use of org.eclipse.ceylon.model.cmr.ArtifactResult in project ceylon by eclipse.
the class SmokeTestCase method testOverridesShareImport.
@Test
public void testOverridesShareImport() throws Exception {
RepositoryManager manager = getRepositoryManager("testsuite/src/test/resources/overridesShareImport.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.exported());
}
use of org.eclipse.ceylon.model.cmr.ArtifactResult 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);
}
use of org.eclipse.ceylon.model.cmr.ArtifactResult in project ceylon by eclipse.
the class SmokeTestCase method testGetMultipleCached.
@Test
public void testGetMultipleCached() 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 artifact1 = new ArtifactContext(null, "ceylon.json", "1.0.0", ArtifactContext.CAR, ArtifactContext.SCRIPTS_ZIPPED, ArtifactContext.JS);
List<ArtifactResult> json1 = manager.getArtifactResults(artifact1);
Assert.assertNotNull("Module 'ceylon.json-1.0.0' not found", json1);
Assert.assertEquals("Expected two artifacts for 'ceylon.json-1.0.0'", 2, json1.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());
ArtifactContext artifact2 = new ArtifactContext(null, "ceylon.json", "1.0.0", ArtifactContext.CAR, ArtifactContext.SCRIPTS_ZIPPED, ArtifactContext.SRC);
List<ArtifactResult> json2 = manager.getArtifactResults(artifact2);
Assert.assertNotNull("Module 'ceylon.json-1.0.0' not found", json2);
Assert.assertEquals("Expected two artifacts for 'ceylon.json-1.0.0'", 2, json2.size());
}
use of org.eclipse.ceylon.model.cmr.ArtifactResult in project ceylon by eclipse.
the class SmokeTestCase method testOverridesReplaceGlobal.
@Test
public void testOverridesReplaceGlobal() throws Exception {
RepositoryManager manager = getRepositoryManager("testsuite/src/test/resources/overridesReplaceGlobal.xml");
ArtifactResult result = manager.getArtifactResult(null, "moduletest", "0.1");
Assert.assertNotNull(result);
Assert.assertEquals("com.acme.helloworld", result.name());
Assert.assertEquals("1.0.0", result.version());
Assert.assertEquals(1, result.dependencies().size());
}
use of org.eclipse.ceylon.model.cmr.ArtifactResult in project ceylon by eclipse.
the class SmokeTestCase method testOptionalOSGi.
@Test
public void testOptionalOSGi() throws Exception {
RepositoryManager manager = getRepositoryManager();
ArtifactContext context = new ArtifactContext(null, "org.osgi.ceylon.optional", "1.0", ArtifactContext.JAR);
try {
Manifest manifest = mockManifest("1.0");
manifest.getMainAttributes().putValue("Require-Bundle", "moduletest;resolution:=optional;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.optional());
} finally {
manager.removeArtifact(context);
}
}
Aggregations