use of org.apache.ivy.core.report.ResolveReport in project ant-ivy by apache.
the class ResolveTest method testResolveForceAfterDependencyExist.
/**
* Test case for IVY-193.
*
* @throws Exception if something goes wrong
* @see <a href="https://issues.apache.org/jira/browse/IVY-193">IVY-193</a>
*/
@Test
public void testResolveForceAfterDependencyExist() throws Exception {
// mod4.1 v 4.10 depends on
// - mod3.1 v 1.0.1 which depends on mod1.2 v 2.0 and forces it
// - mod3.2 v 1.2 which depends on mod1.2 v 2.1 and on mod3.1 v1.0.1
ResolveReport report = ivy.resolve(new File("test/repositories/2/mod4.1/ivy-4.10.xml"), getResolveOptions(new String[] { "*" }));
assertNotNull(report);
// dependencies
assertFalse(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.1")).exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.1", "mod1.2", "jar", "jar").exists());
}
use of org.apache.ivy.core.report.ResolveReport in project ant-ivy by apache.
the class ResolveTest method testDisableTransitivityPerConfiguration4.
@Test
public void testDisableTransitivityPerConfiguration4() throws Exception {
// mod2.2 (A,B,compile) depends on mod 2.1 (A->runtime;B->compile)
// compile is not transitive and extends A and B
//
// mod2.1 (compile, runtime) depends on mod1.1 which depends on mod1.2
// compile conf is not transitive and extends runtime
ResolveReport r = ivy.resolve(new File("test/repositories/1/org2/mod2.2/ivys/ivy-0.6.xml"), getResolveOptions(new String[] { "*" }));
assertFalse(r.hasError());
// here we should get all three recursive dependencies
assertEquals(new HashSet<>(Arrays.asList(ModuleRevisionId.newInstance("org2", "mod2.1", "0.3.2"), ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"), ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"))), r.getConfigurationReport("A").getModuleRevisionIds());
// here we should get only mod2.1 and mod1.1 cause compile is not transitive in mod2.1
assertEquals(new HashSet<>(Arrays.asList(ModuleRevisionId.newInstance("org2", "mod2.1", "0.3.2"), ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"))), r.getConfigurationReport("B").getModuleRevisionIds());
// here we should get only mod2.1 cause compile is not transitive
assertEquals(Collections.singleton(ModuleRevisionId.newInstance("org2", "mod2.1", "0.3.2")), r.getConfigurationReport("compile").getModuleRevisionIds());
}
use of org.apache.ivy.core.report.ResolveReport 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.core.report.ResolveReport in project ant-ivy by apache.
the class ResolveTest method testEvictWithConf3.
/**
* Test case for IVY-681.
*
* @throws Exception if something goes wrong
* @see <a href="https://issues.apache.org/jira/browse/IVY-681">IVY-681</a>
*/
@Test
public void testEvictWithConf3() throws Exception {
// same as first one but the conf requested in evicted module is no longer present in
// selected revision
// mod6.1 r1.4 depends on
// mod5.1 r4.3 conf A
// mod5.2 r1.0 which depends on mod5.1 r4.0 conf B
//
// mod5.1 r4.3 has only conf A, not B
ResolveReport report = ivy.resolve(new File("test/repositories/2/mod6.1/ivy-1.4.xml"), getResolveOptions(new String[] { "*" }));
assertFalse(report.hasError());
// dependencies
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org5", "mod5.1", "4.3")).exists());
assertTrue(getArchiveFileInCache("org5", "mod5.1", "4.3", "art51A", "jar", "jar").exists());
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org5", "mod5.2", "1.0")).exists());
assertTrue(getArchiveFileInCache("org5", "mod5.2", "1.0", "mod5.2", "jar", "jar").exists());
assertFalse(getArchiveFileInCache("org5", "mod5.1", "4.0", "art51A", "jar", "jar").exists());
assertFalse(getArchiveFileInCache("org5", "mod5.1", "4.0", "art51B", "jar", "jar").exists());
}
use of org.apache.ivy.core.report.ResolveReport 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