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 28628f2781..92ded81a3b 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 static Test suite() // suite.addTestSuite( MavenIT0109ReleaseUpdateTest.class ); // suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137 + suite.addTestSuite( MavenITmng3887PluginExecutionOrderTest.class ); suite.addTestSuite( MavenITmng3886ExecutionGoalsOrderTest.class ); suite.addTestSuite( MavenITmng3877BasedirAlignedModelTest.class ); suite.addTestSuite( MavenITmng3873MultipleExecutionGoalsTest.class ); diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3887PluginExecutionOrderTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3887PluginExecutionOrderTest.java new file mode 100644 index 0000000000..186d10ca78 --- /dev/null +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3887PluginExecutionOrderTest.java @@ -0,0 +1,79 @@ +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.Arrays; +import java.util.List; + +/** + * This is a test set for MNG-3887. + * + * @author Benjamin Bentmann + * @version $Id$ + */ +public class MavenITmng3887PluginExecutionOrderTest + extends AbstractMavenIntegrationTestCase +{ + + public MavenITmng3887PluginExecutionOrderTest() + { + } + + /** + * Test that multiple plugin executions bound to the same phase are executed in the order given by the POM when no + * is involved. + */ + public void testitWithoutPluginManagement() + throws Exception + { + testitMNG3887( "test-1" ); + } + + /** + * Test that multiple plugin executions bound to the same phase are executed in the order given by the POM when + * is involved. + */ + public void testitWithPluginManagement() + throws Exception + { + testitMNG3887( "test-2" ); + } + + private void testitMNG3887( String project ) + throws Exception + { + File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3887" ); + + Verifier verifier = new Verifier( new File( testDir, project ).getAbsolutePath() ); + verifier.setAutoclean( false ); + verifier.deleteDirectory( "target" ); + verifier.executeGoal( "validate" ); + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + + List lines = verifier.loadLines( "target/it.log", "UTF-8" ); + assertEquals( Arrays.asList( new String[] { "test", "----" } ), lines ); + } + +} diff --git a/its/core-it-suite/src/test/resources/mng-3887/test-1/pom.xml b/its/core-it-suite/src/test/resources/mng-3887/test-1/pom.xml new file mode 100644 index 0000000000..5295a088d7 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-3887/test-1/pom.xml @@ -0,0 +1,80 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng3887 + test-1 + 0.1 + pom + + Maven Integration Test :: MNG-3887 + + Test that multiple plugin executions bound to the same phase are executed in the order given by the POM. + + + + + + + org.apache.maven.its.plugins + maven-it-plugin-log-file + 2.1-SNAPSHOT + + target/it.log + test + 4 + + + + test-1 + validate + + log-separator + + + + test-2 + validate + + reset + + + + test-3 + validate + + log-string + + + + test-4 + validate + + log-separator + + + + + + + diff --git a/its/core-it-suite/src/test/resources/mng-3887/test-2/pom.xml b/its/core-it-suite/src/test/resources/mng-3887/test-2/pom.xml new file mode 100644 index 0000000000..9885bfe011 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-3887/test-2/pom.xml @@ -0,0 +1,89 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng3886 + test-2 + 0.1 + pom + + Maven Integration Test :: MNG-3886 + + Test that multiple plugin executions bound to the same phase are executed in the order given by the POM. + + + + + + + + org.apache.maven.its.plugins + maven-it-plugin-log-file + 2.1-SNAPSHOT + + + + + + org.apache.maven.its.plugins + maven-it-plugin-log-file + 2.1-SNAPSHOT + + target/it.log + test + 4 + + + + test-1 + validate + + log-separator + + + + test-2 + validate + + reset + + + + test-3 + validate + + log-string + + + + test-4 + validate + + log-separator + + + + + + +