diff options
-rw-r--r-- | pom.xml | 8 | ||||
-rw-r--r-- | test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java | 10 | ||||
-rw-r--r-- | test/src/java/com/healthmarketscience/jackcess/JetFormatTest.java | 36 |
3 files changed, 41 insertions, 13 deletions
@@ -82,6 +82,10 @@ <name>com.healthmarketscience.jackcess.bigIndex</name> <value>${jackcess.bigIndex}</value> </property> + <property> + <name>com.healthmarketscience.jackcess.testFormats</name> + <value>${jackcess.testFormats}</value> + </property> </systemProperties> </configuration> </plugin> @@ -182,4 +186,8 @@ <url>scp://shell.sourceforge.net/home/groups/j/ja/jackcess/htdocs</url> </site> </distributionManagement> + <properties> + <jackcess.bigIndex>true</jackcess.bigIndex> + <jackcess.testFormats>V2000,V2003,V2007</jackcess.testFormats> + </properties> </project> diff --git a/test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java b/test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java index c8de012..7052e41 100644 --- a/test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java +++ b/test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java @@ -70,7 +70,9 @@ public class DatabaseTest extends TestCase { super(name); } - public static Database open(Database.FileFormat fileFormat, File file) throws Exception { + public static Database open(FileFormat fileFormat, File file) + throws Exception + { final Database db = Database.open(file, true, _autoSync); assertEquals("Wrong JetFormat.", fileFormat.getJetFormat(), db.getFormat()); assertEquals("Wrong FileFormat.", fileFormat, db.getFileFormat()); @@ -81,11 +83,13 @@ public class DatabaseTest extends TestCase { return open(testDB.getExpectedFileFormat(), testDB.getFile()); } - public static Database create(Database.FileFormat fileFormat) throws Exception { + public static Database create(FileFormat fileFormat) throws Exception { return create(fileFormat, false); } - public static Database create(Database.FileFormat fileFormat, boolean keep) throws Exception { + public static Database create(FileFormat fileFormat, boolean keep) + throws Exception + { return Database.create(fileFormat, createTempFile(keep), _autoSync); } diff --git a/test/src/java/com/healthmarketscience/jackcess/JetFormatTest.java b/test/src/java/com/healthmarketscience/jackcess/JetFormatTest.java index d386af6..d2e3267 100644 --- a/test/src/java/com/healthmarketscience/jackcess/JetFormatTest.java +++ b/test/src/java/com/healthmarketscience/jackcess/JetFormatTest.java @@ -4,10 +4,14 @@ import java.io.File; import java.io.IOException; import java.nio.channels.FileChannel; import java.util.ArrayList; +import java.util.EnumSet; import java.util.List; +import java.util.Set; import junit.framework.TestCase; +import static com.healthmarketscience.jackcess.Database.*; + /** * @author Dan Rollo * Date: Mar 5, 2010 @@ -50,11 +54,11 @@ public class JetFormatTest extends TestCase { } /** Defines currently supported db file formats. */ - final static Database.FileFormat[] SUPPORTED_FILEFORMATS = - new Database.FileFormat[] { - Database.FileFormat.V2000, - Database.FileFormat.V2003, - Database.FileFormat.V2007, + final static FileFormat[] SUPPORTED_FILEFORMATS = + new FileFormat[] { + FileFormat.V2000, + FileFormat.V2003, + FileFormat.V2007, }; /** @@ -63,10 +67,10 @@ public class JetFormatTest extends TestCase { public static final class TestDB { private final File dbFile; - private final Database.FileFormat expectedFileFormat; + private final FileFormat expectedFileFormat; private TestDB(File databaseFile, - Database.FileFormat expectedDBFileFormat) { + FileFormat expectedDBFileFormat) { dbFile = databaseFile; expectedFileFormat = expectedDBFileFormat; @@ -74,7 +78,7 @@ public class JetFormatTest extends TestCase { public final File getFile() { return dbFile; } - public final Database.FileFormat getExpectedFileFormat() { + public final FileFormat getExpectedFileFormat() { return expectedFileFormat; } @@ -90,8 +94,20 @@ public class JetFormatTest extends TestCase { public static List<TestDB> getSupportedForBasename(Basename basename) { + String testFormatStr = System.getProperty("com.healthmarketscience.jackcess.testFormats"); + Set<FileFormat> testFormats = EnumSet.allOf(FileFormat.class); + if((testFormatStr != null) && (testFormatStr.length() > 0)) { + testFormats = EnumSet.noneOf(FileFormat.class); + for(String tmp : testFormatStr.split(",")) { + testFormats.add(FileFormat.valueOf(tmp.toUpperCase())); + } + } + List<TestDB> supportedTestDBs = new ArrayList<TestDB>(); - for (Database.FileFormat fileFormat : SUPPORTED_FILEFORMATS) { + for (FileFormat fileFormat : SUPPORTED_FILEFORMATS) { + if(!testFormats.contains(fileFormat)) { + continue; + } supportedTestDBs.add(new TestDB( getFileForBasename(basename, fileFormat), fileFormat)); @@ -100,7 +116,7 @@ public class JetFormatTest extends TestCase { } private static File getFileForBasename( - Basename basename, Database.FileFormat fileFormat) { + Basename basename, FileFormat fileFormat) { return new File(DIR_TEST_DATA, fileFormat.name() + File.separator + |