2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.homematic.test.util;
15 import java.util.Collection;
16 import java.util.Queue;
17 import java.util.concurrent.ConcurrentLinkedQueue;
19 import org.eclipse.jdt.annotation.NonNull;
20 import org.eclipse.jdt.annotation.Nullable;
21 import org.openhab.core.config.discovery.DiscoveryListener;
22 import org.openhab.core.config.discovery.DiscoveryResult;
23 import org.openhab.core.config.discovery.DiscoveryService;
24 import org.openhab.core.thing.ThingTypeUID;
25 import org.openhab.core.thing.ThingUID;
28 * This {@link DiscoveryListener} implementation simply records all discovered
29 * results, so that they can be checked after the discovery.
31 * @author Florian Stolte - Initial Contribution
34 public class SimpleDiscoveryListener implements DiscoveryListener {
36 public Queue<DiscoveryResult> discoveredResults = new ConcurrentLinkedQueue<>();
39 public void thingRemoved(DiscoveryService source, ThingUID thingUID) {
43 public void thingDiscovered(DiscoveryService source, DiscoveryResult result) {
44 discoveredResults.add(result);
48 public @Nullable Collection<@NonNull ThingUID> removeOlderResults(DiscoveryService source, long timestamp,
49 @Nullable Collection<@NonNull ThingTypeUID> thingTypeUIDs, @Nullable ThingUID bridgeUID) {