use of org.eclipse.ceylon.cmr.api.CmrRepository 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.CmrRepository 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());
}
}
}
use of org.eclipse.ceylon.cmr.api.CmrRepository in project ceylon by eclipse.
the class AetherTestCase method testListVersionsAether.
@Test
public void testListVersionsAether() throws Exception {
CmrRepository repository = createAetherRepository();
RepositoryManager manager = new SimpleRepositoryManager(repository, log);
ModuleVersionQuery lookup = new ModuleVersionQuery("com.sparkjava:spark-core", "1.", Type.JAR);
ModuleVersionResult result = manager.completeVersions(lookup);
Assert.assertEquals(3, result.getVersions().size());
Assert.assertNotNull(result.getVersions().get("1.0"));
Assert.assertNotNull(result.getVersions().get("1.1"));
Assert.assertNotNull(result.getVersions().get("1.1.1"));
for (ModuleVersionDetails res : result.getVersions().values()) {
Assert.assertEquals("Spark\nA Sinatra inspired java web framework\nhttp://www.sparkjava.com", res.getDoc());
Assert.assertEquals("The Apache Software License, Version 2.0\nhttp://www.apache.org/licenses/LICENSE-2.0.txt", res.getLicense());
NavigableSet<ModuleDependencyInfo> deps = res.getDependencies();
List<ModuleDependencyInfo> compileDeps = new ArrayList<>(deps.size());
for (ModuleDependencyInfo dep : res.getDependencies()) {
if (dep.getModuleScope() == ModuleScope.COMPILE || dep.getModuleScope() == ModuleScope.PROVIDED)
compileDeps.add(dep);
}
Assert.assertEquals(4, compileDeps.size());
}
lookup = new ModuleVersionQuery("com.sparkjava:spark-core", null, Type.JAR);
result = manager.completeVersions(lookup);
// Count the version up to 2.3
int cnt = 0;
for (ModuleVersionDetails mvd : result.getVersions().values()) {
cnt++;
if ("2.3".equals(mvd.getVersion())) {
break;
}
}
Assert.assertEquals(7, cnt);
// now check that we only downloaded the POMs for that, and not the jars
File repo = new File("build/test-classes/maven-settings/repository");
File folder = new File(repo, "com/sparkjava/spark-core/1.0");
Assert.assertTrue(new File(folder, "spark-core-1.0.pom").exists());
Assert.assertFalse(new File(folder, "spark-core-1.0.jar").exists());
Assert.assertFalse(new File(repo, "org/eclipse/jetty/jetty-server/9.0.2.v20130417/jetty-server-9.0.2.v20130417.jar").exists());
// this one has a conflict if we do resolve it non-lazily
lookup = new ModuleVersionQuery("org.hibernate:hibernate-validator", "3.", Type.JAR);
result = manager.completeVersions(lookup);
Assert.assertEquals(4, result.getVersions().size());
}
use of org.eclipse.ceylon.cmr.api.CmrRepository in project ceylon by eclipse.
the class AetherTestCase method testReplaceOverrides.
@Test
public void testReplaceOverrides() throws Throwable {
CmrRepository repository = createAetherRepository();
RepositoryManager manager = new SimpleRepositoryManager(repository, log, RepositoryManagerBuilder.parseOverrides(getOverridesFileName()));
ArtifactResult result = manager.getArtifactResult(MavenArtifactContext.NAMESPACE, "org.apache.camel:camel-core", "2.9.2");
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;
List<ArtifactResult> deps = result.dependencies();
Assert.assertEquals(deps.size(), 0);
} finally {
if (exists) {
// delete this one
Assert.assertTrue(artifact.delete());
}
}
}
use of org.eclipse.ceylon.cmr.api.CmrRepository in project ceylon by eclipse.
the class ResolverTestCase method testMavenDependecyResolver.
@Test
public void testMavenDependecyResolver() throws Exception {
final MavenDependencyResolver resolver = new MavenDependencyResolver();
doTest(new Tester() {
public void run(CmrRepository repository, final File artifact) {
ModuleInfo infos = resolver.resolve(new TestArtifactResult(repository, "org.apache.camel:camel-core", "2.9.2", artifact), null);
Assert.assertNotNull(infos);
Assert.assertEquals(String.valueOf(infos), 3, infos.getDependencies().size());
}
});
}
Aggregations