Search in sources :

Example 76 with Configuration

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

the class TradfriHandlerTest method configurationOfTradfriGatewayHandler.

private void configurationOfTradfriGatewayHandler() {
    Configuration configuration = bridge.getConfiguration();
    assertThat(configuration, is(notNullValue()));
    assertThat(configuration.get(GATEWAY_CONFIG_HOST), is("1.2.3.4"));
    assertThat(configuration.get(GATEWAY_CONFIG_IDENTITY), is("identity"));
    assertThat(configuration.get(GATEWAY_CONFIG_PRE_SHARED_KEY), is("pre-shared-secret-key"));
}
Also used : Configuration(org.eclipse.smarthome.config.core.Configuration)

Example 77 with Configuration

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

the class TradfriHandlerTest method setUp.

@Before
public void setUp() {
    registerService(volatileStorageService);
    managedThingProvider = getService(ThingProvider.class, ManagedThingProvider.class);
    Map<String, Object> properties = new HashMap<>();
    properties.put(GATEWAY_CONFIG_HOST, "1.2.3.4");
    properties.put(GATEWAY_CONFIG_IDENTITY, "identity");
    properties.put(GATEWAY_CONFIG_PRE_SHARED_KEY, "pre-shared-secret-key");
    bridge = BridgeBuilder.create(GATEWAY_TYPE_UID, "1").withLabel("My Gateway").withConfiguration(new Configuration(properties)).build();
    properties = new HashMap<>();
    properties.put(CONFIG_ID, "65537");
    thing = ThingBuilder.create(THING_TYPE_DIMMABLE_LIGHT, "1").withLabel("My Bulb").withBridge(bridge.getUID()).withConfiguration(new Configuration(properties)).build();
}
Also used : ThingProvider(org.eclipse.smarthome.core.thing.ThingProvider) ManagedThingProvider(org.eclipse.smarthome.core.thing.ManagedThingProvider) Configuration(org.eclipse.smarthome.config.core.Configuration) HashMap(java.util.HashMap) ManagedThingProvider(org.eclipse.smarthome.core.thing.ManagedThingProvider) Before(org.junit.Before)

Example 78 with Configuration

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

the class TradfriHandlerTest method configurationOfTradfriLightHandler.

private void configurationOfTradfriLightHandler() {
    Configuration configuration = thing.getConfiguration();
    assertThat(configuration, is(notNullValue()));
    assertThat(configuration.get(CONFIG_ID), is("65537"));
}
Also used : Configuration(org.eclipse.smarthome.config.core.Configuration)

Example 79 with Configuration

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

the class NtpOSGiTest method testStringChannelDefaultTimeZoneUpdate.

@Test
public void testStringChannelDefaultTimeZoneUpdate() {
    final String expectedTimeZoneEEST = "EEST";
    final String expectedTimeZoneEET = "EET";
    Configuration configuration = new Configuration();
    Configuration channelConfig = new Configuration();
    /*
         * Set the format of the date, so it is updated in the item registry in
         * a format from which we can easily get the time zone.
         */
    channelConfig.put(NtpBindingConstants.PROPERTY_DATE_TIME_FORMAT, TEST_DATE_TIME_FORMAT);
    // Initialize with configuration with no time zone property set.
    initialize(configuration, NtpBindingConstants.CHANNEL_STRING, ACCEPTED_ITEM_TYPE_STRING, null, null);
    String timeZoneFromItemRegistry = getStringChannelTimeZoneFromItemRegistry();
    assertThat(timeZoneFromItemRegistry, is(anyOf(equalTo(expectedTimeZoneEEST), equalTo(expectedTimeZoneEET))));
}
Also used : Configuration(org.eclipse.smarthome.config.core.Configuration) JavaOSGiTest(org.eclipse.smarthome.test.java.JavaOSGiTest) Test(org.junit.Test)

Example 80 with Configuration

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

the class NtpOSGiTest method testDateTimeChannelCalendarTimeZoneUpdate.

@Test
@Ignore("https://github.com/eclipse/smarthome/issues/5224")
public void testDateTimeChannelCalendarTimeZoneUpdate() {
    Configuration configuration = new Configuration();
    configuration.put(NtpBindingConstants.PROPERTY_TIMEZONE, TEST_TIME_ZONE_ID);
    initialize(configuration, NtpBindingConstants.CHANNEL_DATE_TIME, ACCEPTED_ITEM_TYPE_DATE_TIME, null, null);
    ZonedDateTime timeZoneIdFromItemRegistry = ((DateTimeType) getItemState(ACCEPTED_ITEM_TYPE_DATE_TIME)).getZonedDateTime();
    ZoneOffset testZoneId;
    if (timeZoneIdFromItemRegistry.getZone().getRules().isDaylightSavings(timeZoneIdFromItemRegistry.toInstant())) {
        testZoneId = ZoneOffset.of("-07:00");
    } else {
        testZoneId = ZoneOffset.of("-08:00");
    }
    assertEquals(testZoneId, timeZoneIdFromItemRegistry.getOffset());
}
Also used : DateTimeType(org.eclipse.smarthome.core.library.types.DateTimeType) Configuration(org.eclipse.smarthome.config.core.Configuration) ZonedDateTime(java.time.ZonedDateTime) ZoneOffset(java.time.ZoneOffset) Ignore(org.junit.Ignore) JavaOSGiTest(org.eclipse.smarthome.test.java.JavaOSGiTest) Test(org.junit.Test)

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