use of org.apache.ivy.core.resolve.ResolvedModuleRevision in project ant-ivy by apache.
the class FileSystemResolverTest method testLatestTime.
@Test
public void testLatestTime() throws Exception {
FileSystemResolver resolver = new FileSystemResolver();
resolver.setName("test");
resolver.setSettings(settings);
assertEquals("test", resolver.getName());
resolver.addIvyPattern(IVY_PATTERN);
resolver.addArtifactPattern(settings.getBaseDir() + "/test/repositories/1/" + "[organisation]/[module]/[type]s/[artifact]-[revision].[type]");
resolver.setLatestStrategy(new LatestTimeStrategy());
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org1", "mod1.1", "2.0");
ResolvedModuleRevision rmr = resolver.getDependency(new DefaultDependencyDescriptor(ModuleRevisionId.newInstance("org1", "mod1.1", "latest.integration"), false), data);
assertNotNull(rmr);
assertEquals(mrid, rmr.getId());
Date pubdate = new GregorianCalendar(2005, 1, 15, 11, 0, 0).getTime();
assertEquals(pubdate, rmr.getPublicationDate());
}
use of org.apache.ivy.core.resolve.ResolvedModuleRevision 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.resolve.ResolvedModuleRevision 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.resolve.ResolvedModuleRevision 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.resolve.ResolvedModuleRevision 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());
}
Aggregations