[MNG-3057] finally got IT for 3057 fixed.

git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@745951 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2009-02-19 18:11:43 +00:00
parent ac63225d5c
commit d2708c5060
1 changed files with 21 additions and 11 deletions

View File

@ -23,9 +23,12 @@ import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.net.URI;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Properties; import java.util.Properties;
import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
@ -70,23 +73,26 @@ public class MavenITmng3057VersionExprTransformations
{ {
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3057" ); File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3057" );
String remoteRepo = new File( testDir, "target/deployment" ).toURL().toExternalForm(); URI remoteRepo = new File( testDir, "target/deployment" ).toURI();
Verifier verifier = new Verifier( testDir.getAbsolutePath() ); Verifier verifier = new Verifier( testDir.getAbsolutePath() );
verifier.deleteArtifact( "org.apache.maven.its.mng3057", "mng-3057", "1", "pom" ); verifier.deleteArtifacts( "org.apache.maven.its.mng3057" );
verifier.deleteArtifact( "org.apache.maven.its.mng3057", "level2", "1", "pom" );
verifier.deleteArtifact( "org.apache.maven.its.mng3057", "level3", "1", "pom" );
verifier.deleteArtifact( "org.apache.maven.its.mng3057", "level3", "1", "jar" );
Properties properties = verifier.newDefaultFilterProperties(); Properties properties = verifier.newDefaultFilterProperties();
properties.setProperty( "@deployTo@", remoteRepo ); properties.setProperty( "@deployTo@", remoteRepo.toURL().toExternalForm() );
verifier.filterFile( "pom.xml", "pom.xml", "UTF-8", properties ); verifier.filterFile( "pom.xml", "pom.xml", "UTF-8", properties );
List cliOptions = new ArrayList(); List cliOptions = new ArrayList();
cliOptions.add( "-V" );
cliOptions.add( "-DtestVersion=1" ); cliOptions.add( "-DtestVersion=1" );
verifier.setCliOptions( cliOptions ); verifier.setCliOptions( cliOptions );
// Map envars = new HashMap();
// envars.put( "MAVEN_OPTS", "-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,address=5005 -Djava.compiler=NONE" );
// verifier.executeGoal( "deploy", envars );
verifier.executeGoal( "deploy" ); verifier.executeGoal( "deploy" );
verifier.verifyErrorFreeLog(); verifier.verifyErrorFreeLog();
verifier.resetStreams(); verifier.resetStreams();
@ -95,9 +101,9 @@ public class MavenITmng3057VersionExprTransformations
assertVersionExpressions( new File( verifier.getArtifactPath( "org.apache.maven.its.mng3057", "level2", "1", "pom" ) ) ); assertVersionExpressions( new File( verifier.getArtifactPath( "org.apache.maven.its.mng3057", "level2", "1", "pom" ) ) );
assertVersionExpressions( new File( verifier.getArtifactPath( "org.apache.maven.its.mng3057", "level3", "1", "pom" ) ) ); assertVersionExpressions( new File( verifier.getArtifactPath( "org.apache.maven.its.mng3057", "level3", "1", "pom" ) ) );
assertVersionExpressions( new File( remoteRepo, "org/apache/maven/its/mng3057/mng-3057/1/mng-3057-1.pom" ) ); assertVersionExpressions( new File( remoteRepo.getPath(), "org/apache/maven/its/mng3057/mng-3057/1/mng-3057-1.pom" ) );
assertVersionExpressions( new File( remoteRepo, "org/apache/maven/its/mng3057/level2/1/level2-1.pom" ) ); assertVersionExpressions( new File( remoteRepo.getPath(), "org/apache/maven/its/mng3057/level2/1/level2-1.pom" ) );
assertVersionExpressions( new File( remoteRepo, "org/apache/maven/its/mng3057/level3/1/level3-1.pom" ) ); assertVersionExpressions( new File( remoteRepo.getPath(), "org/apache/maven/its/mng3057/level3/1/level3-1.pom" ) );
} }
private void assertVersionExpressions( File pomFile ) private void assertVersionExpressions( File pomFile )
@ -106,13 +112,17 @@ public class MavenITmng3057VersionExprTransformations
Verifier verifier = new Verifier( pomFile.getParentFile().getAbsolutePath() ); Verifier verifier = new Verifier( pomFile.getParentFile().getAbsolutePath() );
List cliOptions = new ArrayList(); List cliOptions = new ArrayList();
cliOptions.add( "-f" ); cliOptions.add( "-V" );
cliOptions.add( "-N" );
cliOptions.add( "-Dexpression.outputFile=expressions.properties" ); cliOptions.add( "-Dexpression.outputFile=expressions.properties" );
cliOptions.add( "-Dexpression.expressions=" + StringUtils.join( VERIFICATION_EXPRESSIONS.iterator(), "," ) ); cliOptions.add( "-Dexpression.expressions=" + StringUtils.join( VERIFICATION_EXPRESSIONS.iterator(), "," ) );
cliOptions.add( "-f" );
cliOptions.add( pomFile.getName() ); cliOptions.add( pomFile.getName() );
verifier.setCliOptions( cliOptions ); verifier.setCliOptions( cliOptions );
verifier.setAutoclean( false );
verifier.executeGoal( "org.apache.maven.its.plugins:maven-it-plugin-expression:eval" ); verifier.executeGoal( "org.apache.maven.its.plugins:maven-it-plugin-expression:eval" );
verifier.verifyErrorFreeLog(); verifier.verifyErrorFreeLog();
verifier.resetStreams(); verifier.resetStreams();