org.apache.ivy.core.search.ModuleEntry Java Examples

The following examples show how to use org.apache.ivy.core.search.ModuleEntry. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: IBiblioResolverTest.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings({"rawtypes", "unchecked"})
@Test
public void testMaven2Listing() {
    IBiblioResolver resolver = new IBiblioResolver();
    resolver.setName("test");
    resolver.setSettings(settings);
    resolver.setM2compatible(true);
    assertEquals("test", resolver.getName());

    ModuleEntry[] modules = resolver
            .listModules(new OrganisationEntry(resolver, "commons-lang"));
    assertNotNull(modules);
    assertEquals(1, modules.length);
    assertEquals("commons-lang", modules[0].getModule());

    RevisionEntry[] revisions = resolver.listRevisions(modules[0]);
    assertTrue(revisions.length > 0);

    Map otherTokenValues = new HashMap();
    otherTokenValues.put(IvyPatternHelper.ORGANISATION_KEY, "commons-lang");
    String[] values = resolver.listTokenValues(IvyPatternHelper.MODULE_KEY, otherTokenValues);
    assertNotNull(values);
    assertEquals(1, values.length);
    assertEquals("commons-lang", values[0]);

    Map[] valuesMaps = resolver.listTokenValues(new String[] {IvyPatternHelper.MODULE_KEY},
        otherTokenValues);
    Set vals = new HashSet();
    for (Map valuesMap : valuesMaps) {
        vals.add(valuesMap.get(IvyPatternHelper.MODULE_KEY));
    }
    values = (String[]) vals.toArray(new String[vals.size()]);
    assertEquals(1, values.length);
    assertEquals("commons-lang", values[0]);
}
 
Example #2
Source File: FileSystemResolverTest.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
@Test
public void testListing() {
    FileSystemResolver resolver = new FileSystemResolver();
    resolver.setName("test");
    resolver.setSettings(settings);
    assertEquals("test", resolver.getName());

    resolver.addIvyPattern(IVY_PATTERN);
    resolver.addArtifactPattern(settings.getBaseDir() + "/test/repositories/1/"
            + "[organisation]/[module]/[type]s/[artifact]-[revision].[ext]");

    OrganisationEntry[] orgs = resolver.listOrganisations();
    ResolverTestHelper.assertOrganisationEntriesContains(resolver, new String[] {"org1",
            "org2", "org6", "org9", "orgfailure", "yourorg", "IVY-644"}, orgs);

    OrganisationEntry org = ResolverTestHelper.getEntry(orgs, "org1");
    assertNotNull("organisation not found: org1", org);
    ModuleEntry[] mods = resolver.listModules(org);
    ResolverTestHelper.assertModuleEntries(resolver, org, new String[] {"mod1.1", "mod1.2",
            "mod1.3", "mod1.4", "mod1.5", "mod1.6", "mod1.7"}, mods);

    ModuleEntry mod = ResolverTestHelper.getEntry(mods, "mod1.1");
    assertNotNull("module not found: mod1.1", mod);
    RevisionEntry[] revs = resolver.listRevisions(mod);
    ResolverTestHelper.assertRevisionEntries(resolver, mod, new String[] {"1.0", "1.0.1",
            "1.1", "2.0"}, revs);

    mod = ResolverTestHelper.getEntry(mods, "mod1.2");
    assertNotNull("module not found: mod1.2", mod);
    revs = resolver.listRevisions(mod);
    ResolverTestHelper.assertRevisionEntries(resolver, mod, new String[] {"0.9", "1.0", "1.1",
            "2.0", "2.1", "2.2"}, revs);
}
 
Example #3
Source File: ResolverTestHelper.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
static ModuleEntry getEntry(ModuleEntry[] mods, String name) {
    for (ModuleEntry mod : mods) {
        if (name.equals(mod.getModule())) {
            return mod;
        }
    }
    return null; // for compilation only
}
 
Example #4
Source File: ResolverTestHelper.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
private static void assertRevisionEntriesContains(DependencyResolver resolver, ModuleEntry mod,
                                                  String[] names, RevisionEntry[] revs) {
    assertNotNull(revs);
    for (String name : names) {
        boolean found = false;
        for (RevisionEntry rev : revs) {
            if (name.equals(rev.getRevision())) {
                found = true;
                assertEquals(resolver, rev.getResolver());
                assertEquals(mod, rev.getModuleEntry());
            }
        }
        assertTrue("revision not found: " + name, found);
    }
}
 
