/** * test the supplementer registry by adding a supplementing bundle to it * * @throws Exception */ public void testSupplementerRegistryWithSupplementer() throws Exception { final Hashtable headers = new Hashtable(); headers.put("Eclipse-SupplementBundle", "test.bundle1"); EasyMock.expect(bundle.getHeaders()).andStubReturn(headers); EasyMock.expect(context.getBundles()).andReturn(new Bundle[] {bundle}); EasyMock.replay(mocks); registry.addBundle(bundle); final ManifestElement[] imports = ManifestElement.parseHeader("Import-Package", "org.test1,\n org.test2"); final ManifestElement[] exports = ManifestElement.parseHeader("Export-Package", "org.test3,\n org.test4"); final List<Supplementer> supplementers = registry.getMatchingSupplementers("test.bundle1", imports, exports); assertNotNull(supplementers); assertEquals(1, supplementers.size()); assertEquals(bundle, supplementers.get(0).getSupplementerBundle()); EasyMock.verify(mocks); }
/** * test an empty supplementer registry * * @throws Exception */ public void testSupplementerRegistryEmpty() throws Exception { EasyMock.replay(mocks); Supplementer[] supplementers = registry.getSupplementers(0); assertNotNull(supplementers); assertEquals(0, supplementers.length); supplementers = registry.getSupplementers(bundle); assertNotNull(supplementers); assertEquals(0, supplementers.length); EasyMock.verify(mocks); final ManifestElement[] imports = ManifestElement.parseHeader("Import-Package", "org.test1,\n org.test2"); final ManifestElement[] exports = ManifestElement.parseHeader("Export-Package", "org.test3,\n org.test4"); final List<Supplementer> possibleSupplementers = registry.getMatchingSupplementers("symbolicName", imports, exports); assertNotNull(possibleSupplementers); assertEquals(0, possibleSupplementers.size()); }