Search in sources :

Example 1 with AbstractItemRegistryEvent

use of org.openhab.core.items.events.AbstractItemRegistryEvent in project openhab-core by openhab.

the class ChannelLinkNotifierOSGiTest method afterEach.

@AfterEach
public void afterEach() throws Exception {
    Set<String> itemChannelLinkUIDsToRemove = managedItemChannelLinkProvider.getAll().stream().map(ItemChannelLink::getUID).collect(Collectors.toSet());
    Set<String> itemNamesToRemove = managedItemProvider.getAll().stream().map(Item::getName).collect(Collectors.toSet());
    Set<String> thingUIDsToRemove = managedThingProvider.getAll().stream().map(Thing::getUID).map(ThingUID::toString).collect(Collectors.toSet());
    Set<String> removedItemNames = new HashSet<>();
    Set<String> removedItemChannelLinkUIDs = new HashSet<>();
    Set<String> removedThingUIDs = new HashSet<>();
    EventSubscriber itemEventSubscriber = new EventSubscriber() {

        @Override
        public void receive(Event event) {
            logger.debug("Received event: {}", event);
            if (event instanceof AbstractItemChannelLinkRegistryEvent) {
                ItemChannelLinkDTO link = ((AbstractItemChannelLinkRegistryEvent) event).getLink();
                removedItemChannelLinkUIDs.add(AbstractLink.getIDFor(link.itemName, new ChannelUID(link.channelUID)));
            } else if (event instanceof AbstractItemRegistryEvent) {
                removedItemNames.add(((AbstractItemRegistryEvent) event).getItem().name);
            } else if (event instanceof AbstractThingRegistryEvent) {
                removedThingUIDs.add(((AbstractThingRegistryEvent) event).getThing().UID);
            }
        }

        @Override
        public Set<String> getSubscribedEventTypes() {
            return Set.of(ItemChannelLinkRemovedEvent.TYPE, ItemRemovedEvent.TYPE, ThingRemovedEvent.TYPE);
        }

        @Override
        @Nullable
        public EventFilter getEventFilter() {
            return null;
        }
    };
    registerService(itemEventSubscriber);
    Thread.sleep(300);
    managedItemChannelLinkProvider.getAll().forEach(itemChannelLink -> managedItemChannelLinkProvider.remove(itemChannelLink.getUID()));
    managedItemProvider.getAll().forEach(item -> managedItemProvider.remove(item.getUID()));
    managedThingProvider.getAll().forEach(thing -> managedThingProvider.remove(thing.getUID()));
    // wait for the resulting events to be handled so they do not cause the next test to fail
    waitForAssert(() -> {
        assertTrue(removedItemChannelLinkUIDs.containsAll(itemChannelLinkUIDsToRemove));
        assertTrue(removedItemNames.containsAll(itemNamesToRemove));
        assertTrue(removedThingUIDs.containsAll(thingUIDsToRemove));
    });
    unregisterService(itemEventSubscriber);
}
Also used : EventSubscriber(org.openhab.core.events.EventSubscriber) AbstractItemChannelLinkRegistryEvent(org.openhab.core.thing.link.events.AbstractItemChannelLinkRegistryEvent) ChannelUID(org.openhab.core.thing.ChannelUID) AbstractItemRegistryEvent(org.openhab.core.items.events.AbstractItemRegistryEvent) ItemRemovedEvent(org.openhab.core.items.events.ItemRemovedEvent) ThingRemovedEvent(org.openhab.core.thing.events.ThingRemovedEvent) AbstractThingRegistryEvent(org.openhab.core.thing.events.AbstractThingRegistryEvent) ItemChannelLinkRemovedEvent(org.openhab.core.thing.link.events.ItemChannelLinkRemovedEvent) Event(org.openhab.core.events.Event) AbstractItemChannelLinkRegistryEvent(org.openhab.core.thing.link.events.AbstractItemChannelLinkRegistryEvent) AbstractItemRegistryEvent(org.openhab.core.items.events.AbstractItemRegistryEvent) AbstractThingRegistryEvent(org.openhab.core.thing.events.AbstractThingRegistryEvent) ItemChannelLinkDTO(org.openhab.core.thing.link.dto.ItemChannelLinkDTO) Thing(org.openhab.core.thing.Thing) HashSet(java.util.HashSet) AfterEach(org.junit.jupiter.api.AfterEach)

