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

Commit

Permalink
Fix getExistingDiscoveryResult no longer filtering on Thing UID (#4533)
Browse files Browse the repository at this point in the history
Signed-off-by: Wouter Born <eclipse@maindrain.net>
  • Loading branch information
wborn authored and maggu2810 committed Nov 13, 2017
1 parent 96b013c commit bf3d166
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
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
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

0 comments on commit bf3d166

Please sign in to comment.