use of org.apache.ivy.plugins.repository.BasicResource in project ant-ivy by apache.
the class XmlModuleUpdaterTest method testUpdateWithComments.
@Test
public void testUpdateWithComments() throws Exception {
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
URL settingsUrl = new File("test/java/org/apache/ivy/plugins/parser/xml/" + "test-with-comments.xml").toURI().toURL();
XmlModuleDescriptorUpdater.update(settingsUrl, new BufferedOutputStream(buffer, 1024), getUpdateOptions("release", "mynewrev"));
XmlModuleDescriptorParser parser = XmlModuleDescriptorParser.getInstance();
ModuleDescriptor updatedMd = parser.parseDescriptor(new IvySettings(), new ByteArrayInputStream(buffer.toByteArray()), new BasicResource("test", false, 0, 0, false), true);
DependencyDescriptor[] dependencies = updatedMd.getDependencies();
assertNotNull(dependencies);
assertEquals(3, dependencies.length);
}
use of org.apache.ivy.plugins.repository.BasicResource in project ant-ivy by apache.
the class XmlModuleUpdaterTest method testMergedUpdateWithIncludeAndExcludedConf.
/**
* Test case for IVY-1419.
*
* @throws Exception if something goes wrong
* @see <a href="https://issues.apache.org/jira/browse/IVY-1419">IVY-1419</a>
*/
@Test
public void testMergedUpdateWithIncludeAndExcludedConf() throws Exception {
URL url = XmlModuleUpdaterTest.class.getResource("test-update-excludedconfs6.xml");
XmlModuleDescriptorParser parser = XmlModuleDescriptorParser.getInstance();
ModuleDescriptor md = parser.parseDescriptor(new IvySettings(), url, true);
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
XmlModuleDescriptorUpdater.update(url, buffer, getUpdateOptions("release", "mynewrev").setMerge(true).setMergedDescriptor(md).setConfsToExclude(new String[] { "conf1" }));
ModuleDescriptor updatedMd = parser.parseDescriptor(new IvySettings(), new ByteArrayInputStream(buffer.toByteArray()), new BasicResource("test", false, 0, 0, false), true);
Configuration[] configurations = updatedMd.getConfigurations();
assertNotNull("Configurations shouldn't be null", configurations);
assertEquals("Number of configurations is incorrect", 5, configurations.length);
String updatedXml = buffer.toString();
System.out.println(updatedXml);
assertTrue(updatedXml.contains("dependencies/"));
}
Aggregations