Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.

Fix getExistingDiscoveryResult no longer filtering on Thing UID #4533

Merged
merged 1 commit into from
Nov 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,10 @@ class DiscoveryServiceRegistryOSGITest extends OSGiTest {

// verify that the existing DiscoveryResult can be accessed
assertNotNull extendedDiscoveryServiceMock.discoveryServiceCallback.getExistingDiscoveryResult(thingUID)

// verify that a non-existing DiscoveryResult can not be accessed
thingUID = new ThingUID(EXTENDED_BINDING_ID, EXTENDED_THING_TYPE, "bar")
assertNull extendedDiscoveryServiceMock.discoveryServiceCallback.getExistingDiscoveryResult(thingUID)
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/
package org.eclipse.smarthome.config.discovery.internal;

import static org.eclipse.smarthome.config.discovery.inbox.InboxPredicates.withFlag;
import static org.eclipse.smarthome.config.discovery.inbox.InboxPredicates.*;

import java.security.AccessController;
import java.security.PrivilegedAction;
Expand Down Expand Up @@ -154,7 +154,8 @@ public DiscoveryResult getExistingDiscoveryResult(ThingUID thingUID) {
return null;
}
List<DiscoveryResult> ret = new ArrayList<>();
ret = inboxReference.stream().filter(withFlag((DiscoveryResultFlag.NEW))).collect(Collectors.toList());
ret = inboxReference.stream().filter(withFlag(DiscoveryResultFlag.NEW).and(forThingUID(thingUID)))
.collect(Collectors.toList());
if (ret.size() > 0) {
return ret.get(0);
} else {
Expand Down