From 3a9dc16e26cc0c860efb6828f0c2ed3894c71eca Mon Sep 17 00:00:00 2001 From: Benjamin Bentmann Date: Sat, 15 Nov 2008 13:26:47 +0000 Subject: [PATCH] [MNG-3845] Unintended inheritance of parent elements overriden by children o Added IT git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@714252 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/maven/it/IntegrationTestSuite.java | 1 + ...venITmng3845LimitedPomInheritanceTest.java | 70 +++++++++++++++ .../src/test/resources/mng-3845/child/pom.xml | 89 +++++++++++++++++++ .../src/test/resources/mng-3845/pom.xml | 87 ++++++++++++++++++ 4 files changed, 247 insertions(+) create mode 100644 its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3845LimitedPomInheritanceTest.java create mode 100644 its/core-it-suite/src/test/resources/mng-3845/child/pom.xml create mode 100644 its/core-it-suite/src/test/resources/mng-3845/pom.xml diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java b/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java index 777a58a296..8bc88b7faf 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java @@ -88,6 +88,7 @@ public class IntegrationTestSuite // suite.addTestSuite( MavenIT0109ReleaseUpdateTest.class ); // suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137 + suite.addTestSuite( MavenITmng3845LimitedPomInheritanceTest.class ); suite.addTestSuite( MavenITmng3843PomInheritanceTest.class ); suite.addTestSuite( MavenITmng3839PomParsingCoalesceTextTest.class ); suite.addTestSuite( MavenITmng3838EqualPluginDepsTest.class ); diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3845LimitedPomInheritanceTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3845LimitedPomInheritanceTest.java new file mode 100644 index 0000000000..ef37b7a4c1 --- /dev/null +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3845LimitedPomInheritanceTest.java @@ -0,0 +1,70 @@ +package org.apache.maven.it; + +/* + * 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. + */ + +import org.apache.maven.it.Verifier; +import org.apache.maven.it.util.ResourceExtractor; + +import java.io.File; +import java.util.Properties; + +/** + * This is a test set for MNG-3845. + * + * @author Benjamin Bentmann + * @version $Id$ + */ +public class MavenITmng3845LimitedPomInheritanceTest + extends AbstractMavenIntegrationTestCase +{ + + public MavenITmng3845LimitedPomInheritanceTest() + { + } + + /** + * Test that inheritance is all-or-nothing for certain sub-trees of the POM. + */ + public void testitMNG3845() + throws Exception + { + File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3845" ); + + Verifier verifier = new Verifier( new File( testDir, "child" ).getAbsolutePath() ); + verifier.setAutoclean( false ); + verifier.deleteDirectory( "target" ); + verifier.executeGoal( "validate" ); + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + + Properties props = verifier.loadProperties( "target/pom.properties" ); + assertEquals( "", props.getProperty( "project.organization.url", "" ) ); + assertEquals( "", props.getProperty( "project.issueManagement.system", "" ) ); + assertEquals( "0", props.getProperty( "project.ciManagement.notifiers", "0" ) ); + assertEquals( "", props.getProperty( "project.distributionManagement.repository.name", "" ) ); + assertEquals( "true", props.getProperty( "project.distributionManagement.repository.uniqueVersion", "true" ) ); + assertEquals( "default", props.getProperty( "project.distributionManagement.repository.layout", "default" ) ); + assertEquals( "", props.getProperty( "project.distributionManagement.snapshotRepository.name", "" ) ); + assertEquals( "true", props.getProperty( "project.distributionManagement.snapshotRepository.uniqueVersion", "true" ) ); + assertEquals( "default", props.getProperty( "project.distributionManagement.snapshotRepository.layout", "default" ) ); + assertEquals( "", props.getProperty( "project.distributionManagement.site.name", "" ) ); + } + +} diff --git a/its/core-it-suite/src/test/resources/mng-3845/child/pom.xml b/its/core-it-suite/src/test/resources/mng-3845/child/pom.xml new file mode 100644 index 0000000000..f47bd040d6 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-3845/child/pom.xml @@ -0,0 +1,89 @@ + + + + + + 4.0.0 + + + org.apache.maven.its.mng3845 + parent + 0.1 + + + child + + + child-org + + + + https://child.url/scm + + + http://child.url/issues + + + child-ci + http://child.url/ci + + + + child-distros + ssh://child.url/distros + + + child-snaps + ssh://child.url/snaps + + + child-site + scp://child.url/site + + + + + + + org.apache.maven.its.plugins + maven-it-plugin-expression + 2.1-SNAPSHOT + + + validate + + eval + + + target/pom.properties + + project/organization + project/scm + project/ciManagement + project/issueManagement + project/distributionManagement + + + + + + + + diff --git a/its/core-it-suite/src/test/resources/mng-3845/pom.xml b/its/core-it-suite/src/test/resources/mng-3845/pom.xml new file mode 100644 index 0000000000..bd7b4588a0 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-3845/pom.xml @@ -0,0 +1,87 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng3845 + parent + 0.1 + pom + + Maven Integration Test :: MNG-3845 + + Test that inheritance is all-or-nothing for certain sub-trees of the POM. + + + + parent-org + http://parent.url/org + + + + http://parent.url/viewvc + http://parent.url/scm + https://parent.url/scm + parent-tag + + + parent-issues + http://parent.url/issues + + + parent-ci + http://parent.url/ci + + + irc + true + true + false + false + +
irc://parent.url/#ci
+
+
+
+
+ + + parent-distros + parent-distros + ssh://parent.url/distros + false + legacy + + + parent-snaps + parent-snaps + ssh://parent.url/snaps + false + legacy + + + parent-site + parent-site + scp://parent.url/site + + +