o Set log file name up front to make sure the final location of a build log does not depend on whether the test failed/passed

git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@709936 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2008-11-02 21:15:48 +00:00
parent e6686add99
commit c5df24b1b0
10 changed files with 29 additions and 63 deletions

View File

@ -42,11 +42,11 @@ public class MavenIT0069Test
// phase 1: run build in online mode to fill local repo
Verifier verifier = new Verifier( testDir.getAbsolutePath() );
verifier.deleteArtifacts( "org.apache.maven.its.it0069" );
verifier.setLogFileName( "log1.txt" );
verifier.executeGoal( "org.apache.maven.its.plugins:maven-it-plugin-dependency-resolution:2.1-SNAPSHOT:compile" );
verifier.assertFilePresent( "target/compile.txt" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
new File( testDir, "log.txt").renameTo( new File( testDir, "log1.txt" ) );
}
{
@ -56,11 +56,11 @@ public class MavenIT0069Test
List cliOptions = new ArrayList();
cliOptions.add( "-o" );
verifier.setCliOptions( cliOptions );
verifier.setLogFileName( "log2.txt" );
verifier.executeGoal( "org.apache.maven.its.plugins:maven-it-plugin-dependency-resolution:2.1-SNAPSHOT:compile" );
verifier.assertFilePresent( "target/compile.txt" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
new File( testDir, "log.txt").renameTo( new File( testDir, "log2.txt" ) );
}
{
@ -70,6 +70,7 @@ public class MavenIT0069Test
List cliOptions = new ArrayList();
cliOptions.add( "-o" );
verifier.setCliOptions( cliOptions );
verifier.setLogFileName( "log3.txt" );
try
{
verifier.executeGoal( "org.apache.maven.its.plugins:maven-it-plugin-dependency-resolution:2.1-SNAPSHOT:compile" );
@ -80,7 +81,6 @@ public class MavenIT0069Test
// expected, should fail
}
verifier.resetStreams();
new File( testDir, "log.txt").renameTo( new File( testDir, "log3.txt" ) );
}
}

View File

@ -64,6 +64,7 @@ public class MavenITmng2339BadProjectInterpolationTest
verifier = new Verifier( testDir.getAbsolutePath() );
verifier.setLogFileName( "log-pom-specified.txt" );
verifier.executeGoal( "initialize" );
assertTrue( "Touchfile using ${project.version} for ${version} does not exist.",
@ -72,21 +73,17 @@ public class MavenITmng2339BadProjectInterpolationTest
verifier.verifyErrorFreeLog();
verifier.resetStreams();
File logFile = new File( testDir, "log.txt" );
logFile.renameTo( new File( testDir, "log-pom-specified.txt" ) );
verifier = new Verifier( testDir.getAbsolutePath() );
List cliOptions = new ArrayList();
cliOptions.add( "-Dversion=2" );
verifier.setCliOptions( cliOptions );
verifier.setLogFileName( "log-cli-specified.txt" );
verifier.executeGoal( "initialize" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
logFile.renameTo( new File( testDir, "log-cli-specified.txt" ) );
assertTrue( "Touchfile using CLI-specified ${version} does not exist.",
new File( testDir, "target/touch-2.txt" ).exists() );
}

View File

@ -20,7 +20,6 @@ package org.apache.maven.it;
*/
import org.apache.maven.it.Verifier;
import org.apache.maven.it.util.FileUtils;
import org.apache.maven.it.util.ResourceExtractor;
import java.io.File;
@ -57,12 +56,12 @@ public class MavenITmng2695OfflinePluginSnapshotsTest
verifier.deleteDirectory( "target" );
verifier.deleteArtifacts( "org.apache.maven.its.mng2695" );
verifier.setAutoclean( false );
verifier.setLogFileName( "log1.txt" );
verifier.executeGoal( "validate" );
verifier.assertFilePresent( "target/a.txt" );
verifier.assertFilePresent( "target/b.txt" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
new File( testDir, "log.txt").renameTo( new File( testDir, "log1.txt" ) );
}
{
@ -71,12 +70,12 @@ public class MavenITmng2695OfflinePluginSnapshotsTest
verifier.deleteDirectory( "target" );
verifier.setAutoclean( false );
verifier.setCliOptions( Collections.singletonList( "-o" ) );
verifier.setLogFileName( "log2.txt" );
verifier.executeGoal( "validate" );
verifier.assertFilePresent( "target/a.txt" );
verifier.assertFilePresent( "target/b.txt" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
new File( testDir, "log.txt").renameTo( new File( testDir, "log2.txt" ) );
}
}

View File

@ -51,6 +51,7 @@ public class MavenITmng3221InfiniteForkingTest
verifier.deleteArtifact( "org.apache.maven.its.mng3221", "maven-forking-report-plugin", "1", "jar" );
verifier.setLogFileName( "mng-3221-a-log.txt" );
verifier.executeGoal( "install" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
@ -61,6 +62,7 @@ public class MavenITmng3221InfiniteForkingTest
cliOptions.add( "-Psite" );
verifier.setCliOptions( cliOptions );
verifier.setLogFileName( "mng-3221-a-log.txt" );
verifier.executeGoal( "site" );
verifier.verifyErrorFreeLog();
}
@ -70,11 +72,6 @@ public class MavenITmng3221InfiniteForkingTest
{
verifier.resetStreams();
}
File logFile = new File( projectDir, "log.txt" );
File logFileBackup = new File( logBackupDir, "mng-3221-a-log.txt" );
logFile.renameTo( logFileBackup );
}
}
@ -95,6 +92,7 @@ public class MavenITmng3221InfiniteForkingTest
verifier.deleteArtifact( "org.apache.maven.its.mng3221", "maven-forking-test-plugin", "1", "jar" );
verifier.setLogFileName( "mng-3221-b-log.txt" );
verifier.executeGoal( "install" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
@ -105,6 +103,7 @@ public class MavenITmng3221InfiniteForkingTest
cliOptions.add( "-Pplugin" );
verifier.setCliOptions( cliOptions );
verifier.setLogFileName( "mng-3221-b-log.txt" );
verifier.executeGoal( "package" );
verifier.verifyErrorFreeLog();
}
@ -114,11 +113,6 @@ public class MavenITmng3221InfiniteForkingTest
{
verifier.resetStreams();
}
File logFile = new File( projectDir, "log.txt" );
File logFileBackup = new File( logBackupDir, "mng-3221-b-log.txt" );
logFile.renameTo( logFileBackup );
}
}
}

