Search in sources :

Example 71 with RepositoryManager

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

the class SmokeTestCase method testPropertiesPut.

@Test
public void testPropertiesPut() throws Exception {
    RepositoryManager manager = getRepositoryManager();
    ArtifactContext context = new ArtifactContext(null, "org.acme.props", "1.0", ArtifactContext.JAR);
    try {
        manager.putArtifact(context, mockJar("someentry", "qwerty".getBytes()));
        manager.putArtifact(context.getModuleProperties(), new ByteArrayInputStream("moduletest=0.1\n".getBytes()));
        File file = manager.getArtifact(context);
        Assert.assertNotNull(file);
    } finally {
        manager.removeArtifact(context);
    }
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) 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 72 with RepositoryManager

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

the class SmokeTestCase method testCompleteJDKWithPrefix.

@Test
public void testCompleteJDKWithPrefix() throws Exception {
    Assume.assumeTrue(JDKUtils.jdk == JDKUtils.JDK.JDK8);
    RepositoryManager manager = getJDKRepositoryManager();
    ModuleDetails[] expected = new ModuleDetails[] { jdkModule("java.auth", "JDK module java.auth"), jdkModule("java.auth.kerberos", "JDK module java.auth.kerberos"), jdkModule("java.base", "JDK module java.base"), jdkModule("java.compiler", "JDK module java.compiler"), jdkModule("java.corba", "JDK module java.corba"), jdkModule("java.desktop", "JDK module java.desktop"), jdkModule("java.instrument", "JDK module java.instrument"), jdkModule("java.jdbc", "JDK module java.jdbc"), jdkModule("java.jdbc.rowset", "JDK module java.jdbc.rowset"), jdkModule("java.logging", "JDK module java.logging"), jdkModule("java.management", "JDK module java.management"), jdkModule("java.prefs", "JDK module java.prefs"), jdkModule("java.rmi", "JDK module java.rmi"), jdkModule("java.security.acl", "JDK module java.security.acl"), jdkModule("java.tls", "JDK module java.tls"), jdkModule("javafx.base", "JDK module javafx.base"), jdkModule("javafx.controls", "JDK module javafx.controls"), jdkModule("javafx.deploy", "JDK module javafx.deploy"), jdkModule("javafx.fxml", "JDK module javafx.fxml"), jdkModule("javafx.graphics", "JDK module javafx.graphics"), jdkModule("javafx.media", "JDK module javafx.media"), jdkModule("javafx.swing", "JDK module javafx.swing"), jdkModule("javafx.web", "JDK module javafx.web"), jdkModule("javax.annotation", "JDK module javax.annotation"), jdkModule("javax.jaxws", "JDK module javax.jaxws"), jdkModule("javax.naming", "JDK module javax.naming"), jdkModule("javax.script", "JDK module javax.script"), jdkModule("javax.transaction", "JDK module javax.transaction"), jdkModule("javax.xml", "JDK module javax.xml"), jdkModule("javax.xmldsig", "JDK module javax.xmldsig") };
    testComplete("java", expected, manager);
    expected = new ModuleDetails[] { jdkModule("javax.annotation", "JDK module javax.annotation"), jdkModule("javax.jaxws", "JDK module javax.jaxws"), jdkModule("javax.naming", "JDK module javax.naming"), jdkModule("javax.script", "JDK module javax.script"), jdkModule("javax.transaction", "JDK module javax.transaction"), jdkModule("javax.xml", "JDK module javax.xml"), jdkModule("javax.xmldsig", "JDK module javax.xmldsig") };
    testComplete("javax", expected, manager);
}
Also used : RepositoryManager(org.eclipse.ceylon.cmr.api.RepositoryManager) SimpleRepositoryManager(org.eclipse.ceylon.cmr.impl.SimpleRepositoryManager) ModuleDetails(org.eclipse.ceylon.cmr.api.ModuleSearchResult.ModuleDetails) Test(org.junit.Test)

Example 73 with RepositoryManager

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

the class SmokeTestCase method testForcedPut.

