use of org.eclipse.ceylon.cmr.api.ArtifactContext in project ceylon by eclipse.
the class RepoUsingTool method getModuleArtifact.
protected ArtifactResult getModuleArtifact(RepositoryManager repoMgr, String name, String version, ModuleQuery.Type type) {
ArtifactContext ac = new ArtifactContext(null, name, version, type.getSuffixes());
ac.setIgnoreDependencies(true);
ac.setThrowErrorIfMissing(false);
return repoMgr.getArtifactResult(ac);
}
use of org.eclipse.ceylon.cmr.api.ArtifactContext in project ceylon by eclipse.
the class CallbackTestCase method testDefault.
@Test
public void testDefault() throws Exception {
TestArtifactCallback callback = new TestArtifactCallback();
ArtifactContext context = new ArtifactContext(null, name, version);
context.setCallback(callback);
doTest(context, callback);
}
use of org.eclipse.ceylon.cmr.api.ArtifactContext 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());
}
use of org.eclipse.ceylon.cmr.api.ArtifactContext 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
}
use of org.eclipse.ceylon.cmr.api.ArtifactContext in project ceylon by eclipse.
the class SmokeTestCase method testExternalNodes.
@Test
public void testExternalNodes() throws Exception {
RepositoryManagerBuilder builder = getRepositoryManagerBuilder(false, 60000, java.net.Proxy.NO_PROXY);
InMemoryContentStore imcs = new InMemoryContentStore();
OpenNode root = imcs.createRoot();
CmrRepository repo = new DefaultRepository(root);
RepositoryManager manager = builder.addRepository(repo).buildRepository();
// a few impl details, feel free to remove/ignore this test
String name = "org.eclipse.acme";
String version = "1.0.0.CR1";
ArtifactContext context = new ArtifactContext(null, name, version);
// ignore with in-memory
context.setIgnoreSHA(true);
OpenNode parent = repo.createParent(context);
parent.addContent(name + "-" + version + ArtifactContext.CAR, new ByteArrayInputStream("qwerty".getBytes()), context);
try {
File file = manager.getArtifact(context);
Assert.assertNotNull("Failed to retrieve after put", file);
} finally {
manager.removeArtifact(null, name, version);
}
}
Aggregations