Search in sources :

Example 31 with RepositoryManager

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

the class SmokeTestCase method test2ndTry.

@Test
public void test2ndTry() throws Exception {
    RepositoryManager manager = getRepositoryManager();
    ArtifactContext ac = new ArtifactContext(null, "test-jar", "0.1");
    ArtifactResult result = manager.getArtifactResult(ac);
    Assert.assertNull(result);
    ac.setSuffixes(ArtifactContext.JAR);
    result = manager.getArtifactResult(ac);
    Assert.assertNotNull(result);
}
Also used : RepositoryManager(org.eclipse.ceylon.cmr.api.RepositoryManager) SimpleRepositoryManager(org.eclipse.ceylon.cmr.impl.SimpleRepositoryManager) ArtifactContext(org.eclipse.ceylon.cmr.api.ArtifactContext) ArtifactResult(org.eclipse.ceylon.model.cmr.ArtifactResult) Test(org.junit.Test)

Example 32 with RepositoryManager

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

the class SmokeTestCase method testSimpleOSGi.

@Test
public void testSimpleOSGi() throws Exception {
    RepositoryManager manager = getRepositoryManager();
    ArtifactContext context = new ArtifactContext(null, "org.osgi.ceylon.simple", "1.0", ArtifactContext.JAR);
    try {
        Manifest manifest = mockManifest("1.0");
        manifest.getMainAttributes().putValue("Require-Bundle", "moduletest;bundle-version=0.1");
        manager.putArtifact(context, mockJar("foo", "bar".getBytes(), manifest));
        File file = manager.getArtifact(context);
        Assert.assertNotNull(file);
    } 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) File(java.io.File) Test(org.junit.Test)

Example 33 with RepositoryManager

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

the class SmokeTestCase method testGetMultipleCached.

@Test
public void testGetMultipleCached() throws Exception {
    RepositoryManagerBuilder builder = getRepositoryManagerBuilder(false, 60000, java.net.Proxy.NO_PROXY);
    CmrRepository[] externalRepos = builder.repositoryBuilder().buildRepository(Constants.REPO_URL_CEYLON);
    for (CmrRepository repo : externalRepos) {
        builder.addRepository(repo);
    }
    RepositoryManager manager = builder.buildRepository();
    ArtifactContext artifact1 = new ArtifactContext(null, "ceylon.json", "1.0.0", ArtifactContext.CAR, ArtifactContext.SCRIPTS_ZIPPED, ArtifactContext.JS);
    List<ArtifactResult> json1 = manager.getArtifactResults(artifact1);
    Assert.assertNotNull("Module 'ceylon.json-1.0.0' not found", json1);
    Assert.assertEquals("Expected two artifacts for 'ceylon.json-1.0.0'", 2, json1.size());
    File root = new File(manager.getRepositories().get(1).getDisplayString());
    File missing = new File(root, "ceylon/json/1.0.0/ceylon.json-1.0.0.scripts.zip.missing");
    Assert.assertTrue("Marker file .missing not found", missing.exists());
    ArtifactContext artifact2 = new ArtifactContext(null, "ceylon.json", "1.0.0", ArtifactContext.CAR, ArtifactContext.SCRIPTS_ZIPPED, ArtifactContext.SRC);
    List<ArtifactResult> json2 = manager.getArtifactResults(artifact2);
    Assert.assertNotNull("Module 'ceylon.json-1.0.0' not found", json2);
    Assert.assertEquals("Expected two artifacts for 'ceylon.json-1.0.0'", 2, json2.size());
}
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) ArtifactResult(org.eclipse.ceylon.model.cmr.ArtifactResult) Test(org.junit.Test)

Example 34 with RepositoryManager

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

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

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