Search in sources :

Example 21 with ResolveOptions

use of org.apache.ivy.core.resolve.ResolveOptions in project ant-ivy by apache.

the class OBRResolverTest method setUp.

@Before
public void setUp() throws Exception {
    settings = new IvySettings();
    bundleResolver = new OBRResolver();
    bundleResolver.setRepoXmlFile(new File("test/test-repo/bundlerepo/repo.xml").getAbsolutePath());
    bundleResolver.setName("bundle");
    bundleResolver.setSettings(settings);
    settings.addResolver(bundleResolver);
    bundleUrlResolver = new OBRResolver();
    bundleUrlResolver.setRepoXmlURL(new File("test/test-repo/bundlerepo/repo.xml").toURI().toURL().toExternalForm());
    bundleUrlResolver.setName("bundleurl");
    bundleUrlResolver.setSettings(settings);
    settings.addResolver(bundleUrlResolver);
    dualResolver = new DualResolver();
    OBRResolver resolver = new OBRResolver();
    resolver.setRepoXmlFile(new File("test/test-repo/ivyrepo/repo.xml").getAbsolutePath());
    resolver.setName("dual-bundle");
    resolver.setSettings(settings);
    dualResolver.add(resolver);
    dualResolver.setName("dual");
    File ivyrepo = new File("test/test-repo/ivyrepo");
    FileSystemResolver fileSystemResolver = new FileSystemResolver();
    fileSystemResolver.addIvyPattern(ivyrepo.getAbsolutePath() + "/[organisation]/[module]/[revision]/ivy.xml");
    fileSystemResolver.addArtifactPattern(ivyrepo.getAbsolutePath() + "/[organisation]/[module]/[revision]/[type]s/[artifact]-[revision].[ext]");
    fileSystemResolver.setName("dual-file");
    fileSystemResolver.setSettings(settings);
    dualResolver.add(fileSystemResolver);
    settings.addResolver(dualResolver);
    settings.setDefaultResolver("bundle");
    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 (RepositoryCacheManager cache : caches) {
        cache.clean();
    }
    data = new ResolveData(ivy.getResolveEngine(), new ResolveOptions());
}
Also used : ResolveData(org.apache.ivy.core.resolve.ResolveData) RepositoryCacheManager(org.apache.ivy.core.cache.RepositoryCacheManager) DualResolver(org.apache.ivy.plugins.resolver.DualResolver) IvySettings(org.apache.ivy.core.settings.IvySettings) File(java.io.File) Ivy(org.apache.ivy.Ivy) ResolveOptions(org.apache.ivy.core.resolve.ResolveOptions) FileSystemResolver(org.apache.ivy.plugins.resolver.FileSystemResolver) Before(org.junit.Before)

Example 22 with ResolveOptions

use of org.apache.ivy.core.resolve.ResolveOptions in project ant-ivy by apache.

the class OBRResolverTest method genericTestFailingResolve.

private void genericTestFailingResolve(String jarName, String conf) throws Exception {
    JarInputStream jis = new JarInputStream(new FileInputStream("test/test-repo/bundlerepo/" + jarName));
    Manifest manifest = jis.getManifest();
    jis.close();
    BundleInfo bundleInfo = ManifestParser.parseManifest(manifest);
    bundleInfo.addArtifact(new BundleArtifact(false, new File("test/test-repo/bundlerepo/" + jarName).toURI(), null));
    DefaultModuleDescriptor md = BundleInfoAdapter.toModuleDescriptor(OSGiManifestParser.getInstance(), null, bundleInfo, manifest, profileProvider);
    ResolveReport resolveReport = ivy.resolve(md, new ResolveOptions().setConfs(new String[] { conf }).setOutputReport(false));
    assertTrue(resolveReport.hasError());
}
Also used : ResolveReport(org.apache.ivy.core.report.ResolveReport) BundleInfo(org.apache.ivy.osgi.core.BundleInfo) JarInputStream(java.util.jar.JarInputStream) BundleArtifact(org.apache.ivy.osgi.core.BundleArtifact) Manifest(java.util.jar.Manifest) DefaultModuleDescriptor(org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor) File(java.io.File) ResolveOptions(org.apache.ivy.core.resolve.ResolveOptions) FileInputStream(java.io.FileInputStream)

Example 23 with ResolveOptions

use of org.apache.ivy.core.resolve.ResolveOptions in project ant-ivy by apache.

the class P2DescriptorTest method setUp.

@Before
public void setUp() throws Exception {
    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);
    p2ZippedResolver = new UpdateSiteResolver();
    p2ZippedResolver.setName("p2-zipped");
    p2ZippedResolver.setUrl(new File("test/test-p2/zipped").toURI().toURL().toExternalForm());
    p2ZippedResolver.setSettings(settings);
    settings.addResolver(p2ZippedResolver);
    p2WithPackedResolver = new UpdateSiteResolver();
    p2WithPackedResolver.setName("p2-with-packed");
    p2WithPackedResolver.setUrl(new File("test/test-p2/packed").toURI().toURL().toExternalForm());
    p2WithPackedResolver.setSettings(settings);
    settings.addResolver(p2WithPackedResolver);
    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 (RepositoryCacheManager cache : caches) {
        cache.clean();
    }
    data = new ResolveData(ivy.getResolveEngine(), new ResolveOptions());
}
Also used : ResolveData(org.apache.ivy.core.resolve.ResolveData) RepositoryCacheManager(org.apache.ivy.core.cache.RepositoryCacheManager) IvySettings(org.apache.ivy.core.settings.IvySettings) UpdateSiteResolver(org.apache.ivy.osgi.updatesite.UpdateSiteResolver) File(java.io.File) Ivy(org.apache.ivy.Ivy) ResolveOptions(org.apache.ivy.core.resolve.ResolveOptions) Before(org.junit.Before)

