Search in sources :

Example 16 with SimpleRepositoryManager

use of org.eclipse.ceylon.cmr.impl.SimpleRepositoryManager in project ceylon by eclipse.

the class ResolverTestCase method doTest.

private void doTest(Tester tester) throws Exception {
    CmrRepository repository = createAetherRepository();
    RepositoryManager manager = new SimpleRepositoryManager(repository, log);
    ArtifactResult result = manager.getArtifactResult(MavenArtifactContext.NAMESPACE, "org.apache.camel:camel-core", "2.9.2");
    Assert.assertNotNull(result);
    Assert.assertEquals(result.name(), "org.apache.camel:camel-core");
    File artifact = result.artifact();
    boolean exists = false;
    try {
        Assert.assertNotNull(artifact);
        Assert.assertTrue(artifact.exists());
        exists = true;
        tester.run(repository, artifact);
    } finally {
        if (exists) {
            // delete this one
            Assert.assertTrue(artifact.delete());
        }
    }
}
Also used : SimpleRepositoryManager(org.eclipse.ceylon.cmr.impl.SimpleRepositoryManager) SimpleRepositoryManager(org.eclipse.ceylon.cmr.impl.SimpleRepositoryManager) RepositoryManager(org.eclipse.ceylon.cmr.api.RepositoryManager) CmrRepository(org.eclipse.ceylon.cmr.api.CmrRepository) File(java.io.File) ArtifactResult(org.eclipse.ceylon.model.cmr.ArtifactResult) AbstractArtifactResult(org.eclipse.ceylon.cmr.impl.AbstractArtifactResult)

Example 17 with SimpleRepositoryManager

use of org.eclipse.ceylon.cmr.impl.SimpleRepositoryManager in project ceylon by eclipse.

the class ModuleLoaderTest method testNoDots.

@Test
public void testNoDots() throws ModuleNotFoundException {
    CmrRepository repository = AetherRepository.createRepository(log, false, 60000);
    RepositoryManager manager = new SimpleRepositoryManager(repository, log);
    Map<String, String> extraModules = new HashMap<>();
    extraModules.put("maven:aopalliance:aopalliance", "1.0");
    TestableModuleLoader moduleLoader = new TestableModuleLoader(manager, null, extraModules, true);
    // org.antlr:stringtemplate:3.2.1
    // com.google.inject:guice:4.0
    moduleLoader.loadModule("maven:antlr:antlr", "2.7.7", ModuleScope.RUNTIME);
    // Check that we got them
    Assert.assertEquals("2.7.7", moduleLoader.getModuleVersion("maven:antlr:antlr"));
    Assert.assertEquals("1.0", moduleLoader.getModuleVersion("maven:aopalliance:aopalliance"));
}
Also used : SimpleRepositoryManager(org.eclipse.ceylon.cmr.impl.SimpleRepositoryManager) HashMap(java.util.HashMap) SimpleRepositoryManager(org.eclipse.ceylon.cmr.impl.SimpleRepositoryManager) RepositoryManager(org.eclipse.ceylon.cmr.api.RepositoryManager) CmrRepository(org.eclipse.ceylon.cmr.api.CmrRepository) Test(org.junit.Test)

Example 18 with SimpleRepositoryManager

use of org.eclipse.ceylon.cmr.impl.SimpleRepositoryManager in project ceylon by eclipse.

the class ModuleLoaderTest method testNoDotsFromMaven.

@Test
public void testNoDotsFromMaven() throws ModuleNotFoundException {
    CmrRepository repository = AetherRepository.createRepository(log, false, 60000);
    RepositoryManager manager = new SimpleRepositoryManager(repository, log);
    Map<String, String> extraModules = new HashMap<>();
    extraModules.put("org.antlr:stringtemplate", "3.2.1");
    TestableModuleLoader moduleLoader = new TestableModuleLoader(manager, null, extraModules, true);
    moduleLoader.loadModule("com.google.inject:guice", "4.0", ModuleScope.RUNTIME);
    // Check that we got them
    Assert.assertEquals("2.7.7", moduleLoader.getModuleVersion("maven:antlr:antlr"));
    Assert.assertEquals("1.0", moduleLoader.getModuleVersion("maven:aopalliance:aopalliance"));
}
Also used : SimpleRepositoryManager(org.eclipse.ceylon.cmr.impl.SimpleRepositoryManager) HashMap(java.util.HashMap) SimpleRepositoryManager(org.eclipse.ceylon.cmr.impl.SimpleRepositoryManager) RepositoryManager(org.eclipse.ceylon.cmr.api.RepositoryManager) CmrRepository(org.eclipse.ceylon.cmr.api.CmrRepository) Test(org.junit.Test)

