Search in sources :

Example 96 with Configuration

use of org.eclipse.smarthome.config.core.Configuration in project smarthome by eclipse.

the class SacnBridgeHandlerTest method setUp.

@Before
public void setUp() {
    bridgeProperties = new HashMap<>();
    bridgeProperties.put(CONFIG_ADDRESS, TEST_ADDRESS);
    bridgeProperties.put(CONFIG_UNIVERSE, TEST_UNIVERSE);
    bridgeProperties.put(CONFIG_SACN_MODE, "unicast");
    bridge = BridgeBuilder.create(THING_TYPE_SACN_BRIDGE, "sacnbridge").withLabel("sACN 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 SacnBridgeHandler(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) ThingHandlerCallback(org.eclipse.smarthome.core.thing.binding.ThingHandlerCallback) SacnBridgeHandler(org.eclipse.smarthome.binding.dmx.handler.SacnBridgeHandler) Thing(org.eclipse.smarthome.core.thing.Thing) Before(org.junit.Before)

Example 97 with Configuration

use of org.eclipse.smarthome.config.core.Configuration in project smarthome by eclipse.

the class TunableWhiteThingHandlerTest 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, "127,127");
    dimmerThing = ThingBuilder.create(THING_TYPE_TUNABLEWHITE, "testdimmer").withLabel("Dimmer Thing").withBridge(bridge.getUID()).withConfiguration(new Configuration(thingProperties)).withChannel(ChannelBuilder.create(CHANNEL_UID_BRIGHTNESS, "Brightness").withType(BRIGHTNESS_CHANNEL_TYPEUID).build()).withChannel(ChannelBuilder.create(CHANNEL_UID_BRIGHTNESS_CW, "Brightness CW").withType(BRIGHTNESS_CHANNEL_TYPEUID).build()).withChannel(ChannelBuilder.create(CHANNEL_UID_BRIGHTNESS_WW, "Brightness WW").withType(BRIGHTNESS_CHANNEL_TYPEUID).build()).withChannel(ChannelBuilder.create(CHANNEL_UID_COLOR_TEMP, "Color temperature").withType(COLOR_TEMPERATURE_CHANNEL_TYPEUID).build()).build();
    dimmerThingHandler = new TunableWhiteThingHandler(dimmerThing) {

        @Override
        @Nullable
        protected Bridge getBridge() {
            return bridge;
        }
    };
    initializeHandler(dimmerThingHandler);
}
Also used : TunableWhiteThingHandler(org.eclipse.smarthome.binding.dmx.handler.TunableWhiteThingHandler) 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 98 with Configuration

use of org.eclipse.smarthome.config.core.Configuration in project smarthome by eclipse.

the class RuleTemplateRegistry method copyActions.

private List<Action> copyActions(List<Action> actions) {
    List<Action> res = new ArrayList<Action>();
    if (actions != null) {
        for (Action a : actions) {
            Configuration c = new Configuration();
            c.setProperties(a.getConfiguration().getProperties());
            Action action = new Action(a.getId(), a.getTypeUID(), c, a.getInputs());
            action.setLabel(a.getLabel());
            action.setDescription(a.getDescription());
            res.add(action);
        }
    }
    return res;
}
Also used : Action(org.eclipse.smarthome.automation.Action) Configuration(org.eclipse.smarthome.config.core.Configuration) ArrayList(java.util.ArrayList)

Example 99 with Configuration

use of org.eclipse.smarthome.config.core.Configuration in project smarthome by eclipse.

the class ModuleTypeRegistryImpl method copyConditions.

private static List<Condition> copyConditions(List<Condition> conditions) {
    List<Condition> res = new ArrayList<Condition>(11);
    if (conditions != null) {
        for (Condition c : conditions) {
            Configuration conf = new Configuration();
            conf.setProperties(c.getConfiguration().getProperties());
            Condition condition = new Condition(c.getId(), c.getTypeUID(), conf, new HashMap<String, String>(c.getInputs()));
            condition.setLabel(condition.getLabel());
            condition.setDescription(condition.getDescription());
            res.add(condition);
        }
    }
    return res;
}
Also used : Condition(org.eclipse.smarthome.automation.Condition) Configuration(org.eclipse.smarthome.config.core.Configuration) ArrayList(java.util.ArrayList)

Example 100 with Configuration

use of org.eclipse.smarthome.config.core.Configuration in project smarthome by eclipse.

the class ModuleTypeRegistryImpl method copyActions.

private static List<Action> copyActions(List<Action> actions) {
    List<Action> res = new ArrayList<Action>();
    if (actions != null) {
        for (Action a : actions) {
            Configuration c = new Configuration();
            c.setProperties(a.getConfiguration().getProperties());
            Action action = new Action(a.getId(), a.getTypeUID(), c, a.getInputs());
            action.setLabel(a.getLabel());
            action.setDescription(a.getDescription());
            res.add(action);
        }
    }
    return res;
}
Also used : Action(org.eclipse.smarthome.automation.Action) Configuration(org.eclipse.smarthome.config.core.Configuration) ArrayList(java.util.ArrayList)

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