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 * DepManDeepVersionDependencyGraphTest
32 * DependencyGraphTest for testing <code>net.example.depman.deepversion:A:1.0</code>
36 public class DepManDeepVersionDependencyGraphTest
37 extends AbstractDependencyGraphFactoryTestCase
39 public void testResolvedDepsToNodes()
40 throws GraphTaskException
42 MemoryRepositoryDependencyGraphBuilder graphBuilder = new MemoryRepositoryDependencyGraphBuilder();
43 MemoryRepository repository = new DepManDeepVersionMemoryRepository();
44 graphBuilder.setMemoryRepository( repository );
46 // Create the factory, and add the test resolver.
47 DependencyGraphFactory factory = new DependencyGraphFactory();
48 factory.setGraphBuilder( graphBuilder );
49 factory.setDesiredScope( DependencyScope.TEST );
51 // Get the model to resolve from
52 VersionedReference rootRef = toVersionedReference( "net.example.depman.deepversion:A:1.0" );
54 // Perform the resolution.
55 DependencyGraph graph = factory.getGraph( rootRef );
58 assertNotNull( "Graph shouldn't be null.", graph );
60 String expectedRootRef = "net.example.depman.deepversion:A:1.0";
61 List expectedNodes = new ArrayList();
63 // Check for all nodes, regardless of scope.
64 expectedNodes.clear();
65 expectedNodes.add( "net.example.depman.deepversion:B:1.0::jar" );
66 expectedNodes.add( "net.example.depman.deepversion:C:1.0::jar" );
67 expectedNodes.add( "net.example.depman.deepversion:D:2.0::jar" );
68 expectedNodes.add( "net.example.depman.deepversion:E:3.0::jar" );
69 expectedNodes.add( "net.example.depman.deepversion:F:1.0::jar" );
71 assertGraph( graph, expectedRootRef, expectedNodes );