Example 19 with SimpleRepositoryManager

use of org.eclipse.ceylon.cmr.impl.SimpleRepositoryManager in project ceylon by eclipse.

the class ModuleLoaderTest method testModuleLoaderDirectImportsNotExcluded.

@Test
public void testModuleLoaderDirectImportsNotExcluded() throws ModuleNotFoundException {
    CmrRepository repository = AetherRepository.createRepository(log, settings, false, 60000, null);
    RepositoryManager manager = new SimpleRepositoryManager(repository, log);
    Map<String, String> extraModules = new HashMap<>();
    extraModules.put("org.springframework.cloud:spring-cloud-starter-eureka-server", "1.1.0.RC1");
    TestableModuleLoader moduleLoader = new TestableModuleLoader(manager, null, extraModules, false);
    moduleLoader.loadModule("org.springframework.cloud:spring-cloud-starter-eureka-server", "1.1.0.RC1", ModuleScope.RUNTIME);
    // Those should not be there
    Assert.assertNull(moduleLoader.getModuleVersion("jackson-dataformat-xml:com.fasterxml.jackson.dataformat"));
    moduleLoader.cleanup();
    // now add a direct import
    moduleLoader.loadModule("com.fasterxml.jackson.dataformat:jackson-dataformat-xml", "2.6.5", ModuleScope.RUNTIME);
    // Should be there
    Assert.assertEquals("2.6.5", moduleLoader.getModuleVersion("com.fasterxml.jackson.dataformat:jackson-dataformat-xml"));
}
Also used : SimpleRepositoryManager(org.eclipse.ceylon.cmr.impl.SimpleRepositoryManager) HashMap(java.util.HashMap) SimpleRepositoryManager(org.eclipse.ceylon.cmr.impl.SimpleRepositoryManager) RepositoryManager(org.eclipse.ceylon.cmr.api.RepositoryManager) CmrRepository(org.eclipse.ceylon.cmr.api.CmrRepository) Test(org.junit.Test)

Aggregations

RepositoryManager (org.eclipse.ceylon.cmr.api.RepositoryManager)19 SimpleRepositoryManager (org.eclipse.ceylon.cmr.impl.SimpleRepositoryManager)19 CmrRepository (org.eclipse.ceylon.cmr.api.CmrRepository)18 Test (org.junit.Test)18 File (java.io.File)14 ArtifactResult (org.eclipse.ceylon.model.cmr.ArtifactResult)11 HashMap (java.util.HashMap)5 ArrayList (java.util.ArrayList)2 ArtifactContext (org.eclipse.ceylon.cmr.api.ArtifactContext)2 MavenArtifactContext (org.eclipse.ceylon.cmr.api.MavenArtifactContext)1 ModuleDependencyInfo (org.eclipse.ceylon.cmr.api.ModuleDependencyInfo)1 ModuleVersionDetails (org.eclipse.ceylon.cmr.api.ModuleVersionDetails)1 ModuleVersionQuery (org.eclipse.ceylon.cmr.api.ModuleVersionQuery)1 ModuleVersionResult (org.eclipse.ceylon.cmr.api.ModuleVersionResult)1 Overrides (org.eclipse.ceylon.cmr.api.Overrides)1 AbstractArtifactResult (org.eclipse.ceylon.cmr.impl.AbstractArtifactResult)1 AetherContentStore (org.eclipse.ceylon.cmr.maven.AetherContentStore)1 StructureBuilder (org.eclipse.ceylon.cmr.spi.StructureBuilder)1 Ignore (org.junit.Ignore)1