o Extended IT to check merging/overriding during inheritance

git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@719891 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2008-11-22 18:26:27 +00:00
parent f1dd554ebb
commit f15a010623
3 changed files with 264 additions and 2 deletions

View File

@ -53,6 +53,7 @@ public class MavenITmng3843PomInheritanceTest
verifier.deleteDirectory( "test-1/target" ); verifier.deleteDirectory( "test-1/target" );
verifier.deleteDirectory( "test-2/target" ); verifier.deleteDirectory( "test-2/target" );
verifier.deleteDirectory( "test-2/child-1/target" ); verifier.deleteDirectory( "test-2/child-1/target" );
verifier.deleteDirectory( "test-2/child-2/target" );
verifier.deleteDirectory( "test-3/sub-parent/child-a/target" ); verifier.deleteDirectory( "test-3/sub-parent/child-a/target" );
verifier.executeGoal( "validate" ); verifier.executeGoal( "validate" );
verifier.verifyErrorFreeLog(); verifier.verifyErrorFreeLog();
@ -164,6 +165,65 @@ public class MavenITmng3843PomInheritanceTest
assertEquals( "1", props.getProperty( "project.dependencyManagement.dependencies" ) ); assertEquals( "1", props.getProperty( "project.dependencyManagement.dependencies" ) );
assertEquals( "parent-dep-a", props.getProperty( "project.dependencyManagement.dependencies.0.artifactId" ) ); assertEquals( "parent-dep-a", props.getProperty( "project.dependencyManagement.dependencies.0.artifactId" ) );
basedir = new File( verifier.getBasedir(), "test-2/child-2" );
props = verifier.loadProperties( "test-2/child-2/target/pom.properties" );
assertEquals( "org.apache.maven.its.mng3843.child", props.getProperty( "project.groupId" ) );
assertEquals( "child-2", props.getProperty( "project.artifactId" ) );
assertEquals( "0.2", props.getProperty( "project.version" ) );
assertEquals( "jar", props.getProperty( "project.packaging" ) );
assertEquals( "child-name", props.getProperty( "project.name" ) );
assertEquals( "child-description", props.getProperty( "project.description", "" ) );
assertUrlCommon( "http://child.url", props.getProperty( "project.url", "" ) );
assertEquals( "2009", props.getProperty( "project.inceptionYear", "" ) );
assertEquals( "validate", props.getProperty( "project.build.defaultGoal" ) );
assertEquals( "parent-property", props.getProperty( "project.properties.parentProperty" ) );
assertEquals( "child-property", props.getProperty( "project.properties.childProperty" ) );
assertEquals( "2.0.1", props.getProperty( "project.prerequisites.maven" ) );
assertMissing( props, "project.modules." );
assertEquals( "1", props.getProperty( "project.licenses" ) );
assertEquals( "http://child.url/license", props.getProperty( "project.licenses.0.url" ) );
assertEquals( "1", props.getProperty( "project.developers" ) );
assertEquals( "child-developer", props.getProperty( "project.developers.0.name" ) );
assertEquals( "1", props.getProperty( "project.contributors" ) );
assertEquals( "child-contributor", props.getProperty( "project.contributors.0.name" ) );
assertEquals( "1", props.getProperty( "project.mailingLists" ) );
assertEquals( "child-mailing-list", props.getProperty( "project.mailingLists.0.name" ) );
assertEquals( "http://child-org.url/", props.getProperty( "project.organization.url" ) );
assertUrlCommon( "http://child.url/trunk", props.getProperty( "project.scm.url" ) );
assertUrlCommon( "http://child.url/scm", props.getProperty( "project.scm.connection" ) );
assertUrlCommon( "https://child.url/scm", props.getProperty( "project.scm.developerConnection" ) );
assertEquals( "http://child.url/ci", props.getProperty( "project.ciManagement.url" ) );
assertEquals( "http://child.url/issues", props.getProperty( "project.issueManagement.url" ) );
assertEquals( "http://child.url/dist", props.getProperty( "project.distributionManagement.repository.url" ) );
assertEquals( "http://child.url/snaps", props.getProperty( "project.distributionManagement.snapshotRepository.url" ) );
assertUrlCommon( "http://child.url/site", props.getProperty( "project.distributionManagement.site.url" ) );
assertUrlCommon( "http://child.url/download", props.getProperty( "project.distributionManagement.downloadUrl" ) );
assertEquals( "child-reloc-msg", props.getProperty( "project.distributionManagement.relocation.message" ) );
assertMissing( props, "project.profiles." );
assertEquals( "coreit", props.getProperty( "project.build.finalName" ) );
assertPathEquals( basedir, "sources/main", props.getProperty( "project.build.sourceDirectory" ) );
assertPathEquals( basedir, "sources/test", props.getProperty( "project.build.testSourceDirectory" ) );
assertPathEquals( basedir, "sources/scripts", props.getProperty( "project.build.scriptSourceDirectory" ) );
assertEquals( "1", props.getProperty( "project.build.resources" ) );
assertPathEquals( basedir, "resources/main", props.getProperty( "project.build.resources.0.directory" ) );
assertEquals( "1", props.getProperty( "project.build.testResources" ) );
assertPathEquals( basedir, "resources/test", props.getProperty( "project.build.testResources.0.directory" ) );
assertPathEquals( basedir, "build", props.getProperty( "project.build.directory" ) );
assertPathEquals( basedir, "build/main", props.getProperty( "project.build.outputDirectory" ) );
assertPathEquals( basedir, "build/test", props.getProperty( "project.build.testOutputDirectory" ) );
assertPathEquals( basedir, "docs", props.getProperty( "project.reporting.outputDirectory" ) );
assertEquals( "false", props.getProperty( "project.reporting.excludeDefaults" ) );
assertTrue( Integer.parseInt( props.getProperty( "project.repositories" ) ) > 1 );
assertEquals( "1", props.getProperty( "project.build.plugins" ) );
assertEquals( "4", props.getProperty( "project.dependencies" ) );
assertEquals( "parent-dep-b", props.getProperty( "project.dependencies.0.artifactId" ) );
assertEquals( "child-dep-b", props.getProperty( "project.dependencies.1.artifactId" ) );
assertEquals( "child-dep-c", props.getProperty( "project.dependencies.2.artifactId" ) );
assertEquals( "child-dep-d", props.getProperty( "project.dependencies.3.artifactId" ) );
assertEquals( "2", props.getProperty( "project.dependencyManagement.dependencies" ) );
assertEquals( "parent-dep-a", props.getProperty( "project.dependencyManagement.dependencies.0.artifactId" ) );
assertEquals( "child-dep-a", props.getProperty( "project.dependencyManagement.dependencies.1.artifactId" ) );
basedir = new File( verifier.getBasedir(), "test-3/sub-parent/child-a" ); basedir = new File( verifier.getBasedir(), "test-3/sub-parent/child-a" );
props = verifier.loadProperties( "test-3/sub-parent/child-a/target/pom.properties" ); props = verifier.loadProperties( "test-3/sub-parent/child-a/target/pom.properties" );
assertEquals( "../pom.xml", props.getProperty( "project.originalModel.parent.relativePath" ) ); assertEquals( "../pom.xml", props.getProperty( "project.originalModel.parent.relativePath" ) );