Example 24 with ResolveOptions

use of org.apache.ivy.core.resolve.ResolveOptions in project ant-ivy by apache.

the class UpdateSiteResolverTest method setUp.

@Before
public void setUp() throws Exception {
    settings = new IvySettings();
    resolver = new UpdateSiteResolver();
    resolver.setName("ivyde-repo");
    resolver.setUrl(new File("test/test-p2/ivyde-repo").toURI().toURL().toExternalForm());
    resolver.setSettings(settings);
    settings.addResolver(resolver);
    settings.setDefaultResolver("ivyde-repo");
    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 (RepositoryCacheManager cache : caches) {
        cache.clean();
    }
    data = new ResolveData(ivy.getResolveEngine(), new ResolveOptions());
}
Also used : ResolveData(org.apache.ivy.core.resolve.ResolveData) RepositoryCacheManager(org.apache.ivy.core.cache.RepositoryCacheManager) IvySettings(org.apache.ivy.core.settings.IvySettings) File(java.io.File) Ivy(org.apache.ivy.Ivy) ResolveOptions(org.apache.ivy.core.resolve.ResolveOptions) Before(org.junit.Before)

Example 25 with ResolveOptions

use of org.apache.ivy.core.resolve.ResolveOptions in project ant-ivy by apache.

the class AggregatedOSGiResolverTest method setUp.

@Before
public void setUp() throws Exception {
    settings = new IvySettings();
    OBRResolver bundleResolver = new OBRResolver();
    bundleResolver.setRepoXmlFile(new File("test/test-repo/bundlerepo/repo.xml").getAbsolutePath());
    bundleResolver.setName("bundle");
    bundleResolver.setSettings(settings);
    settings.addResolver(bundleResolver);
    UpdateSiteResolver updatesite = new UpdateSiteResolver();
    updatesite.setUrl(new File("test/test-p2/ivyde-repo").toURI().toURL().toExternalForm());
    updatesite.setName("updatesite");
    updatesite.setSettings(settings);
    settings.addResolver(updatesite);
    OBRResolver repo1 = new OBRResolver();
    repo1.setRepoXmlFile(new File("test/test-repo/multi-osgi/repo1/obr.xml").getAbsolutePath());
    repo1.setName("repo1");
    repo1.setSettings(settings);
    repo1.setRequirementStrategy(RequirementStrategy.noambiguity);
    settings.addResolver(repo1);
    OBRResolver repo2 = new OBRResolver();
    repo2.setRepoXmlFile(new File("test/test-repo/multi-osgi/repo2/obr.xml").getAbsolutePath());
    repo2.setName("repo2");
    repo2.setSettings(settings);
    repo2.setRequirementStrategy(RequirementStrategy.noambiguity);
    settings.addResolver(repo2);
    resolver = new AggregatedOSGiResolver();
    resolver.add(bundleResolver);
    resolver.add(updatesite);
    resolver.add(repo1);
    resolver.add(repo2);
    resolver.setName("multiosgi");
    resolver.setSettings(settings);
    settings.addResolver(resolver);
    settings.setDefaultResolver("multiosgi");
    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 (RepositoryCacheManager cache : caches) {
        cache.clean();
    }
    data = new ResolveData(ivy.getResolveEngine(), new ResolveOptions());
}
Also used : ResolveData(org.apache.ivy.core.resolve.ResolveData) RepositoryCacheManager(org.apache.ivy.core.cache.RepositoryCacheManager) OBRResolver(org.apache.ivy.osgi.obr.OBRResolver) IvySettings(org.apache.ivy.core.settings.IvySettings) UpdateSiteResolver(org.apache.ivy.osgi.updatesite.UpdateSiteResolver) File(java.io.File) AggregatedOSGiResolver(org.apache.ivy.osgi.repo.AggregatedOSGiResolver) Ivy(org.apache.ivy.Ivy) ResolveOptions(org.apache.ivy.core.resolve.ResolveOptions) Before(org.junit.Before)

Aggregations

ResolveOptions (org.apache.ivy.core.resolve.ResolveOptions)36 File (java.io.File)23 IvySettings (org.apache.ivy.core.settings.IvySettings)21 ResolveData (org.apache.ivy.core.resolve.ResolveData)19 Before (org.junit.Before)16 ResolveReport (org.apache.ivy.core.report.ResolveReport)13 ResolveEngine (org.apache.ivy.core.resolve.ResolveEngine)13 EventManager (org.apache.ivy.core.event.EventManager)12 SortEngine (org.apache.ivy.core.sort.SortEngine)12 ModuleDescriptor (org.apache.ivy.core.module.descriptor.ModuleDescriptor)10 IOException (java.io.IOException)7 ParseException (java.text.ParseException)6 Ivy (org.apache.ivy.Ivy)6 DefaultModuleDescriptor (org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor)6 ModuleRevisionId (org.apache.ivy.core.module.id.ModuleRevisionId)6 URL (java.net.URL)5 HashSet (java.util.HashSet)5 RepositoryCacheManager (org.apache.ivy.core.cache.RepositoryCacheManager)5 BuildException (org.apache.tools.ant.BuildException)5 DefaultDependencyDescriptor (org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor)3