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.Verifier;
26 import org.apache.maven.it.util.ResourceExtractor;
27
28
29
30
31
32
33
34 public class MavenITmng4106InterpolationUsesDominantProfileTest
35 extends AbstractMavenIntegrationTestCase
36 {
37
38 public MavenITmng4106InterpolationUsesDominantProfileTest()
39 {
40 super( "[2.0.5,)" );
41 }
42
43
44
45
46
47
48 public void testitMNG4106()
49 throws Exception
50 {
51 File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4106" );
52
53 Verifier verifier = newVerifier( testDir.getAbsolutePath() );
54 verifier.setAutoclean( false );
55 verifier.getCliOptions().add( "--settings" );
56 verifier.getCliOptions().add( "settings.xml" );
57 verifier.getCliOptions().add( "-Ppom-a,pom-b,profiles-a,profiles-b,settings-a,settings-b" );
58 verifier.executeGoal( "validate" );
59 verifier.verifyErrorFreeLog();
60 verifier.resetStreams();
61
62 Properties props = verifier.loadProperties( "target/pom.properties" );
63
64 assertEquals( "b", props.getProperty( "project.properties.pomProperty" ) );
65 assertEquals( "b", props.getProperty( "project.properties.pom" ) );
66
67 assertEquals( "b", props.getProperty( "project.properties.settingsProperty" ) );
68 assertEquals( "b", props.getProperty( "project.properties.settings" ) );
69
70 if ( matchesVersionRange( "(,3.0-alpha-1)" ) )
71 {
72
73 assertEquals( "b", props.getProperty( "project.properties.profilesProperty" ) );
74 assertEquals( "b", props.getProperty( "project.properties.profiles" ) );
75 }
76 }
77
78 }