@@ -525,6 +525,8 @@ public void testCtsQueriesWithOptions() throws KeyManagementException, NoSuchAlg
525525 JsonNode jsonResults = jacksonHandle .get ();
526526
527527 JsonNode jsonBindingsNodes = jsonResults .path ("rows" );
528+ System .out .println ("Results are " + jsonBindingsNodes .toString ());
529+
528530 assertTrue ("Number of Elements after plan execution is incorrect. Should be 1" , 1 == jsonBindingsNodes .size ());
529531 assertEquals ("Row 1 myCity.city value incorrect" , "new york" , jsonBindingsNodes .path (0 ).path ("myCity.city" ).path ("value" ).asText ());
530532 }
@@ -579,7 +581,7 @@ public void testJsonPropertyRangeQueryFromViews() throws KeyManagementException,
579581 @ Test
580582 public void testQNameExport () throws KeyManagementException , NoSuchAlgorithmException , IOException , SAXException , ParserConfigurationException
581583 {
582- System .out .println ("In testjsonPropertyWordAndValueQuery method" );
584+ System .out .println ("In testQNameExport method" );
583585
584586 // Create a new Plan.
585587 RowManager rowMgr = client .newRowManager ();
@@ -637,70 +639,52 @@ public void testQNameExport() throws KeyManagementException, NoSuchAlgorithmExce
637639
638640 /*
639641 * Test cts queries with options and empty results on fromLexicons - TEST 15
640- * and 16 plan1 uses fromLexicon plan2 use fromLexicons TODO when 633 is
641- * fixed.
642+ * and 16 plan1 uses fromLexicon plan2 use fromLexicons
642643 */
643644 @ Test
644645 public void testEmptyAndInvalidResults () throws KeyManagementException , NoSuchAlgorithmException , IOException , SAXException , ParserConfigurationException
645- {/*
646- * System.out.println("In testEmptyAndInvalidResults method");
647- *
648- * // Create a new Plan. RowManager rowMgr = client.newRowManager();
649- * PlanBuilder p = rowMgr.newPlanBuilder(); Map<String,
650- * CtsReferenceExpr>index1 = new HashMap<String, CtsReferenceExpr>();
651- * index1.put("uri1", p.cts.uriReference()); index1.put("city",
652- * p.cts.jsonPropertyReference("city")); index1.put("popularity",
653- * p.cts.jsonPropertyReference("popularity")); index1.put("date",
654- * p.cts.jsonPropertyReference("date")); index1.put("distance",
655- * p.cts.jsonPropertyReference("distance")); index1.put("point",
656- * p.cts.jsonPropertyReference("latLonPoint"));
657- *
658- * Map<String, CtsReferenceExpr>index2 = new HashMap<String,
659- * CtsReferenceExpr>(); index2.put("uri2", p.cts.uriReference());
660- * index2.put("cityName", p.cts.jsonPropertyReference("cityName"));
661- * index2.put("cityTeam", p.cts.jsonPropertyReference("cityTeam"));
662- *
663- * // TODO Ask Eric about query options.
664- *
665- * ModifyPlan plan1 = p.fromLexicons(index1, "myCity",
666- * p.fragmentIdCol("fragId1"), p.cts.jsonPropertyWordQuery("city", "London",
667- * "case-sensitive")); // plan2 - fromLexicons ModifyPlan plan2 =
668- * p.fromLexicons(index2, "myTeam", p.fragmentIdCol("fragId2"), null);
669- *
670- * ModifyPlan outputEmpty = plan1.joinInner(plan2)
671- * .where(p.eq(p.viewCol("myCity", "city"), p.col("cityName")))
672- * .orderBy(p.asc(p.col("date"))); JacksonHandle jacksonHandle = new
673- * JacksonHandle(); jacksonHandle.setMimetype("application/json");
674- * rowMgr.resultDoc(outputEmpty, jacksonHandle); JsonNode node = null;
675- * StringBuilder strNull = new StringBuilder(); int nSize = 0; try { node =
676- * jacksonHandle.get(); nSize = node.size(); } catch(Exception ex) {
677- * strNull.append(ex.getMessage());
678- * System.out.println("Exception message is " + strNull.toString()); } //
679- * Should have NullPointerException. assertTrue("Exceptions not found",
680- * strNull.toString().contains("null"));
681- *
682- * // Invalid operation. ModifyPlan plan3 =
683- * p.fromView("opticFunctionalTest4", "detail4", null, null,
684- * p.cts.jsonPropertyRangeQuery("id", "#", p.xs.intVal(300))); ModifyPlan
685- * plan4 = p.fromView("opticFunctionalTest4", "master4");
686- *
687- * ModifyPlan outputInvalid = plan3.joinInner(plan4,
688- * p.on(p.schemaCol("opticFunctionalTest4", "detail4", "masterId"),
689- * p.schemaCol("opticFunctionalTest4", "master4", "id")))
690- * .orderBy(p.schemaCol("opticFunctionalTest4", "detail4", "id"));
691- * JacksonHandle jacksonHandleInval = new JacksonHandle();
692- * jacksonHandleInval.setMimetype("application/json"); StringBuilder strInv =
693- * new StringBuilder();
694- *
695- * try { rowMgr.resultDoc(outputInvalid, jacksonHandleInval); }
696- * catch(Exception ex) { strInv.append(ex.getMessage());
697- * System.out.println("Exception message is " + strInv.toString()); } //
698- * Should have Internal Server Error. Server Message: JS-JAVASCRIPT. Checking
699- * part of exception message. assertTrue("Exceptions not found",
700- * strInv.toString().contains(
701- * "XDMP-ARG: cts.jsonPropertyRangeQuery(\"id\", \"#\", xs.int(\"300\")) -- op is invalid"
702- * ));
703- */
646+ {
647+ System .out .println ("In testEmptyAndInvalidResults method" );
648+
649+ // Create a new Plan. RowManager rowMgr = client.newRowManager();
650+ RowManager rowMgr = client .newRowManager ();
651+ PlanBuilder p = rowMgr .newPlanBuilder ();
652+ Map <String , CtsReferenceExpr >index1 = new HashMap <String , CtsReferenceExpr >();
653+ index1 .put ("uri1" , p .cts .uriReference ()); index1 .put ("city" ,
654+ p .cts .jsonPropertyReference ("city" )); index1 .put ("popularity" ,
655+ p .cts .jsonPropertyReference ("popularity" )); index1 .put ("date" ,
656+ p .cts .jsonPropertyReference ("date" )); index1 .put ("distance" ,
657+ p .cts .jsonPropertyReference ("distance" )); index1 .put ("point" ,
658+ p .cts .jsonPropertyReference ("latLonPoint" ));
659+
660+ Map <String , CtsReferenceExpr >index2 = new HashMap <String ,
661+ CtsReferenceExpr >(); index2 .put ("uri2" , p .cts .uriReference ());
662+ index2 .put ("cityName" , p .cts .jsonPropertyReference ("cityName" ));
663+ index2 .put ("cityTeam" , p .cts .jsonPropertyReference ("cityTeam" ));
664+
665+ ModifyPlan plan1 = p .fromLexicons (index1 , "myCity" , p .fragmentIdCol ("fragId1" ));
666+ ModifyPlan plan2 = p .fromLexicons (index2 , "myTeam" , p .fragmentIdCol ("fragId2" ));
667+
668+ ModifyPlan outputEmpty = plan1
669+ .where (p .cts .jsonPropertyWordQuery ("city" , "London" , "case-sensitive" ))
670+ .joinInner (plan2 )
671+ .where (p .eq (p .viewCol ("myCity" , "city" ), p .col ("cityName" )))
672+ .orderBy (p .asc (p .col ("date" )));
673+ JacksonHandle jacksonHandle = new JacksonHandle ();
674+ jacksonHandle .setMimetype ("application/json" );
675+ rowMgr .resultDoc (outputEmpty , jacksonHandle );
676+ JsonNode node = null ;
677+ StringBuilder strNull = new StringBuilder ();
678+ int nSize = 0 ;
679+ try {
680+ node = jacksonHandle .get ();
681+ nSize = node .size ();
682+ } catch (Exception ex ) {
683+ strNull .append (ex .getMessage ());
684+ System .out .println ("Exception message is " + strNull .toString ());
685+ }
686+ // Should have NullPointerException.
687+ assertTrue ("Exceptions not found" , strNull .toString ().contains ("null" ));
704688 }
705689
706690 /*
@@ -762,7 +746,6 @@ public void testMultipleQuriesLinear() throws KeyManagementException, NoSuchAlgo
762746 public void testMultipleQuriesNested () throws KeyManagementException , NoSuchAlgorithmException , IOException , SAXException , ParserConfigurationException
763747 {
764748 System .out .println ("In testMultipleQuriesNested method" );
765- System .out .println ("In testMultipleQuriesLinear method" );
766749
767750 // Create a new Plan.
768751 RowManager rowMgr = client .newRowManager ();
@@ -908,7 +891,6 @@ record = rowItr.next();
908891
909892 rCount ++;
910893 }
911-
912894 }
913895
914896 @ AfterClass
0 commit comments