Example 2 with AbstractItemRegistryEvent

use of org.openhab.core.items.events.AbstractItemRegistryEvent in project openhab-core by openhab.

the class GenericItemProviderTest method assertThatItemEventsAreSentOnlyOncePerItemEvenWithMultipleItemFiles.

@Test
public void assertThatItemEventsAreSentOnlyOncePerItemEvenWithMultipleItemFiles() {
    List<AbstractItemRegistryEvent> receivedEvents = new ArrayList<>();
    EventSubscriber itemEventSubscriber = new EventSubscriber() {

        @Override
        public void receive(Event event) {
            logger.debug("Received event: {}", event);
            receivedEvents.add((AbstractItemRegistryEvent) event);
        }

        @Override
        public Set<String> getSubscribedEventTypes() {
            return Stream.of(ItemAddedEvent.TYPE, ItemUpdatedEvent.TYPE, ItemRemovedEvent.TYPE).collect(toSet());
        }

        @Override
        @Nullable
        public EventFilter getEventFilter() {
            return null;
        }
    };
    registerService(itemEventSubscriber);
    assertThat(itemRegistry.getAll(), hasSize(0));
    receivedEvents.clear();
    String model = "String test1 \"Test Item [%s]\" { channel=\"test:test:test:test\" }\n" + "String test2 \"Test Item [%s]\" { channel=\"test:test:test:test\" }";
    modelRepository.addOrRefreshModel(TESTMODEL_NAME, new ByteArrayInputStream(model.getBytes()));
    waitForAssert(() -> {
        assertThat(itemRegistry.getAll(), hasSize(2));
        assertThat(receivedEvents, hasSize(2));
        assertThat(receivedEvents.stream().filter(e -> "test1".equals(e.getItem().name)).findFirst().get(), instanceOf(ItemAddedEvent.class));
        assertThat(receivedEvents.stream().filter(e -> "test2".equals(e.getItem().name)).findFirst().get(), instanceOf(ItemAddedEvent.class));
    });
    receivedEvents.clear();
    model = "String test3 \"Test Item [%s]\" { channel=\"test:test:test:test\" }\n" + "String test4 \"Test Item [%s]\" { channel=\"test:test:test:test\" }";
    modelRepository.addOrRefreshModel(TESTMODEL_NAME2, new ByteArrayInputStream(model.getBytes()));
    // only ItemAddedEvents for items test3 and test4 should be fired, NOT for test1 and test2 again
    waitForAssert(() -> {
        assertThat(itemRegistry.getAll(), hasSize(4));
        assertThat(receivedEvents, hasSize(2));
        assertThat(receivedEvents.stream().filter(e -> "test3".equals(e.getItem().name)).findFirst().get(), instanceOf(ItemAddedEvent.class));
        assertThat(receivedEvents.stream().filter(e -> "test4".equals(e.getItem().name)).findFirst().get(), instanceOf(ItemAddedEvent.class));
    });
    unregisterService(itemEventSubscriber);
}
Also used : CoreMatchers(org.hamcrest.CoreMatchers) BeforeEach(org.junit.jupiter.api.BeforeEach) ItemRemovedEvent(org.openhab.core.items.events.ItemRemovedEvent) LoggerFactory(org.slf4j.LoggerFactory) OnOffType(org.openhab.core.library.types.OnOffType) StateDescription(org.openhab.core.types.StateDescription) BigDecimal(java.math.BigDecimal) ByteArrayInputStream(java.io.ByteArrayInputStream) Nullable(org.eclipse.jdt.annotation.Nullable) GenericItem(org.openhab.core.items.GenericItem) NumberItem(org.openhab.core.library.items.NumberItem) Metadata(org.openhab.core.items.Metadata) NonNullByDefault(org.eclipse.jdt.annotation.NonNullByDefault) ItemAddedEvent(org.openhab.core.items.events.ItemAddedEvent) ArithmeticGroupFunction(org.openhab.core.library.types.ArithmeticGroupFunction) Collection(java.util.Collection) UnDefType(org.openhab.core.types.UnDefType) Set(java.util.Set) GroupFunction(org.openhab.core.items.GroupFunction) Collectors(java.util.stream.Collectors) IsCollectionWithSize.hasSize(org.hamcrest.collection.IsCollectionWithSize.hasSize) Test(org.junit.jupiter.api.Test) List(java.util.List) Stream(java.util.stream.Stream) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) EventType(org.openhab.core.model.core.EventType) EventSubscriber(org.openhab.core.events.EventSubscriber) SwitchItem(org.openhab.core.library.items.SwitchItem) ItemUpdatedEvent(org.openhab.core.items.events.ItemUpdatedEvent) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) ModelRepositoryChangeListener(org.openhab.core.model.core.ModelRepositoryChangeListener) EventFilter(org.openhab.core.events.EventFilter) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) LinkedList(java.util.LinkedList) GroupItem(org.openhab.core.items.GroupItem) Logger(org.slf4j.Logger) Iterator(java.util.Iterator) ItemProvider(org.openhab.core.items.ItemProvider) Event(org.openhab.core.events.Event) ItemNotFoundException(org.openhab.core.items.ItemNotFoundException) MetadataRegistry(org.openhab.core.items.MetadataRegistry) MetadataKey(org.openhab.core.items.MetadataKey) Item(org.openhab.core.items.Item) ItemRegistry(org.openhab.core.items.ItemRegistry) AfterEach(org.junit.jupiter.api.AfterEach) JavaOSGiTest(org.openhab.core.test.java.JavaOSGiTest) ModelRepository(org.openhab.core.model.core.ModelRepository) AbstractItemRegistryEvent(org.openhab.core.items.events.AbstractItemRegistryEvent) EventSubscriber(org.openhab.core.events.EventSubscriber) ByteArrayInputStream(java.io.ByteArrayInputStream) AbstractItemRegistryEvent(org.openhab.core.items.events.AbstractItemRegistryEvent) ArrayList(java.util.ArrayList) ItemRemovedEvent(org.openhab.core.items.events.ItemRemovedEvent) ItemAddedEvent(org.openhab.core.items.events.ItemAddedEvent) ItemUpdatedEvent(org.openhab.core.items.events.ItemUpdatedEvent) Event(org.openhab.core.events.Event) AbstractItemRegistryEvent(org.openhab.core.items.events.AbstractItemRegistryEvent) ItemAddedEvent(org.openhab.core.items.events.ItemAddedEvent) Test(org.junit.jupiter.api.Test) JavaOSGiTest(org.openhab.core.test.java.JavaOSGiTest)

