summaryrefslogtreecommitdiffstats
path: root/bundle-plugin-test
diff options
context:
space:
mode:
authorGeir Storli <geirstorli@yahoo.no>2019-01-21 16:06:53 +0100
committerGitHub <noreply@github.com>2019-01-21 16:06:53 +0100
commit8372a883c5a5fa100f88fc9b80824359b5bb70cd (patch)
tree660ce3ef61f060b33bd97eac1185715606b8e2bd /bundle-plugin-test
parent3722c1cdd91fce30d1c2538b2a8749d9321e194b (diff)
parenteb0b1134a66507e3bd8f09793c22cd824d01dff5 (diff)
Merge pull request #8198 from vespa-engine/7
7 MERGEOK
Diffstat (limited to 'bundle-plugin-test')
-rw-r--r--bundle-plugin-test/pom.xml4
-rw-r--r--bundle-plugin-test/src/main/java/com/yahoo/test/SimpleSearcher2.java22
-rw-r--r--bundle-plugin-test/src/test/java/com/yahoo/BundleIT.java19
3 files changed, 34 insertions, 11 deletions
diff --git a/bundle-plugin-test/pom.xml b/bundle-plugin-test/pom.xml
index 4b36435529e..3ba9bf7b4b6 100644
--- a/bundle-plugin-test/pom.xml
+++ b/bundle-plugin-test/pom.xml
@@ -8,12 +8,12 @@
<parent>
<groupId>com.yahoo.vespa</groupId>
<artifactId>parent</artifactId>
- <version>6-SNAPSHOT</version>
+ <version>7-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
<groupId>com.yahoo.vespa</groupId>
<artifactId>bundle-plugin-test</artifactId>
- <version>6-SNAPSHOT</version>
+ <version>7-SNAPSHOT</version>
<packaging>container-plugin</packaging>
<dependencies>
<dependency>
diff --git a/bundle-plugin-test/src/main/java/com/yahoo/test/SimpleSearcher2.java b/bundle-plugin-test/src/main/java/com/yahoo/test/SimpleSearcher2.java
index c92f029ade6..3220171de13 100644
--- a/bundle-plugin-test/src/main/java/com/yahoo/test/SimpleSearcher2.java
+++ b/bundle-plugin-test/src/main/java/com/yahoo/test/SimpleSearcher2.java
@@ -3,10 +3,26 @@ package com.yahoo.test;
/**
- * A searcher adding a new hit.
- * TODO: add annotation check
- * @author Joe Developer
+ * Test class for integration tests. Used to verify that nested classes are visited.
+ *
+ * Do not replace the fully qualified class names with imports!
*/
public class SimpleSearcher2 extends SimpleSearcher {
public void dummy() {}
+
+ private class InnerClassProcessor extends com.yahoo.processing.Processor {
+ @Override
+ public com.yahoo.processing.Response process(com.yahoo.processing.Request request,
+ com.yahoo.processing.execution.Execution execution) {
+ return null;
+ }
+ }
+
+ private static class NestedStaticClass {
+ private com.yahoo.metrics.simple.Counter counter;
+
+ @com.google.inject.Inject
+ public NestedStaticClass() { }
+ }
+
}
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 38ca08ecff1..5b4fdda06f7 100644
--- a/bundle-plugin-test/src/test/java/com/yahoo/BundleIT.java
+++ b/bundle-plugin-test/src/test/java/com/yahoo/BundleIT.java
@@ -4,7 +4,6 @@ package com.yahoo;
import com.yahoo.osgi.maven.ProjectBundleClassPaths;
import com.yahoo.vespa.config.VespaVersion;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import java.io.File;
@@ -81,9 +80,15 @@ public class BundleIT {
@Test
public void require_that_manifest_contains_inferred_imports() {
String importPackage = mainAttributes.getValue("Import-Package");
+
+ // From SimpleSearcher
assertThat(importPackage, containsString("com.yahoo.prelude.hitfield"));
- //Not available from jdisc at the moment, scope temporarily changed to compile.
- //assertThat(importPackage, containsString("org.json"));
+ assertThat(importPackage, containsString("org.json"));
+
+ // From SimpleSearcher2
+ assertThat(importPackage, containsString("com.yahoo.processing"));
+ assertThat(importPackage, containsString("com.yahoo.metrics.simple"));
+ assertThat(importPackage, containsString("com.google.inject"));
}
@Test
@@ -104,20 +109,22 @@ public class BundleIT {
}
@Test
+ // TODO: use another jar than jrt, which now pulls in a lot of dependencies that pollute the manifest of the
+ // generated bundle. (It's compile scoped in pom.xml to be added to the bundle-cp.)
public void require_that_manifest_contains_bundle_class_path() {
String bundleClassPath = mainAttributes.getValue("Bundle-ClassPath");
assertThat(bundleClassPath, containsString(".,"));
// 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.
+ // is used: jrt-7-SNAPSHOT.jar.
assertThat(bundleClassPath, anyOf(
- containsString("dependencies/jrt-6-SNAPSHOT.jar"),
+ containsString("dependencies/jrt-7-SNAPSHOT.jar"),
containsString("dependencies/jrt.jar")));
}
@Test
public void require_that_component_jar_file_contains_compile_artifacts() {
- ZipEntry versionedEntry = jarFile.getEntry("dependencies/jrt-6-SNAPSHOT.jar");
+ ZipEntry versionedEntry = jarFile.getEntry("dependencies/jrt-7-SNAPSHOT.jar");
ZipEntry unversionedEntry = jarFile.getEntry("dependencies/jrt.jar");
if (versionedEntry == null) {
assertNotNull(unversionedEntry);