mirror of https://github.com/apache/archiva.git
test that the reason is set correctly
git-svn-id: https://svn.apache.org/repos/asf/maven/repository-manager/trunk@424875 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
955aec2db3
commit
e1fcc485de
|
@ -101,7 +101,7 @@ public abstract class AbstractDiscoverer
|
||||||
{
|
{
|
||||||
String path = files.next().toString();
|
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();
|
return scanner.getIncludedFiles();
|
||||||
|
|
|
@ -22,11 +22,6 @@ package org.apache.maven.repository.discovery;
|
||||||
public class DiscovererException
|
public class DiscovererException
|
||||||
extends Exception
|
extends Exception
|
||||||
{
|
{
|
||||||
public DiscovererException( Throwable cause )
|
|
||||||
{
|
|
||||||
super( cause );
|
|
||||||
}
|
|
||||||
|
|
||||||
public DiscovererException( String message )
|
public DiscovererException( String message )
|
||||||
{
|
{
|
||||||
super( message );
|
super( message );
|
||||||
|
|
|
@ -58,7 +58,12 @@ public class DefaultArtifactDiscovererTest
|
||||||
|
|
||||||
String path = dPath.getPath();
|
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 );
|
assertTrue( "Check exclusion was found", found );
|
||||||
|
|
||||||
|
@ -80,7 +85,11 @@ public class DefaultArtifactDiscovererTest
|
||||||
|
|
||||||
String path = dPath.getPath();
|
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 );
|
assertTrue( "Check exclusion was found", found );
|
||||||
|
|
||||||
|
@ -102,7 +111,12 @@ public class DefaultArtifactDiscovererTest
|
||||||
|
|
||||||
String path = dPath.getPath();
|
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 );
|
assertTrue( "Check exclusion was found", found );
|
||||||
|
|
||||||
|
@ -120,7 +134,13 @@ public class DefaultArtifactDiscovererTest
|
||||||
|
|
||||||
String path = dPath.getPath();
|
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 );
|
assertTrue( "Check kickout was found", found );
|
||||||
|
|
||||||
|
@ -142,8 +162,13 @@ public class DefaultArtifactDiscovererTest
|
||||||
|
|
||||||
String path = dPath.getPath();
|
String path = dPath.getPath();
|
||||||
|
|
||||||
found = "org/apache/maven/test/1.0-SNAPSHOT/wrong-artifactId-1.0-20050611.112233-1.jar".equals(
|
if ( "org/apache/maven/test/1.0-SNAPSHOT/wrong-artifactId-1.0-20050611.112233-1.jar".equals(
|
||||||
path.replace( '\\', '/' ) );
|
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 );
|
assertTrue( "Check kickout was found", found );
|
||||||
|
|
||||||
|
@ -166,7 +191,12 @@ public class DefaultArtifactDiscovererTest
|
||||||
|
|
||||||
String path = dPath.getPath();
|
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 );
|
assertTrue( "Check kickout was found", found );
|
||||||
|
|
||||||
|
@ -188,7 +218,12 @@ public class DefaultArtifactDiscovererTest
|
||||||
|
|
||||||
String path = dPath.getPath();
|
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 );
|
assertTrue( "Check kickout was found", found );
|
||||||
|
|
||||||
|
@ -210,7 +245,12 @@ public class DefaultArtifactDiscovererTest
|
||||||
|
|
||||||
String path = dPath.getPath();
|
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 );
|
assertTrue( "Check kickout was found", found );
|
||||||
|
|
||||||
|
@ -232,7 +272,13 @@ public class DefaultArtifactDiscovererTest
|
||||||
|
|
||||||
String path = dPath.getPath();
|
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 );
|
assertTrue( "Check kickout was found", found );
|
||||||
|
|
||||||
|
@ -254,8 +300,14 @@ public class DefaultArtifactDiscovererTest
|
||||||
|
|
||||||
String path = dPath.getPath();
|
String path = dPath.getPath();
|
||||||
|
|
||||||
found = "invalid/invalid/1.0-20050611.123456-1/invalid-1.0-20050611.123456-1.jar".equals(
|
if ( "invalid/invalid/1.0-20050611.123456-1/invalid-1.0-20050611.123456-1.jar".equals(
|
||||||
path.replace( '\\', '/' ) );
|
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 );
|
assertTrue( "Check kickout was found", found );
|
||||||
|
|
||||||
|
|
|
@ -40,8 +40,7 @@ public class DefaultMetadataDiscovererTest
|
||||||
{
|
{
|
||||||
super.setUp();
|
super.setUp();
|
||||||
|
|
||||||
discoverer = (MetadataDiscoverer) lookup( MetadataDiscoverer.ROLE,
|
discoverer = (MetadataDiscoverer) lookup( MetadataDiscoverer.ROLE, "default" );
|
||||||
"default" );
|
|
||||||
repositoryLocation = getTestFile( "src/test/repository" );
|
repositoryLocation = getTestFile( "src/test/repository" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,6 +81,8 @@ public class DefaultMetadataDiscovererTest
|
||||||
if ( "javax/maven-metadata-repository.xml".equals( normalizedDir ) )
|
if ( "javax/maven-metadata-repository.xml".equals( normalizedDir ) )
|
||||||
{
|
{
|
||||||
found = true;
|
found = true;
|
||||||
|
assertEquals( "Check reason for kickout", "Unable to build a repository metadata from path",
|
||||||
|
dPath.getComment() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assertTrue( found );
|
assertTrue( found );
|
||||||
|
@ -104,6 +105,8 @@ public class DefaultMetadataDiscovererTest
|
||||||
if ( "org/apache/maven/some-ejb/1.0/maven-metadata-repository.xml".equals( normalizedDir ) )
|
if ( "org/apache/maven/some-ejb/1.0/maven-metadata-repository.xml".equals( normalizedDir ) )
|
||||||
{
|
{
|
||||||
found = true;
|
found = true;
|
||||||
|
assertTrue( "Check reason for kickout", dPath.getComment().matches(
|
||||||
|
"Error reading metadata file '(.*)': input contained no data" ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assertTrue( found );
|
assertTrue( found );
|
||||||
|
|
|
@ -54,7 +54,11 @@ public class LegacyArtifactDiscovererTest
|
||||||
|
|
||||||
String path = dPath.getPath();
|
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 );
|
assertTrue( "Check exclusion was found", found );
|
||||||
|
|
||||||
|
@ -76,7 +80,11 @@ public class LegacyArtifactDiscovererTest
|
||||||
|
|
||||||
String path = dPath.getPath();
|
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 );
|
assertTrue( "Check exclusion was found", found );
|
||||||
|
|
||||||
|
@ -98,7 +106,12 @@ public class LegacyArtifactDiscovererTest
|
||||||
|
|
||||||
String path = dPath.getPath();
|
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 );
|
assertTrue( "Check exclusion was found", found );
|
||||||
|
|
||||||
|
@ -116,7 +129,12 @@ public class LegacyArtifactDiscovererTest
|
||||||
|
|
||||||
String path = dPath.getPath();
|
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 );
|
assertTrue( "Check kickout was found", found );
|
||||||
|
|
||||||
|
@ -138,7 +156,12 @@ public class LegacyArtifactDiscovererTest
|
||||||
|
|
||||||
String path = dPath.getPath();
|
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 );
|
assertTrue( "Check kickout was found", found );
|
||||||
|
|
||||||
|
@ -160,7 +183,12 @@ public class LegacyArtifactDiscovererTest
|
||||||
|
|
||||||
String path = dPath.getPath();
|
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 );
|
assertTrue( "Check kickout was found", found );
|
||||||
|
|
||||||
|
@ -182,7 +210,12 @@ public class LegacyArtifactDiscovererTest
|
||||||
|
|
||||||
String path = dPath.getPath();
|
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 );
|
assertTrue( "Check kickout was found", found );
|
||||||
|
|
||||||
|
@ -204,7 +237,12 @@ public class LegacyArtifactDiscovererTest
|
||||||
|
|
||||||
String path = dPath.getPath();
|
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 );
|
assertTrue( "Check kickout was found", found );
|
||||||
|
|
||||||
|
@ -226,7 +264,11 @@ public class LegacyArtifactDiscovererTest
|
||||||
|
|
||||||
String path = dPath.getPath();
|
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 );
|
assertTrue( "Check kickout was found", found );
|
||||||
|
|
||||||
|
|
|
@ -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.
|
|
||||||
-->
|
|
||||||
|
|
Loading…
Reference in New Issue