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 public class MavenITmng2339BadProjectInterpolationTest
32 extends AbstractMavenIntegrationTestCase
33 {
34 public MavenITmng2339BadProjectInterpolationTest()
35 {
36 super( "(2.0.8,)" );
37 }
38
39 public void testitMNG2339a()
40 throws Exception
41 {
42 File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2339/a" );
43
44 Verifier verifier;
45
46 verifier = newVerifier( testDir.getAbsolutePath() );
47 verifier.setAutoclean( false );
48
49 verifier.addCliOption( "-Dversion=foo" );
50 verifier.executeGoal( "validate" );
51
52 verifier.verifyErrorFreeLog();
53 verifier.resetStreams();
54 }
55
56
57 public void testitMNG2339b()
58 throws Exception
59 {
60 File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2339/b" );
61
62 Verifier verifier;
63
64 verifier = newVerifier( testDir.getAbsolutePath() );
65 verifier.setAutoclean( false );
66 verifier.deleteDirectory( "target" );
67
68 verifier.setLogFileName( "log-pom-specified.txt" );
69 verifier.executeGoal( "initialize" );
70
71 assertTrue( "Touchfile using ${project.version} for ${version} does not exist.",
72 new File( testDir, "target/touch-1.txt" ).exists() );
73
74 verifier.verifyErrorFreeLog();
75 verifier.resetStreams();
76
77 verifier = newVerifier( testDir.getAbsolutePath() );
78 verifier.setAutoclean( false );
79 verifier.deleteDirectory( "target" );
80
81 verifier.addCliOption( "-Dversion=2" );
82 verifier.setLogFileName( "log-cli-specified.txt" );
83 verifier.executeGoal( "initialize" );
84
85 verifier.verifyErrorFreeLog();
86 verifier.resetStreams();
87
88 assertTrue( "Touchfile using CLI-specified ${version} does not exist.",
89 new File( testDir, "target/touch-2.txt" ).exists() );
90 }
91
92 }