AutomaticInboxProcessor extends AbstractTypedEventSubscriber<ThingStatusInfoChangedEvent> implements InboxListener, RegistryChangeListener<Thing> { @Activate protected void activate(@Nullable Map<String, @Nullable Object> properties) { thingRegistry.addRegistryChangeListener(this); inbox.addInboxListener(this); modified(properties); } @Activate  AutomaticInboxProcessor(final @Reference ThingTypeRegistry thingTypeRegistry,
            final @Reference ThingRegistry thingRegistry, final @Reference Inbox inbox); @Override void receiveTypedEvent(ThingStatusInfoChangedEvent event); @Override void thingAdded(Inbox inbox, DiscoveryResult result); @Override void thingUpdated(Inbox inbox, DiscoveryResult result); @Override void thingRemoved(Inbox inbox, DiscoveryResult result); @Override void added(Thing element); @Override void removed(Thing element); @Override void updated(Thing oldElement, Thing element); static final String AUTO_IGNORE_CONFIG_PROPERTY; static final String ALWAYS_AUTO_APPROVE_CONFIG_PROPERTY; }
@Test public void testAlwaysAutoApproveInboxEntries() { inbox.add(DiscoveryResultBuilder.create(THING_UID).build()); verify(thingRegistry, never()).add(argThat(thing -> THING_UID.equals(thing.getUID()))); Map<String, Object> configProperties = new HashMap<>(); configProperties.put(AutomaticInboxProcessor.ALWAYS_AUTO_APPROVE_CONFIG_PROPERTY, true); automaticInboxProcessor.activate(configProperties); verify(thingRegistry, times(1)).add(argThat(thing -> THING_UID.equals(thing.getUID()))); inbox.add(DiscoveryResultBuilder.create(THING_UID2).build()); verify(thingRegistry, times(1)).add(argThat(thing -> THING_UID2.equals(thing.getUID()))); }