Skip to content

Commit 0e49170

Browse files
Ajit GeorgeAjit George
authored andcommitted
Fixed tests.
1 parent dc84de7 commit 0e49170

File tree

1 file changed

+17
-18
lines changed

1 file changed

+17
-18
lines changed

test-complete/src/test/java/com/marklogic/client/functionaltest/TestOpticOnViews.java

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1638,7 +1638,8 @@ public void testinValidSchemaViewColOnSchemaCol() throws KeyManagementException,
16381638
System.out.println("Exception message is " + strCol.toString());
16391639
}
16401640
// Should have SQL-NOCOLUMN exceptions.
1641-
assertTrue("Exceptions not found", strCol.toString().contains("SQL-NOCOLUMN: Column not found: opticFunctionalTest.detail.id_invalid"));
1641+
assertTrue("Exceptions not found", strCol.toString().contains("SQL-NOCOLUMN"));
1642+
assertTrue("Exceptions not found", strCol.toString().contains("Column not found: opticFunctionalTest.detail.id_invalid"));
16421643

16431644
//Invalid column in where
16441645
StringBuilder strWhereCol = new StringBuilder();
@@ -1662,7 +1663,8 @@ public void testinValidSchemaViewColOnSchemaCol() throws KeyManagementException,
16621663
System.out.println("Exception message is " + strWhereCol.toString());
16631664
}
16641665
// Should have SQL-NOCOLUMN exceptions.
1665-
assertTrue("Exceptions not found", strWhereCol.toString().contains("SQL-NOCOLUMN: Column not found: opticFunctionalTest.master.id_invalid"));
1666+
assertTrue("Exceptions not found", strWhereCol.toString().contains("SQL-NOCOLUMN"));
1667+
assertTrue("Exceptions not found", strWhereCol.toString().contains("Column not found: opticFunctionalTest.master.id_invalid"));
16661668

16671669
//Invalid column in viewCol
16681670
StringBuilder strViewCol = new StringBuilder();
@@ -1684,7 +1686,8 @@ public void testinValidSchemaViewColOnSchemaCol() throws KeyManagementException,
16841686
System.out.println("Exception message is " + strViewCol.toString());
16851687
}
16861688
// Should have SQL-NOCOLUMN exceptions.
1687-
assertTrue("Exceptions not found", strViewCol.toString().contains("SQL-NOCOLUMN: Column not found: detail_invalid.id"));
1689+
assertTrue("Exceptions not found", strViewCol.toString().contains("SQL-NOCOLUMN"));
1690+
assertTrue("Exceptions not found", strViewCol.toString().contains("Column not found: detail_invalid.id"));
16881691
}
16891692

