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 import java.util.Properties;
26
27
28
29
30
31
32 public class MavenITmng2136ActiveByDefaultProfileTest
33 extends AbstractMavenIntegrationTestCase
34 {
35 public MavenITmng2136ActiveByDefaultProfileTest()
36 {
37 super( ALL_MAVEN_VERSIONS );
38 }
39
40
41
42
43
44
45
46 public void testitMNG2136()
47 throws Exception
48 {
49 File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2136" );
50
51 Verifier verifier = newVerifier( testDir.getAbsolutePath() );
52 verifier.setAutoclean( false );
53 verifier.deleteDirectory( "target" );
54
55 verifier.setSystemProperty( "expression.outputFile", new File( testDir, "target/expression.properties" ).getPath() );
56 verifier.setSystemProperty( "expression.expressions", "project/properties" );
57 verifier.addCliOption( "--settings" );
58 verifier.addCliOption( "settings.xml" );
59 verifier.executeGoal( "org.apache.maven.its.plugins:maven-it-plugin-expression:2.1-SNAPSHOT:eval" );
60 verifier.verifyErrorFreeLog();
61 verifier.resetStreams();
62
63 verifier.assertFilePresent( "target/expression.properties" );
64 Properties props = verifier.loadProperties( "target/expression.properties" );
65 assertNull( props.getProperty( "project.properties.it0102.testOutput" ) );
66 assertEquals( "Success", props.getProperty( "project.properties.testOutput" ) );
67 assertEquals( "PASSED", props.getProperty( "project.properties.settingsValue" ) );
68 if ( matchesVersionRange( "[2.0,3.0-alpha-1)" ) )
69 {
70
71 assertEquals( "Present", props.getProperty( "project.properties.profilesXmlValue" ) );
72 }
73 }
74
75 }