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 import org.apache.maven.shared.utils.Os;
24
25 import java.io.File;
26 import java.util.HashMap;
27 import java.util.Map;
28 import java.util.Properties;
29
30
31
32
33
34
35
36 public class MavenITmng3940EnvVarInterpolationTest
37 extends AbstractMavenIntegrationTestCase
38 {
39
40 public MavenITmng3940EnvVarInterpolationTest()
41 {
42 super( "(2.0.10,2.1.0-M1),(2.1.0-M1,)" );
43 }
44
45
46
47
48
49
50
51 public void testitMNG3940()
52 throws Exception
53 {
54 File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3940" );
55
56 Map<String, String> envVars = new HashMap<>();
57
58
59
60
61 if ( Os.isFamily( Os.FAMILY_WINDOWS ) )
62 {
63 envVars.put( "Maven_mng_3940", "PASSED" );
64 }
65 else
66 {
67 envVars.put( "MAVEN_MNG_3940", "PASSED" );
68 }
69
70 Verifier verifier = newVerifier( testDir.getAbsolutePath() );
71 verifier.setAutoclean( false );
72 verifier.deleteDirectory( "target" );
73 verifier.executeGoal( "validate", envVars );
74 verifier.verifyErrorFreeLog();
75 verifier.resetStreams();
76
77 verifier.assertFilePresent( "target/PASSED.properties" );
78 Properties props = verifier.loadProperties( "target/PASSED.properties" );
79 assertEquals( "PASSED", props.getProperty( "project.properties.envTest" ) );
80 }
81
82 }