Search in sources :

Example 1 with EventFilter

use of org.openhab.core.events.EventFilter 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) EventType(org.openhab.core.model.core.EventType) EventSubscriber(org.openhab.core.events.EventSubscriber) SwitchItem(org.openhab.core.library.items.SwitchItem) ItemRemovedEvent(org.openhab.core.items.events.ItemRemovedEvent) LoggerFactory(org.slf4j.LoggerFactory) OnOffType(org.openhab.core.library.types.OnOffType) StateDescription(org.openhab.core.types.StateDescription) ItemUpdatedEvent(org.openhab.core.items.events.ItemUpdatedEvent) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) BigDecimal(java.math.BigDecimal) ByteArrayInputStream(java.io.ByteArrayInputStream) Nullable(org.eclipse.jdt.annotation.Nullable) GenericItem(org.openhab.core.items.GenericItem) ModelRepositoryChangeListener(org.openhab.core.model.core.ModelRepositoryChangeListener) EventFilter(org.openhab.core.events.EventFilter) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) LinkedList(java.util.LinkedList) NumberItem(org.openhab.core.library.items.NumberItem) Metadata(org.openhab.core.items.Metadata) NonNullByDefault(org.eclipse.jdt.annotation.NonNullByDefault) GroupItem(org.openhab.core.items.GroupItem) ItemAddedEvent(org.openhab.core.items.events.ItemAddedEvent) ArithmeticGroupFunction(org.openhab.core.library.types.ArithmeticGroupFunction) Logger(org.slf4j.Logger) Iterator(java.util.Iterator) ItemProvider(org.openhab.core.items.ItemProvider) Collection(java.util.Collection) Event(org.openhab.core.events.Event) UnDefType(org.openhab.core.types.UnDefType) Set(java.util.Set) GroupFunction(org.openhab.core.items.GroupFunction) MetadataRegistry(org.openhab.core.items.MetadataRegistry) Collectors(java.util.stream.Collectors) MetadataKey(org.openhab.core.items.MetadataKey) Item(org.openhab.core.items.Item) IsCollectionWithSize.hasSize(org.hamcrest.collection.IsCollectionWithSize.hasSize) Test(org.junit.jupiter.api.Test) ItemRegistry(org.openhab.core.items.ItemRegistry) List(java.util.List) AfterEach(org.junit.jupiter.api.AfterEach) Stream(java.util.stream.Stream) 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) ItemUpdatedEvent(org.openhab.core.items.events.ItemUpdatedEvent) ItemAddedEvent(org.openhab.core.items.events.ItemAddedEvent) 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 2 with EventFilter

use of org.openhab.core.events.EventFilter 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) EventType(org.openhab.core.model.core.EventType) EventSubscriber(org.openhab.core.events.EventSubscriber) SwitchItem(org.openhab.core.library.items.SwitchItem) ItemRemovedEvent(org.openhab.core.items.events.ItemRemovedEvent) LoggerFactory(org.slf4j.LoggerFactory) OnOffType(org.openhab.core.library.types.OnOffType) StateDescription(org.openhab.core.types.StateDescription) ItemUpdatedEvent(org.openhab.core.items.events.ItemUpdatedEvent) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) BigDecimal(java.math.BigDecimal) ByteArrayInputStream(java.io.ByteArrayInputStream) Nullable(org.eclipse.jdt.annotation.Nullable) GenericItem(org.openhab.core.items.GenericItem) ModelRepositoryChangeListener(org.openhab.core.model.core.ModelRepositoryChangeListener) EventFilter(org.openhab.core.events.EventFilter) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) LinkedList(java.util.LinkedList) NumberItem(org.openhab.core.library.items.NumberItem) Metadata(org.openhab.core.items.Metadata) NonNullByDefault(org.eclipse.jdt.annotation.NonNullByDefault) GroupItem(org.openhab.core.items.GroupItem) ItemAddedEvent(org.openhab.core.items.events.ItemAddedEvent) ArithmeticGroupFunction(org.openhab.core.library.types.ArithmeticGroupFunction) Logger(org.slf4j.Logger) Iterator(java.util.Iterator) ItemProvider(org.openhab.core.items.ItemProvider) Collection(java.util.Collection) Event(org.openhab.core.events.Event) UnDefType(org.openhab.core.types.UnDefType) Set(java.util.Set) GroupFunction(org.openhab.core.items.GroupFunction) MetadataRegistry(org.openhab.core.items.MetadataRegistry) Collectors(java.util.stream.Collectors) MetadataKey(org.openhab.core.items.MetadataKey) Item(org.openhab.core.items.Item) IsCollectionWithSize.hasSize(org.hamcrest.collection.IsCollectionWithSize.hasSize) Test(org.junit.jupiter.api.Test) ItemRegistry(org.openhab.core.items.ItemRegistry) List(java.util.List) AfterEach(org.junit.jupiter.api.AfterEach) Stream(java.util.stream.Stream) 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) ItemUpdatedEvent(org.openhab.core.items.events.ItemUpdatedEvent) ItemAddedEvent(org.openhab.core.items.events.ItemAddedEvent) 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 3 with EventFilter

