use of org.eclipse.smarthome.core.thing.Thing in project smarthome by eclipse.
the class FSInternetRadioHandlerJavaTest method presetChannelUpdated.
/**
* Verify the preset channel is updated.
*/
@Test
public void presetChannelUpdated() {
String presetChannelID = FSInternetRadioBindingConstants.CHANNEL_PRESET;
String acceptedItemType = acceptedItemTypes.get(presetChannelID);
createChannel(DEFAULT_THING_UID, presetChannelID, acceptedItemType);
Thing radioThing = initializeRadioThing(DEFAULT_COMPLETE_CONFIGURATION);
testRadioThingConsideringConfiguration(radioThing);
turnTheRadioOn(radioThing);
ChannelUID presetChannelUID = getChannelUID(radioThing, FSInternetRadioBindingConstants.CHANNEL_PRESET);
initializeItem(presetChannelUID, DEFAULT_TEST_ITEM_NAME, acceptedItemType);
radioHandler.handleCommand(presetChannelUID, DecimalType.valueOf("100"));
waitForAssert(() -> {
assertTrue("We should be able to set value to the preset", radioServiceDummy.containsRequestParameter(100, PRESET));
radioServiceDummy.clearRequestParameters();
});
}
use of org.eclipse.smarthome.core.thing.Thing in project smarthome by eclipse.
the class FSInternetRadioHandlerJavaTest method volumeChannelUpdatedPercIncDec.
/**
* Verify the volume is updated through the CHANNEL_VOLUME_PERCENT using INCREASE and DECREASE commands.
*/
@Test
public void volumeChannelUpdatedPercIncDec() {
/*
* The volume is set through the CHANNEL_VOLUME_PERCENT in order to check if
* the absolute volume will be updated properly.
*/
String absoluteVolumeChannelID = FSInternetRadioBindingConstants.CHANNEL_VOLUME_ABSOLUTE;
String absoluteAcceptedItemType = acceptedItemTypes.get(absoluteVolumeChannelID);
createChannel(DEFAULT_THING_UID, absoluteVolumeChannelID, absoluteAcceptedItemType);
String percentVolumeChannelID = FSInternetRadioBindingConstants.CHANNEL_VOLUME_PERCENT;
String percentAcceptedItemType = acceptedItemTypes.get(percentVolumeChannelID);
createChannel(DEFAULT_THING_UID, percentVolumeChannelID, percentAcceptedItemType);
Thing radioThing = initializeRadioThing(DEFAULT_COMPLETE_CONFIGURATION);
testRadioThingConsideringConfiguration(radioThing);
turnTheRadioOn(radioThing);
ChannelUID absoluteVolumeChannelUID = getChannelUID(radioThing, absoluteVolumeChannelID);
Item volumeTestItem = initializeItem(absoluteVolumeChannelUID, DEFAULT_TEST_ITEM_NAME, absoluteAcceptedItemType);
ChannelUID percentVolumeChannelUID = getChannelUID(radioThing, percentVolumeChannelID);
testChannelWithINCREASEAndDECREASECommands(percentVolumeChannelUID, volumeTestItem);
}
use of org.eclipse.smarthome.core.thing.Thing in project smarthome by eclipse.
the class FSInternetRadioHandlerJavaTest method verifyOnlineStatus.
/**
* Verify ONLINE status of a Thing with complete configuration.
*/
@Test
public void verifyOnlineStatus() {
Thing radioThing = initializeRadioThing(DEFAULT_COMPLETE_CONFIGURATION);
testRadioThingConsideringConfiguration(radioThing);
}
use of org.eclipse.smarthome.core.thing.Thing in project smarthome by eclipse.
the class AbstractDmxThingTest method initializeBridge.
private void initializeBridge() {
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();
}
use of org.eclipse.smarthome.core.thing.Thing in project smarthome by eclipse.
the class Lib485BridgeHandlerTest method setUp.
@Before
public void setUp() {
bridgeProperties = new HashMap<>();
bridgeProperties.put(CONFIG_ADDRESS, TEST_ADDRESS);
bridge = BridgeBuilder.create(THING_TYPE_LIB485_BRIDGE, "lib485bridge").withLabel("Lib485 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 Lib485BridgeHandler(bridge) {
@Override
protected void validateConfigurationParameters(Map<String, Object> configurationParameters) {
}
};
bridgeHandler.getThing().setHandler(bridgeHandler);
bridgeHandler.setCallback(mockCallback);
bridgeHandler.initialize();
}
Aggregations