Search in sources :

Example 46 with DependencyDescriptor

use of org.apache.ivy.core.module.descriptor.DependencyDescriptor in project ant-ivy by apache.

the class ResolveTest method testExtraAttributesForcedDependencies.

@Test
public void testExtraAttributesForcedDependencies() throws Exception {
    Ivy ivy = new Ivy();
    ivy.configure(new File("test/repositories/extra-attributes-forceddependencies/ivysettings-filerepo-attribs.xml"));
    ivy.getSettings().setDefaultCache(cache);
    ResolveReport report = ivy.resolve(ResolveTest.class.getResource("ivy-extra-attrib-forced-dependencies.xml"), getResolveOptions(ivy.getSettings(), new String[] { "*" }).setValidate(false));
    assertFalse(report.hasError());
    ivy.deliver("1.0.0", deliverDir.getAbsolutePath() + "/ivy-1.0.0.xml", new DeliverOptions().setResolveId(report.getResolveId()).setValidate(false).setPubdate(new Date()));
    File deliveredIvyFile = new File(deliverDir, "ivy-1.0.0.xml");
    assertTrue(deliveredIvyFile.exists());
    ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(ivy.getSettings(), deliveredIvyFile.toURI().toURL(), false);
    DependencyDescriptor[] dds = md.getDependencies();
    assertEquals(2, dds.length);
    assertEquals(ModuleRevisionId.newInstance("CAE-Visualization-Components", "SGL", "MAIN", "6.2.34.7"), dds[1].getDependencyRevisionId());
}
Also used : DeliverOptions(org.apache.ivy.core.deliver.DeliverOptions) ModuleDescriptor(org.apache.ivy.core.module.descriptor.ModuleDescriptor) ConfigurationResolveReport(org.apache.ivy.core.report.ConfigurationResolveReport) ResolveReport(org.apache.ivy.core.report.ResolveReport) DependencyDescriptor(org.apache.ivy.core.module.descriptor.DependencyDescriptor) Ivy(org.apache.ivy.Ivy) JarFile(java.util.jar.JarFile) File(java.io.File) Date(java.util.Date) Test(org.junit.Test)

Example 47 with DependencyDescriptor

use of org.apache.ivy.core.module.descriptor.DependencyDescriptor in project ant-ivy by apache.

the class ResolveTest method testIVY1159_orderIsModBModA.

/**
 * Test case for IVY-1159.
 *
 * @throws Exception if something goes wrong
 * @see <a href="https://issues.apache.org/jira/browse/IVY-1159">IVY-1159</a>
 */
@Test
public void testIVY1159_orderIsModBModA() throws Exception {
    testIVY1159("ivy-depsorder_modB_then_modA.xml", false);
    File deliveredIvyFile = new File("build/test/deliver/ivy-1.xml");
    assertTrue(deliveredIvyFile.exists());
    ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(ivy.getSettings(), deliveredIvyFile.toURI().toURL(), false);
    DependencyDescriptor[] dds = md.getDependencies();
    assertEquals(2, dds.length);
    assertEquals(ModuleRevisionId.newInstance("myorg", "modB", "0"), dds[0].getDependencyRevisionId());
    assertEquals(ModuleRevisionId.newInstance("myorg", "modA", "0"), dds[1].getDependencyRevisionId());
}
Also used : ModuleDescriptor(org.apache.ivy.core.module.descriptor.ModuleDescriptor) DependencyDescriptor(org.apache.ivy.core.module.descriptor.DependencyDescriptor) JarFile(java.util.jar.JarFile) File(java.io.File) Test(org.junit.Test)

Example 48 with DependencyDescriptor

use of org.apache.ivy.core.module.descriptor.DependencyDescriptor in project ant-ivy by apache.

the class ResolveTest method testIVY1159_orderIsModAModB.

/**
 * Test case for IVY-1159.
 *
 * @throws Exception if something goes wrong
 * @see <a href="https://issues.apache.org/jira/browse/IVY-1159">IVY-1159</a>
 */
