Search in sources :

Example 1 with RepositoryBuilder

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

Example 2 with RepositoryBuilder

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

the class RepositoryBuilderImpl method buildRepository.

public CmrRepository[] buildRepository(String token, RepositoryBuilderConfig config) throws Exception {
    if (token == null)
        throw new IllegalArgumentException("Null repository");
    final String key = (token.startsWith("${") ? token.substring(2, token.length() - 1) : token);
    final String temp = SecurityActions.getProperty(key);
    if (temp != null)
        token = temp;
    for (RepositoryBuilder builder : builders) {
        CmrRepository[] repos = builder.buildRepository(token, config);
        if (repos != null) {
            return repos;
        }
    }
    return localBuilder.buildRepository(token, config);
}
Also used : RepositoryBuilder(org.eclipse.ceylon.cmr.api.RepositoryBuilder) CmrRepository(org.eclipse.ceylon.cmr.api.CmrRepository)

Aggregations

CmrRepository (org.eclipse.ceylon.cmr.api.CmrRepository)2 RepositoryBuilder (org.eclipse.ceylon.cmr.api.RepositoryBuilder)2 File (java.io.File)1 ArtifactContext (org.eclipse.ceylon.cmr.api.ArtifactContext)1 RepositoryManager (org.eclipse.ceylon.cmr.api.RepositoryManager)1 RepositoryManagerBuilder (org.eclipse.ceylon.cmr.api.RepositoryManagerBuilder)1 SimpleRepositoryManager (org.eclipse.ceylon.cmr.impl.SimpleRepositoryManager)1 Test (org.junit.Test)1