maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aherit...@apache.org
Subject svn commit: r803330 - in /maven/shared/trunk/maven-common-artifact-filters/src: main/java/org/apache/maven/shared/artifact/filter/collection/ test/java/org/apache/maven/shared/artifact/filter/collection/
Date Tue, 11 Aug 2009 23:58:24 GMT
Author: aheritier
Date: Tue Aug 11 23:58:24 2009
New Revision: 803330

URL: http://svn.apache.org/viewvc?rev=803330&view=rev
Log:
MSHARED-88 : ProjectTransitivityFilter has incorrect behavior for artifactIsADirectDependency
method

Modified:
    maven/shared/trunk/maven-common-artifact-filters/src/main/java/org/apache/maven/shared/artifact/filter/collection/ProjectTransitivityFilter.java
    maven/shared/trunk/maven-common-artifact-filters/src/test/java/org/apache/maven/shared/artifact/filter/collection/TestFilterArtifacts.java
    maven/shared/trunk/maven-common-artifact-filters/src/test/java/org/apache/maven/shared/artifact/filter/collection/TestProjectTransitivityFilter.java

Modified: maven/shared/trunk/maven-common-artifact-filters/src/main/java/org/apache/maven/shared/artifact/filter/collection/ProjectTransitivityFilter.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-common-artifact-filters/src/main/java/org/apache/maven/shared/artifact/filter/collection/ProjectTransitivityFilter.java?rev=803330&r1=803329&r2=803330&view=diff
==============================================================================
--- maven/shared/trunk/maven-common-artifact-filters/src/main/java/org/apache/maven/shared/artifact/filter/collection/ProjectTransitivityFilter.java
(original)
+++ maven/shared/trunk/maven-common-artifact-filters/src/main/java/org/apache/maven/shared/artifact/filter/collection/ProjectTransitivityFilter.java
Tue Aug 11 23:58:24 2009
@@ -79,8 +79,7 @@
         while ( iterator.hasNext() )
         {
             Artifact dependency = (Artifact) iterator.next();
-            if ( dependency.getGroupId().equals( artifact.getGroupId() ) &&
-                dependency.getArtifactId().equals( artifact.getArtifactId() ) )
+            if ( dependency.equals( artifact ) )
             {
                 result = true;
                 break;

Modified: maven/shared/trunk/maven-common-artifact-filters/src/test/java/org/apache/maven/shared/artifact/filter/collection/TestFilterArtifacts.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-common-artifact-filters/src/test/java/org/apache/maven/shared/artifact/filter/collection/TestFilterArtifacts.java?rev=803330&r1=803329&r2=803330&view=diff
==============================================================================
--- maven/shared/trunk/maven-common-artifact-filters/src/test/java/org/apache/maven/shared/artifact/filter/collection/TestFilterArtifacts.java
(original)
+++ maven/shared/trunk/maven-common-artifact-filters/src/test/java/org/apache/maven/shared/artifact/filter/collection/TestFilterArtifacts.java
Tue Aug 11 23:58:24 2009
@@ -112,5 +112,20 @@
         assertTrue( fa.getFilters().get( 2 ) instanceof TypeFilter );
 
     }
+    
+    public void testArtifactFilterWithClassifier() throws IOException, ArtifactFilterException
+    {
+        File outputFolder = new File( "target/filters/" );
+        FileUtils.deleteDirectory( outputFolder );
+        ArtifactStubFactory fact = new ArtifactStubFactory( outputFolder, false );
+        Set artifacts = fact.getClassifiedArtifacts();
+        FilterArtifacts fa = new FilterArtifacts();
+        fa.addFilter( new ClassifierFilter( "", "four" ) );
+        Set results = fa.filter( artifacts );
+        assertEquals( 3, results.size() );
+        fa.addFilter( new ClassifierFilter( "two,three", "" ) );
+        results = fa.filter( artifacts );
+        assertEquals( 2, results.size() );
+    }
 
 }

Modified: maven/shared/trunk/maven-common-artifact-filters/src/test/java/org/apache/maven/shared/artifact/filter/collection/TestProjectTransitivityFilter.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-common-artifact-filters/src/test/java/org/apache/maven/shared/artifact/filter/collection/TestProjectTransitivityFilter.java?rev=803330&r1=803329&r2=803330&view=diff
==============================================================================
--- maven/shared/trunk/maven-common-artifact-filters/src/test/java/org/apache/maven/shared/artifact/filter/collection/TestProjectTransitivityFilter.java
(original)
+++ maven/shared/trunk/maven-common-artifact-filters/src/test/java/org/apache/maven/shared/artifact/filter/collection/TestProjectTransitivityFilter.java
Tue Aug 11 23:58:24 2009
@@ -40,6 +40,8 @@
     Set artifacts = new HashSet();
 
     Set directArtifacts = new HashSet();
+    
+    Set classifiedArtifacts = new HashSet();
 
     protected void setUp()
         throws Exception
@@ -48,10 +50,10 @@
 
         ArtifactStubFactory fact = new ArtifactStubFactory( null, false );
         artifacts = fact.getScopedArtifacts();
-
         directArtifacts = fact.getReleaseAndSnapshotArtifacts();
-
+        classifiedArtifacts = fact.getClassifiedArtifacts();
         artifacts.addAll( directArtifacts );
+        artifacts.addAll( classifiedArtifacts );
     }
 
     public void testAll()
@@ -60,7 +62,7 @@
 
         Set result = filter.filter( artifacts );
 
-        assertEquals( 7, result.size() );
+        assertEquals( 11, result.size() );
     }
 
     public void testExclude()
@@ -81,4 +83,13 @@
         }
     }
 
+    public void testClassified()
+    {
+        ProjectTransitivityFilter filter = new ProjectTransitivityFilter( classifiedArtifacts,
true );
+
+        Set result = filter.filter( artifacts );
+
+        assertEquals( 4, result.size() );
+    }
+
 }



Mime
View raw message