summaryrefslogtreecommitdiffstats
path: root/bundle-plugin-test
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorn.christian@seime.no>2021-02-01 23:51:00 +0100
committerGitHub <noreply@github.com>2021-02-01 23:51:00 +0100
commit42794e42e8ce223705e0a8e0e3e9293d65adaf6c (patch)
treea337188686fe568fd0dc04db5234c7ffa2ccbb63 /bundle-plugin-test
parent7f04da806204b7727f377b4099bd10571c61e5da (diff)
Revert "Remove org.json usage [run-systemtest]"
Diffstat (limited to 'bundle-plugin-test')
-rw-r--r--bundle-plugin-test/integration-test/src/test/java/com/yahoo/container/plugin/BundleTest.java1
-rw-r--r--bundle-plugin-test/test-bundles/main/pom.xml5
-rw-r--r--bundle-plugin-test/test-bundles/main/src/main/java/com/yahoo/test/SimpleSearcher.java8
3 files changed, 14 insertions, 0 deletions
diff --git a/bundle-plugin-test/integration-test/src/test/java/com/yahoo/container/plugin/BundleTest.java b/bundle-plugin-test/integration-test/src/test/java/com/yahoo/container/plugin/BundleTest.java
index 35a95ed3d89..a46abce1dff 100644
--- a/bundle-plugin-test/integration-test/src/test/java/com/yahoo/container/plugin/BundleTest.java
+++ b/bundle-plugin-test/integration-test/src/test/java/com/yahoo/container/plugin/BundleTest.java
@@ -91,6 +91,7 @@ public class BundleTest {
// From SimpleSearcher
assertThat(importPackage, containsString("com.yahoo.prelude.hitfield"));
+ assertThat(importPackage, containsString("org.json"));
// From SimpleSearcher2
assertThat(importPackage, containsString("com.yahoo.processing"));
diff --git a/bundle-plugin-test/test-bundles/main/pom.xml b/bundle-plugin-test/test-bundles/main/pom.xml
index 190e1c9d90f..c9c9ea270eb 100644
--- a/bundle-plugin-test/test-bundles/main/pom.xml
+++ b/bundle-plugin-test/test-bundles/main/pom.xml
@@ -16,6 +16,11 @@
<packaging>container-plugin</packaging>
<dependencies>
<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>
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
index ae9644aa010..dddca3f4d59 100644
--- 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
@@ -8,6 +8,8 @@ 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.
@@ -17,13 +19,19 @@ import com.yahoo.text.BooleanParser;
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);
+ }
}
}