maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r575628 - in /maven/shared/trunk/maven-common-artifact-filters: ./ src/main/java/org/apache/maven/shared/artifact/filter/ src/test/java/org/apache/maven/shared/artifact/filter/
Date Fri, 14 Sep 2007 11:28:30 GMT
Author: markh
Date: Fri Sep 14 04:28:29 2007
New Revision: 575628

URL: http://svn.apache.org/viewvc?rev=575628&view=rev
Log:
o Fixed StrictPatternArtifactFilters to use base version - this allows SNAPSHOT patterns to
match artifacts with timestamp snapshot versions
o Upgraded maven-artifact to 2.0.8-SNAPSHOT for proper artifact base version setting introduced
in r566206

Modified:
    maven/shared/trunk/maven-common-artifact-filters/pom.xml
    maven/shared/trunk/maven-common-artifact-filters/src/main/java/org/apache/maven/shared/artifact/filter/AbstractStrictPatternArtifactFilter.java
    maven/shared/trunk/maven-common-artifact-filters/src/test/java/org/apache/maven/shared/artifact/filter/AbstractStrictPatternArtifactFilterTest.java

Modified: maven/shared/trunk/maven-common-artifact-filters/pom.xml
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-common-artifact-filters/pom.xml?rev=575628&r1=575627&r2=575628&view=diff
==============================================================================
--- maven/shared/trunk/maven-common-artifact-filters/pom.xml (original)
+++ maven/shared/trunk/maven-common-artifact-filters/pom.xml Fri Sep 14 04:28:29 2007
@@ -15,7 +15,7 @@
     <dependency>
       <groupId>org.apache.maven</groupId>
       <artifactId>maven-artifact</artifactId>
-      <version>2.0.2</version>
+      <version>2.0.8-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.codehaus.plexus</groupId>

Modified: maven/shared/trunk/maven-common-artifact-filters/src/main/java/org/apache/maven/shared/artifact/filter/AbstractStrictPatternArtifactFilter.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-common-artifact-filters/src/main/java/org/apache/maven/shared/artifact/filter/AbstractStrictPatternArtifactFilter.java?rev=575628&r1=575627&r2=575628&view=diff
==============================================================================
--- maven/shared/trunk/maven-common-artifact-filters/src/main/java/org/apache/maven/shared/artifact/filter/AbstractStrictPatternArtifactFilter.java
(original)
+++ maven/shared/trunk/maven-common-artifact-filters/src/main/java/org/apache/maven/shared/artifact/filter/AbstractStrictPatternArtifactFilter.java
Fri Sep 14 04:28:29 2007
@@ -112,8 +112,12 @@
      */
     private boolean include( Artifact artifact, String pattern )
     {
-        String[] tokens =
-            new String[] { artifact.getGroupId(), artifact.getArtifactId(), artifact.getType(),
artifact.getVersion() };
+        String[] tokens = new String[] {
+            artifact.getGroupId(),
+            artifact.getArtifactId(),
+            artifact.getType(),
+            artifact.getBaseVersion()
+        };
 
         String[] patternTokens = pattern.split( ":" );
 

Modified: maven/shared/trunk/maven-common-artifact-filters/src/test/java/org/apache/maven/shared/artifact/filter/AbstractStrictPatternArtifactFilterTest.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-common-artifact-filters/src/test/java/org/apache/maven/shared/artifact/filter/AbstractStrictPatternArtifactFilterTest.java?rev=575628&r1=575627&r2=575628&view=diff
==============================================================================
--- maven/shared/trunk/maven-common-artifact-filters/src/test/java/org/apache/maven/shared/artifact/filter/AbstractStrictPatternArtifactFilterTest.java
(original)
+++ maven/shared/trunk/maven-common-artifact-filters/src/test/java/org/apache/maven/shared/artifact/filter/AbstractStrictPatternArtifactFilterTest.java
Fri Sep 14 04:28:29 2007
@@ -51,10 +51,7 @@
      */
     protected void setUp() throws Exception
     {
-        VersionRange version = VersionRange.createFromVersion( "version" );
-        ArtifactHandler handler = new DefaultArtifactHandler();
-
-        artifact = new DefaultArtifact( "groupId", "artifactId", version, null, "type", null,
handler );
+        artifact = createArtifact( "groupId", "artifactId", "type", "version" );
     }
 
     // tests ------------------------------------------------------------------
@@ -314,7 +311,35 @@
         assertIncluded( "group*:*Id:*:version" );
     }
 
+    public void testSnapshotVersion()
+    {
+        artifact = createArtifact( "groupId", "artifactId", "type", "version-12345678.123456-1"
);
+
+        assertIncluded( ":::*-SNAPSHOT" );
+    }
+
     // protected methods ------------------------------------------------------
+
+    /**
+     * Creates an artifact with the specified attributes.
+     * 
+     * @param groupId
+     *            the group id for the new artifact
+     * @param artifactId
+     *            the artifact id for the new artifact
+     * @param type
+     *            the type for the new artifact
+     * @param version
+     *            the version for the new artifact
+     * @return the artifact
+     */
+    protected Artifact createArtifact( String groupId, String artifactId, String type, String
version )
+    {
+        VersionRange versionRange = VersionRange.createFromVersion( version );
+        ArtifactHandler handler = new DefaultArtifactHandler();
+
+        return new DefaultArtifact( groupId, artifactId, versionRange, null, type, null,
handler );
+    }
 
     /**
      * Asserts that the specified pattern is included by the filter being tested.



Mime
View raw message