Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pluginManagement {
plugins {
id("de.fayard.refreshVersions") version "0.40.1"
}
}

plugins {
id("de.fayard.refreshVersions")
}
5 changes: 5 additions & 0 deletions buildSrc/src/main/kotlin/org.openbase.bco.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ dependencies {
implementation("org.jetbrains.kotlin:kotlin-reflect:1.6.10")
api("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.10")
implementation("org.jetbrains.kotlin:kotlin-script-runtime:1.5.21")
testImplementation("org.junit.jupiter:junit-jupiter:[5.8,5.9-alpha)")
testImplementation ("org.junit.jupiter:junit-jupiter-api:[5.8,5.9-alpha)")
testRuntimeOnly ("org.junit.jupiter:junit-jupiter-engine:[5.8,5.9-alpha)")
}
Expand All @@ -47,6 +48,10 @@ tasks.withType<KotlinCompile> {
tasks.withType<Test> {
useJUnitPlatform()
maxParallelForks = 1
logging.captureStandardOutput(LogLevel.WARN)
maxHeapSize = "7G"
failFast = true
setForkEvery(1)
}

publishing {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
* #L%
*/

import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand All @@ -39,9 +40,6 @@
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.TimeUnit;

import static junit.framework.TestCase.assertEquals;

/**
* @author <a href="mailto:pleminoq@openbase.org">Tamino Huxohl</a>
Expand All @@ -51,14 +49,14 @@ public class ServiceStateTraitMapperFactoryTest extends MqttIntegrationTest {
private static final Logger LOGGER = LoggerFactory.getLogger(ServiceStateTraitMapperFactoryTest.class);

@BeforeEach
public void setUp() throws Exception {
public void setupTest() throws Exception {
MockRegistryHolder.newMockRegistry();

Registries.getTemplateRegistry(true);
}

@AfterEach
public void tearDown() {
public void tearDownTest() {
MockRegistryHolder.shutdownMockRegistry();
}

Expand Down Expand Up @@ -89,7 +87,7 @@ public void testMapperAvailability() {
LOGGER.error(entry.getValue().getMessage());
}

assertEquals("Could not create every needed mapping", 0, mapperExceptionMap.size());
assertEquals(0, mapperExceptionMap.size(), "Could not create every needed mapping");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,15 @@
* #L%
*/



import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.openbase.type.domotic.unit.UnitTemplateType.UnitTemplate.UnitType;

import static org.junit.Assert.assertEquals;


/**
* @author <a href="mailto:pleminoq@openbase.org">Tamino Huxohl</a>
Expand All @@ -49,8 +52,10 @@ public void testUnitTypeValidity() throws IllegalArgumentException {

final UnitType unitType = UnitType.valueOf(unitTypeName);

assertEquals("UnitTypeMapping[" + unitTypeMapping.name() + "] does not match unitType[" + unitType.name() + "]",
unitTypeMapping.getUnitType(), unitType);
Assertions.assertEquals(unitTypeMapping.getUnitType(),
unitType,
"UnitTypeMapping[" + unitTypeMapping.name() + "] does not match unitType[" + unitType.name() + "]"
);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/
import static org.junit.Assert.assertEquals;


import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
import org.openbase.app.test.agent.AbstractBCOAgentManagerTest;
Expand Down Expand Up @@ -112,10 +113,10 @@ public void testAbsenceEnergySavingAgent() throws Exception {
locationStateAwaiter.waitForState((LocationData data) -> data.getPowerState().getValue() == PowerState.State.ON);
colorableLightStateAwaiter.waitForState((ColorableLightData data) -> data.getPowerState().getValue() == PowerState.State.ON);

assertEquals("MotionState of MotionDetector[" + motionDetectorRemote.getLabel() + "] has not switched to NO_MOTION", MotionState.State.MOTION, motionDetectorRemote.getMotionState().getValue());
assertEquals("PresenceState of Location[" + locationRemote.getLabel() + "] has not switched to ABSENT.", PresenceState.State.PRESENT, locationRemote.getPresenceState().getValue());
assertEquals("PowerState of Location[" + locationRemote.getLabel() + "] has not switched to OFF", PowerState.State.ON, locationRemote.getPowerState().getValue());
assertEquals("PowerState of ColorableLight[" + colorableLightRemote.getLabel() + "] has not switched to OFF", PowerState.State.ON, colorableLightRemote.getPowerState().getValue());
assertEquals(MotionState.State.MOTION, motionDetectorRemote.getMotionState().getValue(), "MotionState of MotionDetector[" + motionDetectorRemote.getLabel() + "] has not switched to NO_MOTION");
assertEquals(PresenceState.State.PRESENT, locationRemote.getPresenceState().getValue(), "PresenceState of Location[" + locationRemote.getLabel() + "] has not switched to ABSENT.");
assertEquals(PowerState.State.ON, locationRemote.getPowerState().getValue(), "PowerState of Location[" + locationRemote.getLabel() + "] has not switched to OFF");
assertEquals(PowerState.State.ON, colorableLightRemote.getPowerState().getValue(), "PowerState of ColorableLight[" + colorableLightRemote.getLabel() + "] has not switched to OFF");

// test if on no motion the lights are turned off
motionDetectorController.applyServiceState(NO_MOTION, ServiceType.MOTION_STATE_SERVICE);
Expand All @@ -124,9 +125,9 @@ public void testAbsenceEnergySavingAgent() throws Exception {
colorableLightStateAwaiter.waitForState((ColorableLightData data) -> data.getPowerState().getValue() == PowerState.State.OFF);
//locationStateAwaiter.waitForState((LocationData data) -> data.getPowerState().getValue() == PowerState.State.OFF);

assertEquals("MotionState of MotionDetector[" + motionDetectorRemote.getLabel() + "] has not switched to NO_MOTION", MotionState.State.NO_MOTION, motionDetectorRemote.getMotionState().getValue());
assertEquals("PresenceState of Location[" + locationRemote.getLabel() + "] has not switched to ABSENT.", PresenceState.State.ABSENT, locationRemote.getPresenceState().getValue());
assertEquals("PowerState of ColorableLight[" + colorableLightRemote.getLabel() + "] has not switched to OFF", PowerState.State.OFF, colorableLightRemote.getPowerState().getValue());
assertEquals(MotionState.State.NO_MOTION, motionDetectorRemote.getMotionState().getValue(), "MotionState of MotionDetector[" + motionDetectorRemote.getLabel() + "] has not switched to NO_MOTION");
assertEquals(PresenceState.State.ABSENT, locationRemote.getPresenceState().getValue(), "PresenceState of Location[" + locationRemote.getLabel() + "] has not switched to ABSENT.");
assertEquals(PowerState.State.OFF, colorableLightRemote.getPowerState().getValue(), "PowerState of ColorableLight[" + colorableLightRemote.getLabel() + "] has not switched to OFF");
//assertEquals("PowerState of Location[" + locationRemote.getLabel() + "] has not switched to OFF", PowerState.State.OFF, locationRemote.getPowerState().getValue());

// test if the lights stay off on new motion
Expand All @@ -136,9 +137,9 @@ public void testAbsenceEnergySavingAgent() throws Exception {
colorableLightStateAwaiter.waitForState((ColorableLightData data) -> data.getPowerState().getValue() == PowerState.State.OFF);
//locationStateAwaiter.waitForState((LocationData data) -> data.getPowerState().getValue() == PowerState.State.OFF);

assertEquals("MotionState of MotionDetector[" + motionDetectorRemote.getLabel() + "] has not switched to MOTION", MotionState.State.MOTION, motionDetectorRemote.getMotionState().getValue());
assertEquals("PresenceState of Location[" + locationRemote.getLabel() + "] has not switched to PRESENT.", PresenceState.State.PRESENT, locationRemote.getPresenceState().getValue());
assertEquals("PowerState of ColorableLight[" + colorableLightRemote.getLabel() + "] has changes without intention", PowerState.State.OFF, colorableLightRemote.getPowerState().getValue());
assertEquals(MotionState.State.MOTION, motionDetectorRemote.getMotionState().getValue(), "MotionState of MotionDetector[" + motionDetectorRemote.getLabel() + "] has not switched to MOTION");
assertEquals(PresenceState.State.PRESENT, locationRemote.getPresenceState().getValue(), "PresenceState of Location[" + locationRemote.getLabel() + "] has not switched to PRESENT.");
assertEquals(PowerState.State.OFF, colorableLightRemote.getPowerState().getValue(), "PowerState of ColorableLight[" + colorableLightRemote.getLabel() + "] has changes without intention");
//assertEquals("PowerState of Location[" + locationRemote.getLabel() + "] has changes without intention", PowerState.State.OFF, locationRemote.getPowerState().getValue());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/

import static org.junit.jupiter.api.Assertions.*;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
import org.openbase.app.test.agent.AbstractBCOAgentManagerTest;
Expand All @@ -46,7 +49,7 @@
import org.openbase.type.domotic.unit.dal.SmokeDetectorDataType.SmokeDetectorData;
import org.openbase.type.domotic.unit.location.LocationDataType.LocationData;

import static org.junit.Assert.assertEquals;


public class FireAlarmAgentTest extends AbstractBCOAgentManagerTest {

Expand Down Expand Up @@ -92,10 +95,10 @@ public void testFireAlarmAgent() throws Exception {
locationStateAwaiter.waitForState((LocationData data) -> data.getPowerState().getValue() == PowerState.State.OFF);
colorableLightStateAwaiter.waitForState((ColorableLightData data) -> data.getPowerState().getValue() == PowerState.State.OFF);

assertEquals("Initial SmokeAlarmState of SmokeDetector[" + smokeDetectorRemote.getLabel() + "] is not NO_ALARM", AlarmState.State.NO_ALARM, smokeDetectorRemote.getSmokeAlarmState().getValue());
assertEquals("Initial OpeningRatio of Blindstate of Rollershutter[" + rollerShutterRemote.getLabel() + "] is not 0.0", 0d, rollerShutterRemote.getBlindState().getOpeningRatio(), 0.001);
assertEquals("Initial PowerState of ColorableLight[" + colorableLightRemote.getLabel() + "] is not OFF", PowerState.State.OFF, colorableLightRemote.getPowerState().getValue());
assertEquals("Initial PowerState of Location[" + locationRemote.getLabel() + "] is not OFF", PowerState.State.OFF, locationRemote.getPowerState().getValue());
assertEquals(AlarmState.State.NO_ALARM, smokeDetectorRemote.getSmokeAlarmState().getValue(), "Initial SmokeAlarmState of SmokeDetector[" + smokeDetectorRemote.getLabel() + "] is not NO_ALARM");
assertEquals(0d, rollerShutterRemote.getBlindState().getOpeningRatio(), 0.001, "Initial OpeningRatio of Blindstate of Rollershutter[" + rollerShutterRemote.getLabel() + "] is not 0.0");
assertEquals(PowerState.State.OFF, colorableLightRemote.getPowerState().getValue(), "Initial PowerState of ColorableLight[" + colorableLightRemote.getLabel() + "] is not OFF");
assertEquals(PowerState.State.OFF, locationRemote.getPowerState().getValue(), "Initial PowerState of Location[" + locationRemote.getLabel() + "] is not OFF");

// test if on alarm the lights are turned on
smokeDetectorController.applyServiceState(ALARM, ServiceType.SMOKE_ALARM_STATE_SERVICE);
Expand All @@ -105,11 +108,11 @@ public void testFireAlarmAgent() throws Exception {
rollerShutterStateAwaiter.waitForState((RollerShutterData data) -> data.getBlindState().getOpeningRatio() == 1.0d && data.getBlindState().getValue() == State.UP);
locationStateAwaiter.waitForState((LocationData data) -> data.getPowerState().getValue() == PowerState.State.ON);

assertEquals("SmokeAlarmState of SmokeDetector[" + smokeDetectorRemote.getLabel() + "] has not switched to ALARM", AlarmState.State.ALARM, smokeDetectorRemote.getSmokeAlarmState().getValue());
assertEquals("OpeningRatio of Blindstate of Rollershutter[" + rollerShutterRemote.getLabel() + "] has not switched to 100", 1.0d, rollerShutterRemote.getBlindState().getOpeningRatio(), 0.001);
assertEquals("SmokeAlarmState of Location[" + locationRemote.getLabel() + "] has not switched to ALARM.", AlarmState.State.ALARM, locationRemote.getSmokeAlarmState().getValue());
assertEquals("PowerState of ColorableLight[" + colorableLightRemote.getLabel() + "] has not switched to ON", PowerState.State.ON, colorableLightRemote.getPowerState().getValue());
assertEquals("PowerState of Location[" + locationRemote.getLabel() + "] has not switched to ON", PowerState.State.ON, locationRemote.getPowerState().getValue());
assertEquals(AlarmState.State.ALARM, smokeDetectorRemote.getSmokeAlarmState().getValue(), "SmokeAlarmState of SmokeDetector[" + smokeDetectorRemote.getLabel() + "] has not switched to ALARM");
assertEquals(1.0d, rollerShutterRemote.getBlindState().getOpeningRatio(), 0.001, "OpeningRatio of Blindstate of Rollershutter[" + rollerShutterRemote.getLabel() + "] has not switched to 100");
assertEquals(AlarmState.State.ALARM, locationRemote.getSmokeAlarmState().getValue(), "SmokeAlarmState of Location[" + locationRemote.getLabel() + "] has not switched to ALARM.");
assertEquals(PowerState.State.ON, colorableLightRemote.getPowerState().getValue(), "PowerState of ColorableLight[" + colorableLightRemote.getLabel() + "] has not switched to ON");
assertEquals(PowerState.State.ON, locationRemote.getPowerState().getValue(), "PowerState of Location[" + locationRemote.getLabel() + "] has not switched to ON");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
* #L%
*/

import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Timeout;
import org.openbase.app.test.agent.AbstractBCOAgentManagerTest;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -49,7 +50,7 @@
import org.openbase.type.domotic.unit.dal.TemperatureControllerDataType.TemperatureControllerData;
import org.openbase.type.domotic.unit.location.LocationDataType.LocationData;

import static org.junit.Assert.assertEquals;


/**
* * @author <a href="mailto:tmichalski@techfak.uni-bielefeld.de">Timo
Expand Down Expand Up @@ -80,8 +81,8 @@ public void testHeaterEnergySavingAgent() throws Exception {
TemperatureControllerController temperatureController = (TemperatureControllerController) deviceManagerLauncher.getLaunchable().getUnitControllerRegistry().get(temperatureControllerRemote.getId());

// validate remote controller match
assertEquals("Controller and remote are not compatible to each other!", reedContactController.getId(), reedContactRemote.getId());
assertEquals("Reed contact is not connected to window.", connectionRemote.getConfig().getConnectionConfig().getUnitIdList().contains(reedContactRemote.getId()), true);
assertEquals(reedContactController.getId(), reedContactRemote.getId(), "Controller and remote are not compatible to each other!");
assertEquals(connectionRemote.getConfig().getConnectionConfig().getUnitIdList().contains(reedContactRemote.getId()), true, "Reed contact is not connected to window.");

UnitStateAwaiter<ReedContactData, ReedContactRemote> reedContactStateAwaiter = new UnitStateAwaiter<>(reedContactRemote);
UnitStateAwaiter<ConnectionData, ConnectionRemote> connectionStateAwaiter = new UnitStateAwaiter<>(connectionRemote);
Expand All @@ -97,10 +98,10 @@ public void testHeaterEnergySavingAgent() throws Exception {
temperatureControllerStateAwaiter.waitForState((TemperatureControllerData data) -> data.getTargetTemperatureState().getTemperature() == 21.0);
locationStateAwaiter.waitForState((LocationData data) -> data.getTargetTemperatureState().getTemperature() == 21.0);

assertEquals("Initial ContactState of ReedContact[" + reedContactRemote.getLabel() + "] is not CLOSED", ContactState.State.CLOSED, reedContactRemote.getContactState().getValue());
assertEquals("Initial ContactState of Connection[" + connectionRemote.getLabel() + "] is not CLOSED", WindowState.State.CLOSED, connectionRemote.getWindowState().getValue());
assertEquals("Initial TargetTemperature of TemperatureController[" + temperatureControllerRemote.getLabel() + "] is not 21.0", 21.0, temperatureControllerRemote.getTargetTemperatureState().getTemperature(), 1.0);
assertEquals("Initial TargetTemperature of location[" + locationRemote.getLabel() + "] is not 21.0", 21.0, locationRemote.getTargetTemperatureState().getTemperature(), 1.0);
assertEquals(ContactState.State.CLOSED, reedContactRemote.getContactState().getValue(), "Initial ContactState of ReedContact[" + reedContactRemote.getLabel() + "] is not CLOSED");
assertEquals(WindowState.State.CLOSED, connectionRemote.getWindowState().getValue(), "Initial ContactState of Connection[" + connectionRemote.getLabel() + "] is not CLOSED");
assertEquals(21.0, temperatureControllerRemote.getTargetTemperatureState().getTemperature(), 1.0, "Initial TargetTemperature of TemperatureController[" + temperatureControllerRemote.getLabel() + "] is not 21.0");
assertEquals(21.0, locationRemote.getTargetTemperatureState().getTemperature(), 1.0, "Initial TargetTemperature of location[" + locationRemote.getLabel() + "] is not 21.0");

// test if on open reed sensor target temperature is set to 13.0
reedContactController.applyServiceState(States.Contact.OPEN, ServiceType.CONTACT_STATE_SERVICE);
Expand All @@ -109,10 +110,10 @@ public void testHeaterEnergySavingAgent() throws Exception {
temperatureControllerStateAwaiter.waitForState((TemperatureControllerData data) -> data.getTargetTemperatureState().getTemperature() == 13.0);
locationStateAwaiter.waitForState((LocationData data) -> data.getTargetTemperatureState().getTemperature() == 13.0);

assertEquals("ContactState of ReedContact[" + reedContactRemote.getLabel() + "] has not switched to OPEN", ContactState.State.OPEN, reedContactRemote.getContactState().getValue());
assertEquals("ContactState of Connection[" + connectionRemote.getLabel() + "] has not switched to OPEN", WindowState.State.OPEN, connectionRemote.getWindowState().getValue());
assertEquals("TargetTemperature of TemperatureController[" + temperatureControllerRemote.getLabel() + "] has not switched to 13.0", 13.0, temperatureControllerRemote.getTargetTemperatureState().getTemperature(), 1.0);
assertEquals("TargetTemperature of location[" + locationRemote.getLabel() + "] has not switched to 13.0", 13.0, locationRemote.getTargetTemperatureState().getTemperature(), 1.0);
assertEquals(ContactState.State.OPEN, reedContactRemote.getContactState().getValue(), "ContactState of ReedContact[" + reedContactRemote.getLabel() + "] has not switched to OPEN");
assertEquals(WindowState.State.OPEN, connectionRemote.getWindowState().getValue(), "ContactState of Connection[" + connectionRemote.getLabel() + "] has not switched to OPEN");
assertEquals(13.0, temperatureControllerRemote.getTargetTemperatureState().getTemperature(), 1.0, "TargetTemperature of TemperatureController[" + temperatureControllerRemote.getLabel() + "] has not switched to 13.0");
assertEquals(13.0, locationRemote.getTargetTemperatureState().getTemperature(), 1.0, "TargetTemperature of location[" + locationRemote.getLabel() + "] has not switched to 13.0");

// Obsoled as functionality of HeaterEnergySavingAgent was reduced
// // test if on closed reedsensor target temperature is set back to 21.0
Expand Down
Loading