assertTrue(ByteUtil.asUnsignedByte(b3) < ByteUtil.asUnsignedByte(b4));
assertTrue(ByteUtil.asUnsignedByte(b4) < ByteUtil.asUnsignedByte(b5));
}
-
+
public void testByteCodeComparator() {
byte[] b0 = null;
byte[] b1 = new byte[]{(byte)0x00};
IndexData.BYTE_CODE_COMPARATOR);
sortedSet.addAll(expectedList);
assertEquals(expectedList, new ArrayList<byte[]>(sortedSet));
-
+
}
public void testPrimaryKey() throws Exception {
index.isPrimaryKey());
if(index.isPrimaryKey()) {
pkIndex= index;
-
+
}
}
Map<String, Boolean> expectedPKs = new HashMap<String, Boolean>();
assertSame(pkIndex, table.getPrimaryKeyIndex());
}
}
-
+
public void testLogicalIndexes() throws Exception
{
for (final TestDB testDB : TestDB.getSupportedForBasename(Basename.INDEX, true)) {
for (final TestDB testDB : TestDB.getSupportedForBasename(Basename.INDEX_PROPERTIES)) {
Database db = openCopy(testDB);
+ db.setEvaluateExpressions(false);
+
doTestIgnoreNulls(db, "TableIgnoreNulls1");
doTestIgnoreNulls(db, "TableIgnoreNulls2");
temp.addRow(orig.asRow(row));
}
- assertEquals(origI.getIndexData().getEntryCount(),
+ assertEquals(origI.getIndexData().getEntryCount(),
tempI.getIndexData().getEntryCount());
Cursor origC = origI.newCursor().toCursor();
Cursor.Position origCurPos = origC.getSavepoint().getCurrentPosition();
Map<String,Object> tempRow = tempC.getCurrentRow();
Cursor.Position tempCurPos = tempC.getSavepoint().getCurrentPosition();
-
+
assertEquals(origRow, tempRow);
assertEquals(IndexCodesTest.entryToString(origCurPos),
IndexCodesTest.entryToString(tempCurPos));
final Row row = c.getCurrentRow();
// Row order is arbitrary, so v2007 row order difference is valid
- if (testDB.getExpectedFileFormat().ordinal() >=
+ if (testDB.getExpectedFileFormat().ordinal() >=
Database.FileFormat.V2007.ordinal()) {
TestUtil.checkTestDBTable1RowA(testDB, table, row);
} else {
db.close();
}
}
-
+
public void testReplId() throws Exception
{
for (final TestDB testDB : SUPPORTED_DBS_TEST) {
assertEquals(1, t.getIndexes().size());
IndexImpl idx = (IndexImpl)t.getIndexes().get(0);
-
- assertEquals(IndexBuilder.PRIMARY_KEY_NAME, idx.getName());
+
+ assertEquals(IndexBuilder.PRIMARY_KEY_NAME, idx.getName());
assertEquals(1, idx.getColumns().size());
assertEquals("id", idx.getColumns().get(0).getName());
assertTrue(idx.getColumns().get(0).isAscending());
assertEquals("row" + i, row.get("data"));
}
assertFalse(c.moveToNextRow());
- }
+ }
}
-
+
public void testIndexCreationSharedData() throws Exception
{
for (final FileFormat fileFormat : SUPPORTED_FILEFORMATS) {
assertEquals(4, t.getIndexes().size());
IndexImpl idx = (IndexImpl)t.getIndexes().get(0);
-
- assertEquals(IndexBuilder.PRIMARY_KEY_NAME, idx.getName());
+
+ assertEquals(IndexBuilder.PRIMARY_KEY_NAME, idx.getName());
assertEquals(1, idx.getColumns().size());
assertEquals("id", idx.getColumns().get(0).getName());
assertTrue(idx.getColumns().get(0).isAscending());
assertFalse(c.moveToNextRow());
}
}
-
+
public void testGetForeignKeyIndex() throws Exception
{
for (final TestDB testDB : TestDB.getSupportedForBasename(Basename.INDEX, true)) {
assertTrue(t3t1.getReference().isCascadeUpdates());
assertFalse(t3t1.getReference().isCascadeDeletes());
doCheckForeignKeyIndex(t1, t3t1, t3);
-
+
Index t1pk = t1.getIndex(IndexBuilder.PRIMARY_KEY_NAME);
assertNotNull(t1pk);
assertNull(((IndexImpl)t1pk).getReference());
assertNull(t1pk.getReferencedIndex());
- }
+ }
}
public void testConstraintViolation() throws Exception
IndexCursor pkCursor = CursorBuilder.createPrimaryKeyCursor(t);
assertCursor(expectedRows, pkCursor);
- assertCursor(expectedRows,
+ assertCursor(expectedRows,
CursorBuilder.createCursor(t.getIndex("data_ind")));
List<Object[]> batch = new ArrayList<Object[]>();
expectedRows.add(createExpectedRow("id", 6, "data", "row6"));
assertTable(expectedRows, t);
-
+
assertCursor(expectedRows, pkCursor);
- assertCursor(expectedRows,
+ assertCursor(expectedRows,
CursorBuilder.createCursor(t.getIndex("data_ind")));
pkCursor.findFirstRowByEntry(4);
} catch(ConstraintViolationException ce) {
// success
}
-
+
assertTable(expectedRows, t);
-
+
assertCursor(expectedRows, pkCursor);
- assertCursor(expectedRows,
+ assertCursor(expectedRows,
CursorBuilder.createCursor(t.getIndex("data_ind")));
db.close();
- }
+ }
}
public void testAutoNumberRecover() throws Exception
} catch(ConstraintViolationException ce) {
// success
}
-
+
t.addRow(null, "row3");
assertEquals(3, t.getRowCount());
IndexCursor pkCursor = CursorBuilder.createPrimaryKeyCursor(t);
assertCursor(expectedRows, pkCursor);
- assertCursor(expectedRows,
+ assertCursor(expectedRows,
CursorBuilder.createCursor(t.getIndex("data_ind")));
List<Object[]> batch = new ArrayList<Object[]>();
expectedRows.add(createExpectedRow("id", 5, "data", "row5"));
assertTable(expectedRows, t);
-
+
assertCursor(expectedRows, pkCursor);
- assertCursor(expectedRows,
+ assertCursor(expectedRows,
CursorBuilder.createCursor(t.getIndex("data_ind")));
db.close();
}
}
-
+
public void testBinaryIndex() throws Exception
{
for (final TestDB testDB : TestDB.getSupportedForBasename(Basename.BINARY_INDEX)) {
boolean found = false;
for(Row idxRow : ic.newEntryIterable(data)) {
-
+
assertTrue(Arrays.equals(data, idxRow.getBytes(colName)));
if(id == idxRow.getInt("ID")) {
found = true;