diff options
author | James Ahlborn <jtahlborn@yahoo.com> | 2014-08-18 02:30:15 +0000 |
---|---|---|
committer | James Ahlborn <jtahlborn@yahoo.com> | 2014-08-18 02:30:15 +0000 |
commit | 31ade435667bb1073ff28acb9b55eb98910832d5 (patch) | |
tree | 88087d246f45c259ec63cded827ac3029686d364 /src/test/java/com | |
parent | 111f269f83ccb6c06c5c76ca03a365902d5c5fe7 (diff) | |
download | jackcess-31ade435667bb1073ff28acb9b55eb98910832d5.tar.gz jackcess-31ade435667bb1073ff28acb9b55eb98910832d5.zip |
speed up unit tests by delaying disk syncs
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@866 f203690c-595d-4dc9-a70b-905162fa7fd2
Diffstat (limited to 'src/test/java/com')
-rw-r--r-- | src/test/java/com/healthmarketscience/jackcess/DatabaseTest.java | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/src/test/java/com/healthmarketscience/jackcess/DatabaseTest.java b/src/test/java/com/healthmarketscience/jackcess/DatabaseTest.java index ab80183..3a45f39 100644 --- a/src/test/java/com/healthmarketscience/jackcess/DatabaseTest.java +++ b/src/test/java/com/healthmarketscience/jackcess/DatabaseTest.java @@ -364,8 +364,13 @@ public class DatabaseTest extends TestCase row[3] = null; Table table = db.getTable("Test"); int count = 1000; - for (int i = 0; i < count; i++) { - table.addRow(row); + ((DatabaseImpl)db).getPageChannel().startWrite(); + try { + for (int i = 0; i < count; i++) { + table.addRow(row); + } + } finally { + ((DatabaseImpl)db).getPageChannel().finishWrite(); } for (int i = 0; i < count; i++) { Map<String, Object> readRow = table.getNextRow(); @@ -932,8 +937,13 @@ public class DatabaseTest extends TestCase String lval = createNonAsciiString(255); // "--255 chars long text--"; - for(int i = 0; i < 1000; ++i) { - t.addRow(i, 13, 57, lval, lval, lval, lval, lval, lval, 47.0d); + ((DatabaseImpl)db).getPageChannel().startWrite(); + try { + for(int i = 0; i < 1000; ++i) { + t.addRow(i, 13, 57, lval, lval, lval, lval, lval, lval, 47.0d); + } + } finally { + ((DatabaseImpl)db).getPageChannel().finishWrite(); } Set<Integer> ids = new HashSet<Integer>(); @@ -1098,8 +1108,13 @@ public class DatabaseTest extends TestCase } } - for(Date d : dates) { - table.addRow("row " + d, d); + ((DatabaseImpl)db).getPageChannel().startWrite(); + try { + for(Date d : dates) { + table.addRow("row " + d, d); + } + } finally { + ((DatabaseImpl)db).getPageChannel().finishWrite(); } List<Date> foundDates = new ArrayList<Date>(); |