Skip to content

Commit

Permalink
Reapplying previous fixes and changes that were lost in upgrade to ve…
Browse files Browse the repository at this point in the history
…rsion 2.1.0
  • Loading branch information
dstl-admin committed Dec 11, 2015
1 parent 0a9e026 commit b572e88
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.apache.uima.jcas.tcas.DocumentAnnotation;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import uk.gov.dstl.baleen.uima.BaleenCollectionReader;
Expand All @@ -31,7 +32,20 @@ public class FolderReaderTest {
private static final String DIR = "baleen-test";
File inputDir;
JCas jCas;


private static Long TIMEOUT = 1000L;

@BeforeClass
public static void beforeClass(){
//If we're testing on a Mac, then we need to set the time out higher,
//as currently the WatchService on a Mac uses polling rather than a
//native implementation and therefore we need to ensure we wait longer
//than the poll interval
if(System.getProperty("os.name").toLowerCase().startsWith("mac os x")){
TIMEOUT = 15000L;
}
}

@Before
public void beforeTest() throws Exception{
inputDir = Files.createTempDirectory(DIR).toFile();
Expand Down Expand Up @@ -75,7 +89,7 @@ public void testCreateFile() throws Exception{
f.createNewFile();

//Wait for file to be written and change detected
Thread.sleep(1000);
Thread.sleep(TIMEOUT);

assertTrue(bcr.doHasNext());

Expand Down Expand Up @@ -106,7 +120,7 @@ public void testMultipleDirectories() throws Exception{
File f22 = new File(inputDir2, TEST2_FILE);
f22.createNewFile();

Thread.sleep(1000);
Thread.sleep(TIMEOUT);

assertNextSourceNotNull(bcr);
assertNextSourceNotNull(bcr);
Expand All @@ -133,7 +147,7 @@ public void testSubDirectories() throws Exception{
File f2 = new File(subdir, TEST2_FILE);
f2.createNewFile();

Thread.sleep(1000);
Thread.sleep(TIMEOUT);

assertNextSourceNotNull(bcr);

Expand Down Expand Up @@ -166,7 +180,7 @@ public void testSubDirectoriesNonRecursive() throws Exception{
File f3 = new File(inputDir, TEST3_FILE);
f3.createNewFile();

Thread.sleep(1000);
Thread.sleep(TIMEOUT);

assertTrue(bcr.hasNext());
bcr.getNext(jCas.getCas());
Expand All @@ -189,7 +203,7 @@ public void testModifiedFile() throws Exception{
f.createNewFile();

//Wait for file to be written and change detected
Thread.sleep(1000);
Thread.sleep(TIMEOUT);

assertTrue(bcr.doHasNext());

Expand All @@ -203,7 +217,7 @@ public void testModifiedFile() throws Exception{
writer.write("Test");
writer.close();

Thread.sleep(1000);
Thread.sleep(TIMEOUT);

assertTrue(bcr.doHasNext());

Expand All @@ -227,12 +241,12 @@ public void testDeleteFile() throws Exception{
f.createNewFile();

//Wait for file to be written and change detected
Thread.sleep(1000);
Thread.sleep(TIMEOUT);

f.delete();

//Wait for file to be written and change detected
Thread.sleep(1000);
Thread.sleep(TIMEOUT);

assertFalse(bcr.doHasNext());

Expand Down
2 changes: 2 additions & 0 deletions baleen/baleen-javadoc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
<groupId>jdk.tools</groupId>
<artifactId>jdk.tools</artifactId>
<version>1.8</version>
<scope>system</scope>
<systemPath>${java.home}/../lib/tools.jar</systemPath>
</dependency>
</dependencies>
</project>
1 change: 1 addition & 0 deletions baleen/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<packaging>pom</packaging>
<name>Baleen</name>
<description>Structured information from unstructured data</description>
<url>https://github.com/dstl/baleen</url>
<inceptionYear>2015</inceptionYear>

<licenses>
Expand Down

0 comments on commit b572e88

Please sign in to comment.