Search in sources :

Example 6 with ItemChannelLink

use of org.openhab.core.thing.link.ItemChannelLink in project openhab-core by openhab.

the class AutoUpdateManagerTest method testAutoUpdateNoPolicyThingOFFLINE.

@Test
public void testAutoUpdateNoPolicyThingOFFLINE() {
    links.add(new ItemChannelLink(ITEM_NAME, CHANNEL_UID_OFFLINE_1));
    aum.receiveCommand(event, item);
    assertKeepCurrentState();
}
Also used : ItemChannelLink(org.openhab.core.thing.link.ItemChannelLink) Test(org.junit.jupiter.api.Test)

Example 7 with ItemChannelLink

use of org.openhab.core.thing.link.ItemChannelLink in project openhab-core by openhab.

the class AutoUpdateManagerTest method testAutoUpdateErrorInvalidatesVETO2.

@Test
public void testAutoUpdateErrorInvalidatesVETO2() {
    links.add(new ItemChannelLink(ITEM_NAME, CHANNEL_UID_ONLINE_1));
    links.add(new ItemChannelLink(ITEM_NAME, CHANNEL_UID_ONLINE_GONE));
    setAutoUpdatePolicy(CHANNEL_UID_ONLINE_1, AutoUpdatePolicy.DEFAULT);
    setAutoUpdatePolicy(CHANNEL_UID_ONLINE_GONE, AutoUpdatePolicy.VETO);
    aum.receiveCommand(event, item);
    assertChangeStateTo();
}
Also used : ItemChannelLink(org.openhab.core.thing.link.ItemChannelLink) Test(org.junit.jupiter.api.Test)

Example 8 with ItemChannelLink

use of org.openhab.core.thing.link.ItemChannelLink in project openhab-core by openhab.

the class AutoUpdateManagerTest method testAutoUpdateErrorInvalidatesVETO.

@Test
public void testAutoUpdateErrorInvalidatesVETO() {
    links.add(new ItemChannelLink(ITEM_NAME, CHANNEL_UID_ONLINE_1));
    links.add(new ItemChannelLink(ITEM_NAME, CHANNEL_UID_ONLINE_GONE));
    setAutoUpdatePolicy(CHANNEL_UID_ONLINE_1, AutoUpdatePolicy.RECOMMEND);
    setAutoUpdatePolicy(CHANNEL_UID_ONLINE_GONE, AutoUpdatePolicy.VETO);
    aum.receiveCommand(event, item);
    assertStateEvent("AFTER", AutoUpdateManager.EVENT_SOURCE);
}
Also used : ItemChannelLink(org.openhab.core.thing.link.ItemChannelLink) Test(org.junit.jupiter.api.Test)

Example 9 with ItemChannelLink

use of org.openhab.core.thing.link.ItemChannelLink in project openhab-core by openhab.

the class AutoUpdateManagerTest method testAutoUpdateNoPolicyNoChannel.

@Test
public void testAutoUpdateNoPolicyNoChannel() {
    links.add(new ItemChannelLink(ITEM_NAME, CHANNEL_UID_ONLINE_GONE));
    aum.receiveCommand(event, item);
    assertKeepCurrentState();
}
Also used : ItemChannelLink(org.openhab.core.thing.link.ItemChannelLink) Test(org.junit.jupiter.api.Test)

Example 10 with ItemChannelLink

use of org.openhab.core.thing.link.ItemChannelLink in project openhab-core by openhab.

the class AutoUpdateManagerTest method testAutoUpdatePolicyVETObeatsRECOMMEND.

@Test
public void testAutoUpdatePolicyVETObeatsRECOMMEND() {
    links.add(new ItemChannelLink(ITEM_NAME, CHANNEL_UID_ONLINE_1));
    links.add(new ItemChannelLink(ITEM_NAME, CHANNEL_UID_ONLINE_2));
    setAutoUpdatePolicy(CHANNEL_UID_ONLINE_1, AutoUpdatePolicy.VETO);
    setAutoUpdatePolicy(CHANNEL_UID_ONLINE_2, AutoUpdatePolicy.RECOMMEND);
    aum.receiveCommand(event, item);
    assertNothingHappened();
}
Also used : ItemChannelLink(org.openhab.core.thing.link.ItemChannelLink) Test(org.junit.jupiter.api.Test)

Aggregations

ItemChannelLink (org.openhab.core.thing.link.ItemChannelLink)49 Test (org.junit.jupiter.api.Test)30 Thing (org.openhab.core.thing.Thing)14 Item (org.openhab.core.items.Item)13 JavaOSGiTest (org.openhab.core.test.java.JavaOSGiTest)13 ChannelUID (org.openhab.core.thing.ChannelUID)11 StringItem (org.openhab.core.library.items.StringItem)8 ThingTypeUID (org.openhab.core.thing.ThingTypeUID)8 Configuration (org.openhab.core.config.core.Configuration)6 NumberItem (org.openhab.core.library.items.NumberItem)6 ThingUID (org.openhab.core.thing.ThingUID)6 Nullable (org.eclipse.jdt.annotation.Nullable)5 Channel (org.openhab.core.thing.Channel)5 ThingRegistry (org.openhab.core.thing.ThingRegistry)5 ThingHandler (org.openhab.core.thing.binding.ThingHandler)5 ThingHandlerCallback (org.openhab.core.thing.binding.ThingHandlerCallback)5 ManagedItemChannelLinkProvider (org.openhab.core.thing.link.ManagedItemChannelLinkProvider)5 ArrayList (java.util.ArrayList)4 InvocationOnMock (org.mockito.invocation.InvocationOnMock)4 ManagedThingProvider (org.openhab.core.thing.ManagedThingProvider)4