aboutsummaryrefslogtreecommitdiffstats
path: root/bundle-plugin-test/test-bundles
diff options
context:
space:
mode:
authorgjoranv <gv@verizonmedia.com>2019-10-19 16:31:03 +0200
committergjoranv <gv@verizonmedia.com>2019-10-23 12:26:58 +0200
commitaaec0de4e4e7ae3fd0776c594b76bbe16fe30bfb (patch)
tree9951d4305728fbe3c70f5647333968ca79013701 /bundle-plugin-test/test-bundles
parente87cd4be6d717807246d20204954739118160126 (diff)
Restructure bundle-plugin-test to allow multiple test bundles.
Diffstat (limited to 'bundle-plugin-test/test-bundles')
-rw-r--r--bundle-plugin-test/test-bundles/main/pom.xml83
-rw-r--r--bundle-plugin-test/test-bundles/main/src/main/java/InDefaultPackage.java3
-rw-r--r--bundle-plugin-test/test-bundles/main/src/main/java/com/yahoo/test/SimpleSearcher.java37
-rw-r--r--bundle-plugin-test/test-bundles/main/src/main/java/com/yahoo/test/SimpleSearcher2.java28
-rw-r--r--bundle-plugin-test/test-bundles/main/src/main/java/com/yahoo/test/package-info.java6
-rw-r--r--bundle-plugin-test/test-bundles/main/src/main/resources/configdefinitions/test.def4
-rw-r--r--bundle-plugin-test/test-bundles/pom.xml48
7 files changed, 209 insertions, 0 deletions
diff --git a/bundle-plugin-test/test-bundles/main/pom.xml b/bundle-plugin-test/test-bundles/main/pom.xml
new file mode 100644
index 00000000000..1c02a516fe8
--- /dev/null
+++ b/bundle-plugin-test/test-bundles/main/pom.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0"?>
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+ http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>com.yahoo.vespa.bundle-plugin</groupId>
+ <artifactId>test-bundles</artifactId>
+ <version>7-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>main</artifactId>
+ <version>7-SNAPSHOT</version>
+ <packaging>container-plugin</packaging>
+ <dependencies>
+ <dependency>
+ <groupId>com.yahoo.vespa</groupId>
+ <artifactId>container-dev</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.json</groupId>
+ <artifactId>json</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.yahoo.vespa</groupId>
+ <artifactId>jrt</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <!-- Added to verify that module-info.class can be handled by bundle-plugin without throwing an exception. -->
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.3.0</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.yahoo.vespa</groupId>
+ <artifactId>bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <Import-Package>
+ manualImport.withoutVersion,
+ manualImport.withVersion;version="12.3.4",
+ multiple.packages.with.the.same.version1;multiple.packages.with.the.same.version2;version="[1,2)"
+ </Import-Package>
+ <WebInfUrl>/WEB-INF/web.xml</WebInfUrl>
+ </configuration>
+ </plugin>
+ <plugin>
+ <!-- Trick to copy bundle-plugin.bundle-classpath-mappings.json from target/test-classes to target/classes -->
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-resources</id>
+ <phase>prepare-package</phase>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${project.build.outputDirectory}</outputDirectory>
+ <overwrite>true</overwrite>
+ <resources>
+ <resource>
+ <directory>${project.build.testOutputDirectory}</directory>
+ <includes>
+ <include>bundle-plugin.bundle-classpath-mappings.json</include>
+ </includes>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/bundle-plugin-test/test-bundles/main/src/main/java/InDefaultPackage.java b/bundle-plugin-test/test-bundles/main/src/main/java/InDefaultPackage.java
new file mode 100644
index 00000000000..a650916d653
--- /dev/null
+++ b/bundle-plugin-test/test-bundles/main/src/main/java/InDefaultPackage.java
@@ -0,0 +1,3 @@
+// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+public class InDefaultPackage {}
diff --git a/bundle-plugin-test/test-bundles/main/src/main/java/com/yahoo/test/SimpleSearcher.java b/bundle-plugin-test/test-bundles/main/src/main/java/com/yahoo/test/SimpleSearcher.java
new file mode 100644
index 00000000000..dddca3f4d59
--- /dev/null
+++ b/bundle-plugin-test/test-bundles/main/src/main/java/com/yahoo/test/SimpleSearcher.java
@@ -0,0 +1,37 @@
+// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.test;
+
+import com.yahoo.prelude.hitfield.XMLString;
+import com.yahoo.search.Query;
+import com.yahoo.search.Result;
+import com.yahoo.search.Searcher;
+import com.yahoo.search.result.Hit;
+import com.yahoo.search.searchchain.Execution;
+import com.yahoo.text.BooleanParser;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+/**
+ * A searcher adding a new hit.
+ *
+ * @author Joe Developer
+ */
+public class SimpleSearcher extends Searcher {
+
+ public Result search(Query query,Execution execution) {
+ try {
+ BooleanParser.parseBoolean("true");
+ XMLString xmlString = new XMLString("<sampleXmlString/>");
+
+ Hit hit = new Hit("Hello world!");
+ hit.setField("json", new JSONObject().put("price", 42).toString());
+
+ Result result = execution.search(query);
+ result.hits().add(hit);
+ return result;
+
+ } catch (JSONException e) {
+ throw new RuntimeException(e);
+ }
+ }
+}
diff --git a/bundle-plugin-test/test-bundles/main/src/main/java/com/yahoo/test/SimpleSearcher2.java b/bundle-plugin-test/test-bundles/main/src/main/java/com/yahoo/test/SimpleSearcher2.java
new file mode 100644
index 00000000000..3220171de13
--- /dev/null
+++ b/bundle-plugin-test/test-bundles/main/src/main/java/com/yahoo/test/SimpleSearcher2.java
@@ -0,0 +1,28 @@
+// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.test;
+
+
+/**
+ * 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/test-bundles/main/src/main/java/com/yahoo/test/package-info.java b/bundle-plugin-test/test-bundles/main/src/main/java/com/yahoo/test/package-info.java
new file mode 100644
index 00000000000..5774fc8d5f2
--- /dev/null
+++ b/bundle-plugin-test/test-bundles/main/src/main/java/com/yahoo/test/package-info.java
@@ -0,0 +1,6 @@
+// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+@ExportPackage(version = @Version(major = 1, minor = 2, micro = 3, qualifier = "RELEASE"))
+package com.yahoo.test;
+
+import com.yahoo.osgi.annotation.ExportPackage;
+import com.yahoo.osgi.annotation.Version;
diff --git a/bundle-plugin-test/test-bundles/main/src/main/resources/configdefinitions/test.def b/bundle-plugin-test/test-bundles/main/src/main/resources/configdefinitions/test.def
new file mode 100644
index 00000000000..b4ba9ec518a
--- /dev/null
+++ b/bundle-plugin-test/test-bundles/main/src/main/resources/configdefinitions/test.def
@@ -0,0 +1,4 @@
+# Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+namespace=example
+
+exampleKey string default="exampleValue"
diff --git a/bundle-plugin-test/test-bundles/pom.xml b/bundle-plugin-test/test-bundles/pom.xml
new file mode 100644
index 00000000000..680f43ba057
--- /dev/null
+++ b/bundle-plugin-test/test-bundles/pom.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0"?>
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+ http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>com.yahoo.vespa.bundle-plugin</groupId>
+ <artifactId>bundle-plugin-test</artifactId>
+ <version>7-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>test-bundles</artifactId>
+ <version>7-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <!-- Trick to package bundles before test phase to allow running 'mvn test' -->
+ <groupId>com.yahoo.vespa</groupId>
+ <artifactId>bundle-plugin</artifactId>
+ <version>${project.version}</version>
+ <executions>
+ <execution>
+ <id>package-test-bundles</id>
+ <phase>process-classes</phase>
+ <goals>
+ <goal>generate-osgi-manifest</goal>
+ <goal>assemble-container-plugin</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <!-- The integration-test module should use the bundle jars instead of the ordinary artifacts. -->
+ <AttachBundle>true</AttachBundle>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <modules>
+ <module>main</module>
+ </modules>
+</project>