use of org.eclipse.smarthome.core.thing.ChannelUID in project smarthome by eclipse.
the class ThingRegistryOSGiTest method assertThatThingRegistryDelegatesConfigUpdateToThingHandler.
@Test
public void assertThatThingRegistryDelegatesConfigUpdateToThingHandler() {
ThingUID thingUID = new ThingUID("binding:type:thing");
Thing thing = ThingBuilder.create(THING_TYPE_UID, thingUID).build();
ThingHandler thingHandler = new BaseThingHandler(thing) {
@Override
public void handleCommand(@NonNull ChannelUID channelUID, @NonNull Command command) {
}
@Override
public void handleConfigurationUpdate(@NonNull Map<@NonNull String, @NonNull Object> configurationParameters) {
changedParameters = configurationParameters;
}
};
thing.setHandler(thingHandler);
ThingProvider thingProvider = new ThingProvider() {
@Override
public void addProviderChangeListener(ProviderChangeListener<@NonNull Thing> listener) {
}
@Override
public Collection<@NonNull Thing> getAll() {
return Collections.singleton(thing);
}
@Override
public void removeProviderChangeListener(ProviderChangeListener<@NonNull Thing> listener) {
}
};
registerService(thingProvider);
ThingRegistry thingRegistry = getService(ThingRegistry.class);
Map<String, Object> parameters = new HashMap<>();
parameters.put("param1", "value1");
parameters.put("param2", 1);
thingRegistry.updateConfiguration(thingUID, parameters);
assertThat(changedParameters.entrySet(), is(equalTo(parameters.entrySet())));
}
use of org.eclipse.smarthome.core.thing.ChannelUID in project smarthome by eclipse.
the class SystemProfileFactoryTest method testGetSuggestedProfileTypeUID_nullChannelType2.
@Test
public void testGetSuggestedProfileTypeUID_nullChannelType2() {
Channel channel = ChannelBuilder.create(new ChannelUID("test:test:test:test"), CoreItemFactory.SWITCH).build();
assertThat(factory.getSuggestedProfileTypeUID(channel, CoreItemFactory.SWITCH), is(SystemProfiles.DEFAULT));
}
use of org.eclipse.smarthome.core.thing.ChannelUID in project smarthome by eclipse.
the class ThingBuilderTest method testWithChannel_wrongThing.
@Test(expected = IllegalArgumentException.class)
public void testWithChannel_wrongThing() {
ThingBuilder thingBuilder = ThingBuilder.create(THING_TYPE_UID, THING_UID);
thingBuilder.withChannel(ChannelBuilder.create(new ChannelUID(new ThingUID(THING_TYPE_UID, "wrong"), "channel1"), "").build());
}
use of org.eclipse.smarthome.core.thing.ChannelUID in project smarthome by eclipse.
the class ThingBuilderTest method testWithChannels_duplicatesCollections.
@Test(expected = IllegalArgumentException.class)
public void testWithChannels_duplicatesCollections() {
ThingBuilder thingBuilder = ThingBuilder.create(THING_TYPE_UID, THING_UID);
thingBuilder.withChannels(//
Arrays.asList(//
ChannelBuilder.create(new ChannelUID(THING_UID, "channel1"), "").build(), ChannelBuilder.create(new ChannelUID(THING_UID, "channel1"), "").build()));
}
use of org.eclipse.smarthome.core.thing.ChannelUID in project smarthome by eclipse.
the class ThingBuilderTest method testWithChannels_duplicatesVararg.
@Test(expected = IllegalArgumentException.class)
public void testWithChannels_duplicatesVararg() {
ThingBuilder thingBuilder = ThingBuilder.create(THING_TYPE_UID, THING_UID);
//
thingBuilder.withChannels(//
ChannelBuilder.create(new ChannelUID(THING_UID, "channel1"), "").build(), ChannelBuilder.create(new ChannelUID(THING_UID, "channel1"), "").build());
}
Aggregations