use of org.eclipse.ceylon.cmr.api.RepositoryManagerBuilder in project ceylon by eclipse.
the class BuilderTestCase method testBogusFqn.
@Test(expected = Exception.class)
public void testBogusFqn() throws Exception {
try {
// invalid name
System.setProperty("ceylon.module.resolver.builder", "some.fake.name");
RepositoryManagerBuilder builder = getRepositoryManagerBuilder(false, 60000, java.net.Proxy.NO_PROXY);
assertBuilder(builder, RepositoryManagerBuilderImpl.class);
} finally {
System.clearProperty("ceylon.module.resolver.builder");
}
}
use of org.eclipse.ceylon.cmr.api.RepositoryManagerBuilder in project ceylon by eclipse.
the class BuilderTestCase method testImpl.
@Test
public void testImpl() throws Exception {
try {
System.setProperty("ceylon.module.resolver.builder", org.eclipse.ceylon.test.smoke.support.RepositoryManagerBuilderTester.class.getName());
RepositoryManagerBuilder builder = getRepositoryManagerBuilder(false, 60000, java.net.Proxy.NO_PROXY);
assertBuilder(builder, RepositoryManagerBuilderTester.class);
} finally {
System.clearProperty("ceylon.module.resolver.builder");
}
}
use of org.eclipse.ceylon.cmr.api.RepositoryManagerBuilder in project ceylon by eclipse.
the class CallbackTestCase method doTest.
protected void doTest(ArtifactContext context, TestArtifactCallback callback) throws Exception {
String repoURL = "http://jboss-as7-modules-repository.googlecode.com/svn/trunk/ceylon";
try {
new URL(repoURL).openStream();
} catch (Exception e) {
log.error(String.format("Cannot connect to repo %s - %s", repoURL, e));
// probably not on the internet?
return;
}
RepositoryManagerBuilder builder = getRepositoryManagerBuilder(false, 60000, java.net.Proxy.NO_PROXY);
RemoteContentStore rcs = new RemoteContentStore(repoURL, log, false, 60000, java.net.Proxy.NO_PROXY);
CmrRepository repo = new DefaultRepository(rcs.createRoot());
RepositoryManager manager = builder.addRepository(repo).buildRepository();
try {
File file = manager.getArtifact(context);
Assert.assertNotNull(file);
Assert.assertTrue(callback.size > 0);
Assert.assertEquals(callback.size, callback.current);
} catch (Exception re) {
Assert.assertNotNull(callback.ts);
Assert.assertNotNull(callback.err);
Assert.assertEquals(callback.ts, callback.err.getMessage());
} finally {
manager.removeArtifact(null, name, version);
// test if remove really works
testSearchResults("org.eclipse.fizbiz", ModuleQuery.Type.JVM, new ModuleSearchResult.ModuleDetails[0]);
}
}
use of org.eclipse.ceylon.cmr.api.RepositoryManagerBuilder 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.RepositoryManagerBuilder in project ceylon by eclipse.
the class SmokeTestCase method testRemoteContent.
@Test
public void testRemoteContent() throws Exception {
String repoURL = "http://jboss-as7-modules-repository.googlecode.com/svn/trunk/ceylon";
try {
new URL(repoURL).openStream();
} catch (Exception e) {
log.error(String.format("Cannot connect to repo %s - %s", repoURL, e));
// probably not on the internet?
return;
}
RepositoryManagerBuilder builder = getRepositoryManagerBuilder(false, 60000, java.net.Proxy.NO_PROXY);
RemoteContentStore rcs = new RemoteContentStore(repoURL, log, false, 60000, java.net.Proxy.NO_PROXY);
CmrRepository repo = new DefaultRepository(rcs.createRoot());
RepositoryManager manager = builder.addRepository(repo).buildRepository();
String name = "org.eclipse.fizbiz";
String version = "1.0.0.Beta1";
File file = null;
File originFile = null;
try {
file = manager.getArtifact(null, name, version);
Assert.assertNotNull(file);
originFile = new File(file.getAbsolutePath() + ".origin");
Assert.assertNotNull(originFile);
try {
String line;
try (BufferedReader reader = new BufferedReader(new FileReader(originFile))) {
line = reader.readLine();
}
assertEquals(repoURL, line);
} catch (IOException ignored) {
}
} finally {
manager.removeArtifact(null, name, version);
// test if remove really works
if (file != null)
assertFalse(file.exists());
if (originFile != null)
assertFalse(originFile.exists());
testSearchResults("org.eclipse.fizbiz", Type.JVM, new ModuleDetails[0]);
}
}
Aggregations