1 package org.apache.maven.project.inheritance.t12scm;
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
24 import org.apache.maven.project.MavenProject;
25 import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase;
26
27
28
29
30
31
32 public class ProjectInheritanceTest
33 extends AbstractProjectInheritanceTestCase
34 {
35
36
37
38
39
40
41
42
43
44
45
46 public void testScmInfoCalculatedCorrectlyOnParentAndChildRead()
47 throws Exception
48 {
49 File localRepo = getLocalRepositoryPath();
50
51 File pom0 = new File( localRepo, "p0/pom.xml" );
52 File pom0Basedir = pom0.getParentFile();
53 File pom1 = new File( pom0Basedir, "modules/p1/pom.xml" );
54
55
56 MavenProject project0 = getProject( pom0 );
57 MavenProject project1 = getProject( pom1 );
58
59 System.out.println( "\n\n" );
60 System.out.println( "Parent SCM URL is: " + project0.getScm().getUrl() );
61 System.out.println( "Child SCM URL is: " + project1.getScm().getUrl() );
62 System.out.println();
63 System.out.println( "Parent SCM connection is: " + project0.getScm().getConnection() );
64 System.out.println( "Child SCM connection is: " + project1.getScm().getConnection() );
65 System.out.println();
66 System.out.println( "Parent SCM developer connection is: "
67 + project0.getScm().getDeveloperConnection() );
68 System.out.println( "Child SCM developer connection is: "
69 + project1.getScm().getDeveloperConnection() );
70
71 assertEquals( project1.getScm().getUrl(), project0.getScm().getUrl() + "/modules/p1" );
72 assertEquals( project1.getScm().getConnection(), project0.getScm().getConnection()
73 + "/modules/p1" );
74 assertEquals( project1.getScm().getDeveloperConnection(), project0.getScm()
75 .getDeveloperConnection()
76 + "/modules/p1" );
77 }
78
79 public void testScmInfoCalculatedCorrectlyOnChildOnlyRead()
80 throws Exception
81 {
82 File localRepo = getLocalRepositoryPath();
83
84 File pom1 = new File( localRepo, "p0/modules/p1/pom.xml" );
85
86
87 MavenProject project1 = getProject( pom1 );
88
89 System.out.println( "\n\n" );
90 System.out.println( "Child SCM URL is: " + project1.getScm().getUrl() );
91 System.out.println( "Child SCM connection is: " + project1.getScm().getConnection() );
92 System.out.println( "Child SCM developer connection is: "
93 + project1.getScm().getDeveloperConnection() );
94
95 assertEquals( "http://host/viewer?path=/p0/modules/p1", project1.getScm().getUrl() );
96 assertEquals( "scm:svn:http://host/p0/modules/p1", project1.getScm().getConnection() );
97 assertEquals( "scm:svn:https://host/p0/modules/p1", project1.getScm().getDeveloperConnection() );
98 }
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125 }