amichair commented on code in PR #115:
URL: https://github.com/apache/aries-rsa/pull/115#discussion_r3261086957
##########
discovery/local/src/test/java/org/apache/aries/rsa/discovery/local/LocalDiscoveryTest.java:
##########
@@ -18,339 +18,284 @@
*/
package org.apache.aries.rsa.discovery.local;
+import static org.easymock.EasyMock.*;
+import static org.easymock.EasyMock.anyObject;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertSame;
import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Dictionary;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
Review Comment:
I really should change the IDE auto-import settings... maybe tomorrow ;-)
##########
discovery/local/src/main/java/org/apache/aries/rsa/discovery/local/LocalDiscovery.java:
##########
@@ -50,16 +49,25 @@
@Component(immediate = true)
public class LocalDiscovery implements BundleListener {
- // this is effectively a set which allows for multiple service
descriptions with the
- // same interface name but different properties and takes care of itself
with respect to concurrency
- final Map<EndpointDescription, Bundle> endpointDescriptions = new
ConcurrentHashMap<>();
- final Map<EndpointEventListener, Collection<String>> listenerToFilters =
new HashMap<>();
- final Map<String, Collection<EndpointEventListener>> filterToListeners =
new HashMap<>();
+ final Map<Bundle, Collection<EndpointDescription>> endpoints = new
ConcurrentHashMap<>();
+ final Map<EndpointEventListener, Collection<Filter>> listenerToFilters =
new HashMap<>();
- EndpointDescriptionBundleParser bundleParser;
+ EndpointDescriptionBundleParser parser;
public LocalDiscovery() {
- this.bundleParser = new EndpointDescriptionBundleParser();
+ this.parser = new EndpointDescriptionBundleParser();
+ }
+
+ private static List<Filter>
createFilters(ServiceReference<EndpointEventListener> ref) {
+ List<String> values =
StringPlus.normalize(ref.getProperty(EndpointEventListener.ENDPOINT_LISTENER_SCOPE));
+ List<Filter> filters = new ArrayList<>(values.size());
+ for (String value : values) {
+ try {
+ filters.add(FrameworkUtil.createFilter(value));
+ } catch (InvalidSyntaxException ignore) { // bad filter never
matches
Review Comment:
Clarified the comment and added a trace log.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]