Search in sources :

Example 36 with DependencyResolver

use of org.apache.ivy.plugins.resolver.DependencyResolver in project ant-ivy by apache.

the class ConfigureTest method testTypedefWithCustomClasspathWithFile.

@Test
public void testTypedefWithCustomClasspathWithFile() throws Exception {
    Ivy ivy = new Ivy();
    ivy.setVariable("ivy.custom.test.dir", new File("test/java/org/apache/ivy/core/settings").getAbsolutePath());
    ivy.configure(ConfigureTest.class.getResource("ivysettings-custom-typedef2.xml"));
    DependencyResolver custom = ivy.getSettings().getResolver("custom");
    assertNotNull(custom);
    assertEquals("org.apache.ivy.plugins.resolver.CustomResolver", custom.getClass().getName());
}
Also used : Ivy(org.apache.ivy.Ivy) File(java.io.File) DependencyResolver(org.apache.ivy.plugins.resolver.DependencyResolver) Test(org.junit.Test)

Example 37 with DependencyResolver

use of org.apache.ivy.plugins.resolver.DependencyResolver in project ant-ivy by apache.

the class IvySettingsTest method testChangeDefaultResolver.

@Test
public void testChangeDefaultResolver() throws ParseException, IOException {
    Ivy ivy = new Ivy();
    ivy.configureDefault();
    IvySettings settings = ivy.getSettings();
    DependencyResolver defaultResolver = settings.getDefaultResolver();
    assertNotNull(defaultResolver);
    assertEquals("default", defaultResolver.getName());
    assertSame("default resolver cached", defaultResolver, settings.getDefaultResolver());
    settings.setDefaultResolver("public");
    DependencyResolver newDefault = settings.getDefaultResolver();
    assertNotNull(newDefault);
    assertNotSame("default resolver has changed", defaultResolver, newDefault);
    assertEquals("resolver changed successfully", "public", newDefault.getName());
}
Also used : Ivy(org.apache.ivy.Ivy) DependencyResolver(org.apache.ivy.plugins.resolver.DependencyResolver) Test(org.junit.Test)

Example 38 with DependencyResolver

use of org.apache.ivy.plugins.resolver.DependencyResolver in project ant-ivy by apache.

the class OnlineXmlSettingsParserTest method testIncludeHttpRelativeUrl.

@Test
public void testIncludeHttpRelativeUrl() throws Exception {
    // Use a settings file via http that use an include with relative url
    configureURLHandler();
    IvySettings settings = new IvySettings();
    XmlSettingsParser parser = new XmlSettingsParser(settings);
    parser.parse(new URL("http://ant.apache.org/ivy/test/ivysettings-include-http-relative-url.xml"));
    DependencyResolver resolver = settings.getResolver("ivyrep");
    assertNotNull(resolver);
    assertTrue(resolver instanceof IvyRepResolver);
}
Also used : URL(java.net.URL) DependencyResolver(org.apache.ivy.plugins.resolver.DependencyResolver) IvyRepResolver(org.apache.ivy.plugins.resolver.IvyRepResolver) Test(org.junit.Test)

Example 39 with DependencyResolver

use of org.apache.ivy.plugins.resolver.DependencyResolver in project ant-ivy by apache.

the class OnlineXmlSettingsParserTest method testIncludeHttpAbsoluteFile.

@Test
public void testIncludeHttpAbsoluteFile() throws Exception {
    // Use a settings file via http that use an include with absolute file
    // WARNING : this test will only work if the test are launched from the project root
    // directory
    configureURLHandler();
    IvySettings settings = new IvySettings();
    XmlSettingsParser parser = new XmlSettingsParser(settings);
    parser.parse(new URL("http://ant.apache.org/ivy/test/ivysettings-include-http-absolute-file.xml"));
    DependencyResolver inc = settings.getResolver("includeworks");
    assertNotNull(inc);
    assertTrue(inc instanceof ChainResolver);
}
Also used : ChainResolver(org.apache.ivy.plugins.resolver.ChainResolver) URL(java.net.URL) DependencyResolver(org.apache.ivy.plugins.resolver.DependencyResolver) Test(org.junit.Test)

Example 40 with DependencyResolver

use of org.apache.ivy.plugins.resolver.DependencyResolver in project ant-ivy by apache.

the class OnlineXmlSettingsParserTest method testIncludeHttpRelativeFile.

@Test
public void testIncludeHttpRelativeFile() throws Exception {
    // Use a settings file via http that use an include with relative file
    configureURLHandler();
    IvySettings settings = new IvySettings();
    XmlSettingsParser parser = new XmlSettingsParser(settings);
    parser.parse(new URL("http://ant.apache.org/ivy/test/ivysettings-include-http-relative-file.xml"));
    DependencyResolver resolver = settings.getResolver("ivyrep");
    assertNotNull(resolver);
    assertTrue(resolver instanceof IvyRepResolver);
}
Also used : URL(java.net.URL) DependencyResolver(org.apache.ivy.plugins.resolver.DependencyResolver) IvyRepResolver(org.apache.ivy.plugins.resolver.IvyRepResolver) Test(org.junit.Test)

Aggregations

DependencyResolver (org.apache.ivy.plugins.resolver.DependencyResolver)50 Test (org.junit.Test)23 ModuleDescriptorParserRegistryTest (org.apache.ivy.plugins.parser.ModuleDescriptorParserRegistryTest)11 ChainResolver (org.apache.ivy.plugins.resolver.ChainResolver)11 File (java.io.File)10 Ivy (org.apache.ivy.Ivy)9 HashMap (java.util.HashMap)8 ModuleRevisionId (org.apache.ivy.core.module.id.ModuleRevisionId)8 URL (java.net.URL)7 HashSet (java.util.HashSet)7 Map (java.util.Map)7 LinkedHashSet (java.util.LinkedHashSet)6 ModuleDescriptor (org.apache.ivy.core.module.descriptor.ModuleDescriptor)6 IvySettings (org.apache.ivy.core.settings.IvySettings)6 FileSystemResolver (org.apache.ivy.plugins.resolver.FileSystemResolver)6 ParseException (java.text.ParseException)5 DependencyDescriptor (org.apache.ivy.core.module.descriptor.DependencyDescriptor)5 IvyRepResolver (org.apache.ivy.plugins.resolver.IvyRepResolver)5 DefaultDependencyDescriptor (org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor)4 ModuleId (org.apache.ivy.core.module.id.ModuleId)4