Search in sources :

Example 21 with ConfigurationResolveReport

use of org.apache.ivy.core.report.ConfigurationResolveReport in project ant-ivy by apache.

the class ResolveTest method testConfigurationMapping2.

/**
 * Test case for IVY-84.
 *
 * @throws Exception if something goes wrong
 * @see <a href="https://issues.apache.org/jira/browse/IVY-84">IVY-84</a>
 */
@Test
public void testConfigurationMapping2() throws Exception {
    Ivy ivy = new Ivy();
    ivy.configure(new File("test/repositories/IVY-84/ivysettings.xml"));
    ResolveReport report = ivy.resolve(new File("test/repositories/IVY-84/tests/2/ivy.xml"), getResolveOptions(new String[] { "*" }));
    ConfigurationResolveReport conf = report.getConfigurationReport("default");
    assertContainsArtifact("test", "a", "1.0.1", "a", "txt", "txt", conf);
    assertDoesntContainArtifact("test", "a", "1.0.1", "a-bt", "txt", "txt", conf);
    assertContainsArtifact("test", "b", "1.0.1", "b", "txt", "txt", conf);
    assertDoesntContainArtifact("test", "b", "1.0.1", "b-bt", "txt", "txt", conf);
    assertContainsArtifact("test", "c", "1.0.1", "c", "txt", "txt", conf);
    assertDoesntContainArtifact("test", "c", "1.0.1", "c-bt", "txt", "txt", conf);
}
Also used : ConfigurationResolveReport(org.apache.ivy.core.report.ConfigurationResolveReport) ResolveReport(org.apache.ivy.core.report.ResolveReport) ConfigurationResolveReport(org.apache.ivy.core.report.ConfigurationResolveReport) Ivy(org.apache.ivy.Ivy) JarFile(java.util.jar.JarFile) File(java.io.File) Test(org.junit.Test)

Example 22 with ConfigurationResolveReport

use of org.apache.ivy.core.report.ConfigurationResolveReport in project ant-ivy by apache.

the class ResolveTest method testConfigurationMapping6.

/**
 * Test case for IVY-84.
 *
 * @throws Exception if something goes wrong
 * @see <a href="https://issues.apache.org/jira/browse/IVY-84">IVY-84</a>
 */
@Test
public void testConfigurationMapping6() throws Exception {
    Ivy ivy = new Ivy();
    ivy.configure(new File("test/repositories/IVY-84/ivysettings.xml"));
    ResolveReport report = ivy.resolve(new File("test/repositories/IVY-84/tests/6/ivy.xml"), getResolveOptions(new String[] { "default", "buildtime" }));
    ConfigurationResolveReport conf = report.getConfigurationReport("default");
    assertContainsArtifact("test", "a", "1.0.2", "a", "txt", "txt", conf);
    assertDoesntContainArtifact("test", "a", "1.0.2", "a-bt", "txt", "txt", conf);
    assertContainsArtifact("test", "b", "1.0.1", "b", "txt", "txt", conf);
    assertDoesntContainArtifact("test", "b", "1.0.1", "b-bt", "txt", "txt", conf);
    assertContainsArtifact("test", "c", "1.0.1", "c", "txt", "txt", conf);
    assertDoesntContainArtifact("test", "c", "1.0.1", "c-bt", "txt", "txt", conf);
}
Also used : ConfigurationResolveReport(org.apache.ivy.core.report.ConfigurationResolveReport) ResolveReport(org.apache.ivy.core.report.ResolveReport) ConfigurationResolveReport(org.apache.ivy.core.report.ConfigurationResolveReport) Ivy(org.apache.ivy.Ivy) JarFile(java.util.jar.JarFile) File(java.io.File) Test(org.junit.Test)

Example 23 with ConfigurationResolveReport

use of org.apache.ivy.core.report.ConfigurationResolveReport in project ant-ivy by apache.

the class LatestConflictManagerTest method testIvy383.

/**
 * Test case for IVY-383.
 *
 * @throws Exception if something goes wrong
 * @see <a href="https://issues.apache.org/jira/browse/IVY-383">IVY-383</a>
 */
@Test
public void testIvy383() throws Exception {
    ResolveReport report = ivy.resolve(LatestConflictManagerTest.class.getResource("ivy-383.xml"), getResolveOptions());
    ConfigurationResolveReport defaultReport = report.getConfigurationReport("default");
    for (ModuleRevisionId mrid : defaultReport.getModuleRevisionIds()) {
        if (mrid.getName().equals("mod1.1")) {
            assertEquals("1.0", mrid.getRevision());
        } else if (mrid.getName().equals("mod1.2")) {
            assertEquals("2.2", mrid.getRevision());
        }
    }
}
Also used : ConfigurationResolveReport(org.apache.ivy.core.report.ConfigurationResolveReport) ResolveReport(org.apache.ivy.core.report.ResolveReport) ModuleRevisionId(org.apache.ivy.core.module.id.ModuleRevisionId) ConfigurationResolveReport(org.apache.ivy.core.report.ConfigurationResolveReport) Test(org.junit.Test)

Example 24 with ConfigurationResolveReport

use of org.apache.ivy.core.report.ConfigurationResolveReport in project ant-ivy by apache.

the class LatestConflictManagerTest method testLatestTimeTransitivity.

/**
 * Test case for IVY-407 (with transitivity). There are 5 modules A, B, C, D and E.
 * <ol>
 * <li>publish C-1.0.0, C-1.0.1 and C-1.0.2</li>
 * <li>B needs C-1.0.0 : retrieve ok and publish B-1.0.0</li>
 * <li>A needs B-1.0.0 and C-1.0.2 : retrieve ok and publish A-1.0.0</li>
 * <li>D needs C-1.0.1 : retrieve ok and publish D-1.0.0</li>
 * <li>E needs D-1.0.0 and A-1.0.0 (D before A in ivy file) :
 * retrieve failed to get C-1.0.2 from A (get apparently C-1.0.1 from D)</li>
 * </ol>
 *
 * @throws Exception if something goes wrong
 * @see <a href="https://issues.apache.org/jira/browse/IVY-407">IVY-407</a>
 */
