1 package org.apache.maven.repository.legacy.resolver.conflict;
2
3 /*
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
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
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
19 * under the License.
20 */
21
22 import org.apache.maven.artifact.resolver.ResolutionNode;
23
24 /**
25 * Tests <code>OldestConflictResolver</code>.
26 *
27 * @author <a href="mailto:markhobson@gmail.com">Mark Hobson</a>
28 * @see OldestConflictResolver
29 */
30 public class OldestConflictResolverTest
31 extends AbstractConflictResolverTest
32 {
33 // constructors -----------------------------------------------------------
34
35 public OldestConflictResolverTest()
36 throws Exception
37 {
38 super("oldest");
39 }
40
41 // tests ------------------------------------------------------------------
42
43 /**
44 * Tests that <code>a:1.0</code> wins in the scenario:
45 * <pre>
46 * a:1.0
47 * b:1.0 -> a:2.0
48 * </pre>
49 */
50 public void testDepth()
51 {
52 ResolutionNode a1n = createResolutionNode( a1 );
53 ResolutionNode b1n = createResolutionNode( b1);
54 ResolutionNode a2n = createResolutionNode( a2, b1n );
55
56 assertResolveConflict( a1n, a1n, a2n );
57 }
58
59
60 /**
61 * Tests that <code>a:1.0</code> wins in the scenario:
62 * <pre>
63 * b:1.0 -> a:2.0
64 * a:1.0
65 * </pre>
66 */
67 public void testDepthReversed()
68 {
69 ResolutionNode b1n = createResolutionNode( b1 );
70 ResolutionNode a2n = createResolutionNode( a2, b1n );
71 ResolutionNode a1n = createResolutionNode( a1 );
72
73 assertResolveConflict( a1n, a2n, a1n );
74 }
75
76 /**
77 * Tests that <code>a:1.0</code> wins in the scenario:
78 * <pre>
79 * a:1.0
80 * a:2.0
81 * </pre>
82 */
83 public void testEqual()
84 {
85 ResolutionNode a1n = createResolutionNode( a1 );
86 ResolutionNode a2n = createResolutionNode( a2 );
87
88 assertResolveConflict( a1n, a1n, a2n );
89 }
90
91 /**
92 * Tests that <code>a:1.0</code> wins in the scenario:
93 * <pre>
94 * a:2.0
95 * a:1.0
96 * </pre>
97 */
98 public void testEqualReversed()
99 {
100 ResolutionNode a2n = createResolutionNode( a2);
101 ResolutionNode a1n = createResolutionNode( a1 );
102
103 assertResolveConflict( a1n, a2n, a1n );
104 }
105 }