[MSHARED-167] added IT

git-svn-id: https://svn.apache.org/repos/asf/maven/shared/trunk@1469697 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/it/mshared-167/expected-M2.txt b/src/it/mshared-167/expected-M2.txt
new file mode 100644
index 0000000..da04271
--- /dev/null
+++ b/src/it/mshared-167/expected-M2.txt
@@ -0,0 +1,18 @@
+org.apache.maven.its.dependency-tree:mshared-167:jar:1.0-SNAPSHOT
+\- org.apache.xmlgraphics:batik-swing:jar:1.7:compile
+   +- org.apache.xmlgraphics:batik-awt-util:jar:1.7:compile
+   +- org.apache.xmlgraphics:batik-bridge:jar:1.7:compile
+   |  +- org.apache.xmlgraphics:batik-anim:jar:1.7:compile
+   |  +- org.apache.xmlgraphics:batik-parser:jar:1.7:compile
+   |  +- org.apache.xmlgraphics:batik-script:jar:1.7:compile
+   |  +- org.apache.xmlgraphics:batik-xml:jar:1.7:compile
+   |  \- xalan:xalan:jar:2.6.0:compile
+   +- org.apache.xmlgraphics:batik-css:jar:1.7:compile
+   +- org.apache.xmlgraphics:batik-dom:jar:1.7:compile
+   +- org.apache.xmlgraphics:batik-ext:jar:1.7:compile
+   +- org.apache.xmlgraphics:batik-gui-util:jar:1.7:compile
+   +- org.apache.xmlgraphics:batik-gvt:jar:1.7:compile
+   +- org.apache.xmlgraphics:batik-svg-dom:jar:1.7:compile
+   +- org.apache.xmlgraphics:batik-util:jar:1.7:compile
+   +- xml-apis:xml-apis:jar:1.3.04:compile
+   \- xml-apis:xml-apis-ext:jar:1.3.04:compile
diff --git a/src/it/mshared-167/expected-M3.txt b/src/it/mshared-167/expected-M3.txt
new file mode 100644
index 0000000..e75deb6
--- /dev/null
+++ b/src/it/mshared-167/expected-M3.txt
@@ -0,0 +1,19 @@
+org.apache.maven.its.dependency-tree:mshared-167:jar:1.0-SNAPSHOT
+\- org.apache.xmlgraphics:batik-swing:jar:1.7:compile
+   +- org.apache.xmlgraphics:batik-awt-util:jar:1.7:compile
+   +- org.apache.xmlgraphics:batik-bridge:jar:1.7:compile
+   |  +- org.apache.xmlgraphics:batik-anim:jar:1.7:compile
+   |  +- org.apache.xmlgraphics:batik-parser:jar:1.7:compile
+   |  +- org.apache.xmlgraphics:batik-script:jar:1.7:compile
+   |  |  \- org.apache.xmlgraphics:batik-js:jar:1.7:compile
+   |  +- org.apache.xmlgraphics:batik-xml:jar:1.7:compile
+   |  \- xalan:xalan:jar:2.6.0:compile
+   +- org.apache.xmlgraphics:batik-css:jar:1.7:compile
+   +- org.apache.xmlgraphics:batik-dom:jar:1.7:compile
+   +- org.apache.xmlgraphics:batik-ext:jar:1.7:compile
+   +- org.apache.xmlgraphics:batik-gui-util:jar:1.7:compile
+   +- org.apache.xmlgraphics:batik-gvt:jar:1.7:compile
+   +- org.apache.xmlgraphics:batik-svg-dom:jar:1.7:compile
+   +- org.apache.xmlgraphics:batik-util:jar:1.7:compile
+   +- xml-apis:xml-apis:jar:1.3.04:compile
+   \- xml-apis:xml-apis-ext:jar:1.3.04:compile
diff --git a/src/it/mshared-167/invoker.properties b/src/it/mshared-167/invoker.properties
new file mode 100644
index 0000000..2200036
--- /dev/null
+++ b/src/it/mshared-167/invoker.properties
@@ -0,0 +1 @@
+invoker.goals = clean dependency:tree
diff --git a/src/it/mshared-167/pom.xml b/src/it/mshared-167/pom.xml
new file mode 100644
index 0000000..cfb8f76
--- /dev/null
+++ b/src/it/mshared-167/pom.xml
@@ -0,0 +1,85 @@
+<?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.dependency-tree</groupId>
+  <artifactId>mshared-167</artifactId>
+  <version>1.0-SNAPSHOT</version>
+
+  <name>Test MSHARED-167</name>
+  <description>
+    Maven 2.2.x has a bug: omits batik-js (transitive batik-swing -> batik-bridge -> batik-script -> batik-js)
+    Maven 3.x doesn't omit the transitive dependency
+  </description>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <outputFile>target/tree-M2.txt</outputFile>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.xmlgraphics</groupId>
+      <artifactId>batik-swing</artifactId>
+      <version>1.7</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-dependency-plugin</artifactId>
+          <version>2.5</version>
+          <configuration>
+            <outputFile>${outputFile}</outputFile>
+          </configuration>
+          <dependencies>
+            <dependency>
+              <groupId>@project.groupId@</groupId>
+              <artifactId>@project.artifactId@</artifactId>
+              <version>@project.version@</version>
+            </dependency>
+          </dependencies>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+
+  <profiles>
+    <profile>
+      <id>maven-3</id>
+      <activation>
+        <file>
+          <!--  This employs that the basedir expression is only recognized by Maven 3.x (see MNG-2363) -->
+          <exists>${basedir}</exists>
+         </file>
+      </activation>
+      <properties>
+        <outputFile>target/tree-M3.txt</outputFile>
+      </properties>
+    </profile>    
+  </profiles>
+</project>
diff --git a/src/it/mshared-167/verify.bsh b/src/it/mshared-167/verify.bsh
new file mode 100644
index 0000000..401c65f
--- /dev/null
+++ b/src/it/mshared-167/verify.bsh
@@ -0,0 +1,26 @@
+import java.io.*;
+
+import org.codehaus.plexus.util.*;
+
+File outputFile = new File( basedir, "target/tree-M2.txt" );
+File expectedFile = new File( basedir, "expected-M2.txt" );
+if ( ! outputFile.exists() )
+{
+  outputFile = new File( basedir, "target/tree-M3.txt" );
+  expectedFile = new File( basedir, "expected-M3.txt" );
+}
+
+String actual = FileUtils.fileRead( outputFile );
+String expected = FileUtils.fileRead( expectedFile );
+
+actual = actual.replaceAll( "[\n\r]+", "\n" );
+expected = expected.replaceAll( "[\n\r]+", "\n" );
+
+System.out.println( "Checking dependency tree..." );
+
+if ( !actual.equals( expected ) )
+{
+    throw new Exception( "Unexpected dependency tree" );
+}
+
+return true;