Map<Collection<String>, String> eids = getEndpointIDs(lds.servicesInfo.keySet());
Map<String, Object> sed1Props = new HashMap<String, Object>();
sed1Props.put("osgi.remote.requires.intents", "confidentiality");
setEndpointID(eids, sed1Props, "org.example.SomeService");
ServiceEndpointDescription sed1 = new ServiceEndpointDescriptionImpl(
Arrays.asList("org.example.SomeService"), sed1Props);
Map<String, Object> sed2Props = new HashMap<String, Object>();
setEndpointID(eids, sed2Props, "SomeOtherService", "WithSomeSecondInterface");
ServiceEndpointDescription sed2 = new ServiceEndpointDescriptionImpl(
Arrays.asList("SomeOtherService", "WithSomeSecondInterface"), sed2Props);
assertTrue(lds.servicesInfo.containsKey(sed1));
assertTrue(lds.servicesInfo.containsKey(sed2));
// should be pre-populated by now...
// register a tracker, it should get called back instantly with sed1
assertEquals("Precondition failed", 0, dst.notifications.size());
lds.trackerTracker.addingService(sr);
assertEquals(1, dst.notifications.size());
DiscoveredServiceNotification dsn = dst.notifications.iterator().next();
assertEquals(DiscoveredServiceNotification.AVAILABLE, dsn.getType());
assertEquals(sed1, dsn.getServiceEndpointDescription());
verifyNotification(dsn, 0, 1, "org.example.SomeService");
// add a new bundle that also contains a someservice
// we should get notified again...
Bundle b1 = EasyMock.createNiceMock(Bundle.class);
EasyMock.expect(b1.getState()).andReturn(Bundle.ACTIVE).anyTimes();
EasyMock.expect(b1.findEntries("OSGI-INF/remote-service", "*.xml", false)).
andReturn(rsBEnum).anyTimes();
EasyMock.replay(b1);
// Call back on the LDS just like what would have happened with the BundleListener
BundleEvent be = new BundleEvent(BundleEvent.STARTED, b1);
lds.bundleChanged(be);
Map<Collection<String>, String> eids2 = getEndpointIDs(lds.servicesInfo.keySet());
Map<String, Object> sed3Props = new HashMap<String, Object>();
setEndpointID(eids2, sed3Props, "org.example.SomeRelatedService", "org.example.SomeService");
ServiceEndpointDescription sed3 = new ServiceEndpointDescriptionImpl(
Arrays.asList("org.example.SomeRelatedService", "org.example.SomeService"), sed3Props);
assertEquals(3, lds.servicesInfo.size());
assertTrue(lds.servicesInfo.containsKey(sed1));
assertTrue(lds.servicesInfo.containsKey(sed2));
assertTrue(lds.servicesInfo.containsKey(sed3));