diff options
author | James Ahlborn <jtahlborn@yahoo.com> | 2007-07-10 21:48:33 +0000 |
---|---|---|
committer | James Ahlborn <jtahlborn@yahoo.com> | 2007-07-10 21:48:33 +0000 |
commit | a05f660f7b0d93d8e4e739686cec112650ca84d2 (patch) | |
tree | 1e2ee13f5f04b14384a5a0921dc2e3a467c81f6a /test | |
parent | a97ce25f570f8867e93ff2e244b9dc5a8fe4b2bc (diff) | |
download | jackcess-a05f660f7b0d93d8e4e739686cec112650ca84d2.tar.gz jackcess-a05f660f7b0d93d8e4e739686cec112650ca84d2.zip |
add flush method to Database; add unit test for new usage map functionality
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@157 f203690c-595d-4dc9-a70b-905162fa7fd2
Diffstat (limited to 'test')
-rw-r--r-- | test/data/testPromotion.mdb | bin | 0 -> 167936 bytes | |||
-rw-r--r-- | test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java | 27 |
2 files changed, 27 insertions, 0 deletions
diff --git a/test/data/testPromotion.mdb b/test/data/testPromotion.mdb Binary files differnew file mode 100644 index 0000000..901c520 --- /dev/null +++ b/test/data/testPromotion.mdb diff --git a/test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java b/test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java index 7524133..5083577 100644 --- a/test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java +++ b/test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java @@ -19,8 +19,10 @@ import java.util.Calendar; import java.util.Collections; import java.util.Date; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; import junit.framework.TestCase; @@ -636,6 +638,31 @@ public class DatabaseTest extends TestCase { assertEquals(tval, readRow.get("c")); } + + + public void testUsageMapPromotion() throws Exception { + File srcFile = new File("test/data/testPromotion.mdb"); + File dbFile = File.createTempFile("databaseTest", ".mdb"); + dbFile.deleteOnExit(); + copyFile(srcFile, dbFile); + + Database db = Database.open(dbFile); + Table t = db.getTable("jobDB1"); + + String lval = createString(255); // "--255 chars long text--"; + + for(int i = 0; i < 1000; ++i) { + t.addRow(i, 13, 57, 47.0d, lval, lval, lval, lval, lval, lval); + } + + Set<Integer> ids = new HashSet<Integer>(); + for(Map<String,Object> row : t) { + ids.add((Integer)row.get("ID")); + } + assertEquals(1000, ids.size()); + + db.close(); + } static Object[] createTestRow(String col1Val) { return new Object[] {col1Val, "R", "McCune", 1234, (byte) 0xad, 555.66d, |