ListenerHookImpl implements ListenerHook { String extendFilter(String filter) { return "(&" + filter + "(!(" + RemoteConstants.ENDPOINT_FRAMEWORK_UUID + "=" + frameworkUUID + ")))"; } ListenerHookImpl(BundleContext bc, ServiceInterestListener serviceInterestListener); @Override void added(Collection<ListenerInfo> listeners); @Override void removed(Collection<ListenerInfo> listeners);  }
@Test public void testExtendFilter() throws InvalidSyntaxException { String filter = "(a=b)"; BundleContext bc = createBundleContext(); filter = new ListenerHookImpl(bc, null).extendFilter(filter); Filter f = FrameworkUtil.createFilter(filter); Dictionary<String, String> m = new Hashtable<>(); m.put("a", "b"); assertTrue(filter + " filter must match as uuid is missing", f.match(m)); m.put(RemoteConstants.ENDPOINT_FRAMEWORK_UUID, "MyUUID"); assertFalse(filter + " filter must NOT match as uuid is the local one", f.match(m)); }