trafodion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sure...@apache.org
Subject [5/6] incubator-trafodion git commit: add test to check if the getIndexOf return real null
Date Fri, 05 Aug 2016 22:10:35 GMT
add test to check if the getIndexOf return real null


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/fa3cf706
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/fa3cf706
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/fa3cf706

Branch: refs/heads/master
Commit: fa3cf706cc6f502733cb33857a8911e83b636d8f
Parents: e0af177
Author: Weiqing Xu <weiqing.xu@esgyn.cn>
Authored: Fri Aug 5 01:55:14 2016 +0000
Committer: Weiqing Xu <weiqing.xu@esgyn.cn>
Committed: Fri Aug 5 02:00:15 2016 +0000

----------------------------------------------------------------------
 .../org/trafodion/jdbc_test/TestGetIndexInfo.java   | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/fa3cf706/dcs/src/test/jdbc_test/src/test/java/org/trafodion/jdbc_test/TestGetIndexInfo.java
----------------------------------------------------------------------
diff --git a/dcs/src/test/jdbc_test/src/test/java/org/trafodion/jdbc_test/TestGetIndexInfo.java
b/dcs/src/test/jdbc_test/src/test/java/org/trafodion/jdbc_test/TestGetIndexInfo.java
index f0cfa12..1cab0b0 100644
--- a/dcs/src/test/jdbc_test/src/test/java/org/trafodion/jdbc_test/TestGetIndexInfo.java
+++ b/dcs/src/test/jdbc_test/src/test/java/org/trafodion/jdbc_test/TestGetIndexInfo.java
@@ -163,14 +163,30 @@ public class TestGetIndexInfo {
 			
 			assertEquals(methondName + " rowNum " + Integer.toString(rowNum) + " dbTableName ", indexInfo.dbTableName,
rs.getString("TABLE_NAME"));
 			assertEquals(methondName + " rowNum " + Integer.toString(rowNum) + " dbNoneUnique ", indexInfo.dbNoneUnique,
rs.getBoolean("NON_UNIQUE"));
+			// By the Document, dbNoneUnique will return null if the type is SQL_TABLE_STAT
+			System.out.println(rs.wasNull());
+			if (indexInfo.dbType == DatabaseMetaData.tableIndexStatistic)
+				assertTrue(rs.wasNull());
+
 			assertEquals(methondName + " rowNum " + Integer.toString(rowNum) + " dbIndexQualifier
", indexInfo.dbIndexQualifier, rs.getString("INDEX_QUALIFIER"));
 			assertEquals(methondName + " rowNum " + Integer.toString(rowNum) + " dbIndexName ", indexInfo.dbIndexName,
rs.getString("INDEX_NAME"));
 			assertEquals(methondName + " rowNum " + Integer.toString(rowNum) + " dbType ", indexInfo.dbType,
rs.getShort("TYPE"));
 			assertEquals(methondName + " rowNum " + Integer.toString(rowNum) + " dbOridinalPosition
", indexInfo.dbOrdinalPosition, rs.getShort("ORDINAL_POSITION"));
+			// By the Document, it return NULL when the type is SQL_TABLE_STAT
+			if (indexInfo.dbType == DatabaseMetaData.tableIndexStatistic)
+				assertTrue(rs.wasNull());
+
 			assertEquals(methondName + " rowNum " + Integer.toString(rowNum) + " dbColumnName ", indexInfo.dbColumnName,
rs.getString("COLUMN_NAME"));
 			assertEquals(methondName + " rowNum " + Integer.toString(rowNum) + " dbAscOrDesc ", indexInfo.dbAscOrDesc,
rs.getString("ASC_OR_DESC"));
 			assertEquals(methondName + " rowNum " + Integer.toString(rowNum) + " dbCardinality ",
indexInfo.dbCardinality, rs.getInt("CARDINALITY"));
+			// When the type is not SQL_TABLE_STAT, dbCardinality will be NULL
+			if (indexInfo.dbType != DatabaseMetaData.tableIndexStatistic)
+				assertTrue(rs.wasNull());
 			assertEquals(methondName + " rowNum " + Integer.toString(rowNum) + " dbPages ", indexInfo.dbPages,
rs.getInt("PAGES"));
+			// Since dbPages is not supported now, it always return NULL
+			// here check if it is real NULL
+			assertTrue(rs.wasNull());
+
 			assertEquals(methondName + " rowNum " + Integer.toString(rowNum) + " dbFilterCondition
", indexInfo.dbFilterCondition, rs.getString("FILTER_CONDITION"));
 		} catch (Exception e) {
 			System.out.println(e.getMessage());


Mime
View raw message