use of org.apache.ivy.core.report.ResolveReport 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());
}
use of org.apache.ivy.core.report.ResolveReport in project ant-ivy by apache.
the class ResolveTest method testUseCacheOnlyWithRange.
@Test
public void testUseCacheOnlyWithRange() throws Exception {
ResolveOptions option = getResolveOptions(new String[] { "*" });
option.setValidate(false);
ivy.getSettings().setDefaultUseOrigin(true);
ivy.getSettings().setDefaultResolveMode("dynamic");
URL url = new File("test/repositories/1/usecacheonly/mod3/ivys/ivy-1.0.xml").toURI().toURL();
// normal resolve, the file goes in the cache
ResolveReport report = ivy.resolve(url, option);
assertFalse(report.hasError());
option.setUseCacheOnly(true);
// use cache only, hit the cache
report = ivy.resolve(url, option);
assertFalse(report.hasError());
}
use of org.apache.ivy.core.report.ResolveReport in project ant-ivy by apache.
the class ResolveTest method testResolveMaven2.
@Test
public void testResolveMaven2() throws Exception {
// test3 depends on test2 which depends on test
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.0/test3-1.0.pom"), getResolveOptions(new String[] { "test" }));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org.apache", "test3", "1.0");
assertEquals(mrid, md.getModuleRevisionId());
assertTrue(getResolvedIvyFileInCache(mrid).exists());
// dependencies
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org.apache", "test2", "1.0")).exists());
assertTrue(getArchiveFileInCache(ivy, "org.apache", "test2", "1.0", "test2", "jar", "jar").exists());
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org.apache", "test", "1.0")).exists());
assertTrue(getArchiveFileInCache(ivy, "org.apache", "test", "1.0", "test", "jar", "jar").exists());
}
use of org.apache.ivy.core.report.ResolveReport in project ant-ivy by apache.
the class ResolveTest method testConfigurationMapping5.
/**
* Test case for IVY-84.
*
* @throws Exception if something goes wrong
* @see <a href="https://issues.apache.org/jira/browse/IVY-84">IVY-84</a>
*/
@Test
public void testConfigurationMapping5() throws Exception {
Ivy ivy = new Ivy();
ivy.configure(new File("test/repositories/IVY-84/ivysettings.xml"));
ResolveReport report = ivy.resolve(new File("test/repositories/IVY-84/tests/5/ivy.xml"), getResolveOptions(new String[] { "*" }));
ConfigurationResolveReport conf = report.getConfigurationReport("default");
assertContainsArtifact("test", "a", "1.0.2", "a", "txt", "txt", conf);
assertDoesntContainArtifact("test", "a", "1.0.2", "a-bt", "txt", "txt", conf);
assertContainsArtifact("test", "b", "1.0.1", "b", "txt", "txt", conf);
assertDoesntContainArtifact("test", "b", "1.0.1", "b-bt", "txt", "txt", conf);
assertContainsArtifact("test", "c", "1.0.1", "c", "txt", "txt", conf);
assertDoesntContainArtifact("test", "c", "1.0.1", "c-bt", "txt", "txt", conf);
}
use of org.apache.ivy.core.report.ResolveReport in project ant-ivy by apache.
the class ResolveTest method testResolveModeDynamic2.
@Test
public void testResolveModeDynamic2() throws Exception {
// same as ResolveModeDynamic1, but resolve mode is set in settings
Map<String, String> attributes = new HashMap<>();
attributes.put("organisation", "org1");
attributes.put("module", "mod1.2");
ivy.getSettings().addModuleConfiguration(attributes, ExactPatternMatcher.INSTANCE, null, null, null, ResolveOptions.RESOLVEMODE_DYNAMIC);
ResolveReport report = ivy.resolve(new File("test/repositories/1/org1/mod1.1/ivys/ivy-1.0.1.xml"), getResolveOptions(new String[] { "default" }));
assertNotNull(report);
ModuleRevisionId depId = ModuleRevisionId.newInstance("org1", "mod1.2", "2.2");
ConfigurationResolveReport crr = report.getConfigurationReport("default");
assertEquals(1, crr.getDownloadReports(depId).length);
assertTrue(getIvyFileInCache(depId).exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.2", "mod1.2", "jar", "jar").exists());
}
Aggregations