You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ma...@apache.org on 2020/10/19 18:08:56 UTC
[maven-integration-testing] branch master updated: [MNG-6981]
Verify that the --projects switch will include the children of the targeted
projects.
This is an automated email from the ASF dual-hosted git repository.
martinkanters 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 a3813fd [MNG-6981] Verify that the --projects switch will include the children of the targeted projects.
a3813fd is described below
commit a3813fd0eaebaa4887d24944f3a62b29dece0065
Author: Martin Kanters <ma...@apache.org>
AuthorDate: Wed Sep 9 18:11:12 2020 +0200
[MNG-6981] Verify that the --projects switch will include the children of the targeted projects.
This closes #71
---
.../org/apache/maven/it/IntegrationTestSuite.java | 2 +
...ITmng4262MakeLikeReactorDottedPath370Test.java} | 13 ++---
...avenITmng4262MakeLikeReactorDottedPathTest.java | 2 +-
...ng6981ProjectListShouldIncludeChildrenTest.java | 68 ++++++++++++++++++++++
.../module-a/module-a-1/pom.xml | 36 ++++++++++++
.../module-a/pom.xml | 42 +++++++++++++
.../mng-6981-pl-should-include-children/pom.xml | 48 +++++++++++++++
7 files changed, 203 insertions(+), 8 deletions(-)
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 ed6554f..24fd5b7 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
@@ -107,6 +107,7 @@ public class IntegrationTestSuite
// -------------------------------------------------------------------------------------------------------------
// suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
+ suite.addTestSuite( MavenITmng6981ProjectListShouldIncludeChildrenTest.class );
suite.addTestSuite( MavenITmng6972AllowAccessToGraphPackageTest.class );
suite.addTestSuite( MavenITmng6772NestedImportScopeRepositoryOverride.class );
suite.addTestSuite( MavenITmng6759TransitiveDependencyRepositoriesTest.class );
@@ -359,6 +360,7 @@ public class IntegrationTestSuite
suite.addTestSuite( MavenITmng4270ArtifactHandlersFromPluginDepsTest.class );
suite.addTestSuite( MavenITmng4269BadReactorResolutionFromOutDirTest.class );
suite.addTestSuite( MavenITmng4262MakeLikeReactorDottedPathTest.class );
+ suite.addTestSuite( MavenITmng4262MakeLikeReactorDottedPath370Test.class );
suite.addTestSuite( MavenITmng4254SelectableWagonProvidersTest.class );
suite.addTestSuite( MavenITmng4238ArtifactHandlerExtensionUsageTest.class );
suite.addTestSuite( MavenITmng4235HttpAuthDeploymentChecksumsTest.class );
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4262MakeLikeReactorDottedPathTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4262MakeLikeReactorDottedPath370Test.java
similarity index 91%
copy from core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4262MakeLikeReactorDottedPathTest.java
copy to core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4262MakeLikeReactorDottedPath370Test.java
index 0daa9f3..388974b 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4262MakeLikeReactorDottedPathTest.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4262MakeLikeReactorDottedPath370Test.java
@@ -19,23 +19,22 @@ package org.apache.maven.it;
* under the License.
*/
-import java.io.File;
-
-import org.apache.maven.it.Verifier;
import org.apache.maven.it.util.ResourceExtractor;
+import java.io.File;
+
/**
* This is a test set for <a href="https://issues.apache.org/jira/browse/MNG-4262">MNG-4262</a>.
*
* @author Benjamin Bentmann
*/
-public class MavenITmng4262MakeLikeReactorDottedPathTest
+public class MavenITmng4262MakeLikeReactorDottedPath370Test
extends AbstractMavenIntegrationTestCase
{
- public MavenITmng4262MakeLikeReactorDottedPathTest()
+ public MavenITmng4262MakeLikeReactorDottedPath370Test()
{
- super( "[3.0-alpha-3,)" );
+ super( "[3.7.0,)" );
}
private void clean( Verifier verifier )
@@ -64,7 +63,7 @@ public class MavenITmng4262MakeLikeReactorDottedPathTest
verifier.resetStreams();
verifier.assertFilePresent( "target/touch.txt" );
- verifier.assertFileNotPresent( "../sub-a/target/touch.txt" );
+ verifier.assertFilePresent( "../sub-a/target/touch.txt" );
}
/**
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4262MakeLikeReactorDottedPathTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4262MakeLikeReactorDottedPathTest.java
index 0daa9f3..0b19956 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4262MakeLikeReactorDottedPathTest.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4262MakeLikeReactorDottedPathTest.java
@@ -35,7 +35,7 @@ public class MavenITmng4262MakeLikeReactorDottedPathTest
public MavenITmng4262MakeLikeReactorDottedPathTest()
{
- super( "[3.0-alpha-3,)" );
+ super( "[3.0-alpha-3,3.7.0)" );
}
private void clean( Verifier verifier )
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6981ProjectListShouldIncludeChildrenTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6981ProjectListShouldIncludeChildrenTest.java
new file mode 100644
index 0000000..0894390
--- /dev/null
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6981ProjectListShouldIncludeChildrenTest.java
@@ -0,0 +1,68 @@
+package org.apache.maven.it;
+
+import org.apache.maven.it.util.ResourceExtractor;
+
+import java.io.File;
+import java.util.List;
+
+public class MavenITmng6981ProjectListShouldIncludeChildrenTest
+ extends AbstractMavenIntegrationTestCase
+{
+
+ private static final String RESOURCE_PATH = "/mng-6981-pl-should-include-children";
+
+ public MavenITmng6981ProjectListShouldIncludeChildrenTest()
+ {
+ super( "[3.7.0,)" );
+ }
+
+ public void testProjectListShouldIncludeChildrenByDefault()
+ throws Exception
+ {
+ final File testDir = ResourceExtractor.simpleExtractResources( getClass(), RESOURCE_PATH );
+ Verifier verifier = newVerifier( testDir.getAbsolutePath() );
+
+ verifier.addCliOption( "-pl" );
+ verifier.addCliOption( ":module-a" );
+ verifier.executeGoal( "compile" );
+ verifier.verifyTextInLog( "Building module-a-1 1.0" );
+ }
+
+ /**
+ * Since --pl's behavior is changed, make sure the alternative for building a pom without its children still works.
+ */
+ public void testFileSwitchAllowsExcludeOfChildren()
+ throws Exception
+ {
+ final File testDir = ResourceExtractor.simpleExtractResources( getClass(), RESOURCE_PATH );
+ Verifier verifier = newVerifier( testDir.getAbsolutePath() );
+
+ verifier.addCliOption( "-f" );
+ verifier.addCliOption( "module-a" );
+ verifier.addCliOption( "--non-recursive" );
+ verifier.setLogFileName( "log-non-recursive.txt" );
+ verifier.executeGoal( "compile" );
+ verifyTextNotInLog( verifier, "Building module-a-1 1.0" );
+ }
+
+ /**
+ * Throws an exception if the text <strong>is</strong> present in the log.
+ *
+ * @param verifier the verifier to use
+ * @param text the text to assert present
+ * @throws VerificationException if text is not found in log
+ */
+ private void verifyTextNotInLog( Verifier verifier, String text )
+ throws VerificationException
+ {
+ List<String> lines = verifier.loadFile( verifier.getBasedir(), verifier.getLogFileName(), false );
+
+ for ( String line : lines )
+ {
+ if ( Verifier.stripAnsi( line ).contains( text ) )
+ {
+ throw new VerificationException( "Text found in log: " + text );
+ }
+ }
+ }
+}
diff --git a/core-it-suite/src/test/resources/mng-6981-pl-should-include-children/module-a/module-a-1/pom.xml b/core-it-suite/src/test/resources/mng-6981-pl-should-include-children/module-a/module-a-1/pom.xml
new file mode 100644
index 0000000..f004e69
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-6981-pl-should-include-children/module-a/module-a-1/pom.xml
@@ -0,0 +1,36 @@
+<?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>
+
+ <artifactId>module-a-1</artifactId>
+
+ <parent>
+ <groupId>org.apache.maven.its.mng6981</groupId>
+ <artifactId>module-a</artifactId>
+ <version>1.0</version>
+ </parent>
+
+</project>
diff --git a/core-it-suite/src/test/resources/mng-6981-pl-should-include-children/module-a/pom.xml b/core-it-suite/src/test/resources/mng-6981-pl-should-include-children/module-a/pom.xml
new file mode 100644
index 0000000..2b1c7fa
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-6981-pl-should-include-children/module-a/pom.xml
@@ -0,0 +1,42 @@
+<?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>
+
+ <artifactId>module-a</artifactId>
+
+ <packaging>pom</packaging>
+
+ <parent>
+ <groupId>org.apache.maven.its.mng6981</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0</version>
+ </parent>
+
+ <modules>
+ <module>module-a-1</module>
+ </modules>
+
+</project>
diff --git a/core-it-suite/src/test/resources/mng-6981-pl-should-include-children/pom.xml b/core-it-suite/src/test/resources/mng-6981-pl-should-include-children/pom.xml
new file mode 100644
index 0000000..0d23baf
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-6981-pl-should-include-children/pom.xml
@@ -0,0 +1,48 @@
+<?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>org.apache.maven.its.mng6981</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0</version>
+
+ <packaging>pom</packaging>
+
+ <name>Maven Integration Test :: MNG-6981</name>
+ <description>
+ Test that the --projects flag will include the target project's children in the reactor.
+ </description>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <maven.compiler.source>1.8</maven.compiler.source>
+ <maven.compiler.target>1.8</maven.compiler.target>
+ </properties>
+
+ <modules>
+ <module>module-a</module>
+ </modules>
+
+</project>