You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by zh...@apache.org on 2017/10/21 01:33:55 UTC

[geode] branch feature/GEODE-3245 updated: GEODE-3245: add a test case to insert and query on json object

This is an automated email from the ASF dual-hosted git repository.

zhouxj pushed a commit to branch feature/GEODE-3245
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/feature/GEODE-3245 by this push:
     new adda88c  GEODE-3245: add a test case to insert and query on json object
adda88c is described below

commit adda88c01cb3e043cb9582532fc9890122d780e8
Author: zhouxh <gz...@pivotal.io>
AuthorDate: Fri Oct 20 18:33:25 2017 -0700

    GEODE-3245: add a test case to insert and query on json object
---
 .../NestedObjectSeralizerIntegrationTest.java       | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/NestedObjectSeralizerIntegrationTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/NestedObjectSeralizerIntegrationTest.java
index a5801d0..0d6529f 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/NestedObjectSeralizerIntegrationTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/NestedObjectSeralizerIntegrationTest.java
@@ -33,6 +33,7 @@ import org.apache.geode.cache.lucene.test.Customer;
 import org.apache.geode.cache.lucene.test.Page;
 import org.apache.geode.cache.lucene.test.Person;
 import org.apache.geode.internal.logging.LogService;
+import org.apache.geode.pdx.JSONFormatter;
 import org.apache.geode.pdx.PdxReader;
 import org.apache.geode.pdx.PdxSerializable;
 import org.apache.geode.pdx.PdxWriter;
@@ -517,6 +518,26 @@ public class NestedObjectSeralizerIntegrationTest extends LuceneIntegrationTest
     printResults(results);
   }
 
+  @Test
+  public void insertAndQueryJSONObject() throws InterruptedException, LuceneQueryException {
+    Region region = createRegionAndIndexForPdxObject();
+
+    String jsonCustomer = "{" + "\"ID\" : 3," + "\"position1\" : {" + "\"country\" : \"USA\","
+        + "\"secId\" : \"DELL\"," + "\"sharesOutstanding\" : 9000.0," + "\"pid\" : 9,"
+        + "\"portfolioId\" : 0" + "}," + "\"positions\" : [ {" + "\"country\" : \"USA\","
+        + "\"secId\" : \"NOVL\"," + "\"sharesOutstanding\" : 11000.0," + "\"pid\" : 11,"
+        + "\"portfolioId\" : 0" + "}," + "{" + "\"country\" : \"USA\"," + "\"secId\" : \"RHAT\","
+        + "\"sharesOutstanding\" : 10000.0," + "\"pid\" : 10," + "\"portfolioId\" : 0" + "} ],"
+        + "\"status\" : \"inactive\"," + "\"names\" : [ \"aaa\", \"bbb\", \"ccc\", \"ddd\" ],"
+        + "\"description\" : \"XXXX\"," + "\"createTime\" : 0" + "}";
+    region.put("jsondoc1", JSONFormatter.fromJSON(jsonCustomer));
+    query = luceneService.createLuceneQueryFactory().create(INDEX_NAME, REGION_NAME, "NOVL",
+        "positions.secId");
+    results = query.findPages();
+    assertEquals(1, results.size());
+    printResults(results);
+  }
+
   public static class SimplePortfolioPdx implements Serializable, PdxSerializable {
     private int ID;
     public String description;

-- 
To stop receiving notification emails like this one, please contact
['"commits@geode.apache.org" <co...@geode.apache.org>'].