maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r424875 - in /maven/repository-manager/trunk/maven-repository-discovery/src: main/java/org/apache/maven/repository/discovery/ test/java/org/apache/maven/repository/discovery/ test/repository/org/apache/maven/some-ejb/1.0/
Date Mon, 24 Jul 2006 01:42:09 GMT
Author: brett
Date: Sun Jul 23 18:42:09 2006
New Revision: 424875

URL: http://svn.apache.org/viewvc?rev=424875&view=rev
Log:
test that the reason is set correctly

Modified:
    maven/repository-manager/trunk/maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/AbstractDiscoverer.java
    maven/repository-manager/trunk/maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/DiscovererException.java
    maven/repository-manager/trunk/maven-repository-discovery/src/test/java/org/apache/maven/repository/discovery/DefaultArtifactDiscovererTest.java
    maven/repository-manager/trunk/maven-repository-discovery/src/test/java/org/apache/maven/repository/discovery/DefaultMetadataDiscovererTest.java
    maven/repository-manager/trunk/maven-repository-discovery/src/test/java/org/apache/maven/repository/discovery/LegacyArtifactDiscovererTest.java
    maven/repository-manager/trunk/maven-repository-discovery/src/test/repository/org/apache/maven/some-ejb/1.0/maven-metadata-repository.xml

Modified: maven/repository-manager/trunk/maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/AbstractDiscoverer.java
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/AbstractDiscoverer.java?rev=424875&r1=424874&r2=424875&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/AbstractDiscoverer.java
(original)
+++ maven/repository-manager/trunk/maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/AbstractDiscoverer.java
Sun Jul 23 18:42:09 2006
@@ -51,7 +51,7 @@
     /**
      * 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 @@
         {
             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();

Modified: maven/repository-manager/trunk/maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/DiscovererException.java
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/DiscovererException.java?rev=424875&r1=424874&r2=424875&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/DiscovererException.java
(original)
+++ maven/repository-manager/trunk/maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/DiscovererException.java
Sun Jul 23 18:42:09 2006
@@ -22,11 +22,6 @@
 public class DiscovererException
     extends Exception
 {
-    public DiscovererException( Throwable cause )
-    {
-        super( cause );
-    }
-
     public DiscovererException( String message )
     {
         super( message );

Modified: maven/repository-manager/trunk/maven-repository-discovery/src/test/java/org/apache/maven/repository/discovery/DefaultArtifactDiscovererTest.java
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-discovery/src/test/java/org/apache/maven/repository/discovery/DefaultArtifactDiscovererTest.java?rev=424875&r1=424874&r2=424875&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-discovery/src/test/java/org/apache/maven/repository/discovery/DefaultArtifactDiscovererTest.java
(original)
+++ maven/repository-manager/trunk/maven-repository-discovery/src/test/java/org/apache/maven/repository/discovery/DefaultArtifactDiscovererTest.java
Sun Jul 23 18:42:09 2006
@@ -58,7 +58,12 @@
 
             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 @@
 
             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 @@
 
             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 @@
 
             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 @@
 
             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 @@
 
             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 @@
 
             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 @@
 
             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 @@
 
             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 @@
 
             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 );
 

Modified: maven/repository-manager/trunk/maven-repository-discovery/src/test/java/org/apache/maven/repository/discovery/DefaultMetadataDiscovererTest.java
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-discovery/src/test/java/org/apache/maven/repository/discovery/DefaultMetadataDiscovererTest.java?rev=424875&r1=424874&r2=424875&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-discovery/src/test/java/org/apache/maven/repository/discovery/DefaultMetadataDiscovererTest.java
(original)
+++ maven/repository-manager/trunk/maven-repository-discovery/src/test/java/org/apache/maven/repository/discovery/DefaultMetadataDiscovererTest.java
Sun Jul 23 18:42:09 2006
@@ -40,8 +40,7 @@
     {
         super.setUp();
 
-        discoverer = (MetadataDiscoverer) lookup( MetadataDiscoverer.ROLE,
-                                                  "default" );
+        discoverer = (MetadataDiscoverer) lookup( MetadataDiscoverer.ROLE, "default" );
         repositoryLocation = getTestFile( "src/test/repository" );
     }
 
@@ -82,6 +81,8 @@
             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 @@
             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 );

Modified: maven/repository-manager/trunk/maven-repository-discovery/src/test/java/org/apache/maven/repository/discovery/LegacyArtifactDiscovererTest.java
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-discovery/src/test/java/org/apache/maven/repository/discovery/LegacyArtifactDiscovererTest.java?rev=424875&r1=424874&r2=424875&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-discovery/src/test/java/org/apache/maven/repository/discovery/LegacyArtifactDiscovererTest.java
(original)
+++ maven/repository-manager/trunk/maven-repository-discovery/src/test/java/org/apache/maven/repository/discovery/LegacyArtifactDiscovererTest.java
Sun Jul 23 18:42:09 2006
@@ -54,7 +54,11 @@
 
             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 @@
 
             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 @@
 
             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 @@
 
             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 @@
 
             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 @@
 
             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 @@
 
             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 @@
 
             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 @@
 
             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 );
 

Modified: maven/repository-manager/trunk/maven-repository-discovery/src/test/repository/org/apache/maven/some-ejb/1.0/maven-metadata-repository.xml
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-discovery/src/test/repository/org/apache/maven/some-ejb/1.0/maven-metadata-repository.xml?rev=424875&r1=424874&r2=424875&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-discovery/src/test/repository/org/apache/maven/some-ejb/1.0/maven-metadata-repository.xml
(original)
+++ maven/repository-manager/trunk/maven-repository-discovery/src/test/repository/org/apache/maven/some-ejb/1.0/maven-metadata-repository.xml
Sun Jul 23 18:42:09 2006
@@ -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.
-  -->
-



Mime
View raw message