use of org.openhab.core.events.EventFilter in project openhab-core by openhab.

the class AutomationIntegrationJsonTest method assertThatARuleFromJsonFileIsAddedAutomaticallyAndTheRuntimeRuleHasResolvedModuleReferences.

@Test
public void assertThatARuleFromJsonFileIsAddedAutomaticallyAndTheRuntimeRuleHasResolvedModuleReferences() {
    logger.info("assert that a rule from json file is added automatically and the runtime rule has resolved module references");
    // WAIT until Rule modules types are parsed and the rule becomes IDLE
    waitForAssert(() -> {
        assertThat(ruleRegistry.getAll().isEmpty(), is(false));
        Optional<Rule> rule2 = ruleRegistry.stream().filter(RulePredicates.hasAllTags("jsonTest", "references")).findFirst();
        assertThat(rule2.isPresent(), is(true));
        RuleStatusInfo ruleStatus2 = ruleManager.getStatusInfo(rule2.get().getUID());
        assertThat(ruleStatus2.getStatus(), is(RuleStatus.IDLE));
    }, 10000, 200);
    Optional<Rule> optionalRule = ruleRegistry.stream().filter(RulePredicates.hasAllTags("jsonTest", "references")).findFirst();
    assertThat(optionalRule.isPresent(), is(true));
    Rule rule = optionalRule.get();
    assertThat(rule.getName(), is("ItemSampleRuleWithReferences"));
    assertTrue(rule.getTags().contains("sample"));
    assertTrue(rule.getTags().contains("item"));
    assertTrue(rule.getTags().contains("rule"));
    assertTrue(rule.getTags().contains("references"));
    Optional<? extends Trigger> trigger = rule.getTriggers().stream().filter(t -> "ItemStateChangeTriggerID".equals(t.getId())).findFirst();
    assertThat(trigger.isPresent(), is(true));
    assertThat(trigger.get().getTypeUID(), is("core.GenericEventTrigger"));
    assertThat(trigger.get().getConfiguration().get("eventTopic"), is("openhab/items/*"));
    assertThat(trigger.get().getConfiguration().get("eventTypes"), is("ItemStateEvent"));
    Optional<? extends Action> action = rule.getActions().stream().filter(a -> "ItemPostCommandActionID".equals(a.getId())).findFirst();
    assertThat(action.isPresent(), is(true));
    assertThat(action.get().getTypeUID(), is("core.ItemCommandAction"));
    assertThat(action.get().getConfiguration().get("command"), is("ON"));
    RuleStatusInfo ruleStatus = ruleManager.getStatusInfo(rule.getUID());
    assertThat(ruleStatus.getStatus(), is(RuleStatus.IDLE));
    // run the rule to check if the runtime rule has resolved module references and is executed successfully
    EventPublisher eventPublisher = getService(EventPublisher.class);
    @NonNullByDefault EventSubscriber itemEventHandler = new EventSubscriber() {

        @Override
        public Set<String> getSubscribedEventTypes() {
            return Set.of(ItemCommandEvent.TYPE);
        }

        @Override
        @Nullable
        public EventFilter getEventFilter() {
            return null;
        }

        @Override
        public void receive(Event e) {
            logger.info("Event: {}", e.getTopic());
            if (e.getTopic().contains("myLampItem")) {
                itemEvent = e;
            }
        }
    };
    registerService(itemEventHandler);
    eventPublisher.post(ItemEventFactory.createStateEvent("myMotionItem", OnOffType.ON));
    waitForAssert(() -> {
        assertThat(itemEvent, is(notNullValue()));
    }, 3000, 100);
    assertThat(itemEvent.getTopic(), is(equalTo("openhab/items/myLampItem/command")));
    assertThat(((ItemCommandEvent) itemEvent).getItemCommand(), is(OnOffType.ON));
}
Also used : ItemEventFactory(org.openhab.core.items.events.ItemEventFactory) VolatileStorageService(org.openhab.core.test.storage.VolatileStorageService) CoreMatchers(org.hamcrest.CoreMatchers) BeforeEach(org.junit.jupiter.api.BeforeEach) TriggerType(org.openhab.core.automation.type.TriggerType) EventSubscriber(org.openhab.core.events.EventSubscriber) RuleRegistry(org.openhab.core.automation.RuleRegistry) SwitchItem(org.openhab.core.library.items.SwitchItem) RuleManager(org.openhab.core.automation.RuleManager) LoggerFactory(org.slf4j.LoggerFactory) OnOffType(org.openhab.core.library.types.OnOffType) Trigger(org.openhab.core.automation.Trigger) RuleEngineImpl(org.openhab.core.automation.internal.RuleEngineImpl) Input(org.openhab.core.automation.type.Input) ManagedRuleProvider(org.openhab.core.automation.ManagedRuleProvider) StorageService(org.openhab.core.storage.StorageService) RulePredicates(org.openhab.core.automation.RulePredicates) Nullable(org.eclipse.jdt.annotation.Nullable) EventFilter(org.openhab.core.events.EventFilter) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) RuleStatusInfoEvent(org.openhab.core.automation.events.RuleStatusInfoEvent) EventPublisher(org.openhab.core.events.EventPublisher) ItemCommandEvent(org.openhab.core.items.events.ItemCommandEvent) RuleStatusInfo(org.openhab.core.automation.RuleStatusInfo) NonNullByDefault(org.eclipse.jdt.annotation.NonNullByDefault) Logger(org.slf4j.Logger) ItemProvider(org.openhab.core.items.ItemProvider) Collection(java.util.Collection) Action(org.openhab.core.automation.Action) Event(org.openhab.core.events.Event) UnDefType(org.openhab.core.types.UnDefType) ItemNotFoundException(org.openhab.core.items.ItemNotFoundException) Set(java.util.Set) ConfigDescriptionParameter(org.openhab.core.config.core.ConfigDescriptionParameter) ReadyMarker(org.openhab.core.service.ReadyMarker) Rule(org.openhab.core.automation.Rule) Item(org.openhab.core.items.Item) Test(org.junit.jupiter.api.Test) ItemRegistry(org.openhab.core.items.ItemRegistry) RuleStatus(org.openhab.core.automation.RuleStatus) AfterEach(org.junit.jupiter.api.AfterEach) Output(org.openhab.core.automation.type.Output) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) ActionType(org.openhab.core.automation.type.ActionType) JavaOSGiTest(org.openhab.core.test.java.JavaOSGiTest) Optional(java.util.Optional) ProviderChangeListener(org.openhab.core.common.registry.ProviderChangeListener) ModuleTypeRegistry(org.openhab.core.automation.type.ModuleTypeRegistry) EventSubscriber(org.openhab.core.events.EventSubscriber) RuleStatusInfo(org.openhab.core.automation.RuleStatusInfo) NonNullByDefault(org.eclipse.jdt.annotation.NonNullByDefault) EventPublisher(org.openhab.core.events.EventPublisher) RuleStatusInfoEvent(org.openhab.core.automation.events.RuleStatusInfoEvent) ItemCommandEvent(org.openhab.core.items.events.ItemCommandEvent) Event(org.openhab.core.events.Event) Rule(org.openhab.core.automation.Rule) Test(org.junit.jupiter.api.Test) JavaOSGiTest(org.openhab.core.test.java.JavaOSGiTest)

