use of org.eclipse.smarthome.core.thing.ChannelUID in project smarthome by eclipse.
the class FSInternetRadioHandlerJavaTest method playInfoTextChannelUpdated.
/**
* Verify the playInfoText channel is updated.
*/
@Test
public void playInfoTextChannelUpdated() {
String playInfoTextChannelID = FSInternetRadioBindingConstants.CHANNEL_PLAY_INFO_TEXT;
String acceptedItemType = acceptedItemTypes.get(playInfoTextChannelID);
createChannel(DEFAULT_THING_UID, playInfoTextChannelID, acceptedItemType);
Thing radioThing = initializeRadioThingWithMockedHandler(DEFAULT_COMPLETE_CONFIGURATION);
testRadioThingConsideringConfiguration(radioThing);
turnTheRadioOn(radioThing);
ChannelUID playInfoTextChannelUID = getChannelUID(radioThing, FSInternetRadioBindingConstants.CHANNEL_PLAY_INFO_TEXT);
initializeItem(playInfoTextChannelUID, DEFAULT_TEST_ITEM_NAME, acceptedItemType);
waitForAssert(() -> {
verifyOnlineStatusIsSet();
});
}
use of org.eclipse.smarthome.core.thing.ChannelUID in project smarthome by eclipse.
the class FSInternetRadioHandlerJavaTest method volumeChannelUpdatedAbsUpDown.
/**
* Verify the volume is updated through the CHANNEL_VOLUME_ABSOLUTE using UP and DOWN commands.
*/
@Test
public void volumeChannelUpdatedAbsUpDown() {
String absoluteVolumeChannelID = FSInternetRadioBindingConstants.CHANNEL_VOLUME_ABSOLUTE;
String absoluteAcceptedItemType = acceptedItemTypes.get(absoluteVolumeChannelID);
createChannel(DEFAULT_THING_UID, absoluteVolumeChannelID, absoluteAcceptedItemType);
Thing radioThing = initializeRadioThing(DEFAULT_COMPLETE_CONFIGURATION);
testRadioThingConsideringConfiguration(radioThing);
turnTheRadioOn(radioThing);
ChannelUID absoluteVolumeChannelUID = getChannelUID(radioThing, absoluteVolumeChannelID);
Item volumeTestItem = initializeItem(absoluteVolumeChannelUID, DEFAULT_TEST_ITEM_NAME, absoluteAcceptedItemType);
testChannelWithUPAndDOWNCommands(absoluteVolumeChannelUID, volumeTestItem);
}
use of org.eclipse.smarthome.core.thing.ChannelUID in project smarthome by eclipse.
the class FSInternetRadioHandlerJavaTest method getChannelUID.
@NonNull
private static ChannelUID getChannelUID(@NonNull final Thing thing, @NonNull final String channelId) {
final ChannelUID channelUID = getChannel(thing, channelId).getUID();
Assert.assertNotNull(channelUID);
return channelUID;
}
use of org.eclipse.smarthome.core.thing.ChannelUID in project smarthome by eclipse.
the class FSInternetRadioHandlerJavaTest method httpStatusNokHandling.
/**
* Verify the HTTP status is handled correctly when it is not OK_200.
*/
@Test
public void httpStatusNokHandling() {
// create a thing with two channels - the power channel and any of the others
String modeChannelID = FSInternetRadioBindingConstants.CHANNEL_MODE;
String acceptedItemType = acceptedItemTypes.get(modeChannelID);
createChannel(DEFAULT_THING_UID, modeChannelID, acceptedItemType);
Thing radioThing = initializeRadioThing(DEFAULT_COMPLETE_CONFIGURATION);
testRadioThingConsideringConfiguration(radioThing);
// turn-on the radio
turnTheRadioOn(radioThing);
/*
* Setting the needed boolean variable to false, so we can be sure
* that the XML response won't have a OK_200 status
*/
ChannelUID modeChannelUID = getChannelUID(radioThing, modeChannelID);
Item modeTestItem = initializeItem(modeChannelUID, CHANNEL_MODE, acceptedItemType);
// try to handle a command
radioHandler.handleCommand(modeChannelUID, DecimalType.valueOf("1"));
waitForAssert(() -> {
assertSame(UnDefType.NULL, modeTestItem.getState());
});
}
Aggregations