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 MavenIT0139InterpolationWithProjectPrefixTest
33 extends AbstractMavenIntegrationTestCase
34 {
35 public MavenIT0139InterpolationWithProjectPrefixTest()
36 {
37 super( ALL_MAVEN_VERSIONS );
38 }
39
40
41
42
43
44
45 public void testit0139()
46 throws Exception
47 {
48 File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0139" );
49 File child = new File( testDir, "child" );
50
51 Verifier verifier = newVerifier( child.getAbsolutePath() );
52 verifier.setAutoclean( false );
53 verifier.deleteDirectory( "target" );
54 verifier.executeGoal( "initialize" );
55 verifier.verifyErrorFreeLog();
56 verifier.resetStreams();
57
58 Properties props = verifier.loadProperties( "target/interpolated.properties" );
59 String prefix = "project.properties.";
60
61 assertEquals( child.getCanonicalFile(), new File( props.getProperty( prefix + "projectDir" ) ).getCanonicalFile() );
62
63 assertEquals( "org.apache.maven.its.it0139.child", props.getProperty( prefix + "projectGroupId" ) );
64 assertEquals( "child", props.getProperty( prefix + "projectArtifactId" ) );
65 assertEquals( "2.0-alpha-1", props.getProperty( prefix + "projectVersion" ) );
66 assertEquals( "jar", props.getProperty( prefix + "projectPackaging" ) );
67
68 assertEquals( "child-name", props.getProperty( prefix + "projectName" ) );
69 assertEquals( "child-desc", props.getProperty( prefix + "projectDesc" ) );
70 assertEquals( "http://child.org/", props.getProperty( prefix + "projectUrl" ) );
71 assertEquals( "2008", props.getProperty( prefix + "projectYear" ) );
72 assertEquals( "child-org-name", props.getProperty( prefix + "projectOrgName" ) );
73
74 assertEquals( "2.0.0", props.getProperty( prefix + "projectPrereqMvn" ) );
75 assertEquals( "http://scm.org/", props.getProperty( prefix + "projectScmUrl" ) );
76 assertEquals( "http://issue.org/", props.getProperty( prefix + "projectIssueUrl" ) );
77 assertEquals( "http://ci.org/", props.getProperty( prefix + "projectCiUrl" ) );
78 assertEquals( "child-dist-repo", props.getProperty( prefix + "projectDistRepoName" ) );
79
80 assertEquals( "org.apache.maven.its.it0139", props.getProperty( prefix + "parentGroupId" ) );
81 assertEquals( "parent", props.getProperty( prefix + "parentArtifactId" ) );
82 assertEquals( "1.0", props.getProperty( prefix + "parentVersion" ) );
83
84
85
86
87
88 if ( matchesVersionRange( "(2.0.8,)" ) )
89 {
90 assertTrue( props.getProperty( prefix + "projectBuildOut" ).endsWith( "bin" ) );
91 }
92 assertTrue( props.getProperty( prefix + "projectSiteOut" ).endsWith( "doc" ) );
93 }
94
95 }