summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/AbstractDiscoverer.java4
-rw-r--r--maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/DiscovererException.java5
-rw-r--r--maven-repository-discovery/src/test/java/org/apache/maven/repository/discovery/DefaultArtifactDiscovererTest.java76
-rw-r--r--maven-repository-discovery/src/test/java/org/apache/maven/repository/discovery/DefaultMetadataDiscovererTest.java7
-rw-r--r--maven-repository-discovery/src/test/java/org/apache/maven/repository/discovery/LegacyArtifactDiscovererTest.java60
-rw-r--r--maven-repository-discovery/src/test/repository/org/apache/maven/some-ejb/1.0/maven-metadata-repository.xml16
6 files changed, 122 insertions, 46 deletions
diff --git a/maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/AbstractDiscoverer.java b/maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/AbstractDiscoverer.java
index 58a97d493..90762b53e 100644
--- a/maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/AbstractDiscoverer.java
+++ b/maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/AbstractDiscoverer.java
@@ -51,7 +51,7 @@ public abstract class AbstractDiscoverer
/**
* Add a path to the list of files that were kicked out due to being invalid.
*
- * @param path the path to add
+ * @param path the path to add
* @param reason the reason why the path is being kicked out
*/
protected void addKickedOutPath( String path, String reason )
@@ -101,7 +101,7 @@ public abstract class AbstractDiscoverer
{
String path = files.next().toString();
- excludedPaths.add( new DiscovererPath( path, "Excluded by DirectoryScanner" ) );
+ excludedPaths.add( new DiscovererPath( path, "Artifact was in the specified list of exclusions" ) );
}
return scanner.getIncludedFiles();
diff --git a/maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/DiscovererException.java b/maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/DiscovererException.java
index 937e1780c..02e45e699 100644
--- a/maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/DiscovererException.java
+++ b/maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/DiscovererException.java
@@ -22,11 +22,6 @@ package org.apache.maven.repository.discovery;
public class DiscovererException
extends Exception
{
- public DiscovererException( Throwable cause )
- {
- super( cause );
- }
-
public DiscovererException( String message )
{
super( message );
diff --git a/maven-repository-discovery/src/test/java/org/apache/maven/repository/discovery/DefaultArtifactDiscovererTest.java b/maven-repository-discovery/src/test/java/org/apache/maven/repository/discovery/DefaultArtifactDiscovererTest.java
index 1da5a4f66..29544a0aa 100644
--- a/maven-repository-discovery/src/test/java/org/apache/maven/repository/discovery/DefaultArtifactDiscovererTest.java
+++ b/maven-repository-discovery/src/test/java/org/apache/maven/repository/discovery/DefaultArtifactDiscovererTest.java
@@ -58,7 +58,12 @@ public class DefaultArtifactDiscovererTest
String path = dPath.getPath();
- found = path.indexOf( ".svn" ) >= 0;
+ boolean b = path.indexOf( ".svn" ) >= 0;
+ if ( b )
+ {
+ found = true;
+ assertEquals( "Check comment", "Artifact was in the specified list of exclusions", dPath.getComment() );
+ }
}
assertTrue( "Check exclusion was found", found );
@@ -80,7 +85,11 @@ public class DefaultArtifactDiscovererTest
String path = dPath.getPath();
- found = "KEYS".equals( path );
+ if ( "KEYS".equals( path ) )
+ {
+ found = true;
+ assertEquals( "Check comment", "Artifact was in the specified list of exclusions", dPath.getComment() );
+ }
}
assertTrue( "Check exclusion was found", found );
@@ -102,7 +111,12 @@ public class DefaultArtifactDiscovererTest
String path = dPath.getPath();
- found = "javax/sql/jdbc/2.0/jdbc-2.0.jar".equals( path.replace( '\\', '/' ) );
+ if ( "javax/sql/jdbc/2.0/jdbc-2.0.jar".equals( path.replace( '\\', '/' ) ) )
+ {
+ found = true;
+ assertEquals( "Check comment is about blacklisting", "Artifact was in the specified list of exclusions",
+ dPath.getComment() );
+ }
}
assertTrue( "Check exclusion was found", found );
@@ -120,7 +134,13 @@ public class DefaultArtifactDiscovererTest
String path = dPath.getPath();
- found = "invalid/invalid-1.0.jar".equals( path.replace( '\\', '/' ) );
+ if ( "invalid/invalid-1.0.jar".equals( path.replace( '\\', '/' ) ) )
+ {
+ found = true;
+ assertEquals( "Check reason for kickout", "Path is too short to build an artifact from",
+ dPath.getComment() );
+
+ }
}
assertTrue( "Check kickout was found", found );
@@ -142,8 +162,13 @@ public class DefaultArtifactDiscovererTest
String path = dPath.getPath();
- found = "org/apache/maven/test/1.0-SNAPSHOT/wrong-artifactId-1.0-20050611.112233-1.jar".equals(
- path.replace( '\\', '/' ) );
+ if ( "org/apache/maven/test/1.0-SNAPSHOT/wrong-artifactId-1.0-20050611.112233-1.jar".equals(
+ path.replace( '\\', '/' ) ) )
+ {
+ found = true;
+ assertEquals( "Check reason for kickout", "Path filename does not correspond to an artifact",
+ dPath.getComment() );
+ }
}
assertTrue( "Check kickout was found", found );
@@ -166,7 +191,12 @@ public class DefaultArtifactDiscovererTest
String path = dPath.getPath();
- found = "invalid/invalid/1/invalid-1".equals( path.replace( '\\', '/' ) );
+ if ( "invalid/invalid/1/invalid-1".equals( path.replace( '\\', '/' ) ) )
+ {
+ found = true;
+ assertEquals( "Check reason for kickout", "Path filename does not have an extension",
+ dPath.getComment() );
+ }
}
assertTrue( "Check kickout was found", found );
@@ -188,7 +218,12 @@ public class DefaultArtifactDiscovererTest
String path = dPath.getPath();
- found = "invalid/invalid/1.0/invalid-2.0.jar".equals( path.replace( '\\', '/' ) );
+ if ( "invalid/invalid/1.0/invalid-2.0.jar".equals( path.replace( '\\', '/' ) ) )
+ {
+ found = true;
+ assertEquals( "Check reason for kickout", "Built artifact version does not match path version",
+ dPath.getComment() );
+ }
}
assertTrue( "Check kickout was found", found );
@@ -210,7 +245,12 @@ public class DefaultArtifactDiscovererTest
String path = dPath.getPath();
- found = "invalid/invalid/1.0/invalid-1.0b.jar".equals( path.replace( '\\', '/' ) );
+ if ( "invalid/invalid/1.0/invalid-1.0b.jar".equals( path.replace( '\\', '/' ) ) )
+ {
+ found = true;
+ assertEquals( "Check reason for kickout", "Path version does not corresspond to an artifact version",
+ dPath.getComment() );
+ }
}
assertTrue( "Check kickout was found", found );
@@ -232,7 +272,13 @@ public class DefaultArtifactDiscovererTest
String path = dPath.getPath();
- found = "invalid/invalid/1.0-SNAPSHOT/invalid-1.0.jar".equals( path.replace( '\\', '/' ) );
+ if ( "invalid/invalid/1.0-SNAPSHOT/invalid-1.0.jar".equals( path.replace( '\\', '/' ) ) )
+ {
+ found = true;
+ assertEquals( "Check reason for kickout",
+ "Failed to create a snapshot artifact: invalid:invalid:jar:1.0:runtime",
+ dPath.getComment() );
+ }
}
assertTrue( "Check kickout was found", found );
@@ -254,8 +300,14 @@ public class DefaultArtifactDiscovererTest
String path = dPath.getPath();
- found = "invalid/invalid/1.0-20050611.123456-1/invalid-1.0-20050611.123456-1.jar".equals(
- path.replace( '\\', '/' ) );
+ if ( "invalid/invalid/1.0-20050611.123456-1/invalid-1.0-20050611.123456-1.jar".equals(
+ path.replace( '\\', '/' ) ) )
+ {
+ found = true;
+ assertEquals( "Check reason for kickout",
+ "Built snapshot artifact base version does not match path version: invalid:invalid:jar:1.0-SNAPSHOT:runtime; should have been version: 1.0-20050611.123456-1",
+ dPath.getComment() );
+ }
}
assertTrue( "Check kickout was found", found );
diff --git a/maven-repository-discovery/src/test/java/org/apache/maven/repository/discovery/DefaultMetadataDiscovererTest.java b/maven-repository-discovery/src/test/java/org/apache/maven/repository/discovery/DefaultMetadataDiscovererTest.java
index 0caffd1a8..223b2a902 100644
--- a/maven-repository-discovery/src/test/java/org/apache/maven/repository/discovery/DefaultMetadataDiscovererTest.java
+++ b/maven-repository-discovery/src/test/java/org/apache/maven/repository/discovery/DefaultMetadataDiscovererTest.java
@@ -40,8 +40,7 @@ public class DefaultMetadataDiscovererTest
{
super.setUp();
- discoverer = (MetadataDiscoverer) lookup( MetadataDiscoverer.ROLE,
- "default" );
+ discoverer = (MetadataDiscoverer) lookup( MetadataDiscoverer.ROLE, "default" );
repositoryLocation = getTestFile( "src/test/repository" );
}
@@ -82,6 +81,8 @@ public class DefaultMetadataDiscovererTest
if ( "javax/maven-metadata-repository.xml".equals( normalizedDir ) )
{
found = true;
+ assertEquals( "Check reason for kickout", "Unable to build a repository metadata from path",
+ dPath.getComment() );
}
}
assertTrue( found );
@@ -104,6 +105,8 @@ public class DefaultMetadataDiscovererTest
if ( "org/apache/maven/some-ejb/1.0/maven-metadata-repository.xml".equals( normalizedDir ) )
{
found = true;
+ assertTrue( "Check reason for kickout", dPath.getComment().matches(
+ "Error reading metadata file '(.*)': input contained no data" ) );
}
}
assertTrue( found );
diff --git a/maven-repository-discovery/src/test/java/org/apache/maven/repository/discovery/LegacyArtifactDiscovererTest.java b/maven-repository-discovery/src/test/java/org/apache/maven/repository/discovery/LegacyArtifactDiscovererTest.java
index 7c2d03c12..eaa27f876 100644
--- a/maven-repository-discovery/src/test/java/org/apache/maven/repository/discovery/LegacyArtifactDiscovererTest.java
+++ b/maven-repository-discovery/src/test/java/org/apache/maven/repository/discovery/LegacyArtifactDiscovererTest.java
@@ -54,7 +54,11 @@ public class LegacyArtifactDiscovererTest
String path = dPath.getPath();
- found = path.indexOf( ".svn" ) >= 0;
+ if ( path.indexOf( ".svn" ) >= 0 )
+ {
+ found = true;
+ assertEquals( "Check comment", "Artifact was in the specified list of exclusions", dPath.getComment() );
+ }
}
assertTrue( "Check exclusion was found", found );
@@ -76,7 +80,11 @@ public class LegacyArtifactDiscovererTest
String path = dPath.getPath();
- found = "KEYS".equals( path );
+ if ( "KEYS".equals( path ) )
+ {
+ found = true;
+ assertEquals( "Check comment", "Artifact was in the specified list of exclusions", dPath.getComment() );
+ }
}
assertTrue( "Check exclusion was found", found );
@@ -98,7 +106,12 @@ public class LegacyArtifactDiscovererTest
String path = dPath.getPath();
- found = "javax.sql/jars/jdbc-2.0.jar".equals( path.replace( '\\', '/' ) );
+ if ( "javax.sql/jars/jdbc-2.0.jar".equals( path.replace( '\\', '/' ) ) )
+ {
+ found = true;
+ assertEquals( "Check comment is about blacklisting", "Artifact was in the specified list of exclusions",
+ dPath.getComment() );
+ }
}
assertTrue( "Check exclusion was found", found );
@@ -116,7 +129,12 @@ public class LegacyArtifactDiscovererTest
String path = dPath.getPath();
- found = "invalid/invalid-1.0.jar".equals( path.replace( '\\', '/' ) );
+ if ( "invalid/invalid-1.0.jar".equals( path.replace( '\\', '/' ) ) )
+ {
+ found = true;
+ assertEquals( "Check reason for kickout",
+ "Path does not match a legacy repository path for an artifact", dPath.getComment() );
+ }
}
assertTrue( "Check kickout was found", found );
@@ -138,7 +156,12 @@ public class LegacyArtifactDiscovererTest
String path = dPath.getPath();
- found = "invalid/jars/1.0/invalid-1.0.jar".equals( path.replace( '\\', '/' ) );
+ if ( "invalid/jars/1.0/invalid-1.0.jar".equals( path.replace( '\\', '/' ) ) )
+ {
+ found = true;
+ assertEquals( "Check reason for kickout",
+ "Path does not match a legacy repository path for an artifact", dPath.getComment() );
+ }
}
assertTrue( "Check kickout was found", found );
@@ -160,7 +183,12 @@ public class LegacyArtifactDiscovererTest
String path = dPath.getPath();
- found = "invalid/foo/invalid-1.0.foo".equals( path.replace( '\\', '/' ) );
+ if ( "invalid/foo/invalid-1.0.foo".equals( path.replace( '\\', '/' ) ) )
+ {
+ found = true;
+ assertEquals( "Check reason for kickout", "Path artifact type does not corresspond to an artifact type",
+ dPath.getComment() );
+ }
}
assertTrue( "Check kickout was found", found );
@@ -182,7 +210,12 @@ public class LegacyArtifactDiscovererTest
String path = dPath.getPath();
- found = "invalid/jars/no-extension".equals( path.replace( '\\', '/' ) );
+ if ( "invalid/jars/no-extension".equals( path.replace( '\\', '/' ) ) )
+ {
+ found = true;
+ assertEquals( "Check reason for kickout", "Path filename does not have an extension",
+ dPath.getComment() );
+ }
}
assertTrue( "Check kickout was found", found );
@@ -204,7 +237,12 @@ public class LegacyArtifactDiscovererTest
String path = dPath.getPath();
- found = "invalid/jars/invalid-1.0.rar".equals( path.replace( '\\', '/' ) );
+ if ( "invalid/jars/invalid-1.0.rar".equals( path.replace( '\\', '/' ) ) )
+ {
+ found = true;
+ assertEquals( "Check reason for kickout", "Path type does not match the extension",
+ dPath.getComment() );
+ }
}
assertTrue( "Check kickout was found", found );
@@ -226,7 +264,11 @@ public class LegacyArtifactDiscovererTest
String path = dPath.getPath();
- found = "invalid/jars/invalid.jar".equals( path.replace( '\\', '/' ) );
+ if ( "invalid/jars/invalid.jar".equals( path.replace( '\\', '/' ) ) )
+ {
+ found = true;
+ assertEquals( "Check reason for kickout", "Path filename version is empty", dPath.getComment() );
+ }
}
assertTrue( "Check kickout was found", found );
diff --git a/maven-repository-discovery/src/test/repository/org/apache/maven/some-ejb/1.0/maven-metadata-repository.xml b/maven-repository-discovery/src/test/repository/org/apache/maven/some-ejb/1.0/maven-metadata-repository.xml
index f94756148..e69de29bb 100644
--- a/maven-repository-discovery/src/test/repository/org/apache/maven/some-ejb/1.0/maven-metadata-repository.xml
+++ b/maven-repository-discovery/src/test/repository/org/apache/maven/some-ejb/1.0/maven-metadata-repository.xml
@@ -1,16 +0,0 @@
-<!--
- ~ Copyright 2005-2006 The Apache Software Foundation.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-