summaryrefslogtreecommitdiffstats
path: root/test/src/java
diff options
context:
space:
mode:
authorJames Ahlborn <jtahlborn@yahoo.com>2008-03-13 03:28:03 +0000
committerJames Ahlborn <jtahlborn@yahoo.com>2008-03-13 03:28:03 +0000
commitd4113e1b68d70f20ab1ef56669d28554213e5e22 (patch)
tree5e5473d8a8c6ee4a9b97eac793840ee164c1d6f9 /test/src/java
parent340c3dc831ebc40e6ddd6eab089f72ffadd9e3da (diff)
downloadjackcess-d4113e1b68d70f20ab1ef56669d28554213e5e22.tar.gz
jackcess-d4113e1b68d70f20ab1ef56669d28554213e5e22.zip
use readOnly dbs for unit tests
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@268 f203690c-595d-4dc9-a70b-905162fa7fd2
Diffstat (limited to 'test/src/java')
-rw-r--r--test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java16
-rw-r--r--test/src/java/com/healthmarketscience/jackcess/IndexCodesTest.java20
-rw-r--r--test/src/java/com/healthmarketscience/jackcess/IndexTest.java4
3 files changed, 22 insertions, 18 deletions
diff --git a/test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java b/test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java
index faf1d07..d77f54a 100644
--- a/test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java
+++ b/test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java
@@ -64,7 +64,11 @@ public class DatabaseTest extends TestCase {
}
static Database open() throws Exception {
- return Database.open(new File("test/data/test.mdb"));
+ return open(new File("test/data/test.mdb"));
+ }
+
+ static Database open(File file) throws Exception {
+ return Database.open(file, true, Database.DEFAULT_AUTO_SYNC);
}
static Database create() throws Exception {
@@ -143,7 +147,7 @@ public class DatabaseTest extends TestCase {
}
public void testReadDeletedRows() throws Exception {
- Table table = Database.open(new File("test/data/delTest.mdb")).getTable("Table");
+ Table table = open(new File("test/data/delTest.mdb")).getTable("Table");
int rows = 0;
while (table.getNextRow() != null) {
rows++;
@@ -332,7 +336,7 @@ public class DatabaseTest extends TestCase {
public void testReadLongValue() throws Exception {
- Database db = Database.open(new File("test/data/test2.mdb"));
+ Database db = open(new File("test/data/test2.mdb"));
Table table = db.getTable("MSP_PROJECTS");
Map<String, Object> row = table.getNextRow();
assertEquals("Jon Iles this is a a vawesrasoih aksdkl fas dlkjflkasjd flkjaslkdjflkajlksj dfl lkasjdf lkjaskldfj lkas dlk lkjsjdfkl; aslkdf lkasjkldjf lka skldf lka sdkjfl;kasjd falksjdfljaslkdjf laskjdfk jalskjd flkj aslkdjflkjkjasljdflkjas jf;lkasjd fjkas dasdf asd fasdf asdf asdmhf lksaiyudfoi jasodfj902384jsdf9 aw90se fisajldkfj lkasj dlkfslkd jflksjadf as", row.get("PROJ_PROP_AUTHOR"));
@@ -398,7 +402,7 @@ public class DatabaseTest extends TestCase {
File bogusFile = new File("fooby-dooby.mdb");
assertTrue(!bogusFile.exists());
try {
- Database db = Database.open(bogusFile);
+ Database db = open(bogusFile);
fail("FileNotFoundException should have been thrown");
} catch(FileNotFoundException e) {
}
@@ -406,7 +410,7 @@ public class DatabaseTest extends TestCase {
}
public void testReadWithDeletedCols() throws Exception {
- Table table = Database.open(new File("test/data/delColTest.mdb")).getTable("Table1");
+ Table table = open(new File("test/data/delColTest.mdb")).getTable("Table1");
Map<String, Object> expectedRow0 = new LinkedHashMap<String, Object>();
expectedRow0.put("id", 0);
@@ -624,7 +628,7 @@ public class DatabaseTest extends TestCase {
public void testOverflow() throws Exception
{
- Database mdb = Database.open(new File("test/data/overflowTest.mdb"));
+ Database mdb = open(new File("test/data/overflowTest.mdb"));
Table table = mdb.getTable("Table1");
// 7 rows, 3 and 5 are overflow
diff --git a/test/src/java/com/healthmarketscience/jackcess/IndexCodesTest.java b/test/src/java/com/healthmarketscience/jackcess/IndexCodesTest.java
index c057656..f54109e 100644
--- a/test/src/java/com/healthmarketscience/jackcess/IndexCodesTest.java
+++ b/test/src/java/com/healthmarketscience/jackcess/IndexCodesTest.java
@@ -67,7 +67,7 @@ public class IndexCodesTest extends TestCase {
public void testIndexCodes() throws Exception
{
- Database db = Database.open(new File("test/data/testIndexCodes.mdb"));
+ Database db = open(new File("test/data/testIndexCodes.mdb"));
for(Table t : db) {
for(Index index : t.getIndexes()) {
@@ -182,10 +182,10 @@ public class IndexCodesTest extends TestCase {
public void x_testReadIsoMdb() throws Exception
{
-// Database db = Database.open(new File("/tmp/test_ind.mdb"));
-// Database db = Database.open(new File("/tmp/test_ind2.mdb"));
- Database db = Database.open(new File("/tmp/test_ind3.mdb"));
-// Database db = Database.open(new File("/tmp/test_ind4.mdb"));
+// Database db = open(new File("/tmp/test_ind.mdb"));
+// Database db = open(new File("/tmp/test_ind2.mdb"));
+ Database db = open(new File("/tmp/test_ind3.mdb"));
+// Database db = open(new File("/tmp/test_ind4.mdb"));
Table t = db.getTable("Table1");
Index index = t.getIndex("B");
@@ -204,11 +204,11 @@ public class IndexCodesTest extends TestCase {
public void x_testReverseIsoMdb() throws Exception
{
-// Database db = Database.open(new File("/tmp/test_ind.mdb"));
- Database db = Database.open(new File("/tmp/test_ind2.mdb"));
-// Database db = Database.open(new File("/tmp/databaseTest14366_ind.mdb"));
-// Database db = Database.open(new File("/tmp/databaseTest56165_ind.mdb"));
-// Database db = Database.open(new File("/tmp/databaseTest53970_ind.mdb"));
+// Database db = open(new File("/tmp/test_ind.mdb"));
+ Database db = open(new File("/tmp/test_ind2.mdb"));
+// Database db = open(new File("/tmp/databaseTest14366_ind.mdb"));
+// Database db = open(new File("/tmp/databaseTest56165_ind.mdb"));
+// Database db = open(new File("/tmp/databaseTest53970_ind.mdb"));
Table t = db.getTable("Table1");
Index index = t.getIndex("B");
diff --git a/test/src/java/com/healthmarketscience/jackcess/IndexTest.java b/test/src/java/com/healthmarketscience/jackcess/IndexTest.java
index bb3b7f1..4b21af3 100644
--- a/test/src/java/com/healthmarketscience/jackcess/IndexTest.java
+++ b/test/src/java/com/healthmarketscience/jackcess/IndexTest.java
@@ -102,7 +102,7 @@ public class IndexTest extends TestCase {
public void testIndexSlots() throws Exception
{
- Database mdb = Database.open(new File("test/data/indexTest.mdb"));
+ Database mdb = open(new File("test/data/indexTest.mdb"));
Table table = mdb.getTable("Table1");
for(Index idx : table.getIndexes()) {
@@ -141,7 +141,7 @@ public class IndexTest extends TestCase {
{
// this file has an index with "compressed" entries and node pages
File origFile = new File("test/data/compIndexTest.mdb");
- Database db = Database.open(origFile);
+ Database db = open(origFile);
Table t = db.getTable("Table1");
Index index = t.getIndexes().get(0);
assertFalse(index.isInitialized());