maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r349671 - 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/invalid/invalid/1.0-SNAPSHOT/
Date Tue, 29 Nov 2005 08:34:43 GMT
Author: brett
Date: Tue Nov 29 00:34:32 2005
New Revision: 349671

URL: http://svn.apache.org/viewcvs?rev=349671&view=rev
Log:
test invalid snapshot version
PR: MRM-9

Added:
    maven/repository-manager/trunk/maven-repository-discovery/src/test/repository/invalid/invalid/1.0-SNAPSHOT/
    maven/repository-manager/trunk/maven-repository-discovery/src/test/repository/invalid/invalid/1.0-SNAPSHOT/invalid-1.0.jar
Modified:
    maven/repository-manager/trunk/maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/DefaultArtifactDiscoverer.java
    maven/repository-manager/trunk/maven-repository-discovery/src/test/java/org/apache/maven/repository/discovery/DefaultArtifactDiscovererTest.java

Modified: maven/repository-manager/trunk/maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/DefaultArtifactDiscoverer.java
URL: http://svn.apache.org/viewcvs/maven/repository-manager/trunk/maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/DefaultArtifactDiscoverer.java?rev=349671&r1=349670&r2=349671&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/DefaultArtifactDiscoverer.java
(original)
+++ maven/repository-manager/trunk/maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/DefaultArtifactDiscoverer.java
Tue Nov 29 00:34:32 2005
@@ -107,8 +107,16 @@
         remainingFilename = remainingFilename.substring( artifactId.length() + 1 );
         if ( result.isSnapshot() )
         {
-            result = artifactFactory.createArtifact( groupId, artifactId, version, Artifact.SCOPE_RUNTIME,
"jar" );
-            result.setResolvedVersion( remainingFilename.substring( 0, remainingFilename.length()
- 4 ) );
+            result = artifactFactory.createArtifact( groupId, artifactId,
+                                                     remainingFilename.substring( 0, remainingFilename.length()
- 4 ),
+                                                     Artifact.SCOPE_RUNTIME, "jar" );
+            // poor encapsulation requires we do this to populate base version
+            if ( !result.isSnapshot() )
+            {
+                addKickedOutPath( path );
+
+                return null;
+            }
             if ( !result.getBaseVersion().equals( version ) )
             {
                 addKickedOutPath( path );

Modified: maven/repository-manager/trunk/maven-repository-discovery/src/test/java/org/apache/maven/repository/discovery/DefaultArtifactDiscovererTest.java
URL: http://svn.apache.org/viewcvs/maven/repository-manager/trunk/maven-repository-discovery/src/test/java/org/apache/maven/repository/discovery/DefaultArtifactDiscovererTest.java?rev=349671&r1=349670&r2=349671&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
Tue Nov 29 00:34:32 2005
@@ -170,6 +170,26 @@
         }
     }
 
+    public void testKickoutWithWrongSnapshotVersion()
+    {
+        List artifacts = discoverer.discoverArtifacts( repositoryLocation, null, false );
+        assertNotNull( "Check artifacts not null", artifacts );
+        boolean found = false;
+        for ( Iterator i = discoverer.getKickedOutPathsIterator(); i.hasNext() &&
!found; )
+        {
+            String path = (String) i.next();
+
+            found = path.replace( '\\', '/' ).equals( "invalid/invalid/1.0-SNAPSHOT/invalid-1.0.jar"
);
+        }
+        assertTrue( "Check kickout was found", found );
+
+        for ( Iterator i = artifacts.iterator(); i.hasNext(); )
+        {
+            Artifact a = (Artifact) i.next();
+            assertFalse( "Check not 'invalid-1.0.jar'", a.getFile().getName().equals( "invalid-1.0.jar"
) );
+        }
+    }
+
     public void testSnapshotInclusion()
     {
         List artifacts = discoverer.discoverArtifacts( repositoryLocation, null, true );

Added: maven/repository-manager/trunk/maven-repository-discovery/src/test/repository/invalid/invalid/1.0-SNAPSHOT/invalid-1.0.jar
URL: http://svn.apache.org/viewcvs/maven/repository-manager/trunk/maven-repository-discovery/src/test/repository/invalid/invalid/1.0-SNAPSHOT/invalid-1.0.jar?rev=349671&view=auto
==============================================================================
    (empty)



Mime
View raw message