Search in sources :

Example 1 with ModuleDetails

use of org.eclipse.ceylon.cmr.api.ModuleSearchResult.ModuleDetails in project ceylon by eclipse.

the class LegacyImporter method findSuggestions.

private Set<ModuleDetails> findSuggestions(String pkg) {
    Set<ModuleDetails> suggestions = new TreeSet<>();
    ModuleVersionQuery query = new ModuleVersionQuery(null, "", null, ModuleQuery.Type.JVM);
    query.setJvmBinaryMajor(Versions.JVM_BINARY_MAJOR_VERSION);
    query.setJvmBinaryMinor(Versions.JVM_BINARY_MINOR_VERSION);
    query.setMemberName(pkg);
    query.setMemberSearchExact(true);
    query.setMemberSearchPackageOnly(true);
    ModuleSearchResult result = lookupRepoman.completeModules(query);
    for (ModuleDetails mvd : result.getResults()) {
        suggestions.add(mvd);
    }
    return suggestions;
}
Also used : TreeSet(java.util.TreeSet) ModuleDetails(org.eclipse.ceylon.cmr.api.ModuleSearchResult.ModuleDetails) ModuleVersionQuery(org.eclipse.ceylon.cmr.api.ModuleVersionQuery) ModuleSearchResult(org.eclipse.ceylon.cmr.api.ModuleSearchResult)

Example 2 with ModuleDetails

use of org.eclipse.ceylon.cmr.api.ModuleSearchResult.ModuleDetails in project ceylon by eclipse.

the class SmokeTestCase method testCompleteHe.

@Test
public void testCompleteHe() throws Exception {
    RepositoryManager manager = getRepositoryManager();
    ModuleDetails[] expected = new ModuleDetails[] { hello, hello2_jvm };
    testComplete("he", expected, manager);
}
Also used : RepositoryManager(org.eclipse.ceylon.cmr.api.RepositoryManager) SimpleRepositoryManager(org.eclipse.ceylon.cmr.impl.SimpleRepositoryManager) ModuleDetails(org.eclipse.ceylon.cmr.api.ModuleSearchResult.ModuleDetails) Test(org.junit.Test)

Example 3 with ModuleDetails

use of org.eclipse.ceylon.cmr.api.ModuleSearchResult.ModuleDetails in project ceylon by eclipse.

the class SmokeTestCase method testCompleteJDKOnJS.

@Test
public void testCompleteJDKOnJS() throws Exception {
    RepositoryManager manager = getJDKRepositoryManager();
    ModuleDetails[] expected = new ModuleDetails[] {};
    testComplete("", expected, manager, ModuleQuery.Type.JS);
}
Also used : RepositoryManager(org.eclipse.ceylon.cmr.api.RepositoryManager) SimpleRepositoryManager(org.eclipse.ceylon.cmr.impl.SimpleRepositoryManager) ModuleDetails(org.eclipse.ceylon.cmr.api.ModuleSearchResult.ModuleDetails) Test(org.junit.Test)

Example 4 with ModuleDetails

use of org.eclipse.ceylon.cmr.api.ModuleSearchResult.ModuleDetails in project ceylon by eclipse.

the class SmokeTestCase method testSearchModulesPaged.

@Test
public void testSearchModulesPaged() throws Exception {
    RepositoryManager repoManager = getRepositoryManager();
    // first page
    ModuleDetails[] expected = new ModuleDetails[] { com_acme_helloworld, hello };
    ModuleSearchResult results = testSearchResults("", Type.JVM, expected, 0l, 2l, repoManager);
    Assert.assertEquals(2, results.getCount());
    Assert.assertEquals(true, results.getHasMoreResults());
    Assert.assertEquals(0, results.getStart());
    // second page
    expected = new ModuleDetails[] { hello2_jvm, moduletest, old_jar };
    results = testSearchResults("", Type.JVM, expected, results.getStart() + results.getCount(), 3l, repoManager, results.getNextPagingInfo());
    Assert.assertEquals(3, results.getCount());
    Assert.assertEquals(true, results.getHasMoreResults());
    Assert.assertEquals(2, results.getStart());
    // third page
    expected = new ModuleDetails[] { older_jar, test_jar };
    results = testSearchResults("", Type.JVM, expected, results.getStart() + results.getCount(), 2l, repoManager, results.getNextPagingInfo());
    Assert.assertEquals(2, results.getCount());
    Assert.assertEquals(false, results.getHasMoreResults());
    Assert.assertEquals(5, results.getStart());
}
Also used : RepositoryManager(org.eclipse.ceylon.cmr.api.RepositoryManager) SimpleRepositoryManager(org.eclipse.ceylon.cmr.impl.SimpleRepositoryManager) ModuleDetails(org.eclipse.ceylon.cmr.api.ModuleSearchResult.ModuleDetails) ModuleSearchResult(org.eclipse.ceylon.cmr.api.ModuleSearchResult) Test(org.junit.Test)

Example 5 with ModuleDetails

use of org.eclipse.ceylon.cmr.api.ModuleSearchResult.ModuleDetails in project ceylon by eclipse.

the class SmokeTestCase method testCompleteEmptyJS.

@Test
public void testCompleteEmptyJS() throws Exception {
    RepositoryManager manager = getRepositoryManager();
    ModuleDetails[] expected = new ModuleDetails[] { com_acme_helloworld_js, hello_js, hello2_js, jsonly, moduletest_js };
    testComplete("", expected, manager, ModuleQuery.Type.JS);
}
Also used : RepositoryManager(org.eclipse.ceylon.cmr.api.RepositoryManager) SimpleRepositoryManager(org.eclipse.ceylon.cmr.impl.SimpleRepositoryManager) ModuleDetails(org.eclipse.ceylon.cmr.api.ModuleSearchResult.ModuleDetails) Test(org.junit.Test)

Aggregations

ModuleDetails (org.eclipse.ceylon.cmr.api.ModuleSearchResult.ModuleDetails)20 Test (org.junit.Test)15 RepositoryManager (org.eclipse.ceylon.cmr.api.RepositoryManager)14 SimpleRepositoryManager (org.eclipse.ceylon.cmr.impl.SimpleRepositoryManager)14 ModuleSearchResult (org.eclipse.ceylon.cmr.api.ModuleSearchResult)5 TreeSet (java.util.TreeSet)2 CmrRepository (org.eclipse.ceylon.cmr.api.CmrRepository)1 ModuleDependencyInfo (org.eclipse.ceylon.cmr.api.ModuleDependencyInfo)1 ModuleVersionDetails (org.eclipse.ceylon.cmr.api.ModuleVersionDetails)1 ModuleVersionQuery (org.eclipse.ceylon.cmr.api.ModuleVersionQuery)1 ModuleSpec (org.eclipse.ceylon.common.ModuleSpec)1