Search in sources :

Example 91 with Configuration

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();
}
Also used : Configuration(org.eclipse.smarthome.config.core.Configuration) ArtnetBridgeHandler(org.eclipse.smarthome.binding.dmx.handler.ArtnetBridgeHandler) ThingHandlerCallback(org.eclipse.smarthome.core.thing.binding.ThingHandlerCallback) Thing(org.eclipse.smarthome.core.thing.Thing) Before(org.junit.Before)

Example 92 with Configuration

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();
}
Also used : TestBridgeHandler(org.eclipse.smarthome.binding.dmx.test.TestBridgeHandler) Configuration(org.eclipse.smarthome.config.core.Configuration) ThingHandlerCallback(org.eclipse.smarthome.core.thing.binding.ThingHandlerCallback) Thing(org.eclipse.smarthome.core.thing.Thing)

Example 93 with Configuration

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);
}
Also used : Configuration(org.eclipse.smarthome.config.core.Configuration) ChaserThingHandler(org.eclipse.smarthome.binding.dmx.handler.ChaserThingHandler) Nullable(org.eclipse.jdt.annotation.Nullable) Bridge(org.eclipse.smarthome.core.thing.Bridge)

Example 94 with Configuration

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);
}
Also used : ColorThingHandler(org.eclipse.smarthome.binding.dmx.handler.ColorThingHandler) Configuration(org.eclipse.smarthome.config.core.Configuration) Nullable(org.eclipse.jdt.annotation.Nullable) Bridge(org.eclipse.smarthome.core.thing.Bridge) Before(org.junit.Before)

Example 95 with Configuration

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();
}
Also used : Configuration(org.eclipse.smarthome.config.core.Configuration) ThingHandlerCallback(org.eclipse.smarthome.core.thing.binding.ThingHandlerCallback) Thing(org.eclipse.smarthome.core.thing.Thing) Before(org.junit.Before)

Aggregations

Configuration (org.eclipse.smarthome.config.core.Configuration)119 Test (org.junit.Test)27 JavaOSGiTest (org.eclipse.smarthome.test.java.JavaOSGiTest)19 ArrayList (java.util.ArrayList)18 Thing (org.eclipse.smarthome.core.thing.Thing)18 Action (org.eclipse.smarthome.automation.Action)16 Trigger (org.eclipse.smarthome.automation.Trigger)16 Rule (org.eclipse.smarthome.automation.Rule)15 Before (org.junit.Before)14 Condition (org.eclipse.smarthome.automation.Condition)10 Bridge (org.eclipse.smarthome.core.thing.Bridge)9 ApiOperation (io.swagger.annotations.ApiOperation)8 ApiResponses (io.swagger.annotations.ApiResponses)8 HashMap (java.util.HashMap)8 ChannelUID (org.eclipse.smarthome.core.thing.ChannelUID)8 Path (javax.ws.rs.Path)7 IOException (java.io.IOException)6 BigDecimal (java.math.BigDecimal)6 Consumes (javax.ws.rs.Consumes)6 RuleRegistry (org.eclipse.smarthome.automation.RuleRegistry)6