Example #5
Source File: ResolverTestHelper.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
static void assertRevisionEntries(DependencyResolver resolver, ModuleEntry mod, String[] names,
        RevisionEntry[] revs) {
    assertNotNull(revs);
    assertEquals(
        "invalid revision entries: unmatched number: expected: " + Arrays.asList(names)
                + " but was " + Arrays.asList(revs), names.length, revs.length);
    assertRevisionEntriesContains(resolver, mod, names, revs);
}
 
Example #6
Source File: ResolverTestHelper.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
private static void assertModuleEntriesContains(DependencyResolver resolver, OrganisationEntry org,
                                                String[] names, ModuleEntry[] mods) {
    assertNotNull(mods);
    for (String name : names) {
        boolean found = false;
        for (ModuleEntry mod : mods) {
            if (name.equals(mod.getModule())) {
                found = true;
                assertEquals(resolver, mod.getResolver());
                assertEquals(org, mod.getOrganisationEntry());
            }
        }
        assertTrue("module not found: " + name, found);
    }
}
 
Example #7
Source File: ResolverTestHelper.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
static void assertModuleEntries(DependencyResolver resolver, OrganisationEntry org,
        String[] names, ModuleEntry[] mods) {
    assertNotNull(mods);
    assertEquals(
        "invalid module entries: unmatched number: expected: " + Arrays.asList(names)
                + " but was " + Arrays.asList(mods), names.length, mods.length);
    assertModuleEntriesContains(resolver, org, names, mods);
}
 
Example #8
Source File: UpdateSiteResolverTest.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
@Test
public void testListModules() {
    ModuleEntry[] modules = resolver.listModules(new OrganisationEntry(resolver,
            BundleInfo.BUNDLE_TYPE));
    assertEquals(3, modules.length);
    modules = resolver.listModules(new OrganisationEntry(resolver, BundleInfo.PACKAGE_TYPE));
    assertEquals(64, modules.length);
}
 
Example #9
Source File: IBiblioResolver.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
@Override
public ModuleEntry[] listModules(OrganisationEntry org) {
    if (isM2compatible()) {
        ensureConfigured(getSettings());
        return super.listModules(org);
    }
    return new ModuleEntry[0];
}
 
Example #10
Source File: BasicResolver.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
@Override
public ModuleEntry[] listModules(OrganisationEntry org) {
    Map<String, String> tokenValues = new HashMap<>();
    tokenValues.put(IvyPatternHelper.ORGANISATION_KEY, org.getOrganisation());
    Collection<String> names = findNames(tokenValues, IvyPatternHelper.MODULE_KEY);
    List<ModuleEntry> ret = new ArrayList<>(names.size());
    for (String name : names) {
        ret.add(new ModuleEntry(org, name));
    }
    return ret.toArray(new ModuleEntry[names.size()]);
}
 
Example #11
Source File: IvyRepResolver.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
@Override
public ModuleEntry[] listModules(OrganisationEntry org) {
    ensureIvyConfigured(getSettings());
    Map<String, String> tokenValues = new HashMap<>();
    tokenValues.put(IvyPatternHelper.ORGANISATION_KEY, org.getOrganisation());
    Collection<String> names = findIvyNames(tokenValues, IvyPatternHelper.MODULE_KEY);
    List<ModuleEntry> ret = new ArrayList<>(names.size());
    for (String name : names) {
        ret.add(new ModuleEntry(org, name));
    }
    return ret.toArray(new ModuleEntry[names.size()]);
}
 
Example #12
Source File: BasicResolver.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
@Override
public RevisionEntry[] listRevisions(ModuleEntry mod) {
    Map<String, String> tokenValues = new HashMap<>();
    tokenValues.put(IvyPatternHelper.ORGANISATION_KEY, mod.getOrganisation());
    tokenValues.put(IvyPatternHelper.MODULE_KEY, mod.getModule());
    Collection<String> names = findNames(tokenValues, IvyPatternHelper.REVISION_KEY);
    List<RevisionEntry> ret = new ArrayList<>(names.size());
    for (String name : names) {
        ret.add(new RevisionEntry(mod, name));
    }
    return ret.toArray(new RevisionEntry[names.size()]);
}
 
