Search in sources :

Example 36 with ItemChannelLink

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

the class AutoUpdateManagerTest method testAutoUpdateErrorInvalidatesDEFAULT.

@Test
public void testAutoUpdateErrorInvalidatesDEFAULT() {
    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.DEFAULT);
    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 37 with ItemChannelLink

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

the class AutoUpdateManagerTest method testAutoUpdatePolicyDEFAULTbeatsRECOMMEND.

@Test
public void testAutoUpdatePolicyDEFAULTbeatsRECOMMEND() {
    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.DEFAULT);
    setAutoUpdatePolicy(CHANNEL_UID_ONLINE_2, AutoUpdatePolicy.RECOMMEND);
    aum.receiveCommand(event, item);
    assertChangeStateTo();
}
Also used : ItemChannelLink(org.openhab.core.thing.link.ItemChannelLink) Test(org.junit.jupiter.api.Test)

Example 38 with ItemChannelLink

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

the class AutoUpdateManagerTest method testAutoUpdatePolicyRECOMMEND.

@Test
public void testAutoUpdatePolicyRECOMMEND() {
    links.add(new ItemChannelLink(ITEM_NAME, CHANNEL_UID_ONLINE_1));
    setAutoUpdatePolicy(CHANNEL_UID_ONLINE_1, AutoUpdatePolicy.RECOMMEND);
    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 39 with ItemChannelLink

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

the class AutoUpdateManagerTest method testAutoUpdateNoPolicyNoHandler.

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

Example 40 with ItemChannelLink

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

the class AutoUpdateManagerTest method testAutoUpdateNoPolicyThingONLINEandThingOFFLINE.

@Test
public void testAutoUpdateNoPolicyThingONLINEandThingOFFLINE() {
    links.add(new ItemChannelLink(ITEM_NAME, CHANNEL_UID_ONLINE_1));
    links.add(new ItemChannelLink(ITEM_NAME, CHANNEL_UID_OFFLINE_1));
    aum.receiveCommand(event, item);
    assertChangeStateTo();
}
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