use of org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor in project ant-ivy by apache.
the class IvyRepResolverTest method testIvyRepWithLocalURL.
@Test
public void testIvyRepWithLocalURL() throws Exception {
IvyRepResolver resolver = new IvyRepResolver();
String rootpath = new File("test/repositories/1").getAbsolutePath();
resolver.setName("testLocal");
resolver.setIvyroot("file:" + rootpath);
resolver.setIvypattern("[organisation]/[module]/ivys/ivy-[revision].xml");
resolver.setArtroot("file:" + rootpath);
resolver.setArtpattern("[organisation]/[module]/jars/[artifact]-[revision].[ext]");
resolver.setSettings(settings);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org1", "mod1.1", "1.0");
ResolvedModuleRevision rmr = resolver.getDependency(new DefaultDependencyDescriptor(mrid, false), data);
assertNotNull(rmr);
DefaultArtifact artifact = new DefaultArtifact(mrid, rmr.getPublicationDate(), "mod1.1", "jar", "jar");
DownloadReport report = resolver.download(new Artifact[] { artifact }, downloadOptions());
assertNotNull(report);
assertEquals(1, report.getArtifactsReports().length);
ArtifactDownloadReport ar = report.getArtifactReport(artifact);
assertNotNull(ar);
assertEquals(artifact, ar.getArtifact());
assertEquals(DownloadStatus.SUCCESSFUL, ar.getDownloadStatus());
// test to ask to download again, should use cache
report = resolver.download(new Artifact[] { artifact }, downloadOptions());
assertNotNull(report);
assertEquals(1, report.getArtifactsReports().length);
ar = report.getArtifactReport(artifact);
assertNotNull(ar);
assertEquals(artifact, ar.getArtifact());
assertEquals(DownloadStatus.NO, ar.getDownloadStatus());
}
use of org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor in project ant-ivy by apache.
the class JarResolverTest method testUrl.
@Test
public void testUrl() throws Exception {
JarResolver resolver = new JarResolver();
resolver.setName("jarresolver1");
resolver.setUrl(new File("test/jar-repos/jarrepo1.jar").toURI().toURL().toExternalForm());
resolver.addIvyPattern("[organisation]/[module]/ivys/ivy-[revision].xml");
resolver.addArtifactPattern("[organisation]/[module]/[type]s/[artifact]-[revision].[type]");
resolver.setSettings(settings);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org1", "mod1.1", "1.0");
ResolvedModuleRevision rmr = resolver.getDependency(new DefaultDependencyDescriptor(mrid, false), data);
assertNotNull(rmr);
}
use of org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor in project ant-ivy by apache.
the class JarResolverTest method testSimpleFile.
@Test
public void testSimpleFile() throws Exception {
JarResolver resolver = new JarResolver();
resolver.setName("jarresolver1");
resolver.setFile(new File("test/jar-repos/jarrepo1.jar").getAbsolutePath());
resolver.addIvyPattern("[organisation]/[module]/ivys/ivy-[revision].xml");
resolver.addArtifactPattern("[organisation]/[module]/[type]s/[artifact]-[revision].[type]");
resolver.setSettings(settings);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org1", "mod1.1", "1.0");
ResolvedModuleRevision rmr = resolver.getDependency(new DefaultDependencyDescriptor(mrid, false), data);
assertNotNull(rmr);
}
use of org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor in project ant-ivy by apache.
the class Maven2LocalTest method testUseMetadataForListing.
@Test
public void testUseMetadataForListing() throws Exception {
IBiblioResolver resolver = maven2Resolver();
ResolvedModuleRevision m = resolver.getDependency(new DefaultDependencyDescriptor(ModuleRevisionId.newInstance("org.apache", "test-metadata", "latest.integration"), false), data);
assertNotNull(m);
// should trust the metadata (latest=1.1) instead of listing revisions (latest=1.2)
assertEquals(ModuleRevisionId.newInstance("org.apache", "test-metadata", "1.1"), m.getId());
}
use of org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor in project ant-ivy by apache.
the class Maven2LocalTest method testNotUseMetadataForListing.
@Test
public void testNotUseMetadataForListing() throws Exception {
IBiblioResolver resolver = maven2Resolver();
resolver.setUseMavenMetadata(false);
ResolvedModuleRevision m = resolver.getDependency(new DefaultDependencyDescriptor(ModuleRevisionId.newInstance("org.apache", "test-metadata", "latest.integration"), false), data);
assertNotNull(m);
// should trust listing revisions (latest=1.2) instead of the metadata (latest=1.1)
assertEquals(ModuleRevisionId.newInstance("org.apache", "test-metadata", "1.2"), m.getId());
}
Aggregations