Last active
August 29, 2015 14:04
-
-
Save eiswind/319657c3f7835a023a0d to your computer and use it in GitHub Desktop.
Taken from the Ivy Tests: Downloading p2 artifacts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Taken from the Ivy Tests: Downloading p2 artifacts | |
settings = new IvySettings(); | |
p2SourceResolver = new UpdateSiteResolver(); | |
p2SourceResolver.setName("p2-sources"); | |
p2SourceResolver.setUrl(new File("test/test-p2/sources").toURI().toURL().toExternalForm()); | |
p2SourceResolver.setSettings(settings); | |
settings.addResolver(p2SourceResolver); | |
cache = new File("build/cache"); | |
cache.mkdirs(); | |
settings.setDefaultCache(cache); | |
ivy = new Ivy(); | |
ivy.setSettings(settings); | |
ivy.bind(); | |
ivy.getResolutionCacheManager().clean(); | |
RepositoryCacheManager[] caches = settings.getRepositoryCacheManagers(); | |
for (int i = 0; i < caches.length; i++) { | |
caches[i].clean(); | |
} | |
data = new ResolveData(ivy.getResolveEngine(), new ResolveOptions()); | |
settings.setDefaultResolver("p2-sources"); | |
ModuleRevisionId mrid = ModuleRevisionId.newInstance(BundleInfo.BUNDLE_TYPE, | |
"org.apache.ivy", "2.2.0.final_20100923230623"); | |
ResolvedModuleRevision rmr = p2SourceResolver.getDependency( | |
new DefaultDependencyDescriptor(mrid, false), data); | |
assertNotNull(rmr); | |
assertEquals(mrid, rmr.getId()); | |
assertEquals(2, rmr.getDescriptor().getAllArtifacts().length); | |
DownloadReport report = p2SourceResolver.download(rmr.getDescriptor().getAllArtifacts(), | |
new DownloadOptions()); | |
assertNotNull(report); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment