Search in sources :

Example 1 with IBiblioResolver

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

the class IvyConfigureTest method testDefault.

@Test
public void testDefault() {
    // by default settings look in the current directory for an ivysettings.xml file...
    // but Ivy itself has one, and we don't want to use it
    configure.getProject().setProperty("ivy.settings.file", "no/settings/will/use/default.xml");
    configure.execute();
    IvySettings settings = getIvyInstance().getSettings();
    assertNotNull(settings.getDefaultResolver());
    DependencyResolver publicResolver = settings.getResolver("public");
    assertNotNull(publicResolver);
    assertTrue(publicResolver instanceof IBiblioResolver);
    IBiblioResolver ibiblio = (IBiblioResolver) publicResolver;
    assertTrue(ibiblio.isM2compatible());
}
Also used : IBiblioResolver(org.apache.ivy.plugins.resolver.IBiblioResolver) IvySettings(org.apache.ivy.core.settings.IvySettings) DependencyResolver(org.apache.ivy.plugins.resolver.DependencyResolver) Test(org.junit.Test)

Example 2 with IBiblioResolver

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

the class XmlSettingsParserTest method testMacroAndRef2.

/**
 * Test case for IVY-860.
 *
 * @throws Exception if something goes wrong
 * @see <a href="https://issues.apache.org/jira/browse/IVY-860">IVY-860</a>
 */
@Test
public void testMacroAndRef2() throws Exception {
    IvySettings settings = new IvySettings();
    XmlSettingsParser parser = new XmlSettingsParser(settings);
    parser.parse(XmlSettingsParserTest.class.getResource("ivysettings-macro+ref2.xml"));
    DependencyResolver macrores = settings.getResolver("macroresolver");
    assertNotNull(macrores);
    assertTrue(macrores instanceof ChainResolver);
    DependencyResolver testResolver = settings.getResolver("test");
    assertNotNull(testResolver);
    assertTrue(testResolver instanceof IBiblioResolver);
    ChainResolver chain = (ChainResolver) macrores;
    List<DependencyResolver> subresolvers = chain.getResolvers();
    assertNotNull(subresolvers);
    assertEquals(1, subresolvers.size());
    assertEquals(testResolver, subresolvers.get(0));
}
Also used : ChainResolver(org.apache.ivy.plugins.resolver.ChainResolver) IBiblioResolver(org.apache.ivy.plugins.resolver.IBiblioResolver) DependencyResolver(org.apache.ivy.plugins.resolver.DependencyResolver) Test(org.junit.Test) ModuleDescriptorParserRegistryTest(org.apache.ivy.plugins.parser.ModuleDescriptorParserRegistryTest)

Example 3 with IBiblioResolver

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

the class UpdateSiteAndIbiblioResolverTest method setUp.

@Before
public void setUp() throws Exception {
    settings = new IvySettings();
    chain = new ChainResolver();
    chain.setName("chain");
    chain.setSettings(settings);
    resolver = new UpdateSiteResolver();
    resolver.setName("ivyde-repo");
    resolver.setUrl(new File("test/test-p2/ivyde-repo").toURI().toURL().toExternalForm());
    resolver.setSettings(settings);
    resolver2 = new IBiblioResolver();
    resolver2.setName("maven2");
    settings.setVariable("ivy.ibiblio.default.artifact.root", DEFAULT_M2_ROOT);
    settings.setVariable("ivy.ibiblio.default.artifact.pattern", "[organisation]/[module]/[revision]/[artifact]-[revision].[ext]");
    resolver2.setSettings(settings);
    chain.add(resolver);
    chain.add(resolver2);
    settings.addResolver(chain);
    settings.setDefaultResolver("chain");
    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 : ChainResolver(org.apache.ivy.plugins.resolver.ChainResolver) IBiblioResolver(org.apache.ivy.plugins.resolver.IBiblioResolver) 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 4 with IBiblioResolver

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

the class SearchTest method testListInMavenRepo2.

@Test
public void testListInMavenRepo2() throws Exception {
    Ivy ivy = Ivy.newInstance();
    ivy.configure(new File("test/repositories/m2/ivysettings.xml").toURI().toURL());
    ((IBiblioResolver) ivy.getSettings().getResolver("m2")).setUseMavenMetadata(false);
    Map<String, Object> otherTokenValues = new HashMap<>();
    otherTokenValues.put(IvyPatternHelper.ORGANISATION_KEY, "org.apache");
    otherTokenValues.put(IvyPatternHelper.MODULE_KEY, "test-metadata");
    String[] revs = ivy.listTokenValues(IvyPatternHelper.REVISION_KEY, otherTokenValues);
    assertEquals(new HashSet<>(Arrays.asList("1.0", "1.1", "1.2")), new HashSet<>(Arrays.asList(revs)));
}
Also used : IBiblioResolver(org.apache.ivy.plugins.resolver.IBiblioResolver) HashMap(java.util.HashMap) Ivy(org.apache.ivy.Ivy) File(java.io.File) Test(org.junit.Test)

Example 5 with IBiblioResolver

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

the class ConfigureTest method testDefault.

@Test
public void testDefault() throws ParseException, IOException {
    Ivy ivy = new Ivy();
    ivy.configureDefault();
    IvySettings settings = ivy.getSettings();
    assertNotNull(settings.getDefaultResolver());
    DependencyResolver publicResolver = settings.getResolver("public");
    assertNotNull(publicResolver);
    assertTrue(publicResolver instanceof IBiblioResolver);
    IBiblioResolver ibiblio = (IBiblioResolver) publicResolver;
    assertTrue(ibiblio.isM2compatible());
}
Also used : IBiblioResolver(org.apache.ivy.plugins.resolver.IBiblioResolver) Ivy(org.apache.ivy.Ivy) DependencyResolver(org.apache.ivy.plugins.resolver.DependencyResolver) Test(org.junit.Test)

Aggregations

IBiblioResolver (org.apache.ivy.plugins.resolver.IBiblioResolver)6 Test (org.junit.Test)5 File (java.io.File)3 Ivy (org.apache.ivy.Ivy)3 DependencyResolver (org.apache.ivy.plugins.resolver.DependencyResolver)3 IvySettings (org.apache.ivy.core.settings.IvySettings)2 ModuleDescriptorParserRegistryTest (org.apache.ivy.plugins.parser.ModuleDescriptorParserRegistryTest)2 ChainResolver (org.apache.ivy.plugins.resolver.ChainResolver)2 HashMap (java.util.HashMap)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 FileSystemResolver (org.apache.ivy.plugins.resolver.FileSystemResolver)1 URLResolver (org.apache.ivy.plugins.resolver.URLResolver)1 Before (org.junit.Before)1