]> source.dussan.org Git - archiva.git/commitdiff
more log for MRM-1832
authorOlivier Lamy <olamy@apache.org>
Tue, 22 Apr 2014 12:52:25 +0000 (22:52 +1000)
committerOlivier Lamy <olamy@apache.org>
Tue, 22 Apr 2014 12:52:25 +0000 (22:52 +1000)
archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/InvalidScanConsumer.java
archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryScannerTest.java

index 717b8ba589b55fec65389a5fb30f91a08bc39da6..a253179f7605b499d4f1abe360090d2a686b9e9c 100644 (file)
@@ -23,6 +23,8 @@ import org.apache.archiva.admin.model.beans.ManagedRepository;
 import org.apache.archiva.consumers.AbstractMonitoredConsumer;
 import org.apache.archiva.consumers.ConsumerException;
 import org.apache.archiva.consumers.InvalidRepositoryContentConsumer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.context.annotation.Scope;
 import org.springframework.stereotype.Service;
 
@@ -42,6 +44,8 @@ public class InvalidScanConsumer
      * default-value="unset-id"
      */
     private String id = "unset-id";
+
+    private Logger logger = LoggerFactory.getLogger( getClass() );
     
     private int processCount = 0;
 
@@ -87,6 +91,7 @@ public class InvalidScanConsumer
     public void processFile( String path )
         throws ConsumerException
     {
+        logger.info( "processFile: {}", path );
         processCount++;
     }
 
index a19b16db773f6231588a4cf0e0368afc7f73ca63..dc40787fc07332fad4e81e5fc0c224cb222cd1b1 100644 (file)
@@ -22,9 +22,10 @@ package org.apache.archiva.repository.scanner;
 import junit.framework.TestCase;
 import org.apache.archiva.admin.model.beans.ManagedRepository;
 import org.apache.archiva.admin.model.beans.RemoteRepository;
-import org.apache.commons.io.FileUtils;
 import org.apache.archiva.consumers.InvalidRepositoryContentConsumer;
 import org.apache.archiva.consumers.KnownRepositoryContentConsumer;
+import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
+import org.apache.commons.io.FileUtils;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.context.ApplicationContext;
@@ -33,6 +34,7 @@ import org.springframework.test.context.ContextConfiguration;
 import javax.inject.Inject;
 import java.io.File;
 import java.io.IOException;
+import java.nio.file.Paths;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
@@ -40,15 +42,12 @@ import java.util.Arrays;
 import java.util.List;
 import java.util.Locale;
 import java.util.TimeZone;
-import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
 
 /**
  * RepositoryScannerTest
- *
- *
  */
-@RunWith( ArchivaSpringJUnit4ClassRunner.class )
-@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml" } )
+@RunWith(ArchivaSpringJUnit4ClassRunner.class)
+@ContextConfiguration(locations = { "classpath*:/META-INF/spring-context.xml" })
 public class RepositoryScannerTest
     extends TestCase
 {
@@ -79,7 +78,8 @@ public class RepositoryScannerTest
 
     private ManagedRepository createDefaultRepository()
     {
-        File repoDir = new File( "src/test/repositories/default-repository" );
+        File repoDir =
+            Paths.get( System.getProperty( "basedir" ), "src/test/repositories/default-repository" ).toFile();
 
         assertTrue( "Default Test Repository should exist.", repoDir.exists() && repoDir.isDirectory() );
 
@@ -89,9 +89,9 @@ public class RepositoryScannerTest
     private ManagedRepository createSimpleRepository()
         throws IOException, ParseException
     {
-        File srcDir = new File( "src/test/repositories/simple-repository" );
+        File srcDir = Paths.get( System.getProperty( "basedir" ),  "src/test/repositories/simple-repository" ).toFile();
 
-        File repoDir = new File( "target/test-repos/simple-repository" );
+        File repoDir = Paths.get( System.getProperty( "basedir" ),  "target/test-repos/simple-repository" ).toFile();
 
         FileUtils.deleteDirectory( repoDir );
 
@@ -116,7 +116,7 @@ public class RepositoryScannerTest
 
     private ManagedRepository createLegacyRepository()
     {
-        File repoDir = new File( "src/test/repositories/legacy-repository" );
+        File repoDir = Paths.get( System.getProperty( "basedir" ),  "src/test/repositories/legacy-repository" ).toFile();
 
         assertTrue( "Legacy Test Repository should exist.", repoDir.exists() && repoDir.isDirectory() );
 
@@ -238,7 +238,8 @@ public class RepositoryScannerTest
         KnownScanConsumer consumer = new KnownScanConsumer();
         consumer.setIncludes(
             new String[]{ "**/*.jar", "**/*.war", "**/*.pom", "**/maven-metadata.xml", "**/*-site.xml", "**/*.zip",
-                "**/*.tar.gz", "**/*.sha1", "**/*.md5" } );
+                "**/*.tar.gz", "**/*.sha1", "**/*.md5" }
+        );
         knownConsumers.add( consumer );
 
         List<InvalidRepositoryContentConsumer> invalidConsumers = new ArrayList<>();