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 f33e920d4d..7ba0fc7e5b 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 @@ -342,6 +342,7 @@ public class IntegrationTestSuite suite.addTestSuite( MavenITmng3807PluginConfigExpressionEvaluationTest.class ); suite.addTestSuite( MavenITmng3805ExtensionClassPathOrderingTest.class ); suite.addTestSuite( MavenITmng3796ClassImportInconsistencyTest.class ); + suite.addTestSuite( MavenITmng3775ConflictResolutionBacktrackingTest.class ); suite.addTestSuite( MavenITmng3769ExclusionRelocatedTransdepsTest.class ); suite.addTestSuite( MavenITmng3766ToolchainsFromExtensionTest.class ); suite.addTestSuite( MavenITmng3760BaseUriPropertyTest.class ); diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3775ConflictResolutionBacktrackingTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3775ConflictResolutionBacktrackingTest.java new file mode 100644 index 0000000000..cc4bbd172a --- /dev/null +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3775ConflictResolutionBacktrackingTest.java @@ -0,0 +1,107 @@ +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.List; + +/** + * This is a test set for MNG-3775. + * + * @author Benjamin Bentmann + */ +public class MavenITmng3775ConflictResolutionBacktrackingTest + extends AbstractMavenIntegrationTestCase +{ + + public MavenITmng3775ConflictResolutionBacktrackingTest() + { + super( "[3.0,)" ); + } + + public void testitABC() + throws Exception + { + testit( "test-abc" ); + } + + public void testitACB() + throws Exception + { + testit( "test-acb" ); + } + + public void testitBAC() + throws Exception + { + testit( "test-bac" ); + } + + public void testitBCA() + throws Exception + { + testit( "test-bca" ); + } + + public void testitCAB() + throws Exception + { + testit( "test-cab" ); + } + + public void testitCBA() + throws Exception + { + testit( "test-cba" ); + } + + /** + * Verify that conflict resolution doesn't select nodes which are children of eventually disabled nodes. + * In other words, when a sub tree gets disabled, all previously selected winners among the children need to + * be revised. + */ + private void testit( String project ) + throws Exception + { + File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3775" ); + + Verifier verifier = newVerifier( new File( testDir, project ).getAbsolutePath() ); + verifier.setAutoclean( false ); + verifier.deleteDirectory( "target" ); + verifier.deleteArtifacts( "org.apache.maven.its.mng3775" ); + verifier.getCliOptions().add( "-s" ); + verifier.getCliOptions().add( "settings.xml" ); + verifier.filterFile( "../settings-template.xml", "settings.xml", "UTF-8", verifier.newDefaultFilterProperties() ); + verifier.executeGoal( "validate" ); + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + + List test = verifier.loadLines( "target/test.txt", "UTF-8" ); + + assertTrue( project + " > " + test.toString(), test.contains( "a-0.1.jar" ) ); + assertTrue( project + " > " + test.toString(), test.contains( "b-0.1.jar" ) ); + assertTrue( project + " > " + test.toString(), test.contains( "x-0.1.jar" ) ); + assertTrue( project + " > " + test.toString(), test.contains( "c-0.1.jar" ) ); + } + +} diff --git a/its/core-it-suite/src/test/resources/mng-3775/repo/org/apache/maven/its/mng3775/a/0.1/a-0.1.jar b/its/core-it-suite/src/test/resources/mng-3775/repo/org/apache/maven/its/mng3775/a/0.1/a-0.1.jar new file mode 100644 index 0000000000..e151435245 Binary files /dev/null and b/its/core-it-suite/src/test/resources/mng-3775/repo/org/apache/maven/its/mng3775/a/0.1/a-0.1.jar differ diff --git a/its/core-it-suite/src/test/resources/mng-3775/repo/org/apache/maven/its/mng3775/a/0.1/a-0.1.pom b/its/core-it-suite/src/test/resources/mng-3775/repo/org/apache/maven/its/mng3775/a/0.1/a-0.1.pom new file mode 100644 index 0000000000..77cc9e64f1 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-3775/repo/org/apache/maven/its/mng3775/a/0.1/a-0.1.pom @@ -0,0 +1,45 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng3775 + a + 0.1 + jar + + + + org.apache.maven.its.mng3775 + b + 0.1 + compile + + + + + + maven-core-it + file:///${basedir}/repo + + + diff --git a/its/core-it-suite/src/test/resources/mng-3775/repo/org/apache/maven/its/mng3775/b/0.1/b-0.1.jar b/its/core-it-suite/src/test/resources/mng-3775/repo/org/apache/maven/its/mng3775/b/0.1/b-0.1.jar new file mode 100644 index 0000000000..7a36629c88 Binary files /dev/null and b/its/core-it-suite/src/test/resources/mng-3775/repo/org/apache/maven/its/mng3775/b/0.1/b-0.1.jar differ diff --git a/its/core-it-suite/src/test/resources/mng-3775/repo/org/apache/maven/its/mng3775/b/0.1/b-0.1.pom b/its/core-it-suite/src/test/resources/mng-3775/repo/org/apache/maven/its/mng3775/b/0.1/b-0.1.pom new file mode 100644 index 0000000000..0b692220d4 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-3775/repo/org/apache/maven/its/mng3775/b/0.1/b-0.1.pom @@ -0,0 +1,45 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng3775 + b + 0.1 + jar + + + + org.apache.maven.its.mng3775 + x + 0.1 + compile + + + + + + maven-core-it + file:///${basedir}/repo + + + diff --git a/its/core-it-suite/src/test/resources/mng-3775/repo/org/apache/maven/its/mng3775/c/0.1/c-0.1.jar b/its/core-it-suite/src/test/resources/mng-3775/repo/org/apache/maven/its/mng3775/c/0.1/c-0.1.jar new file mode 100644 index 0000000000..1635d9ca93 Binary files /dev/null and b/its/core-it-suite/src/test/resources/mng-3775/repo/org/apache/maven/its/mng3775/c/0.1/c-0.1.jar differ diff --git a/its/core-it-suite/src/test/resources/mng-3775/repo/org/apache/maven/its/mng3775/c/0.1/c-0.1.pom b/its/core-it-suite/src/test/resources/mng-3775/repo/org/apache/maven/its/mng3775/c/0.1/c-0.1.pom new file mode 100644 index 0000000000..b9a40b8dc0 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-3775/repo/org/apache/maven/its/mng3775/c/0.1/c-0.1.pom @@ -0,0 +1,45 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng3775 + c + 0.1 + jar + + + + org.apache.maven.its.mng3775 + x + 0.1 + compile + + + + + + maven-core-it + file:///${basedir}/repo + + + diff --git a/its/core-it-suite/src/test/resources/mng-3775/repo/org/apache/maven/its/mng3775/x/0.1/x-0.1.jar b/its/core-it-suite/src/test/resources/mng-3775/repo/org/apache/maven/its/mng3775/x/0.1/x-0.1.jar new file mode 100644 index 0000000000..fcf7d967e3 Binary files /dev/null and b/its/core-it-suite/src/test/resources/mng-3775/repo/org/apache/maven/its/mng3775/x/0.1/x-0.1.jar differ diff --git a/its/core-it-suite/src/test/resources/mng-3775/repo/org/apache/maven/its/mng3775/x/0.1/x-0.1.pom b/its/core-it-suite/src/test/resources/mng-3775/repo/org/apache/maven/its/mng3775/x/0.1/x-0.1.pom new file mode 100644 index 0000000000..fc25721a0b --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-3775/repo/org/apache/maven/its/mng3775/x/0.1/x-0.1.pom @@ -0,0 +1,36 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng3775 + x + 0.1 + jar + + + + maven-core-it + file:///${basedir}/repo + + + diff --git a/its/core-it-suite/src/test/resources/mng-3775/settings-template.xml b/its/core-it-suite/src/test/resources/mng-3775/settings-template.xml new file mode 100644 index 0000000000..f22a7f3570 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-3775/settings-template.xml @@ -0,0 +1,43 @@ + + + + + + + + maven-core-it-repo + + + maven-core-it + @baseurl@/../repo + + ignore + + + false + + + + + + + maven-core-it-repo + + diff --git a/its/core-it-suite/src/test/resources/mng-3775/test-abc/pom.xml b/its/core-it-suite/src/test/resources/mng-3775/test-abc/pom.xml new file mode 100644 index 0000000000..660dfc1bde --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-3775/test-abc/pom.xml @@ -0,0 +1,99 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng3775 + abc + 0.1 + jar + + Maven Integration Test :: MNG-3775 + + Verify that conflict resolution doesn't select nodes which are children of eventually disabled nodes. + In other words, when a sub tree gets disabled, all previously selected winners among the children need to + be revised. + + + + + + org.apache.maven.its.mng3775 + a + 0.1 + compile + + + org.apache.maven.its.mng3775 + b + 0.1 + compile + + + + org.apache.maven.its.mng3775 + x + + + + + org.apache.maven.its.mng3775 + c + 0.1 + + test + + + + + + + org.apache.maven.its.plugins + maven-it-plugin-dependency-resolution + 2.1-SNAPSHOT + + target/compile.txt + target/test.txt + 1 + + + + resolve + validate + + compile + test + + + + + + + diff --git a/its/core-it-suite/src/test/resources/mng-3775/test-acb/pom.xml b/its/core-it-suite/src/test/resources/mng-3775/test-acb/pom.xml new file mode 100644 index 0000000000..da6e78393b --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-3775/test-acb/pom.xml @@ -0,0 +1,99 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng3775 + acb + 0.1 + jar + + Maven Integration Test :: MNG-3775 + + Verify that conflict resolution doesn't select nodes which are children of eventually disabled nodes. + In other words, when a sub tree gets disabled, all previously selected winners among the children need to + be revised. + + + + + + org.apache.maven.its.mng3775 + a + 0.1 + compile + + + org.apache.maven.its.mng3775 + c + 0.1 + + test + + + org.apache.maven.its.mng3775 + b + 0.1 + compile + + + + org.apache.maven.its.mng3775 + x + + + + + + + + + org.apache.maven.its.plugins + maven-it-plugin-dependency-resolution + 2.1-SNAPSHOT + + target/compile.txt + target/test.txt + 1 + + + + resolve + validate + + compile + test + + + + + + + diff --git a/its/core-it-suite/src/test/resources/mng-3775/test-bac/pom.xml b/its/core-it-suite/src/test/resources/mng-3775/test-bac/pom.xml new file mode 100644 index 0000000000..b400652de6 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-3775/test-bac/pom.xml @@ -0,0 +1,99 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng3775 + bac + 0.1 + jar + + Maven Integration Test :: MNG-3775 + + Verify that conflict resolution doesn't select nodes which are children of eventually disabled nodes. + In other words, when a sub tree gets disabled, all previously selected winners among the children need to + be revised. + + + + + + org.apache.maven.its.mng3775 + b + 0.1 + compile + + + + org.apache.maven.its.mng3775 + x + + + + + org.apache.maven.its.mng3775 + a + 0.1 + compile + + + org.apache.maven.its.mng3775 + c + 0.1 + + test + + + + + + + org.apache.maven.its.plugins + maven-it-plugin-dependency-resolution + 2.1-SNAPSHOT + + target/compile.txt + target/test.txt + 1 + + + + resolve + validate + + compile + test + + + + + + + diff --git a/its/core-it-suite/src/test/resources/mng-3775/test-bca/pom.xml b/its/core-it-suite/src/test/resources/mng-3775/test-bca/pom.xml new file mode 100644 index 0000000000..851d4ece3c --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-3775/test-bca/pom.xml @@ -0,0 +1,99 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng3775 + bca + 0.1 + jar + + Maven Integration Test :: MNG-3775 + + Verify that conflict resolution doesn't select nodes which are children of eventually disabled nodes. + In other words, when a sub tree gets disabled, all previously selected winners among the children need to + be revised. + + + + + + org.apache.maven.its.mng3775 + b + 0.1 + compile + + + + org.apache.maven.its.mng3775 + x + + + + + org.apache.maven.its.mng3775 + c + 0.1 + + test + + + org.apache.maven.its.mng3775 + a + 0.1 + compile + + + + + + + org.apache.maven.its.plugins + maven-it-plugin-dependency-resolution + 2.1-SNAPSHOT + + target/compile.txt + target/test.txt + 1 + + + + resolve + validate + + compile + test + + + + + + + diff --git a/its/core-it-suite/src/test/resources/mng-3775/test-cab/pom.xml b/its/core-it-suite/src/test/resources/mng-3775/test-cab/pom.xml new file mode 100644 index 0000000000..eb3347cab2 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-3775/test-cab/pom.xml @@ -0,0 +1,99 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng3775 + cab + 0.1 + jar + + Maven Integration Test :: MNG-3775 + + Verify that conflict resolution doesn't select nodes which are children of eventually disabled nodes. + In other words, when a sub tree gets disabled, all previously selected winners among the children need to + be revised. + + + + + + org.apache.maven.its.mng3775 + c + 0.1 + + test + + + org.apache.maven.its.mng3775 + a + 0.1 + compile + + + org.apache.maven.its.mng3775 + b + 0.1 + compile + + + + org.apache.maven.its.mng3775 + x + + + + + + + + + org.apache.maven.its.plugins + maven-it-plugin-dependency-resolution + 2.1-SNAPSHOT + + target/compile.txt + target/test.txt + 1 + + + + resolve + validate + + compile + test + + + + + + + diff --git a/its/core-it-suite/src/test/resources/mng-3775/test-cba/pom.xml b/its/core-it-suite/src/test/resources/mng-3775/test-cba/pom.xml new file mode 100644 index 0000000000..7c1984c7e8 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-3775/test-cba/pom.xml @@ -0,0 +1,99 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng3775 + cba + 0.1 + jar + + Maven Integration Test :: MNG-3775 + + Verify that conflict resolution doesn't select nodes which are children of eventually disabled nodes. + In other words, when a sub tree gets disabled, all previously selected winners among the children need to + be revised. + + + + + + org.apache.maven.its.mng3775 + c + 0.1 + + test + + + org.apache.maven.its.mng3775 + b + 0.1 + compile + + + + org.apache.maven.its.mng3775 + x + + + + + org.apache.maven.its.mng3775 + a + 0.1 + compile + + + + + + + org.apache.maven.its.plugins + maven-it-plugin-dependency-resolution + 2.1-SNAPSHOT + + target/compile.txt + target/test.txt + 1 + + + + resolve + validate + + compile + test + + + + + + +