Example 3 with AbstractItemRegistryEvent

use of org.openhab.core.items.events.AbstractItemRegistryEvent in project openhab-core by openhab.

the class GenericItemProviderTest method assertThatItemEventsAreSentCorrectly.

@Test
public void assertThatItemEventsAreSentCorrectly() {
    List<AbstractItemRegistryEvent> receivedEvents = new ArrayList<>();
    EventSubscriber itemEventSubscriber = new EventSubscriber() {

        @Override
        public void receive(Event event) {
            logger.debug("Received event: {}", event);
            receivedEvents.add((AbstractItemRegistryEvent) event);
        }

        @Override
        public Set<String> getSubscribedEventTypes() {
            return Stream.of(ItemAddedEvent.TYPE, ItemUpdatedEvent.TYPE, ItemRemovedEvent.TYPE).collect(toSet());
        }

        @Override
        @Nullable
        public EventFilter getEventFilter() {
            return null;
        }
    };
    registerService(itemEventSubscriber);
    assertThat(itemRegistry.getAll(), hasSize(0));
    receivedEvents.clear();
    String model = "String test1 \"Test Item [%s]\" { channel=\"test:test:test:test\" }\n" + "String test2 \"Test Item [%s]\" { channel=\"test:test:test:test\" }";
    modelRepository.addOrRefreshModel(TESTMODEL_NAME, new ByteArrayInputStream(model.getBytes()));
    waitForAssert(() -> {
        assertThat(itemRegistry.getAll(), hasSize(2));
        assertThat(receivedEvents, hasSize(2));
        assertThat(receivedEvents.stream().filter(e -> "test1".equals(e.getItem().name)).findFirst().get(), instanceOf(ItemAddedEvent.class));
        assertThat(receivedEvents.stream().filter(e -> "test2".equals(e.getItem().name)).findFirst().get(), instanceOf(ItemAddedEvent.class));
    });
    receivedEvents.clear();
    model = "String test1 \"Test Item Changed [%s]\" { channel=\"test:test:test:test\" }";
    modelRepository.addOrRefreshModel(TESTMODEL_NAME, new ByteArrayInputStream(model.getBytes()));
    waitForAssert(() -> {
        assertThat(itemRegistry.getAll(), hasSize(1));
        assertThat(receivedEvents, hasSize(2));
        assertThat(receivedEvents.stream().filter(e -> "test1".equals(e.getItem().name)).findFirst().get(), instanceOf(ItemUpdatedEvent.class));
        assertThat(receivedEvents.stream().filter(e -> "test2".equals(e.getItem().name)).findFirst().get(), instanceOf(ItemRemovedEvent.class));
    });
    receivedEvents.clear();
    model = "";
    modelRepository.addOrRefreshModel(TESTMODEL_NAME, new ByteArrayInputStream(model.getBytes()));
    waitForAssert(() -> {
        assertThat(itemRegistry.getAll(), hasSize(0));
        assertThat(receivedEvents, hasSize(1));
        assertThat(receivedEvents.stream().filter(e -> "test1".equals(e.getItem().name)).findFirst().get(), instanceOf(ItemRemovedEvent.class));
    });
    unregisterService(itemEventSubscriber);
}
Also used : CoreMatchers(org.hamcrest.CoreMatchers) BeforeEach(org.junit.jupiter.api.BeforeEach) ItemRemovedEvent(org.openhab.core.items.events.ItemRemovedEvent) LoggerFactory(org.slf4j.LoggerFactory) OnOffType(org.openhab.core.library.types.OnOffType) StateDescription(org.openhab.core.types.StateDescription) BigDecimal(java.math.BigDecimal) ByteArrayInputStream(java.io.ByteArrayInputStream) Nullable(org.eclipse.jdt.annotation.Nullable) GenericItem(org.openhab.core.items.GenericItem) NumberItem(org.openhab.core.library.items.NumberItem) Metadata(org.openhab.core.items.Metadata) NonNullByDefault(org.eclipse.jdt.annotation.NonNullByDefault) ItemAddedEvent(org.openhab.core.items.events.ItemAddedEvent) ArithmeticGroupFunction(org.openhab.core.library.types.ArithmeticGroupFunction) Collection(java.util.Collection) UnDefType(org.openhab.core.types.UnDefType) Set(java.util.Set) GroupFunction(org.openhab.core.items.GroupFunction) Collectors(java.util.stream.Collectors) IsCollectionWithSize.hasSize(org.hamcrest.collection.IsCollectionWithSize.hasSize) Test(org.junit.jupiter.api.Test) List(java.util.List) Stream(java.util.stream.Stream) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) EventType(org.openhab.core.model.core.EventType) EventSubscriber(org.openhab.core.events.EventSubscriber) SwitchItem(org.openhab.core.library.items.SwitchItem) ItemUpdatedEvent(org.openhab.core.items.events.ItemUpdatedEvent) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) ModelRepositoryChangeListener(org.openhab.core.model.core.ModelRepositoryChangeListener) EventFilter(org.openhab.core.events.EventFilter) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) LinkedList(java.util.LinkedList) GroupItem(org.openhab.core.items.GroupItem) Logger(org.slf4j.Logger) Iterator(java.util.Iterator) ItemProvider(org.openhab.core.items.ItemProvider) Event(org.openhab.core.events.Event) ItemNotFoundException(org.openhab.core.items.ItemNotFoundException) MetadataRegistry(org.openhab.core.items.MetadataRegistry) MetadataKey(org.openhab.core.items.MetadataKey) Item(org.openhab.core.items.Item) ItemRegistry(org.openhab.core.items.ItemRegistry) AfterEach(org.junit.jupiter.api.AfterEach) JavaOSGiTest(org.openhab.core.test.java.JavaOSGiTest) ModelRepository(org.openhab.core.model.core.ModelRepository) AbstractItemRegistryEvent(org.openhab.core.items.events.AbstractItemRegistryEvent) EventSubscriber(org.openhab.core.events.EventSubscriber) ItemRemovedEvent(org.openhab.core.items.events.ItemRemovedEvent) ByteArrayInputStream(java.io.ByteArrayInputStream) AbstractItemRegistryEvent(org.openhab.core.items.events.AbstractItemRegistryEvent) ArrayList(java.util.ArrayList) ItemRemovedEvent(org.openhab.core.items.events.ItemRemovedEvent) ItemAddedEvent(org.openhab.core.items.events.ItemAddedEvent) ItemUpdatedEvent(org.openhab.core.items.events.ItemUpdatedEvent) Event(org.openhab.core.events.Event) AbstractItemRegistryEvent(org.openhab.core.items.events.AbstractItemRegistryEvent) ItemAddedEvent(org.openhab.core.items.events.ItemAddedEvent) ItemUpdatedEvent(org.openhab.core.items.events.ItemUpdatedEvent) Test(org.junit.jupiter.api.Test) JavaOSGiTest(org.openhab.core.test.java.JavaOSGiTest)

