use of org.apache.ivy.core.module.descriptor.ModuleDescriptor in project ant-ivy by apache.
the class ResolveTest method testResolveSimple.
@Test
public void testResolveSimple() throws Exception {
// mod1.1 depends on mod1.2
ResolveReport report = ivy.resolve(new File("test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml"), getResolveOptions(new String[] { "*" }));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org1", "mod1.1", "1.0");
assertEquals(mrid, md.getModuleRevisionId());
assertTrue(getResolvedIvyFileInCache(mrid).exists());
// dependencies
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
}
use of org.apache.ivy.core.module.descriptor.ModuleDescriptor in project ant-ivy by apache.
the class ResolveTest method testResolveExcludesConf2.
@Test
public void testResolveExcludesConf2() throws Exception {
// same as testResolveExcludesConf
ResolveReport report = ivy.resolve(new File("test/repositories/1/org2/mod2.6/ivys/ivy-0.13.xml"), getResolveOptions(new String[] { "exclude" }));
ModuleDescriptor md = report.getModuleDescriptor();
assertEquals(ModuleRevisionId.newInstance("org2", "mod2.6", "0.13"), md.getModuleRevisionId());
assertFalse(getIvyFileInCache(ModuleRevisionId.newInstance("org2", "mod2.3", "0.4")).exists());
}
use of org.apache.ivy.core.module.descriptor.ModuleDescriptor in project ant-ivy by apache.
the class ResolveTest method testResolveWithStartPublicConf.
@Test
public void testResolveWithStartPublicConf() throws Exception {
// mod2.2 depends on mod1.3 and selects its artifacts
ResolveReport report = ivy.resolve(new File("test/repositories/1/org2/mod2.2/ivys/ivy-0.8.xml"), getResolveOptions(new String[] { "*(public)" }));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org2", "mod2.2", "0.8");
assertEquals(mrid, md.getModuleRevisionId());
assertTrue(getResolvedIvyFileInCache(mrid).exists());
// dependencies
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.3", "3.0")).exists());
assertTrue(getArchiveFileInCache("org1", "mod1.3", "3.0", "mod1.3-A", "jar", "jar").exists());
assertTrue(getArchiveFileInCache("org1", "mod1.3", "3.0", "mod1.3-B", "jar", "jar").exists());
assertFalse(getArchiveFileInCache("org1", "mod1.3", "3.0", "mod1.3", "jar", "jar").exists());
}
use of org.apache.ivy.core.module.descriptor.ModuleDescriptor in project ant-ivy by apache.
the class ResolveTest method testResolveMaven2WithVersionProperty.
@Test
public void testResolveMaven2WithVersionProperty() throws Exception {
Ivy ivy = new Ivy();
ivy.configure(new File("test/repositories/m2/ivysettings.xml"));
ResolveReport report = ivy.resolve(new File("test/repositories/m2/org/apache/test-version/1.0/test-version-1.0.pom"), getResolveOptions(new String[] { "*" }));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org.apache", "test-version", "1.0");
assertEquals(mrid, md.getModuleRevisionId());
assertTrue(getResolvedIvyFileInCache(mrid).exists());
// dependencies
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org.apache", "test-classifier", "1.0")).exists());
assertTrue(getArchiveFileInCache(ivy, "org.apache", "test-classifier", "1.0", "test-classifier", "jar", "jar").exists());
}
use of org.apache.ivy.core.module.descriptor.ModuleDescriptor in project ant-ivy by apache.
the class ResolveTest method testResolveMaven2ParentPomWithNamespace.
/**
* Test case for IVY-1186.
*
* @throws Exception if something goes wrong
* @see <a href="https://issues.apache.org/jira/browse/IVY-1186">IVY-1186</a>
*/
@Test
public void testResolveMaven2ParentPomWithNamespace() throws Exception {
Ivy ivy = new Ivy();
ivy.configure(new File("test/repositories/parentPom/ivysettings-namespace.xml"));
ResolveReport report = ivy.resolve(ModuleRevisionId.newInstance("org.apache.systemDm", "test", "1.0"), getResolveOptions(new String[] { "*(public)" }), true);
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
// assertEquals(mrid, md.getModuleRevisionId());
// assertTrue(getResolvedIvyFileInCache(mrid).exists());
// test the report to make sure the right dependencies are listed
List<IvyNode> dependencies = report.getDependencies();
// the test module + it's 2 dependencies
assertEquals(3, dependencies.size());
IvyNode ivyNode = dependencies.get(0);
assertNotNull(ivyNode);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org.apache.systemDm", "test", "1.0");
assertEquals(mrid, ivyNode.getId());
// dependencies
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org.apache.systemDm", "test", "1.0")).exists());
assertTrue(getArchiveFileInCache(ivy, "org.apache.systemDm", "test", "1.0", "test", "jar", "jar").exists());
ivyNode = dependencies.get(1);
assertNotNull(ivyNode);
mrid = ModuleRevisionId.newInstance("org.apache.systemDm", "test2", "2.0");
assertEquals(mrid, ivyNode.getId());
// dependencies
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org.apache.systemDm", "test2", "2.0")).exists());
assertTrue(getArchiveFileInCache(ivy, "org.apache.systemDm", "test2", "2.0", "test2", "jar", "jar").exists());
ivyNode = dependencies.get(2);
assertNotNull(ivyNode);
mrid = ModuleRevisionId.newInstance("org.apache.systemDm", "test3", "1.0");
assertEquals(mrid, ivyNode.getId());
// dependencies
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org.apache.systemDm", "test3", "1.0")).exists());
assertTrue(getArchiveFileInCache(ivy, "org.apache.systemDm", "test3", "1.0", "test3", "jar", "jar").exists());
}
Aggregations