diff options
author | Joakim Erdfelt <joakime@apache.org> | 2007-05-18 22:35:12 +0000 |
---|---|---|
committer | Joakim Erdfelt <joakime@apache.org> | 2007-05-18 22:35:12 +0000 |
commit | 3dce54c7fbf91ab1484cf07c8ada97affd54a13d (patch) | |
tree | 07d4f992dbbbf7695cf56c7753f6751d4b8c3064 /archiva-base | |
parent | c870196fffc9bb7f12a5fff13f63166112af69c7 (diff) | |
download | archiva-3dce54c7fbf91ab1484cf07c8ada97affd54a13d.tar.gz archiva-3dce54c7fbf91ab1484cf07c8ada97affd54a13d.zip |
[MRM-346]: Show Artifact results in error 500.
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@539619 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-base')
10 files changed, 46 insertions, 404 deletions
diff --git a/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ProjectModelToDatabaseConsumer.java b/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ProjectModelToDatabaseConsumer.java index cc4558d9d..0b13f8b1a 100644 --- a/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ProjectModelToDatabaseConsumer.java +++ b/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ProjectModelToDatabaseConsumer.java @@ -38,6 +38,7 @@ import org.apache.maven.archiva.repository.project.ProjectModelReader; import java.io.File; import java.util.ArrayList; +import java.util.Date; import java.util.List; /** @@ -130,6 +131,9 @@ public class ProjectModelToDatabaseConsumer try { ArchivaProjectModel model = project400Reader.read( artifactFile ); + + model.setOrigin( "filesystem" ); + dao.getProjectModelDAO().saveProjectModel( model ); } catch ( ProjectModelException e ) diff --git a/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaModelCloner.java b/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaModelCloner.java index c77a7ef34..cf0d5f274 100644 --- a/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaModelCloner.java +++ b/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaModelCloner.java @@ -62,7 +62,7 @@ public class ArchivaModelCloner cloned.setOrganization( clone( model.getOrganization() ) ); cloned.setScm( clone( model.getScm() ) ); cloned.setRepositories( cloneRepositories( model.getRepositories() ) ); - cloned.setDependencyTree( clone( model.getDependencyTree() ) ); + cloned.setDependencies( cloneDependencies( model.getDependencies() ) ); cloned.setPlugins( clonePlugins( model.getPlugins() ) ); cloned.setReports( cloneReports( model.getReports() ) ); cloned.setDependencyManagement( cloneDependencies( model.getDependencyManagement() ) ); @@ -130,37 +130,6 @@ public class ArchivaModelCloner return cloned; } - public static DependencyEdge clone( DependencyEdge edge ) - { - if ( edge == null ) - { - return null; - } - - DependencyEdge cloned = new DependencyEdge(); - - cloned.setFromDependency( clone( edge.getFromDependency() ) ); - cloned.setToDependency( clone( edge.getToDependency() ) ); - cloned.setType( edge.getType() ); - - return cloned; - } - - public static DependencyTree clone( DependencyTree dependencyTree ) - { - if ( dependencyTree == null ) - { - return null; - } - - DependencyTree cloned = new DependencyTree(); - - cloned.setDependencyNodes( cloneDependencies( dependencyTree.getDependencyNodes() ) ); - cloned.setDependencyEdges( cloneDependencyEdges( dependencyTree.getDependencyEdges() ) ); - - return cloned; - } - public static IssueManagement clone( IssueManagement issueManagement ) { if ( issueManagement == null ) @@ -323,32 +292,6 @@ public class ArchivaModelCloner return ret; } - public static List cloneDependencyEdges( List dependencyEdges ) - { - if ( dependencyEdges == null ) - { - return null; - } - - List ret = new ArrayList(); - - Iterator it = dependencyEdges.iterator(); - while ( it.hasNext() ) - { - DependencyEdge edge = (DependencyEdge) it.next(); - - if ( edge == null ) - { - // Skip empty edge. - continue; - } - - ret.add( clone( edge ) ); - } - - return ret; - } - public static List cloneExclusions( List exclusions ) { if ( exclusions == null ) diff --git a/archiva-base/archiva-model/src/main/mdo/archiva-base.xml b/archiva-base/archiva-model/src/main/mdo/archiva-base.xml index 02089dbad..244bc41f4 100644 --- a/archiva-base/archiva-model/src/main/mdo/archiva-base.xml +++ b/archiva-base/archiva-model/src/main/mdo/archiva-base.xml @@ -998,7 +998,7 @@ <name>whenIndexed</name> <identifier>false</identifier> <version>1.0.0+</version> - <required>true</required> + <required>false</required> <type>Date</type> <description> The timestamp when this model was indexed. @@ -1080,14 +1080,15 @@ </association> </field> <field> - <name>dependencyTree</name> + <name>dependencies</name> <version>1.0.0+</version> <description><![CDATA[ This element describes all of the dependencies associated with a project. ]]></description> <association> - <type>DependencyTree</type> + <type>Dependency</type> + <multiplicity>*</multiplicity> </association> </field> <field> @@ -1441,129 +1442,6 @@ </field> </fields> </class> - - <class stash.storable="true" - jpox.table="DEPENDENCY_TREE"> - <name>DependencyTree</name> - <description>The Dependency Tree</description> - <version>1.0.0+</version> - <fields> - <field> - <name>dependencyNodes</name> - <version>1.0.0+</version> - <description>The nodes for this dependency tree.</description> - <association> - <type>Dependency</type> - <multiplicity>*</multiplicity> - </association> - </field> - <field> - <name>dependencyEdges</name> - <version>1.0.0+</version> - <description>The edges for this dependency tree.</description> - <association> - <type>DependencyEdge</type> - <multiplicity>*</multiplicity> - </association> - </field> - </fields> - <codeSegments> - <codeSegment> - <version>1.0.0+</version> - <code><![CDATA[ - /** - * True if the dependency tree is empty. - * - * @return true if the dependency tree is empty. - */ - public boolean isEmpty() - { - if ( this.dependencyNodes == null ) - { - return true; - } - - return this.dependencyNodes.isEmpty(); - } - - public void addDependencyEdge( Dependency fromNode, Dependency toNode ) - { - if ( this.dependencyNodes == null ) - { - this.dependencyNodes = new java.util.ArrayList(); - } - - if ( this.dependencyEdges == null ) - { - this.dependencyEdges = new java.util.ArrayList(); - } - - java.util.Iterator it; - - DependencyEdge edge = new DependencyEdge(); - edge.setFromDependency( toArtifactReference( fromNode ) ); - edge.setToDependency( toArtifactReference( toNode ) ); - - String key = DependencyEdge.toKey( edge ); - - // Test for existance of previous edge. - it = this.dependencyEdges.iterator(); - while ( it.hasNext() ) - { - DependencyEdge existingEdge = (DependencyEdge) it.next(); - String existingKey = DependencyEdge.toKey( existingEdge ); - if ( key.equals( existingKey ) ) - { - // Key already exists. - // Update type and return. - existingEdge.setType( edge.getType() ); - return; - } - } - - // Test for existance of fromNode or toNode and add if not present. - String fromKey = Dependency.toVersionlessKey( fromNode ); - String toKey = Dependency.toVersionlessKey( toNode ); - - // Generate list of keys - java.util.List existingKeys = new java.util.ArrayList(); - - it = this.dependencyNodes.iterator(); - while ( it.hasNext() ) - { - Dependency existingDep = (Dependency) it.next(); - String existingKey = Dependency.toVersionlessKey( existingDep ); - existingKeys.add( existingKey ); - } - - // Now add nodes that are not present. - if ( !existingKeys.contains( fromKey ) ) - { - this.dependencyNodes.add( fromNode ); - } - - if ( !existingKeys.contains( toKey ) ) - { - this.dependencyNodes.add( toNode ); - } - } - - public static ArtifactReference toArtifactReference( Dependency dependency ) - { - ArtifactReference ref = new ArtifactReference(); - - ref.setGroupId( dependency.getGroupId() ); - ref.setArtifactId( dependency.getArtifactId() ); - ref.setVersion( dependency.getVersion() ); - ref.setClassifier( dependency.getClassifier() ); - ref.setType( dependency.getType() ); - - return ref; - } - ]]></code> - </codeSegment> - </codeSegments> - </class> <class stash.storable="true" jpox.table="DEPENDENCY"> @@ -1602,6 +1480,7 @@ <version>1.0.0+</version> <type>String</type> <required>false</required> + <defaultValue></defaultValue> <description><![CDATA[ The classifier of the dependency. This allows distinguishing two artifacts that belong to the same POM but were built differently, and is appended to the filename after the version. For example, @@ -1738,85 +1617,6 @@ </class> <class stash.storable="true" - jpox.table="DEPENDENCY_EDGE"> - <name>DependencyEdge</name> - <version>1.0.0+</version> - <fields> - <field> - <name>fromDependency</name> - <version>1.0.0+</version> - <required>true</required> - <description>The dependency reference for the 'from' node</description> - <association> - <type>ArtifactReference</type> - </association> - </field> - <field> - <name>toDependency</name> - <version>1.0.0+</version> - <required>true</required> - <description>The dependency reference for the 'to' node</description> - <association> - <type>ArtifactReference</type> - </association> - </field> - <field jpox.column="EDGE_TYPE"> - <name>type</name> - <version>1.0.0+</version> - <required>true</required> - <description><![CDATA[ - <p> - The type of edge you have. - </p> - - <dl> - <dt><code>runtime</code></dt> - <dd>A dependency node that is required for runtime of the project</dd> - - <dt><code>test</code></dt> - <dd>A dependency node that is used by the project for testing purposes.</dd> - - <dt><code>build</code></dt> - <dd>A dependency node that is used in the build/extension capacity.</dd> - - <dt><code>plugin</code></dt> - <dd>A dependency node that is used as, or by a, declared plugin in this project. - This includes the plugin itself, and any defined plugins/plugin/dependencies/dependency references. - </dd> - - <dt><code>report</code></dt> - <dd>A dependency node that is used as, or by a, declared report in this project. - This includes the report itself, and any defined reporting/plugins/plugin/dependencies/dependency references.</dd> - </dl> - ]]></description> - <type>String</type> - </field> - </fields> - <codeSegments> - <codeSegment> - <version>1.0.0+</version> - <code><![CDATA[ - public static String toKey( DependencyEdge edge ) - { - StringBuffer key = new StringBuffer(); - - key.append( ArtifactReference.toVersionlessKey( edge.getFromDependency() ) ); - key.append( "->" ); - key.append( ArtifactReference.toVersionlessKey( edge.getToDependency() ) ); - - return key.toString(); - } - - public String toString() - { - return DependencyEdge.toKey( this ); - } - ]]></code> - </codeSegment> - </codeSegments> - </class> - - <class stash.storable="true" jpox.table="EXCLUSIONS"> <name>Exclusion</name> <version>1.0.0+</version> diff --git a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelMerge.java b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelMerge.java index a08646add..7da66c5a4 100644 --- a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelMerge.java +++ b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelMerge.java @@ -25,8 +25,6 @@ import org.apache.maven.archiva.model.ArchivaProjectModel; import org.apache.maven.archiva.model.ArtifactReference; import org.apache.maven.archiva.model.CiManagement; import org.apache.maven.archiva.model.Dependency; -import org.apache.maven.archiva.model.DependencyEdge; -import org.apache.maven.archiva.model.DependencyTree; import org.apache.maven.archiva.model.Exclusion; import org.apache.maven.archiva.model.Individual; import org.apache.maven.archiva.model.IssueManagement; @@ -94,7 +92,7 @@ public class ProjectModelMerge merged.setOrganization( merge( mainProject.getOrganization(), parentProject.getOrganization() ) ); merged.setScm( merge( mainProject.getScm(), parentProject.getScm() ) ); merged.setRepositories( mergeRepositories( mainProject.getRepositories(), parentProject.getRepositories() ) ); - merged.setDependencyTree( merge( mainProject.getDependencyTree(), parentProject.getDependencyTree() ) ); + merged.setDependencies( mergeDependencies( mainProject.getDependencies(), parentProject.getDependencies() ) ); merged.setDependencyManagement( mergeDependencyManagement( mainProject.getDependencyManagement(), parentProject .getDependencyManagement() ) ); merged.setPlugins( mergePlugins( mainProject.getPlugins(), parentProject.getPlugins() ) ); @@ -181,21 +179,6 @@ public class ProjectModelMerge return ret; } - private static Map createEdgeMap( List dependencyEdges ) - { - Map ret = new HashMap(); - - Iterator it = dependencyEdges.iterator(); - while ( it.hasNext() ) - { - DependencyEdge edge = (DependencyEdge) it.next(); - String key = toKey( edge ); - ret.put( key, edge ); - } - - return ret; - } - private static boolean empty( String val ) { if ( val == null ) @@ -233,28 +216,6 @@ public class ProjectModelMerge return merged; } - private static DependencyTree merge( DependencyTree mainDependencyTree, DependencyTree parentDependencyTree ) - { - if ( parentDependencyTree == null ) - { - return mainDependencyTree; - } - - if ( mainDependencyTree == null ) - { - return ArchivaModelCloner.clone( parentDependencyTree ); - } - - DependencyTree merged = ArchivaModelCloner.clone( mainDependencyTree ); - - merged.setDependencyNodes( mergeDependencies( mainDependencyTree.getDependencyNodes(), parentDependencyTree - .getDependencyNodes() ) ); - merged.setDependencyEdges( mergeDependencyEdges( mainDependencyTree.getDependencyEdges(), parentDependencyTree - .getDependencyEdges() ) ); - - return merged; - } - private static CiManagement merge( CiManagement mainCim, CiManagement parentCim ) { if ( parentCim == null ) @@ -675,45 +636,6 @@ public class ProjectModelMerge return merged; } - private static List mergeDependencyEdges( List mainDependencyEdges, List parentDependencyEdges ) - { - if ( parentDependencyEdges == null ) - { - return mainDependencyEdges; - } - - if ( mainDependencyEdges == null ) - { - return ArchivaModelCloner.cloneDependencyEdges( parentDependencyEdges ); - } - - List merged = new ArrayList(); - - Map mainEdgesMap = createEdgeMap( mainDependencyEdges ); - Map parentEdgesMap = createEdgeMap( parentDependencyEdges ); - - Iterator it = mainEdgesMap.entrySet().iterator(); - while ( it.hasNext() ) - { - Map.Entry entry = (Entry) it.next(); - String key = (String) entry.getKey(); - DependencyEdge mainEdge = (DependencyEdge) entry.getValue(); - DependencyEdge parentEdge = (DependencyEdge) parentEdgesMap.get( key ); - - if ( parentEdge == null ) - { - merged.add( mainEdge ); - } - else - { - // Not merging. Local wins. - merged.add( parentEdge ); - } - } - - return merged; - } - private static String toVersionlessArtifactKey( ArtifactReference artifactReference ) { StringBuffer key = new StringBuffer(); @@ -735,15 +657,4 @@ public class ProjectModelMerge return key.toString(); } - - private static String toKey( DependencyEdge edge ) - { - StringBuffer key = new StringBuffer(); - - key.append( toVersionlessArtifactKey( edge.getFromDependency() ) ); - key.append( "->" ); - key.append( toVersionlessArtifactKey( edge.getToDependency() ) ); - - return key.toString(); - } } diff --git a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/filters/EffectiveProjectModelFilter.java b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/filters/EffectiveProjectModelFilter.java index 2141c2b02..33083768b 100644 --- a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/filters/EffectiveProjectModelFilter.java +++ b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/filters/EffectiveProjectModelFilter.java @@ -118,20 +118,20 @@ public class EffectiveProjectModelFilter implements ProjectModelFilter private void applyDependencyManagement( ArchivaProjectModel pom ) { - if ( ( pom.getDependencyManagement() == null ) || ( pom.getDependencyTree() == null ) ) + if ( ( pom.getDependencyManagement() == null ) || ( pom.getDependencies() == null ) ) { // Nothing to do. All done! return; } - if ( pom.getDependencyManagement().isEmpty() || pom.getDependencyTree().isEmpty() ) + if ( pom.getDependencyManagement().isEmpty() || pom.getDependencies().isEmpty() ) { // Nothing to do. All done! return; } Map managedDependencies = createDependencyMap( pom.getDependencyManagement() ); - Iterator it = pom.getDependencyTree().getDependencyNodes().iterator(); + Iterator it = pom.getDependencies().iterator(); while ( it.hasNext() ) { Dependency dep = (Dependency) it.next(); diff --git a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/filters/ProjectModelExpressionFilter.java b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/filters/ProjectModelExpressionFilter.java index e2abca0cc..d845897be 100644 --- a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/filters/ProjectModelExpressionFilter.java +++ b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/filters/ProjectModelExpressionFilter.java @@ -19,6 +19,7 @@ package org.apache.maven.archiva.repository.project.filters; * under the License. */ +import org.apache.commons.collections.CollectionUtils; import org.apache.maven.archiva.model.ArchivaModelCloner; import org.apache.maven.archiva.model.ArchivaProjectModel; import org.apache.maven.archiva.model.Dependency; @@ -73,9 +74,9 @@ public class ProjectModelExpressionFilter ret.setVersion( evaluator.expand( ret.getVersion() ) ); ret.setGroupId( evaluator.expand( ret.getGroupId() ) ); - if ( ( ret.getDependencyTree() != null ) && !ret.getDependencyTree().isEmpty() ) + if ( CollectionUtils.isNotEmpty( ret.getDependencies() ) ) { - evaluateExpressionsInDependencyList( evaluator, ret.getDependencyTree().getDependencyNodes() ); + evaluateExpressionsInDependencyList( evaluator, ret.getDependencies() ); } evaluateExpressionsInDependencyList( evaluator, ret.getDependencyManagement() ); diff --git a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/readers/ProjectModel400Reader.java b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/readers/ProjectModel400Reader.java index 9d8033f0c..a10722025 100644 --- a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/readers/ProjectModel400Reader.java +++ b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/readers/ProjectModel400Reader.java @@ -25,7 +25,6 @@ import org.apache.maven.archiva.model.ArtifactReference; import org.apache.maven.archiva.model.CiManagement; import org.apache.maven.archiva.model.Dependency; import org.apache.maven.archiva.model.DependencyScope; -import org.apache.maven.archiva.model.DependencyTree; import org.apache.maven.archiva.model.Exclusion; import org.apache.maven.archiva.model.Individual; import org.apache.maven.archiva.model.IssueManagement; @@ -100,7 +99,7 @@ public class ProjectModel400Reader model.setScm( getSCM( xml ) ); model.setRepositories( getRepositories( xml ) ); - model.setDependencyTree( getDependencyTree( xml ) ); + model.setDependencies( getDependencies( xml ) ); model.setDependencyManagement( getDependencyManagement( xml ) ); model.setPlugins( getPlugins( xml ) ); model.setReports( getReports( xml ) ); @@ -142,20 +141,10 @@ public class ProjectModel400Reader return null; } - private DependencyTree getDependencyTree( XMLReader xml ) + private List getDependencies( XMLReader xml ) throws XMLException { - DependencyTree tree = new DependencyTree(); - List dependencies = getDependencyList( xml, new String[] { "dependencies" } ); - - Iterator it = dependencies.iterator(); - while ( it.hasNext() ) - { - Dependency dependency = (Dependency) it.next(); - tree.addDependencyNode( dependency ); - } - - return tree; + return getDependencyList( xml, new String[] { "dependencies" } ); } private List getDependencyList( XMLReader xml, String parts[] ) @@ -187,7 +176,7 @@ public class ProjectModel400Reader dependency.setArtifactId( elemDependency.elementTextTrim( "artifactId" ) ); dependency.setVersion( elemDependency.elementTextTrim( "version" ) ); - dependency.setClassifier( elemDependency.elementTextTrim( "classifier" ) ); + dependency.setClassifier( StringUtils.defaultString( elemDependency.elementTextTrim( "classifier" ) ) ); dependency.setType( StringUtils.defaultIfEmpty( elemDependency.elementTextTrim( "type" ), "jar" ) ); dependency.setScope( StringUtils.defaultIfEmpty( elemDependency.elementTextTrim( "scope" ), "compile" ) ); // Not for v4.0.0 -> dependency.setUrl( elemDependency.elementTextTrim("url") ); diff --git a/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/filters/EffectiveProjectModelFilterTest.java b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/filters/EffectiveProjectModelFilterTest.java index 5092df2e6..7ac0c506f 100644 --- a/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/filters/EffectiveProjectModelFilterTest.java +++ b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/filters/EffectiveProjectModelFilterTest.java @@ -22,7 +22,6 @@ package org.apache.maven.archiva.repository.project.filters; import org.apache.maven.archiva.model.ArchivaProjectModel; import org.apache.maven.archiva.model.ArchivaRepository; import org.apache.maven.archiva.model.Dependency; -import org.apache.maven.archiva.model.DependencyTree; import org.apache.maven.archiva.model.Individual; import org.apache.maven.archiva.repository.project.ProjectModelException; import org.apache.maven.archiva.repository.project.ProjectModelFilter; @@ -100,30 +99,28 @@ public class EffectiveProjectModelFilterTest assertEquals( "Equivalent Models", expectedModel, effectiveModel ); assertContainsSameIndividuals( "Individuals", expectedModel.getIndividuals(), effectiveModel.getIndividuals() ); - dumpDependencyList( "Expected", expectedModel.getDependencyTree() ); - dumpDependencyList( "Effective", effectiveModel.getDependencyTree() ); - assertContainsSameDependencies( "Dependencies", expectedModel.getDependencyTree().getDependencyNodes(), - effectiveModel.getDependencyTree().getDependencyNodes() ); - assertContainsSameDependencies( "DependencyManagement", expectedModel.getDependencyManagement(), effectiveModel - .getDependencyManagement() ); + dumpDependencyList( "Expected", expectedModel.getDependencies() ); + dumpDependencyList( "Effective", effectiveModel.getDependencies() ); + assertContainsSameDependencies( "Dependencies", expectedModel.getDependencies(), + effectiveModel.getDependencies() ); + assertContainsSameDependencies( "DependencyManagement", expectedModel.getDependencyManagement(), + effectiveModel.getDependencyManagement() ); } - private void dumpDependencyList( String type, DependencyTree tree ) + private void dumpDependencyList( String type, List deps ) { - if ( tree == null ) + if ( deps == null ) { - System.out.println( " Tree [" + type + "] is null." ); + System.out.println( " Dependencies [" + type + "] is null." ); return; } - if ( tree.getDependencyNodes() == null ) + if ( deps.isEmpty() ) { - System.out.println( " Tree [" + type + "] dependency list (nodes) is null." ); + System.out.println( " Dependencies [" + type + "] dependency list is empty." ); return; } - List deps = tree.getDependencyNodes(); - System.out.println( ".\\ [" + type + "] Dependency List (size:" + deps.size() + ") \\.________________" ); Iterator it = deps.iterator(); while ( it.hasNext() ) diff --git a/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/filters/ProjectModelExpressionExpanderTest.java b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/filters/ProjectModelExpressionExpanderTest.java index b63c7b13e..99a00c407 100644 --- a/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/filters/ProjectModelExpressionExpanderTest.java +++ b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/filters/ProjectModelExpressionExpanderTest.java @@ -21,11 +21,12 @@ package org.apache.maven.archiva.repository.project.filters; import org.apache.maven.archiva.model.ArchivaProjectModel; import org.apache.maven.archiva.model.Dependency; -import org.apache.maven.archiva.model.DependencyTree; import org.apache.maven.archiva.repository.project.ProjectModelFilter; import org.codehaus.plexus.PlexusTestCase; +import java.util.ArrayList; import java.util.Iterator; +import java.util.List; /** * ProjectModelExpressionExpanderTest @@ -49,13 +50,13 @@ public class ProjectModelExpressionExpanderTest model.setArtifactId( "archiva-test-project" ); model.setVersion( "1.0-SNAPSHOT" ); - DependencyTree depTree = new DependencyTree(); + List deps = new ArrayList(); - depTree.addDependencyEdge( model.asDependency(), createDependency( "org.apache.maven.archiva", "archiva-model", "${archiva.version}" ) ); - depTree.addDependencyEdge( model.asDependency(), createDependency( "org.apache.maven.archiva", "archiva-common", "${archiva.version}" ) ); - depTree.addDependencyEdge( model.asDependency(), createDependency( "org.apache.maven.archiva", "archiva-indexer", "${archiva.version}" ) ); + deps.add( createDependency( "org.apache.maven.archiva", "archiva-model", "${archiva.version}" ) ); + deps.add( createDependency( "org.apache.maven.archiva", "archiva-common", "${archiva.version}" ) ); + deps.add( createDependency( "org.apache.maven.archiva", "archiva-indexer", "${archiva.version}" ) ); - model.setDependencyTree( depTree ); + model.setDependencies( deps ); model.addProperty( "archiva.version", "1.0-SNAPSHOT" ); @@ -67,11 +68,10 @@ public class ProjectModelExpressionExpanderTest assertEquals( "Group ID", "org.apache.maven.archiva", model.getGroupId() ); assertEquals( "Artifact ID", "archiva-test-project", model.getArtifactId() ); assertEquals( "Version", "1.0-SNAPSHOT", model.getVersion() ); - assertNotNull( "DependencyTree", model.getDependencyTree() ); - assertNotNull( "DependencyTree.dependencies", model.getDependencyTree().getDependencyNodes() ); - assertEquals( "Dependencies Size", 4, model.getDependencyTree().getDependencyNodes().size() ); + assertNotNull( "Dependencies", model.getDependencies() ); + assertEquals( "Dependencies Size", 3, model.getDependencies().size() ); - Iterator it = model.getDependencyTree().getDependencyNodes().iterator(); + Iterator it = model.getDependencies().iterator(); while ( it.hasNext() ) { Dependency dep = (Dependency) it.next(); diff --git a/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/readers/ProjectModel400ReaderTest.java b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/readers/ProjectModel400ReaderTest.java index aefe08f48..43cce058a 100644 --- a/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/readers/ProjectModel400ReaderTest.java +++ b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/readers/ProjectModel400ReaderTest.java @@ -23,7 +23,6 @@ import org.apache.maven.archiva.model.ArchivaProjectModel; import org.apache.maven.archiva.model.VersionedReference; import org.apache.maven.archiva.repository.project.ProjectModelException; import org.apache.maven.archiva.repository.project.ProjectModelReader; -import org.apache.maven.archiva.repository.project.readers.ProjectModel400Reader; import org.codehaus.plexus.PlexusTestCase; import java.io.File; @@ -63,9 +62,8 @@ public class ProjectModel400ReaderTest assertEquals( "Parent Artifact ID", "maven-shared-components", parentRef.getArtifactId() ); assertEquals( "Parent Version", "4", parentRef.getVersion() ); - assertNotNull( "DependencyTree", project.getDependencyTree() ); - assertNotNull( "DependencyTree.dependencies", project.getDependencyTree().getDependencyNodes() ); - assertEquals( "Dependencies.size", 3, project.getDependencyTree().getDependencyNodes().size() ); + assertNotNull( "Dependencies", project.getDependencies() ); + assertEquals( "Dependencies.size", 3, project.getDependencies().size() ); } public void testLoadWithNamespace() @@ -93,8 +91,7 @@ public class ProjectModel400ReaderTest assertEquals( "Parent Artifact ID", "archiva-base", parentRef.getArtifactId() ); assertEquals( "Parent Version", "1.0-SNAPSHOT", parentRef.getVersion() ); - assertNotNull( "DependencyTree", project.getDependencyTree() ); - assertNotNull( "DependencyTree.dependencies", project.getDependencyTree().getDependencyNodes() ); - assertEquals( "Dependencies.size", 6, project.getDependencyTree().getDependencyNodes().size() ); + assertNotNull( "Dependencies", project.getDependencies() ); + assertEquals( "Dependencies.size", 6, project.getDependencies().size() ); } } |