import java.nio.file.FileSystems;
import java.nio.file.Path;
import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.List;
import java.util.StringTokenizer;
import java.util.Vector;
import java.util.stream.StreamSupport;
public class EventManager implements EventSource
{
- private static final Logger log = LoggerFactory.getLogger(EventManager.class);
+ private static final Logger LOG = LoggerFactory.getLogger(EventManager.class);
private final ConcurrentHashMap<EventType<? extends Event>, Set<EventHandler>> handlerMap = new ConcurrentHashMap<>();
handler.handle(event);
} catch (Exception e) {
// We catch all errors from handlers
- log.error("An error occured during event handling: {}", e.getMessage(), e);
+ LOG.error("An error occured during event handling: {}", e.getMessage(), e);
}
}
}
import java.nio.file.Path;
import java.nio.file.Paths;
+import org.apache.commons.io.FilenameUtils;
/**
* PathUtilTest
public class PathUtilTest
extends TestCase
{
+
public void testToRelativeWithoutSlash()
{
- assertEquals( "path/to/resource.xml", PathUtil.getRelative( "/home/user/foo/repository",
+ assertEquals( FilenameUtils.separatorsToSystem( "path/to/resource.xml" ), PathUtil.getRelative( "/home/user/foo/repository",
"/home/user/foo/repository/path/to/resource.xml" ) );
}
public void testToRelativeWithSlash()
{
- assertEquals( "path/to/resource.xml", PathUtil.getRelative( "/home/user/foo/repository/",
+ assertEquals( FilenameUtils.separatorsToSystem( "path/to/resource.xml" ), PathUtil.getRelative( "/home/user/foo/repository/",
"/home/user/foo/repository/path/to/resource.xml" ) );
}
String path = "path/to/resource.xml";
String expectedPath = "file:" + workingDirname + "/" + path;
-
+
assertEquals( expectedPath, PathUtil.toUrl( expectedPath ) );
}
}