1 package org.apache.maven.archiva.dependency.graph;
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
22 import org.apache.maven.archiva.dependency.DependencyGraphFactory;
23 import org.apache.maven.archiva.model.DependencyScope;
24 import org.apache.maven.archiva.model.VersionedReference;
26 import java.util.ArrayList;
27 import java.util.List;
30 * ArchivaXmlToolsDependencyGraphTest
32 * DependencyGraphTest for testing <code>org.apache.maven.archiva:archiva-xml-tools:1.0-alpha-2-SNAPSHOT</code>
34 * Generated by <code>archivadev:generate-dependency-tests</code> plugin
37 public class ArchivaXmlToolsDependencyGraphTest
38 extends AbstractDependencyGraphFactoryTestCase
40 public void testResolvedDepsToNodes()
41 throws GraphTaskException
43 MemoryRepositoryDependencyGraphBuilder graphBuilder =
44 new MemoryRepositoryDependencyGraphBuilder();
45 MemoryRepository repository = new ArchivaXmlToolsMemoryRepository();
46 graphBuilder.setMemoryRepository( repository );
48 // Create the factory, and add the test resolver.
49 DependencyGraphFactory factory = new DependencyGraphFactory();
50 factory.setGraphBuilder( graphBuilder );
51 factory.setDesiredScope( DependencyScope.TEST );
53 // Get the model to resolve from
54 VersionedReference rootRef = toVersionedReference( "org.apache.maven.archiva:archiva-xml-tools:1.0-alpha-2-SNAPSHOT");
56 // Perform the resolution.
57 DependencyGraph graph = factory.getGraph( rootRef );
60 assertNotNull( "Graph shouldn't be null.", graph );
62 String expectedRootRef = "org.apache.maven.archiva:archiva-xml-tools:1.0-alpha-2-SNAPSHOT";
63 List expectedNodes = new ArrayList();
65 // Check for all nodes, regardless of scope.
66 expectedNodes.clear();
67 expectedNodes.add( "commons-collections:commons-collections:3.2::jar" );
68 expectedNodes.add( "commons-lang:commons-lang:2.2::jar" );
69 expectedNodes.add( "dom4j:dom4j:1.6.1::jar" );
70 expectedNodes.add( "jaxen:jaxen:1.1::jar" );
71 expectedNodes.add( "junit:junit:3.8.1::jar" );
72 expectedNodes.add( "log4j:log4j:1.2.8::jar" );
73 expectedNodes.add( "org.apache.maven.archiva:archiva-common:1.0-alpha-2-SNAPSHOT::jar" );
74 expectedNodes.add( "org.codehaus.plexus:plexus-classworlds:1.2-alpha-7::jar" );
75 expectedNodes.add( "org.codehaus.plexus:plexus-component-api:1.0-alpha-22::jar" );
76 expectedNodes.add( "org.codehaus.plexus:plexus-container-default:1.0-alpha-22::jar" );
77 expectedNodes.add( "org.codehaus.plexus:plexus-utils:1.4::jar" );
78 expectedNodes.add( "org.slf4j:slf4j-api:1.2::jar" );
79 expectedNodes.add( "org.slf4j:slf4j-log4j12:1.2::jar" );
80 expectedNodes.add( "xerces:xercesImpl:2.6.2::jar" );
81 expectedNodes.add( "xml-apis:xml-apis:1.0.b2::jar" );
83 assertGraph( graph, expectedRootRef, expectedNodes );