Example 4 with EventFilter

use of org.openhab.core.events.EventFilter in project openhab-core by openhab.

the class RunRuleModuleTest method subscribeToEvents.

private void subscribeToEvents(String eventType, final Queue<Event> events) {
    EventSubscriber eventSubscriber = new EventSubscriber() {

        @Override
        public void receive(final Event event) {
            logger.info("Event: {}", event.getTopic());
            events.add(event);
        }

        @Override
        public Set<String> getSubscribedEventTypes() {
            return Set.of(eventType);
        }

        @Override
        @Nullable
        public EventFilter getEventFilter() {
            return null;
        }
    };
    ServiceReference<?> subscriberReference = registerService(eventSubscriber).getReference();
    assertNotNull(getServices(EventSubscriber.class, (reference) -> reference.equals(subscriberReference)));
}
Also used : ItemEventFactory(org.openhab.core.items.events.ItemEventFactory) VolatileStorageService(org.openhab.core.test.storage.VolatileStorageService) BeforeEach(org.junit.jupiter.api.BeforeEach) EventSubscriber(org.openhab.core.events.EventSubscriber) RuleRegistry(org.openhab.core.automation.RuleRegistry) SwitchItem(org.openhab.core.library.items.SwitchItem) RuleManager(org.openhab.core.automation.RuleManager) RuleBuilder(org.openhab.core.automation.util.RuleBuilder) LoggerFactory(org.slf4j.LoggerFactory) OnOffType(org.openhab.core.library.types.OnOffType) Checks.requireNonNull(org.eclipse.jdt.annotation.Checks.requireNonNull) RuleEngineImpl(org.openhab.core.automation.internal.RuleEngineImpl) ArrayList(java.util.ArrayList) Nullable(org.eclipse.jdt.annotation.Nullable) Configuration(org.openhab.core.config.core.Configuration) Map(java.util.Map) ModuleBuilder(org.openhab.core.automation.util.ModuleBuilder) EventFilter(org.openhab.core.events.EventFilter) Map.entry(java.util.Map.entry) LinkedList(java.util.LinkedList) EventPublisher(org.openhab.core.events.EventPublisher) ServiceReference(org.osgi.framework.ServiceReference) ItemCommandEvent(org.openhab.core.items.events.ItemCommandEvent) NonNullByDefault(org.eclipse.jdt.annotation.NonNullByDefault) Logger(org.slf4j.Logger) ItemProvider(org.openhab.core.items.ItemProvider) Collection(java.util.Collection) Event(org.openhab.core.events.Event) ItemNotFoundException(org.openhab.core.items.ItemNotFoundException) Set(java.util.Set) ReadyMarker(org.openhab.core.service.ReadyMarker) Rule(org.openhab.core.automation.Rule) Item(org.openhab.core.items.Item) Test(org.junit.jupiter.api.Test) ItemRegistry(org.openhab.core.items.ItemRegistry) RuleStatus(org.openhab.core.automation.RuleStatus) List(java.util.List) JavaOSGiTest(org.openhab.core.test.java.JavaOSGiTest) Assertions(org.junit.jupiter.api.Assertions) ProviderChangeListener(org.openhab.core.common.registry.ProviderChangeListener) Queue(java.util.Queue) EventSubscriber(org.openhab.core.events.EventSubscriber) ItemCommandEvent(org.openhab.core.items.events.ItemCommandEvent) Event(org.openhab.core.events.Event)

