mirror of https://github.com/apache/ant-ivy
Added junit test from IVY-388
git-svn-id: https://svn.apache.org/repos/asf/incubator/ivy/trunk@496001 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
80129f70ab
commit
1224f28a1d
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
package org.apache.ivy.conflict;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.apache.ivy.Ivy;
|
||||
import org.apache.ivy.IvyNode;
|
||||
import org.apache.ivy.report.ResolveReport;
|
||||
|
||||
public class LatestConflictManagerTest extends TestCase {
|
||||
|
||||
private Ivy ivy;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
ivy = new Ivy();
|
||||
ivy.configure(LatestConflictManagerTest.class
|
||||
.getResource("ivyconf-latest.xml"));
|
||||
}
|
||||
|
||||
// Test case for issue IVY-388
|
||||
public void testIvy388() throws Exception {
|
||||
ResolveReport report = ivy.resolve(LatestConflictManagerTest.class
|
||||
.getResource("ivy-388.xml"), null, new String[] { "*" }, null,
|
||||
new Date(), false);
|
||||
|
||||
List deps = report.getDependencies();
|
||||
Iterator dependencies = deps.iterator();
|
||||
String[] confs = report.getConfigurations();
|
||||
while (dependencies.hasNext()) {
|
||||
IvyNode node = (IvyNode) dependencies.next();
|
||||
for (int i = 0; i < confs.length; i++) {
|
||||
String conf = confs[i];
|
||||
if (!node.isEvicted(conf)) {
|
||||
boolean flag1 = report.getConfigurationReport(conf)
|
||||
.getDependency(node.getResolvedId()) != null;
|
||||
boolean flag2 = report.getConfigurationReport(conf)
|
||||
.getModuleRevisionIds().contains(node.getResolvedId());
|
||||
assertEquals("Inconsistent data for node " + node + " in conf " + conf , flag1, flag2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ivy-module version="1.0">
|
||||
<info organisation="apache" module="resolve-latest-conflict" revision="1.0" status="release"/>
|
||||
<configurations>
|
||||
<conf name="default"/>
|
||||
<conf name="nontransitive" transitive="false" extends="default"/>
|
||||
</configurations>
|
||||
<dependencies>
|
||||
<dependency org="org1" name="mod1.1" rev="1.0"/>
|
||||
<dependency org="org1" name="mod1.2" rev="2.1"/>
|
||||
<dependency org="org6" name="mod6.1" rev="0.6"/>
|
||||
</dependencies>
|
||||
</ivy-module>
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
<ivyconf>
|
||||
|
||||
<conf defaultResolver="test"/>
|
||||
|
||||
<resolvers>
|
||||
<filesystem name="test">
|
||||
<artifact
|
||||
pattern="test/repositories/1/[organisation]/[module]/[type]s/[artifact]-[revision].[type]"/>
|
||||
<ivy pattern="test/repositories/1/[organisation]/[module]/ivys/ivy-[revision].xml"/>
|
||||
</filesystem>
|
||||
</resolvers>
|
||||
</ivyconf>
|
||||
Loading…
Reference in New Issue