use of org.eclipse.ceylon.cmr.api.ArtifactContext in project ceylon by eclipse.
the class SmokeTestCase method testPropertiesPut.
@Test
public void testPropertiesPut() throws Exception {
RepositoryManager manager = getRepositoryManager();
ArtifactContext context = new ArtifactContext(null, "org.acme.props", "1.0", ArtifactContext.JAR);
try {
manager.putArtifact(context, mockJar("someentry", "qwerty".getBytes()));
manager.putArtifact(context.getModuleProperties(), new ByteArrayInputStream("moduletest=0.1\n".getBytes()));
File file = manager.getArtifact(context);
Assert.assertNotNull(file);
} finally {
manager.removeArtifact(context);
}
}
use of org.eclipse.ceylon.cmr.api.ArtifactContext in project ceylon by eclipse.
the class SmokeTestCase method testForcedPut.
@Test
public void testForcedPut() throws Exception {
RepositoryManager manager = getRepositoryManager();
ByteArrayInputStream baos = new ByteArrayInputStream("qwerty".getBytes());
String name = "org.eclipse.foobar2";
String version = "1.0.0.Alpha1";
try {
ArtifactContext context = new ArtifactContext();
context.setName(name);
context.setVersion(version);
context.setForceOperation(true);
manager.putArtifact(context, baos);
File file = manager.getArtifact(null, name, version);
Assert.assertNotNull("Failed to retrieve after put", file);
baos = new ByteArrayInputStream("ytrewq".getBytes());
manager.putArtifact(context, baos);
file = manager.getArtifact(null, name, version);
Assert.assertNotNull("Failed to retrieve after forced put", file);
} finally {
manager.removeArtifact(null, name, version);
}
}
use of org.eclipse.ceylon.cmr.api.ArtifactContext in project ceylon by eclipse.
the class SmokeTestCase method testPropertiesResolver.
@Test
public void testPropertiesResolver() throws Exception {
RepositoryManager manager = getRepositoryManager();
ArtifactContext context = new ArtifactContext(null, "old-jar", "1.2.CR1", ArtifactContext.JAR);
File file = manager.getArtifact(context);
Assert.assertNotNull(file);
}
use of org.eclipse.ceylon.cmr.api.ArtifactContext in project ceylon by eclipse.
the class AetherRepository method toModuleName.
@Override
protected String toModuleName(Node node) {
ArtifactContext context = ArtifactContext.fromNode(node);
if (context != null) {
return context.getName();
}
String moduleName = node.getLabel();
Node parent = NodeUtils.firstParent(node);
String groupId = NodeUtils.getFullPath(parent, ".");
// That's sort of an invariant, but let's be safe
if (groupId.startsWith("."))
groupId = groupId.substring(1);
moduleName = groupId != null ? groupId + ":" + moduleName : moduleName;
return moduleName;
}
use of org.eclipse.ceylon.cmr.api.ArtifactContext in project ceylon by eclipse.
the class AetherUtils method findDependencies.
private ArtifactResult findDependencies(RepositoryManager manager, Node node, Boolean fetchSingleArtifact) {
final ArtifactContext ac = ArtifactContext.fromNode(node);
if (ac == null)
return null;
final String name = ac.getName();
String[] groupArtifactIds = nameToGroupArtifactIds(name);
if (groupArtifactIds == null) {
return null;
}
String groupId = groupArtifactIds[0];
String artifactId = groupArtifactIds[1];
String classifier = groupArtifactIds[2];
String version = ac.getVersion();
String repositoryDisplayString = NodeUtils.getRepositoryDisplayString(node);
CmrRepository repository = NodeUtils.getRepository(node);
if (CeylonUtils.arrayContains(ac.getSuffixes(), ArtifactContext.LEGACY_SRC)) {
classifier = "sources";
}
return fetchDependencies(manager, repository, groupId, artifactId, classifier, version, fetchSingleArtifact != null ? fetchSingleArtifact : ac.isIgnoreDependencies(), repositoryDisplayString);
}
Aggregations