Example 4 with AbstractItemRegistryEvent

use of org.openhab.core.items.events.AbstractItemRegistryEvent in project openhab-core by openhab.

the class GenericItemProviderTest method testMetadataConfigured.

@Test
public void testMetadataConfigured() {
    String model = // 
    "Switch simple { namespace=\"value\" } " + // 
    "Switch configured { foo=\"bar\" [ answer=42 ] } " + "Switch negative { foo=\"bar\" [ property=-42 ] }";
    modelRepository.addOrRefreshModel(TESTMODEL_NAME, new ByteArrayInputStream(model.getBytes()));
    Item item = itemRegistry.get("configured");
    assertThat(item, is(notNullValue()));
    Metadata res = metadataRegistry.get(new MetadataKey("foo", "configured"));
    assertThat(res, is(notNullValue()));
    assertThat(res.getValue(), is("bar"));
    assertThat(res.getConfiguration().get("answer"), is(new BigDecimal(42)));
    res = metadataRegistry.get(new MetadataKey("foo", "negative"));
    assertThat(res, is(notNullValue()));
    assertThat(res.getValue(), is("bar"));
    assertThat(res.getConfiguration().get("property"), is(new BigDecimal(-42)));
    Collection<Item> itemsToRemove = itemRegistry.getAll();
    List<AbstractItemRegistryEvent> removedItemEvents = new ArrayList<>();
    EventSubscriber itemEventSubscriber = new EventSubscriber() {

        @Override
        public void receive(Event event) {
            logger.debug("Received event: {}", event);
            removedItemEvents.add((AbstractItemRegistryEvent) event);
        }

        @Override
        public Set<String> getSubscribedEventTypes() {
            return Stream.of(ItemRemovedEvent.TYPE).collect(toSet());
        }

        @Override
        @Nullable
        public EventFilter getEventFilter() {
            return null;
        }
    };
    registerService(itemEventSubscriber);
    modelRepository.removeModel(TESTMODEL_NAME);
    waitForAssert(() -> {
        assertThat(removedItemEvents, hasSize(itemsToRemove.size()));
    });
    unregisterService(itemEventSubscriber);
    res = metadataRegistry.get(new MetadataKey("foo", "configured"));
    assertThat(res, is(nullValue()));
}
Also used : GenericItem(org.openhab.core.items.GenericItem) NumberItem(org.openhab.core.library.items.NumberItem) SwitchItem(org.openhab.core.library.items.SwitchItem) GroupItem(org.openhab.core.items.GroupItem) Item(org.openhab.core.items.Item) EventSubscriber(org.openhab.core.events.EventSubscriber) ByteArrayInputStream(java.io.ByteArrayInputStream) AbstractItemRegistryEvent(org.openhab.core.items.events.AbstractItemRegistryEvent) Metadata(org.openhab.core.items.Metadata) ArrayList(java.util.ArrayList) ItemRemovedEvent(org.openhab.core.items.events.ItemRemovedEvent) ItemAddedEvent(org.openhab.core.items.events.ItemAddedEvent) ItemUpdatedEvent(org.openhab.core.items.events.ItemUpdatedEvent) Event(org.openhab.core.events.Event) AbstractItemRegistryEvent(org.openhab.core.items.events.AbstractItemRegistryEvent) MetadataKey(org.openhab.core.items.MetadataKey) BigDecimal(java.math.BigDecimal) Test(org.junit.jupiter.api.Test) JavaOSGiTest(org.openhab.core.test.java.JavaOSGiTest)

