diff options
author | James Ahlborn <jtahlborn@yahoo.com> | 2010-05-27 12:27:19 +0000 |
---|---|---|
committer | James Ahlborn <jtahlborn@yahoo.com> | 2010-05-27 12:27:19 +0000 |
commit | aa1c9c85833e617e2fa458fbb622be51747de55c (patch) | |
tree | 3baa10d26e62b675cfdcd4a14b541b5f0f5a4d29 /test | |
parent | 1b59ad9bfc0da2d68dd5ba295456810a55b27b9f (diff) | |
download | jackcess-aa1c9c85833e617e2fa458fbb622be51747de55c.tar.gz jackcess-aa1c9c85833e617e2fa458fbb622be51747de55c.zip |
better test format handling
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@470 f203690c-595d-4dc9-a70b-905162fa7fd2
Diffstat (limited to 'test')
-rw-r--r-- | test/src/java/com/healthmarketscience/jackcess/JetFormatTest.java | 46 |
1 files changed, 27 insertions, 19 deletions
diff --git a/test/src/java/com/healthmarketscience/jackcess/JetFormatTest.java b/test/src/java/com/healthmarketscience/jackcess/JetFormatTest.java index d2e3267..44c5544 100644 --- a/test/src/java/com/healthmarketscience/jackcess/JetFormatTest.java +++ b/test/src/java/com/healthmarketscience/jackcess/JetFormatTest.java @@ -4,6 +4,7 @@ import java.io.File; import java.io.IOException; import java.nio.channels.FileChannel; import java.util.ArrayList; +import java.util.Arrays; import java.util.EnumSet; import java.util.List; import java.util.Set; @@ -53,13 +54,32 @@ public class JetFormatTest extends TestCase { public String toString() { return _basename; } } - /** Defines currently supported db file formats. */ - final static FileFormat[] SUPPORTED_FILEFORMATS = - new FileFormat[] { - FileFormat.V2000, - FileFormat.V2003, - FileFormat.V2007, - }; + /** Defines currently supported db file formats. (can be modified at + runtime via the system property + "com.healthmarketscience.jackcess.testFormats") */ + final static FileFormat[] SUPPORTED_FILEFORMATS; + + static { + String testFormatStr = System.getProperty("com.healthmarketscience.jackcess.testFormats"); + Set<FileFormat> testFormats = EnumSet.allOf(FileFormat.class); + if((testFormatStr != null) && (testFormatStr.length() > 0)) { + testFormats.clear(); + for(String tmp : testFormatStr.split(",")) { + testFormats.add(FileFormat.valueOf(tmp.toUpperCase())); + } + } + + List<FileFormat> supported = new ArrayList<FileFormat>(); + for(FileFormat ff : Arrays.asList(FileFormat.V2000, FileFormat.V2003, + FileFormat.V2007)) { + if(!testFormats.contains(ff)) { + continue; + } + supported.add(ff); + } + + SUPPORTED_FILEFORMATS = supported.toArray(new FileFormat[0]); + } /** * Defines known valid test database files, and their jet format version. @@ -94,20 +114,8 @@ 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 (FileFormat fileFormat : SUPPORTED_FILEFORMATS) { - if(!testFormats.contains(fileFormat)) { - continue; - } supportedTestDBs.add(new TestDB( getFileForBasename(basename, fileFormat), fileFormat)); |