Author: markh
Date: Mon Sep 17 03:53:08 2007
New Revision: 576358

URL: http://svn.apache.org/viewvc?rev=576358&view=rev
Log:
[MDEP-74] Added test for analyzing test dependencies

Added:
    
maven/shared/trunk/maven-dependency-analyzer/src/test/resources/jarWithTestDependency/
    
maven/shared/trunk/maven-dependency-analyzer/src/test/resources/jarWithTestDependency/pom.xml
   (with props)
    
maven/shared/trunk/maven-dependency-analyzer/src/test/resources/jarWithTestDependency/project1/
    
maven/shared/trunk/maven-dependency-analyzer/src/test/resources/jarWithTestDependency/project1/pom.xml
   (with props)
    
maven/shared/trunk/maven-dependency-analyzer/src/test/resources/jarWithTestDependency/project1/src/
    
maven/shared/trunk/maven-dependency-analyzer/src/test/resources/jarWithTestDependency/project1/src/main/
    
maven/shared/trunk/maven-dependency-analyzer/src/test/resources/jarWithTestDependency/project1/src/main/java/
    
maven/shared/trunk/maven-dependency-analyzer/src/test/resources/jarWithTestDependency/project1/src/main/java/jarWithTestDependency/
    
maven/shared/trunk/maven-dependency-analyzer/src/test/resources/jarWithTestDependency/project1/src/main/java/jarWithTestDependency/project1/
    
maven/shared/trunk/maven-dependency-analyzer/src/test/resources/jarWithTestDependency/project1/src/main/java/jarWithTestDependency/project1/Project1.java
   (with props)
    
maven/shared/trunk/maven-dependency-analyzer/src/test/resources/jarWithTestDependency/project2/
    
maven/shared/trunk/maven-dependency-analyzer/src/test/resources/jarWithTestDependency/project2/pom.xml
   (with props)
    
maven/shared/trunk/maven-dependency-analyzer/src/test/resources/jarWithTestDependency/project2/src/
    
maven/shared/trunk/maven-dependency-analyzer/src/test/resources/jarWithTestDependency/project2/src/test/
    
maven/shared/trunk/maven-dependency-analyzer/src/test/resources/jarWithTestDependency/project2/src/test/java/
    
maven/shared/trunk/maven-dependency-analyzer/src/test/resources/jarWithTestDependency/project2/src/test/java/jarWithTestDependency/
    
maven/shared/trunk/maven-dependency-analyzer/src/test/resources/jarWithTestDependency/project2/src/test/java/jarWithTestDependency/project2/
    
maven/shared/trunk/maven-dependency-analyzer/src/test/resources/jarWithTestDependency/project2/src/test/java/jarWithTestDependency/project2/Project2.java
   (with props)
Modified:
    
maven/shared/trunk/maven-dependency-analyzer/src/test/java/org/apache/maven/shared/dependency/analyzer/DefaultProjectDependencyAnalyzerTest.java

Modified: 
maven/shared/trunk/maven-dependency-analyzer/src/test/java/org/apache/maven/shared/dependency/analyzer/DefaultProjectDependencyAnalyzerTest.java
URL: 
http://svn.apache.org/viewvc/maven/shared/trunk/maven-dependency-analyzer/src/test/java/org/apache/maven/shared/dependency/analyzer/DefaultProjectDependencyAnalyzerTest.java?rev=576358&r1=576357&r2=576358&view=diff
==============================================================================
--- 
maven/shared/trunk/maven-dependency-analyzer/src/test/java/org/apache/maven/shared/dependency/analyzer/DefaultProjectDependencyAnalyzerTest.java
 (original)
+++ 
maven/shared/trunk/maven-dependency-analyzer/src/test/java/org/apache/maven/shared/dependency/analyzer/DefaultProjectDependencyAnalyzerTest.java
 Mon Sep 17 03:53:08 2007
@@ -87,6 +87,26 @@
         assertEquals( expectedAnalysis, actualAnalysis );
     }
     
