waitForMBean(new ObjectName(FrameworkMBean.OBJECTNAME));
}
@Test
public void testMBeanInterface() throws IOException {
FrameworkMBean framework = getMBean(FrameworkMBean.OBJECTNAME, FrameworkMBean.class);
assertNotNull(framework);
long[] bundleIds = new long[]{1,2};
int[] newlevels = new int[]{1,1};
CompositeData compData = framework.setBundleStartLevels(bundleIds, newlevels);
assertNotNull(compData);
BatchActionResult batch2 = BatchActionResult.from(compData);
assertNotNull(batch2.getCompleted());
assertTrue(batch2.isSuccess());
assertNull(batch2.getError());
assertNull(batch2.getRemainingItems());
File file = File.createTempFile("bundletest", ".jar");
file.deleteOnExit();
Manifest man = new Manifest();
man.getMainAttributes().putValue("Manifest-Version", "1.0");
JarOutputStream jaros = new JarOutputStream(new FileOutputStream(file), man);
jaros.flush();
jaros.close();
long bundleId = 0;
try {
bundleId = framework.installBundleFromURL(file.getAbsolutePath(), file.toURI().toString());
} catch (Exception e) {
fail("Installation of test bundle shouldn't fail");
}
try{
framework.uninstallBundle(bundleId);
} catch (Exception e) {
fail("Uninstallation of test bundle shouldn't fail");
}
}