Example 5 with AbstractItemRegistryEvent

use of org.openhab.core.items.events.AbstractItemRegistryEvent in project openhab-core by openhab.

the class CommunicationManager method receive.

@Override
public void receive(Event event) {
    if (event instanceof ItemStateEvent) {
        receiveUpdate((ItemStateEvent) event);
    } else if (event instanceof ItemCommandEvent) {
        receiveCommand((ItemCommandEvent) event);
    } else if (event instanceof ChannelTriggeredEvent) {
        receiveTrigger((ChannelTriggeredEvent) event);
    } else if (event instanceof AbstractItemRegistryEvent) {
        String itemName = ((AbstractItemRegistryEvent) event).getItem().name;
        profiles.entrySet().removeIf(entry -> {
            ItemChannelLink link = itemChannelLinkRegistry.get(entry.getKey());
            return link != null && itemName.equals(link.getItemName());
        });
    } else if (event instanceof AbstractThingRegistryEvent) {
        ThingUID thingUid = new ThingUID(((AbstractThingRegistryEvent) event).getThing().UID);
        profiles.entrySet().removeIf(entry -> {
            ItemChannelLink link = itemChannelLinkRegistry.get(entry.getKey());
            return link != null && thingUid.equals(link.getLinkedUID().getThingUID());
        });
    }
}
Also used : ProfileContext(org.openhab.core.thing.profiles.ProfileContext) TriggerProfile(org.openhab.core.thing.profiles.TriggerProfile) RegistryChangeListener(org.openhab.core.common.registry.RegistryChangeListener) LoggerFactory(org.slf4j.LoggerFactory) SafeCaller(org.openhab.core.common.SafeCaller) ChannelTypeRegistry(org.openhab.core.thing.type.ChannelTypeRegistry) ItemStateEvent(org.openhab.core.items.events.ItemStateEvent) Quantity(javax.measure.Quantity) Nullable(org.eclipse.jdt.annotation.Nullable) Duration(java.time.Duration) Map(java.util.Map) SystemProfileFactory(org.openhab.core.thing.internal.profiles.SystemProfileFactory) ItemStateConverter(org.openhab.core.items.ItemStateConverter) ProfileTypeUID(org.openhab.core.thing.profiles.ProfileTypeUID) EventPublisher(org.openhab.core.events.EventPublisher) NumberItem(org.openhab.core.library.items.NumberItem) NonNullByDefault(org.eclipse.jdt.annotation.NonNullByDefault) ItemChannelLinkRegistry(org.openhab.core.thing.link.ItemChannelLinkRegistry) Deactivate(org.osgi.service.component.annotations.Deactivate) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Set(java.util.Set) ReferencePolicy(org.osgi.service.component.annotations.ReferencePolicy) CopyOnWriteArraySet(java.util.concurrent.CopyOnWriteArraySet) ItemUtil(org.openhab.core.items.ItemUtil) StateProfile(org.openhab.core.thing.profiles.StateProfile) Objects(java.util.Objects) Channel(org.openhab.core.thing.Channel) ThingEventFactory(org.openhab.core.thing.events.ThingEventFactory) List(java.util.List) ThingRegistry(org.openhab.core.thing.ThingRegistry) ChannelTriggeredEvent(org.openhab.core.thing.events.ChannelTriggeredEvent) Entry(java.util.Map.Entry) AbstractUID(org.openhab.core.common.AbstractUID) ProfileCallback(org.openhab.core.thing.profiles.ProfileCallback) ItemChannelLink(org.openhab.core.thing.link.ItemChannelLink) EventSubscriber(org.openhab.core.events.EventSubscriber) ProfileAdvisor(org.openhab.core.thing.profiles.ProfileAdvisor) Function(java.util.function.Function) ItemChannelLinkConfigDescriptionProvider(org.openhab.core.thing.internal.link.ItemChannelLinkConfigDescriptionProvider) Thing(org.openhab.core.thing.Thing) Type(org.openhab.core.types.Type) Component(org.osgi.service.component.annotations.Component) ItemFactory(org.openhab.core.items.ItemFactory) EventFilter(org.openhab.core.events.EventFilter) ChannelUID(org.openhab.core.thing.ChannelUID) Activate(org.osgi.service.component.annotations.Activate) DecimalType(org.openhab.core.library.types.DecimalType) AbstractThingRegistryEvent(org.openhab.core.thing.events.AbstractThingRegistryEvent) ItemCommandEvent(org.openhab.core.items.events.ItemCommandEvent) QuantityType(org.openhab.core.library.types.QuantityType) Command(org.openhab.core.types.Command) Logger(org.slf4j.Logger) ThingUID(org.openhab.core.thing.ThingUID) Event(org.openhab.core.events.Event) ProfileFactory(org.openhab.core.thing.profiles.ProfileFactory) State(org.openhab.core.types.State) ExpiringCacheMap(org.openhab.core.cache.ExpiringCacheMap) UnitUtils(org.openhab.core.types.util.UnitUtils) Item(org.openhab.core.items.Item) ChannelType(org.openhab.core.thing.type.ChannelType) TimeUnit(java.util.concurrent.TimeUnit) Consumer(java.util.function.Consumer) ItemRegistry(org.openhab.core.items.ItemRegistry) ReferenceCardinality(org.osgi.service.component.annotations.ReferenceCardinality) Profile(org.openhab.core.thing.profiles.Profile) ChannelTypeUID(org.openhab.core.thing.type.ChannelTypeUID) ProfileCallbackImpl(org.openhab.core.thing.internal.profiles.ProfileCallbackImpl) Reference(org.osgi.service.component.annotations.Reference) AbstractItemRegistryEvent(org.openhab.core.items.events.AbstractItemRegistryEvent) ItemCommandEvent(org.openhab.core.items.events.ItemCommandEvent) AbstractItemRegistryEvent(org.openhab.core.items.events.AbstractItemRegistryEvent) ThingUID(org.openhab.core.thing.ThingUID) ItemChannelLink(org.openhab.core.thing.link.ItemChannelLink) ChannelTriggeredEvent(org.openhab.core.thing.events.ChannelTriggeredEvent) AbstractThingRegistryEvent(org.openhab.core.thing.events.AbstractThingRegistryEvent) ItemStateEvent(org.openhab.core.items.events.ItemStateEvent)

Aggregations

Event (org.openhab.core.events.Event)6 EventSubscriber (org.openhab.core.events.EventSubscriber)6 AbstractItemRegistryEvent (org.openhab.core.items.events.AbstractItemRegistryEvent)6 Item (org.openhab.core.items.Item)5 NumberItem (org.openhab.core.library.items.NumberItem)5 ByteArrayInputStream (java.io.ByteArrayInputStream)4 BigDecimal (java.math.BigDecimal)4 ArrayList (java.util.ArrayList)4 HashSet (java.util.HashSet)4 List (java.util.List)4 Set (java.util.Set)4 NonNullByDefault (org.eclipse.jdt.annotation.NonNullByDefault)4 Nullable (org.eclipse.jdt.annotation.Nullable)4 AfterEach (org.junit.jupiter.api.AfterEach)4 Test (org.junit.jupiter.api.Test)4 EventFilter (org.openhab.core.events.EventFilter)4 ItemRegistry (org.openhab.core.items.ItemRegistry)4 ItemRemovedEvent (org.openhab.core.items.events.ItemRemovedEvent)4 Collection (java.util.Collection)3 Iterator (java.util.Iterator)3