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

The following examples show how to use org.apache.ivy.core.search.RevisionEntry. 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
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 #4
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 #5
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 #6
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 #7
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 #8
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 #9
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 #10
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 #11
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 #12
Source File: Ivy14.java    From ant-ivy with Apache License 2.0 4 votes vote down vote up
public RevisionEntry[] listRevisionEntries(ModuleEntry module) {
    return ivy.listRevisionEntries(module);
}
 
Example #13
Source File: LegacyDependencyResolver.java    From Pushjet-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 #14
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 #15
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 #16
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 #17
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 #18
Source File: DependencyResolver.java    From ant-ivy with Apache License 2.0 votes vote down vote up
RevisionEntry[] listRevisions(ModuleEntry module);