use of org.apache.ivy.core.module.descriptor.Configuration in project ant-ivy by apache.
the class XmlModuleDescriptorParserTest method testImportConfigurationsWithExtendOtherConfigs.
@Test
public void testImportConfigurationsWithExtendOtherConfigs() throws Exception {
// import configurations and default mapping
ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(settings, getClass().getResource("test-configextendsothers2.xml"), true);
assertNotNull(md);
// has an 'all-public' configuration
Configuration allPublic = md.getConfiguration("all-public");
assertNotNull(allPublic);
// 'all-public' extends all other public configurations
String[] allPublicExt = allPublic.getExtends();
assertEquals(Arrays.asList("default", "test", "extra"), Arrays.asList(allPublicExt));
}
use of org.apache.ivy.core.module.descriptor.Configuration in project ant-ivy by apache.
the class XmlModuleDescriptorParserTest method testNoArtifact.
@Test
public void testNoArtifact() throws Exception {
ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(settings, getClass().getResource("test-noartifact.xml"), true);
assertNotNull(md);
assertEquals("myorg", md.getModuleRevisionId().getOrganisation());
assertEquals("mymodule", md.getModuleRevisionId().getName());
assertEquals(Ivy.getWorkingRevision(), md.getModuleRevisionId().getRevision());
assertEquals("integration", md.getStatus());
assertNotNull(md.getConfigurations());
assertEquals(Collections.singletonList(new Configuration("default")), Arrays.asList(md.getConfigurations()));
assertNotNull(md.getArtifacts("default"));
assertEquals(0, md.getArtifacts("default").length);
assertNotNull(md.getDependencies());
assertEquals(0, md.getDependencies().length);
}
use of org.apache.ivy.core.module.descriptor.Configuration in project ant-ivy by apache.
the class XmlModuleDescriptorParserTest method testBug60.
@Test
public void testBug60() throws Exception {
ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(settings, getClass().getResource("test-bug60.xml"), true);
assertNotNull(md);
assertEquals("myorg", md.getModuleRevisionId().getOrganisation());
assertEquals("mymodule", md.getModuleRevisionId().getName());
assertEquals("myrev", md.getModuleRevisionId().getRevision());
assertEquals("integration", md.getStatus());
Date pubdate = new GregorianCalendar(2004, 10, 1, 11, 0, 0).getTime();
assertEquals(pubdate, md.getPublicationDate());
assertEquals(Collections.singletonList(new Configuration("default")), Arrays.asList(md.getConfigurations()));
assertArtifacts(md.getArtifacts("default"), new String[] { "myartifact1", "myartifact2" });
}
use of org.apache.ivy.core.module.descriptor.Configuration in project ant-ivy by apache.
the class XmlModuleDescriptorWriterTest method testTransitiveAttributeForNonTransitiveConfs.
/**
* Test that the transitive attribute is written for non-transitive configurations.
*
* <code><conf ... transitive="false" ... /></code>
*
* @throws Exception if something goes wrong
* @see <a href="https://issues.apache.org/jira/browse/IVY-1207">IVY-1207</a>
*/
@Test
public void testTransitiveAttributeForNonTransitiveConfs() throws Exception {
// Given a ModuleDescriptor with a non-transitive configuration
DefaultModuleDescriptor md = new DefaultModuleDescriptor(new ModuleRevisionId(new ModuleId("myorg", "myname"), "1.0"), "integration", new Date());
Configuration conf = new Configuration("conf", PUBLIC, "desc", null, false, null);
md.addConfiguration(conf);
// When the ModuleDescriptor is written
XmlModuleDescriptorWriter.write(md, LICENSE, dest);
// Then the transitive attribute must be set to false
String output = FileUtil.readEntirely(dest);
String writtenConf = output.substring(output.indexOf("<configurations>") + 16, output.indexOf("</configurations>")).trim();
assertTrue("Transitive attribute not set to false: " + writtenConf, writtenConf.contains("transitive=\"false\""));
}
use of org.apache.ivy.core.module.descriptor.Configuration in project ant-ivy by apache.
the class AbstractModuleDescriptorParserTester method assertConf.
protected void assertConf(ModuleDescriptor md, String name, String desc, Visibility visibility, String[] exts) {
Configuration conf = md.getConfiguration(name);
assertNotNull("configuration not found: " + name, conf);
assertEquals(name, conf.getName());
assertEquals(desc, conf.getDescription());
assertEquals(visibility, conf.getVisibility());
assertEquals(Arrays.asList(exts), Arrays.asList(conf.getExtends()));
}
Aggregations