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);
}
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);
}
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());
}
}
}
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;
}
}
}
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);
}
Aggregations