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"));
}
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();
}
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"));
}
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))));
}
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());
}
Aggregations