assertEquals(1, bwbCaps.size());
Map<String, Object> expectedBWBAttrs = new HashMap<String, Object>();
expectedBWBAttrs.put("osgi.wiring.bundle", "cap.bundle");
expectedBWBAttrs.put("bundle-version", Version.parseVersion("1.2.3.Blah"));
Capability expectedBWBCap = new TestCapability("osgi.wiring.bundle",
expectedBWBAttrs, Collections.<String, String>emptyMap());
assertCapsEquals(expectedBWBCap, bwbCaps.get(0));
List<Capability> bwhCaps = bbr.getCapabilities("osgi.wiring.host");
assertEquals(1, bwhCaps.size());
Map<String, Object> expectedBWHAttrs = new HashMap<String, Object>();
expectedBWHAttrs.put("osgi.wiring.host", "cap.bundle");
expectedBWHAttrs.put("bundle-version", Version.parseVersion("1.2.3.Blah"));
Capability expectedBWHCap = new TestCapability("osgi.wiring.host",
expectedBWHAttrs, Collections.<String, String>emptyMap());
assertCapsEquals(expectedBWHCap, bwhCaps.get(0));
List<Capability> bwiCaps = bbr.getCapabilities("osgi.identity");
assertEquals(1, bwiCaps.size());
Map<String, Object> expectedBWIAttrs = new HashMap<String, Object>();
expectedBWIAttrs.put("osgi.identity", "cap.bundle");
expectedBWIAttrs.put("type", "osgi.bundle");
expectedBWIAttrs.put("version", Version.parseVersion("1.2.3.Blah"));
Capability expectedBWICap = new TestCapability("osgi.identity",
expectedBWIAttrs, Collections.<String, String>emptyMap());
assertCapsEquals(expectedBWICap, bwiCaps.get(0));
assertEquals("The Bundle should not directly expose osgi.wiring.package",
0, bbr.getCapabilities("osgi.wiring.package").size());
// Check the fragment's capabilities.
// First check the capabilities on the Bundle Revision, which is available on installed fragments
BundleRevision fbr = f.adapt(BundleRevision.class);
List<Capability> fwpCaps = fbr.getCapabilities("osgi.wiring.package");
assertEquals(1, fwpCaps.size());
Map<String, Object> expectedFWAttrs = new HashMap<String, Object>();
expectedFWAttrs.put("osgi.wiring.package", "org.foo.bar");
expectedFWAttrs.put("version", Version.parseVersion("2"));
expectedFWAttrs.put("bundle-symbolic-name", "cap.frag");
expectedFWAttrs.put("bundle-version", Version.parseVersion("1.0.0"));
Capability expectedFWCap = new TestCapability("osgi.wiring.package",
expectedFWAttrs, Collections.<String, String>emptyMap());
assertCapsEquals(expectedFWCap, fwpCaps.get(0));
List<Capability> fiCaps = fbr.getCapabilities("osgi.identity");
assertEquals(1, fiCaps.size());
Map<String, Object> expectedFIAttrs = new HashMap<String, Object>();
expectedFIAttrs.put("osgi.identity", "cap.frag");
expectedFIAttrs.put("type", "osgi.fragment");
expectedFIAttrs.put("version", Version.parseVersion("1.0.0"));
Capability expectedFICap = new TestCapability("osgi.identity",
expectedFIAttrs, Collections.<String, String>emptyMap());
assertCapsEquals(expectedFICap, fiCaps.get(0));
// Start the bundle. This will make the BundleWiring available on both the bundle and the fragment
b.start();