Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlyn Normington2012-01-27 06:35:34 -0500
committerGlyn Normington2012-01-27 06:35:34 -0500
commit8e7d9fad4bb11de299cead813f8ababe60dfc4dc (patch)
tree6e814b77444a488c8c82966ada8e813afe7756ee /org.eclipse.virgo.kernel.deployer.test/src/test/java
parenta30076a8536dec2876665b56f7c960280390a99e (diff)
downloadorg.eclipse.virgo.kernel-8e7d9fad4bb11de299cead813f8ababe60dfc4dc.tar.gz
org.eclipse.virgo.kernel-8e7d9fad4bb11de299cead813f8ababe60dfc4dc.tar.xz
org.eclipse.virgo.kernel-8e7d9fad4bb11de299cead813f8ababe60dfc4dc.zip
358447: avoid stopping an artefact with at least one active parent
Diffstat (limited to 'org.eclipse.virgo.kernel.deployer.test/src/test/java')
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/PlanDeploymentWithDAGTests.java54
1 files changed, 51 insertions, 3 deletions
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/PlanDeploymentWithDAGTests.java b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/PlanDeploymentWithDAGTests.java
index dc629d5c..6ecd0cbe 100644
--- a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/PlanDeploymentWithDAGTests.java
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/PlanDeploymentWithDAGTests.java
@@ -14,6 +14,7 @@ package org.eclipse.virgo.kernel.deployer.test;
import static org.eclipse.virgo.kernel.deployer.test.PlanDeploymentTests.assertBundlesInstalled;
import static org.eclipse.virgo.kernel.deployer.test.PlanDeploymentTests.assertBundlesNotInstalled;
import static org.eclipse.virgo.kernel.deployer.test.PlanDeploymentTests.getInstalledBsns;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.io.File;
@@ -31,7 +32,7 @@ public class PlanDeploymentWithDAGTests extends AbstractDeployerIntegrationTest
@Test
// 1a. (@see https://bugs.eclipse.org/bugs/show_bug.cgi?id=365034)
public void planReferencingAnAlreadyInstalledBundle() throws Exception {
-
+
File file = new File("src/test/resources/plan-deployment/simple.bundle.one.jar");
DeploymentIdentity deploymentId = this.deployer.deploy(file.toURI());
assertBundlesInstalled(this.context.getBundles(), BUNDLE_ONE_SYMBOLIC_NAME);
@@ -49,7 +50,7 @@ public class PlanDeploymentWithDAGTests extends AbstractDeployerIntegrationTest
@Test
// 1a. (@see https://bugs.eclipse.org/bugs/show_bug.cgi?id=365034)
public void planReferencingAnAlreadyInstalledBundleUndeployBundleFirst() throws Exception {
-
+
File file = new File("src/test/resources/plan-deployment/simple.bundle.one.jar");
DeploymentIdentity deploymentId = this.deployer.deploy(file.toURI());
assertBundlesInstalled(this.context.getBundles(), BUNDLE_ONE_SYMBOLIC_NAME);
@@ -57,7 +58,7 @@ public class PlanDeploymentWithDAGTests extends AbstractDeployerIntegrationTest
DeploymentIdentity deploymentIdentity = this.deployer.deploy(new File("src/test/resources/testunscopednonatomicA.plan").toURI());
assertNoDuplicatesInstalled(this.context.getBundles(), BUNDLE_ONE_SYMBOLIC_NAME);
assertBundlesInstalled(this.context.getBundles(), BUNDLE_ONE_SYMBOLIC_NAME);
-
+
this.deployer.undeploy(deploymentId.getType(), deploymentId.getSymbolicName(), deploymentId.getVersion());
assertBundlesInstalled(this.context.getBundles(), BUNDLE_ONE_SYMBOLIC_NAME);
@@ -112,4 +113,51 @@ public class PlanDeploymentWithDAGTests extends AbstractDeployerIntegrationTest
assertBundlesNotInstalled(this.context.getBundles(), BUNDLE_ONE_SYMBOLIC_NAME);
}
+ @Test
+ public void testLifecycleWithTwoPlansReferencingASharedBundle() throws Exception {
+
+ DeploymentIdentity deploymentIdentityPlanA = this.deployer.deploy(new File("src/test/resources/testunscopednonatomicA.plan").toURI());
+ assertBundlesActive(this.context.getBundles(), BUNDLE_ONE_SYMBOLIC_NAME);
+
+ DeploymentIdentity deploymentIdentityPlanB = this.deployer.deploy(new File("src/test/resources/testunscopednonatomicB.plan").toURI());
+ assertBundlesActive(this.context.getBundles(), BUNDLE_ONE_SYMBOLIC_NAME);
+
+ this.deployer.undeploy(deploymentIdentityPlanB);
+
+ assertBundlesActive(this.context.getBundles(), BUNDLE_ONE_SYMBOLIC_NAME);
+
+ this.deployer.undeploy(deploymentIdentityPlanA);
+ }
+
+ @Test
+ public void testLifecycleWithPlanReferencingAnAlreadyInstalledBundleUndeployBundleFirst() throws Exception {
+
+ File file = new File("src/test/resources/plan-deployment/simple.bundle.one.jar");
+ DeploymentIdentity deploymentId = this.deployer.deploy(file.toURI());
+ assertBundlesActive(this.context.getBundles(), BUNDLE_ONE_SYMBOLIC_NAME);
+
+ DeploymentIdentity deploymentIdentity = this.deployer.deploy(new File("src/test/resources/testunscopednonatomicA.plan").toURI());
+ assertBundlesActive(this.context.getBundles(), BUNDLE_ONE_SYMBOLIC_NAME);
+
+ this.deployer.undeploy(deploymentId.getType(), deploymentId.getSymbolicName(), deploymentId.getVersion());
+ assertBundlesActive(this.context.getBundles(), BUNDLE_ONE_SYMBOLIC_NAME);
+
+ this.deployer.undeploy(deploymentIdentity);
+ }
+
+
+
+ static void assertBundlesActive(Bundle[] bundles, String... bsns) {
+ for (String bsn : bsns) {
+ boolean found = false;
+ for (Bundle bundle : bundles) {
+ if (bsn.equals(bundle.getSymbolicName())) {
+ found = true;
+ assertEquals(Bundle.ACTIVE, bundle.getState());
+ }
+ }
+ assertTrue(found);
+ }
+ }
+
}

Back to the top