@Test public void testClientDeploymentAsArchive() throws Exception { String symbolicName = "archive-deployer-test-bundle"; Archive<?> archive = provider.getClientDeployment(symbolicName); String depname = archiveDeployer.deploy(archive); Bundle bundle = null; try { for (Bundle aux : context.getBundles()) { if (symbolicName.equals(aux.getSymbolicName())) { bundle = aux; break; } } // Assert that the bundle is there assertNotNull("Bundle found", bundle); // Start the bundle bundle.start(); OSGiTestHelper.assertBundleState(Bundle.ACTIVE, bundle.getState()); // Stop the bundle bundle.stop(); OSGiTestHelper.assertBundleState(Bundle.RESOLVED, bundle.getState()); } finally { archiveDeployer.undeploy(depname); // FIXME JBAS-9359 // OSGiTestHelper.assertBundleState(Bundle.UNINSTALLED, bundle.getState()); } }
@Test public void testBundleDeployment() throws Exception { InputStream input = provider.getClientDeploymentAsStream("test-bundle-one"); Bundle bundle = context.installBundle("test-bundle", input); try { // Assert that the bundle is in state INSTALLED OSGiTestHelper.assertBundleState(Bundle.INSTALLED, bundle.getState()); // Start the bundle bundle.start(); OSGiTestHelper.assertBundleState(Bundle.ACTIVE, bundle.getState()); // Stop the bundle bundle.stop(); OSGiTestHelper.assertBundleState(Bundle.RESOLVED, bundle.getState()); } finally { bundle.uninstall(); OSGiTestHelper.assertBundleState(Bundle.UNINSTALLED, bundle.getState()); } }