use of org.eclipse.ceylon.cmr.api.RepositoryManager 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.cmr.api.RepositoryManager 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);
}
}
use of org.eclipse.ceylon.cmr.api.RepositoryManager in project ceylon by eclipse.
the class SmokeTestCase method testPropertiesGet.
@Test
public void testPropertiesGet() throws Exception {
RepositoryManagerBuilder builder = getRepositoryManagerBuilder(false, 60000, java.net.Proxy.NO_PROXY);
RepositoryBuilder rb = builder.repositoryBuilder();
CmrRepository[] repositories = rb.buildRepository(Constants.REPO_URL_CEYLON);
for (CmrRepository repo : repositories) {
builder.addRepository(repo);
}
RepositoryManager manager = builder.buildRepository();
ArtifactContext context = new ArtifactContext(null, "io.undertow.core", "1.0.0.Alpha1-9fdfd5f766", ArtifactContext.JAR);
try {
File artifact = manager.getArtifact(context);
Assert.assertNotNull(artifact);
File mp = new File(artifact.getParent(), ArtifactContext.MODULE_PROPERTIES);
Assert.assertNotNull(mp.exists());
} finally {
manager.removeArtifact(context);
}
}
use of org.eclipse.ceylon.cmr.api.RepositoryManager in project ceylon by eclipse.
the class AetherTestCase method testAetherFetchingDependenciesWithUselessProperties.
@Test
public void testAetherFetchingDependenciesWithUselessProperties() throws Throwable {
CmrRepository repository = AetherRepository.createRepository(log, false, 60000);
RepositoryManager manager = new SimpleRepositoryManager(repository, log);
ArtifactResult result = manager.getArtifactResult(MavenArtifactContext.NAMESPACE, "org.springframework.cloud:spring-cloud-starter-eureka", "1.1.2.RELEASE");
Assert.assertNotNull(result);
File artifact = result.artifact();
boolean exists = false;
try {
Assert.assertNotNull(artifact);
Assert.assertTrue(artifact.exists());
exists = true;
List<ArtifactResult> deps = result.dependencies();
Assert.assertEquals(10, deps.size());
log.debug("deps = " + deps);
} finally {
if (exists) {
// delete this one
Assert.assertTrue(artifact.delete());
}
}
}
use of org.eclipse.ceylon.cmr.api.RepositoryManager in project ceylon by eclipse.
the class AetherTestCase method testFilterOverrides.
@Test
public void testFilterOverrides() throws Throwable {
CmrRepository repository = createAetherRepository();
RepositoryManager manager = new SimpleRepositoryManager(repository, log, RepositoryManagerBuilder.parseOverrides(getOverridesFileName()));
ArtifactResult result = manager.getArtifactResult(MavenArtifactContext.NAMESPACE, "org.osgi:org.osgi.core", "4.0.0");
Assert.assertNotNull(result);
Assert.assertEquals(result.name(), "org.osgi:org.osgi.core");
File artifact = result.artifact();
boolean exists = false;
try {
Assert.assertNotNull(artifact);
Assert.assertTrue(artifact.exists());
exists = true;
Assert.assertNotNull(result.filter());
Assert.assertTrue(result.filter().accept("org/osgi/test"));
Assert.assertFalse(result.filter().accept("org/eclipse/test"));
} finally {
if (exists) {
// delete this one
Assert.assertTrue(artifact.delete());
}
}
}
Aggregations