use of org.apache.ivy.core.module.descriptor.ModuleDescriptor in project ant-ivy by apache.
the class FixDepsTaskTest method testFixedResolve.
@Test
public void testFixedResolve() throws Exception {
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-transitive.xml");
File dest = new File("build/testFixDeps/testTransitivity.xml");
fixDeps.setToFile(dest);
fixDeps.execute();
project.setProperty("ivy.dep.file", dest.getAbsolutePath());
File dest2 = new File("build/testFixDeps/testTransitivity2.xml");
fixDeps.setToFile(dest2);
fixDeps.execute();
ModuleDescriptor md1 = XmlModuleDescriptorParser.getInstance().parseDescriptor(new IvySettings(), dest.toURI().toURL(), true);
ModuleDescriptor md2 = XmlModuleDescriptorParser.getInstance().parseDescriptor(new IvySettings(), dest2.toURI().toURL(), true);
assertEquals(md1, md2);
assertEquals(Arrays.asList(md1.getConfigurations()), Arrays.asList(md2.getConfigurations()));
assertEquals(toString(Arrays.asList(md1.getDependencies())), toString(Arrays.asList(md2.getDependencies())));
}
use of org.apache.ivy.core.module.descriptor.ModuleDescriptor in project ant-ivy by apache.
the class FixDepsTaskTest method testMulticonf.
@Test
public void testMulticonf() throws Exception {
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-multiconf.xml");
File dest = new File("build/testFixDeps/testMultiConf.xml");
fixDeps.setToFile(dest);
fixDeps.execute();
assertTrue(dest.exists());
ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(new IvySettings(), dest.toURI().toURL(), true);
assertEquals("apache", md.getModuleRevisionId().getOrganisation());
assertEquals("resolve-simple", md.getModuleRevisionId().getName());
assertEquals("1.0", md.getModuleRevisionId().getRevision());
assertEquals("release", md.getStatus());
assertEquals(2, md.getConfigurations().length);
assertEquals("default", md.getConfigurations()[0].getName());
assertEquals(0, md.getConfigurations()[0].getExtends().length);
assertEquals("compile", md.getConfigurations()[1].getName());
assertEquals(0, md.getConfigurations()[1].getExtends().length);
assertEquals(2, md.getDependencies().length);
assertEquals("org1", md.getDependencies()[0].getDependencyId().getOrganisation());
assertEquals("mod1.2", md.getDependencies()[0].getDependencyId().getName());
assertFalse(md.getDependencies()[0].isChanging());
assertTrue(md.getDependencies()[0].isForce());
assertFalse(md.getDependencies()[0].isTransitive());
assertEquals("2.0", md.getDependencies()[0].getDependencyRevisionId().getRevision());
assertEquals(1, md.getDependencies()[0].getModuleConfigurations().length);
assertEquals("default", md.getDependencies()[0].getModuleConfigurations()[0]);
assertEquals(1, md.getDependencies()[0].getDependencyConfigurations("default").length);
assertEquals("default", md.getDependencies()[0].getDependencyConfigurations("default")[0]);
assertEquals("org1", md.getDependencies()[1].getDependencyId().getOrganisation());
assertEquals("mod1.1", md.getDependencies()[1].getDependencyId().getName());
assertFalse(md.getDependencies()[1].isChanging());
assertTrue(md.getDependencies()[1].isForce());
assertFalse(md.getDependencies()[1].isTransitive());
assertEquals("2.0", md.getDependencies()[1].getDependencyRevisionId().getRevision());
assertEquals(1, md.getDependencies()[1].getModuleConfigurations().length);
assertEquals("compile", md.getDependencies()[1].getModuleConfigurations()[0]);
assertEquals(1, md.getDependencies()[1].getDependencyConfigurations("compile").length);
assertEquals("default", md.getDependencies()[1].getDependencyConfigurations("compile")[0]);
}
use of org.apache.ivy.core.module.descriptor.ModuleDescriptor in project ant-ivy by apache.
the class IvyDeliverTest method testWithBranch.
/**
* Test case for IVY-404.
*
* @throws Exception if something goes wrong
* @see <a href="https://issues.apache.org/jira/browse/IVY-404">IVY-404</a>
*/
@Test
public void testWithBranch() throws Exception {
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-latest-branch.xml");
IvyResolve res = new IvyResolve();
res.setProject(project);
res.execute();
deliver.setPubrevision("1.2");
deliver.setDeliverpattern("build/test/deliver/ivy-[revision].xml");
deliver.execute();
// should have done the ivy delivering
File deliveredIvyFile = new File("build/test/deliver/ivy-1.2.xml");
assertTrue(deliveredIvyFile.exists());
ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(new IvySettings(), deliveredIvyFile.toURI().toURL(), true);
assertEquals(ModuleRevisionId.newInstance("apache", "resolve-latest", "1.2"), md.getModuleRevisionId());
DependencyDescriptor[] dds = md.getDependencies();
assertEquals(1, dds.length);
assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "TRUNK", "2.2"), dds[0].getDependencyRevisionId());
}
use of org.apache.ivy.core.module.descriptor.ModuleDescriptor in project ant-ivy by apache.
the class IvyDeliverTest method testReplaceBranchInfo.
@Test
public void testReplaceBranchInfo() throws Exception {
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-latest.xml");
IvyResolve res = new IvyResolve();
res.setProject(project);
res.execute();
deliver.setPubrevision("1.2");
deliver.setPubbranch("BRANCH1");
deliver.setDeliverpattern("build/test/deliver/ivy-[revision].xml");
deliver.execute();
// should have done the ivy delivering
File deliveredIvyFile = new File("build/test/deliver/ivy-1.2.xml");
assertTrue(deliveredIvyFile.exists());
ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(new IvySettings(), deliveredIvyFile.toURI().toURL(), true);
assertEquals(ModuleRevisionId.newInstance("apache", "resolve-latest", "BRANCH1", "1.2"), md.getModuleRevisionId());
}
use of org.apache.ivy.core.module.descriptor.ModuleDescriptor in project ant-ivy by apache.
the class IvyDeliverTest method testSimple.
@Test
public void testSimple() throws Exception {
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-latest.xml");
IvyResolve res = new IvyResolve();
res.setProject(project);
res.execute();
deliver.setPubrevision("1.2");
deliver.setDeliverpattern("build/test/deliver/ivy-[revision].xml");
deliver.execute();
// should have done the ivy delivering
File deliveredIvyFile = new File("build/test/deliver/ivy-1.2.xml");
assertTrue(deliveredIvyFile.exists());
ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(new IvySettings(), deliveredIvyFile.toURI().toURL(), true);
assertEquals(ModuleRevisionId.newInstance("apache", "resolve-latest", "1.2"), md.getModuleRevisionId());
DependencyDescriptor[] dds = md.getDependencies();
assertEquals(1, dds.length);
assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "2.2"), dds[0].getDependencyRevisionId());
assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "latest.integration"), dds[0].getDynamicConstraintDependencyRevisionId());
}
Aggregations