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 2022/07/29 09:30:45 UTC

[maven-integration-testing] branch master updated: [MNG-7443] Implement consistent logging between optional projects and optional profiles

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 393f6242d [MNG-7443] Implement consistent logging between optional projects and optional profiles
393f6242d is described below

commit 393f6242d93eb1ef951268c94a1699d2f3567563
Author: Giovanni van der Schelde <Gi...@infosupport.com>
AuthorDate: Tue May 24 14:28:11 2022 +0200

    [MNG-7443] Implement consistent logging between optional projects and optional profiles
    
    This closes #168
---
 .../org/apache/maven/it/IntegrationTestSuite.java  |  1 +
 ...nsistencyOfOptionalProjectsAndProfilesTest.java | 74 ++++++++++++++++++++++
 .../pom.xml                                        | 36 +++++++++++
 3 files changed, 111 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 76b4c4084..eddacd921 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
@@ -106,6 +106,7 @@ public class IntegrationTestSuite
         // Tests that don't run stable and need to be fixed
         // -------------------------------------------------------------------------------------------------------------
         // suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
+        suite.addTestSuite( MavenITmng7443ConsistencyOfOptionalProjectsAndProfilesTest.class );
         suite.addTestSuite( MavenITmng7353CliGoalInvocationTest.class );
         suite.addTestSuite( MavenITmng7504NotWarnUnsupportedReportPluginsTest.class );
         suite.addTestSuite( MavenITmng7160ExtensionClassloader.class );
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7443ConsistencyOfOptionalProjectsAndProfilesTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7443ConsistencyOfOptionalProjectsAndProfilesTest.java
new file mode 100644
index 000000000..68679cf51
--- /dev/null
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7443ConsistencyOfOptionalProjectsAndProfilesTest.java
@@ -0,0 +1,74 @@
+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.util.ResourceExtractor;
+import org.junit.Assert;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+
+public class MavenITmng7443ConsistencyOfOptionalProjectsAndProfilesTest extends AbstractMavenIntegrationTestCase
+{
+    public MavenITmng7443ConsistencyOfOptionalProjectsAndProfilesTest()
+    {
+        super( "[4.0.0-alpha-1,)" );
+    }
+
+    public void testConsistentLoggingOfOptionalProfilesAndProjects() throws IOException, VerificationException
+    {
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(),
+                "/mng-7443-consistency-of-optional-profiles-and-projects" );
+
+        Verifier verifier = newVerifier( testDir.getAbsolutePath() );
+        verifier.addCliOption( "-pl" );
+        verifier.addCliOption( "?:does-not-exist" );
+        verifier.addCliOption( "-P" );
+        verifier.addCliOption( "?does-not-exist-either" );
+
+        verifier.executeGoals( Arrays.asList( "clean", "verify" ) );
+
+        final List<String> logLines = verifier.loadFile( verifier.getBasedir(), verifier.getLogFileName(), false );
+
+        int projectSelectorMissingCounter = 0;
+        int profileSelectorMissingCounter = 0;
+
+        for ( String logLine : logLines )
+        {
+            if ( logLine.contains( "The requested optional projects" )
+                    && logLine.contains( ":does-not-exist" )
+                    && logLine.contains( "do not exist" ) )
+            {
+                projectSelectorMissingCounter++;
+            }
+            if ( logLine.contains( "The requested optional profiles" )
+                    && logLine.contains( "does-not-exist-either" )
+                    && logLine.contains( "do not exist" ) )
+            {
+                profileSelectorMissingCounter++;
+            }
+        }
+
+        Assert.assertEquals( 2, profileSelectorMissingCounter );
+        Assert.assertEquals( 2, projectSelectorMissingCounter );
+    }
+}
diff --git a/core-it-suite/src/test/resources/mng-7443-consistency-of-optional-profiles-and-projects/pom.xml b/core-it-suite/src/test/resources/mng-7443-consistency-of-optional-profiles-and-projects/pom.xml
new file mode 100644
index 000000000..c2de91f27
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-7443-consistency-of-optional-profiles-and-projects/pom.xml
@@ -0,0 +1,36 @@
+<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">
+  <!--
+   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.
+   -->
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.mng7443</groupId>
+  <artifactId>consistent-logging-of-optional-projects-and-profiles-selectors</artifactId>
+  <version>1.0</version>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>3.10.1</version>
+      </plugin>
+    </plugins>
+  </build>
+</project>