@Test
public void testForcedPut() throws Exception {
    RepositoryManager manager = getRepositoryManager();
    ByteArrayInputStream baos = new ByteArrayInputStream("qwerty".getBytes());
    String name = "org.eclipse.foobar2";
    String version = "1.0.0.Alpha1";
    try {
        ArtifactContext context = new ArtifactContext();
        context.setName(name);
        context.setVersion(version);
        context.setForceOperation(true);
        manager.putArtifact(context, baos);
        File file = manager.getArtifact(null, name, version);
        Assert.assertNotNull("Failed to retrieve after put", file);
        baos = new ByteArrayInputStream("ytrewq".getBytes());
        manager.putArtifact(context, baos);
        file = manager.getArtifact(null, name, version);
        Assert.assertNotNull("Failed to retrieve after forced put", file);
    } finally {
        manager.removeArtifact(null, name, version);
    }
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) 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 74 with RepositoryManager

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

the class SmokeTestCase method testRemove.

@Test
public void testRemove() throws Exception {
    RepositoryManager manager = getRepositoryManager();
    String name = "org.jboss.qwerty";
    String version = "1.0.0.Alpha2";
    File file = null;
    try {
        File artifact = manager.getArtifact(null, name, version);
        Assert.assertNull(artifact);
        manager.putArtifact(null, name, version, new ByteArrayInputStream("qwerty".getBytes()));
        file = manager.getArtifact(null, name, version);
        Assert.assertNotNull("Failed to retrieve after put", file);
    } finally {
        manager.removeArtifact(null, name, version);
        if (file != null)
            Assert.assertFalse("Failed to remove module", file.exists());
    }
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) RepositoryManager(org.eclipse.ceylon.cmr.api.RepositoryManager) SimpleRepositoryManager(org.eclipse.ceylon.cmr.impl.SimpleRepositoryManager) File(java.io.File) Test(org.junit.Test)

Example 75 with RepositoryManager

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

the class SmokeTestCase method testNoVersion.

@Test
public void testNoVersion() throws Exception {
    RepositoryManager manager = getRepositoryManager();
    File def = manager.getArtifact(null, RepositoryManager.DEFAULT_MODULE, null);
    Assert.assertNotNull("Default module not found", def);
}
Also used : RepositoryManager(org.eclipse.ceylon.cmr.api.RepositoryManager) SimpleRepositoryManager(org.eclipse.ceylon.cmr.impl.SimpleRepositoryManager) File(java.io.File) Test(org.junit.Test)

Aggregations

RepositoryManager (org.eclipse.ceylon.cmr.api.RepositoryManager)95 Test (org.junit.Test)71 SimpleRepositoryManager (org.eclipse.ceylon.cmr.impl.SimpleRepositoryManager)68 File (java.io.File)47 ArtifactResult (org.eclipse.ceylon.model.cmr.ArtifactResult)32 CmrRepository (org.eclipse.ceylon.cmr.api.CmrRepository)26 ArtifactContext (org.eclipse.ceylon.cmr.api.ArtifactContext)23 ModuleDetails (org.eclipse.ceylon.cmr.api.ModuleSearchResult.ModuleDetails)14 TypeCheckerBuilder (org.eclipse.ceylon.compiler.typechecker.TypeCheckerBuilder)11 RepositoryManagerBuilder (org.eclipse.ceylon.cmr.api.RepositoryManagerBuilder)8 HashMap (java.util.HashMap)7 TypeChecker (org.eclipse.ceylon.compiler.typechecker.TypeChecker)7 ByteArrayInputStream (java.io.ByteArrayInputStream)5 ArrayList (java.util.ArrayList)5 JsModuleManagerFactory (org.eclipse.ceylon.compiler.js.loader.JsModuleManagerFactory)5 ModuleSearchResult (org.eclipse.ceylon.cmr.api.ModuleSearchResult)4 CeylonRepoManagerBuilder (org.eclipse.ceylon.cmr.ceylon.CeylonUtils.CeylonRepoManagerBuilder)4 IOException (java.io.IOException)3 Manifest (java.util.jar.Manifest)3 DefaultRepository (org.eclipse.ceylon.cmr.impl.DefaultRepository)3