+    public void testJarWithTestDependency() throws TestToolsException, 
ProjectDependencyAnalyzerException
+    {
+        compileProject( "jarWithTestDependency/pom.xml" );
+        
+        MavenProject project2 = getProject( 
"jarWithTestDependency/project2/pom.xml" );
+        
+        ProjectDependencyAnalysis actualAnalysis = analyzer.analyze( project2 
);
+        
+        Artifact project1 = createArtifact( 
"org.apache.maven.shared.dependency-analyzer.tests", "jarWithTestDependency1", 
"jar", "1.0", "test");
+        Set usedDeclaredArtifacts = Collections.singleton( project1 );
+        
+        // TODO: remove workaround for SUREFIRE-300 when 2.3.1 released
+        Artifact junit = createArtifact( "junit", "junit", "jar", "3.8.1", 
"test");
+        Set unusedDeclaredArtifacts = Collections.singleton( junit );
+        
+        ProjectDependencyAnalysis expectedAnalysis = new 
ProjectDependencyAnalysis( usedDeclaredArtifacts, null, unusedDeclaredArtifacts 
);
+        
+        assertEquals( expectedAnalysis, actualAnalysis );
+    }
+    
     // private methods --------------------------------------------------------
     
     private void compileProject( String pomPath ) throws TestToolsException

Added: 
maven/shared/trunk/maven-dependency-analyzer/src/test/resources/jarWithTestDependency/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/shared/trunk/maven-dependency-analyzer/src/test/resources/jarWithTestDependency/pom.xml?rev=576358&view=auto
==============================================================================
--- 
maven/shared/trunk/maven-dependency-analyzer/src/test/resources/jarWithTestDependency/pom.xml
 (added)
+++ 
maven/shared/trunk/maven-dependency-analyzer/src/test/resources/jarWithTestDependency/pom.xml
 Mon Sep 17 03:53:08 2007
@@ -0,0 +1,38 @@
+<?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/maven-v4_0_0.xsd";
+>
+       <modelVersion>4.0.0</modelVersion>
+       <groupId>org.apache.maven.shared.dependency-analyzer.tests</groupId>
+       <artifactId>jarWithTestDependency</artifactId>
+       <packaging>pom</packaging>
+       <version>1.0</version>
+       
+       <modules>
+               <module>project1</module>
+               <module>project2</module>
+       </modules>
+       
+</project>

Propchange: 
maven/shared/trunk/maven-dependency-analyzer/src/test/resources/jarWithTestDependency/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/shared/trunk/maven-dependency-analyzer/src/test/resources/jarWithTestDependency/pom.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: 
maven/shared/trunk/maven-dependency-analyzer/src/test/resources/jarWithTestDependency/project1/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/shared/trunk/maven-dependency-analyzer/src/test/resources/jarWithTestDependency/project1/pom.xml?rev=576358&view=auto
==============================================================================
--- 
maven/shared/trunk/maven-dependency-analyzer/src/test/resources/jarWithTestDependency/project1/pom.xml
 (added)
+++ 
maven/shared/trunk/maven-dependency-analyzer/src/test/resources/jarWithTestDependency/project1/pom.xml
 Mon Sep 17 03:53:08 2007
@@ -0,0 +1,33 @@
+<?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/maven-v4_0_0.xsd";
+>
+       <modelVersion>4.0.0</modelVersion>
+       <groupId>org.apache.maven.shared.dependency-analyzer.tests</groupId>
+       <artifactId>jarWithTestDependency1</artifactId>
+       <packaging>jar</packaging>
+       <version>1.0</version>
+
+</project>

Propchange: 
maven/shared/trunk/maven-dependency-analyzer/src/test/resources/jarWithTestDependency/project1/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/shared/trunk/maven-dependency-analyzer/src/test/resources/jarWithTestDependency/project1/pom.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: 
maven/shared/trunk/maven-dependency-analyzer/src/test/resources/jarWithTestDependency/project1/src/main/java/jarWithTestDependency/project1/Project1.java
URL: 
http://svn.apache.org/viewvc/maven/shared/trunk/maven-dependency-analyzer/src/test/resources/jarWithTestDependency/project1/src/main/java/jarWithTestDependency/project1/Project1.java?rev=576358&view=auto
==============================================================================
--- 
maven/shared/trunk/maven-dependency-analyzer/src/test/resources/jarWithTestDependency/project1/src/main/java/jarWithTestDependency/project1/Project1.java
 (added)
+++ 
maven/shared/trunk/maven-dependency-analyzer/src/test/resources/jarWithTestDependency/project1/src/main/java/jarWithTestDependency/project1/Project1.java
 Mon Sep 17 03:53:08 2007
@@ -0,0 +1,36 @@
+package jarWithTestDependency.project1;
+
+/*
+ * 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.
+ */
+
+/**
+ * 
+ * 
+ * @author <a href="mailto:[EMAIL PROTECTED]">Mark Hobson</a>
+ * @version $Id$
+ */
+public class Project1
+{
+    // constructors -----------------------------------------------------------
+
+    public Project1()
+    {
+        // no-op
+    }
+}