@Test
public void testIVY1159_orderIsModAModB() throws Exception {
    testIVY1159("ivy-depsorder_modA_then_modB.xml", false);
    File deliveredIvyFile = new File("build/test/deliver/ivy-1.xml");
    assertTrue(deliveredIvyFile.exists());
    ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(ivy.getSettings(), deliveredIvyFile.toURI().toURL(), false);
    DependencyDescriptor[] dds = md.getDependencies();
    assertEquals(2, dds.length);
    assertEquals(ModuleRevisionId.newInstance("myorg", "modA", "0"), dds[0].getDependencyRevisionId());
    assertEquals(ModuleRevisionId.newInstance("myorg", "modB", "0"), dds[1].getDependencyRevisionId());
}
Also used : ModuleDescriptor(org.apache.ivy.core.module.descriptor.ModuleDescriptor) DependencyDescriptor(org.apache.ivy.core.module.descriptor.DependencyDescriptor) JarFile(java.util.jar.JarFile) File(java.io.File) Test(org.junit.Test)

Example 49 with DependencyDescriptor

use of org.apache.ivy.core.module.descriptor.DependencyDescriptor in project ant-ivy by apache.

the class ResolveTest method testIVY1159_orderIsModAModBReplaceForced.

/**
 * Test case for IVY-1159.
 *
 * @throws Exception if something goes wrong
 * @see <a href="https://issues.apache.org/jira/browse/IVY-1159">IVY-1159</a>
 */
@Test
public void testIVY1159_orderIsModAModBReplaceForced() throws Exception {
    testIVY1159("ivy-depsorder_modA_then_modB.xml", true);
    File deliveredIvyFile = new File("build/test/deliver/ivy-1.xml");
    assertTrue(deliveredIvyFile.exists());
    ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(ivy.getSettings(), deliveredIvyFile.toURI().toURL(), false);
    DependencyDescriptor[] dds = md.getDependencies();
    assertEquals(2, dds.length);
    assertEquals(ModuleRevisionId.newInstance("myorg", "modA", "1"), dds[0].getDependencyRevisionId());
    assertEquals(ModuleRevisionId.newInstance("myorg", "modB", "1"), dds[1].getDependencyRevisionId());
}
Also used : ModuleDescriptor(org.apache.ivy.core.module.descriptor.ModuleDescriptor) DependencyDescriptor(org.apache.ivy.core.module.descriptor.DependencyDescriptor) JarFile(java.util.jar.JarFile) File(java.io.File) Test(org.junit.Test)

Example 50 with DependencyDescriptor

use of org.apache.ivy.core.module.descriptor.DependencyDescriptor in project ant-ivy by apache.

the class SortTest method addDependency.

private DependencyDescriptor addDependency(DefaultModuleDescriptor parent, String moduleName, String revision) {
    ModuleRevisionId mrid = ModuleRevisionId.newInstance("org", moduleName, revision);
    DependencyDescriptor depDescr = new DefaultDependencyDescriptor(parent, mrid, false, false, true);
    parent.addDependency(depDescr);
    return depDescr;
}
Also used : DependencyDescriptor(org.apache.ivy.core.module.descriptor.DependencyDescriptor) DefaultDependencyDescriptor(org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor) ModuleRevisionId(org.apache.ivy.core.module.id.ModuleRevisionId) DefaultDependencyDescriptor(org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor)

Aggregations

DependencyDescriptor (org.apache.ivy.core.module.descriptor.DependencyDescriptor)101 ModuleDescriptor (org.apache.ivy.core.module.descriptor.ModuleDescriptor)80 Test (org.junit.Test)75 DefaultDependencyDescriptor (org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor)35 DefaultModuleDescriptor (org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor)33 File (java.io.File)26 XmlModuleDescriptorParserTest (org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParserTest)26 ModuleRevisionId (org.apache.ivy.core.module.id.ModuleRevisionId)25 ResolvedModuleRevision (org.apache.ivy.core.resolve.ResolvedModuleRevision)18 IvySettings (org.apache.ivy.core.settings.IvySettings)17 Configuration (org.apache.ivy.core.module.descriptor.Configuration)15 Artifact (org.apache.ivy.core.module.descriptor.Artifact)13 ParseException (java.text.ParseException)12 IOException (java.io.IOException)11 ResolveData (org.apache.ivy.core.resolve.ResolveData)11 MockResolver (org.apache.ivy.plugins.resolver.MockResolver)9 JarFile (java.util.jar.JarFile)7 GregorianCalendar (java.util.GregorianCalendar)6 ModuleId (org.apache.ivy.core.module.id.ModuleId)6 ResolveReport (org.apache.ivy.core.report.ResolveReport)6