Search in sources :

Example 21 with ArtifactContext

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

the class SmokeTestCase method testSharedOSGi.

@Test
public void testSharedOSGi() throws Exception {
    RepositoryManager manager = getRepositoryManager();
    ArtifactContext context = new ArtifactContext(null, "org.osgi.ceylon.shared", "1.0", ArtifactContext.JAR);
    try {
        Manifest manifest = mockManifest("1.0");
        manifest.getMainAttributes().putValue("Require-Bundle", "moduletest;visibility:=reexport;bundle-version=0.1");
        manager.putArtifact(context, mockJar("foo", "bar".getBytes(), manifest));
        ArtifactResult result = manager.getArtifactResult(context);
        Assert.assertNotNull(result);
        Assert.assertNotNull(result.dependencies());
        Assert.assertEquals(1, result.dependencies().size());
        ArtifactResult dep1 = result.dependencies().get(0);
        Assert.assertNotNull(dep1);
        Assert.assertTrue(dep1.exported());
    } finally {
        manager.removeArtifact(context);
    }
}
Also used : RepositoryManager(org.eclipse.ceylon.cmr.api.RepositoryManager) SimpleRepositoryManager(org.eclipse.ceylon.cmr.impl.SimpleRepositoryManager) ArtifactContext(org.eclipse.ceylon.cmr.api.ArtifactContext) Manifest(java.util.jar.Manifest) ArtifactResult(org.eclipse.ceylon.model.cmr.ArtifactResult) Test(org.junit.Test)

Example 22 with ArtifactContext

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

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

the class SmokeTestCase method testXmlResolver.

@Test
public void testXmlResolver() throws Exception {
    RepositoryManager manager = getRepositoryManager();
    ArtifactContext context = new ArtifactContext(null, "older-jar", "12-b3", ArtifactContext.JAR);
    File file = manager.getArtifact(context);
    Assert.assertNotNull(file);
}
Also used : 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) Test(org.junit.Test)

Example 24 with ArtifactContext

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

the class SmokeTestCase method testFolderPut.

@Test
public void testFolderPut() throws Exception {
    RepositoryManager manager = getRepositoryManager();
    File docs = new File(getFolders(), "docs");
    String name = "org.eclipse.docs";
    String version = "1.0.0.CR3";
    ArtifactContext template = new ArtifactContext();
    template.setName(name);
    template.setVersion(version);
    ArtifactContext context = template.getDocsContext();
    manager.putArtifact(context, docs);
    try {
        File copy = manager.getArtifact(context);
        File x = new File(copy, "x.txt");
        Assert.assertTrue(x.exists());
        File y = new File(copy, "sub/y.txt");
        Assert.assertTrue(y.exists());
    } finally {
        manager.removeArtifact(context);
    }
}
Also used : 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) Test(org.junit.Test)

Example 25 with ArtifactContext

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

the class SmokeTestCase method test2ndTry.

@Test
public void test2ndTry() throws Exception {
    RepositoryManager manager = getRepositoryManager();
    ArtifactContext ac = new ArtifactContext(null, "test-jar", "0.1");
    ArtifactResult result = manager.getArtifactResult(ac);
    Assert.assertNull(result);
    ac.setSuffixes(ArtifactContext.JAR);
    result = manager.getArtifactResult(ac);
    Assert.assertNotNull(result);
}
Also used : RepositoryManager(org.eclipse.ceylon.cmr.api.RepositoryManager) SimpleRepositoryManager(org.eclipse.ceylon.cmr.impl.SimpleRepositoryManager) ArtifactContext(org.eclipse.ceylon.cmr.api.ArtifactContext) ArtifactResult(org.eclipse.ceylon.model.cmr.ArtifactResult) Test(org.junit.Test)

Aggregations

ArtifactContext (org.eclipse.ceylon.cmr.api.ArtifactContext)62 File (java.io.File)33 ArtifactResult (org.eclipse.ceylon.model.cmr.ArtifactResult)25 RepositoryManager (org.eclipse.ceylon.cmr.api.RepositoryManager)22 Test (org.junit.Test)20 SimpleRepositoryManager (org.eclipse.ceylon.cmr.impl.SimpleRepositoryManager)17 IOException (java.io.IOException)13 CmrRepository (org.eclipse.ceylon.cmr.api.CmrRepository)9 MavenArtifactContext (org.eclipse.ceylon.cmr.api.MavenArtifactContext)7 ModuleSpec (org.eclipse.ceylon.common.ModuleSpec)6 ArrayList (java.util.ArrayList)5 RepositoryManagerBuilder (org.eclipse.ceylon.cmr.api.RepositoryManagerBuilder)5 Manifest (java.util.jar.Manifest)4 ModuleVersionDetails (org.eclipse.ceylon.cmr.api.ModuleVersionDetails)4 Module (org.eclipse.ceylon.model.typechecker.model.Module)4 ByteArrayInputStream (java.io.ByteArrayInputStream)3 FileWriter (java.io.FileWriter)3 HashMap (java.util.HashMap)3 HashSet (java.util.HashSet)3 Map (java.util.Map)3