Enumeration<URL> rsBEnum = Collections.enumeration(Arrays.asList(rsB));
URL rsC = getClass().getResource("/rs_f.xml");
Enumeration<URL> rsCEnum = Collections.enumeration(Arrays.asList(rsC));
// Set up some mock objects
IMocksControl control = EasyMock.createNiceControl();
Bundle b0 = control.createMock(Bundle.class);
EasyMock.expect(b0.getState()).andReturn(Bundle.ACTIVE).anyTimes();
EasyMock.expect(b0.findEntries("OSGI-INF/remote-service", "*.xml", false)).
andReturn(rsAEnum).anyTimes();
BundleContext bc = control.createMock(BundleContext.class);
Filter mockFilter = control.createMock(Filter.class);
ServiceReference sr = control.createMock(ServiceReference.class);
TestDiscoveredServiceTracker dst = new TestDiscoveredServiceTracker();
EasyMock.expect(bc.getBundles()).andReturn(new Bundle[] {b0}).anyTimes();
EasyMock.expect(bc.createFilter("(blah <= 5)")).andReturn(mockFilter).anyTimes();
EasyMock.expect(sr.getProperty(DiscoveredServiceTracker.FILTER_MATCH_CRITERIA)).
andReturn(Collections.singleton("(blah <= 5)")).anyTimes();
EasyMock.expect(bc.getService(sr)).andReturn(dst).anyTimes();
// set up the mock filter behaviour
Dictionary<String, Object> d1 = new Hashtable<String, Object>();
d1.put("blah", "5");
EasyMock.expect(mockFilter.match(d1)).andReturn(true).anyTimes();
Dictionary<String, Object> d2 = new Hashtable<String, Object>();
d2.put("blah", "3");
d2.put("boo", "hello");
EasyMock.expect(mockFilter.match(d2)).andReturn(true).anyTimes();
control.replay();
// create the local discovery service
LocalDiscoveryService lds = new LocalDiscoveryService(bc);
// it should be prepopulated with the info from bundle b0