[MNG-5600] Dependency management import should support exclusions.

Project: http://git-wip-us.apache.org/repos/asf/maven-integration-testing/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/maven-integration-testing/commit/e8745ea4
Tree: 
http://git-wip-us.apache.org/repos/asf/maven-integration-testing/tree/e8745ea4
Diff: 
http://git-wip-us.apache.org/repos/asf/maven-integration-testing/diff/e8745ea4

Branch: refs/heads/DEPMGMT
Commit: e8745ea463032382e621c297efe4a5b626dcb47b
Parents: e929084
Author: Christian Schulte <schu...@apache.org>
Authored: Sun Jun 19 17:18:51 2016 +0200
Committer: Christian Schulte <schu...@apache.org>
Committed: Thu Feb 2 04:16:45 2017 +0100

----------------------------------------------------------------------
 .../apache/maven/it/IntegrationTestSuite.java   |  1 +
 ...ependencyManagementImportExclusionsTest.java | 82 +++++++++++++++++++
 .../test/resources/mng-5600/exclusions/pom.xml  | 84 ++++++++++++++++++++
 .../apache/maven/its/mng5600/bom/0/bom-0.pom    | 44 ++++++++++
 .../resources/mng-5600/settings-template.xml    | 43 ++++++++++
 5 files changed, 254 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/e8745ea4/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
----------------------------------------------------------------------
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 8f1477c..f896f66 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
         // 
-------------------------------------------------------------------------------------------------------------
         // suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- 
MNG-3137
 
+        suite.addTestSuite( 
MavenITmng5600DependencyManagementImportExclusionsTest.class );
         suite.addTestSuite( 
MavenITmng5527DependencyManagementImportRelocationsTest.class );
         suite.addTestSuite( 
MavenITmng4463DependencyManagementImportVersionRanges.class );
         suite.addTestSuite( MavenITmng5958LifecyclePhaseBinaryCompat.class );

http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/e8745ea4/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5600DependencyManagementImportExclusionsTest.java
----------------------------------------------------------------------
diff --git 
a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5600DependencyManagementImportExclusionsTest.java
 