Example 5 with EventFilter

use of org.openhab.core.events.EventFilter in project openhab-core by openhab.

the class GroupItemOSGiTest method beforeEach.

@BeforeEach
public void beforeEach() {
    registerVolatileStorageService();
    itemRegistry = getService(ItemRegistry.class);
    assertNotNull(itemRegistry);
    registerService(new EventSubscriber() {

        @Override
        public void receive(Event event) {
            events.add(event);
        }

        @Override
        public Set<String> getSubscribedEventTypes() {
            Set<String> hs = new HashSet<>();
            hs.add(ItemUpdatedEvent.TYPE);
            return hs;
        }

        @Override
        @Nullable
        public EventFilter getEventFilter() {
            return null;
        }
    });
    when(unitProviderMock.getUnit(Temperature.class)).thenReturn(Units.CELSIUS);
    itemStateConverter = new ItemStateConverterImpl(unitProviderMock);
}
Also used : EventSubscriber(org.openhab.core.events.EventSubscriber) Set(java.util.Set) HashSet(java.util.HashSet) GroupItemStateChangedEvent(org.openhab.core.items.events.GroupItemStateChangedEvent) ItemUpdatedEvent(org.openhab.core.items.events.ItemUpdatedEvent) ItemCommandEvent(org.openhab.core.items.events.ItemCommandEvent) Event(org.openhab.core.events.Event) ItemStateConverterImpl(org.openhab.core.internal.items.ItemStateConverterImpl) EventFilter(org.openhab.core.events.EventFilter) Nullable(org.eclipse.jdt.annotation.Nullable) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

EventFilter (org.openhab.core.events.EventFilter)11 Nullable (org.eclipse.jdt.annotation.Nullable)10 Event (org.openhab.core.events.Event)10 EventSubscriber (org.openhab.core.events.EventSubscriber)10 Set (java.util.Set)9 BeforeEach (org.junit.jupiter.api.BeforeEach)9 Collection (java.util.Collection)8 NonNullByDefault (org.eclipse.jdt.annotation.NonNullByDefault)8 Test (org.junit.jupiter.api.Test)8 Item (org.openhab.core.items.Item)8 ItemProvider (org.openhab.core.items.ItemProvider)8 ItemRegistry (org.openhab.core.items.ItemRegistry)8 SwitchItem (org.openhab.core.library.items.SwitchItem)8 OnOffType (org.openhab.core.library.types.OnOffType)8 JavaOSGiTest (org.openhab.core.test.java.JavaOSGiTest)8 Logger (org.slf4j.Logger)8 LoggerFactory (org.slf4j.LoggerFactory)8 List (java.util.List)7 ItemCommandEvent (org.openhab.core.items.events.ItemCommandEvent)7 CoreMatchers (org.hamcrest.CoreMatchers)6