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