Search in sources :

Example 6 with SimpleRepositoryManager

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

the class AetherTestCase method testReplaceOverrides.

@Test
public void testReplaceOverrides() throws Throwable {
    CmrRepository repository = createAetherRepository();
    RepositoryManager manager = new SimpleRepositoryManager(repository, log, RepositoryManagerBuilder.parseOverrides(getOverridesFileName()));
    ArtifactResult result = manager.getArtifactResult(MavenArtifactContext.NAMESPACE, "org.apache.camel:camel-core", "2.9.2");
    Assert.assertNotNull(result);
    Assert.assertEquals(result.name(), "org.osgi:org.osgi.core");
    File artifact = result.artifact();
    boolean exists = false;
    try {
        Assert.assertNotNull(artifact);
        Assert.assertTrue(artifact.exists());
        exists = true;
        List<ArtifactResult> deps = result.dependencies();
        Assert.assertEquals(deps.size(), 0);
    } finally {
        if (exists) {
            // delete this one
            Assert.assertTrue(artifact.delete());
        }
    }
}
Also used : SimpleRepositoryManager(org.eclipse.ceylon.cmr.impl.SimpleRepositoryManager) RepositoryManager(org.eclipse.ceylon.cmr.api.RepositoryManager) SimpleRepositoryManager(org.eclipse.ceylon.cmr.impl.SimpleRepositoryManager) CmrRepository(org.eclipse.ceylon.cmr.api.CmrRepository) File(java.io.File) ArtifactResult(org.eclipse.ceylon.model.cmr.ArtifactResult) Test(org.junit.Test)

Example 7 with SimpleRepositoryManager

use of org.eclipse.ceylon.cmr.impl.SimpleRepositoryManager 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 8 with SimpleRepositoryManager

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

the class AetherTestCase method testAddRemoveOverrides.

@Test
public void testAddRemoveOverrides() throws Throwable {
    CmrRepository repository = createAetherRepository();
    RepositoryManager manager = new SimpleRepositoryManager(repository, log, RepositoryManagerBuilder.parseOverrides(getOverridesFileName()));
    ArtifactResult result = manager.getArtifactResult(MavenArtifactContext.NAMESPACE, "org.restlet.jse:org.restlet", "2.0.10");
    Assert.assertNotNull(result);
    File artifact = result.artifact();
    boolean exists = false;
    try {
        Assert.assertNotNull(artifact);
        Assert.assertTrue(artifact.exists());
        exists = true;
        List<ArtifactResult> deps = result.dependencies();
        Assert.assertEquals(deps.size(), 1);
        Assert.assertEquals("org.slf4j:slf4j-api", deps.get(0).name());
        Assert.assertEquals("1.6.1", deps.get(0).version());
        log.debug("deps = " + deps);
    } finally {
        if (exists) {
            // delete this one
            Assert.assertTrue(artifact.delete());
        }
    }
}
Also used : SimpleRepositoryManager(org.eclipse.ceylon.cmr.impl.SimpleRepositoryManager) RepositoryManager(org.eclipse.ceylon.cmr.api.RepositoryManager) SimpleRepositoryManager(org.eclipse.ceylon.cmr.impl.SimpleRepositoryManager) CmrRepository(org.eclipse.ceylon.cmr.api.CmrRepository) File(java.io.File) ArtifactResult(org.eclipse.ceylon.model.cmr.ArtifactResult) Test(org.junit.Test)

Example 9 with SimpleRepositoryManager

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

the class AetherTestCase method testAether.

@Test
public void testAether() throws Throwable {
    CmrRepository repository = AetherRepository.createRepository(log, false, 60000);
    RepositoryManager manager = new SimpleRepositoryManager(repository, log);
    ArtifactResult result = manager.getArtifactResult(MavenArtifactContext.NAMESPACE, "org.slf4j:slf4j-api", "1.6.4");
    Assert.assertNotNull(result);
    File artifact = result.artifact();
    boolean exists = false;
    try {
        Assert.assertNotNull(artifact);
        Assert.assertTrue(artifact.exists());
        exists = true;
        List<ArtifactResult> deps = result.dependencies();
        log.debug("deps = " + deps);
    } finally {
        if (exists) {
            // delete this one
            Assert.assertTrue(artifact.delete());
        }
    }
}
Also used : SimpleRepositoryManager(org.eclipse.ceylon.cmr.impl.SimpleRepositoryManager) RepositoryManager(org.eclipse.ceylon.cmr.api.RepositoryManager) SimpleRepositoryManager(org.eclipse.ceylon.cmr.impl.SimpleRepositoryManager) 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 SimpleRepositoryManager

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

the class AetherTestCase method testAetherJarless.

@Test
public void testAetherJarless() throws Throwable {
    CmrRepository repository = AetherRepository.createRepository(log, false, 60000);
    RepositoryManager manager = new SimpleRepositoryManager(repository, log);
    ArtifactResult result = manager.getArtifactResult(MavenArtifactContext.NAMESPACE, "javax.mail:mail", "1.3.2");
    Assert.assertNotNull(result);
    File artifact = result.artifact();
    boolean exists = false;
    try {
        Assert.assertNotNull(artifact);
        Assert.assertTrue(artifact.exists());
        Assert.assertTrue(ModuleUtil.isMavenJarlessModule(artifact));
        exists = true;
        List<ArtifactResult> deps = result.dependencies();
        Assert.assertEquals(1, deps.size());
        log.debug("deps = " + deps);
    } finally {
        if (exists) {
            // delete this one
            Assert.assertTrue(artifact.delete());
        }
    }
}
Also used : SimpleRepositoryManager(org.eclipse.ceylon.cmr.impl.SimpleRepositoryManager) RepositoryManager(org.eclipse.ceylon.cmr.api.RepositoryManager) SimpleRepositoryManager(org.eclipse.ceylon.cmr.impl.SimpleRepositoryManager) CmrRepository(org.eclipse.ceylon.cmr.api.CmrRepository) File(java.io.File) ArtifactResult(org.eclipse.ceylon.model.cmr.ArtifactResult) 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