Author: brianf
Date: Tue Jan  1 19:58:53 2008
New Revision: 607995

URL: http://svn.apache.org/viewvc?rev=607995&view=rev
Log:
finished cleanup

Added:
    
maven/shared/branches/maven-common-artifact-filters-brianf/src/main/java/org/apache/maven/shared/artifact/filter/collection/ArtifactFilterException.java
    
maven/shared/branches/maven-common-artifact-filters-brianf/src/test/java/org/apache/maven/shared/artifact/filter/collection/AbstractArtifactFeatureFilterTestCase.java
Modified:
    
maven/shared/branches/maven-common-artifact-filters-brianf/src/main/java/org/apache/maven/shared/artifact/filter/collection/AbstractArtifactsFilter.java
    
maven/shared/branches/maven-common-artifact-filters-brianf/src/main/java/org/apache/maven/shared/artifact/filter/collection/ArtifactsFilter.java

Modified: 
maven/shared/branches/maven-common-artifact-filters-brianf/src/main/java/org/apache/maven/shared/artifact/filter/collection/AbstractArtifactsFilter.java
URL: 
http://svn.apache.org/viewvc/maven/shared/branches/maven-common-artifact-filters-brianf/src/main/java/org/apache/maven/shared/artifact/filter/collection/AbstractArtifactsFilter.java?rev=607995&r1=607994&r2=607995&view=diff
==============================================================================
--- 
maven/shared/branches/maven-common-artifact-filters-brianf/src/main/java/org/apache/maven/shared/artifact/filter/collection/AbstractArtifactsFilter.java
 (original)
+++ 
maven/shared/branches/maven-common-artifact-filters-brianf/src/main/java/org/apache/maven/shared/artifact/filter/collection/AbstractArtifactsFilter.java
 Tue Jan  1 19:58:53 2008
@@ -30,9 +30,9 @@
     /**
      * @author <a href="mailto:[EMAIL PROTECTED]">Brian Fox</a>
      * @version $Id$
+     * @throws ArtifactFilterException 
      */
-    public boolean okToProcess( Artifact artifact )
-        throws ArtifactFilterException
+    public boolean isArtifactIncluded( Artifact artifact ) throws 
ArtifactFilterException
     {
         Set set = new HashSet();
         set.add( artifact );

Added: 
maven/shared/branches/maven-common-artifact-filters-brianf/src/main/java/org/apache/maven/shared/artifact/filter/collection/ArtifactFilterException.java
URL: 
http://svn.apache.org/viewvc/maven/shared/branches/maven-common-artifact-filters-brianf/src/main/java/org/apache/maven/shared/artifact/filter/collection/ArtifactFilterException.java?rev=607995&view=auto
==============================================================================
--- 
maven/shared/branches/maven-common-artifact-filters-brianf/src/main/java/org/apache/maven/shared/artifact/filter/collection/ArtifactFilterException.java
 (added)
+++ 
maven/shared/branches/maven-common-artifact-filters-brianf/src/main/java/org/apache/maven/shared/artifact/filter/collection/ArtifactFilterException.java
 Tue Jan  1 19:58:53 2008
@@ -0,0 +1,54 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.    
+ */
+package org.apache.maven.shared.artifact.filter.collection;
+
+/**
+ * @author <a href="mailto:[EMAIL PROTECTED]">Brian Fox</a>
+ */
+public class ArtifactFilterException
+    extends Exception
+{
+
+   
+    /**
+     * 
+     */
+    private static final long serialVersionUID = 1L;
+
+    public ArtifactFilterException()
+    {
+        super();
+    }
+
+    public ArtifactFilterException( String theMessage, Throwable theCause )
+    {
+        super( theMessage, theCause );
+    }
+
+    public ArtifactFilterException( String theMessage )
+    {
+        super( theMessage );
+    }
+
+    public ArtifactFilterException( Throwable theCause )
+    {
+        super( theCause );
+    }
+
+}

Modified: 
maven/shared/branches/maven-common-artifact-filters-brianf/src/main/java/org/apache/maven/shared/artifact/filter/collection/ArtifactsFilter.java
URL: 
http://svn.apache.org/viewvc/maven/shared/branches/maven-common-artifact-filters-brianf/src/main/java/org/apache/maven/shared/artifact/filter/collection/ArtifactsFilter.java?rev=607995&r1=607994&r2=607995&view=diff
==============================================================================
--- 
maven/shared/branches/maven-common-artifact-filters-brianf/src/main/java/org/apache/maven/shared/artifact/filter/collection/ArtifactsFilter.java
 (original)
+++ 
maven/shared/branches/maven-common-artifact-filters-brianf/src/main/java/org/apache/maven/shared/artifact/filter/collection/ArtifactsFilter.java
 Tue Jan  1 19:58:53 2008
@@ -36,6 +36,6 @@
     Set filter( Set artifacts )
         throws ArtifactFilterException;
 
-    boolean okToProcess( Artifact artifact )
+    boolean isArtifactIncluded( Artifact artifact )
         throws ArtifactFilterException;
 }