@Test
public void testLatestTimeTransitivity() throws Exception {
    ivy = new Ivy();
    ivy.configure(LatestConflictManagerTest.class.getResource("ivysettings-latest-time-transitivity.xml"));
    ivy.getSettings().setVariable("ivy.log.conflict.resolution", "true", true);
    // set timestamps, because svn is not preserving this information,
    // and the latest time strategy is relying on it
    long time = System.currentTimeMillis() - 10000;
    new File("test/repositories/IVY-407/MyCompany/C/ivy-1.0.0.xml").setLastModified(time);
    new File("test/repositories/IVY-407/MyCompany/C/ivy-1.0.1.xml").setLastModified(time + 2000);
    new File("test/repositories/IVY-407/MyCompany/C/ivy-1.0.2.xml").setLastModified(time + 4000);
    ResolveReport report = ivy.resolve(LatestConflictManagerTest.class.getResource("ivy-latest-time-transitivity.xml"), getResolveOptions());
    ConfigurationResolveReport defaultReport = report.getConfigurationReport("default");
    for (ModuleRevisionId mrid : defaultReport.getModuleRevisionIds()) {
        switch(mrid.getName()) {
            case "A":
                assertEquals("A revision should be 1.0.0", "1.0.0", mrid.getRevision());
                break;
            case "B":
                // by transitivity
                assertEquals("B revision should be 1.0.0", "1.0.0", mrid.getRevision());
                break;
            case "C":
                assertEquals("C revision should be 1.0.2", "1.0.2", mrid.getRevision());
                break;
            case "D":
                assertEquals("D revision should be 1.0.0", "1.0.0", mrid.getRevision());
                break;
        }
    }
}
Also used : ConfigurationResolveReport(org.apache.ivy.core.report.ConfigurationResolveReport) ResolveReport(org.apache.ivy.core.report.ResolveReport) ModuleRevisionId(org.apache.ivy.core.module.id.ModuleRevisionId) ConfigurationResolveReport(org.apache.ivy.core.report.ConfigurationResolveReport) Ivy(org.apache.ivy.Ivy) File(java.io.File) Test(org.junit.Test)

Example 25 with ConfigurationResolveReport

use of org.apache.ivy.core.report.ConfigurationResolveReport in project ant-ivy by apache.

the class ResolveTest method testConfigurationMapping1.

// /////////////////////////////////////////////////////////
// here comes a series of test provided by Chris Rudd
// about configuration mapping and eviction
// /////////////////////////////////////////////////////////
/**
 * Test case for IVY-84.
 *
 * @throws Exception if something goes wrong
 * @see <a href="https://issues.apache.org/jira/browse/IVY-84">IVY-84</a>
 */
@Test
public void testConfigurationMapping1() throws Exception {
    Ivy ivy = new Ivy();
    ivy.configure(new File("test/repositories/IVY-84/ivysettings.xml"));
    ResolveReport report = ivy.resolve(new File("test/repositories/IVY-84/tests/1/ivy.xml"), getResolveOptions(new String[] { "*" }));
    ConfigurationResolveReport conf = report.getConfigurationReport("default");
    assertContainsArtifact("test", "a", "1.0.2", "a", "txt", "txt", conf);
    assertDoesntContainArtifact("test", "a", "1.0.2", "a-bt", "txt", "txt", conf);
    assertContainsArtifact("test", "b", "1.0.2", "b", "txt", "txt", conf);
    assertDoesntContainArtifact("test", "b", "1.0.2", "b-bt", "txt", "txt", conf);
    assertContainsArtifact("test", "c", "1.0.2", "c", "txt", "txt", conf);
    assertDoesntContainArtifact("test", "c", "1.0.2", "c-bt", "txt", "txt", conf);
}
Also used : ConfigurationResolveReport(org.apache.ivy.core.report.ConfigurationResolveReport) ResolveReport(org.apache.ivy.core.report.ResolveReport) ConfigurationResolveReport(org.apache.ivy.core.report.ConfigurationResolveReport) Ivy(org.apache.ivy.Ivy) JarFile(java.util.jar.JarFile) File(java.io.File) Test(org.junit.Test)

Aggregations

ConfigurationResolveReport (org.apache.ivy.core.report.ConfigurationResolveReport)45 ResolveReport (org.apache.ivy.core.report.ResolveReport)43 File (java.io.File)40 Test (org.junit.Test)40 JarFile (java.util.jar.JarFile)34 ModuleRevisionId (org.apache.ivy.core.module.id.ModuleRevisionId)27 Ivy (org.apache.ivy.Ivy)16 ModuleDescriptor (org.apache.ivy.core.module.descriptor.ModuleDescriptor)12 SAXParser (javax.xml.parsers.SAXParser)4 Attributes (org.xml.sax.Attributes)4 DefaultHandler (org.xml.sax.helpers.DefaultHandler)4 HashMap (java.util.HashMap)3 ArtifactDownloadReport (org.apache.ivy.core.report.ArtifactDownloadReport)3 ArrayList (java.util.ArrayList)2 LinkedHashSet (java.util.LinkedHashSet)2 ParseException (java.text.ParseException)1 Date (java.util.Date)1 IvyContext (org.apache.ivy.core.IvyContext)1 ResolutionCacheManager (org.apache.ivy.core.cache.ResolutionCacheManager)1 EndResolveEvent (org.apache.ivy.core.event.resolve.EndResolveEvent)1