use of org.eclipse.smarthome.core.thing.ChannelUID in project smarthome by eclipse.
the class FSInternetRadioHandlerJavaTest method volumeChannelUpdatedPercUpDown.
/**
* Verify the volume is updated through the CHANNEL_VOLUME_PERCENT using UP and DOWN commands.
*/
@Test
public void volumeChannelUpdatedPercUpDown() {
/*
* 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);
testChannelWithUPAndDOWNCommands(percentVolumeChannelUID, volumeTestItem);
}
use of org.eclipse.smarthome.core.thing.ChannelUID 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.ChannelUID 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.ChannelUID in project smarthome by eclipse.
the class ChaserThingHandlerTest method holdInfiniteChaser.
@Test
public void holdInfiniteChaser() {
initializeTestBridge();
thingProperties.put(CONFIG_CHASER_STEPS, TEST_STEPS_INFINITE);
initialize();
long currentTime = System.currentTimeMillis();
chaserThingHandler.handleCommand(new ChannelUID(chaserThing.getUID(), CHANNEL_SWITCH), OnOffType.ON);
// step I
currentTime = dmxBridgeHandler.calcBuffer(currentTime, 1000);
waitForAssert(() -> assertThat(dmxBridgeHandler.getDmxChannelValue(100), is(equalTo(100))));
currentTime = dmxBridgeHandler.calcBuffer(currentTime, 1000);
waitForAssert(() -> assertThat(dmxBridgeHandler.getDmxChannelValue(100), is(equalTo(100))));
// step II (holds forever)
currentTime = dmxBridgeHandler.calcBuffer(currentTime, 1000);
waitForAssert(() -> assertThat(dmxBridgeHandler.getDmxChannelValue(100), is(equalTo(200))));
currentTime = dmxBridgeHandler.calcBuffer(currentTime, 2000);
waitForAssert(() -> assertThat(dmxBridgeHandler.getDmxChannelValue(100), is(equalTo(200))));
}
use of org.eclipse.smarthome.core.thing.ChannelUID in project smarthome by eclipse.
the class ChaserThingHandlerTest method runningChaserWithResume.
@Test
public void runningChaserWithResume() {
initializeTestBridge();
thingProperties.put(CONFIG_CHASER_STEPS, TEST_STEPS_REPEAT);
thingProperties.put(CONFIG_CHASER_RESUME_AFTER, true);
initialize();
dmxBridgeHandler.setDmxChannelValue(100, 193);
long currentTime = System.currentTimeMillis();
currentTime = dmxBridgeHandler.calcBuffer(currentTime, 0);
waitForAssert(() -> assertThat(dmxBridgeHandler.getDmxChannelValue(100), is(equalTo(193))));
chaserThingHandler.handleCommand(new ChannelUID(chaserThing.getUID(), CHANNEL_SWITCH), OnOffType.ON);
// step I
currentTime = dmxBridgeHandler.calcBuffer(currentTime, 1000);
waitForAssert(() -> assertThat(dmxBridgeHandler.getDmxChannelValue(100), is(equalTo(115))));
currentTime = dmxBridgeHandler.calcBuffer(currentTime, 1000);
waitForAssert(() -> assertThat(dmxBridgeHandler.getDmxChannelValue(100), is(equalTo(115))));
// step II
currentTime = dmxBridgeHandler.calcBuffer(currentTime, 1000);
waitForAssert(() -> assertThat(dmxBridgeHandler.getDmxChannelValue(100), is(equalTo(210))));
currentTime = dmxBridgeHandler.calcBuffer(currentTime, 1000);
waitForAssert(() -> assertThat(dmxBridgeHandler.getDmxChannelValue(100), is(equalTo(210))));
// resume old state
currentTime = dmxBridgeHandler.calcBuffer(currentTime, 1000);
waitForAssert(() -> assertThat(dmxBridgeHandler.getDmxChannelValue(100), is(equalTo(193))));
}
Aggregations