use of org.eclipse.smarthome.core.thing.Thing 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.Thing in project smarthome by eclipse.
the class FSInternetRadioHandlerJavaTest method offlineIfNullIp.
/**
* Verify OFFLINE Thing status when the IP is NULL.
*/
@Test
public void offlineIfNullIp() {
Configuration config = createConfiguration(null, DEFAULT_CONFIG_PROPERTY_PIN, String.valueOf(DEFAULT_CONFIG_PROPERTY_PORT), DEFAULT_CONFIG_PROPERTY_REFRESH);
Thing radioThingWithNullIP = initializeRadioThing(config);
testRadioThingConsideringConfiguration(radioThingWithNullIP);
}
use of org.eclipse.smarthome.core.thing.Thing 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