when(s3.getProperty(Constants.SERVICE_ID)).thenReturn(new Long(17));
when(bundle.getServicesInUse()).thenReturn(new ServiceReference[] { s1, s2, s3 });
BundleData b = new BundleData(context, bundle, packageAdmin, startLevel);
CompositeData compositeData = b.toCompositeData();
assertEquals("test", compositeData.get(SYMBOLIC_NAME));
assertEquals("0.0.0", (String) compositeData.get(VERSION));
TabularData headerTable = (TabularData) compositeData.get(HEADERS);
assertEquals(4, headerTable.values().size());
CompositeData header = headerTable.get(new Object[]{Constants.BUNDLE_SYMBOLICNAME});
assertNotNull(header);
String value = (String) header.get(VALUE);
assertEquals("test", value);
String key = (String)header.get(KEY);
assertEquals(Constants.BUNDLE_SYMBOLICNAME, key);
TabularData bundleTable = new TabularDataSupport(BUNDLES_TYPE);
bundleTable.put(b.toCompositeData());
CompositeData bundleData = bundleTable.get(new Object[]{Long.valueOf(1)});
assertNotNull(bundleData);
String location = (String) bundleData.get(LOCATION);
assertEquals("location", location);
assertArrayEquals(new String[] { "org.apache.aries.jmx;1.0.0"} , (String[]) compositeData.get(EXPORTED_PACKAGES));
assertArrayEquals(new String[] { "org.apache.aries.jmx.b1;0.0.0" , "org.apache.aries.jmx.b2;2.0.1"}, (String[]) compositeData.get(IMPORTED_PACKAGES));
assertEquals(toSet(new long[] { 44, 55, 66 }), toSet((Long[]) compositeData.get(REQUIRED_BUNDLES)));