use of org.apache.ivy.core.module.descriptor.DependencyDescriptor in project ant-ivy by apache.
the class PomModuleDescriptorParserTest method testDependenciesWithType.
@Test
public void testDependenciesWithType() throws Exception {
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings, getClass().getResource("test-dependencies-with-type.pom"), true);
assertNotNull(md);
assertEquals(ModuleRevisionId.newInstance("org.apache", "test", "1.0"), md.getModuleRevisionId());
DependencyDescriptor[] dds = md.getDependencies();
assertNotNull(dds);
assertEquals(1, dds.length);
assertEquals(ModuleRevisionId.newInstance("commons-logging", "commons-logging", "1.0.4"), dds[0].getDependencyRevisionId());
assertEquals(1, dds[0].getAllDependencyArtifacts().length);
assertEquals("dll", dds[0].getAllDependencyArtifacts()[0].getExt());
assertEquals("dll", dds[0].getAllDependencyArtifacts()[0].getType());
}
use of org.apache.ivy.core.module.descriptor.DependencyDescriptor in project ant-ivy by apache.
the class PomModuleDescriptorParserTest method testParentProperties.
@Test
public void testParentProperties() 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-version.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-parent-properties.pom"), false);
assertNotNull(md);
assertEquals("1.0", md.getRevision());
DependencyDescriptor[] dds = md.getDependencies();
assertNotNull(dds);
assertEquals(3, dds.length);
// 2 are inherited from parent. Only the first one is important for this test
assertEquals(ModuleRevisionId.newInstance("org.apache", "test-version-other", "5.76"), dds[0].getDependencyRevisionId());
// present in the pom using a property defined in the parent
}
use of org.apache.ivy.core.module.descriptor.DependencyDescriptor in project ant-ivy by apache.
the class PomModuleDescriptorParserTest method testDependenciesWithInactiveProfile.
/**
* Test case for IVY-392.
*
* @throws Exception if something goes wrong
* @see <a href="https://issues.apache.org/jira/browse/IVY-392">IVY-392</a>
*/
@Test
public void testDependenciesWithInactiveProfile() throws Exception {
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings, getClass().getResource("test-dependencies-with-profile.pom"), false);
assertNotNull(md);
assertEquals(ModuleRevisionId.newInstance("org.apache", "test", "1.0"), md.getModuleRevisionId());
DependencyDescriptor[] dds = md.getDependencies();
assertNotNull(dds);
assertEquals(1, dds.length);
assertEquals(ModuleRevisionId.newInstance("commons-logging", "commons-logging", "1.0.4"), dds[0].getDependencyRevisionId());
}
use of org.apache.ivy.core.module.descriptor.DependencyDescriptor in project ant-ivy by apache.
the class PomModuleDescriptorParserTest method testOptional.
@Test
public void testOptional() throws Exception {
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings, getClass().getResource("test-optional.pom"), false);
assertNotNull(md);
assertEquals(ModuleRevisionId.newInstance("org.apache", "test", "1.0"), md.getModuleRevisionId());
assertTrue(Arrays.asList(md.getConfigurationsNames()).contains("optional"));
DependencyDescriptor[] dds = md.getDependencies();
assertNotNull(dds);
assertEquals(3, dds.length);
assertEquals(ModuleRevisionId.newInstance("commons-logging", "commons-logging", "1.0.4"), dds[0].getDependencyRevisionId());
assertEquals(new HashSet<>(Collections.singletonList("optional")), new HashSet<>(Arrays.asList(dds[0].getModuleConfigurations())));
// I don't know what it should be. Ivy has no notion of optional dependencies
// assertEquals(new HashSet<>(Arrays.asList("compile(*)", "runtime(*)", "master(*)")),
// new HashSet<>(Arrays.asList(dds[0].getDependencyConfigurations("optional"))));
assertEquals(ModuleRevisionId.newInstance("cglib", "cglib", "2.0.2"), dds[1].getDependencyRevisionId());
assertEquals(new HashSet<>(Arrays.asList("compile", "runtime")), new HashSet<>(Arrays.asList(dds[1].getModuleConfigurations())));
assertEquals(new HashSet<>(Arrays.asList("master(*)", "compile(*)")), new HashSet<>(Arrays.asList(dds[1].getDependencyConfigurations("compile"))));
assertEquals(new HashSet<>(Collections.singletonList("runtime(*)")), new HashSet<>(Arrays.asList(dds[1].getDependencyConfigurations("runtime"))));
assertEquals(ModuleRevisionId.newInstance("cglib", "cglib-extra", "2.0.2"), dds[2].getDependencyRevisionId());
assertEquals(new HashSet<>(Arrays.asList("compile", "runtime")), new HashSet<>(Arrays.asList(dds[2].getModuleConfigurations())));
assertEquals(new HashSet<>(Arrays.asList("master(*)", "compile(*)")), new HashSet<>(Arrays.asList(dds[2].getDependencyConfigurations("compile"))));
assertEquals(new HashSet<>(Collections.singletonList("runtime(*)")), new HashSet<>(Arrays.asList(dds[2].getDependencyConfigurations("runtime"))));
}
use of org.apache.ivy.core.module.descriptor.DependencyDescriptor in project ant-ivy by apache.
the class PomModuleDescriptorParserTest method testProperties.
@Test
public void testProperties() throws Exception {
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings, getClass().getResource("test-properties.pom"), false);
assertNotNull(md);
assertEquals(ModuleRevisionId.newInstance("drools", "drools-smf", "2.0-beta-18"), md.getModuleRevisionId());
DependencyDescriptor[] dds = md.getDependencies();
assertNotNull(dds);
assertEquals(1, dds.length);
assertEquals(ModuleRevisionId.newInstance("drools", "drools-core", "2.0-beta-18"), dds[0].getDependencyRevisionId());
}
Aggregations