use of org.apache.ivy.Ivy in project ant-ivy by apache.
the class ResolveTest method testExtraAttributesMultipleDependenciesHang2.
@Test
public void testExtraAttributesMultipleDependenciesHang2() throws Exception {
Ivy ivy = new Ivy();
ivy.configure(new File("test/repositories/extra-attributes-multipledependencies/ivysettings-filerepo-attribs.xml"));
ivy.getSettings().setDefaultCache(cache);
ResolveReport report = ivy.resolve(ResolveTest.class.getResource("ivy-extra-att-multipledependencies2.xml"), getResolveOptions(ivy.getSettings(), new String[] { "*" }).setValidate(false));
assertFalse(report.hasError());
}
use of org.apache.ivy.Ivy in project ant-ivy by apache.
the class ResolveTest method testResolveWithDynamicRevisionsAndArtifactLockStrategy.
@Test
public void testResolveWithDynamicRevisionsAndArtifactLockStrategy() throws Exception {
// mod4.1 v 4.5 depends on
// - mod1.2 v 1+ and forces it
// - mod3.1 v 1.2 which depends on mod1.2 v 2+
Ivy ivy = new Ivy();
ivy.configure(new File("test/repositories/ivysettings-artifact-lock.xml"));
ivy.resolve(new File("test/repositories/2/mod4.1/ivy-4.5.xml"), getResolveOptions(new String[] { "*" }));
List<File> lockFiles = new ArrayList<>();
findLockFiles(cache, lockFiles);
assertTrue("There were lockfiles left in the cache: " + lockFiles, lockFiles.isEmpty());
}
use of org.apache.ivy.Ivy in project ant-ivy by apache.
the class ResolveTest method testDynamicFromCache.
@Test
public void testDynamicFromCache() throws Exception {
// mod1.4;1.0.2 depends on mod1.2;[1.0,2.0[
Ivy ivy = ivyTestCache();
ivy.getSettings().setVariable("ivy.cache.ttl.default", "10s", true);
// set up repository
FileUtil.forceDelete(new File("build/testCache2"));
FileUtil.copy(new File("test/repositories/1/org1/mod1.2/jars/mod1.2-2.0.jar"), new File("build/testCache2/mod1.2-1.5.jar"), null);
// we first do a simple resolve so that module is in cache
ResolveReport report = ivy.resolve(new File("test/repositories/1/org1/mod1.4/ivys/ivy-1.0.2.xml"), getResolveOptions(new String[] { "*" }));
assertFalse(report.hasError());
assertEquals(Collections.singleton(ModuleRevisionId.newInstance("org1", "mod1.2", "1.5")), report.getConfigurationReport("default").getModuleRevisionIds());
// now we clean the repository to simulate repo not available (network pb for instance)
FileUtil.forceDelete(new File("build/testCache2"));
// now do a new resolve: it should use cached data
report = ivy.resolve(new File("test/repositories/1/org1/mod1.4/ivys/ivy-1.0.2.xml"), getResolveOptions(new String[] { "*" }));
assertFalse(report.hasError());
assertEquals(Collections.singleton(ModuleRevisionId.newInstance("org1", "mod1.2", "1.5")), report.getConfigurationReport("default").getModuleRevisionIds());
}
use of org.apache.ivy.Ivy in project ant-ivy by apache.
the class ResolveTest method testBranches1.
@Test
public void testBranches1() throws Exception {
Ivy ivy = new Ivy();
ivy.configure(new File("test/repositories/branches/ivysettings.xml"));
ResolveReport report = ivy.resolve(new File("test/repositories/branches/bar/bar1/trunk/1/ivy.xml"), getResolveOptions(new String[] { "*" }).setValidate(false));
assertFalse(report.hasError());
assertTrue(getArchiveFileInCache(ivy, "foo#foo1#trunk;3", "foo1", "jar", "jar").exists());
}
use of org.apache.ivy.Ivy in project ant-ivy by apache.
the class ResolveTest method testResolveMaven2WithConflict.
@Test
public void testResolveMaven2WithConflict() 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/test3/1.1/test3-1.1.pom"), getResolveOptions(new String[] { "default" }));
assertFalse(report.hasError());
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org.apache", "test2", "1.1")).exists());
assertTrue(getArchiveFileInCache(ivy, "org.apache", "test2", "1.1", "test2", "jar", "jar").exists());
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org.apache", "test", "1.1")).exists());
assertTrue(getArchiveFileInCache(ivy, "org.apache", "test", "1.1", "test", "jar", "jar").exists());
assertContainsArtifact(report.getConfigurationReport("default"), getArtifact("org.apache", "test2", "1.1", "test2", "jar", "jar"));
assertContainsArtifact(report.getConfigurationReport("default"), getArtifact("org.apache", "test", "1.1", "test", "jar", "jar"));
}
Aggregations