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
33 public class MavenITmng3864PerExecPluginConfigTest
34 extends AbstractMavenIntegrationTestCase
35 {
36
37 public MavenITmng3864PerExecPluginConfigTest()
38 {
39 super( ALL_MAVEN_VERSIONS );
40 }
41
42
43
44
45
46
47 public void testitMNG3864()
48 throws Exception
49 {
50 File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3864" );
51
52 Verifier verifier = newVerifier( testDir.getAbsolutePath() );
53 verifier.setAutoclean( false );
54 verifier.deleteDirectory( "target" );
55 verifier.executeGoal( "validate" );
56 verifier.verifyErrorFreeLog();
57 verifier.resetStreams();
58
59 Properties props = verifier.loadProperties( "target/plugin-config.properties" );
60
61 assertCanonicalFileEquals( new File( testDir, "pom.xml" ), new File( props.getProperty( "fileParam" ) ) );
62 assertEquals( "true", props.getProperty( "booleanParam" ) );
63 assertEquals( "42", props.getProperty( "byteParam" ) );
64 assertEquals( "-12345", props.getProperty( "shortParam" ) );
65 assertEquals( "0", props.getProperty( "integerParam" ) );
66 assertEquals( "9876543210", props.getProperty( "longParam" ) );
67 assertEquals( "0.0", props.getProperty( "floatParam" ) );
68 assertEquals( "-1.5", props.getProperty( "doubleParam" ) );
69 assertEquals( "X", props.getProperty( "characterParam" ) );
70 assertEquals( "Hello World!", props.getProperty( "stringParam" ) );
71 assertEquals( "2008-11-09 11:59:03", props.getProperty( "dateParam" ) );
72 assertEquals( "http://maven.apache.org/", props.getProperty( "urlParam" ) );
73
74 assertEquals( "4", props.getProperty( "stringParams" ) );
75 assertEquals( "one", props.getProperty( "stringParams.0" ) );
76 assertEquals( "two", props.getProperty( "stringParams.1" ) );
77 assertEquals( "three", props.getProperty( "stringParams.2" ) );
78 assertEquals( "four", props.getProperty( "stringParams.3" ) );
79
80 assertEquals( "4", props.getProperty( "listParam" ) );
81 assertEquals( "one", props.getProperty( "listParam.0" ) );
82 assertEquals( "two", props.getProperty( "listParam.1" ) );
83 assertEquals( "three", props.getProperty( "listParam.2" ) );
84 assertEquals( "four", props.getProperty( "listParam.3" ) );
85
86 assertEquals( "1", props.getProperty( "setParam" ) );
87 assertEquals( "item", props.getProperty( "setParam.0" ) );
88
89 assertEquals( "2", props.getProperty( "mapParam" ) );
90 assertEquals( "value1", props.getProperty( "mapParam.key1" ) );
91 assertEquals( "value2", props.getProperty( "mapParam.key2" ) );
92
93 assertEquals( "2", props.getProperty( "propertiesParam" ) );
94 assertEquals( "value1", props.getProperty( "propertiesParam.key1" ) );
95 assertEquals( "value2", props.getProperty( "propertiesParam.key2" ) );
96
97 assertEquals( "field", props.getProperty( "beanParam.fieldParam" ) );
98 assertEquals( "setter", props.getProperty( "beanParam.setterParam" ) );
99 assertEquals( "true", props.getProperty( "beanParam.setterCalled" ) );
100
101 assertEquals( "4", props.getProperty( "domParam.children" ) );
102 assertEquals( "one", props.getProperty( "domParam.children.echo.0.value" ) );
103 assertEquals( "two", props.getProperty( "domParam.children.echo.1.value" ) );
104 assertEquals( "three", props.getProperty( "domParam.children.echo.2.value" ) );
105 assertEquals( "four", props.getProperty( "domParam.children.echo.3.value" ) );
106 }
107
108 }