Added: 
maven/shared/branches/maven-common-artifact-filters-brianf/src/test/java/org/apache/maven/shared/artifact/filter/collection/AbstractArtifactFeatureFilterTestCase.java
URL: 
http://svn.apache.org/viewvc/maven/shared/branches/maven-common-artifact-filters-brianf/src/test/java/org/apache/maven/shared/artifact/filter/collection/AbstractArtifactFeatureFilterTestCase.java?rev=607995&view=auto
==============================================================================
--- 
maven/shared/branches/maven-common-artifact-filters-brianf/src/test/java/org/apache/maven/shared/artifact/filter/collection/AbstractArtifactFeatureFilterTestCase.java
 (added)
+++ 
maven/shared/branches/maven-common-artifact-filters-brianf/src/test/java/org/apache/maven/shared/artifact/filter/collection/AbstractArtifactFeatureFilterTestCase.java
 Tue Jan  1 19:58:53 2008
@@ -0,0 +1,133 @@
+package org.apache.maven.shared.artifact.filter.collection;
+
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.    
+ */
+
+/**
+ * 
+ */
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import junit.framework.TestCase;
+
+/**
+ * Abstract test case for subclasses of AbstractArtifactFeatureFilter
+ * 
+ * @author clove
+ * @see junit.framework.TestCase
+ * @see 
org.apache.maven.plugin.dependency.utils.filters.AbstractArtifactFeatureFilter
+ * @since 2.0
+ */
+public abstract class AbstractArtifactFeatureFilterTestCase
+    extends TestCase
+{
+    protected Set artifacts = new HashSet();
+
+    protected Class filterClass;
+
+    protected void setUp()
+        throws Exception
+    {
+        super.setUp();
+
+    }
+
+    private Object createObjectViaReflection( Class clazz, Object[] conArgs )
+        throws SecurityException, NoSuchMethodException, 
IllegalArgumentException, InstantiationException,
+        IllegalAccessException, InvocationTargetException
+    {
+        Class[] argslist = new Class[2];
+        argslist[0] = String.class;
+        argslist[1] = String.class;
+        Constructor ct = clazz.getConstructor( argslist );
+        return ct.newInstance( conArgs );
+    }
+
+    public abstract void testParsing()
+        throws Exception;
+
+    public void parsing()
+        throws SecurityException, NoSuchMethodException, 
IllegalArgumentException, InstantiationException,
+        IllegalAccessException, InvocationTargetException
+    {
+        Object[] conArgs = new Object[] { "one,two", "three,four," };
+
+        AbstractArtifactFeatureFilter filter =
+            (AbstractArtifactFeatureFilter) createObjectViaReflection( 
filterClass, conArgs );
+        List includes = filter.getIncludes();
+        List excludes = filter.getExcludes();
+
+        assertEquals( 2, includes.size() );
+        assertEquals( 2, excludes.size() );
+        assertEquals( "one", includes.get( 0 ).toString() );
+        assertEquals( "two", includes.get( 1 ).toString() );
+        assertEquals( "three", excludes.get( 0 ).toString() );
+        assertEquals( "four", excludes.get( 1 ).toString() );
+    }
+
+    public abstract void testFiltering()
+        throws Exception;
+
+    public Set filtering()
+        throws SecurityException, IllegalArgumentException, 
NoSuchMethodException, InstantiationException,
+        IllegalAccessException, InvocationTargetException
+    {
+        Object[] conArgs = new Object[] { "one,two", "one,three," };
+        AbstractArtifactFeatureFilter filter =
+            (AbstractArtifactFeatureFilter) createObjectViaReflection( 
filterClass, conArgs );
+        Set result = filter.filter( artifacts );
+        assertEquals( 1, result.size() );
+        return result;
+    }
+
+    public abstract void testFiltering2()
+        throws Exception;
+
+    public Set filtering2()
+        throws SecurityException, IllegalArgumentException, 
NoSuchMethodException, InstantiationException,
+        IllegalAccessException, InvocationTargetException
+    {
+        Object[] conArgs = new Object[] { null, "one,three," };
+        AbstractArtifactFeatureFilter filter =
+            (AbstractArtifactFeatureFilter) createObjectViaReflection( 
filterClass, conArgs );
+        Set result = filter.filter( artifacts );
+        assertEquals( 2, result.size() );
+        return result;
+
+    }
+
+    public abstract void testFiltering3()
+        throws Exception;
+
+    public void filtering3()
+        throws SecurityException, IllegalArgumentException, 
NoSuchMethodException, InstantiationException,
+        IllegalAccessException, InvocationTargetException
+    {
+        Object[] conArgs = new Object[] { null, null };
+        AbstractArtifactFeatureFilter filter =
+            (AbstractArtifactFeatureFilter) createObjectViaReflection( 
filterClass, conArgs );
+        Set result = filter.filter( artifacts );
+        assertEquals( 4, result.size() );
+    }
+}


Reply via email to