Search in sources :

Example 31 with ResolveData

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

the class MirroredURLResolverTest method setUp.

@Before
public void setUp() throws Exception {
    settings = new IvySettings();
    engine = new ResolveEngine(settings, new EventManager(), new SortEngine(settings));
    data = new ResolveData(engine, new ResolveOptions());
    TestHelper.createCache();
    settings.setDefaultCache(TestHelper.cache);
    settings.setVariable("test.mirroredurl.mirrorlist-solo.url", this.getClass().getResource("mirrorlist-solo.txt").toExternalForm());
    settings.setVariable("test.mirroredurl.mirrorlist-failover.url", this.getClass().getResource("mirrorlist-failover.txt").toExternalForm());
    settings.setVariable("test.mirroredurl.mirrorlist-fail.url", this.getClass().getResource("mirrorlist-fail.txt").toExternalForm());
    new XmlSettingsParser(settings).parse(MirroredURLResolverTest.class.getResource("mirror-resolver-settings.xml"));
}
Also used : ResolveEngine(org.apache.ivy.core.resolve.ResolveEngine) SortEngine(org.apache.ivy.core.sort.SortEngine) ResolveData(org.apache.ivy.core.resolve.ResolveData) EventManager(org.apache.ivy.core.event.EventManager) IvySettings(org.apache.ivy.core.settings.IvySettings) ResolveOptions(org.apache.ivy.core.resolve.ResolveOptions) XmlSettingsParser(org.apache.ivy.core.settings.XmlSettingsParser) Before(org.junit.Before)

Example 32 with ResolveData

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

the class PackagerResolverTest method setUp.

@Before
public void setUp() throws Exception {
    Message.setDefaultLogger(new DefaultMessageLogger(99));
    settings = new IvySettings();
    ResolveEngine engine = new ResolveEngine(settings, new EventManager(), new SortEngine(settings));
    cache = new File("build/cache");
    data = new ResolveData(engine, new ResolveOptions());
    cache.mkdirs();
    settings.setDefaultCache(cache);
    // Create work space with build and resource cache directories
    workdir = new File("build/test/PackagerResolverTest");
    builddir = new File(workdir, "build");
    cachedir = new File(workdir, "resources");
    cleanupTempDirs();
    if (!builddir.mkdirs() || !cachedir.mkdirs()) {
        throw new Exception("can't create directories under " + workdir);
    }
}
Also used : ResolveEngine(org.apache.ivy.core.resolve.ResolveEngine) SortEngine(org.apache.ivy.core.sort.SortEngine) ResolveData(org.apache.ivy.core.resolve.ResolveData) EventManager(org.apache.ivy.core.event.EventManager) DefaultMessageLogger(org.apache.ivy.util.DefaultMessageLogger) IvySettings(org.apache.ivy.core.settings.IvySettings) File(java.io.File) ResolveOptions(org.apache.ivy.core.resolve.ResolveOptions) Before(org.junit.Before)

Example 33 with ResolveData

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

the class PomModuleDescriptorParser method parseOtherPom.

private ResolvedModuleRevision parseOtherPom(ParserSettings ivySettings, ModuleRevisionId parentModRevID) throws ParseException {
    DependencyDescriptor dd = new DefaultDependencyDescriptor(parentModRevID, true);
    ResolveData data = IvyContext.getContext().getResolveData();
    if (data == null) {
        ResolveEngine engine = IvyContext.getContext().getIvy().getResolveEngine();
        ResolveOptions options = new ResolveOptions();
        options.setDownload(false);
        data = new ResolveData(engine, options);
    }
    DependencyResolver resolver = ivySettings.getResolver(parentModRevID);
    if (resolver == null) {
        // TODO: Throw exception here?
        return null;
    }
    dd = toSystem(dd, ivySettings.getContextNamespace());
    return resolver.getDependency(dd, data);
}
Also used : ResolveEngine(org.apache.ivy.core.resolve.ResolveEngine) ResolveData(org.apache.ivy.core.resolve.ResolveData) DependencyDescriptor(org.apache.ivy.core.module.descriptor.DependencyDescriptor) PomDependencyDescriptor(org.apache.ivy.plugins.parser.m2.PomModuleDescriptorBuilder.PomDependencyDescriptor) DefaultDependencyDescriptor(org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor) DefaultDependencyDescriptor(org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor) ResolveOptions(org.apache.ivy.core.resolve.ResolveOptions) DependencyResolver(org.apache.ivy.plugins.resolver.DependencyResolver)

Aggregations

ResolveData (org.apache.ivy.core.resolve.ResolveData)33 ResolveOptions (org.apache.ivy.core.resolve.ResolveOptions)19 IvySettings (org.apache.ivy.core.settings.IvySettings)18 Before (org.junit.Before)16 ResolveEngine (org.apache.ivy.core.resolve.ResolveEngine)14 EventManager (org.apache.ivy.core.event.EventManager)13 SortEngine (org.apache.ivy.core.sort.SortEngine)13 DependencyDescriptor (org.apache.ivy.core.module.descriptor.DependencyDescriptor)11 ResolvedModuleRevision (org.apache.ivy.core.resolve.ResolvedModuleRevision)11 File (java.io.File)10 IOException (java.io.IOException)10 ParseException (java.text.ParseException)10 ModuleDescriptor (org.apache.ivy.core.module.descriptor.ModuleDescriptor)10 DefaultModuleDescriptor (org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor)9 XmlModuleDescriptorParserTest (org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParserTest)8 MockResolver (org.apache.ivy.plugins.resolver.MockResolver)8 Test (org.junit.Test)8 Ivy (org.apache.ivy.Ivy)5 RepositoryCacheManager (org.apache.ivy.core.cache.RepositoryCacheManager)5 ArrayList (java.util.ArrayList)2