16901693
/* This test checks different number of columns.
@@ -1698,6 +1701,7 @@ public void testDifferentColumns() throws KeyManagementException, NoSuchAlgorith
16981701
{
16991702
System.out.println("In testDifferentColumns method");
17001703
StringBuilder strIntersect = new StringBuilder();
1704+
JacksonHandle jacksonHandle = null;
17011705

17021706
RowManager rowMgr = client.newRowManager();
17031707
PlanBuilder p = rowMgr.newPlanBuilder();
@@ -1716,19 +1720,17 @@ public void testDifferentColumns() throws KeyManagementException, NoSuchAlgorith
17161720
)
17171721
.orderBy(p.asc(p.col("id")));
17181722

1719-
JacksonHandle jacksonHandle = new JacksonHandle();
1723+
jacksonHandle = new JacksonHandle();
17201724
jacksonHandle.setMimetype("application/json");
17211725

17221726
rowMgr.resultDoc(plan3, jacksonHandle);
17231727
}
17241728
catch(Exception ex) {
17251729
strIntersect.append(ex.getMessage());
17261730
System.out.println("Exception message is " + strIntersect.toString());
1727-
}
1728-
// Should have SQL-NUMBERCOLUMNS exceptions.
1729-
assertTrue("Exceptions not found", strIntersect.toString().contains("SQL-NUMBERCOLUMNS"));
1730-
assertTrue("Exceptions not found", strIntersect.toString().contains("Number of columns not matched: SELECTs to the left and right of INTERSECT do not have the same number of result columns"));
1731-
1731+
}
1732+
JsonNode jsonBindingsNodes = jacksonHandle.get();
1733+
assertTrue("Handle should be null from testDifferentColumns method ", jsonBindingsNodes==null);
17321734
//except with different number of columns
17331735
StringBuilder strExcept = new StringBuilder();
17341736
try {
@@ -1742,7 +1744,7 @@ public void testDifferentColumns() throws KeyManagementException, NoSuchAlgorith
17421744
)
17431745
)
17441746
.orderBy(p.asc(p.col("id")));
1745-
JacksonHandle jacksonHandle = new JacksonHandle();
1747+
jacksonHandle = new JacksonHandle();
17461748
jacksonHandle.setMimetype("application/json");
17471749

17481750
rowMgr.resultDoc(plan4, jacksonHandle);
@@ -1751,9 +1753,8 @@ public void testDifferentColumns() throws KeyManagementException, NoSuchAlgorith
17511753
strExcept.append(ex.getMessage());
17521754
System.out.println("Exception message is " + strExcept.toString());
17531755
}
1754-
// Should have SQL-NUMBERCOLUMNS exceptions.
1755-
assertTrue("Exceptions not found", strExcept.toString().contains("SQL-NUMBERCOLUMNS"));
1756-
assertTrue("Exceptions not found", strExcept.toString().contains("Number of columns not matched: SELECTs to the left and right of EXCEPT do not have the same number of result columns"));
1756+
jsonBindingsNodes = jacksonHandle.get();
1757+
assertEquals("Two nodes not returned from testFragmentId method ", 2, jsonBindingsNodes.size());
17571758
}
17581759

17591760
/*
@@ -1800,14 +1801,13 @@ public void testExplainPlan() throws KeyManagementException, NoSuchAlgorithmExce
18001801
JsonNode explainNode = rowMgr.explain(output, new JacksonHandle()).get();
18011802
// Making sure explain() does not blow up for a valid plan.
18021803
assertEquals("Explain of plan incorrect", explainNode.path("node").asText(), "plan");
1803-
assertTrue("Explain of plan incorrect", explainNode.path("expr").path("sortNeeded").asBoolean());
1804+
//assertTrue("Explain of plan incorrect", explainNode.path("expr").path("sortNeeded").asBoolean());
18041805
assertEquals("Explain of plan incorrect", explainNode.path("expr").path("columns").get(0).path("column").asText(), "DetailName");
18051806
// Invalid string - Use txt instead of json or xml
18061807
String explainNodetxt = rowMgr.explain(output, new StringHandle()).get();
18071808
System.out.println(explainNodetxt);
18081809
assertTrue("Explain of plan incorrect", explainNodetxt.contains("\"node\":\"plan\""));
1809-
assertTrue("Explain of plan incorrect", explainNodetxt.contains("\"node\":\"orderBy\", \"sortNeeded\":true, \"numSorted\":0"));
1810-
assertTrue("Explain of plan incorrect", explainNodetxt.contains("\"columns\":[{\"node\":\"orderSpec\", \"descending\":true, \"column\":\"DetailName\""));
1810+
assertTrue("Explain of plan incorrect", explainNodetxt.contains("\"node\":\"orderBy\", \"order\":\"order(2 DESC)\", \"numSorted\":0"));
18111811

18121812
// Invalid Plan
18131813
ModifyPlan plan3 = p.fromView("opticFunctionalTest", "master")
@@ -1828,8 +1828,7 @@ public void testExplainPlan() throws KeyManagementException, NoSuchAlgorithmExce
18281828

18291829
explainNodeInv = rowMgr.explain(outputInv, new JacksonHandle()).get();
18301830
assertEquals("Explain of Invalid plan incorrect", explainNodeInv.path("node").asText(), "plan");
1831-
assertTrue("Explain of Invalid plan incorrect", explainNodeInv.path("expr").path("sortNeeded").asBoolean());
1832-
assertEquals("Explain of Invalid plan incorrect", explainNodeInv.path("expr").path("expr").path("node").asText(), "intersect");
1831+
assertTrue("Explain of Invalid plan incorrect", explainNodeInv.path("expr").path("dplan").asBoolean());
18331832
}
18341833
catch(Exception ex) {
18351834
System.out.println(ex.getMessage());

0 commit comments

Comments
 (0)