Skip to content

Commit

Permalink
Extend test to check file modification in directory
Browse files Browse the repository at this point in the history
Signed-off-by: Clement Escoffier <clement.escoffier@gmail.com>
  • Loading branch information
cescoffier committed Oct 1, 2015
1 parent 3f2b5d9 commit fac4a94
Showing 1 changed file with 13 additions and 1 deletion.
Expand Up @@ -139,7 +139,7 @@ public void testFileDeletion() throws IOException, InterruptedException {
}

@Test
public void testFileAdditionInDirectory() throws IOException, InterruptedException {
public void testFileAdditionAndModificationInDirectory() throws IOException, InterruptedException {
watcher.watch();
// Wait until the file monitoring is set up (ugly, but I don't know any way to detect this).
Thread.sleep(2000);
Expand All @@ -155,6 +155,18 @@ public void testFileAdditionInDirectory() throws IOException, InterruptedExcepti

// undeployment followed by redeployment
waitUntil(() -> undeploy.get() == 1 && deploy.get() == 2);

// Update file
// Simulate a 'touch'
file.setLastModified(System.currentTimeMillis());

// undeployment followed by redeployment
waitUntil(() -> undeploy.get() == 2 && deploy.get() == 3);

// delete directory
deleteRecursive(newDir);

waitUntil(() -> undeploy.get() == 2 && deploy.get() == 3);
}

public static boolean deleteRecursive(File path) {
Expand Down

0 comments on commit fac4a94

Please sign in to comment.