maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r576940 - in /maven/shared/trunk/maven-dependency-tree/src: main/java/org/apache/maven/shared/dependency/tree/traversal/ test/java/org/apache/maven/shared/dependency/tree/ test/java/org/apache/maven/shared/dependency/tree/traversal/
Date Tue, 18 Sep 2007 15:01:38 GMT
Author: markh
Date: Tue Sep 18 08:01:37 2007
New Revision: 576940

URL: http://svn.apache.org/viewvc?rev=576940&view=rev
Log:
Correctly clone all node properties in BuildingDependencyNodeVisitor.

Modified:
    maven/shared/trunk/maven-dependency-tree/src/main/java/org/apache/maven/shared/dependency/tree/traversal/BuildingDependencyNodeVisitor.java
    maven/shared/trunk/maven-dependency-tree/src/test/java/org/apache/maven/shared/dependency/tree/AbstractDependencyNodeTest.java
    maven/shared/trunk/maven-dependency-tree/src/test/java/org/apache/maven/shared/dependency/tree/traversal/BuildingDependencyNodeVisitorTest.java

Modified: maven/shared/trunk/maven-dependency-tree/src/main/java/org/apache/maven/shared/dependency/tree/traversal/BuildingDependencyNodeVisitor.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-dependency-tree/src/main/java/org/apache/maven/shared/dependency/tree/traversal/BuildingDependencyNodeVisitor.java?rev=576940&r1=576939&r2=576940&view=diff
==============================================================================
--- maven/shared/trunk/maven-dependency-tree/src/main/java/org/apache/maven/shared/dependency/tree/traversal/BuildingDependencyNodeVisitor.java
(original)
+++ maven/shared/trunk/maven-dependency-tree/src/main/java/org/apache/maven/shared/dependency/tree/traversal/BuildingDependencyNodeVisitor.java
Tue Sep 18 08:01:37 2007
@@ -83,6 +83,10 @@
     {
         // clone the node
         DependencyNode newNode = new DependencyNode( node.getArtifact(), node.getState(),
node.getRelatedArtifact() );
+        newNode.setOriginalScope( node.getOriginalScope() );
+        newNode.setFailedUpdateScope( node.getFailedUpdateScope() );
+        newNode.setPremanagedVersion( node.getPremanagedVersion() );
+        newNode.setPremanagedScope( node.getPremanagedScope() );
 
         if ( parentNodes.empty() )
         {

Modified: maven/shared/trunk/maven-dependency-tree/src/test/java/org/apache/maven/shared/dependency/tree/AbstractDependencyNodeTest.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-dependency-tree/src/test/java/org/apache/maven/shared/dependency/tree/AbstractDependencyNodeTest.java?rev=576940&r1=576939&r2=576940&view=diff
==============================================================================
--- maven/shared/trunk/maven-dependency-tree/src/test/java/org/apache/maven/shared/dependency/tree/AbstractDependencyNodeTest.java
(original)
+++ maven/shared/trunk/maven-dependency-tree/src/test/java/org/apache/maven/shared/dependency/tree/AbstractDependencyNodeTest.java
Tue Sep 18 08:01:37 2007
@@ -35,11 +35,26 @@
 
     protected DependencyNode createNode( String id )
     {
-        return new DependencyNode( createArtifact( id ) );
+        return createNode( id, DependencyNode.INCLUDED );
+    }
+
+    protected DependencyNode createNode( String id, int state )
+    {
+        return createNode( id, state, null );
+    }
+
+    protected DependencyNode createNode( String id, int state, String relatedId )
+    {
+        return new DependencyNode( createArtifact( id ), state, createArtifact( relatedId
) );
     }
 
     protected Artifact createArtifact( String id )
     {
+        if ( id == null )
+        {
+            return null;
+        }
+        
         String[] tokens = id.split( ":" );
 
         return createArtifact( get( tokens, 0 ), get( tokens, 1 ), get( tokens, 2 ), get(
tokens, 3 ), get( tokens, 4 ) );

Modified: maven/shared/trunk/maven-dependency-tree/src/test/java/org/apache/maven/shared/dependency/tree/traversal/BuildingDependencyNodeVisitorTest.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-dependency-tree/src/test/java/org/apache/maven/shared/dependency/tree/traversal/BuildingDependencyNodeVisitorTest.java?rev=576940&r1=576939&r2=576940&view=diff
==============================================================================
--- maven/shared/trunk/maven-dependency-tree/src/test/java/org/apache/maven/shared/dependency/tree/traversal/BuildingDependencyNodeVisitorTest.java
(original)
+++ maven/shared/trunk/maven-dependency-tree/src/test/java/org/apache/maven/shared/dependency/tree/traversal/BuildingDependencyNodeVisitorTest.java
Tue Sep 18 08:01:37 2007
@@ -51,6 +51,88 @@
         assertEquals( sourceNode, resultNode );
     }
 
+    public void testVisitNodeWithState()
+    {
+        DependencyNode sourceNode = createNode( "g:a:t:1", DependencyNode.OMITTED_FOR_CYCLE
);
+
+        visitor = new BuildingDependencyNodeVisitor();
+        visitor.visit( sourceNode );
+        visitor.endVisit( sourceNode );
+
+        DependencyNode resultNode = visitor.getDependencyTree();
+        assertNotSame( sourceNode, resultNode );
+        assertEquals( sourceNode, resultNode );
+    }
+
+    public void testVisitNodeWithRelatedArtifact()
+    {
+        DependencyNode sourceNode = createNode( "g:a:t:1", DependencyNode.OMITTED_FOR_CONFLICT,
"g:a:t:2" );
+
+        visitor = new BuildingDependencyNodeVisitor();
+        visitor.visit( sourceNode );
+        visitor.endVisit( sourceNode );
+
+        DependencyNode resultNode = visitor.getDependencyTree();
+        assertNotSame( sourceNode, resultNode );
+        assertEquals( sourceNode, resultNode );
+    }
+
+    public void testVisitNodeWithOriginalScope()
+    {
+        DependencyNode sourceNode = createNode( "g:a:t:1" );
+        sourceNode.setOriginalScope( "x" );
+
+        visitor = new BuildingDependencyNodeVisitor();
+        visitor.visit( sourceNode );
+        visitor.endVisit( sourceNode );
+
+        DependencyNode resultNode = visitor.getDependencyTree();
+        assertNotSame( sourceNode, resultNode );
+        assertEquals( sourceNode, resultNode );
+    }
+
+    public void testVisitNodeWithFailedUpdateScope()
+    {
+        DependencyNode sourceNode = createNode( "g:a:t:1" );
+        sourceNode.setFailedUpdateScope( "x" );
+
+        visitor = new BuildingDependencyNodeVisitor();
+        visitor.visit( sourceNode );
+        visitor.endVisit( sourceNode );
+
+        DependencyNode resultNode = visitor.getDependencyTree();
+        assertNotSame( sourceNode, resultNode );
+        assertEquals( sourceNode, resultNode );
+    }
+
+    public void testVisitNodeWithPremanagedVersion()
+    {
+        DependencyNode sourceNode = createNode( "g:a:t:1" );
+        sourceNode.setPremanagedVersion( "2" );
+
+        visitor = new BuildingDependencyNodeVisitor();
+        visitor.visit( sourceNode );
+        visitor.endVisit( sourceNode );
+
+        DependencyNode resultNode = visitor.getDependencyTree();
+        assertNotSame( sourceNode, resultNode );
+        assertEquals( sourceNode, resultNode );
+    }
+
+    public void testVisitNodeWithPremanagedScope()
+    {
+        DependencyNode sourceNode = createNode( "g:a:t:1" );
+        sourceNode.setPremanagedScope( "x" );
+
+        visitor = new BuildingDependencyNodeVisitor();
+        visitor.visit( sourceNode );
+        visitor.endVisit( sourceNode );
+
+        DependencyNode resultNode = visitor.getDependencyTree();
+        assertNotSame( sourceNode, resultNode );
+        assertEquals( sourceNode, resultNode );
+    }
+
     public void testVisitNodeWithChild()
     {
         DependencyNode sourceNode = createNode( "g:a:t:1" );



Mime
View raw message