1 package org.apache.maven.it;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.maven.it.util.ResourceExtractor;
23
24 import java.io.File;
25
26
27
28
29
30
31
32 public class MavenITmng4660ResumeFromTest extends AbstractMavenIntegrationTestCase {
33 public MavenITmng4660ResumeFromTest()
34 {
35 super( "[4.0.0-alpha-1,)" );
36 }
37
38
39
40
41
42
43
44
45
46 public void testShouldResolveOutputDirectoryFromEarlierBuild() throws Exception
47 {
48 final File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4660-resume-from" );
49
50 final Verifier verifier1 = newVerifier( testDir.getAbsolutePath() );
51 verifier1.deleteDirectory( "target" );
52 verifier1.deleteArtifacts( "org.apache.maven.its.mng4660" );
53
54 try
55 {
56 verifier1.executeGoal( "test" );
57 fail( "Expected this invocation to fail" );
58 }
59 catch ( final VerificationException ve )
60 {
61 verifier1.verifyTextInLog( "Deliberately fail test case" );
62 }
63 finally
64 {
65 verifier1.resetStreams();
66 }
67
68 final Verifier verifier2 = newVerifier( testDir.getAbsolutePath() );
69 verifier2.setAutoclean( false );
70 verifier2.addCliOption( "--resume-from" );
71 verifier2.addCliOption( ":module-b" );
72 verifier2.executeGoal( "compile" );
73
74 verifier2.verifyErrorFreeLog();
75 verifier2.resetStreams();
76 }
77
78
79
80
81
82
83
84
85 public void testShouldResolvePackagedArtifactFromEarlierBuild() throws Exception
86 {
87 final File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4660-resume-from" );
88
89 final Verifier verifier1 = newVerifier( testDir.getAbsolutePath() );
90 verifier1.deleteDirectory( "target" );
91 verifier1.deleteArtifacts( "org.apache.maven.its.mng4660" );
92
93 try
94 {
95 verifier1.executeGoal( "verify" );
96 fail( "Expected this invocation to fail" );
97 }
98 catch ( final VerificationException ve )
99 {
100 verifier1.verifyTextInLog( "Deliberately fail test case" );
101 }
102 finally
103 {
104 verifier1.resetStreams();
105 }
106
107 final Verifier verifier2 = newVerifier( testDir.getAbsolutePath() );
108 verifier2.setAutoclean( false );
109 verifier2.addCliOption( "--resume-from" );
110 verifier2.addCliOption( ":module-b" );
111 verifier2.executeGoal( "compile" );
112
113 verifier2.verifyErrorFreeLog();
114 verifier2.resetStreams();
115 }
116 }