Example #13
Source File: Ivy.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
public ModuleEntry[] listModuleEntries(OrganisationEntry org) {
    pushContext();
    try {
        return searchEngine.listModuleEntries(org);
    } finally {
        popContext();
    }
}
 
Example #14
Source File: Ivy.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
public RevisionEntry[] listRevisionEntries(ModuleEntry module) {
    pushContext();
    try {
        return searchEngine.listRevisionEntries(module);
    } finally {
        popContext();
    }
}
 
Example #15
Source File: CacheResolver.java    From ant-ivy with Apache License 2.0 4 votes vote down vote up
@Override
public RevisionEntry[] listRevisions(ModuleEntry module) {
    ensureConfigured();
    return super.listRevisions(module);
}
 
Example #16
Source File: CacheResolver.java    From ant-ivy with Apache License 2.0 4 votes vote down vote up
@Override
public ModuleEntry[] listModules(OrganisationEntry org) {
    ensureConfigured();
    return super.listModules(org);
}
 
Example #17
Source File: AbstractResolver.java    From ant-ivy with Apache License 2.0 4 votes vote down vote up
public ModuleEntry[] listModules(OrganisationEntry org) {
    return new ModuleEntry[0];
}
 
Example #18
Source File: AbstractResolver.java    From ant-ivy with Apache License 2.0 4 votes vote down vote up
public RevisionEntry[] listRevisions(ModuleEntry module) {
    return new RevisionEntry[0];
}
 
Example #19
Source File: IBiblioResolver.java    From ant-ivy with Apache License 2.0 4 votes vote down vote up
@Override
public RevisionEntry[] listRevisions(ModuleEntry mod) {
    ensureConfigured(getSettings());
    return super.listRevisions(mod);
}
 
Example #20
Source File: IvyRepResolver.java    From ant-ivy with Apache License 2.0 4 votes vote down vote up
@Override
public RevisionEntry[] listRevisions(ModuleEntry mod) {
    ensureIvyConfigured(getSettings());
    ensureArtifactConfigured(getSettings());
    return super.listRevisions(mod);
}
 
Example #21
Source File: AbstractMavenResolver.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public RevisionEntry[] listRevisions(ModuleEntry module) {
    throw new UnsupportedOperationException("A Maven deployer cannot be used to resolve dependencies. It can only be used to publish artifacts.");
}
 
Example #22
Source File: LoopbackDependencyResolver.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public ModuleEntry[] listModules(OrganisationEntry org) {
    throw new UnsupportedOperationException();
}
 
Example #23
Source File: LoopbackDependencyResolver.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public RevisionEntry[] listRevisions(ModuleEntry module) {
    throw new UnsupportedOperationException();
}
 
Example #24
Source File: LegacyDependencyResolver.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public ModuleEntry[] listModules(OrganisationEntry org) {
    // This is never used
    throw new UnsupportedOperationException();
}
 
Example #25
Source File: LegacyDependencyResolver.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public RevisionEntry[] listRevisions(ModuleEntry mod) {
    // This is never used
    throw new UnsupportedOperationException();
}
 
Example #26
Source File: AbstractMavenResolver.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public ModuleEntry[] listModules(OrganisationEntry org) {
    throw new UnsupportedOperationException("A Maven deployer cannot be used to resolve dependencies. It can only be used to publish artifacts.");
}
 
Example #27
Source File: AbstractMavenResolver.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public RevisionEntry[] listRevisions(ModuleEntry module) {
    throw new UnsupportedOperationException("A Maven deployer cannot be used to resolve dependencies. It can only be used to publish artifacts.");
}
 
Example #28
Source File: LoopbackDependencyResolver.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public ModuleEntry[] listModules(OrganisationEntry org) {
    throw new UnsupportedOperationException();
}
 
Example #29
Source File: LoopbackDependencyResolver.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public RevisionEntry[] listRevisions(ModuleEntry module) {
    throw new UnsupportedOperationException();
}
 
Example #30
Source File: LegacyDependencyResolver.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public ModuleEntry[] listModules(OrganisationEntry org) {
    // This is never used
    throw new UnsupportedOperationException();
}