@@ -525,6 +525,8 @@ public void testCtsQueriesWithOptions() throws KeyManagementException, NoSuchAlg
525
525
JsonNode jsonResults = jacksonHandle .get ();
526
526
527
527
JsonNode jsonBindingsNodes = jsonResults .path ("rows" );
528
+ System .out .println ("Results are " + jsonBindingsNodes .toString ());
529
+
528
530
assertTrue ("Number of Elements after plan execution is incorrect. Should be 1" , 1 == jsonBindingsNodes .size ());
529
531
assertEquals ("Row 1 myCity.city value incorrect" , "new york" , jsonBindingsNodes .path (0 ).path ("myCity.city" ).path ("value" ).asText ());
530
532
}
@@ -579,7 +581,7 @@ public void testJsonPropertyRangeQueryFromViews() throws KeyManagementException,
579
581
@ Test
580
582
public void testQNameExport () throws KeyManagementException , NoSuchAlgorithmException , IOException , SAXException , ParserConfigurationException
581
583
{
582
- System .out .println ("In testjsonPropertyWordAndValueQuery method" );
584
+ System .out .println ("In testQNameExport method" );
583
585
584
586
// Create a new Plan.
585
587
RowManager rowMgr = client .newRowManager ();
@@ -637,70 +639,52 @@ public void testQNameExport() throws KeyManagementException, NoSuchAlgorithmExce
637
639
638
640
/*
639
641
* 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
642
643
*/
643
644
@ Test
644
645
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" ));
704
688
}
705
689
706
690
/*
@@ -762,7 +746,6 @@ public void testMultipleQuriesLinear() throws KeyManagementException, NoSuchAlgo
762
746
public void testMultipleQuriesNested () throws KeyManagementException , NoSuchAlgorithmException , IOException , SAXException , ParserConfigurationException
763
747
{
764
748
System .out .println ("In testMultipleQuriesNested method" );
765
- System .out .println ("In testMultipleQuriesLinear method" );
766
749
767
750
// Create a new Plan.
768
751
RowManager rowMgr = client .newRowManager ();
@@ -908,7 +891,6 @@ record = rowItr.next();
908
891
909
892
rCount ++;
910
893
}
911
-
912
894
}
913
895
914
896
@ AfterClass
0 commit comments