Propchange: 
maven/shared/trunk/maven-dependency-analyzer/src/test/resources/jarWithTestDependency/project1/src/main/java/jarWithTestDependency/project1/Project1.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/shared/trunk/maven-dependency-analyzer/src/test/resources/jarWithTestDependency/project1/src/main/java/jarWithTestDependency/project1/Project1.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: 
maven/shared/trunk/maven-dependency-analyzer/src/test/resources/jarWithTestDependency/project2/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/shared/trunk/maven-dependency-analyzer/src/test/resources/jarWithTestDependency/project2/pom.xml?rev=576358&view=auto
==============================================================================
--- 
maven/shared/trunk/maven-dependency-analyzer/src/test/resources/jarWithTestDependency/project2/pom.xml
 (added)
+++ 
maven/shared/trunk/maven-dependency-analyzer/src/test/resources/jarWithTestDependency/project2/pom.xml
 Mon Sep 17 03:53:08 2007
@@ -0,0 +1,64 @@
+<?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/maven-v4_0_0.xsd";
+>
+       <modelVersion>4.0.0</modelVersion>
+       <groupId>org.apache.maven.shared.dependency-analyzer.tests</groupId>
+       <artifactId>jarWithTestDependency2</artifactId>
+       <packaging>jar</packaging>
+       <version>1.0</version>
+       
+       <!-- TODO: reinstate when surefire 2.3.1 released for SUREFIRE-300 -->
+       <!--<build>
+               <pluginManagement>
+                       <plugins>
+                               <plugin>
+                                       
<groupId>org.apache.maven.plugins</groupId>
+                                       
<artifactId>maven-surefire-plugin</artifactId>
+                                       <version>2.3.1</version>
+                               </plugin>
+                       </plugins>
+               </pluginManagement>
+       </build>-->
+
+       <dependencies>
+               <dependency>
+                       
<groupId>org.apache.maven.shared.dependency-analyzer.tests</groupId>
+                       <artifactId>jarWithTestDependency1</artifactId>
+                       <version>1.0</version>
+                       <scope>test</scope>
+               </dependency>
+               
+               <!-- TODO: remove workaround for SUREFIRE-300 when 2.3.1 
released -->
+               <dependency>
+                       <groupId>junit</groupId>
+                       <artifactId>junit</artifactId>
+                       <version>3.8.1</version>
+                       <scope>test</scope>
+               </dependency>
+               
+       </dependencies> 
+       
+</project>

Propchange: 
maven/shared/trunk/maven-dependency-analyzer/src/test/resources/jarWithTestDependency/project2/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/shared/trunk/maven-dependency-analyzer/src/test/resources/jarWithTestDependency/project2/pom.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: 
maven/shared/trunk/maven-dependency-analyzer/src/test/resources/jarWithTestDependency/project2/src/test/java/jarWithTestDependency/project2/Project2.java
URL: 
http://svn.apache.org/viewvc/maven/shared/trunk/maven-dependency-analyzer/src/test/resources/jarWithTestDependency/project2/src/test/java/jarWithTestDependency/project2/Project2.java?rev=576358&view=auto
==============================================================================
--- 
maven/shared/trunk/maven-dependency-analyzer/src/test/resources/jarWithTestDependency/project2/src/test/java/jarWithTestDependency/project2/Project2.java
 (added)
+++ 
maven/shared/trunk/maven-dependency-analyzer/src/test/resources/jarWithTestDependency/project2/src/test/java/jarWithTestDependency/project2/Project2.java
 Mon Sep 17 03:53:08 2007
@@ -0,0 +1,38 @@
+package jarWithTestDependency.project2;
+
+/*
+ * 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 jarWithTestDependency.project1.Project1;
+
+/**
+ * 
+ * 
+ * @author <a href="mailto:[EMAIL PROTECTED]">Mark Hobson</a>
+ * @version $Id$
+ */
+public class Project2
+{
+    // constructors -----------------------------------------------------------
+
+    public Project2()
+    {
+        Project1 project = new Project1();
+    }
+}

Propchange: 
maven/shared/trunk/maven-dependency-analyzer/src/test/resources/jarWithTestDependency/project2/src/test/java/jarWithTestDependency/project2/Project2.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/shared/trunk/maven-dependency-analyzer/src/test/resources/jarWithTestDependency/project2/src/test/java/jarWithTestDependency/project2/Project2.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"


Reply via email to