use of org.sonatype.aether.test.util.impl.StubArtifact in project sonatype-aether by sonatype.
the class NodeBuilder method reloc.
public NodeBuilder reloc(String artifactId) {
Artifact relocation = new StubArtifact(groupId, artifactId, classifier, ext, version);
relocations.add(relocation);
return this;
}
use of org.sonatype.aether.test.util.impl.StubArtifact in project sonatype-aether by sonatype.
the class MavenDefaultLayoutTest method testArtifactPath.
@Test
public void testArtifactPath() {
MavenDefaultLayout layout = new MavenDefaultLayout();
URI uri = layout.getPath(new StubArtifact("g.i.d", "a-i.d", "cls", "ext", "1.0"));
assertEquals("g/i/d/a-i.d/1.0/a-i.d-1.0-cls.ext", uri.getPath());
uri = layout.getPath(new StubArtifact("g.i.d", "aid", "", "ext", "1.0"));
assertEquals("g/i/d/aid/1.0/aid-1.0.ext", uri.getPath());
uri = layout.getPath(new StubArtifact("g.i.d", "aid", "", "", "1.0"));
assertEquals("g/i/d/aid/1.0/aid-1.0", uri.getPath());
}
use of org.sonatype.aether.test.util.impl.StubArtifact in project sonatype-aether by sonatype.
the class IniArtifactDataReader method relocations.
private List<Artifact> relocations(List<String> list) {
List<Artifact> ret = new ArrayList<Artifact>();
if (list == null) {
return ret;
}
for (String coords : list) {
ArtifactDefinition def = new ArtifactDefinition(coords);
ret.add(new StubArtifact(def.getGroupId(), def.getArtifactId(), "", def.getExtension(), def.getVersion()));
}
return ret;
}
use of org.sonatype.aether.test.util.impl.StubArtifact in project sonatype-aether by sonatype.
the class IniArtifactDataReader method dependencies.
private List<Dependency> dependencies(List<String> list) {
List<Dependency> ret = new ArrayList<Dependency>();
if (list == null) {
return ret;
}
Collection<Exclusion> exclusions = new ArrayList<Exclusion>();
boolean optional = false;
Artifact artifact = null;
String scope = null;
for (String coords : list) {
if (coords.startsWith("-")) {
coords = coords.substring(1);
String[] split = coords.split(":");
exclusions.add(new Exclusion(split[0], split[1], "", ""));
} else {
if (artifact != null) {
// commit dependency
Dependency dep = new Dependency(artifact, scope, optional, exclusions);
ret.add(dep);
exclusions = new ArrayList<Exclusion>();
}
ArtifactDefinition def = new ArtifactDefinition(coords);
optional = def.isOptional();
scope = "".equals(def.getScope()) ? "compile" : def.getScope();
artifact = new StubArtifact(def.getGroupId(), def.getArtifactId(), "", def.getExtension(), def.getVersion());
}
}
if (artifact != null) {
// commit dependency
Dependency dep = new Dependency(artifact, scope, optional, exclusions);
ret.add(dep);
exclusions = new ArrayList<Exclusion>();
}
return ret;
}
use of org.sonatype.aether.test.util.impl.StubArtifact in project sonatype-aether by sonatype.
the class NodeBuilder method build.
public DependencyNode build() {
Dependency dependency = null;
TestDependencyNode node = new TestDependencyNode();
if (artifactId != null && artifactId.length() > 0) {
Artifact artifact = new StubArtifact(groupId, artifactId, classifier, ext, version, properties);
dependency = new Dependency(artifact, scope, optional);
node.setDependency(dependency);
try {
node.setVersion(versionScheme.parseVersion(version));
node.setVersionConstraint(versionScheme.parseVersionConstraint(range != null ? range : version));
} catch (InvalidVersionSpecificationException e) {
throw new IllegalArgumentException("bad version: " + e.getMessage(), e);
}
}
node.setRequestContext(context);
node.setRelocations(relocations);
return node;
}
Aggregations