summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDon Anderson <dda@mongodb.com>2016-09-27 21:40:52 -0400
committerAlex Gorrod <alexander.gorrod@mongodb.com>2016-09-28 11:40:52 +1000
commit45dbcfffed52f8d3615b9b2a28878d9ef89afb99 (patch)
tree4d7b9149a41c5e9362f6dbe8fab7a51084bc16ea
parent14339bb76144a3ceeff8bd51e3b8062b7c7bc33d (diff)
downloadmongo-45dbcfffed52f8d3615b9b2a28878d9ef89afb99.tar.gz
WT-2907 Fixed java concurrent close test to have both insert threads and scan threads. (#3066)
-rw-r--r--test/java/com/wiredtiger/test/ConcurrentCloseTest.java21
1 files changed, 11 insertions, 10 deletions
diff --git a/test/java/com/wiredtiger/test/ConcurrentCloseTest.java b/test/java/com/wiredtiger/test/ConcurrentCloseTest.java
index fece0353bf0..fead0b0bf38 100644
--- a/test/java/com/wiredtiger/test/ConcurrentCloseTest.java
+++ b/test/java/com/wiredtiger/test/ConcurrentCloseTest.java
@@ -34,6 +34,7 @@ import com.wiredtiger.db.WiredTigerException;
import com.wiredtiger.db.wiredtiger;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
import java.io.BufferedReader;
import java.io.File;
@@ -69,7 +70,7 @@ class InsertThread extends Thread {
Session session = conn.open_session(null);
Cursor cursor = session.open_cursor("table:cclose", null,
"overwrite");
- cursor.putKeyString("key"+threadId + "-" + i);
+ cursor.putKeyString("key" + threadId + "-" + i);
cursor.putValueString("value1");
ret = cursor.insert();
cursor.close();
@@ -127,36 +128,36 @@ public class ConcurrentCloseTest {
setup();
try {
List<Thread> threads = new ArrayList<Thread>();
- int i, ret;
+ int i;
- ret = session.create("table:cclose", "key_format=S,value_format=S");
+ assertEquals(0, session.create("table:cclose",
+ "key_format=S,value_format=S"));
Cursor cursor = session.open_cursor("table:cclose", null,
"overwrite");
cursor.putKeyString("key1");
cursor.putValueString("value1");
- ret = cursor.insert();
+ assertEquals(0, cursor.insert());
cursor.close();
- ret = session.close(null);
+ assertEquals(0, session.close(null));
for (i = 0; i < NUM_THREADS; i++) {
Thread insertThread = new InsertThread(conn, i);
- Thread scanThread = new InsertThread(conn, i);
+ Thread scanThread = new ScanThread(conn);
insertThread.start();
scanThread.start();
threads.add(insertThread);
threads.add(scanThread);
}
-
for (Thread thread : threads)
try {
thread.join();
- ret = -1;
}
catch (InterruptedException ie) {
+ fail();
}
- ret = conn.close(null);
- System.exit(ret);
+ assertEquals(0, conn.close(null));
+ System.exit(0);
}
catch (WiredTigerException wte) {
System.err.println("Exception: " + wte);