use of org.apache.ivy.Ivy in project ant-ivy by apache.
the class InstallTest method testLatestDependenciesDummyDefaultResolver.
@Test
public void testLatestDependenciesDummyDefaultResolver() throws Exception {
Ivy ivy = Ivy.newInstance();
ivy.configure(new File("test/repositories/ivysettings-dummydefaultresolver.xml"));
ivy.install(ModuleRevisionId.newInstance("org1", "mod1.4", "1.0.1"), "test", "install", new InstallOptions());
assertTrue(new File("build/test/install/org1/mod1.4/ivy-1.0.1.xml").exists());
assertTrue(new File("build/test/install/org1/mod1.1/ivy-2.0.xml").exists());
assertTrue(new File("build/test/install/org1/mod1.1/mod1.1-2.0.jar").exists());
assertTrue(new File("build/test/install/org1/mod1.2/ivy-2.2.xml").exists());
assertTrue(new File("build/test/install/org1/mod1.2/mod1.2-2.2.jar").exists());
}
use of org.apache.ivy.Ivy in project ant-ivy by apache.
the class IvyTaskTest method testDefaultSettings.
@Test
public void testDefaultSettings() throws MalformedURLException {
Project p = TestHelper.newProject();
p.setBasedir("test/repositories");
p.setProperty("myproperty", "myvalue");
IvyTask task = new IvyTask() {
public void doExecute() throws BuildException {
}
};
task.setProject(p);
Ivy ivy = task.getIvyInstance();
assertNotNull(ivy);
IvySettings settings = ivy.getSettings();
assertNotNull(settings);
assertEquals(new File("test/repositories/build/cache").getAbsoluteFile(), settings.getDefaultCache());
// The next test doesn't always works on windows (mix C: and c: drive)
assertEquals(new File("test/repositories/ivysettings.xml").getAbsolutePath().toUpperCase(), new File(settings.getVariables().getVariable("ivy.settings.file")).getAbsolutePath().toUpperCase());
assertEquals(new File("test/repositories/ivysettings.xml").toURI().toURL().toExternalForm().toUpperCase(), settings.getVariables().getVariable("ivy.settings.url").toUpperCase());
assertEquals(new File("test/repositories").getAbsolutePath().toUpperCase(), settings.getVariables().getVariable("ivy.settings.dir").toUpperCase());
assertEquals("myvalue", settings.getVariables().getVariable("myproperty"));
}
use of org.apache.ivy.Ivy in project ant-ivy by apache.
the class IvyVarTest method testSimple.
@Test
public void testSimple() {
IvyVar task = new IvyVar();
task.setProject(TestHelper.newProject());
task.setName("mytest");
task.setValue("myvalue");
task.execute();
Ivy ivy = task.getIvyInstance();
assertNotNull(ivy);
assertEquals("myvalue", ivy.getVariable("mytest"));
}
use of org.apache.ivy.Ivy in project ant-ivy by apache.
the class IvyVarTest method testPrefix.
@Test
public void testPrefix() {
IvyVar task = new IvyVar();
task.setProject(TestHelper.newProject());
task.setName("mytest");
task.setValue("myvalue");
task.setPrefix("myprefix");
task.execute();
Ivy ivy = task.getIvyInstance();
assertNotNull(ivy);
assertEquals("myvalue", ivy.getVariable("myprefix.mytest"));
}
use of org.apache.ivy.Ivy in project ant-ivy by apache.
the class IvyVarTest method testURLPrefix.
@Test
public void testURLPrefix() {
IvyVar task = new IvyVar();
task.setProject(TestHelper.newProject());
task.setUrl(IvyVarTest.class.getResource("vartest.properties").toExternalForm());
task.setPrefix("myprefix.");
task.execute();
Ivy ivy = task.getIvyInstance();
assertNotNull(ivy);
assertEquals("myvalue1", ivy.getVariable("myprefix.mytest1"));
assertEquals("myvalue2", ivy.getVariable("myprefix.mytest2"));
}
Aggregations