Search in sources :

Example 51 with ArtifactResult

use of org.eclipse.ceylon.model.cmr.ArtifactResult in project ceylon by eclipse.

the class SmokeTestCase method testGetMultiple.

@Test
public void testGetMultiple() throws Exception {
    RepositoryManagerBuilder builder = getRepositoryManagerBuilder(false, 60000, java.net.Proxy.NO_PROXY);
    CmrRepository[] externalRepos = builder.repositoryBuilder().buildRepository(Constants.REPO_URL_CEYLON);
    for (CmrRepository repo : externalRepos) {
        builder.addRepository(repo);
    }
    RepositoryManager manager = builder.buildRepository();
    ArtifactContext artifact = new ArtifactContext(null, "ceylon.json", "1.0.0", ArtifactContext.CAR, ArtifactContext.SCRIPTS_ZIPPED, ArtifactContext.JS);
    List<ArtifactResult> json = manager.getArtifactResults(artifact);
    Assert.assertNotNull("Module 'ceylon.json-1.0.0' not found", json);
    Assert.assertEquals("Expected two artifacts for 'ceylon.json-1.0.0'", 2, json.size());
    File root = new File(manager.getRepositories().get(1).getDisplayString());
    File missing = new File(root, "ceylon/json/1.0.0/ceylon.json-1.0.0.scripts.zip.missing");
    Assert.assertTrue("Marker file .missing not found", missing.exists());
}
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) ArtifactResult(org.eclipse.ceylon.model.cmr.ArtifactResult) Test(org.junit.Test)

Example 52 with ArtifactResult

use of org.eclipse.ceylon.model.cmr.ArtifactResult in project ceylon by eclipse.

the class SmokeTestCase method testOverridesOptionalImport.

@Test
public void testOverridesOptionalImport() throws Exception {
    RepositoryManager manager = getRepositoryManager("testsuite/src/test/resources/overridesOptionalImport.xml");
    ArtifactResult result = manager.getArtifactResult(null, "moduletest", "0.1");
    Assert.assertNotNull(result);
    Assert.assertEquals(2, result.dependencies().size());
    ArtifactResult dep = result.dependencies().get(1);
    Assert.assertEquals("hello", dep.name());
    Assert.assertEquals("1.2.1", dep.version());
    Assert.assertTrue(dep.optional());
}
Also used : RepositoryManager(org.eclipse.ceylon.cmr.api.RepositoryManager) SimpleRepositoryManager(org.eclipse.ceylon.cmr.impl.SimpleRepositoryManager) ArtifactResult(org.eclipse.ceylon.model.cmr.ArtifactResult) Test(org.junit.Test)

Example 53 with ArtifactResult

use of org.eclipse.ceylon.model.cmr.ArtifactResult in project ceylon by eclipse.

the class SmokeTestCase method testOverridesRemove.

@Test
public void testOverridesRemove() throws Exception {
    RepositoryManager manager = getRepositoryManager("testsuite/src/test/resources/overrides.xml");
    ArtifactResult result = manager.getArtifactResult(null, "moduletest", "0.1");
    Assert.assertNotNull(result);
    Assert.assertEquals(1, result.dependencies().size());
}
Also used : RepositoryManager(org.eclipse.ceylon.cmr.api.RepositoryManager) SimpleRepositoryManager(org.eclipse.ceylon.cmr.impl.SimpleRepositoryManager) ArtifactResult(org.eclipse.ceylon.model.cmr.ArtifactResult) Test(org.junit.Test)

Example 54 with ArtifactResult

use of org.eclipse.ceylon.model.cmr.ArtifactResult in project ceylon by eclipse.

the class SmokeTestCase method testOverridesRemoveNoVersion.

@Test
public void testOverridesRemoveNoVersion() throws Exception {
    RepositoryManager manager = getRepositoryManager("testsuite/src/test/resources/overridesNoVersion.xml");
    ArtifactResult result = manager.getArtifactResult(null, "moduletest", "0.1");
    Assert.assertNotNull(result);
    Assert.assertEquals(1, result.dependencies().size());
}
Also used : RepositoryManager(org.eclipse.ceylon.cmr.api.RepositoryManager) SimpleRepositoryManager(org.eclipse.ceylon.cmr.impl.SimpleRepositoryManager) ArtifactResult(org.eclipse.ceylon.model.cmr.ArtifactResult) Test(org.junit.Test)

Example 55 with ArtifactResult

use of org.eclipse.ceylon.model.cmr.ArtifactResult in project ceylon by eclipse.

the class SmokeTestCase method testOverridesRemoveGlobal.

@Test
public void testOverridesRemoveGlobal() throws Exception {
    RepositoryManager manager = getRepositoryManager("testsuite/src/test/resources/overridesGlobal.xml");
    ArtifactResult result = manager.getArtifactResult(null, "moduletest", "0.1");
    Assert.assertNotNull(result);
    Assert.assertEquals(1, result.dependencies().size());
}
Also used : RepositoryManager(org.eclipse.ceylon.cmr.api.RepositoryManager) SimpleRepositoryManager(org.eclipse.ceylon.cmr.impl.SimpleRepositoryManager) ArtifactResult(org.eclipse.ceylon.model.cmr.ArtifactResult) Test(org.junit.Test)

Aggregations

ArtifactResult (org.eclipse.ceylon.model.cmr.ArtifactResult)79 File (java.io.File)40 RepositoryManager (org.eclipse.ceylon.cmr.api.RepositoryManager)32 SimpleRepositoryManager (org.eclipse.ceylon.cmr.impl.SimpleRepositoryManager)28 Test (org.junit.Test)28 ArtifactContext (org.eclipse.ceylon.cmr.api.ArtifactContext)25 IOException (java.io.IOException)17 ArrayList (java.util.ArrayList)17 CmrRepository (org.eclipse.ceylon.cmr.api.CmrRepository)15 ModuleSpec (org.eclipse.ceylon.common.ModuleSpec)13 FileOutputStream (java.io.FileOutputStream)6 InputStream (java.io.InputStream)5 ToolUsageError (org.eclipse.ceylon.common.tool.ToolUsageError)5 Module (org.eclipse.ceylon.model.typechecker.model.Module)5 LinkedList (java.util.LinkedList)4 List (java.util.List)4 ZipEntry (java.util.zip.ZipEntry)4 FileInputStream (java.io.FileInputStream)3 OutputStream (java.io.OutputStream)3 OutputStreamWriter (java.io.OutputStreamWriter)3