Search in sources :

Example 1 with ArtifactDescriptor

use of org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor in project tycho by eclipse.

the class GAVArtifactDescriptorTest method testExplicitCoordinatesOverwritesProperties.

@Test
public void testExplicitCoordinatesOverwritesProperties() {
    ArtifactDescriptor input = createP2Descriptor();
    setGAVProperties(input);
    input.setProperty("maven-classifier", OTHER_CLASSIFIER);
    input.setProperty("maven-extension", OTHER_EXTENSION);
    MavenRepositoryCoordinates explicitCoordinatesWithDefaults = new MavenRepositoryCoordinates(TEST_GAV, DEFAULT_CLASSIFIER, DEFAULT_EXTENSION);
    GAVArtifactDescriptor original = new GAVArtifactDescriptor(input, explicitCoordinatesWithDefaults);
    subject = serializeAndDeSerialize(original);
    assertThat(subject.getArtifactKey(), is(TEST_KEY));
    assertThat(subject.getMavenCoordinates(), is(explicitCoordinatesWithDefaults));
}
Also used : MavenRepositoryCoordinates(org.eclipse.tycho.p2.repository.MavenRepositoryCoordinates) IArtifactDescriptor(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor) ArtifactDescriptor(org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor) Test(org.junit.Test)

Example 2 with ArtifactDescriptor

use of org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor in project tycho by eclipse.

the class GAVArtifactDescriptorTest method testDeserializationWithPartialGAV.

@Test
public void testDeserializationWithPartialGAV() {
    ArtifactDescriptor input = createP2Descriptor();
    input.setProperty("maven-groupId", TEST_GAV.getGroupId());
    input.setProperty("maven-artifactId", TEST_GAV.getArtifactId());
    subject = new GAVArtifactDescriptor(input);
    // treated like completely missing properties
    assertThat(subject.getMavenCoordinates(), is(new MavenRepositoryCoordinates("p2.p2.class", "p2.id", "4.3.0.20130614", DEFAULT_CLASSIFIER, DEFAULT_EXTENSION)));
}
Also used : MavenRepositoryCoordinates(org.eclipse.tycho.p2.repository.MavenRepositoryCoordinates) IArtifactDescriptor(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor) ArtifactDescriptor(org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor) Test(org.junit.Test)

Example 3 with ArtifactDescriptor

use of org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor in project tycho by eclipse.

the class GAVArtifactDescriptorTest method serializeAndDeSerialize.

private static GAVArtifactDescriptor serializeAndDeSerialize(GAVArtifactDescriptor original) {
    ArtifactDescriptor serialized = new ArtifactDescriptor(original);
    GAVArtifactDescriptor deserialized = new GAVArtifactDescriptor(serialized);
    return deserialized;
}
Also used : IArtifactDescriptor(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor) ArtifactDescriptor(org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor)

Example 4 with ArtifactDescriptor

use of org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor in project tycho by eclipse.

the class GAVArtifactDescriptorTest method testDeserialization.

@Test
public void testDeserialization() {
    // parsing to p2's implementation of IArtifactDescriptor is done elsewhere, so assume this is the input
    ArtifactDescriptor input = createP2Descriptor();
    input.setProperty("maven-groupId", TEST_GAV.getGroupId());
    input.setProperty("maven-artifactId", TEST_GAV.getArtifactId());
    input.setProperty("maven-version", TEST_GAV.getVersion());
    subject = new GAVArtifactDescriptor(input);
    assertThat(subject.getArtifactKey(), is(TEST_KEY));
    assertThat(subject.getMavenCoordinates(), is(new MavenRepositoryCoordinates(TEST_GAV, DEFAULT_CLASSIFIER, DEFAULT_EXTENSION)));
}
Also used : MavenRepositoryCoordinates(org.eclipse.tycho.p2.repository.MavenRepositoryCoordinates) IArtifactDescriptor(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor) ArtifactDescriptor(org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor) Test(org.junit.Test)

Example 5 with ArtifactDescriptor

use of org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor in project tycho by eclipse.

the class GAVArtifactDescriptorTest method testCreationFromPlainP2Descriptor.

@Test
public void testCreationFromPlainP2Descriptor() {
    ArtifactDescriptor input = createP2Descriptor();
    // no maven properties set
    subject = new GAVArtifactDescriptor(input);
    assertThat(subject.getArtifactKey(), is(TEST_KEY));
    assertThat(subject.getMavenCoordinates(), is(new MavenRepositoryCoordinates("p2.p2.class", "p2.id", "4.3.0.20130614", DEFAULT_CLASSIFIER, DEFAULT_EXTENSION)));
}
Also used : MavenRepositoryCoordinates(org.eclipse.tycho.p2.repository.MavenRepositoryCoordinates) IArtifactDescriptor(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor) ArtifactDescriptor(org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor) Test(org.junit.Test)

Aggregations

IArtifactDescriptor (org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor)29 ArtifactDescriptor (org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor)25 Test (org.junit.Test)22 File (java.io.File)8 MavenRepositoryCoordinates (org.eclipse.tycho.p2.repository.MavenRepositoryCoordinates)8 FeatureRootAdviceTest (org.eclipse.tycho.p2.impl.publisher.rootfiles.FeatureRootAdviceTest)4 ArtifactKey (org.eclipse.equinox.internal.p2.metadata.ArtifactKey)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 IArtifactKey (org.eclipse.equinox.p2.metadata.IArtifactKey)2 IInstallableUnit (org.eclipse.equinox.p2.metadata.IInstallableUnit)2 ProcessingStepDescriptor (org.eclipse.equinox.p2.repository.artifact.spi.ProcessingStepDescriptor)2 IP2Artifact (org.eclipse.tycho.p2.metadata.IP2Artifact)2 BufferedOutputStream (java.io.BufferedOutputStream)1 FileInputStream (java.io.FileInputStream)1 FileOutputStream (java.io.FileOutputStream)1 IOException (java.io.IOException)1 OutputStream (java.io.OutputStream)1 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 IStatus (org.eclipse.core.runtime.IStatus)1