maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bri...@apache.org
Subject svn commit: r533904 - in /maven/plugins/trunk/maven-dependency-plugin/src: main/java/org/apache/maven/plugin/dependency/utils/filters/ test/java/org/apache/maven/plugin/dependency/ test/java/org/apache/maven/plugin/dependency/utils/filters/
Date Tue, 01 May 2007 01:22:54 GMT
Author: brianf
Date: Mon Apr 30 18:22:48 2007
New Revision: 533904

URL: http://svn.apache.org/viewvc?view=rev&rev=533904
Log:
MDEP-87 - fixed up the code, added more logs and tests. No problem found.

Modified:
    maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/filters/AbstractArtifactFeatureFilter.java
    maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/filters/ArtifactIdFilter.java
    maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/filters/GroupIdFilter.java
    maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestCopyDependenciesMojo.java
    maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/utils/filters/TestGroupIdFilter.java

Modified: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/filters/AbstractArtifactFeatureFilter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/filters/AbstractArtifactFeatureFilter.java?view=diff&rev=533904&r1=533903&r2=533904
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/filters/AbstractArtifactFeatureFilter.java
(original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/filters/AbstractArtifactFeatureFilter.java
Mon Apr 30 18:22:48 2007
@@ -33,7 +33,8 @@
  * This is the common base class of ClassifierFilter and TypeFilter
  * 
  * @author <a href="richardv@mxtelecom.com">Richard van der Hoff</a>
- * @version $Id$
+ * @version $Id: AbstractArtifactFeatureFilter.java 522374 2007-03-25 22:58:03Z
+ *          brianf $
  */
 public abstract class AbstractArtifactFeatureFilter
     extends AbstractArtifactsFilter
@@ -78,14 +79,19 @@
 
         if ( this.includes != null && !this.includes.isEmpty() )
         {
-            log.debug( "Including only " + featureName + ": " + this.includeString );
+            int size = includes.size();
+            log.debug( "Including only " + size + " " + featureName + ( ( size > 1 ) ?
"s" : "" ) + ": "
+                + this.includeString );
+
             results = filterIncludes( artifacts, this.includes );
         }
         else
         {
             if ( this.excludes != null && !this.excludes.isEmpty() )
             {
-                log.debug( "Excluding " + featureName + ": " + this.excludeString );
+                int size = excludes.size();
+                log.debug( "Excluding " + size + " " + featureName + ( ( size > 1 ) ?
"s" : "" ) + ": "
+                    + this.excludeString );
                 results = filterExcludes( artifacts, this.excludes );
             }
         }

Modified: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/filters/ArtifactIdFilter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/filters/ArtifactIdFilter.java?view=diff&rev=533904&r1=533903&r2=533904
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/filters/ArtifactIdFilter.java
(original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/filters/ArtifactIdFilter.java
Mon Apr 30 18:22:48 2007
@@ -32,11 +32,6 @@
 public class ArtifactIdFilter
     extends AbstractArtifactFeatureFilter
 {
-
-    private String includeScope;
-
-    private String excludeScope;
-
     /**
      * Will setup super with 'ArtifactId' as the filterType
      * 
@@ -46,24 +41,6 @@
     public ArtifactIdFilter( String include, String exclude )
     {
         super( include, exclude, "ArtifactId" );
-        this.includeScope = include;
-        this.excludeScope = exclude;
-    }
-
-    /**
-     * @return Returns the excludeScope.
-     */
-    public String getExcludeScope()
-    {
-        return excludeScope;
-    }
-
-    /**
-     * @return Returns the includeScope.
-     */
-    public String getIncludeScope()
-    {
-        return includeScope;
     }
 
     /*

Modified: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/filters/GroupIdFilter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/filters/GroupIdFilter.java?view=diff&rev=533904&r1=533903&r2=533904
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/filters/GroupIdFilter.java
(original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/filters/GroupIdFilter.java
Mon Apr 30 18:22:48 2007
@@ -33,10 +33,6 @@
     extends AbstractArtifactFeatureFilter
 {
 
-    private String includeScope;
-
-    private String excludeScope;
-
     /**
      * Construction will setup the super call with a filtertype of 'GroupId'
      * 
@@ -46,24 +42,6 @@
     public GroupIdFilter( String include, String exclude )
     {
         super( include, exclude, "GroupId" );
-        this.includeScope = include;
-        this.excludeScope = exclude;
-    }
-
-    /**
-     * @return Returns the excludeScope.
-     */
-    public String getExcludeScope()
-    {
-        return excludeScope;
-    }
-
-    /**
-     * @return Returns the includeScope.
-     */
-    public String getIncludeScope()
-    {
-        return includeScope;
     }
 
     /*

Modified: maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestCopyDependenciesMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestCopyDependenciesMojo.java?view=diff&rev=533904&r1=533903&r2=533904
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestCopyDependenciesMojo.java
(original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestCopyDependenciesMojo.java
Mon Apr 30 18:22:48 2007
@@ -267,7 +267,25 @@
             assertEquals( artifact.getGroupId().equals( "one" ), !file.exists() );
         }
     }
+    public void testExcludeMultipleGroupIds()
+        throws Exception
+    {
+        mojo.project.setArtifacts( stubFactory.getGroupIdArtifacts() );
+        mojo.project.setDependencyArtifacts( new HashSet() );
+        mojo.excludeGroupIds = "one,two";
+        mojo.execute();
 
+        Iterator iter = mojo.project.getArtifacts().iterator();
+        while ( iter.hasNext() )
+        {
+            Artifact artifact = (Artifact) iter.next();
+            String fileName = DependencyUtil.getFormattedFileName( artifact, false );
+            File file = new File( mojo.outputDirectory, fileName );
+
+            assertEquals( artifact.getGroupId().equals( "one" ) || artifact.getGroupId().equals(
"two" ), !file.exists() );
+        }
+    }
+    
     public void testExcludeClassifier()
         throws Exception
     {

Modified: maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/utils/filters/TestGroupIdFilter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/utils/filters/TestGroupIdFilter.java?view=diff&rev=533904&r1=533903&r2=533904
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/utils/filters/TestGroupIdFilter.java
(original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/utils/filters/TestGroupIdFilter.java
Mon Apr 30 18:22:48 2007
@@ -23,13 +23,16 @@
  * 
  */
 
+import java.lang.reflect.InvocationTargetException;
 import java.util.Iterator;
 import java.util.Set;
 
 import org.apache.maven.artifact.Artifact;
+import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.dependency.testUtils.AbstractArtifactFeatureFilterTestCase;
 import org.apache.maven.plugin.dependency.testUtils.ArtifactStubFactory;
 import org.apache.maven.plugin.dependency.utils.SilentLog;
+import org.apache.maven.plugin.logging.SystemStreamLog;
 
 /**
  * @author clove TestCases for GroupIdFilter
@@ -115,5 +118,27 @@
             assertTrue( artifact.getGroupId().equals( "two" ) );
 
         }
+    }
+    
+    public void testMultipleInclude() throws SecurityException, IllegalArgumentException,
NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException,
MojoExecutionException
+    {
+       ArtifactsFilter filter = new GroupIdFilter("one,two",null);
+       
+       assertEquals( 4, artifacts.size() );
+       
+       Set result = filter.filter( artifacts, new SilentLog() );
+       
+       assertEquals( 2, result.size() );       
+    }
+    
+    public void testMultipleExclude() throws SecurityException, IllegalArgumentException,
NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException,
MojoExecutionException
+    {
+       ArtifactsFilter filter = new GroupIdFilter(null,"one,two");
+       
+       assertEquals( 4, artifacts.size() );
+       
+       Set result = filter.filter( artifacts, new SilentLog() );
+       
+       assertEquals( 2, result.size() );       
     }
 }



Mime
View raw message