Search in sources :

Example 16 with RepositoryManagerBuilder

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

Example 17 with RepositoryManagerBuilder

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

the class AbstractJBossRuntime method createRepository.

private RepositoryManager createRepository(Configuration conf, boolean offline) {
    Logger log = new CMRJULLogger();
    final RepositoryManagerBuilder builder = CeylonUtils.repoManager().cwd(conf.cwd).systemRepo(conf.systemRepository).cacheRepo(conf.cacheRepository).overrides(conf.overrides).upgradeDist(conf.upgradeDist).noDefaultRepos(conf.noDefaultRepositories).noOutRepo(true).userRepos(conf.repositories).offline(offline || conf.offline).logger(log).buildManagerBuilder();
    final MergeStrategy ms = getService(MergeStrategy.class, conf);
    if (ms != null)
        builder.mergeStrategy(ms);
    if (conf.cacheContent)
        builder.cacheContent();
    final ContentTransformer ct = getService(ContentTransformer.class, conf);
    if (ct != null)
        builder.contentTransformer(ct);
    return builder.buildRepository();
}
Also used : RepositoryManagerBuilder(org.eclipse.ceylon.cmr.api.RepositoryManagerBuilder) MergeStrategy(org.eclipse.ceylon.cmr.spi.MergeStrategy) ContentTransformer(org.eclipse.ceylon.cmr.spi.ContentTransformer) CMRJULLogger(org.eclipse.ceylon.cmr.impl.CMRJULLogger) Logger(org.eclipse.ceylon.common.log.Logger) CMRJULLogger(org.eclipse.ceylon.cmr.impl.CMRJULLogger)

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