use of org.apache.ivy.core.module.descriptor.ModuleDescriptor in project ant-ivy by apache.
the class PomModuleDescriptorParserTest method testReal2.
@Test
public void testReal2() throws Exception {
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings, getClass().getResource("wicket-1.3-incubating-SNAPSHOT.pom"), false);
assertNotNull(md);
assertEquals(ModuleRevisionId.newInstance("org.apache.wicket", "wicket", "1.3-incubating-SNAPSHOT"), md.getModuleRevisionId());
}
use of org.apache.ivy.core.module.descriptor.ModuleDescriptor in project ant-ivy by apache.
the class PomModuleDescriptorParserTest method testIVY424.
/**
* Test case for IVY-424.
*
* @throws Exception if something goes wrong
* @see <a href="https://issues.apache.org/jira/browse/IVY-424">IVY-424</a>
*/
@Test
public void testIVY424() throws Exception {
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings, getClass().getResource("shale-tiger-1.1.0-SNAPSHOT.pom"), false);
assertNotNull(md);
assertEquals(ModuleRevisionId.newInstance("org.apache.shale", "shale-tiger", "1.1.0-SNAPSHOT"), md.getModuleRevisionId());
}
use of org.apache.ivy.core.module.descriptor.ModuleDescriptor in project ant-ivy by apache.
the class PomModuleDescriptorParserTest method testParent.
@Test
public void testParent() throws Exception {
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings, getClass().getResource("test-parent.pom"), false);
assertNotNull(md);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org.apache", "test", "1.0");
assertEquals(mrid, md.getModuleRevisionId());
Artifact[] artifact = md.getArtifacts("master");
assertEquals(1, artifact.length);
assertEquals(mrid, artifact[0].getModuleRevisionId());
assertEquals("test", artifact[0].getName());
}
use of org.apache.ivy.core.module.descriptor.ModuleDescriptor in project ant-ivy by apache.
the class PomModuleDescriptorParserTest method testOverrideParentVersionPropertyDependencyMgt.
@Test
public void testOverrideParentVersionPropertyDependencyMgt() throws ParseException, IOException {
settings.setDictatorResolver(new MockResolver() {
public ResolvedModuleRevision getDependency(DependencyDescriptor dd, ResolveData data) throws ParseException {
try {
ModuleDescriptor moduleDescriptor = PomModuleDescriptorParser.getInstance().parseDescriptor(settings, getClass().getResource("test-versionPropertyDependencyMgt.pom"), false);
return new ResolvedModuleRevision(null, null, moduleDescriptor, null);
} catch (IOException e) {
throw new AssertionError(e);
}
}
});
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings, getClass().getResource("test-overrideParentVersionPropertyDependencyMgt.pom"), false);
assertNotNull(md);
assertEquals(ModuleRevisionId.newInstance("org.apache", "test-parentdep", "1.0"), md.getModuleRevisionId());
DependencyDescriptor[] dds = md.getDependencies();
assertNotNull(dds);
assertEquals(2, dds.length);
assertEquals(ModuleRevisionId.newInstance("commons-collections", "commons-collections", "3.2.1"), dds[0].getDependencyRevisionId());
assertEquals(ModuleRevisionId.newInstance("commons-logging", "commons-logging", "1.1.1"), dds[1].getDependencyRevisionId());
ExcludeRule[] excludes = dds[0].getAllExcludeRules();
assertNotNull(excludes);
assertEquals(2, excludes.length);
assertEquals("javax.mail", excludes[0].getId().getModuleId().getOrganisation());
assertEquals("mail", excludes[0].getId().getModuleId().getName());
assertEquals("javax.jms", excludes[1].getId().getModuleId().getOrganisation());
assertEquals("jms", excludes[1].getId().getModuleId().getName());
}
use of org.apache.ivy.core.module.descriptor.ModuleDescriptor in project ant-ivy by apache.
the class PomModuleDescriptorParserTest method testGrandparentBomImport.
@Test
public void testGrandparentBomImport() throws ParseException, IOException {
settings.setDictatorResolver(new MockResolver() {
public ResolvedModuleRevision getDependency(DependencyDescriptor dd, ResolveData data) throws ParseException {
try {
ModuleDescriptor moduleDescriptor = PomModuleDescriptorParser.getInstance().parseDescriptor(settings, getClass().getResource(String.format("depmgt/%s.pom", dd.getDependencyId().getName())), false);
return new ResolvedModuleRevision(null, null, moduleDescriptor, null);
} catch (IOException e) {
throw new AssertionError(e);
}
}
});
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings, getClass().getResource("depmgt/grandchild.pom"), false);
assertNotNull(md);
assertEquals("1.0", md.getRevision());
DependencyDescriptor[] dds = md.getDependencies();
assertNotNull(dds);
assertEquals(2, dds.length);
assertEquals(ModuleRevisionId.newInstance("commons-collection", "commons-collection", "1.0.5"), dds[0].getDependencyRevisionId());
assertEquals(ModuleRevisionId.newInstance("commons-logging", "commons-logging", "1.0.4"), dds[1].getDependencyRevisionId());
}
Aggregations