aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJames Ahlborn <jtahlborn@yahoo.com>2011-03-23 03:19:45 +0000
committerJames Ahlborn <jtahlborn@yahoo.com>2011-03-23 03:19:45 +0000
commit4423e6d4430f7761a5c1dc46f8a11ee7059e7087 (patch)
tree910d9f786589ca5ec1a307035a41c481123d4a72 /test
parent78f474c59414fcbac91ddf4ac81a203a1df34701 (diff)
downloadjackcess-4423e6d4430f7761a5c1dc46f8a11ee7059e7087.tar.gz
jackcess-4423e6d4430f7761a5c1dc46f8a11ee7059e7087.zip
fix usage map promotion test
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@537 f203690c-595d-4dc9-a70b-905162fa7fd2
Diffstat (limited to 'test')
-rw-r--r--test/data/V2000/testPromotionV2000.mdbbin167936 -> 208896 bytes
-rw-r--r--test/data/V2003/testPromotionV2003.mdbbin221184 -> 212992 bytes
-rw-r--r--test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java49
-rw-r--r--test/src/java/com/healthmarketscience/jackcess/IndexCodesTest.java4
4 files changed, 31 insertions, 22 deletions
diff --git a/test/data/V2000/testPromotionV2000.mdb b/test/data/V2000/testPromotionV2000.mdb
index 901c520..b43b570 100644
--- a/test/data/V2000/testPromotionV2000.mdb
+++ b/test/data/V2000/testPromotionV2000.mdb
Binary files differ
diff --git a/test/data/V2003/testPromotionV2003.mdb b/test/data/V2003/testPromotionV2003.mdb
index 982de4b..16dee62 100644
--- a/test/data/V2003/testPromotionV2003.mdb
+++ b/test/data/V2003/testPromotionV2003.mdb
Binary files differ
diff --git a/test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java b/test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java
index 1359d4b..367d669 100644
--- a/test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java
+++ b/test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java
@@ -74,7 +74,8 @@ public class DatabaseTest extends TestCase {
throws Exception
{
final Database db = Database.open(file, true, _autoSync);
- assertEquals("Wrong JetFormat.", fileFormat.getJetFormat(), db.getFormat());
+ assertEquals("Wrong JetFormat.", fileFormat.getJetFormat(),
+ db.getFormat());
assertEquals("Wrong FileFormat.", fileFormat, db.getFileFormat());
return db;
}
@@ -101,21 +102,26 @@ public class DatabaseTest extends TestCase {
public static Database openCopy(TestDB testDB, boolean keep)
throws Exception
{
- return openCopy(testDB.getFile(), keep);
+ return openCopy(testDB.getExpectedFileFormat(), testDB.getFile(), keep);
}
- public static Database openCopy(File file)
+ public static Database openCopy(FileFormat fileFormat, File file)
throws Exception
{
- return openCopy(file, false);
+ return openCopy(fileFormat, file, false);
}
- public static Database openCopy(File file, boolean keep)
+ public static Database openCopy(FileFormat fileFormat, File file,
+ boolean keep)
throws Exception
{
File tmp = createTempFile(keep);
copyFile(file, tmp);
- return Database.open(tmp, false, _autoSync);
+ Database db = Database.open(tmp, false, _autoSync);
+ assertEquals("Wrong JetFormat.", fileFormat.getJetFormat(),
+ db.getFormat());
+ assertEquals("Wrong FileFormat.", fileFormat, db.getFileFormat());
+ return db;
}
@@ -796,21 +802,13 @@ public class DatabaseTest extends TestCase {
Database db = openCopy(testDB);
Table t = db.getTable("jobDB1");
- String lval = createString(255); // "--255 chars long text--";
+ assertTrue(t.getOwnedPagesCursor().getUsageMap().toString()
+ .startsWith("(InlineHandler)"));
- if (FileFormat.V2007.equals(testDB.getExpectedFileFormat())) {
- // @todo Field order differs with V2007
- System.err.println("\n*** TODO: " + getName()
- + "(): Is OK that " + testDB.getExpectedFileFormat().name() + " field order differs? ***");
- }
+ String lval = createNonAsciiString(255); // "--255 chars long text--";
for(int i = 0; i < 1000; ++i) {
- if (FileFormat.V2007.equals(testDB.getExpectedFileFormat())) {
- // @todo Field order differs with V2007
- t.addRow(i, 13, 57, lval, lval, lval, lval, lval, lval, 47.0d);
- } else {
- t.addRow(i, 13, 57, 47.0d, lval, lval, lval, lval, lval, lval);
- }
+ t.addRow(i, 13, 57, lval, lval, lval, lval, lval, lval, 47.0d);
}
Set<Integer> ids = new HashSet<Integer>();
@@ -819,6 +817,9 @@ public class DatabaseTest extends TestCase {
}
assertEquals(1000, ids.size());
+ assertTrue(t.getOwnedPagesCursor().getUsageMap().toString()
+ .startsWith("(ReferenceHandler)"));
+
db.close();
}
}
@@ -1152,11 +1153,19 @@ public class DatabaseTest extends TestCase {
.addColumn(new ColumnBuilder("I", DataType.SHORT_DATE_TIME))
.toTable(db);
}
-
+
static String createString(int len) {
+ return createString(len, 'a');
+ }
+
+ static String createNonAsciiString(int len) {
+ return createString(len, '\u00C0');
+ }
+
+ private static String createString(int len, char firstChar) {
StringBuilder builder = new StringBuilder(len);
for(int i = 0; i < len; ++i) {
- builder.append((char)('a' + (i % 26)));
+ builder.append((char)(firstChar + (i % 26)));
}
return builder.toString();
}
diff --git a/test/src/java/com/healthmarketscience/jackcess/IndexCodesTest.java b/test/src/java/com/healthmarketscience/jackcess/IndexCodesTest.java
index cff03d7..6c7d220 100644
--- a/test/src/java/com/healthmarketscience/jackcess/IndexCodesTest.java
+++ b/test/src/java/com/healthmarketscience/jackcess/IndexCodesTest.java
@@ -160,7 +160,7 @@ public class IndexCodesTest extends TestCase {
public void x_testCreateAltIsoFile() throws Exception
{
- Database db = openCopy(new File("/tmp/test_ind.mdb"), true);
+ Database db = openCopy(Database.FileFormat.V2000, new File("/tmp/test_ind.mdb"), true);
Table t = db.getTable("Table1");
@@ -238,7 +238,7 @@ public class IndexCodesTest extends TestCase {
// Database db = openCopy(new File("/data2/jackcess_test/testAllIndexCodes.mdb"));
// Database db = openCopy(new File("/data2/jackcess_test/testAllIndexCodes_orig.mdb"));
// Database db = openCopy(new File("/data2/jackcess_test/testSomeMoreCodes.mdb"));
- Database db = openCopy(new File("/data2/jackcess_test/testStillMoreCodes.mdb"));
+ Database db = openCopy(Database.FileFormat.V2000, new File("/data2/jackcess_test/testStillMoreCodes.mdb"));
Table t = db.getTable("Table5");
Index ind = t.getIndexes().iterator().next();