waitForMBean(new ObjectName(PackageStateMBean.OBJECTNAME));
}
@Test
public void testMBeanInterface() throws IOException {
PackageStateMBean packagaState = getMBean(PackageStateMBean.OBJECTNAME, PackageStateMBean.class);
assertNotNull(packagaState);
long[] exportingBundles = packagaState.getExportingBundles("org.osgi.jmx.framework", "1.5.0");
assertNotNull(exportingBundles);
assertTrue("Should find a bundle exporting org.osgi.jmx.framework", exportingBundles.length > 0);
long[] exportingBundles2 = packagaState.getExportingBundles("test", "1.0.0");
assertNull("Shouldn't find a bundle exporting test package", exportingBundles2);
long[] importingBundlesId = packagaState
.getImportingBundles("org.osgi.jmx.framework", "1.5.0", exportingBundles[0]);
assertTrue("Should find bundles importing org.osgi.jmx.framework", importingBundlesId.length > 0);
TabularData table = packagaState.listPackages();
assertNotNull("TabularData containing CompositeData with packages info shouldn't be null", table);
assertEquals("TabularData should be a type PACKAGES", PackageStateMBean.PACKAGES_TYPE, table.getTabularType());
Collection colData = table.values();
assertNotNull("Collection of CompositeData shouldn't be null", colData);
assertFalse("Collection of CompositeData should contain elements", colData.isEmpty());
boolean isRemovalPending = packagaState.isRemovalPending("org.osgi.jmx.framework", "1.5.0", exportingBundles[0]);
assertFalse("Should removal pending on org.osgi.jmx.framework be false", isRemovalPending);
}