use of org.apache.ivy.Ivy in project ant-ivy by apache.
the class ResolveTest method testExtraAttributes4.
/**
* Second test case for IVY-745.ยจ
* Now we disable consistency checking, everything must work fine.
*
* @throws Exception if something goes wrong
* @see <a href="https://issues.apache.org/jira/browse/IVY-745">IVY-745</a>
*/
@Test
public void testExtraAttributes4() throws Exception {
Ivy ivy = new Ivy();
ivy.configure(new File("test/repositories/extra-attributes/ivysettings.xml"));
ivy.getSettings().setDefaultCache(cache);
((FileSystemResolver) ivy.getSettings().getResolver("default")).setCheckconsistency(false);
ivy.getSettings().validate();
ResolveReport report = ivy.resolve(ResolveTest.class.getResource("ivy-extra-att3.xml"), getResolveOptions(ivy.getSettings(), new String[] { "*" }).setValidate(false));
assertFalse(report.hasError());
assertTrue(new File(cache, "apache/mymodule/task2/1749/ivy.xml").exists());
assertTrue(new File(cache, "apache/mymodule/task2/1749/ivy.xml.original").exists());
assertTrue(new File(cache, "apache/mymodule/task2/1749/mymodule-windows.jar").exists());
assertTrue(new File(cache, "apache/mymodule/task2/1749/mymodule-linux.jar").exists());
}
use of org.apache.ivy.Ivy in project ant-ivy by apache.
the class ResolveTest method testForceLocal.
@Test
public void testForceLocal() throws Exception {
// mod2.1 depends on mod1.1 which depends on mod1.2
// a local build for mod1.2 is available
Ivy ivy = new Ivy();
ivy.configure(new File("test/repositories/ivysettings-local.xml"));
ResolveReport report = ivy.resolve(new File("test/repositories/1/org2/mod2.1/ivys/ivy-0.3.xml"), getResolveOptions(new String[] { "*" }));
assertFalse(report.hasError());
// dependencies
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.1", "1.0")).exists());
assertTrue(getArchiveFileInCache("org1", "mod1.1", "1.0", "mod1.1", "jar", "jar").exists());
assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "local-20080708091023")).exists());
assertTrue(getArchiveFileInCache("org1", "mod1.2", "local-20080708091023", "mod1.2", "jar", "jar").exists());
assertTrue(getArchiveFileInCache("org1", "mod1.3", "3.0", "mod1.3-A", "jar", "jar").exists());
assertFalse(getIvyFileInCache(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
assertFalse(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
}
use of org.apache.ivy.Ivy in project ant-ivy by apache.
the class ResolveTest method testResolveRequiresDescriptor.
@Test
public void testResolveRequiresDescriptor() throws Exception {
// mod1.1 depends on mod1.2, mod1.2 has no ivy file
Ivy ivy = new Ivy();
ivy.configure(new File("test/repositories/ivysettings.xml"));
((FileSystemResolver) ivy.getSettings().getResolver("1")).setDescriptor(FileSystemResolver.DESCRIPTOR_REQUIRED);
ResolveReport report = ivy.resolve(new File("test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml"), getResolveOptions(new String[] { "*" }));
assertNotNull(report);
assertTrue(report.hasError());
}
use of org.apache.ivy.Ivy in project ant-ivy by apache.
the class DefaultRepositoryCacheManagerTest method setUp.
@Before
public void setUp() throws Exception {
File f = File.createTempFile("ivycache", ".dir");
ivy = new Ivy();
ivy.configureDefault();
ivy.getLoggerEngine().setDefaultLogger(new DefaultMessageLogger(Message.MSG_DEBUG));
IvyContext.pushNewContext().setIvy(ivy);
IvySettings settings = ivy.getSettings();
// we want to use the file as a directory, so we delete the file itself
f.delete();
cacheManager = new DefaultRepositoryCacheManager();
cacheManager.setSettings(settings);
cacheManager.setBasedir(f);
artifact = createArtifact("org", "module", "rev", "name", "type", "ext");
Artifact originArtifact = createArtifact("org", "module", "rev", "name", "pom.original", "pom");
origin = new ArtifactOrigin(originArtifact, true, "file:/some/where.pom");
cacheManager.saveArtifactOrigin(originArtifact, origin);
cacheManager.saveArtifactOrigin(artifact, origin);
}
use of org.apache.ivy.Ivy in project ant-ivy by apache.
the class InstallTest method testSimpleWithoutDefaultResolver.
@Test
public void testSimpleWithoutDefaultResolver() throws Exception {
Ivy ivy = Ivy.newInstance();
ivy.configure(new File("test/repositories/ivysettings-nodefaultresolver.xml"));
ivy.install(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"), "test", "install", new InstallOptions());
assertTrue(new File("build/test/install/org1/mod1.2/ivy-2.0.xml").exists());
assertTrue(new File("build/test/install/org1/mod1.2/mod1.2-2.0.jar").exists());
}
Aggregations