Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlyn Normington2011-03-19 15:15:11 -0400
committerGlyn Normington2011-03-19 15:15:11 -0400
commitbfce058527331aff06b05a6ea26b44ec6ba276cb (patch)
treea970b0c6596055651071960b859ee0ac89d4beb8 /org.eclipse.virgo.kernel.deployer.test/src/test/java
parent3694eff6052d8d0f9c63eeb7e081671ba7c65d5e (diff)
downloadorg.eclipse.virgo.kernel-bfce058527331aff06b05a6ea26b44ec6ba276cb.tar.gz
org.eclipse.virgo.kernel-bfce058527331aff06b05a6ea26b44ec6ba276cb.tar.xz
org.eclipse.virgo.kernel-bfce058527331aff06b05a6ea26b44ec6ba276cb.zip
bug 335689: support plans inside PARs
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/ParDeploymentTests.java53
1 files changed, 31 insertions, 22 deletions
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/ParDeploymentTests.java b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/ParDeploymentTests.java
index 078324d5..dd2fce8e 100644
--- a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/ParDeploymentTests.java
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/ParDeploymentTests.java
@@ -27,38 +27,40 @@ import org.osgi.framework.InvalidSyntaxException;
import org.osgi.framework.Version;
import org.osgi.service.cm.Configuration;
-
-/**
- */
public class ParDeploymentTests extends AbstractDeployerIntegrationTest {
-
+
private static final File PAR_FILE = new File("src/test/resources/BundlesAndConfig.par");
+
private static final File PAR_FOR_BUG331767 = new File("src/test/resources/bug331767.par");
- private static final File PAR_FOR_BUG330506 = new File("src/test/resources/bug330506.par");
-
+
+ private static final File PAR_FOR_BUG330506 = new File("src/test/resources/bug330506.par");
+
+ private static final File PAR_CONTAINING_PLAN = new File("src/test/resources/plan-in-par/ParContainingPlan.par");
+
private static final String BUNDLE_SYMBOLIC_NAME = "appA-1-bundleA";
+
private static final String BUNDLE_SYMBOLIC_NAME_BUG331767 = "PARbug331767-1-BUNDLEbug331767";
- private static final Version BUNDLE_VERSION = new Version(1,0,0);
+ private static final Version BUNDLE_VERSION = new Version(1, 0, 0);
@Test
public void deployParContainingBundlesAndProperties() throws DeploymentException, IOException, InvalidSyntaxException {
DeploymentIdentity deploymentIdentity = this.deployer.deploy(PAR_FILE.toURI());
-
+
Configuration configuration = getConfiguration("foo");
- assertNotNull(configuration);
+ assertNotNull(configuration);
assertEquals("bar", configuration.getProperties().get("foo"));
-
+
assertBundlePresent(BUNDLE_SYMBOLIC_NAME, BUNDLE_VERSION);
-
+
this.deployer.undeploy(deploymentIdentity);
-
+
configuration = getConfiguration("foo");
assertNull(configuration);
-
+
assertBundleNotPresent(BUNDLE_SYMBOLIC_NAME, BUNDLE_VERSION);
}
-
+
@Test
public void deployParContainingDynamicImportStar() throws DeploymentException {
DeploymentIdentity deploymentIdentity = this.deployer.deploy(PAR_FOR_BUG331767.toURI());
@@ -66,31 +68,38 @@ public class ParDeploymentTests extends AbstractDeployerIntegrationTest {
this.deployer.undeploy(deploymentIdentity);
assertBundleNotPresent(BUNDLE_SYMBOLIC_NAME_BUG331767, BUNDLE_VERSION);
}
-
- @Test(expected=DeploymentException.class)
+
+ @Test(expected = DeploymentException.class)
public void deployParContainingFragmentOfSystemBundle() throws DeploymentException {
this.deployer.deploy(PAR_FOR_BUG330506.toURI());
}
-
+
+ @Test
+ public void deployParContainingPlan() throws DeploymentException {
+ DeploymentIdentity deploymentIdentity = this.deployer.deploy(PAR_CONTAINING_PLAN.toURI());
+ assertBundlePresent("par.with.plan-1-simple.bundle.one", new Version(1, 0, 0, "BUILD-20090326114035"));
+ this.deployer.undeploy(deploymentIdentity);
+ }
+
private void assertBundlePresent(String symbolicName, Version version) {
Bundle[] bundles = this.context.getBundles();
-
+
for (Bundle bundle : bundles) {
if (symbolicName.equals(bundle.getSymbolicName()) && version.equals(bundle.getVersion())) {
return;
}
}
-
+
fail("The bundle " + symbolicName + " " + version + " was not found.");
}
-
+
private void assertBundleNotPresent(String symbolicName, Version version) {
Bundle[] bundles = this.context.getBundles();
-
+
for (Bundle bundle : bundles) {
if (symbolicName.equals(bundle.getSymbolicName()) && version.equals(bundle.getVersion())) {
fail("Bundle " + bundle + " should not be present");
}
}
- }
+ }
}

Back to the top