Search in sources :

Example 41 with ArtifactContext

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

the class RepoUsingTool method getModuleArtifact.

protected ArtifactResult getModuleArtifact(RepositoryManager repoMgr, String name, String version, ModuleQuery.Type type) {
    ArtifactContext ac = new ArtifactContext(null, name, version, type.getSuffixes());
    ac.setIgnoreDependencies(true);
    ac.setThrowErrorIfMissing(false);
    return repoMgr.getArtifactResult(ac);
}
Also used : ArtifactContext(org.eclipse.ceylon.cmr.api.ArtifactContext)

Example 42 with ArtifactContext

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

the class CallbackTestCase method testDefault.

@Test
public void testDefault() throws Exception {
    TestArtifactCallback callback = new TestArtifactCallback();
    ArtifactContext context = new ArtifactContext(null, name, version);
    context.setCallback(callback);
    doTest(context, callback);
}
Also used : ArtifactContext(org.eclipse.ceylon.cmr.api.ArtifactContext) Test(org.junit.Test)

Example 43 with ArtifactContext

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

the class SmokeTestCase method testGetMultiple.

@Test
public void testGetMultiple() 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 artifact = new ArtifactContext(null, "ceylon.json", "1.0.0", ArtifactContext.CAR, ArtifactContext.SCRIPTS_ZIPPED, ArtifactContext.JS);
    List<ArtifactResult> json = manager.getArtifactResults(artifact);
    Assert.assertNotNull("Module 'ceylon.json-1.0.0' not found", json);
    Assert.assertEquals("Expected two artifacts for 'ceylon.json-1.0.0'", 2, json.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());
}
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 44 with ArtifactContext

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

the class SmokeTestCase method testMavenLocal.

@Test
// this test should work, if you have org.slf4j.slf4j-api 1.5.10 present
@Ignore
public void testMavenLocal() throws Exception {
    RepositoryManager manager = new SimpleRepositoryManager(MavenRepositoryHelper.getMavenRepository(), log);
    ArtifactContext ac = new ArtifactContext(null, "org.slf4j.slf4j-api", "1.5.10");
    File file = manager.getArtifact(ac);
    Assert.assertNotNull(file);
// No remove, as we don't wanna delete from mvn manager
}
Also used : SimpleRepositoryManager(org.eclipse.ceylon.cmr.impl.SimpleRepositoryManager) RepositoryManager(org.eclipse.ceylon.cmr.api.RepositoryManager) SimpleRepositoryManager(org.eclipse.ceylon.cmr.impl.SimpleRepositoryManager) ArtifactContext(org.eclipse.ceylon.cmr.api.ArtifactContext) File(java.io.File) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 45 with ArtifactContext

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

the class SmokeTestCase method testExternalNodes.

@Test
public void testExternalNodes() throws Exception {
    RepositoryManagerBuilder builder = getRepositoryManagerBuilder(false, 60000, java.net.Proxy.NO_PROXY);
    InMemoryContentStore imcs = new InMemoryContentStore();
    OpenNode root = imcs.createRoot();
    CmrRepository repo = new DefaultRepository(root);
    RepositoryManager manager = builder.addRepository(repo).buildRepository();
    // a few impl details, feel free to remove/ignore this test
    String name = "org.eclipse.acme";
    String version = "1.0.0.CR1";
    ArtifactContext context = new ArtifactContext(null, name, version);
    // ignore with in-memory
    context.setIgnoreSHA(true);
    OpenNode parent = repo.createParent(context);
    parent.addContent(name + "-" + version + ArtifactContext.CAR, new ByteArrayInputStream("qwerty".getBytes()), context);
    try {
        File file = manager.getArtifact(context);
        Assert.assertNotNull("Failed to retrieve after put", file);
    } finally {
        manager.removeArtifact(null, name, version);
    }
}
Also used : RepositoryManagerBuilder(org.eclipse.ceylon.cmr.api.RepositoryManagerBuilder) DefaultRepository(org.eclipse.ceylon.cmr.impl.DefaultRepository) ByteArrayInputStream(java.io.ByteArrayInputStream) InMemoryContentStore(org.eclipse.ceylon.test.smoke.support.InMemoryContentStore) 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) OpenNode(org.eclipse.ceylon.cmr.spi.OpenNode) Test(org.junit.Test)

Aggregations

ArtifactContext (org.eclipse.ceylon.cmr.api.ArtifactContext)62 File (java.io.File)33 ArtifactResult (org.eclipse.ceylon.model.cmr.ArtifactResult)25 RepositoryManager (org.eclipse.ceylon.cmr.api.RepositoryManager)22 Test (org.junit.Test)20 SimpleRepositoryManager (org.eclipse.ceylon.cmr.impl.SimpleRepositoryManager)17 IOException (java.io.IOException)13 CmrRepository (org.eclipse.ceylon.cmr.api.CmrRepository)9 MavenArtifactContext (org.eclipse.ceylon.cmr.api.MavenArtifactContext)7 ModuleSpec (org.eclipse.ceylon.common.ModuleSpec)6 ArrayList (java.util.ArrayList)5 RepositoryManagerBuilder (org.eclipse.ceylon.cmr.api.RepositoryManagerBuilder)5 Manifest (java.util.jar.Manifest)4 ModuleVersionDetails (org.eclipse.ceylon.cmr.api.ModuleVersionDetails)4 Module (org.eclipse.ceylon.model.typechecker.model.Module)4 ByteArrayInputStream (java.io.ByteArrayInputStream)3 FileWriter (java.io.FileWriter)3 HashMap (java.util.HashMap)3 HashSet (java.util.HashSet)3 Map (java.util.Map)3