|
31 | 31 | import org.apache.maven.api.Session; |
32 | 32 | import org.apache.maven.api.SessionData; |
33 | 33 | import org.apache.maven.api.model.Model; |
| 34 | +import org.apache.maven.api.model.Scm; |
34 | 35 | import org.apache.maven.api.services.DependencyResolver; |
35 | 36 | import org.apache.maven.api.services.DependencyResolverResult; |
36 | 37 | import org.apache.maven.api.services.ModelBuilder; |
|
51 | 52 | import org.mockito.Mockito; |
52 | 53 |
|
53 | 54 | import static org.junit.jupiter.api.Assertions.assertNotNull; |
| 55 | +import static org.junit.jupiter.api.Assertions.assertNull; |
54 | 56 | import static org.junit.jupiter.api.Assertions.assertTrue; |
55 | 57 |
|
56 | 58 | public class ConsumerPomBuilderTest extends AbstractRepositoryTestCase { |
@@ -138,4 +140,22 @@ void testSimpleConsumer() throws Exception { |
138 | 140 | assertNotNull(model); |
139 | 141 | assertTrue(model.getProfiles().isEmpty()); |
140 | 142 | } |
| 143 | + |
| 144 | + @Test |
| 145 | + void testScmInheritance() throws Exception { |
| 146 | + Model model = Model.newBuilder() |
| 147 | + .scm(Scm.newBuilder() |
| 148 | + .connection("scm:git:https://github.com/apache/maven-project.git") |
| 149 | + .developerConnection("scm:git:https://github.com/apache/maven-project.git") |
| 150 | + .url("https://github.com/apache/maven-project") |
| 151 | + .childScmConnectionInheritAppendPath("true") |
| 152 | + .childScmUrlInheritAppendPath("true") |
| 153 | + .childScmDeveloperConnectionInheritAppendPath("true") |
| 154 | + .build()) |
| 155 | + .build(); |
| 156 | + Model transformed = DefaultConsumerPomBuilder.transform(model, null); |
| 157 | + assertNull(transformed.getScm().getChildScmConnectionInheritAppendPath()); |
| 158 | + assertNull(transformed.getScm().getChildScmUrlInheritAppendPath()); |
| 159 | + assertNull(transformed.getScm().getChildScmDeveloperConnectionInheritAppendPath()); |
| 160 | + } |
141 | 161 | } |
0 commit comments