You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by jd...@apache.org on 2005/09/28 22:14:47 UTC
svn commit: r292286 - in /maven/components/trunk:
maven-core-it-verifier/src/main/java/org/apache/maven/it/ maven-core-it/
maven-core-it/it2003/ maven-core-it/it2003/src/
maven-core-it/it2003/src/main/ maven-core-it/it2003/src/main/java/
maven-core-it/...
Author: jdcasey
Date: Wed Sep 28 13:14:35 2005
New Revision: 292286
URL: http://svn.apache.org/viewcvs?rev=292286&view=rev
Log:
Adding file-pattern matching for expected results, along with ability to suppress the default maven.repo.local specification from verifier.properties...also, adding a test case for MNG-1021, to ensure the source artifact has the same build number as the main jar...I cannot reproduce the problem using this test...
Added:
maven/components/trunk/maven-core-it/it2003/
maven/components/trunk/maven-core-it/it2003/README.txt (with props)
maven/components/trunk/maven-core-it/it2003/cli-options.txt (with props)
maven/components/trunk/maven-core-it/it2003/expected-results.txt (with props)
maven/components/trunk/maven-core-it/it2003/goals.txt (with props)
maven/components/trunk/maven-core-it/it2003/pom.xml (with props)
maven/components/trunk/maven-core-it/it2003/settings.xml (with props)
maven/components/trunk/maven-core-it/it2003/src/
maven/components/trunk/maven-core-it/it2003/src/main/
maven/components/trunk/maven-core-it/it2003/src/main/java/
maven/components/trunk/maven-core-it/it2003/src/main/java/org/
maven/components/trunk/maven-core-it/it2003/src/main/java/org/apache/
maven/components/trunk/maven-core-it/it2003/src/main/java/org/apache/maven/
maven/components/trunk/maven-core-it/it2003/src/main/java/org/apache/maven/it2003/
maven/components/trunk/maven-core-it/it2003/src/main/java/org/apache/maven/it2003/Person.java (with props)
maven/components/trunk/maven-core-it/it2003/verifier.properties (with props)
Modified:
maven/components/trunk/maven-core-it-verifier/src/main/java/org/apache/maven/it/Verifier.java
maven/components/trunk/maven-core-it/README.txt
Modified: maven/components/trunk/maven-core-it-verifier/src/main/java/org/apache/maven/it/Verifier.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it-verifier/src/main/java/org/apache/maven/it/Verifier.java?rev=292286&r1=292285&r2=292286&view=diff
==============================================================================
--- maven/components/trunk/maven-core-it-verifier/src/main/java/org/apache/maven/it/Verifier.java (original)
+++ maven/components/trunk/maven-core-it-verifier/src/main/java/org/apache/maven/it/Verifier.java Wed Sep 28 13:14:35 2005
@@ -518,19 +518,63 @@
{
expectedFile = new File( basedir, line );
}
-
- if ( !expectedFile.exists() )
+
+ if ( line.indexOf( '*' ) > -1 )
{
- if ( wanted )
+ File parent = expectedFile.getParentFile();
+
+ if ( !parent.exists() )
+ {
+ if ( wanted )
+ {
+ throw new VerificationException( "Expected file was not found: " + expectedFile.getPath() );
+ }
+ }
+ else
{
- throw new VerificationException( "Expected file was not found: " + expectedFile.getPath() );
+ String shortNamePattern = expectedFile.getName().replaceAll( "\\*", ".*" );
+
+ String[] candidates = parent.list();
+
+ boolean found = false;
+
+ if ( candidates != null )
+ {
+ for ( int i = 0; i < candidates.length; i++ )
+ {
+ if ( candidates[i].matches( shortNamePattern ) )
+ {
+ found = true;
+ break;
+ }
+ }
+ }
+
+ if ( !found && wanted )
+ {
+ throw new VerificationException( "Expected file pattern was not found: " + expectedFile.getPath() );
+ }
+ else if ( found && !wanted )
+ {
+ throw new VerificationException( "Unwanted file pattern was found: " + expectedFile.getPath() );
+ }
}
}
else
{
- if ( !wanted )
+ if ( !expectedFile.exists() )
+ {
+ if ( wanted )
+ {
+ throw new VerificationException( "Expected file was not found: " + expectedFile.getPath() );
+ }
+ }
+ else
{
- throw new VerificationException( "Unwanted file was found: " + expectedFile.getPath() );
+ if ( !wanted )
+ {
+ throw new VerificationException( "Unwanted file was found: " + expectedFile.getPath() );
+ }
}
}
}
@@ -540,7 +584,7 @@
//
// ----------------------------------------------------------------------
- public void executeGoals( Properties properties, String filename )
+ public void executeGoals( Properties properties, Properties controlProperties, String filename )
throws VerificationException
{
String mavenHome = System.getProperty( "maven.home" );
@@ -583,7 +627,10 @@
for ( Iterator it = cliOptions.iterator(); it.hasNext(); )
{
String key = (String) it.next();
- cli.createArgument().setLine( key );
+
+ String resolvedArg = resolveCommandLineArg( key );
+
+ cli.createArgument().setLine( resolvedArg );
}
cli.createArgument().setValue( "-e" );
@@ -598,9 +645,13 @@
cli.createArgument().setLine( "-D" + key + "=" + properties.getProperty( key ) );
}
- // Note: Make sure that the repo is surrounded by quotes as it can possibly have
- // spaces in its path.
- cli.createArgument().setLine( "-Dmaven.repo.local=" + "\"" + localRepo + "\"" );
+ boolean useMavenRepoLocal = Boolean.valueOf( controlProperties.getProperty( "use.mavenRepoLocal", "true" ) ).booleanValue();
+ if ( useMavenRepoLocal )
+ {
+ // Note: Make sure that the repo is surrounded by quotes as it can possibly have
+ // spaces in its path.
+ cli.createArgument().setLine( "-Dmaven.repo.local=" + "\"" + localRepo + "\"" );
+ }
for ( Iterator i = allGoals.iterator(); i.hasNext(); )
{
@@ -636,6 +687,15 @@
}
}
+ private String resolveCommandLineArg( String key )
+ {
+ String result = key.replaceAll( "\\$\\{basedir\\}", basedir );
+ result = result.replaceAll( "\\\\", "\\" );
+ result = result.replaceAll( "\\/\\/", "\\/" );
+
+ return result;
+ }
+
private void displayLogFile()
{
System.out.println( "Log file contents:" );
@@ -746,7 +806,7 @@
boolean chokeOnErrorOutput = Boolean.valueOf(
controlProperties.getProperty( "failOnErrorOutput", "true" ) ).booleanValue();
- verifier.executeGoals( properties, "goals.txt" );
+ verifier.executeGoals( properties, controlProperties, "goals.txt" );
verifier.executeHook( "postbuild-hook.txt" );
Modified: maven/components/trunk/maven-core-it/README.txt
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/README.txt?rev=292286&r1=292285&r2=292286&view=diff
==============================================================================
--- maven/components/trunk/maven-core-it/README.txt (original)
+++ maven/components/trunk/maven-core-it/README.txt Wed Sep 28 13:14:35 2005
@@ -291,5 +291,14 @@
that transitive dependencies can be resolved from repositories defined
in the top-level pom.xml. See MNG-757.
+
+it2002: Test the release plugin.
+
+it2003: Test that source artifacts share the same build number as the main
+ project artifact. This is only defined in the 2000 series because of
+ the exorbitant time it takes to execute (it uses a uniquely defined
+ local repository, to avoid pollution from existing artifacts in
+ pattern matching of the results).
+
-------------------------------------------------------------------------------
Added: maven/components/trunk/maven-core-it/it2003/README.txt
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/it2003/README.txt?rev=292286&view=auto
==============================================================================
--- maven/components/trunk/maven-core-it/it2003/README.txt (added)
+++ maven/components/trunk/maven-core-it/it2003/README.txt Wed Sep 28 13:14:35 2005
@@ -0,0 +1,3 @@
+This should be defined as a 00-series IT, but it takes WAY too long to run, so
+I'm putting it in the 20-series. You should use the same method for running this
+test as you would any single test in the 00 series.
Propchange: maven/components/trunk/maven-core-it/it2003/README.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/trunk/maven-core-it/it2003/README.txt
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/components/trunk/maven-core-it/it2003/cli-options.txt
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/it2003/cli-options.txt?rev=292286&view=auto
==============================================================================
--- maven/components/trunk/maven-core-it/it2003/cli-options.txt (added)
+++ maven/components/trunk/maven-core-it/it2003/cli-options.txt Wed Sep 28 13:14:35 2005
@@ -0,0 +1 @@
+--settings ${basedir}/settings.xml
Propchange: maven/components/trunk/maven-core-it/it2003/cli-options.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/trunk/maven-core-it/it2003/cli-options.txt
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/components/trunk/maven-core-it/it2003/expected-results.txt
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/it2003/expected-results.txt?rev=292286&view=auto
==============================================================================
--- maven/components/trunk/maven-core-it/it2003/expected-results.txt (added)
+++ maven/components/trunk/maven-core-it/it2003/expected-results.txt Wed Sep 28 13:14:35 2005
@@ -0,0 +1,2 @@
+target/test-repo/org/apache/maven/it/maven-core-it2003/1.0-SNAPSHOT/maven-core-it2003-1.0-*-1.jar
+target/test-repo/org/apache/maven/it/maven-core-it2003/1.0-SNAPSHOT/maven-core-it2003-1.0-*-1-sources.jar
Propchange: maven/components/trunk/maven-core-it/it2003/expected-results.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/trunk/maven-core-it/it2003/expected-results.txt
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/components/trunk/maven-core-it/it2003/goals.txt
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/it2003/goals.txt?rev=292286&view=auto
==============================================================================
--- maven/components/trunk/maven-core-it/it2003/goals.txt (added)
+++ maven/components/trunk/maven-core-it/it2003/goals.txt Wed Sep 28 13:14:35 2005
@@ -0,0 +1 @@
+deploy
Propchange: maven/components/trunk/maven-core-it/it2003/goals.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/trunk/maven-core-it/it2003/goals.txt
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/components/trunk/maven-core-it/it2003/pom.xml
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/it2003/pom.xml?rev=292286&view=auto
==============================================================================
--- maven/components/trunk/maven-core-it/it2003/pom.xml (added)
+++ maven/components/trunk/maven-core-it/it2003/pom.xml Wed Sep 28 13:14:35 2005
@@ -0,0 +1,31 @@
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven.it</groupId>
+ <artifactId>maven-core-it2003</artifactId>
+ <version>1.0-SNAPSHOT</version>
+
+ <distributionManagement>
+ <snapshotRepository>
+ <id>test-repo</id>
+ <url>file:target/test-repo</url>
+ </snapshotRepository>
+ </distributionManagement>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-source-plugin</artifactId>
+
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Propchange: maven/components/trunk/maven-core-it/it2003/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/trunk/maven-core-it/it2003/pom.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/components/trunk/maven-core-it/it2003/settings.xml
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/it2003/settings.xml?rev=292286&view=auto
==============================================================================
--- maven/components/trunk/maven-core-it/it2003/settings.xml (added)
+++ maven/components/trunk/maven-core-it/it2003/settings.xml Wed Sep 28 13:14:35 2005
@@ -0,0 +1,3 @@
+<settings>
+ <localRepository>file:target/local-repo</localRepository>
+</settings>
Propchange: maven/components/trunk/maven-core-it/it2003/settings.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/trunk/maven-core-it/it2003/settings.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/components/trunk/maven-core-it/it2003/src/main/java/org/apache/maven/it2003/Person.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/it2003/src/main/java/org/apache/maven/it2003/Person.java?rev=292286&view=auto
==============================================================================
--- maven/components/trunk/maven-core-it/it2003/src/main/java/org/apache/maven/it2003/Person.java (added)
+++ maven/components/trunk/maven-core-it/it2003/src/main/java/org/apache/maven/it2003/Person.java Wed Sep 28 13:14:35 2005
@@ -0,0 +1,6 @@
+package org.apache.maven.it2003;
+
+public class Person
+{
+ private String name;
+}
Propchange: maven/components/trunk/maven-core-it/it2003/src/main/java/org/apache/maven/it2003/Person.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/trunk/maven-core-it/it2003/src/main/java/org/apache/maven/it2003/Person.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/components/trunk/maven-core-it/it2003/verifier.properties
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/it2003/verifier.properties?rev=292286&view=auto
==============================================================================
--- maven/components/trunk/maven-core-it/it2003/verifier.properties (added)
+++ maven/components/trunk/maven-core-it/it2003/verifier.properties Wed Sep 28 13:14:35 2005
@@ -0,0 +1 @@
+use.mavenRepoLocal=false
Propchange: maven/components/trunk/maven-core-it/it2003/verifier.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/trunk/maven-core-it/it2003/verifier.properties
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org