summaryrefslogtreecommitdiffstats
path: root/bundle-plugin-test
diff options
context:
space:
mode:
authorHåkon Hallingstad <hakon@yahoo-inc.com>2017-05-13 02:38:43 +0200
committerHåkon Hallingstad <hakon@yahoo-inc.com>2017-05-13 02:38:43 +0200
commit059c2c8076ad3d7936a858c2b7f582b8cdedc629 (patch)
treec19e8fd73bb7e52d8b3fce59817053ea3dd2ce6f /bundle-plugin-test
parent47d4474d48958beca883524a1dea5466015c8fdd (diff)
Make bundle-plugin-test pass when also building jrt
Diffstat (limited to 'bundle-plugin-test')
-rw-r--r--bundle-plugin-test/src/test/java/com/yahoo/BundleIT.java25
1 files changed, 21 insertions, 4 deletions
diff --git a/bundle-plugin-test/src/test/java/com/yahoo/BundleIT.java b/bundle-plugin-test/src/test/java/com/yahoo/BundleIT.java
index f9fbb21d117..c01783428b4 100644
--- a/bundle-plugin-test/src/test/java/com/yahoo/BundleIT.java
+++ b/bundle-plugin-test/src/test/java/com/yahoo/BundleIT.java
@@ -17,14 +17,18 @@ import java.util.Collection;
import java.util.jar.Attributes;
import java.util.jar.JarFile;
import java.util.jar.Manifest;
+import java.util.zip.ZipEntry;
import static org.hamcrest.CoreMatchers.allOf;
+import static org.hamcrest.CoreMatchers.anyOf;
+import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.endsWith;
import static org.hamcrest.CoreMatchers.hasItems;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat;
-import static org.hamcrest.CoreMatchers.containsString;
+import static org.junit.Assert.assertTrue;
/**
* Verifies the bundle jar file built and its manifest.
@@ -101,12 +105,23 @@ public class BundleIT {
public void require_that_manifest_contains_bundle_class_path() {
String bundleClassPath = mainAttributes.getValue("Bundle-ClassPath");
assertThat(bundleClassPath, containsString(".,"));
- assertThat(bundleClassPath, containsString("dependencies/jrt-6-SNAPSHOT.jar"));
+ // If bundle-plugin-test is compiled in a mvn command that also built jrt,
+ // the jrt artifact is jrt.jar, otherwise the installed and versioned artifact
+ // is used: jrt-6-SNAPSHOT.jar.
+ assertThat(bundleClassPath, anyOf(
+ containsString("dependencies/jrt-6-SNAPSHOT.jar"),
+ containsString("dependencies/jrt.jar")));
}
@Test
public void require_that_component_jar_file_contains_compile_artifacts() {
- assertNotNull(jarFile.getEntry("dependencies/jrt-6-SNAPSHOT.jar"));
+ ZipEntry versionedEntry = jarFile.getEntry("dependencies/jrt-6-SNAPSHOT.jar");
+ ZipEntry unversionedEntry = jarFile.getEntry("dependencies/jrt.jar");
+ if (versionedEntry == null) {
+ assertNotNull(unversionedEntry);
+ } else {
+ assertNull(unversionedEntry);
+ }
}
@@ -134,6 +149,8 @@ public class BundleIT {
assertThat(mainBundleClassPaths,
hasItems(
endsWith("target/classes"),
- allOf(containsString("jrt"), containsString(".jar"), containsString("m2/repository"))));
+ anyOf(
+ allOf(containsString("jrt"), containsString(".jar"), containsString("m2/repository")),
+ containsString("jrt/target/jrt.jar"))));
}
}