Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

enhance integration test.

  • Loading branch information...
commit 5b5d5fc89a4bb9ba3f63363ec80351fa4dec899c 1 parent 20b7d8b
@rnewson authored
View
13 src/test/java/com/github/rnewson/couchdb/lucene/IntegrationTest.java
@@ -5,12 +5,10 @@
import static org.junit.Assert.assertThat;
import static org.junit.Assume.assumeTrue;
-import java.io.File;
import java.io.IOException;
import net.sf.json.JSONObject;
-import org.apache.commons.io.FileUtils;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -30,9 +28,6 @@
@Before
public void setup() throws IOException, InterruptedException {
- final File dir = new File("target/output");
- FileUtils.cleanDirectory(dir);
- System.setProperty("couchdb.lucene.dir", dir.getAbsolutePath());
db = new Database(base);
try {
db.deleteDatabase(dbname);
@@ -44,7 +39,7 @@ public void setup() throws IOException, InterruptedException {
@After
public void teardown() throws IOException {
- // db.deleteDatabase(dbname);
+ db.deleteDatabase(dbname);
}
@Test
@@ -54,10 +49,14 @@ public void index() throws IOException, InterruptedException {
for (int i = 0; i < 50; i++) {
assertThat(db.saveDocument(dbname, "doc-" + i, "{\"content\":\"hello\"}"), is(true));
}
- SECONDS.sleep(5);
+
+ SECONDS.sleep(6);
final JSONObject indexState = db.getDoc(dbname, "_fti");
assertThat(indexState.getInt("doc_count"), is(51));
+
+ final JSONObject queryResult = db.getDoc(dbname, "/_fti/lucene/idx?q=hello");
+ assertThat(queryResult.getInt("total_rows"), is(50));
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.