use of org.sonatype.aether.artifact.Artifact 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.artifact.Artifact in project sonatype-aether by sonatype.
the class DefaultArtifactTest method testImmutability.
@Test
public void testImmutability() {
Artifact a = new DefaultArtifact("gid:aid:ext:cls:ver");
assertNotSame(a, a.setFile(new File("file")));
assertNotSame(a, a.setVersion("otherVersion"));
assertNotSame(a, a.setProperties(Collections.singletonMap("key", "value")));
}
use of org.sonatype.aether.artifact.Artifact in project sonatype-aether by sonatype.
the class DefaultArtifactTest method testArtifactType.
@Test
public void testArtifactType() {
DefaultArtifactType type = new DefaultArtifactType("typeId", "typeExt", "typeCls", "typeLang", true, true);
Artifact a = new DefaultArtifact("gid", "aid", null, null, null, null, type);
assertEquals("typeExt", a.getExtension());
assertEquals("typeCls", a.getClassifier());
assertEquals("typeLang", a.getProperties().get(ArtifactProperties.LANGUAGE));
assertEquals("typeId", a.getProperties().get(ArtifactProperties.TYPE));
assertEquals("true", a.getProperties().get(ArtifactProperties.INCLUDES_DEPENDENCIES));
assertEquals("true", a.getProperties().get(ArtifactProperties.CONSTITUTES_BUILD_PATH));
a = new DefaultArtifact("gid", "aid", "cls", "ext", "ver", null, type);
assertEquals("ext", a.getExtension());
assertEquals("cls", a.getClassifier());
assertEquals("typeLang", a.getProperties().get(ArtifactProperties.LANGUAGE));
assertEquals("typeId", a.getProperties().get(ArtifactProperties.TYPE));
assertEquals("true", a.getProperties().get(ArtifactProperties.INCLUDES_DEPENDENCIES));
assertEquals("true", a.getProperties().get(ArtifactProperties.CONSTITUTES_BUILD_PATH));
Map<String, String> props = new HashMap<String, String>();
props.put("someNonStandardProperty", "someNonStandardProperty");
a = new DefaultArtifact("gid", "aid", "cls", "ext", "ver", props, type);
assertEquals("ext", a.getExtension());
assertEquals("cls", a.getClassifier());
assertEquals("typeLang", a.getProperties().get(ArtifactProperties.LANGUAGE));
assertEquals("typeId", a.getProperties().get(ArtifactProperties.TYPE));
assertEquals("true", a.getProperties().get(ArtifactProperties.INCLUDES_DEPENDENCIES));
assertEquals("true", a.getProperties().get(ArtifactProperties.CONSTITUTES_BUILD_PATH));
assertEquals("someNonStandardProperty", a.getProperties().get("someNonStandardProperty"));
props = new HashMap<String, String>();
props.put("someNonStandardProperty", "someNonStandardProperty");
props.put(ArtifactProperties.CONSTITUTES_BUILD_PATH, "rubbish");
props.put(ArtifactProperties.INCLUDES_DEPENDENCIES, "rubbish");
a = new DefaultArtifact("gid", "aid", "cls", "ext", "ver", props, type);
assertEquals("ext", a.getExtension());
assertEquals("cls", a.getClassifier());
assertEquals("typeLang", a.getProperties().get(ArtifactProperties.LANGUAGE));
assertEquals("typeId", a.getProperties().get(ArtifactProperties.TYPE));
assertEquals("rubbish", a.getProperties().get(ArtifactProperties.INCLUDES_DEPENDENCIES));
assertEquals("rubbish", a.getProperties().get(ArtifactProperties.CONSTITUTES_BUILD_PATH));
assertEquals("someNonStandardProperty", a.getProperties().get("someNonStandardProperty"));
}
use of org.sonatype.aether.artifact.Artifact in project sonatype-aether by sonatype.
the class DefaultArtifactTest method testPropertiesCopied.
@Test
public void testPropertiesCopied() {
Map<String, String> props = new HashMap<String, String>();
props.put("key", "value1");
Artifact a = new DefaultArtifact("gid:aid:1", props);
assertEquals("value1", a.getProperty("key", null));
props.clear();
assertEquals("value1", a.getProperty("key", null));
props.put("key", "value2");
a = a.setProperties(props);
assertEquals("value2", a.getProperty("key", null));
props.clear();
assertEquals("value2", a.getProperty("key", null));
}
use of org.sonatype.aether.artifact.Artifact in project sonatype-aether by sonatype.
the class ArtifacIdUtilsTest method testToVersionlessIdArtifact.
@Test
public void testToVersionlessIdArtifact() {
Artifact artifact = null;
assertSame(null, ArtifacIdUtils.toId(artifact));
artifact = new DefaultArtifact("gid", "aid", "ext", "1");
assertEquals("gid:aid:ext", ArtifacIdUtils.toVersionlessId(artifact));
artifact = new DefaultArtifact("gid", "aid", "cls", "ext", "1");
assertEquals("gid:aid:ext:cls", ArtifacIdUtils.toVersionlessId(artifact));
}
Aggregations