aboutsummaryrefslogtreecommitdiffstats
path: root/bundle-plugin-test
diff options
context:
space:
mode:
authorgjoranv <gv@oath.com>2018-11-07 21:06:56 +0100
committergjoranv <gv@oath.com>2019-01-21 15:09:26 +0100
commit01705ccfef4a08cebd98a4eb4251e7032b1eac98 (patch)
tree935991a6ae245248f2115ced47ca7a9ce70f520d /bundle-plugin-test
parent40b2f22a2e0920dea7bfd456f07aab29b2ac745f (diff)
Improve integration test
- Add nested classes - Put back commented assert and remove stale comment + Add comment to replace jrt.jar. It's compile scoped and had a much smaller dependency tree when it was added compared to now. Now, it adds loads of Import-Packages, increasing the risk of invalidating the integration test that verifies that the required imports have been added to the manifest.
Diffstat (limited to 'bundle-plugin-test')
-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.java13
2 files changed, 29 insertions, 6 deletions
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..8a852886254 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 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 10f8f4e976c..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,6 +109,8 @@ 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(".,"));