Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Waibel2012-01-03 11:15:02 +0000
committerFlorian Waibel2012-01-03 11:15:02 +0000
commit50c796f35e6c34a4175455f0ad156ac3bee0e0b5 (patch)
treed7a15b71ba2789bee9799271a5709c0481430727 /org.eclipse.virgo.kernel.deployer.test/src/test
parent51a2b96b9066e279e1bdc980a26495a3b2b18ae0 (diff)
downloadorg.eclipse.virgo.kernel-50c796f35e6c34a4175455f0ad156ac3bee0e0b5.tar.gz
org.eclipse.virgo.kernel-50c796f35e6c34a4175455f0ad156ac3bee0e0b5.tar.xz
org.eclipse.virgo.kernel-50c796f35e6c34a4175455f0ad156ac3bee0e0b5.zip
#365034 - Added additional test case with changed undeployment order
Diffstat (limited to 'org.eclipse.virgo.kernel.deployer.test/src/test')
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/PlanDeploymentTests.java2
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/PlanDeploymentWithDAGTests.java34
2 files changed, 35 insertions, 1 deletions
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 c6d7b891..2862b4ec 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
@@ -274,7 +274,7 @@ public class PlanDeploymentTests extends AbstractDeployerIntegrationTest {
}
}
- private static List<String> getInstalledBsns(Bundle[] bundles) {
+ static List<String> getInstalledBsns(Bundle[] bundles) {
List<String> installedBsns = new ArrayList<String>(bundles.length);
for (Bundle bundle : bundles) {
installedBsns.add(bundle.getSymbolicName());
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 18d88980..dc629d5c 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
@@ -13,11 +13,15 @@ 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.assertTrue;
import java.io.File;
+import java.util.List;
import org.eclipse.virgo.kernel.deployer.core.DeploymentIdentity;
import org.junit.Test;
+import org.osgi.framework.Bundle;
// TODO 1c. (transitive dependencies) (@see https://bugs.eclipse.org/bugs/show_bug.cgi?id=365034)
public class PlanDeploymentWithDAGTests extends AbstractDeployerIntegrationTest {
@@ -43,6 +47,36 @@ 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);
+
+ 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);
+
+ this.deployer.undeploy(deploymentIdentity);
+ assertBundlesNotInstalled(this.context.getBundles(), BUNDLE_ONE_SYMBOLIC_NAME);
+ }
+
+ private void assertNoDuplicatesInstalled(Bundle[] bundles, String bundleOneSymbolicName) {
+ List<String> installedBsns = getInstalledBsns(bundles);
+ int found = 0;
+ for (String installedBsn : installedBsns) {
+ if (installedBsn.contains(bundleOneSymbolicName)) {
+ found++;
+ }
+ }
+ assertTrue("Too many bundles '" + bundleOneSymbolicName + "' found. Should be shared.", found <= 1);
+ }
+
+ @Test
// 1b. (@see https://bugs.eclipse.org/bugs/show_bug.cgi?id=365034)
public void twoPlansReferencingASharedBundle() throws Exception {

Back to the top