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 java.io.File;
23 import java.util.Properties;
24
25 import org.apache.maven.it.util.ResourceExtractor;
26
27
28
29
30
31
32
33 public class MavenITmng3760BaseUriPropertyTest
34 extends AbstractMavenIntegrationTestCase
35 {
36
37 public MavenITmng3760BaseUriPropertyTest()
38 {
39 super( "(2.1.0-M1,3.0-alpha-1),(3.0-alpha-2,3.5.4)" );
40 }
41
42 public void testitMNG3760()
43 throws Exception
44 {
45 File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3760" ).getCanonicalFile();
46
47 Verifier verifier = newVerifier( testDir.getAbsolutePath() );
48 verifier.setAutoclean( false );
49 verifier.deleteDirectory( "target" );
50 verifier.setLogFileName( "log-basic.txt" );
51 verifier.executeGoal( "validate" );
52 verifier.verifyErrorFreeLog();
53 verifier.resetStreams();
54
55 Properties props = verifier.loadProperties( "target/profile.properties" );
56
57 assertEquals( testDir.toURI().toString(), props.getProperty( "project.properties.pomProperty" ) );
58
59 assertEquals( "${baseUri}", props.getProperty( "project.properties.baseUriProperty" ) );
60 }
61
62 public void testitMNG3760SystemPropertyOverride()
63 throws Exception
64 {
65 File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3760" ).getCanonicalFile();
66
67
68 Verifier verifier = newVerifier( testDir.getAbsolutePath() );
69 verifier.setAutoclean( false );
70 verifier.deleteDirectory( "target" );
71 verifier.addCliOption( "-DbaseUri=myBaseUri" );
72 verifier.setLogFileName( "log-sysprop.txt" );
73 verifier.executeGoal( "validate" );
74 verifier.verifyErrorFreeLog();
75 verifier.resetStreams();
76
77 Properties props = verifier.loadProperties( "target/profile.properties" );
78
79 assertEquals( testDir.toURI().toString(), props.getProperty( "project.properties.pomProperty" ) );
80
81 assertEquals( "myBaseUri", props.getProperty( "project.properties.baseUriProperty" ) );
82 }
83
84 }