This commit is contained in:
Greg Wilkins 2017-08-28 16:17:31 +10:00
parent 5f34e0bce8
commit ecad4125a4
1 changed files with 13 additions and 14 deletions

View File

@ -46,7 +46,7 @@ import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
@Ignore("Disabled due to behavioral differences in various FileSystems (hard to write a single testcase that works in all scenarios)")
// @Ignore("Disabled due to behavioral differences in various FileSystems (hard to write a single testcase that works in all scenarios)")
public class PathWatcherTest
{
public static class PathWatchEventCapture implements PathWatcher.Listener
@ -81,6 +81,18 @@ public class PathWatcherTest
{
synchronized (events)
{
Path relativePath = this.baseDir.relativize(event.getPath());
String key = relativePath.toString().replace(File.separatorChar,'/');
List<PathWatchEventType> types = this.events.get(key);
if (types == null)
{
types = new ArrayList<>();
}
types.add(event.getType());
this.events.put(key,types);
LOG.debug("Captured Event: {} | {}",event.getType(),key);
//if triggered by path
if (triggerPath != null)
{
@ -95,19 +107,6 @@ public class PathWatcherTest
{
finishedLatch.countDown();
}
Path relativePath = this.baseDir.relativize(event.getPath());
String key = relativePath.toString().replace(File.separatorChar,'/');
List<PathWatchEventType> types = this.events.get(key);
if (types == null)
{
types = new ArrayList<>();
}
types.add(event.getType());
this.events.put(key,types);
LOG.debug("Captured Event: {} | {}",event.getType(),key);
}
}