View File

@ -0,0 +1,201 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project>
<modelVersion>4.0.0</modelVersion>
<!--
This POM specifies values for most of the model to check overriding/merging with the stuff inherited from its parent.
-->
<parent>
<groupId>org.apache.maven.its.mng3843</groupId>
<artifactId>parent-1</artifactId>
<version>0.1</version>
</parent>
<groupId>org.apache.maven.its.mng3843.child</groupId>
<artifactId>child-2</artifactId>
<version>0.2</version>
<packaging>jar</packaging>
<name>child-name</name>
<description>child-description</description>
<url>http://child.url/</url>
<inceptionYear>2009</inceptionYear>
<organization>
<name>child-org</name>
<url>http://child-org.url/</url>
</organization>
<licenses>
<license>
<name>child-license</name>
<url>http://child.url/license</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<name>child-developer</name>
</developer>
</developers>
<contributors>
<contributor>
<name>child-contributor</name>
</contributor>
</contributors>
<mailingLists>
<mailingList>
<name>child-mailing-list</name>
</mailingList>
</mailingLists>
<prerequisites>
<maven>2.0.1</maven>
</prerequisites>
<scm>
<url>http://child.url/trunk</url>
<connection>http://child.url/scm</connection>
<developerConnection>https://child.url/scm</developerConnection>
</scm>
<issueManagement>
<url>http://child.url/issues</url>
</issueManagement>
<ciManagement>
<url>http://child.url/ci</url>
</ciManagement>
<distributionManagement>
<repository>
<url>http://child.url/dist</url>
<id>child.distros</id>
</repository>
<snapshotRepository>
<url>http://child.url/snaps</url>
<id>child.snaps</id>
</snapshotRepository>
<site>
<url>http://child.url/site</url>
<id>child.site</id>
</site>
<downloadUrl>http://child.url/download</downloadUrl>
<relocation>
<message>child-reloc-msg</message>
</relocation>
</distributionManagement>
<properties>
<childProperty>child-property</childProperty>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.maven.its.mng3843</groupId>
<artifactId>parent-dep-a</artifactId>
<version>2</version>
</dependency>
<dependency>
<groupId>org.apache.maven.its.mng3843</groupId>
<artifactId>child-dep-a</artifactId>
<version>1</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.maven.its.mng3843</groupId>
<artifactId>parent-dep-b</artifactId>
<version>2</version>
</dependency>
<dependency>
<groupId>org.apache.maven.its.mng3843</groupId>
<artifactId>child-dep-b</artifactId>
<version>1</version>
</dependency>
<dependency>
<groupId>org.apache.maven.its.mng3843</groupId>
<artifactId>child-dep-c</artifactId>
<version>1</version>
</dependency>
<dependency>
<groupId>org.apache.maven.its.mng3843</groupId>
<artifactId>child-dep-d</artifactId>
<version>1</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>child-remote-repo</id>
<url>http://child.url/remote</url>
</repository>
</repositories>
<build>
<defaultGoal>validate</defaultGoal>
<directory>build</directory>
<sourceDirectory>sources/main</sourceDirectory>
<scriptSourceDirectory>sources/scripts</scriptSourceDirectory>
<testSourceDirectory>sources/test</testSourceDirectory>
<outputDirectory>build/main</outputDirectory>
<testOutputDirectory>build/test</testOutputDirectory>
<finalName>coreit</finalName>
<resources>
<resource>
<directory>resources/main</directory>
</resource>
</resources>
<testResources>
<testResource>
<directory>resources/test</directory>
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-expression</artifactId>
<version>2.1-SNAPSHOT</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>eval</goal>
</goals>
<configuration>
<outputFile>target/pom.properties</outputFile>
<expressions>
<expression>project</expression>
</expressions>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<reporting>
<excludeDefaults>false</excludeDefaults>
<outputDirectory>docs</outputDirectory>
</reporting>
</project>

View File

@ -70,6 +70,7 @@ under the License.
<modules> <modules>
<module>child-1</module> <module>child-1</module>
<module>child-2</module>
</modules> </modules>
<scm> <scm>
@ -109,7 +110,7 @@ under the License.
<dependencyManagement> <dependencyManagement>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.apache.maven.its.mng384X</groupId> <groupId>org.apache.maven.its.mng3843</groupId>
<artifactId>parent-dep-a</artifactId> <artifactId>parent-dep-a</artifactId>
<version>1</version> <version>1</version>
<scope>test</scope> <scope>test</scope>
@ -118,7 +119,7 @@ under the License.
</dependencyManagement> </dependencyManagement>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.apache.maven.its.mng384X</groupId> <groupId>org.apache.maven.its.mng3843</groupId>
<artifactId>parent-dep-b</artifactId> <artifactId>parent-dep-b</artifactId>
<version>1</version> <version>1</version>
<scope>test</scope> <scope>test</scope>