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

The following examples show how to use org.apache.ivy.core.search.OrganisationEntry. 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: UpdateSiteResolverTest.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
@Test
public void testListOrganization() {
    OrganisationEntry[] orgs = resolver.listOrganisations();
    assertEquals(2, orgs.length);
    assertTrue((orgs[0].getOrganisation().equals(BundleInfo.BUNDLE_TYPE) && orgs[1]
            .getOrganisation().equals(BundleInfo.PACKAGE_TYPE))
            || (orgs[0].getOrganisation().equals(BundleInfo.PACKAGE_TYPE) && orgs[1]
                    .getOrganisation().equals(BundleInfo.BUNDLE_TYPE)));
}
 
Example #2
Source File: BasicResolver.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
@Override
public OrganisationEntry[] listOrganisations() {
    Collection<String> names = findNames(Collections.<String, String> emptyMap(),
        IvyPatternHelper.ORGANISATION_KEY);
    List<OrganisationEntry> ret = new ArrayList<>(names.size());
    for (String org : names) {
        ret.add(new OrganisationEntry(this, org));
    }
    return ret.toArray(new OrganisationEntry[names.size()]);
}
 
Example #3
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 #4
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 #5
Source File: Ivy.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
public OrganisationEntry[] listOrganisationEntries() {
    pushContext();
    try {
        return searchEngine.listOrganisationEntries();
    } finally {
        popContext();
    }
}
 
Example #6
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 #7
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 #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: ResolverTestHelper.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
static void assertOrganisationEntries(DependencyResolver resolver, String[] orgNames,
        OrganisationEntry[] orgs) {
    assertNotNull(orgs);
    assertEquals(
        "invalid organisation entries: unmatched number: expected: " + Arrays.asList(orgNames)
                + " but was " + Arrays.asList(orgs), orgNames.length, orgs.length);
    assertOrganisationEntriesContains(resolver, orgNames, orgs);
}
 
Example #10
Source File: ResolverTestHelper.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
static void assertOrganisationEntriesContains(DependencyResolver resolver, String[] orgNames,
        OrganisationEntry[] orgs) {
    assertNotNull(orgs);
    for (String orgName : orgNames) {
        boolean found = false;
        for (OrganisationEntry org : orgs) {
            if (orgName.equals(org.getOrganisation())) {
                found = true;
                assertEquals(resolver, org.getResolver());
            }
        }
        assertTrue("organisation not found: " + orgName, found);
    }
}
 
Example #11
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 #12
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 #13
Source File: ResolverTestHelper.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
static OrganisationEntry getEntry(OrganisationEntry[] orgs, String name) {
    for (OrganisationEntry org : orgs) {
        if (name.equals(org.getOrganisation())) {
            return org;
        }
    }
    return null; // for compilation only
}
 
Example #14
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 #15
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 #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: IBiblioResolver.java    From ant-ivy with Apache License 2.0 4 votes vote down vote up
@Override
public OrganisationEntry[] listOrganisations() {
    return new OrganisationEntry[0];
}
 
Example #18
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 #19
Source File: AbstractResolver.java    From ant-ivy with Apache License 2.0 4 votes vote down vote up
public OrganisationEntry[] listOrganisations() {
    return new OrganisationEntry[0];
}
 
Example #20
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 #21
Source File: AbstractMavenResolver.java    From pushfish-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 #22
Source File: LoopbackDependencyResolver.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public OrganisationEntry[] listOrganisations() {
    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 ModuleEntry[] listModules(OrganisationEntry org) {
    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 OrganisationEntry[] listOrganisations() {
    // 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 ModuleEntry[] listModules(OrganisationEntry org) {
    // 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 OrganisationEntry[] listOrganisations() {
    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 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 #28
Source File: LoopbackDependencyResolver.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public OrganisationEntry[] listOrganisations() {
    throw new UnsupportedOperationException();
}
 
Example #29
Source File: AbstractMavenResolver.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public OrganisationEntry[] listOrganisations() {
    throw new UnsupportedOperationException("A Maven deployer cannot be used to resolve dependencies. It can only be used to publish artifacts.");
}
 
Example #30
Source File: LegacyDependencyResolver.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public OrganisationEntry[] listOrganisations() {
    // This is never used
    throw new UnsupportedOperationException();
}