diff options
author | Glyn Normington | 2012-07-17 05:20:41 -0400 |
---|---|---|
committer | Glyn Normington | 2012-07-17 05:20:41 -0400 |
commit | 711089f9e9b16ff0e09402c07da12fa00040bf05 (patch) | |
tree | 405bcf83c04ab51f4e020b2b0f8260be75aeb3a4 | |
parent | 841de2679c12426cc9b0b20a3b78a65323660883 (diff) | |
download | org.eclipse.virgo.kernel-711089f9e9b16ff0e09402c07da12fa00040bf05.tar.gz org.eclipse.virgo.kernel-711089f9e9b16ff0e09402c07da12fa00040bf05.tar.xz org.eclipse.virgo.kernel-711089f9e9b16ff0e09402c07da12fa00040bf05.zip |
385264: improve test cleanup
2 files changed, 20 insertions, 1 deletions
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/DMSPlanDeploymentTests.java b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/DMSPlanDeploymentTests.java index c865af14..c6c15495 100644 --- a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/DMSPlanDeploymentTests.java +++ b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/DMSPlanDeploymentTests.java @@ -147,6 +147,7 @@ public class DMSPlanDeploymentTests extends AbstractDeployerIntegrationTest { } } } + private void checkConfigAvailable(String pid, File propertiesFile) throws IOException { Configuration configuration = this.configAdmin.getConfiguration(pid, null); Dictionary<String, Object> dictionary = configuration.getProperties(); diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/PlanDeploymentTests.java b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/PlanDeploymentTests.java index ff3d1262..062561d1 100644 --- a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/PlanDeploymentTests.java +++ b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/PlanDeploymentTests.java @@ -142,6 +142,8 @@ public class PlanDeploymentTests extends AbstractDeployerIntegrationTest { if (propertiesFile != null) { checkConfigUnavailable(pid); } + + uninstallBundles(afterUndeployBundles, "simple.fragment.one"); } private void testPlanDeploymentStartingEvents(File plan, String... candidateBsns) throws Exception { @@ -179,8 +181,24 @@ public class PlanDeploymentTests extends AbstractDeployerIntegrationTest { this.deployer.undeploy(deploymentIdentity); Bundle[] afterUndeployBundles = this.context.getBundles(); assertBundlesNotInstalled(afterUndeployBundles, candidateBsns); + + uninstallBundles(afterUndeployBundles, "simple.fragment.one"); } - + + private void uninstallBundles(Bundle[] bundles, String... uninstallBsns) { + for (Bundle bundle : bundles) { + String symbolicName = bundle.getSymbolicName(); + for (String uninstallBsn : uninstallBsns) { + if (uninstallBsn.equals(symbolicName)) { + try { + bundle.uninstall(); + } catch (BundleException _) { + } + } + } + } + } + private class StartBundleRunnable implements Runnable { BundleContext context = null; |