Search in sources :

Example 6 with RepositoryManagerBuilder

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

the class BuilderTestCase method testDefault.

@Test
public void testDefault() throws Exception {
    try {
        // property not set
        RepositoryManagerBuilder builder = getRepositoryManagerBuilder(false, 60000, java.net.Proxy.NO_PROXY);
        assertBuilder(builder, RepositoryManagerBuilderImpl.class);
        // blank
        System.setProperty("ceylon.module.resolver.builder", "");
        builder = getRepositoryManagerBuilder(false, 60000, java.net.Proxy.NO_PROXY);
        assertBuilder(builder, RepositoryManagerBuilderImpl.class);
    } finally {
        System.clearProperty("ceylon.module.resolver.builder");
    }
}
Also used : RepositoryManagerBuilder(org.eclipse.ceylon.cmr.api.RepositoryManagerBuilder) Test(org.junit.Test)

Example 7 with RepositoryManagerBuilder

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

the class HerdTestCase method getRepositoryManager.

private RepositoryManager getRepositoryManager(File root, boolean offline, int timeout, String apiVersion) throws Exception {
    RepositoryManagerBuilder builder = getRepositoryManagerBuilder(root, offline, timeout, java.net.Proxy.NO_PROXY);
    WebDAVContentStore rcs = new WebDAVContentStore(HERD_URL, log, false, 60000, java.net.Proxy.NO_PROXY, apiVersion);
    CmrRepository repo = new DefaultRepository(rcs.createRoot());
    return builder.addRepository(repo).buildRepository();
}
Also used : RepositoryManagerBuilder(org.eclipse.ceylon.cmr.api.RepositoryManagerBuilder) DefaultRepository(org.eclipse.ceylon.cmr.impl.DefaultRepository) CmrRepository(org.eclipse.ceylon.cmr.api.CmrRepository) WebDAVContentStore(org.eclipse.ceylon.cmr.webdav.WebDAVContentStore)

Example 8 with RepositoryManagerBuilder

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

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

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

the class SmokeTestCase method testPropertiesGet.

@Test
public void testPropertiesGet() throws Exception {
    RepositoryManagerBuilder builder = getRepositoryManagerBuilder(false, 60000, java.net.Proxy.NO_PROXY);
    RepositoryBuilder rb = builder.repositoryBuilder();
    CmrRepository[] repositories = rb.buildRepository(Constants.REPO_URL_CEYLON);
    for (CmrRepository repo : repositories) {
        builder.addRepository(repo);
    }
    RepositoryManager manager = builder.buildRepository();
    ArtifactContext context = new ArtifactContext(null, "io.undertow.core", "1.0.0.Alpha1-9fdfd5f766", ArtifactContext.JAR);
    try {
        File artifact = manager.getArtifact(context);
        Assert.assertNotNull(artifact);
        File mp = new File(artifact.getParent(), ArtifactContext.MODULE_PROPERTIES);
        Assert.assertNotNull(mp.exists());
    } finally {
        manager.removeArtifact(context);
    }
}
Also used : RepositoryManagerBuilder(org.eclipse.ceylon.cmr.api.RepositoryManagerBuilder) RepositoryBuilder(org.eclipse.ceylon.cmr.api.RepositoryBuilder) 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)

Aggregations

RepositoryManagerBuilder (org.eclipse.ceylon.cmr.api.RepositoryManagerBuilder)17 Test (org.junit.Test)10 File (java.io.File)8 CmrRepository (org.eclipse.ceylon.cmr.api.CmrRepository)8 RepositoryManager (org.eclipse.ceylon.cmr.api.RepositoryManager)8 SimpleRepositoryManager (org.eclipse.ceylon.cmr.impl.SimpleRepositoryManager)6 ArtifactContext (org.eclipse.ceylon.cmr.api.ArtifactContext)5 DefaultRepository (org.eclipse.ceylon.cmr.impl.DefaultRepository)5 URL (java.net.URL)2 RemoteContentStore (org.eclipse.ceylon.cmr.impl.RemoteContentStore)2 ArtifactResult (org.eclipse.ceylon.model.cmr.ArtifactResult)2 BufferedReader (java.io.BufferedReader)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 FileReader (java.io.FileReader)1 IOException (java.io.IOException)1 Field (java.lang.reflect.Field)1 ModuleSearchResult (org.eclipse.ceylon.cmr.api.ModuleSearchResult)1 RepositoryBuilder (org.eclipse.ceylon.cmr.api.RepositoryBuilder)1 CMRJULLogger (org.eclipse.ceylon.cmr.impl.CMRJULLogger)1 FileContentStore (org.eclipse.ceylon.cmr.impl.FileContentStore)1