Search in sources :

Example 1 with AggregatedOSGiResolver

use of org.apache.ivy.osgi.repo.AggregatedOSGiResolver 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

File (java.io.File)1 Ivy (org.apache.ivy.Ivy)1 RepositoryCacheManager (org.apache.ivy.core.cache.RepositoryCacheManager)1 ResolveData (org.apache.ivy.core.resolve.ResolveData)1 ResolveOptions (org.apache.ivy.core.resolve.ResolveOptions)1 IvySettings (org.apache.ivy.core.settings.IvySettings)1 OBRResolver (org.apache.ivy.osgi.obr.OBRResolver)1 AggregatedOSGiResolver (org.apache.ivy.osgi.repo.AggregatedOSGiResolver)1 UpdateSiteResolver (org.apache.ivy.osgi.updatesite.UpdateSiteResolver)1 Before (org.junit.Before)1