use of org.apache.ivy.core.module.descriptor.ModuleDescriptor in project ant-ivy by apache.
the class RetrieveTest method testRetrieveWithSymlinksMass.
/**
* This test is here to just test the deprecated {@code symlinkmass} option for retrieve task.
* A version or two down the line, after 2.5 release, we can remove this test and the option
* altogether.
*
* @throws Exception if something goes wrong
*/
@SuppressWarnings("deprecation")
@Test
public void testRetrieveWithSymlinksMass() throws Exception {
// mod1.1 depends on mod1.2
ResolveReport report = ivy.resolve(new File("test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml").toURI().toURL(), getResolveOptions(new String[] { "*" }));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
String pattern = "build/test/retrieve/[module]/[conf]/[artifact]-[revision].[ext]";
ivy.retrieve(md.getModuleRevisionId(), getRetrieveOptions().setMakeSymlinksInMass(true).setDestArtifactPattern(pattern));
assertLinkOrExists(IvyPatternHelper.substitute(pattern, "org1", "mod1.2", "2.0", "mod1.2", "jar", "jar", "default"));
pattern = "build/test/retrieve/[module]/[conf]/[type]s/[artifact]-[revision].[ext]";
ivy.retrieve(md.getModuleRevisionId(), getRetrieveOptions().setMakeSymlinksInMass(true).setDestArtifactPattern(pattern));
assertLinkOrExists(IvyPatternHelper.substitute(pattern, "org1", "mod1.2", "2.0", "mod1.2", "jar", "jar", "default"));
}
use of org.apache.ivy.core.module.descriptor.ModuleDescriptor in project ant-ivy by apache.
the class RetrieveTest method testUnpack.
@Test
public void testUnpack() throws Exception {
ResolveOptions roptions = getResolveOptions(new String[] { "*" });
URL url = new File("test/repositories/1/packaging/module1/ivys/ivy-1.0.xml").toURI().toURL();
// normal resolve, the file goes in the cache
ResolveReport report = ivy.resolve(url, roptions);
assertFalse(report.hasError());
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
String pattern = "build/test/retrieve/[organization]/[module]/[conf]/[type]s/[artifact]-[revision](.[ext])";
ivy.retrieve(md.getModuleRevisionId(), getRetrieveOptions().setDestArtifactPattern(pattern));
File dest = new File("build/test/retrieve/packaging/module2/default/jars/module2-1.0");
assertTrue(dest.exists());
assertTrue(dest.isDirectory());
File[] jarContents = dest.listFiles();
Arrays.sort(jarContents);
assertEquals(new File(dest, "META-INF"), jarContents[0]);
assertEquals(new File(dest, "test.txt"), jarContents[1]);
assertEquals(new File(dest, "META-INF/MANIFEST.MF"), jarContents[0].listFiles()[0]);
}
use of org.apache.ivy.core.module.descriptor.ModuleDescriptor in project ant-ivy by apache.
the class RetrieveTest method testUnpackSync.
@Test
public void testUnpackSync() throws Exception {
ResolveOptions roptions = getResolveOptions(new String[] { "*" });
URL url = new File("test/repositories/1/packaging/module1/ivys/ivy-1.0.xml").toURI().toURL();
// normal resolve, the file goes in the cache
ResolveReport report = ivy.resolve(url, roptions);
assertFalse(report.hasError());
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
String pattern = "build/test/retrieve/[organization]/[module]/[conf]/[type]s/[artifact]-[revision](.[ext])";
ivy.retrieve(md.getModuleRevisionId(), getRetrieveOptions().setSync(true).setDestArtifactPattern(pattern));
File dest = new File("build/test/retrieve/packaging/module2/default/jars/module2-1.0");
assertTrue(dest.exists());
assertTrue(dest.isDirectory());
File[] jarContents = dest.listFiles();
Arrays.sort(jarContents);
assertEquals(new File(dest, "META-INF"), jarContents[0]);
assertEquals(new File(dest, "test.txt"), jarContents[1]);
assertEquals(new File(dest, "META-INF/MANIFEST.MF"), jarContents[0].listFiles()[0]);
}
use of org.apache.ivy.core.module.descriptor.ModuleDescriptor in project ant-ivy by apache.
the class PomModuleDescriptorParserTest method testOverriddenLicense.
/**
* Tests that if a project explicitly specifies the licenses, then the licenses (if any) from
* its parent pom aren't applied to the child project
*
* @throws Exception if something goes wrong
*/
@Test
public void testOverriddenLicense() throws Exception {
final IvySettings customIvySettings = createIvySettingsForParentLicenseTesting("test-parent-with-licenses.pom", "org.apache", "test-ivy-license-parent");
final String pomFile = "test-project-with-overridden-licenses.pom";
final ModuleDescriptor childModule = PomModuleDescriptorParser.getInstance().parseDescriptor(customIvySettings, this.getClass().getResource(pomFile), false);
assertNotNull("Could not find " + pomFile, pomFile);
final License[] licenses = childModule.getLicenses();
assertNotNull("No licenses found in the module " + childModule, licenses);
assertEquals("Unexpected number of licenses found in the module " + childModule, 1, licenses.length);
assertEquals("Unexpected license name", "The Apache Software License, Version 2.0", licenses[0].getName());
assertEquals("Unexpected license URL", "http://www.apache.org/licenses/LICENSE-2.0.txt", licenses[0].getUrl());
}
use of org.apache.ivy.core.module.descriptor.ModuleDescriptor in project ant-ivy by apache.
the class PomModuleDescriptorParserTest method testLargePom.
@Test
public void testLargePom() throws Exception {
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings, getClass().getResource("test-large-pom.pom"), false);
assertNotNull(md);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org.apache.myfaces", "myfaces", "6");
assertEquals(mrid, md.getModuleRevisionId());
}
Aggregations