Search in sources :

Example 6 with ModuleDetails

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

the class SmokeTestCase method testCompleteJsAndJvm.

@Test
public void testCompleteJsAndJvm() throws Exception {
    RepositoryManager manager = getRepositoryManager();
    ModuleDetails[] expected = new ModuleDetails[] { hello_js_jvm, hello2 };
    testComplete("hello", expected, manager, ModuleQuery.Type.CODE);
}
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 7 with ModuleDetails

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

the class SmokeTestCase method testCompleteEmpty.

@Test
public void testCompleteEmpty() throws Exception {
    RepositoryManager manager = getRepositoryManager();
    ModuleDetails[] expected = new ModuleDetails[] { com_acme_helloworld, hello, hello2_jvm, moduletest, old_jar, older_jar, test_jar };
    testComplete("", 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 8 with ModuleDetails

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

the class AbstractTest method compareSearchResults.

private void compareSearchResults(ModuleDetails[] expected, ModuleSearchResult results) {
    int i = 0;
    Collection<ModuleDetails> resultsList = results.getResults();
    Assert.assertEquals(expected.length, resultsList.size());
    for (ModuleDetails result : resultsList) {
        ModuleDetails expectedResult = expected[i++];
        System.err.println("Testing " + result.getName());
        Assert.assertEquals(expectedResult.getName(), result.getName());
        if (expectedResult.getDoc() != null) {
            // Docs can be really big, this let's allow us to ignore them for comparisons
            Assert.assertEquals(expectedResult.getDoc(), result.getDoc());
        }
        Assert.assertEquals(expectedResult.getLicense(), result.getLicense());
        Assert.assertEquals(expectedResult.getAuthors(), result.getAuthors());
        Assert.assertEquals(expectedResult.getVersions(), result.getVersions());
        if (!expectedResult.getDependencies().contains(IGNORE_DEPS)) {
            Assert.assertEquals(expectedResult.getDependencies(), result.getDependencies());
        }
        Assert.assertEquals(expectedResult.getArtifactTypes(), result.getArtifactTypes());
    }
}
Also used : ModuleDetails(org.eclipse.ceylon.cmr.api.ModuleSearchResult.ModuleDetails)

Example 9 with ModuleDetails

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

the class HerdTestCase method testHerdAndRepoSearchPaged2.

@Test
public void testHerdAndRepoSearchPaged2() throws Exception {
    // first page
    ModuleDetails[] expected = new ModuleDetails[] { ceylonCollectionDetails, frEpardaudTestDetails };
    ModuleSearchResult results = testSearchResults("ceylon", Type.JVM, expected, 0L, 2L, getDualRepositoryManager());
    // check end indices
    long[] pagingInfo = results.getNextPagingInfo();
    Assert.assertNotNull(pagingInfo);
    Assert.assertEquals(3, pagingInfo.length);
    Assert.assertEquals(0, pagingInfo[0]);
    Assert.assertEquals(0, pagingInfo[1]);
    Assert.assertEquals(2, pagingInfo[2]);
    // second page
    expected = new ModuleDetails[] { frEpardaudTest2DetailsJvm, new ModuleDetails("ceylon", "hello", null, null, ASL, set("The Ceylon Team"), set("1.2.1"), deps(langmod), types(art(".CAR", 8, 0)), true, "The Herd"), new ModuleDetails("ceylon", "hello2", null, "A test", ASL, set("The Ceylon Team"), set("1.0.0"), deps(langmod), types(art(".CAR", 8, 0)), true, "The Herd"), new ModuleDetails("ceylon", "moduletest", null, null, "GPLv2", set("The Ceylon Team"), set("0.1"), deps(hello), types(art(".CAR", 3, 0)), true, "The Herd") };
    results = testSearchResults("ceylon", Type.JVM, expected, 0L, 6L, getDualRepositoryManager(), pagingInfo);
    // check end indices
    pagingInfo = results.getNextPagingInfo();
    Assert.assertNotNull(pagingInfo);
    Assert.assertEquals(3, pagingInfo.length);
    Assert.assertEquals(3, pagingInfo[0]);
    Assert.assertEquals(0, pagingInfo[1]);
    Assert.assertEquals(3, pagingInfo[2]);
    // again first page
    ModuleDetails[] expected2 = new ModuleDetails[] { ceylonCollectionDetails, frEpardaudTestDetails, frEpardaudTest2DetailsJvm, new ModuleDetails("ceylon", "hello", null, null, ASL, set("The Ceylon Team"), set("1.2.1"), deps(langmod), types(art(".CAR", 8, 0)), true, "The Herd") };
    ModuleSearchResult results2 = testSearchResults("ceylon", Type.JVM, expected2, 0L, 4L, getDualRepositoryManager());
    // check end indices
    long[] pagingInfo2 = results2.getNextPagingInfo();
    Assert.assertNotNull(pagingInfo2);
    Assert.assertEquals(3, pagingInfo2.length);
    Assert.assertEquals(1, pagingInfo2[0]);
    Assert.assertEquals(0, pagingInfo2[1]);
    Assert.assertEquals(3, pagingInfo2[2]);
    // second page
    expected2 = new ModuleDetails[] { new ModuleDetails("ceylon", "hello2", null, "A test", ASL, set("The Ceylon Team"), set("1.0.0"), deps(langmod), types(art(".CAR", 8, 0)), true, "The Herd"), new ModuleDetails("ceylon", "moduletest", null, null, "GPLv2", set("The Ceylon Team"), set("0.1"), deps(hello), types(art(".CAR", 3, 0)), true, "The Herd") };
    results2 = testSearchResults("ceylon", Type.JVM, expected2, 0L, 4L, getDualRepositoryManager(), pagingInfo2);
    // check end indices
    pagingInfo2 = results2.getNextPagingInfo();
    Assert.assertNotNull(pagingInfo2);
    Assert.assertEquals(3, pagingInfo2.length);
    Assert.assertEquals(3, pagingInfo2[0]);
    Assert.assertEquals(0, pagingInfo2[1]);
    Assert.assertEquals(3, pagingInfo2[2]);
}
Also used : ModuleDetails(org.eclipse.ceylon.cmr.api.ModuleSearchResult.ModuleDetails) ModuleSearchResult(org.eclipse.ceylon.cmr.api.ModuleSearchResult) Test(org.junit.Test)

Example 10 with ModuleDetails

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

the class SmokeTestCase method testCompleteStopAtVersion.

@Test
public void testCompleteStopAtVersion() throws Exception {
    RepositoryManager manager = getRepositoryManager();
    ModuleDetails[] expected = new ModuleDetails[] {};
    testComplete("com.acme.helloworld.", 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)

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