You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2020/03/28 20:46:47 UTC
[maven-integration-testing] 12/18: Run test twice,
once with packaged and once without packaged artifact
This is an automated email from the ASF dual-hosted git repository.
rfscholte pushed a commit to branch MNG-4660
in repository https://gitbox.apache.org/repos/asf/maven-integration-testing.git
commit e48801fa41446131ca533d1ac472c7f450e8d3f3
Author: Maarten Mulders <ma...@infosupport.com>
AuthorDate: Mon Mar 9 14:46:59 2020 +0100
Run test twice, once with packaged and once without packaged artifact
---
.../maven/it/MavenITmng4660ResumeFromTest.java | 42 ++++++++++++++++++++--
1 file changed, 40 insertions(+), 2 deletions(-)
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4660ResumeFromTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4660ResumeFromTest.java
index d43e796..6d2b471 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4660ResumeFromTest.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4660ResumeFromTest.java
@@ -38,8 +38,9 @@ public class MavenITmng4660ResumeFromTest extends AbstractMavenIntegrationTestCa
/**
* Test that the --resume-from flag resolves dependencies inside the same Maven project
* without having them installed first.
+ * This test case uses the target/classes folder of module-a.
*/
- public void testShouldResolveDependenciesFromEarlierBuild() throws Exception
+ public void testShouldResolveUnpackagedArtifactFromEarlierBuild() throws Exception
{
final File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4660-resume-from" );
@@ -49,7 +50,44 @@ public class MavenITmng4660ResumeFromTest extends AbstractMavenIntegrationTestCa
try
{
- verifier1.executeGoal( "verify" );
+ verifier1.executeGoal( "test" ); // The test goal will not create a packaged artifact
+ fail( "Expected this invocation to fail" ); // See TestCase.java
+ }
+ catch ( final VerificationException ve )
+ {
+ verifier1.verifyTextInLog( "Deliberately fail test case" );
+ }
+ finally
+ {
+ verifier1.resetStreams();
+ }
+
+ final Verifier verifier2 = newVerifier( testDir.getAbsolutePath() );
+ verifier2.setAutoclean( false );
+ verifier2.addCliOption( "--resume-from" );
+ verifier2.addCliOption( ":module-b" );
+ verifier2.executeGoal( "compile" ); // to prevent the unit test from failing (again)
+
+ verifier2.verifyErrorFreeLog();
+ verifier2.resetStreams();
+ }
+
+ /**
+ * Test that the --resume-from flag resolves dependencies inside the same Maven project
+ * without having them installed first.
+ * This test case uses the packaged artifact of module-a.
+ */
+ public void testShouldResolvePackagedArtifactFromEarlierBuild() throws Exception
+ {
+ final File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4660-resume-from" );
+
+ final Verifier verifier1 = newVerifier( testDir.getAbsolutePath() );
+ verifier1.deleteDirectory( "target" );
+ verifier1.deleteArtifacts( "org.apache.maven.its.mng4660" );
+
+ try
+ {
+ verifier1.executeGoal( "verify" ); // The verify goal will create a packaged artifact
fail( "Expected this invocation to fail" ); // See TestCase.java
}
catch ( final VerificationException ve )