aboutsummaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorJames Ahlborn <jtahlborn@yahoo.com>2020-05-03 01:39:35 +0000
committerJames Ahlborn <jtahlborn@yahoo.com>2020-05-03 01:39:35 +0000
commit42c8f108f9e45d7f3e97b67f7c4fe2b8fa5453f1 (patch)
treea81db7fb30269430722f4a8ee69c350c22b5b31a /src/test
parentca66e82dae9a9c20aa5026a69ea3cf105a882507 (diff)
downloadjackcess-42c8f108f9e45d7f3e97b67f7c4fe2b8fa5453f1.tar.gz
jackcess-42c8f108f9e45d7f3e97b67f7c4fe2b8fa5453f1.zip
enable expression evaluation by default
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@1324 f203690c-595d-4dc9-a70b-905162fa7fd2
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/com/healthmarketscience/jackcess/IndexTest.java62
-rw-r--r--src/test/java/com/healthmarketscience/jackcess/impl/CalcFieldTest.java6
-rw-r--r--src/test/java/com/healthmarketscience/jackcess/impl/FKEnforcerTest.java5
3 files changed, 39 insertions, 34 deletions
diff --git a/src/test/java/com/healthmarketscience/jackcess/IndexTest.java b/src/test/java/com/healthmarketscience/jackcess/IndexTest.java
index 47f7b89..8633dea 100644
--- a/src/test/java/com/healthmarketscience/jackcess/IndexTest.java
+++ b/src/test/java/com/healthmarketscience/jackcess/IndexTest.java
@@ -67,7 +67,7 @@ public class IndexTest extends TestCase {
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};
@@ -85,7 +85,7 @@ public class IndexTest extends TestCase {
IndexData.BYTE_CODE_COMPARATOR);
sortedSet.addAll(expectedList);
assertEquals(expectedList, new ArrayList<byte[]>(sortedSet));
-
+
}
public void testPrimaryKey() throws Exception {
@@ -98,7 +98,7 @@ public class IndexTest extends TestCase {
index.isPrimaryKey());
if(index.isPrimaryKey()) {
pkIndex= index;
-
+
}
}
Map<String, Boolean> expectedPKs = new HashMap<String, Boolean>();
@@ -108,7 +108,7 @@ public class IndexTest extends TestCase {
assertSame(pkIndex, table.getPrimaryKeyIndex());
}
}
-
+
public void testLogicalIndexes() throws Exception
{
for (final TestDB testDB : TestDB.getSupportedForBasename(Basename.INDEX, true)) {
@@ -234,6 +234,8 @@ public class IndexTest extends TestCase {
for (final TestDB testDB : TestDB.getSupportedForBasename(Basename.INDEX_PROPERTIES)) {
Database db = openCopy(testDB);
+ db.setEvaluateExpressions(false);
+
doTestIgnoreNulls(db, "TableIgnoreNulls1");
doTestIgnoreNulls(db, "TableIgnoreNulls2");
@@ -254,7 +256,7 @@ public class IndexTest extends TestCase {
temp.addRow(orig.asRow(row));
}
- assertEquals(origI.getIndexData().getEntryCount(),
+ assertEquals(origI.getIndexData().getEntryCount(),
tempI.getIndexData().getEntryCount());
Cursor origC = origI.newCursor().toCursor();
@@ -272,7 +274,7 @@ public class IndexTest extends TestCase {
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));
@@ -388,7 +390,7 @@ public class IndexTest extends TestCase {
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 {
@@ -405,7 +407,7 @@ public class IndexTest extends TestCase {
db.close();
}
}
-
+
public void testReplId() throws Exception
{
for (final TestDB testDB : SUPPORTED_DBS_TEST) {
@@ -436,8 +438,8 @@ public class IndexTest extends TestCase {
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());
@@ -459,9 +461,9 @@ public class IndexTest extends TestCase {
assertEquals("row" + i, row.get("data"));
}
assertFalse(c.moveToNextRow());
- }
+ }
}
-
+
public void testIndexCreationSharedData() throws Exception
{
for (final FileFormat fileFormat : SUPPORTED_FILEFORMATS) {
@@ -479,8 +481,8 @@ public class IndexTest extends TestCase {
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());
@@ -512,7 +514,7 @@ public class IndexTest extends TestCase {
assertFalse(c.moveToNextRow());
}
}
-
+
public void testGetForeignKeyIndex() throws Exception
{
for (final TestDB testDB : TestDB.getSupportedForBasename(Basename.INDEX, true)) {
@@ -538,12 +540,12 @@ public class IndexTest extends TestCase {
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
@@ -591,7 +593,7 @@ public class IndexTest extends TestCase {
IndexCursor pkCursor = CursorBuilder.createPrimaryKeyCursor(t);
assertCursor(expectedRows, pkCursor);
- assertCursor(expectedRows,
+ assertCursor(expectedRows,
CursorBuilder.createCursor(t.getIndex("data_ind")));
List<Object[]> batch = new ArrayList<Object[]>();
@@ -614,10 +616,10 @@ public class IndexTest extends TestCase {
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);
@@ -631,16 +633,16 @@ public class IndexTest extends TestCase {
} 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
@@ -667,7 +669,7 @@ public class IndexTest extends TestCase {
} catch(ConstraintViolationException ce) {
// success
}
-
+
t.addRow(null, "row3");
assertEquals(3, t.getRowCount());
@@ -686,7 +688,7 @@ public class IndexTest extends TestCase {
IndexCursor pkCursor = CursorBuilder.createPrimaryKeyCursor(t);
assertCursor(expectedRows, pkCursor);
- assertCursor(expectedRows,
+ assertCursor(expectedRows,
CursorBuilder.createCursor(t.getIndex("data_ind")));
List<Object[]> batch = new ArrayList<Object[]>();
@@ -708,16 +710,16 @@ public class IndexTest extends TestCase {
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)) {
@@ -746,7 +748,7 @@ public class IndexTest extends TestCase {
boolean found = false;
for(Row idxRow : ic.newEntryIterable(data)) {
-
+
assertTrue(Arrays.equals(data, idxRow.getBytes(colName)));
if(id == idxRow.getInt("ID")) {
found = true;
diff --git a/src/test/java/com/healthmarketscience/jackcess/impl/CalcFieldTest.java b/src/test/java/com/healthmarketscience/jackcess/impl/CalcFieldTest.java
index b5afcd3..29ea9ac 100644
--- a/src/test/java/com/healthmarketscience/jackcess/impl/CalcFieldTest.java
+++ b/src/test/java/com/healthmarketscience/jackcess/impl/CalcFieldTest.java
@@ -68,6 +68,8 @@ public class CalcFieldTest extends TestCase
Database db = create(fileFormat);
+ db.setEvaluateExpressions(false);
+
Table t = new TableBuilder("Test")
.putProperty("awesome_table", true)
.addColumn(new ColumnBuilder("id", DataType.LONG)
@@ -89,7 +91,7 @@ public class CalcFieldTest extends TestCase
assertTrue(col.isCalculated());
assertEquals("[id] & \"_\" & [data]", col.getProperties().getValue(
PropertyMap.EXPRESSION_PROP));
- assertEquals(DataType.TEXT.getValue(),
+ assertEquals(DataType.TEXT.getValue(),
col.getProperties().getValue(
PropertyMap.RESULT_TYPE_PROP));
@@ -163,7 +165,7 @@ public class CalcFieldTest extends TestCase
assertEquals(expectedRows, rows);
db.close();
- }
+ }
}
}
diff --git a/src/test/java/com/healthmarketscience/jackcess/impl/FKEnforcerTest.java b/src/test/java/com/healthmarketscience/jackcess/impl/FKEnforcerTest.java
index 2567f12..9f02481 100644
--- a/src/test/java/com/healthmarketscience/jackcess/impl/FKEnforcerTest.java
+++ b/src/test/java/com/healthmarketscience/jackcess/impl/FKEnforcerTest.java
@@ -63,13 +63,14 @@ public class FKEnforcerTest extends TestCase
db.close();
}
-
+
}
public void testEnforceForeignKeys() throws Exception {
for (final TestDB testDB : TestDB.getSupportedForBasename(Basename.INDEX)) {
Database db = openCopy(testDB);
+ db.setEvaluateExpressions(false);
Table t1 = db.getTable("Table1");
Table t2 = db.getTable("Table2");
Table t3 = db.getTable("Table3");
@@ -132,7 +133,7 @@ public class FKEnforcerTest extends TestCase
db.close();
}
-
+
}
private static Row createT1Row(