]> source.dussan.org Git - archiva.git/commitdiff
Test for windows, import fix
authorEric Barboni <skygo@apache.org>
Tue, 11 Feb 2020 19:37:01 +0000 (20:37 +0100)
committerEric Barboni <skygo@apache.org>
Tue, 11 Feb 2020 19:37:01 +0000 (20:37 +0100)
archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/utils/PathUtil.java
archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/event/EventHandler.java
archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/event/EventManager.java
archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/event/EventType.java
archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/archiva/common/utils/PathUtilTest.java

index 8c9a437a4bc55410c5573b1354029fcd907696d1..b8d14bb830630a2c224beda090a2e99ce5f4dc81 100644 (file)
@@ -26,8 +26,6 @@ import java.net.URI;
 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;
index 5217f1152ca39840ac9fae3f00ec5b9a2478ac57..f98adcdab8a04b2cc1040210ccb6f096ab94d831 100644 (file)
@@ -19,7 +19,6 @@ package org.apache.archiva.event;
  * under the License.
  */
 
-import org.apache.archiva.event.Event;
 
 import java.util.EventListener;
 
index 189f9500ed1b77e8f4af1de3824b8968aa7b7584..00a24006607e27c15355cd2043874abb141ebfe9 100644 (file)
@@ -28,7 +28,7 @@ import java.util.concurrent.ConcurrentHashMap;
 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<>();
 
@@ -71,7 +71,7 @@ public class EventManager implements EventSource
                             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);
                         }
                     }
             }
index 58a92138210b02cd90bab169e76e1e230dcf0f4d..50d42679ef63007f66d8b054e9691e0ec4d41ae3 100644 (file)
@@ -119,7 +119,7 @@ public class EventType<T extends Event> implements Serializable  {
 
 
     private Object writeReplace() throws ObjectStreamException {
-        Deque<String> path = new LinkedList<String>();
+        Deque<String> path = new LinkedList<>();
         EventType<?> t = this;
         while (t != ROOT) {
             path.addFirst(t.name);
index dfd5b90142dd7b6db3da7dfab8deffd06a159baa..af2c42389ce7f65be87c58b1cfc0f8b1ab5e9b19 100644 (file)
@@ -24,6 +24,7 @@ import org.apache.commons.lang3.StringUtils;
 
 import java.nio.file.Path;
 import java.nio.file.Paths;
+import org.apache.commons.io.FilenameUtils;
 
 /**
  * PathUtilTest 
@@ -33,15 +34,16 @@ import java.nio.file.Paths;
 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" ) );
     }
 
@@ -87,7 +89,7 @@ public class PathUtilTest
 
         String path = "path/to/resource.xml";
         String expectedPath = "file:" + workingDirname + "/" + path;
-
+        
         assertEquals( expectedPath, PathUtil.toUrl( expectedPath ) );
     }
 }