You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2018/12/27 13:16:35 UTC
[maven-integration-testing] branch master updated: [MNG-5965]
Parallel build multiplies work if multiple goals are given
This is an automated email from the ASF dual-hosted git repository.
michaelo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-integration-testing.git
The following commit(s) were added to refs/heads/master by this push:
new d3d6ea3 [MNG-5965] Parallel build multiplies work if multiple goals are given
d3d6ea3 is described below
commit d3d6ea3a6345a51a08e8dd41a0254e8cb0f2692f
Author: Duarte Meneses <du...@sonarsource.com>
AuthorDate: Wed Jul 5 10:59:49 2017 +0200
[MNG-5965] Parallel build multiplies work if multiple goals are given
This closes #22
---
.../org/apache/maven/it/IntegrationTestSuite.java | 1 +
...enITmng5965ParallelBuildMultipliesWorkTest.java | 79 ++++++++++++++++++++++
.../module-1/pom.xml | 34 ++++++++++
.../module-2/pom.xml | 34 ++++++++++
.../pom.xml | 35 ++++++++++
5 files changed, 183 insertions(+)
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java b/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
index 9515e73..324bcf5 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
@@ -108,6 +108,7 @@ public class IntegrationTestSuite
suite.addTestSuite( MavenITmng6386BaseUriPropertyTest.class );
suite.addTestSuite( MavenITmng6330RelativePath.class );
+ suite.addTestSuite( MavenITmng5965ParallelBuildMultipliesWorkTest.class );
suite.addTestSuite( MavenITmng6240PluginExtensionAetherProvider.class );
suite.addTestSuite( MavenITmng6223FindBasedir.class );
suite.addTestSuite( MavenITmng6189SiteReportPluginsWarningTest.class );
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5965ParallelBuildMultipliesWorkTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5965ParallelBuildMultipliesWorkTest.java
new file mode 100644
index 0000000..508b9c7
--- /dev/null
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5965ParallelBuildMultipliesWorkTest.java
@@ -0,0 +1,79 @@
+package org.apache.maven.it;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.maven.it.util.ResourceExtractor;
+
+/**
+ * Test set for <a href="https://issues.apache.org/jira/browse/MNG-5965">MNG-5965</a>.
+ */
+public class MavenITmng5965ParallelBuildMultipliesWorkTest
+ extends AbstractMavenIntegrationTestCase
+{
+ public MavenITmng5965ParallelBuildMultipliesWorkTest()
+ {
+ super( "[3.0,)" );
+ }
+
+ public void testItShouldOnlyRunEachTaskOnce()
+ throws Exception
+ {
+ File testDir =
+ ResourceExtractor.simpleExtractResources( getClass(), "/mng-5965-parallel-build-multiplies-work" );
+
+ Verifier verifier = newVerifier( testDir.getAbsolutePath(), false );
+ verifier.setMavenDebug( false );
+ verifier.setAutoclean( false );
+
+ verifier.setLogFileName( "log-only.txt" );
+ verifier.addCliOption( "-T1" );
+ // include an aggregator task so that the two goals end up in different task segments
+ verifier.executeGoals( Arrays.asList( "clean", "install:help" ) );
+ verifier.verifyErrorFreeLog();
+ verifier.resetStreams();
+
+ List<String> logLines = verifier.loadLines( "log-only.txt", "UTF-8" );
+
+ List<String> cleanGoalsExecuted = findCleanExecutions( logLines );
+
+ // clean only executed once per module
+ assertNoRepeatedLines( cleanGoalsExecuted );
+
+ // clean executed in the 3 modules
+ assertEquals( cleanGoalsExecuted.size(), 3 );
+ }
+
+ private void assertNoRepeatedLines( List<String> logLines )
+ throws VerificationException
+ {
+ Set<String> uniqueLines = new LinkedHashSet<>();
+ for ( String line : logLines )
+ {
+ if ( uniqueLines.contains( line ) )
+ {
+ throw new VerificationException( "Goal executed twice: " + line );
+ }
+ uniqueLines.add( line );
+ }
+ }
+
+ private List<String> findCleanExecutions( List<String> fullLog )
+ {
+ List<String> cleanExecutions = new ArrayList<>();
+ for ( String line : fullLog )
+ {
+ if ( line.contains( "(default-clean)" ) )
+ {
+ cleanExecutions.add( line );
+ }
+ }
+
+ return cleanExecutions;
+ }
+
+}
diff --git a/core-it-suite/src/test/resources/mng-5965-parallel-build-multiplies-work/module-1/pom.xml b/core-it-suite/src/test/resources/mng-5965-parallel-build-multiplies-work/module-1/pom.xml
new file mode 100644
index 0000000..5c64b41
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-5965-parallel-build-multiplies-work/module-1/pom.xml
@@ -0,0 +1,34 @@
+<?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 xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>mng-5965-parallel-build-multiplies-work</groupId>
+ <artifactId>base-project</artifactId>
+ <version>0.1</version>
+ </parent>
+
+ <artifactId>module-1</artifactId>
+ <packaging>pom</packaging>
+</project>
diff --git a/core-it-suite/src/test/resources/mng-5965-parallel-build-multiplies-work/module-2/pom.xml b/core-it-suite/src/test/resources/mng-5965-parallel-build-multiplies-work/module-2/pom.xml
new file mode 100644
index 0000000..c4637ce
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-5965-parallel-build-multiplies-work/module-2/pom.xml
@@ -0,0 +1,34 @@
+<?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 xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>mng-5965-parallel-build-multiplies-work</groupId>
+ <artifactId>base-project</artifactId>
+ <version>0.1</version>
+ </parent>
+
+ <artifactId>module-2</artifactId>
+ <packaging>pom</packaging>
+</project>
diff --git a/core-it-suite/src/test/resources/mng-5965-parallel-build-multiplies-work/pom.xml b/core-it-suite/src/test/resources/mng-5965-parallel-build-multiplies-work/pom.xml
new file mode 100644
index 0000000..971ef54
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-5965-parallel-build-multiplies-work/pom.xml
@@ -0,0 +1,35 @@
+<?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 xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>mng-5965-parallel-build-multiplies-work</groupId>
+ <artifactId>base-project</artifactId>
+ <version>0.1</version>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>module-1</module>
+ <module>module-2</module>
+ </modules>
+</project>