Browse Source

use inmem dbs to speed up slow unit tests

git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@937 f203690c-595d-4dc9-a70b-905162fa7fd2
tags/jackcess-2.1.1
James Ahlborn 9 years ago
parent
commit
4920d75eee

+ 1
- 1
pom.xml View File

<configuration> <configuration>
<forkMode>once</forkMode> <forkMode>once</forkMode>
<parallel>classes</parallel> <parallel>classes</parallel>
<threadCount>1</threadCount>
<threadCount>2</threadCount>
<argLine>-Xmx256M</argLine> <argLine>-Xmx256M</argLine>
<systemProperties> <systemProperties>
<property> <property>

+ 4
- 4
src/test/java/com/healthmarketscience/jackcess/CursorTest.java View File

private static Database createTestTable(final FileFormat fileFormat) private static Database createTestTable(final FileFormat fileFormat)
throws Exception throws Exception
{ {
Database db = create(fileFormat);
Database db = createMem(fileFormat);


Table table = new TableBuilder("test") Table table = new TableBuilder("test")
.addColumn(new ColumnBuilder("id", DataType.LONG)) .addColumn(new ColumnBuilder("id", DataType.LONG))
private static Database createDupeTestTable(final FileFormat fileFormat) private static Database createDupeTestTable(final FileFormat fileFormat)
throws Exception throws Exception
{ {
Database db = create(fileFormat);
Database db = createMem(fileFormat);


Table table = new TableBuilder("test") Table table = new TableBuilder("test")
.addColumn(new ColumnBuilder("id", DataType.LONG)) .addColumn(new ColumnBuilder("id", DataType.LONG))
{ {
for (final TestDB testDB : TestDB.getSupportedForBasename(Basename.INDEX)) { for (final TestDB testDB : TestDB.getSupportedForBasename(Basename.INDEX)) {


Database db = open(testDB);
Database db = openMem(testDB);
Table t1 = db.getTable("Table1"); Table t1 = db.getTable("Table1");
Index idx = t1.getIndex(IndexBuilder.PRIMARY_KEY_NAME); Index idx = t1.getIndex(IndexBuilder.PRIMARY_KEY_NAME);
IndexCursor cursor = CursorBuilder.createCursor(idx); IndexCursor cursor = CursorBuilder.createCursor(idx);
public void testIterationEarlyExit() throws Exception { public void testIterationEarlyExit() throws Exception {
for (final FileFormat fileFormat : JetFormatTest.SUPPORTED_FILEFORMATS) { for (final FileFormat fileFormat : JetFormatTest.SUPPORTED_FILEFORMATS) {


Database db = create(fileFormat);
Database db = createMem(fileFormat);


Table table = new TableBuilder("test") Table table = new TableBuilder("test")
.addColumn(new ColumnBuilder("id", DataType.LONG)) .addColumn(new ColumnBuilder("id", DataType.LONG))

+ 3
- 3
src/test/java/com/healthmarketscience/jackcess/DatabaseTest.java View File



public void testWriteAndReadInBatch() throws Exception { public void testWriteAndReadInBatch() throws Exception {
for (final FileFormat fileFormat : SUPPORTED_FILEFORMATS) { for (final FileFormat fileFormat : SUPPORTED_FILEFORMATS) {
Database db = create(fileFormat);
Database db = createMem(fileFormat);
createTestTable(db); createTestTable(db);
int count = 1000; int count = 1000;
List<Object[]> rows = new ArrayList<Object[]>(count); List<Object[]> rows = new ArrayList<Object[]>(count);
public void testUpdateRow() throws Exception public void testUpdateRow() throws Exception
{ {
for (final FileFormat fileFormat : SUPPORTED_FILEFORMATS) { for (final FileFormat fileFormat : SUPPORTED_FILEFORMATS) {
Database db = create(fileFormat);
Database db = createMem(fileFormat);


Table t = new TableBuilder("test") Table t = new TableBuilder("test")
.addColumn(new ColumnBuilder("name", DataType.TEXT)) .addColumn(new ColumnBuilder("name", DataType.TEXT))
public void testUnicodeCompression() throws Exception public void testUnicodeCompression() throws Exception
{ {
File dbFile = new File("src/test/data/V2003/testUnicodeCompV2003.mdb"); File dbFile = new File("src/test/data/V2003/testUnicodeCompV2003.mdb");
Database db = open(Database.FileFormat.V2003, new File("src/test/data/V2003/testUnicodeCompV2003.mdb"));
Database db = open(Database.FileFormat.V2003, new File("src/test/data/V2003/testUnicodeCompV2003.mdb"), true);


StringBuilder sb = new StringBuilder(127); StringBuilder sb = new StringBuilder(127);
for(int i = 1; i <= 0xFF; ++i) { for(int i = 1; i <= 0xFF; ++i) {

Loading…
Cancel
Save