Search in sources :

Example 66 with ChannelUID

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();
    });
}
Also used : ChannelUID(org.eclipse.smarthome.core.thing.ChannelUID) Thing(org.eclipse.smarthome.core.thing.Thing) Test(org.junit.Test) JavaTest(org.eclipse.smarthome.test.java.JavaTest)

Example 67 with ChannelUID

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);
}
Also used : SwitchItem(org.eclipse.smarthome.core.library.items.SwitchItem) NumberItem(org.eclipse.smarthome.core.library.items.NumberItem) Item(org.eclipse.smarthome.core.items.Item) StringItem(org.eclipse.smarthome.core.library.items.StringItem) DimmerItem(org.eclipse.smarthome.core.library.items.DimmerItem) ChannelUID(org.eclipse.smarthome.core.thing.ChannelUID) Thing(org.eclipse.smarthome.core.thing.Thing) Test(org.junit.Test) JavaTest(org.eclipse.smarthome.test.java.JavaTest)

Example 68 with ChannelUID

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;
}
Also used : ChannelUID(org.eclipse.smarthome.core.thing.ChannelUID) NonNull(org.eclipse.jdt.annotation.NonNull)

Example 69 with 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());
    });
}
Also used : SwitchItem(org.eclipse.smarthome.core.library.items.SwitchItem) NumberItem(org.eclipse.smarthome.core.library.items.NumberItem) Item(org.eclipse.smarthome.core.items.Item) StringItem(org.eclipse.smarthome.core.library.items.StringItem) DimmerItem(org.eclipse.smarthome.core.library.items.DimmerItem) ChannelUID(org.eclipse.smarthome.core.thing.ChannelUID) Thing(org.eclipse.smarthome.core.thing.Thing) Test(org.junit.Test) JavaTest(org.eclipse.smarthome.test.java.JavaTest)

Aggregations

ChannelUID (org.eclipse.smarthome.core.thing.ChannelUID)69 Test (org.junit.Test)31 Thing (org.eclipse.smarthome.core.thing.Thing)24 Channel (org.eclipse.smarthome.core.thing.Channel)16 JavaTest (org.eclipse.smarthome.test.java.JavaTest)14 Configuration (org.eclipse.smarthome.config.core.Configuration)10 Bridge (org.eclipse.smarthome.core.thing.Bridge)9 ThingBuilder (org.eclipse.smarthome.core.thing.binding.builder.ThingBuilder)9 Item (org.eclipse.smarthome.core.items.Item)7 Command (org.eclipse.smarthome.core.types.Command)7 JavaOSGiTest (org.eclipse.smarthome.test.java.JavaOSGiTest)7 DmxBridgeHandler (org.eclipse.smarthome.binding.dmx.internal.DmxBridgeHandler)6 StringItem (org.eclipse.smarthome.core.library.items.StringItem)6 ThingUID (org.eclipse.smarthome.core.thing.ThingUID)6 BaseThingHandler (org.eclipse.smarthome.core.thing.binding.BaseThingHandler)6 ThingHandler (org.eclipse.smarthome.core.thing.binding.ThingHandler)6 ItemChannelLink (org.eclipse.smarthome.core.thing.link.ItemChannelLink)6 NonNull (org.eclipse.jdt.annotation.NonNull)5 DimmerItem (org.eclipse.smarthome.core.library.items.DimmerItem)5 NumberItem (org.eclipse.smarthome.core.library.items.NumberItem)5