View File

@ -56,22 +56,22 @@ public class MavenITmng3314OfflineSnapshotsTest
// phase 1: run build in online mode to fill local repo
Verifier verifier = new Verifier( testDir.getAbsolutePath() );
verifier.deleteArtifacts( "org.apache.maven.its.mng3314" );
verifier.setLogFileName( "log1.txt" );
verifier.executeGoal( "validate" );
verifier.assertFilePresent( "target/compile.txt" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
new File( testDir, "log.txt").renameTo( new File( testDir, "log1.txt" ) );
}
{
// phase 2: run build in offline mode to check it still passes
Verifier verifier = new Verifier( testDir.getAbsolutePath() );
verifier.setCliOptions( Collections.singletonList( "-o" ) );
verifier.setLogFileName( "log2.txt" );
verifier.executeGoal( "validate" );
verifier.assertFilePresent( "target/compile.txt" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
new File( testDir, "log.txt").renameTo( new File( testDir, "log2.txt" ) );
}
}

View File

@ -112,26 +112,22 @@ public class MavenITmng3415JunkRepositoryMetadataTest
cliOptions.add( settings.getPath() );
verifier.setCliOptions( cliOptions );
verifier.setLogFileName( "log-" + methodName + "-firstBuild.txt" );
verifier.executeGoal( "package" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
File firstLogFile = new File( testDir, "log-" + methodName + "-firstBuild.txt" );
logFile.renameTo( firstLogFile );
assertMetadataMissing( localRepo );
setupDummyDependency( testDir, localRepo, true );
verifier.setLogFileName( "log-" + methodName + "-secondBuild.txt" );
verifier.executeGoal( "package" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
File secondLogFile = new File( testDir, "log-" + methodName + "-secondBuild.txt" );
logFile.renameTo( secondLogFile );
assertMetadataMissing( localRepo );
}
@ -193,13 +189,13 @@ public class MavenITmng3415JunkRepositoryMetadataTest
verifier.setCliOptions( cliOptions );
verifier.setLogFileName( "log-" + methodName + "-firstBuild.txt" );
verifier.executeGoal( "package" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
File firstLogFile = new File( testDir, "log-" + methodName + "-firstBuild.txt" );
logFile.renameTo( firstLogFile );
File firstLogFile = new File( testDir, verifier.getLogFileName() );
// FIXME: There really should be a better way than this!
assertOutputLinePresent( verifier, firstLogFile, "snapshot tests:missing:1.0-SNAPSHOT: checking for updates from testing-repo" );
@ -209,13 +205,13 @@ public class MavenITmng3415JunkRepositoryMetadataTest
setupDummyDependency( testDir, localRepo, false );
verifier.setLogFileName( "log-" + methodName + "-secondBuild.txt" );
verifier.executeGoal( "package" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
File secondLogFile = new File( testDir, "log-" + methodName + "-secondBuild.txt" );
logFile.renameTo( secondLogFile );
File secondLogFile = new File( testDir, verifier.getLogFileName() );
// FIXME: There really should be a better way than this!
assertOutputLineMissing( verifier, secondLogFile, "snapshot tests:missing:1.0-SNAPSHOT: checking for updates from testing-repo" );

View File

@ -166,13 +166,11 @@ public class MavenITmng3599useHttpProxyForWebDAVTest
verifier.deleteArtifact( "org.apache.maven.its.mng3599", "test-dependency", "1.0", "jar" );
verifier.deleteArtifact( "org.apache.maven.its.mng3599", "test-dependency", "1.0", "pom" );
verifier.setLogFileName( "logHttp.txt" );
verifier.executeGoal( "compile" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
File logFile = new File( testDir, "log.txt" );
logFile.renameTo( new File( testDir, "logHttp.txt" ) );
verifier.assertArtifactPresent( "org.apache.maven.its.mng3599", "test-dependency", "1.0", "jar" );
verifier.assertArtifactContents( "org.apache.maven.its.mng3599", "test-dependency", "1.0", "jar",
content + LS );
@ -217,13 +215,11 @@ public class MavenITmng3599useHttpProxyForWebDAVTest
verifier.deleteArtifact( "org.apache.maven.its.mng3599", "test-dependency", "1.0", "jar" );
verifier.deleteArtifact( "org.apache.maven.its.mng3599", "test-dependency", "1.0", "pom" );
verifier.setLogFileName( "logDAV.txt" );
verifier.executeGoal( "compile" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
File logFile = new File( testDir, "log.txt" );
logFile.renameTo( new File( testDir, "logDAV.txt" ) );
verifier.assertArtifactPresent( "org.apache.maven.its.mng3599", "test-dependency", "1.0", "jar" );
verifier.assertArtifactContents( "org.apache.maven.its.mng3599", "test-dependency", "1.0", "jar",
content + LS );

View File

@ -109,12 +109,10 @@ public class MavenITmng3652UserAgentHeaderTest
cliOptions.add( "-X" );
verifier.setCliOptions( cliOptions );
verifier.setLogFileName( "log-unConfiguredHttp.txt" );
verifier.executeGoal( "validate" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
File logFile = new File( projectDir, "log.txt" );
logFile.renameTo( new File( projectDir, "log-unConfiguredHttp.txt" ) );
String userAgent = this.userAgent;
assertNotNull( userAgent );
@ -159,6 +157,7 @@ public class MavenITmng3652UserAgentHeaderTest
cliOptions.add( "-X" );
verifier.setCliOptions( cliOptions );
verifier.setLogFileName( "log-unConfiguredDAV.txt" );
verifier.executeGoal( "validate" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
@ -176,9 +175,6 @@ public class MavenITmng3652UserAgentHeaderTest
String os = (String) lines.get( 2 ) + " " + (String) lines.get( 3 );
String artifactVersion = (String) lines.get( 4 );
File logFile = new File( projectDir, "log.txt" );
logFile.renameTo( new File( projectDir, "log-unConfiguredDAV.txt" ) );
String userAgent = this.userAgent;
assertNotNull( userAgent );
@ -211,6 +207,7 @@ public class MavenITmng3652UserAgentHeaderTest
cliOptions.add( "-X" );
verifier.setCliOptions( cliOptions );
verifier.setLogFileName( "log-configWithoutUserAgent.txt" );
verifier.executeGoal( "validate" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
@ -228,9 +225,6 @@ public class MavenITmng3652UserAgentHeaderTest
String os = (String) lines.get( 2 ) + " " + (String) lines.get( 3 );
String artifactVersion = (String) lines.get( 4 );
File logFile = new File( projectDir, "log.txt" );
logFile.renameTo( new File( projectDir, "log-configWithoutUserAgent.txt" ) );
String userAgent = this.userAgent;
assertNotNull( userAgent );
@ -263,13 +257,11 @@ public class MavenITmng3652UserAgentHeaderTest
cliOptions.add( "-X" );
verifier.setCliOptions( cliOptions );
verifier.setLogFileName( "log-configWithUserAgent.txt" );
verifier.executeGoal( "validate" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
File logFile = new File( projectDir, "log.txt" );
logFile.renameTo( new File( projectDir, "log-configWithUserAgent.txt" ) );
String userAgent = this.userAgent;
assertNotNull( userAgent );

View File

@ -52,20 +52,16 @@ public class MavenITmng3684BuildPluginParameterTest
verifier.resetStreams();
verifier = new Verifier( projectDir.getAbsolutePath() );
verifier.setLogFileName( "log-validate.txt" );
verifier.executeGoal( "validate" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
File logFile = new File( projectDir, "log.txt" );
logFile.renameTo( new File( projectDir, "log-validate.txt" ) );
verifier.setLogFileName( "log-site.txt" );
verifier.executeGoal( "site" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
logFile.renameTo( new File( projectDir, "log-site.txt" ) );
}
}

View File

@ -56,14 +56,12 @@ public class MavenITmng3703ExecutionProjectWithRelativePathsTest
verifier.resetStreams();
verifier = new Verifier( projectDir.getAbsolutePath() );
verifier.setLogFileName( "log-mojo.txt" );
verifier.executeGoal( "package" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
File logFile = new File( projectDir, "log.txt" );
logFile.renameTo( new File( projectDir, "log-mojo.txt" ) );
}
public void testForkFromReport()
@ -83,13 +81,11 @@ public class MavenITmng3703ExecutionProjectWithRelativePathsTest
verifier.resetStreams();
verifier = new Verifier( projectDir.getAbsolutePath() );
verifier.setLogFileName( "log-report.txt" );
verifier.executeGoal( "site" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
File logFile = new File( projectDir, "log.txt" );
logFile.renameTo( new File( projectDir, "log-report.txt" ) );
}
}