Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlyn Normington2012-01-20 07:54:06 -0500
committerGlyn Normington2012-01-20 07:54:06 -0500
commit6faec84aa985b2c5394ae3ac9162bd96f34ecd0a (patch)
tree584d994ba71faa7d668f99a66a568542e87ac960 /org.eclipse.virgo.kernel.artifact/src/test
parent51600344c8bd708e355a35786b10e3b744a9ee9b (diff)
downloadorg.eclipse.virgo.kernel-6faec84aa985b2c5394ae3ac9162bd96f34ecd0a.tar.gz
org.eclipse.virgo.kernel-6faec84aa985b2c5394ae3ac9162bd96f34ecd0a.tar.xz
org.eclipse.virgo.kernel-6faec84aa985b2c5394ae3ac9162bd96f34ecd0a.zip
reBug 327538 - support artifact URI in plan reader
Diffstat (limited to 'org.eclipse.virgo.kernel.artifact/src/test')
-rw-r--r--org.eclipse.virgo.kernel.artifact/src/test/java/org/eclipse/virgo/kernel/artifact/plan/PlanReaderTests.java37
-rw-r--r--org.eclipse.virgo.kernel.artifact/src/test/resources/plans/invalid-uri-name.plan11
-rw-r--r--org.eclipse.virgo.kernel.artifact/src/test/resources/plans/invalid-uri-type.plan11
-rw-r--r--org.eclipse.virgo.kernel.artifact/src/test/resources/plans/invalid-uri-versionrange.plan11
-rw-r--r--org.eclipse.virgo.kernel.artifact/src/test/resources/plans/single-uri.plan11
5 files changed, 81 insertions, 0 deletions
diff --git a/org.eclipse.virgo.kernel.artifact/src/test/java/org/eclipse/virgo/kernel/artifact/plan/PlanReaderTests.java b/org.eclipse.virgo.kernel.artifact/src/test/java/org/eclipse/virgo/kernel/artifact/plan/PlanReaderTests.java
index 3d962644..f4cbd86b 100644
--- a/org.eclipse.virgo.kernel.artifact/src/test/java/org/eclipse/virgo/kernel/artifact/plan/PlanReaderTests.java
+++ b/org.eclipse.virgo.kernel.artifact/src/test/java/org/eclipse/virgo/kernel/artifact/plan/PlanReaderTests.java
@@ -13,6 +13,7 @@ package org.eclipse.virgo.kernel.artifact.plan;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.io.FileInputStream;
@@ -53,6 +54,7 @@ public class PlanReaderTests {
assertEquals(new VersionRange("[1.0.0, 2.0.0)"), artifactSpecification.getVersionRange());
assertNotNull(artifactSpecification.getProperties());
assertTrue(artifactSpecification.getProperties().isEmpty());
+ assertNull(artifactSpecification.getUri());
}
@Test
@@ -130,4 +132,39 @@ public class PlanReaderTests {
PlanDescriptor plan = reader.read(new FileInputStream("src/test/resources/plans/provisioning-disabled.plan"));
assertEquals(Provisioning.DISABLED, plan.getProvisioning());
}
+
+ @Test
+ public void testSingleUriPlan() throws FileNotFoundException {
+ PlanDescriptor plan = reader.read(new FileInputStream("src/test/resources/plans/single-uri.plan"));
+ assertEquals("single-uri.plan", plan.getName());
+ assertEquals(new Version(1, 0, 0), plan.getVersion());
+
+ assertEquals(Provisioning.INHERIT, plan.getProvisioning());
+
+ List<ArtifactSpecification> artifactSpecifications = plan.getArtifactSpecifications();
+ assertEquals(1, artifactSpecifications.size());
+ ArtifactSpecification artifactSpecification = artifactSpecifications.iterator().next();
+ assertNull(artifactSpecification.getType());
+ assertNull(artifactSpecification.getName());
+ assertNull(artifactSpecification.getVersionRange());
+ assertNotNull(artifactSpecification.getProperties());
+ assertTrue(artifactSpecification.getProperties().isEmpty());
+ assertEquals("file:/a/b.c", artifactSpecification.getUri().toString());
+ }
+
+ @Test(expected=RuntimeException.class)
+ public void testInvalidUriWithTypePlan() throws FileNotFoundException {
+ reader.read(new FileInputStream("src/test/resources/plans/invalid-uri-type.plan"));
+ }
+
+ @Test(expected=RuntimeException.class)
+ public void testInvalidUriWithNamePlan() throws FileNotFoundException {
+ reader.read(new FileInputStream("src/test/resources/plans/invalid-uri-name.plan"));
+ }
+
+ @Test(expected=RuntimeException.class)
+ public void testInvalidUriWithVersionRangePlan() throws FileNotFoundException {
+ reader.read(new FileInputStream("src/test/resources/plans/invalid-uri-versionrange.plan"));
+ }
+
}
diff --git a/org.eclipse.virgo.kernel.artifact/src/test/resources/plans/invalid-uri-name.plan b/org.eclipse.virgo.kernel.artifact/src/test/resources/plans/invalid-uri-name.plan
new file mode 100644
index 00000000..4142c2e4
--- /dev/null
+++ b/org.eclipse.virgo.kernel.artifact/src/test/resources/plans/invalid-uri-name.plan
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<plan name="invalid-uri-name.plan" version="1.0.0" scoped="true" atomic="true"
+ xmlns="http://www.eclipse.org/virgo/schema/plan"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.eclipse.org/virgo/schema/plan
+ http://www.eclipse.org/virgo/schema/plan/eclipse-virgo-plan.xsd">
+
+ <artifact name="any" uri="file:/a/b.c"/>
+
+</plan> \ No newline at end of file
diff --git a/org.eclipse.virgo.kernel.artifact/src/test/resources/plans/invalid-uri-type.plan b/org.eclipse.virgo.kernel.artifact/src/test/resources/plans/invalid-uri-type.plan
new file mode 100644
index 00000000..dc9a0de2
--- /dev/null
+++ b/org.eclipse.virgo.kernel.artifact/src/test/resources/plans/invalid-uri-type.plan
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<plan name="invalid-uri-type.plan" version="1.0.0" scoped="true" atomic="true"
+ xmlns="http://www.eclipse.org/virgo/schema/plan"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.eclipse.org/virgo/schema/plan
+ http://www.eclipse.org/virgo/schema/plan/eclipse-virgo-plan.xsd">
+
+ <artifact type="bundle" uri="file:/a/b.c"/>
+
+</plan> \ No newline at end of file
diff --git a/org.eclipse.virgo.kernel.artifact/src/test/resources/plans/invalid-uri-versionrange.plan b/org.eclipse.virgo.kernel.artifact/src/test/resources/plans/invalid-uri-versionrange.plan
new file mode 100644
index 00000000..d00ab2a5
--- /dev/null
+++ b/org.eclipse.virgo.kernel.artifact/src/test/resources/plans/invalid-uri-versionrange.plan
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<plan name="invalid-uri-versionrange.plan" version="1.0.0" scoped="true" atomic="true"
+ xmlns="http://www.eclipse.org/virgo/schema/plan"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.eclipse.org/virgo/schema/plan
+ http://www.eclipse.org/virgo/schema/plan/eclipse-virgo-plan.xsd">
+
+ <artifact version="[1.0.0, 2.0.0)" uri="file:/a/b.c"/>
+
+</plan> \ No newline at end of file
diff --git a/org.eclipse.virgo.kernel.artifact/src/test/resources/plans/single-uri.plan b/org.eclipse.virgo.kernel.artifact/src/test/resources/plans/single-uri.plan
new file mode 100644
index 00000000..4d9114ad
--- /dev/null
+++ b/org.eclipse.virgo.kernel.artifact/src/test/resources/plans/single-uri.plan
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<plan name="single-uri.plan" version="1.0.0" scoped="true" atomic="true"
+ xmlns="http://www.eclipse.org/virgo/schema/plan"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.eclipse.org/virgo/schema/plan
+ http://www.eclipse.org/virgo/schema/plan/eclipse-virgo-plan.xsd">
+
+ <artifact uri="file:/a/b.c"/>
+
+</plan> \ No newline at end of file

Back to the top