use of org.eclipse.smarthome.config.core.Configuration in project smarthome by eclipse.
the class ArtnetBridgeHandlerTest method setUp.
@Before
public void setUp() {
bridgeProperties = new HashMap<>();
bridgeProperties.put(CONFIG_ADDRESS, TEST_ADDRESS);
bridgeProperties.put(CONFIG_UNIVERSE, TEST_UNIVERSE);
bridge = BridgeBuilder.create(THING_TYPE_ARTNET_BRIDGE, "artnetbridge").withLabel("Artnet Bridge").withChannel(ChannelBuilder.create(CHANNEL_UID_MUTE, "Switch").withType(MUTE_CHANNEL_TYPEUID).build()).withConfiguration(new Configuration(bridgeProperties)).build();
ThingHandlerCallback mockCallback = mock(ThingHandlerCallback.class);
doAnswer(answer -> {
((Thing) answer.getArgument(0)).setStatusInfo(answer.getArgument(1));
return null;
}).when(mockCallback).statusUpdated(any(), any());
bridgeHandler = new ArtnetBridgeHandler(bridge) {
@Override
protected void validateConfigurationParameters(Map<String, Object> configurationParameters) {
}
};
bridgeHandler.getThing().setHandler(bridgeHandler);
bridgeHandler.setCallback(mockCallback);
bridgeHandler.initialize();
}
use of org.eclipse.smarthome.config.core.Configuration in project smarthome by eclipse.
the class ChaserThingHandlerTest method initializeTestBridge.
private void initializeTestBridge() {
bridgeProperties = new HashMap<>();
bridge = BridgeBuilder.create(THING_TYPE_TEST_BRIDGE, "testbridge").withLabel("Test Bridge").withConfiguration(new Configuration(bridgeProperties)).build();
dmxBridgeHandler = new TestBridgeHandler(bridge);
bridge.setHandler(dmxBridgeHandler);
ThingHandlerCallback bridgeHandler = mock(ThingHandlerCallback.class);
doAnswer(answer -> {
((Thing) answer.getArgument(0)).setStatusInfo(answer.getArgument(1));
return null;
}).when(bridgeHandler).statusUpdated(any(), any());
dmxBridgeHandler.setCallback(bridgeHandler);
dmxBridgeHandler.initialize();
}
use of org.eclipse.smarthome.config.core.Configuration in project smarthome by eclipse.
the class ChaserThingHandlerTest method initialize.
private void initialize() {
chaserThing = ThingBuilder.create(THING_TYPE_CHASER, "testchaser").withLabel("Chaser Thing").withBridge(bridge.getUID()).withConfiguration(new Configuration(thingProperties)).withChannel(ChannelBuilder.create(CHANNEL_UID_SWITCH, "Switch").withType(SWITCH_CHANNEL_TYPEUID).build()).build();
chaserThingHandler = new ChaserThingHandler(chaserThing) {
@Override
@Nullable
protected Bridge getBridge() {
return bridge;
}
};
initializeHandler(chaserThingHandler);
}
use of org.eclipse.smarthome.config.core.Configuration in project smarthome by eclipse.
the class ColorThingHandlerTest method setUp.
@Before
public void setUp() {
super.setup();
thingProperties = new HashMap<>();
thingProperties.put(CONFIG_DMX_ID, TEST_CHANNEL_CONFIG);
thingProperties.put(CONFIG_DIMMER_FADE_TIME, TEST_FADE_TIME);
thingProperties.put(CONFIG_DIMMER_TURNONVALUE, "255,128,0");
dimmerThing = ThingBuilder.create(THING_TYPE_COLOR, "testdimmer").withLabel("Dimmer Thing").withBridge(bridge.getUID()).withConfiguration(new Configuration(thingProperties)).withChannel(ChannelBuilder.create(CHANNEL_UID_BRIGHTNESS_R, "Brightness R").withType(BRIGHTNESS_CHANNEL_TYPEUID).build()).withChannel(ChannelBuilder.create(CHANNEL_UID_BRIGHTNESS_G, "Brightness G").withType(BRIGHTNESS_CHANNEL_TYPEUID).build()).withChannel(ChannelBuilder.create(CHANNEL_UID_BRIGHTNESS_B, "Brightness B").withType(BRIGHTNESS_CHANNEL_TYPEUID).build()).withChannel(ChannelBuilder.create(CHANNEL_UID_COLOR, "Color").withType(COLOR_CHANNEL_TYPEUID).build()).build();
dimmerThingHandler = new ColorThingHandler(dimmerThing) {
@Override
@Nullable
protected Bridge getBridge() {
return bridge;
}
};
initializeHandler(dimmerThingHandler);
}
use of org.eclipse.smarthome.config.core.Configuration in project smarthome by eclipse.
the class DmxBridgeHandlerTest method setUp.
@Before
public void setUp() {
bridgeProperties = new HashMap<>();
bridge = BridgeBuilder.create(THING_TYPE_TEST_BRIDGE, "testbridge").withLabel("Test Bridge").withChannel(ChannelBuilder.create(CHANNEL_UID_MUTE, "Switch").withType(MUTE_CHANNEL_TYPEUID).build()).withConfiguration(new Configuration(bridgeProperties)).build();
ThingHandlerCallback mockCallback = mock(ThingHandlerCallback.class);
doAnswer(answer -> {
((Thing) answer.getArgument(0)).setStatusInfo(answer.getArgument(1));
return null;
}).when(mockCallback).statusUpdated(any(), any());
bridgeHandler = Mockito.spy(new DmxBridgeHandlerImpl(bridge));
bridgeHandler.getThing().setHandler(bridgeHandler);
bridgeHandler.setCallback(mockCallback);
bridgeHandler.initialize();
}
Aggregations