Search in sources :

Example 21 with RepositoryManager

use of org.eclipse.ceylon.cmr.api.RepositoryManager in project ceylon by eclipse.

the class SmokeTestCase method testOverridesSet.

@Test
public void testOverridesSet() throws Exception {
    RepositoryManager manager = getRepositoryManager();
    ArtifactResult result = manager.getArtifactResult(null, "moduletest", "0.1");
    Assert.assertNotNull(result);
    manager = getRepositoryManager("testsuite/src/test/resources/overridesSet.xml");
    result = manager.getArtifactResult(null, "moduletest", "0.1");
    Assert.assertNull(result);
}
Also used : RepositoryManager(org.eclipse.ceylon.cmr.api.RepositoryManager) SimpleRepositoryManager(org.eclipse.ceylon.cmr.impl.SimpleRepositoryManager) ArtifactResult(org.eclipse.ceylon.model.cmr.ArtifactResult) Test(org.junit.Test)

Example 22 with RepositoryManager

use of org.eclipse.ceylon.cmr.api.RepositoryManager 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 23 with RepositoryManager

use of org.eclipse.ceylon.cmr.api.RepositoryManager in project ceylon by eclipse.

the class SmokeTestCase method testSharedOSGi.

@Test
public void testSharedOSGi() throws Exception {
    RepositoryManager manager = getRepositoryManager();
    ArtifactContext context = new ArtifactContext(null, "org.osgi.ceylon.shared", "1.0", ArtifactContext.JAR);
    try {
        Manifest manifest = mockManifest("1.0");
        manifest.getMainAttributes().putValue("Require-Bundle", "moduletest;visibility:=reexport;bundle-version=0.1");
        manager.putArtifact(context, mockJar("foo", "bar".getBytes(), manifest));
        ArtifactResult result = manager.getArtifactResult(context);
        Assert.assertNotNull(result);
        Assert.assertNotNull(result.dependencies());
        Assert.assertEquals(1, result.dependencies().size());
        ArtifactResult dep1 = result.dependencies().get(0);
        Assert.assertNotNull(dep1);
        Assert.assertTrue(dep1.exported());
    } finally {
        manager.removeArtifact(context);
    }
}
Also used : RepositoryManager(org.eclipse.ceylon.cmr.api.RepositoryManager) SimpleRepositoryManager(org.eclipse.ceylon.cmr.impl.SimpleRepositoryManager) ArtifactContext(org.eclipse.ceylon.cmr.api.ArtifactContext) Manifest(java.util.jar.Manifest) ArtifactResult(org.eclipse.ceylon.model.cmr.ArtifactResult) Test(org.junit.Test)

Example 24 with RepositoryManager

use of org.eclipse.ceylon.cmr.api.RepositoryManager in project ceylon by eclipse.

the class SmokeTestCase method testMavenRemote.

@Test
public void testMavenRemote() throws Exception {
    RepositoryManagerBuilder builder = getRepositoryManagerBuilder(false, 60000, java.net.Proxy.NO_PROXY);
    CmrRepository externalRepo = MavenRepositoryHelper.getMavenRepository("https://repository.jboss.org/nexus/content/groups/public", log, false, 60000, java.net.Proxy.NO_PROXY);
    builder.addRepository(externalRepo);
    RepositoryManager manager = builder.buildRepository();
    ArtifactContext ac = new ArtifactContext(MavenRepository.NAMESPACE, "org.jboss:jboss-vfs", "3.0.1.GA", ArtifactContext.JAR);
    File file = null;
    try {
        file = manager.getArtifact(ac);
        Assert.assertNotNull(file);
        Assert.assertEquals("jboss-vfs-3.0.1.GA.jar", file.getName());
    } finally {
        // delete the jar, not the car
        ac.setSuffixes(ArtifactContext.JAR);
        manager.removeArtifact(ac);
        // temporary workaround, because the jar is not stored at the right place
        if (file != null)
            Assert.assertTrue(file.delete());
    }
}
Also used : RepositoryManagerBuilder(org.eclipse.ceylon.cmr.api.RepositoryManagerBuilder) RepositoryManager(org.eclipse.ceylon.cmr.api.RepositoryManager) SimpleRepositoryManager(org.eclipse.ceylon.cmr.impl.SimpleRepositoryManager) ArtifactContext(org.eclipse.ceylon.cmr.api.ArtifactContext) CmrRepository(org.eclipse.ceylon.cmr.api.CmrRepository) File(java.io.File) Test(org.junit.Test)

Example 25 with RepositoryManager

use of org.eclipse.ceylon.cmr.api.RepositoryManager 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)

Aggregations

RepositoryManager (org.eclipse.ceylon.cmr.api.RepositoryManager)95 Test (org.junit.Test)71 SimpleRepositoryManager (org.eclipse.ceylon.cmr.impl.SimpleRepositoryManager)68 File (java.io.File)47 ArtifactResult (org.eclipse.ceylon.model.cmr.ArtifactResult)32 CmrRepository (org.eclipse.ceylon.cmr.api.CmrRepository)26 ArtifactContext (org.eclipse.ceylon.cmr.api.ArtifactContext)23 ModuleDetails (org.eclipse.ceylon.cmr.api.ModuleSearchResult.ModuleDetails)14 TypeCheckerBuilder (org.eclipse.ceylon.compiler.typechecker.TypeCheckerBuilder)11 RepositoryManagerBuilder (org.eclipse.ceylon.cmr.api.RepositoryManagerBuilder)8 HashMap (java.util.HashMap)7 TypeChecker (org.eclipse.ceylon.compiler.typechecker.TypeChecker)7 ByteArrayInputStream (java.io.ByteArrayInputStream)5 ArrayList (java.util.ArrayList)5 JsModuleManagerFactory (org.eclipse.ceylon.compiler.js.loader.JsModuleManagerFactory)5 ModuleSearchResult (org.eclipse.ceylon.cmr.api.ModuleSearchResult)4 CeylonRepoManagerBuilder (org.eclipse.ceylon.cmr.ceylon.CeylonUtils.CeylonRepoManagerBuilder)4 IOException (java.io.IOException)3 Manifest (java.util.jar.Manifest)3 DefaultRepository (org.eclipse.ceylon.cmr.impl.DefaultRepository)3