mirror of https://github.com/apache/ant-ivy
checks ivy files data consistency with asked info (org, module name and revision)
git-svn-id: https://svn.apache.org/repos/asf/incubator/ivy/trunk@483994 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b92f81e2f6
commit
6847003b33
|
|
@ -3,6 +3,7 @@
|
|||
- new type filtering in cachepath task
|
||||
- new cachefileset task: builds an ant fileset of artifacts in cache
|
||||
- publish task now uses srcivypattern for ivy files finding and for delivery
|
||||
- FIX: checks ivy files data consistency with asked info (org, module name and revision)
|
||||
- FIX: use AUTH configuration for configuration file
|
||||
|
||||
version 1.1 - 2005-06-13
|
||||
|
|
|
|||
|
|
@ -249,6 +249,18 @@ public abstract class BasicResolver extends AbstractResolver {
|
|||
try {
|
||||
md = XmlModuleDescriptorParser.parseDescriptor(data.getIvy(), cachedIvyURL, ivyRef.getResource(), doValidate(data));
|
||||
Message.debug("\t"+getName()+": parsed downloaded ivy file for "+mrid+" parsed="+md.getModuleRevisionId());
|
||||
|
||||
// check descriptor data is in sync with resource revision and names
|
||||
if (!mrid.getOrganisation().equals(md.getModuleRevisionId().getOrganisation())) {
|
||||
throw new IllegalStateException("bad organisation found in "+ivyRef.getResource()+": expected="+mrid.getOrganisation()+" found="+md.getModuleRevisionId().getOrganisation());
|
||||
}
|
||||
if (!mrid.getName().equals(md.getModuleRevisionId().getName())) {
|
||||
throw new IllegalStateException("bad module name found in "+ivyRef.getResource()+": expected="+mrid.getName()+" found="+md.getModuleRevisionId().getName());
|
||||
}
|
||||
if (ivyRef.getRevision() != null && md.getModuleRevisionId().getRevision() != null &&
|
||||
!ivyRef.getRevision().equals(md.getModuleRevisionId().getRevision())) {
|
||||
throw new IllegalStateException("bad revision found in "+ivyRef.getResource()+": expected="+ivyRef.getRevision()+" found="+md.getModuleRevisionId().getRevision());
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
Message.warn("io problem while parsing ivy file: "+ivyRef.getResource()+": "+ex.getMessage());
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -713,4 +713,29 @@ public class ResolveTest extends TestCase {
|
|||
assertTrue(new File("build/cache/idautomation/barcode/ivy-4.10.xml").exists());
|
||||
assertTrue(new File("build/cache/idautomation/barcode/jars/LinearBarCode-4.10.jar").exists());
|
||||
}
|
||||
|
||||
public void testBadFiles() throws Exception {
|
||||
Ivy ivy = new Ivy();
|
||||
ivy.configure(new File("test/repositories/badfile/ivyconf.xml"));
|
||||
|
||||
try {
|
||||
ivy.resolve(new File("test/repositories/badfile/ivys/ivy-badorg.xml").toURL(), null, new String[] {"*"}, new File("build/cache"), null, true);
|
||||
fail("bad org should have raised an exception !");
|
||||
} catch (Exception ex) {
|
||||
// OK, it raised an exception
|
||||
}
|
||||
try {
|
||||
ivy.resolve(new File("test/repositories/badfile/ivys/ivy-badmodule.xml").toURL(), null, new String[] {"*"}, new File("build/cache"), null, true);
|
||||
fail("bad module should have raised an exception !");
|
||||
} catch (Exception ex) {
|
||||
// OK, it raised an exception
|
||||
}
|
||||
try {
|
||||
ivy.resolve(new File("test/repositories/badfile/ivys/ivy-badrevision.xml").toURL(), null, new String[] {"*"}, new File("build/cache"), null, true);
|
||||
fail("bad revision should have raised an exception !");
|
||||
} catch (Exception ex) {
|
||||
// OK, it raised an exception
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
<ivyconf>
|
||||
<conf defaultResolver="test"/>
|
||||
<resolvers>
|
||||
<filesystem name="test">
|
||||
<ivy pattern="${ivy.conf.dir}/[organisation]/[module]/ivy-[revision].xml"/>
|
||||
</filesystem>
|
||||
</resolvers>
|
||||
</ivyconf>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<ivy-module version="1.0">
|
||||
<info organisation="jayasoft" name="test-badorg"/>
|
||||
<dependencies>
|
||||
<dependency org="myorg" name="mymodule" rev="badorg"/>
|
||||
</dependencies>
|
||||
</ivy-module>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<ivy-module version="1.0">
|
||||
<info organisation="jayasoft" name="test-badorg"/>
|
||||
<dependencies>
|
||||
<dependency org="myorg" name="mymodule" rev="badorg"/>
|
||||
</dependencies>
|
||||
</ivy-module>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<ivy-module version="1.0">
|
||||
<info organisation="jayasoft" name="test-badorg"/>
|
||||
<dependencies>
|
||||
<dependency org="myorg" name="mymodule" rev="badorg"/>
|
||||
</dependencies>
|
||||
</ivy-module>
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
<ivy-module version="1.1">
|
||||
<info organisation="myorg" name="badmodule" revision="badmodule"/>
|
||||
</ivy-module>
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
<ivy-module version="1.1">
|
||||
<info organisation="badorg" name="mymodule" revision="badorg"/>
|
||||
</ivy-module>
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
<ivy-module version="1.1">
|
||||
<info organisation="myorg" name="mymodule" revision="1.0"/>
|
||||
</ivy-module>
|
||||
Loading…
Reference in New Issue