use of org.apache.ivy.core.report.ResolveReport in project ant-ivy by apache.
the class ResolveTest method testIVY1159.
private void testIVY1159(String modCIvyFile, boolean replaceForced) throws Exception {
ivy = Ivy.newInstance();
ivy.configure(new File("test/repositories/IVY-1159/ivysettings.xml"));
ResolveOptions opts = new ResolveOptions();
opts.setConfs(new String[] { "*" });
opts.setResolveId("resolveid");
opts.setRefresh(true);
opts.setTransitive(true);
ResolveReport report = ivy.resolve(new File("test/repositories/IVY-1159/" + modCIvyFile), opts);
assertFalse(report.hasError());
assertEquals(new HashSet<>(Arrays.asList(ModuleRevisionId.newInstance("myorg", "modA", "1"), ModuleRevisionId.newInstance("myorg", "modB", "1"))), report.getConfigurationReport("default").getModuleRevisionIds());
DeliverOptions dopts = new DeliverOptions();
dopts.setReplaceForcedRevisions(replaceForced);
dopts.setGenerateRevConstraint(true);
dopts.setConfs(new String[] { "*" });
dopts.setStatus("release");
dopts.setPubdate(new Date());
dopts.setResolveId("resolveid");
String pubrev = "1";
String deliveryPattern = "build/test/deliver/ivy-[revision].xml";
ivy.deliver(pubrev, deliveryPattern, dopts);
}
use of org.apache.ivy.core.report.ResolveReport 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.report.ResolveReport 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.report.ResolveReport in project ant-ivy by apache.
the class ResolveTest method testResolveMaven2RelocationOfGroupId.
@Test
public void testResolveMaven2RelocationOfGroupId() throws Exception {
// Same as testResolveMaven2 but with a relocated module pointing to the module
// used in testResolveMaven2.
ivy = new Ivy();
ivy.configure(new File("test/repositories/m2/ivysettings.xml"));
ivy.pushContext();
try {
ResolveReport report = ivy.resolve(new File("test/repositories/m2/org/relocated/test3/1.0/test3-1.0.pom"), getResolveOptions(new String[] { "*" }));
assertNotNull(report);
// 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());
} finally {
ivy.popContext();
}
}
use of org.apache.ivy.core.report.ResolveReport in project ant-ivy by apache.
the class ResolveTest method testIVY999.
/**
* Test case for IVY-999.
*
* @throws Exception if something goes wrong
* @see <a href="https://issues.apache.org/jira/browse/IVY-999">IVY-999</a>
*/
@Test
public void testIVY999() throws Exception {
Ivy ivy = new Ivy();
ivy.configure(new File("test/repositories/IVY-999/ivysettings.xml"));
ivy.getSettings().setDefaultCache(cache);
ResolveReport rr = ivy.resolve(ResolveTest.class.getResource("ivy-999.xml"), getResolveOptions(new String[] { "*" }));
ConfigurationResolveReport crr = rr.getConfigurationReport("default");
Set<ModuleRevisionId> modRevIds = crr.getModuleRevisionIds();
assertTrue(modRevIds.contains(ModuleRevisionId.newInstance("junit", "junit", "4.4")));
assertFalse(modRevIds.contains(ModuleRevisionId.newInstance("junit", "junit", "3.8")));
}
Aggregations