Search in sources :

Example 11 with ItemChannelLink

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

the class AutoUpdateManagerTest method testAutoUpdatePolicyVETOThingONLINE.

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

Example 12 with ItemChannelLink

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

the class AutoUpdateManagerTest method testAutoUpdateNoPolicyThingOFFLINEandThingONLINE.

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

Example 13 with ItemChannelLink

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

the class AutoUpdateManagerTest method testAutoUpdateNoPolicyNoThing.

@Test
public void testAutoUpdateNoPolicyNoThing() {
    links.add(new ItemChannelLink(ITEM_NAME, new ChannelUID(new ThingUID("test::missing"), "gone")));
    aum.receiveCommand(event, item);
    assertKeepCurrentState();
}
Also used : ChannelUID(org.openhab.core.thing.ChannelUID) ThingUID(org.openhab.core.thing.ThingUID) ItemChannelLink(org.openhab.core.thing.link.ItemChannelLink) Test(org.junit.jupiter.api.Test)

Example 14 with ItemChannelLink

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

the class AutoUpdateManagerTest method testAutoUpdatePolicyVETObeatsDEFAULT.

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

Example 15 with ItemChannelLink

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

the class AutoUpdateManagerTest method testAutoUpdateNoPolicy.

@Test
public void testAutoUpdateNoPolicy() {
    links.add(new ItemChannelLink(ITEM_NAME, CHANNEL_UID_ONLINE_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