b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5600DependencyManagementImportExclusionsTest.java
new file mode 100644
index 0000000..fc2ef63
--- /dev/null
+++ 
b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5600DependencyManagementImportExclusionsTest.java
@@ -0,0 +1,82 @@
+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 java.io.File;
+import java.util.Arrays;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.maven.it.util.ResourceExtractor;
+
+import static junit.framework.Assert.assertEquals;
+
+/**
+ * [MNG-5600] Dependency management import should support exclusions.
+ *
+ * @author Christian Schulte
+ */
+public class MavenITmng5600DependencyManagementImportExclusionsTest
+    extends AbstractMavenIntegrationTestCase
+{
+
+    public MavenITmng5600DependencyManagementImportExclusionsTest()
+    {
+        super( "[3.5.1,)" );
+    }
+
+    public void testCanExcludeDependenciesFromImport()
+        throws Exception
+    {
+        final File testDir = ResourceExtractor.simpleExtractResources( 
getClass(), "/mng-5600/exclusions" );
+
+        final Verifier verifier = newVerifier( testDir.getAbsolutePath() );
+        verifier.setAutoclean( false );
+        verifier.filterFile( "../settings-template.xml", "settings.xml", 
"UTF-8",
+                             (Map) verifier.newDefaultFilterProperties() );
+
+        verifier.addCliOption( "-s" );
+        verifier.addCliOption( "settings.xml" );
+        verifier.executeGoals( Arrays.asList( new String[]
+        {
+            "clean", "verify"
+        } ) );
+        verifier.verifyErrorFreeLog();
+        verifier.resetStreams();
+
+        final Properties properties = verifier.loadProperties( 
"target/project.properties" );
+        assertEquals( "1", properties.getProperty( 
"project.dependencyManagement.dependencies" ) );
+        assertEquals( "commons-lang:commons-lang:jar",
+                      properties.getProperty( 
"project.dependencyManagement.dependencies.0.managementKey" ) );
+
+        assertEquals( "2", properties.getProperty( 
"project.dependencyManagement.dependencies.0.exclusions" ) );
+        assertEquals( "commons-io",
+                      properties.getProperty( 
"project.dependencyManagement.dependencies.0.exclusions.0.groupId" ) );
+
+        assertEquals( "commons-io",
+                      properties.getProperty( 
"project.dependencyManagement.dependencies.0.exclusions.0.artifactId" ) );
+
+        assertEquals( "commons-logging",
+                      properties.getProperty( 
"project.dependencyManagement.dependencies.0.exclusions.1.groupId" ) );
+
+        assertEquals( "commons-logging",
+                      properties.getProperty( 
"project.dependencyManagement.dependencies.0.exclusions.1.artifactId" ) );
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/e8745ea4/core-it-suite/src/test/resources/mng-5600/exclusions/pom.xml
----------------------------------------------------------------------
diff --git a/core-it-suite/src/test/resources/mng-5600/exclusions/pom.xml 
b/core-it-suite/src/test/resources/mng-5600/exclusions/pom.xml
new file mode 100644
index 0000000..dc06836
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-5600/exclusions/pom.xml
@@ -0,0 +1,84 @@
+<?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>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.mng5600</groupId>
+  <artifactId>0</artifactId>
+  <version>20160619</version>
+  <packaging>pom</packaging>
+
+  <name>Maven Integration Test :: MNG-5600</name>
+
+  <description>
+    Tests that dependency management import exclusions are supported.
+  </description>
+
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>org.apache.maven.its.mng5600</groupId>
+        <artifactId>bom</artifactId>
+        <version>0</version>
+        <type>pom</type>
+        <scope>import</scope>
+        <exclusions>
+          <exclusion>
+            <!-- Exclude commons-io from BOM and from all imported 
dependencies. -->
+            <groupId>commons-io</groupId>
+            <artifactId>commons-io</artifactId>
+          </exclusion>
+          <exclusion>
+            <!-- Exclude commons-logging from all imported dependencies. -->
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+          </exclusion>
+        </exclusions>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.its.plugins</groupId>
+        <artifactId>maven-it-plugin-expression</artifactId>
+        <version>2.1-SNAPSHOT</version>
+        <executions>
+          <execution>
+            <phase>verify</phase>
+            <goals>
+              <goal>eval</goal>
+            </goals>
+            <configuration>
+              <expressions>
+                <expression>project/dependencyManagement</expression>
+              </expressions>
+              
<outputFile>${project.build.directory}/project.properties</outputFile>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>

http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/e8745ea4/core-it-suite/src/test/resources/mng-5600/repo/org/apache/maven/its/mng5600/bom/0/bom-0.pom
----------------------------------------------------------------------
diff --git 
a/core-it-suite/src/test/resources/mng-5600/repo/org/apache/maven/its/mng5600/bom/0/bom-0.pom
 
b/core-it-suite/src/test/resources/mng-5600/repo/org/apache/maven/its/mng5600/bom/0/bom-0.pom
new file mode 100644
index 0000000..6598212
--- /dev/null
+++ 
b/core-it-suite/src/test/resources/mng-5600/repo/org/apache/maven/its/mng5600/bom/0/bom-0.pom
@@ -0,0 +1,44 @@
+<?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>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.mng5600</groupId>
+  <artifactId>bom</artifactId>
+  <version>0</version>
+  <packaging>pom</packaging>
+
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>commons-io</groupId>
+        <artifactId>commons-io</artifactId>
+        <version>2.5</version>
+      </dependency>
+      <dependency>
+        <groupId>commons-lang</groupId>
+        <artifactId>commons-lang</artifactId>
+        <version>2.6</version>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+</project>

http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/e8745ea4/core-it-suite/src/test/resources/mng-5600/settings-template.xml
----------------------------------------------------------------------
diff --git a/core-it-suite/src/test/resources/mng-5600/settings-template.xml 
b/core-it-suite/src/test/resources/mng-5600/settings-template.xml
new file mode 100644
index 0000000..f22a7f3
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-5600/settings-template.xml
@@ -0,0 +1,43 @@
+<?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.
+-->
+
+<settings>
+  <profiles>
+    <profile>
+      <id>maven-core-it-repo</id>
+      <repositories>
+        <repository>
+          <id>maven-core-it</id>
+          <url>@baseurl@/../repo</url>
+          <releases>
+            <checksumPolicy>ignore</checksumPolicy>
+          </releases>
+          <snapshots>
+            <enabled>false</enabled>
+          </snapshots>
+        </repository>
+      </repositories>
+    </profile>
+  </profiles>
+  <activeProfiles>
+    <activeProfile>maven-core-it-repo</activeProfile>
+  </activeProfiles>
+</settings>

Reply via email to