You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kw...@apache.org on 2022/11/28 09:12:50 UTC

[maven-integration-testing] 01/01: [MNG-7607] add IT

This is an automated email from the ASF dual-hosted git repository.

kwin pushed a commit to branch bugfix/MNG-7606
in repository https://gitbox.apache.org/repos/asf/maven-integration-testing.git

commit de37f3e337ed5c68f63ebc28ad5dedb266897ca9
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Mon Nov 28 10:12:43 2022 +0100

    [MNG-7607] add IT
---
 .../MavenITmng7606DependencyImportScopeTest.java   | 51 ++++++++++++++++++++++
 .../org/apache/maven/it/TestSuiteOrdering.java     |  1 +
 .../src/test/resources-filtered/bootstrap.txt      |  2 +
 core-it-suite/src/test/resources/mng-7606/pom.xml  | 47 ++++++++++++++++++++
 4 files changed, 101 insertions(+)

diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7606DependencyImportScopeTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7606DependencyImportScopeTest.java
new file mode 100644
index 000000000..b1f3cb0cd
--- /dev/null
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7606DependencyImportScopeTest.java
@@ -0,0 +1,51 @@
+package org.apache.maven.it;
+
+import java.io.File;
+
+import org.apache.maven.shared.verifier.Verifier;
+import org.apache.maven.shared.verifier.util.ResourceExtractor;
+import org.junit.jupiter.api.Test;
+
+/**
+ * This is a test set for <a href="https://issues.apache.org/jira/browse/MNG-7606">MNG-7606</a>.
+ * It checks that "import" scope for dependencies work
+ *
+ */
+class MavenITmng7606DependencyImportScopeTest
+    extends AbstractMavenIntegrationTestCase
+{
+
+    public MavenITmng7606DependencyImportScopeTest()
+    {
+        super( "[3.9.0,)" );
+    }
+
+    /**
+     * Verify that dependencies which are managed through imported dependency management work
+     *
+     * @throws Exception in case of failure
+     */
+    @Test
+    void testDependencyResolution()
+        throws Exception
+    {
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-7606" );
+
+        Verifier verifier = newVerifier( testDir.getAbsolutePath() );
+        verifier.setAutoclean( false );
+        //verifier.setDebugJvm( true );
+        //verifier.setForkJvm( true );
+        verifier.deleteDirectory( "target" );
+        verifier.deleteArtifacts( "org.apache.maven.its.mng7606" );
+        try
+        {
+            verifier.executeGoal( "validate" );
+            verifier.verifyErrorFreeLog();
+        }
+        finally
+        {
+            verifier.resetStreams();
+        }
+    }
+
+}
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/TestSuiteOrdering.java b/core-it-suite/src/test/java/org/apache/maven/it/TestSuiteOrdering.java
index 897e09397..24e73640e 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/TestSuiteOrdering.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/TestSuiteOrdering.java
@@ -93,6 +93,7 @@ public class TestSuiteOrdering implements ClassOrderer
          * the tests are to finishing. Newer tests are also more likely to fail, so this is
          * a fail fast technique as well.
          */
+        suite.addTestSuite( MavenITmng7606DependencyImportScopeTest.class );
         suite.addTestSuite( MavenITmng6609ProfileActivationForPackagingTest.class );
         suite.addTestSuite( MavenITmng7566JavaPrerequisiteTest.class );
         suite.addTestSuite( MavenITmng5889FindBasedir.class );
diff --git a/core-it-suite/src/test/resources-filtered/bootstrap.txt b/core-it-suite/src/test/resources-filtered/bootstrap.txt
index 602fd27fa..90c38d935 100644
--- a/core-it-suite/src/test/resources-filtered/bootstrap.txt
+++ b/core-it-suite/src/test/resources-filtered/bootstrap.txt
@@ -166,6 +166,8 @@ org.eclipse.aether:aether-spi:0.9.0.M2
 org.eclipse.sisu:org.eclipse.sisu.inject:0.0.0.M5
 org.eclipse.sisu:org.eclipse.sisu.plexus:0.0.0.M5
 org.eclipse.sisu:sisu-maven-plugin:0.3.5
+org.junit:junit-bom:5.9.1:pom
+org.junit.jupiter:junit-jupiter-engine:5.9.1
 org.ow2.asm:asm:4.1
 org.ow2.asm:asm:6.2
 org.ow2.asm:asm:7.2
diff --git a/core-it-suite/src/test/resources/mng-7606/pom.xml b/core-it-suite/src/test/resources/mng-7606/pom.xml
new file mode 100644
index 000000000..e3a46cc5d
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-7606/pom.xml
@@ -0,0 +1,47 @@
+<?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.mng7606</groupId>
+    <artifactId>test</artifactId>
+    <version>1.0-SNAPSHOT</version>
+
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.junit</groupId>
+                <artifactId>junit-bom</artifactId>
+                <version>5.9.1</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+    <dependencies>
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-engine</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+</project>