use of org.apache.ivy.core.module.descriptor.Artifact in project gradle by gradle.
the class DefaultArtifactPomTest method cannotAddMultipleArtifactsWithTheSameTypeAndClassifier.
@Test
public void cannotAddMultipleArtifactsWithTheSameTypeAndClassifier() {
// No classifier
Artifact mainArtifact = createTestArtifact("someName", null);
artifactPom.addArtifact(mainArtifact, new File("someFile"));
assertIsDuplicate(mainArtifact, new File("someFile"));
assertIsDuplicate(mainArtifact, new File("otherFile"));
assertIsDuplicate(createTestArtifact("otherName", null), new File("otherFile"));
// Classifier
Artifact classifierArtifact = createTestArtifact("someName", "classifier");
artifactPom.addArtifact(classifierArtifact, new File("classifierFile"));
assertIsDuplicate(classifierArtifact, new File("someFile"));
assertIsDuplicate(classifierArtifact, new File("otherFile"));
assertIsDuplicate(createTestArtifact("otherName", "classifier"), new File("otherFile"));
}
use of org.apache.ivy.core.module.descriptor.Artifact in project gradle by gradle.
the class DefaultArtifactPomTest method pomWithMainArtifactAndMetadataArtifacts.
@Test
public void pomWithMainArtifactAndMetadataArtifacts() {
Artifact mainArtifact = createTestArtifact("someName", null, "mainPackaging");
File mainFile = new File("someFile");
File metadataFile = new File("someMetadataFile");
Artifact metadataArtifact = createTestArtifact("otherName", null, "sometype");
artifactPom.addArtifact(mainArtifact, mainFile);
artifactPom.addArtifact(metadataArtifact, metadataFile);
assertThat(artifactPom.getArtifact().getName(), equalTo("someName"));
assertThat(artifactPom.getArtifact().getExtension(), equalTo("mainPackaging"));
assertThat(artifactPom.getArtifact().getType(), equalTo("mainPackaging"));
assertThat(artifactPom.getArtifact().getClassifier(), nullValue());
assertThat(artifactPom.getArtifact().getFile(), equalTo(mainFile));
PublishArtifact artifact = singleItem(artifactPom.getAttachedArtifacts());
assertThat(artifact.getName(), equalTo("someName"));
assertThat(artifact.getExtension(), equalTo("sometype"));
assertThat(artifact.getType(), equalTo("sometype"));
assertThat(artifact.getClassifier(), nullValue());
assertThat(artifact.getFile(), equalTo(metadataFile));
assertThat(artifactPom.getPom().getGroupId(), equalTo("org"));
assertThat(artifactPom.getPom().getArtifactId(), equalTo("someName"));
assertThat(artifactPom.getPom().getVersion(), equalTo("1.0"));
assertThat(artifactPom.getPom().getPackaging(), equalTo("mainPackaging"));
}
use of org.apache.ivy.core.module.descriptor.Artifact in project gradle by gradle.
the class DefaultArtifactPomTest method addMainArtifactTwiceShouldThrowInvalidUserDataEx.
@Test(expected = InvalidUserDataException.class)
public void addMainArtifactTwiceShouldThrowInvalidUserDataEx() {
Artifact mainArtifact = createTestArtifact("someName", null, "mainPackaging");
File mainFile = new File("someFile");
artifactPom.addArtifact(mainArtifact, mainFile);
artifactPom.addArtifact(mainArtifact, mainFile);
}
use of org.apache.ivy.core.module.descriptor.Artifact in project gradle by gradle.
the class DefaultArtifactPomTest method pomWithClassifierArtifactsOnly.
@Test
public void pomWithClassifierArtifactsOnly() {
File classifierFile = new File("someClassifierFile");
Artifact classifierArtifact = createTestArtifact("someName", "javadoc", "zip");
artifactPom.addArtifact(classifierArtifact, classifierFile);
assertThat(artifactPom.getArtifact(), nullValue());
PublishArtifact artifact = singleItem(artifactPom.getAttachedArtifacts());
assertThat(artifact.getName(), equalTo("someName"));
assertThat(artifact.getExtension(), equalTo("zip"));
assertThat(artifact.getType(), equalTo("zip"));
assertThat(artifact.getClassifier(), equalTo("javadoc"));
assertThat(artifact.getFile(), equalTo(classifierFile));
assertThat(artifactPom.getPom().getGroupId(), equalTo("org"));
assertThat(artifactPom.getPom().getArtifactId(), equalTo("someName"));
assertThat(artifactPom.getPom().getVersion(), equalTo("1.0"));
assertThat(artifactPom.getPom().getPackaging(), equalTo("jar"));
}
Aggregations