@@ -356,14 +356,14 @@ public void testgroupBy() throws KeyManagementException, NoSuchAlgorithmExceptio
356356 PlanBuilder p = rowMgr .newPlanBuilder ();
357357
358358 ModifyPlan plan1 = p .fromView ("opticFunctionalTest" , "detail" )
359- .orderBy (p .col ( "id" ));
359+ .orderBy (p .schemaCol ( "opticFunctionalTest" , "detail" , "id" ));
360360
361361 ModifyPlan plan2 = p .fromView ("opticFunctionalTest" , "master" )
362362 .orderBy (p .schemaCol ("opticFunctionalTest" , "master" , "id" ));
363363 ModifyPlan plan3 = plan1 .union (plan2 )
364364 .select (p .as ("MasterName" , p .schemaCol ("opticFunctionalTest" , "master" , "name" )),
365365 p .schemaCol ("opticFunctionalTest" , "master" , "date" ),
366- p .as ("DetailName" , p .col ( "name" )),
366+ p .as ("DetailName" , p .schemaCol ( "opticFunctionalTest" , "detail" , "name" )),
367367 p .col ( "amount" ),
368368 p .col ( "color" )
369369 )
@@ -400,7 +400,7 @@ public void testjoinInnerKeyMatch() throws KeyManagementException, NoSuchAlgorit
400400 RowManager rowMgr = client .newRowManager ();
401401 PlanBuilder p = rowMgr .newPlanBuilder ();
402402 ModifyPlan plan1 = p .fromView ("opticFunctionalTest" , "detail" )
403- .orderBy (p .col ( "id" ));
403+ .orderBy (p .schemaCol ( "opticFunctionalTest" , "detail" , "id" ));
404404 ModifyPlan plan2 = p .fromView ("opticFunctionalTest" , "master" )
405405 .orderBy (p .schemaCol ("opticFunctionalTest" , "master" , "id" ));
406406 ModifyPlan plan3 = plan1 .joinInner (plan2 )
@@ -409,7 +409,7 @@ public void testjoinInnerKeyMatch() throws KeyManagementException, NoSuchAlgorit
409409 p .col ( "masterId" )
410410 )
411411 )
412- .orderBy (p .asc (p .col ( "id" )));
412+ .orderBy (p .asc (p .schemaCol ( "opticFunctionalTest" , "detail" , "id" )));
413413 JacksonHandle jacksonHandle = new JacksonHandle ();
414414 jacksonHandle .setMimetype ("application/json" );
415415
@@ -458,7 +458,7 @@ public void testjoinInnerKeyMatchWithSelect() throws KeyManagementException, NoS
458458 .select (
459459 p .as ("MasterName" , p .schemaCol ("opticFunctionalTest" , "master" , "name" )),
460460 p .schemaCol ("opticFunctionalTest" , "master" , "date" ),
461- p .as ("DetailName" , p .col ( "name" )),
461+ p .as ("DetailName" , p .schemaCol ( "opticFunctionalTest" , "detail" , "name" )),
462462 p .col ( "amount" ),
463463 p .col ( "color" )
464464 )
@@ -536,14 +536,14 @@ public void testjoinLeftOuterWithSelect() throws KeyManagementException, NoSuchA
536536 RowManager rowMgr = client .newRowManager ();
537537 PlanBuilder p = rowMgr .newPlanBuilder ();
538538 ModifyPlan plan1 = p .fromView ("opticFunctionalTest" , "detail" )
539- .orderBy (p .col ( "id" ));
539+ .orderBy (p .schemaCol ( "opticFunctionalTest" , "detail" , "id" ));
540540 ModifyPlan plan2 = p .fromView ("opticFunctionalTest" , "master" )
541541 .orderBy (p .schemaCol ("opticFunctionalTest" , "master" , "id" ));
542542 ModifyPlan plan3 = plan1 .joinLeftOuter (plan2 )
543543 .select (
544544 p .as ("MasterName" , p .schemaCol ("opticFunctionalTest" , "master" , "name" )),
545545 p .schemaCol ("opticFunctionalTest" , "master" , "date" ),
546- p .as ("DetailName" , p .col ( "name" )),
546+ p .as ("DetailName" , p .schemaCol ( "opticFunctionalTest" , "detail" , "name" )),
547547 p .col ( "amount" ),
548548 p .col ( "color" )
549549 )
@@ -583,14 +583,14 @@ public void testjoinCrossProduct() throws KeyManagementException, NoSuchAlgorith
583583 RowManager rowMgr = client .newRowManager ();
584584 PlanBuilder p = rowMgr .newPlanBuilder ();
585585 ModifyPlan plan1 = p .fromView ("opticFunctionalTest" , "detail" )
586- .orderBy (p .col ( "id" ));
586+ .orderBy (p .schemaCol ( "opticFunctionalTest" , "detail" , "id" ));
587587 ModifyPlan plan2 = p .fromView ("opticFunctionalTest" , "master" )
588588 .orderBy (p .schemaCol ("opticFunctionalTest" , "master" , "id" ));
589589 ModifyPlan plan3 = plan1 .joinCrossProduct (plan2 )
590590 .select (
591591 p .as ("MasterName" , p .schemaCol ("opticFunctionalTest" , "master" , "name" )),
592592 p .schemaCol ("opticFunctionalTest" , "master" , "date" ),
593- p .as ("DetailName" , p .col ( "name" )),
593+ p .as ("DetailName" , p .schemaCol ( "opticFunctionalTest" , "detail" , "name" )),
594594 p .col ( "amount" ),
595595 p .col ( "color" )
596596 )
@@ -1066,7 +1066,7 @@ public void testjoinInnerWhereDisctinct() throws KeyManagementException, NoSuchA
10661066 PlanBuilder p = rowMgr .newPlanBuilder ();
10671067
10681068 ModifyPlan plan1 = p .fromView ("opticFunctionalTest" , "detail" )
1069- .orderBy (p .col ( "id" ));
1069+ .orderBy (p .schemaCol ( "opticFunctionalTest" , "detail" , "id" ));
10701070 ModifyPlan plan2 = p .fromView ("opticFunctionalTest" , "master" )
10711071 .orderBy (p .schemaCol ("opticFunctionalTest" , "master" , "id" ));
10721072 ModifyPlan plan3 = plan1 .joinInner (plan2 )
@@ -1076,7 +1076,7 @@ public void testjoinInnerWhereDisctinct() throws KeyManagementException, NoSuchA
10761076 p .col ( "masterId" )
10771077 )
10781078 )
1079- .orderBy (p .asc (p .col ( "id" )))
1079+ .orderBy (p .asc (p .schemaCol ( "opticFunctionalTest" , "master" , "id" )))
10801080 .select (p .col ( "color" ))
10811081 .whereDistinct ()
10821082 .orderBy (p .desc (p .col ( "color" )));
@@ -1116,7 +1116,7 @@ public void testJoinLeftOuter() throws KeyManagementException, NoSuchAlgorithmEx
11161116 .select (
11171117 p .as ("MasterName" , p .schemaCol ("opticFunctionalTest" , "master" , "name" )),
11181118 p .schemaCol ("opticFunctionalTest" , "master" , "date" ),
1119- p .as ("DetailName" , p . col ( "name" )),
1119+ p .as ("DetailName" ,p . schemaCol ( "opticFunctionalTest" , "detail" , "name" )),
11201120 p .col ( "amount" ),
11211121 p .col ( "color" )
11221122 )
@@ -1266,9 +1266,9 @@ public void testArithmeticOperations() throws KeyManagementException, NoSuchAlgo
12661266 RowManager rowMgr = client .newRowManager ();
12671267 PlanBuilder p = rowMgr .newPlanBuilder ();
12681268 ModifyPlan plan1 = p .fromView ("opticFunctionalTest" , "detail" )
1269- .orderBy (p .col ( "id" ));
1269+ .orderBy (p .schemaCol ( "opticFunctionalTest" , "detail" , "id" ));
12701270 ModifyPlan plan2 = p .fromView ("opticFunctionalTest" , "master" )
1271- .orderBy (p .col ( "id" ));
1271+ .orderBy (p .schemaCol ( "opticFunctionalTest" , "master" , "id" ));
12721272 ModifyPlan plan3 = plan1 .joinInner (plan2 )
12731273 .where (p .eq (p .schemaCol ("opticFunctionalTest" , "master" , "id" ),
12741274 p .col ( "masterId" ))
@@ -1611,7 +1611,7 @@ public void testinValidSchemaViewColOnSchemaCol() throws KeyManagementException,
16111611 p .col ( "masterId" )
16121612 )
16131613 )
1614- .orderBy (p .asc (p .col ( "id_invalid" )));
1614+ .orderBy (p .asc (p .schemaCol ( "opticFunctionalTest" , "detail" , "id_invalid" )));
16151615
16161616 JacksonHandle jacksonHandle = new JacksonHandle ();
16171617 jacksonHandle .setMimetype ("application/json" );
@@ -1689,17 +1689,17 @@ public void testDifferentColumns() throws KeyManagementException, NoSuchAlgorith
16891689 ModifyPlan plan1 = p .fromView ("opticFunctionalTest" , "master" )
16901690 .orderBy (p .schemaCol ("opticFunctionalTest" , "master" , "id" ));
16911691 ModifyPlan plan2 = p .fromView ("opticFunctionalTest" , "detail" )
1692- .orderBy (p .col ( "id" ));
1692+ .orderBy (p .schemaCol ( "opticFunctionalTest" , "detail" , "id" ));
16931693 // intersect with different number of columns
16941694 try {
16951695 ModifyPlan plan3 = plan1 .select (p .schemaCol ("opticFunctionalTest" , "master" , "id" ))
16961696 .intersect (
16971697 plan2 .select (
1698- p . col ( "id" ),
1699- p .col ( "masterId" )
1698+ p . schemaCol ( "opticFunctionalTest" , "detail" , "id" ),
1699+ p .schemaCol ( "opticFunctionalTest" , "master" , "masterId" )
17001700 )
17011701 )
1702- .orderBy (p .asc (p .col ( "id" )));
1702+ .orderBy (p .asc (p .schemaCol ( "opticFunctionalTest" , "detail" , "id" )));
17031703
17041704 jacksonHandle = new JacksonHandle ();
17051705 jacksonHandle .setMimetype ("application/json" );
@@ -1824,7 +1824,7 @@ public void testFragmentId() throws KeyManagementException, NoSuchAlgorithmExcep
18241824 PlanSystemColumn fIdCol1 = p .fragmentIdCol ("fragIdCol1" );
18251825 PlanSystemColumn fIdCol2 = p .fragmentIdCol ("fragIdCol2" );
18261826
1827- ModifyPlan plan1 = p .fromView ("opticFunctionalTest" , "detail" , null , p . fragmentIdCol ( "fragIdCol1" ) )
1827+ ModifyPlan plan1 = p .fromView ("opticFunctionalTest" , "detail" , null , fIdCol1 )
18281828 .orderBy (p .col ( "id" ));
18291829 ModifyPlan plan2 = p .fromView ("opticFunctionalTest" , "master" , null , fIdCol2 )
18301830 .orderBy (p .schemaCol ("opticFunctionalTest" , "master" , "id" ));
@@ -1838,7 +1838,7 @@ public void testFragmentId() throws KeyManagementException, NoSuchAlgorithmExcep
18381838 .select (
18391839 p .as ("MasterName" , p .schemaCol ("opticFunctionalTest" , "master" , "name" )),
18401840 p .schemaCol ("opticFunctionalTest" , "master" , "date" ),
1841- p .as ("DetailName" , p .col ( "name" )),
1841+ p .as ("DetailName" , p .schemaCol ( "opticFunctionalTest" , "detail" , "name" )),
18421842 p .col ( "amount" ),
18431843 p .col ( "color" ),
18441844 fIdCol1 ,
@@ -1874,15 +1874,15 @@ public void testjoinInnerWithBind() throws KeyManagementException, NoSuchAlgorit
18741874 RowManager rowMgr = client .newRowManager ();
18751875 PlanBuilder p = rowMgr .newPlanBuilder ();
18761876 ModifyPlan plan1 = p .fromView ("opticFunctionalTest" , "detail" )
1877- .orderBy (p .col ( "id" ));
1877+ .orderBy (p .schemaCol ( "opticFunctionalTest" , "detail" , "id" ));
18781878 ModifyPlan plan2 = p .fromView ("opticFunctionalTest" , "master" )
18791879 .orderBy (p .schemaCol ("opticFunctionalTest" , "master" , "id" ));
18801880 PlanParamExpr idParam = p .param ("ID" );
18811881 ModifyPlan plan3 = plan1 .joinInner (plan2 )
18821882 .where (
18831883 p .eq (p .schemaCol ("opticFunctionalTest" , "master" , "id" ), idParam )
18841884 )
1885- .orderBy (p .asc (p .col ( "id" )));
1885+ .orderBy (p .asc (p .schemaCol ( "opticFunctionalTest" , "detail" , "id" )));
18861886 JacksonHandle jacksonHandle = new JacksonHandle ();
18871887 jacksonHandle .setMimetype ("application/json" );
18881888
@@ -2070,7 +2070,7 @@ public void testFromSqljoinInnerWithkeymatch() throws KeyManagementException, No
20702070 p .col ( "masterId" )
20712071 )
20722072 )
2073- .orderBy (p .asc (p .col ( "id" )));
2073+ .orderBy (p .asc (p .schemaCol ( "opticFunctionalTest" , "detail" , "id" )));
20742074 JacksonHandle jacksonHandle = new JacksonHandle ();
20752075 jacksonHandle .setMimetype ("application/json" );
20762076
@@ -2153,14 +2153,14 @@ public void testFromSqlSelectEmptyAs() throws KeyManagementException, NoSuchAlgo
21532153 PlanBuilder p = rowMgr .newPlanBuilder ();
21542154
21552155 PlanExprColSeq colSeqSel = p .colSeq (
2156- p .col ( "id" ),
2157- p .col ( "color" ),
2156+ p .schemaCol ( "opticFunctionalTest" , "detail" , "id" ),
2157+ p .schemaCol ( "opticFunctionalTest" , "detail" , "color" ),
21582158 p .as ("masterName" , p .schemaCol ("opticFunctionalTest" , "master" , "name" ))
21592159 );
21602160
21612161 ModifyPlan plan1 = p .fromSql ("select * FROM opticFunctionalTest.detail INNER JOIN opticFunctionalTest.master WHERE opticFunctionalTest.detail.masterId = opticFunctionalTest.master.id" )
21622162 .select (colSeqSel )
2163- .orderBy (p .asc (p .col ( "id" )));
2163+ .orderBy (p .asc (p .schemaCol ( "opticFunctionalTest" , "detail" , "id" )));
21642164
21652165 JacksonHandle jacksonHandle = new JacksonHandle ();
21662166 jacksonHandle .setMimetype ("application/json" );
@@ -2304,83 +2304,6 @@ public void testFromSqlUnionOffsetLimit() throws KeyManagementException, NoSuchA
23042304 assertEquals ("Row 3 myPlan value incorrect" , "Detail 3" , jsonResults .path (2 ).path ("myPlan.name" ).path ("value" ).asText ());
23052305 }
23062306
2307- /*
2308- * fromsql
2309- TEST 26 - negative test on arbitrary builtin function
2310- TEST 29 - negative test on incorrect sql statement
2311- TEST 30 - negative test on incorrect sql condition
2312- */
2313- @ Test
2314- public void testFromSqlNegativeIncorrectSql () throws KeyManagementException , NoSuchAlgorithmException , IOException , SAXException , ParserConfigurationException
2315- {
2316- System .out .println ("In testFromSqlNegativeIncorrectSql method" );
2317- RowManager rowMgr = client .newRowManager ();
2318- PlanBuilder p = rowMgr .newPlanBuilder ();
2319- //TEST 29 - negative test on incorrect sql statement
2320- ModifyPlan plan1 = p .fromSql (
2321- "SELECT opticFunctionalTest.detail.id, opticFunctionalTest.detail.name "
2322- + " UNION "
2323- + " SELECT opticFunctionalTest.master.id, opticFunctionalTest.master.name FROM opticFunctionalTest.master ORDER BY name" ,
2324- "myPlan"
2325- )
2326- .orderBy (p .desc ("id" ))
2327- .offsetLimit (1 , 3 );
2328- JacksonHandle jacksonHandle = new JacksonHandle ();
2329- jacksonHandle .setMimetype ("application/json" );
2330- String extStr = null ;
2331-
2332- try {
2333- rowMgr .resultDoc (plan1 , jacksonHandle );
2334- }
2335- catch (Exception ex ) {
2336- extStr = ex .getMessage ();
2337- System .out .println ("TEST29 Exception is + " + extStr );
2338- }
2339- assertTrue ("Exception message incorrect from testFromSqlNegativeIncorrectSql" ,
2340- extStr .contains ("SQL-NOCOLUMN: return plan.sql(select); -- Column not found" ));
2341- //TEST 30 - negative test on incorrect sql condition
2342- ModifyPlan plan2 = p .fromSql (
2343- "SELECT (opticFunctionalTest.detail.amount + opticFunctionalTest.detail.masterId) AS added "
2344- + " (opticFunctionalTest.detail.amount - opticFunctionalTest.master.id) AS substracted, "
2345- + " (opticFunctionalTest.detail.amount % opticFunctionalTest.master.id) AS modulo, "
2346- + " (opticFunctionalTest.detail.amount / (opticFunctionalTest.detail.amount * opticFunctionalTest.detail.id)) AS divided "
2347- + " FROM opticFunctionalTest.detail INNER JOIN opticFunctionalTest.master WHERE opticFunctionalTest.detail.masterId = opticFunctionalTest.master.id)"
2348- )
2349- .orderBy (p .asc ("substracted" ));
2350- JacksonHandle jacksonHandle2 = new JacksonHandle ();
2351- jacksonHandle2 .setMimetype ("application/json" );
2352- String extStr2 = null ;
2353-
2354- try {
2355- rowMgr .resultDoc (plan2 , jacksonHandle );
2356- }
2357- catch (Exception ex ) {
2358- extStr2 = ex .getMessage ();
2359- System .out .println ("TEST30 Exception is + " + extStr2 );
2360- }
2361- assertTrue ("Exception message incorrect from testFromSqlNegativeIncorrectSql" ,
2362- extStr2 .contains ("Unexpected token syntax error" ));
2363- //TEST 26 - negative test on arbitrary builtin function
2364- ModifyPlan plan3 = p .fromSql
2365- (
2366- "SELECT * FROM opticFunctionalTest.detail INNER JOIN opticFunctionalTest.master ORDER BY opticFunctionalTest.detail.id"
2367- )
2368- .where (p .sqlCondition ("<http://www.w3.org/2005/xpath-functions#abs>(-3) = 'theNumericColumn'" ));
2369- JacksonHandle jacksonHandle3 = new JacksonHandle ();
2370- jacksonHandle3 .setMimetype ("application/json" );
2371- String extStr3 = null ;
2372-
2373- try {
2374- rowMgr .resultDoc (plan3 , jacksonHandle );
2375- }
2376- catch (Exception ex ) {
2377- extStr3 = ex .getMessage ();
2378- System .out .println ("TEST30 Exception is + " + extStr3 );
2379- }
2380- assertTrue ("Exception message incorrect from testFromSqlNegativeIncorrectSql" ,
2381- extStr3 .contains ("Unexpected token syntax error" ));
2382- }
2383-
23842307 @ AfterClass
23852308 public static void tearDownAfterClass () throws Exception {
23862309 System .out .println ("In tear down" );
0 commit comments