Skip to content

Commit

Permalink
Update MetadataTest now mondrian has 2 extra functions; fix drill-thr…
Browse files Browse the repository at this point in the history
…ough test for Derby's JDBC driver weirdness.

git-svn-id: https://olap4j.svn.sourceforge.net/svnroot/olap4j/trunk@55 c6a108a4-781c-0410-a6c6-c2d559e19af0
  • Loading branch information
julianhyde committed Dec 21, 2007
1 parent 6d9c74d commit ea8b51d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 16 deletions.
35 changes: 21 additions & 14 deletions testsrc/org/olap4j/ConnectionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -738,31 +738,36 @@ public void testCell() throws Exception {
break;
default:
final ResultSet resultSet = cell.drillThrough();
assertEquals(5, resultSet.getMetaData().getColumnCount());
final ResultSetMetaData metaData = resultSet.getMetaData();
// Most databases return 5 columns. Derby returns 9 because of
// 4 columns in the ORDER BY clause.
assertTrue(metaData.getColumnCount() >= 5);
assertEquals("Year", metaData.getColumnLabel(1));
assertEquals("Store Sales", metaData.getColumnLabel(5));
resultSet.close();
break;
}

// cell out of range using getCell(int)
try {
cellSet.getCell(-5);
fail("expected exception");
Cell cell2 = cellSet.getCell(-5);
fail("expected exception, got " + cell2);
} catch (IndexOutOfBoundsException e) {
// ok
}

// cell out of range using getCell(int)
try {
cellSet.getCell(105);
fail("expected exception");
Cell cell2 = cellSet.getCell(105);
fail("expected exception, got " + cell2);
} catch (IndexOutOfBoundsException e) {
// ok
}

// cell out of range using getCell(List<Integer>)
try {
cellSet.getCell(Arrays.asList(2, 1));
fail("expected exception");
Cell cell2 = cellSet.getCell(Arrays.asList(2, 1));
fail("expected exception, got " + cell2);
} catch (IndexOutOfBoundsException e) {
// ok
}
Expand All @@ -771,18 +776,20 @@ public void testCell() throws Exception {
// number of positions might be wrong
try {
// too few dimensions
cellSet.getCell(cellSet.getAxes().get(0).getPositions().get(0));
fail("expected exception");
Cell cell2 =
cellSet.getCell(cellSet.getAxes().get(0).getPositions().get(0));
fail("expected exception, got " + cell2);
} catch (IllegalArgumentException e) {
// ok
}
try {
// too many dimensions
cellSet.getCell(
cellSet.getAxes().get(0).getPositions().get(0),
cellSet.getAxes().get(1).getPositions().get(0),
cellSet.getAxes().get(0).getPositions().get(0));
fail("expected exception");
Cell cell2 =
cellSet.getCell(
cellSet.getAxes().get(0).getPositions().get(0),
cellSet.getAxes().get(1).getPositions().get(0),
cellSet.getAxes().get(0).getPositions().get(0));
fail("expected exception, got " + cell2);
} catch (IllegalArgumentException e) {
// ok
}
Expand Down
4 changes: 2 additions & 2 deletions testsrc/org/olap4j/MetadataTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -301,12 +301,12 @@ public void testDatabaseMetaDataGetFunctions() throws SQLException {
olapDatabaseMetaData.getOlapFunctions(null),
FUNCTIONS_COLUMN_NAMES);
assertContains("FUNCTION_NAME=Name, DESCRIPTION=Returns the name of a member., PARAMETER_LIST=Member, RETURN_TYPE=8, ORIGIN=1, INTERFACE_NAME=, LIBRARY_NAME=null, CAPTION=Name", s);
assertEquals(272, linecount(s));
assertEquals(274, linecount(s));

s = checkResultSet(
olapDatabaseMetaData.getOlapFunctions("%scendants"),
FUNCTIONS_COLUMN_NAMES);
assertEquals(s, 6, linecount(s));
assertEquals(s, 7, linecount(s));
}

public void testDatabaseMetaDataGetHierarchies() throws SQLException {
Expand Down

0 comments on commit ea8b51d

Please sign in to comment.