use of org.apache.ivy.core.module.descriptor.ModuleDescriptor in project ant-ivy by apache.
the class ResolveTest method testChangeCacheLayout.
@Test
public void testChangeCacheLayout() throws Exception {
Ivy ivy = new Ivy();
ivy.configure(new File("test/repositories/ivysettings.xml"));
DefaultRepositoryCacheManager cacheMgr = (DefaultRepositoryCacheManager) ivy.getSettings().getDefaultRepositoryCacheManager();
cacheMgr.setIvyPattern("[module]/ivy.xml");
cacheMgr.setArtifactPattern("[artifact].[ext]");
// mod1.1 depends on mod1.2
ResolveReport report = ivy.resolve(new File("test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml"), getResolveOptions(ivy.getSettings(), 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(ivy, mrid).exists());
// dependencies
assertTrue(getIvyFileInCache(ivy, ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
assertTrue(new File(cache, "mod1.2/ivy.xml").exists());
assertTrue(getArchiveFileInCache(ivy, "org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
assertTrue(new File(cache, "mod1.2.jar").exists());
}
use of org.apache.ivy.core.module.descriptor.ModuleDescriptor in project ant-ivy by apache.
the class ResolveTest method testResolveWithExcludesArtifacts5.
@Test
public void testResolveWithExcludesArtifacts5() throws Exception {
// mod2.3 depends on mod2.1 and excludes artifacts with glob matcher
ResolveReport report = ivy.resolve(new File("test/repositories/1/org2/mod2.3/ivys/ivy-0.6.5.xml"), getResolveOptions(new String[] { "*" }));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org2", "mod2.3", "0.6.5");
assertEquals(mrid, md.getModuleRevisionId());
assertTrue(getResolvedIvyFileInCache(mrid).exists());
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org2", "mod2.1", "0.3")).exists());
assertTrue(getArchiveFileInCache("org2", "mod2.1", "0.3", "art21A", "jar", "jar").exists());
assertFalse(getArchiveFileInCache("org2", "mod2.1", "0.3", "art21B", "jar", "jar").exists());
assertFalse(getArchiveFileInCache("org2", "mod2.1", "0.3", "mod2.1", "jar", "jar").exists());
}
use of org.apache.ivy.core.module.descriptor.ModuleDescriptor in project ant-ivy by apache.
the class ResolveTest method testResolveForceWithDynamicRevisionsAndSeveralConfs.
@Test
public void testResolveForceWithDynamicRevisionsAndSeveralConfs() throws Exception {
// mod4.1 v 4.6 (conf compile, runtime extends compile, test extends runtime) depends on
// - mod1.2 v 1+ and forces it in conf compile
// - mod3.1 v 1.2 in conf test which depends on mod1.2 v 2+
ResolveReport report = ivy.resolve(new File("test/repositories/2/mod4.1/ivy-4.6.xml"), getResolveOptions(new String[] { "*" }));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org4", "mod4.1", "4.6");
assertEquals(mrid, md.getModuleRevisionId());
assertTrue(getResolvedIvyFileInCache(mrid).exists());
// dependencies
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org3", "mod3.1", "1.2")).exists());
assertTrue(getArchiveFileInCache("org3", "mod3.1", "1.2", "mod3.1", "jar", "jar").exists());
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "1.1")).exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "1.1", "mod1.2", "jar", "jar").exists());
assertFalse(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.2")).exists());
assertFalse(getArchiveFileInCache("org1", "mod1.2", "2.2", "mod1.2", "jar", "jar").exists());
}
use of org.apache.ivy.core.module.descriptor.ModuleDescriptor in project ant-ivy by apache.
the class ResolveTest method testResolveTransitiveExcludesSimple.
@Test
public void testResolveTransitiveExcludesSimple() throws Exception {
// mod2.5 depends on mod2.3 and excludes one artifact from mod2.1
// mod2.3 depends on mod2.1
ResolveReport report = ivy.resolve(new File("test/repositories/1/org2/mod2.5/ivys/ivy-0.6.xml"), getResolveOptions(new String[] { "*" }));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org2", "mod2.5", "0.6");
assertEquals(mrid, md.getModuleRevisionId());
assertTrue(getResolvedIvyFileInCache(mrid).exists());
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org2", "mod2.3", "0.7")).exists());
assertTrue(getArchiveFileInCache("org2", "mod2.3", "0.7", "mod2.3", "jar", "jar").exists());
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org2", "mod2.1", "0.3")).exists());
assertTrue(getArchiveFileInCache("org2", "mod2.1", "0.3", "art21A", "jar", "jar").exists());
assertFalse(getArchiveFileInCache("org2", "mod2.1", "0.3", "art21B", "jar", "jar").exists());
}
use of org.apache.ivy.core.module.descriptor.ModuleDescriptor in project ant-ivy by apache.
the class ResolveTest method testResolverDirectlyUsingCache.
@Test
public void testResolverDirectlyUsingCache() throws Exception {
Ivy ivy = new Ivy();
ivy.configure(ResolveTest.class.getResource("badcacheconf.xml"));
File depIvyFileInCache = getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"));
// creates a
FileUtil.copy(File.createTempFile("test", "xml"), depIvyFileInCache, null);
// fake
// dependency
// file in cache
ResolveReport report = ivy.resolve(new File("test/repositories/1/org2/mod2.4/ivys/ivy-0.3.xml"), getResolveOptions(new String[] { "*" }));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org2", "mod2.4", "0.3");
assertEquals(mrid, md.getModuleRevisionId());
assertTrue(getResolvedIvyFileInCache(mrid).exists());
// dependencies
assertTrue(depIvyFileInCache.exists());
assertFalse(getArchiveFileInCache(ivy, "org1", "mod1.1", "1.0", "mod1.1", "jar", "jar").exists());
}
Aggregations