Search in sources :

Example 26 with ArtifactDescriptor

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

the class GAVArtifactDescriptorTest method testDeserializationWithClassifierAndExt.

@Test
public void testDeserializationWithClassifierAndExt() {
    ArtifactDescriptor input = createP2Descriptor();
    setGAVProperties(input);
    input.setProperty("maven-classifier", OTHER_CLASSIFIER);
    input.setProperty("maven-extension", OTHER_EXTENSION);
    subject = new GAVArtifactDescriptor(input);
    assertThat(subject.getMavenCoordinates(), is(new MavenRepositoryCoordinates(TEST_GAV, OTHER_CLASSIFIER, OTHER_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 27 with ArtifactDescriptor

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

the class LocalArtifactRepositoryTest method getMavenLocationWithClassifierAndExtension.

@Test
public void getMavenLocationWithClassifierAndExtension() {
    LocalArtifactRepository repo = new LocalArtifactRepository(localRepoIndices);
    ArtifactDescriptor desc = newBundleArtifactDescriptor(true);
    Assert.assertEquals(new File(baseDir, "group/org.eclipse.tycho.test.maven/1.0.0/org.eclipse.tycho.test.maven-1.0.0.jar"), repo.internalGetArtifactStorageLocation(desc));
    desc.setProperty(RepositoryLayoutHelper.PROP_CLASSIFIER, "classifier.value");
    Assert.assertEquals(new File(baseDir, "group/org.eclipse.tycho.test.maven/1.0.0/org.eclipse.tycho.test.maven-1.0.0-classifier.value.jar"), repo.internalGetArtifactStorageLocation(desc));
    desc.setProperty(RepositoryLayoutHelper.PROP_EXTENSION, "zip");
    Assert.assertEquals(new File(baseDir, "group/org.eclipse.tycho.test.maven/1.0.0/org.eclipse.tycho.test.maven-1.0.0-classifier.value.zip"), repo.internalGetArtifactStorageLocation(desc));
    desc.setProperty(RepositoryLayoutHelper.PROP_CLASSIFIER, null);
    Assert.assertEquals(new File(baseDir, "group/org.eclipse.tycho.test.maven/1.0.0/org.eclipse.tycho.test.maven-1.0.0.zip"), repo.internalGetArtifactStorageLocation(desc));
}
Also used : ArtifactDescriptor(org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor) IArtifactDescriptor(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor) File(java.io.File) Test(org.junit.Test)

Example 28 with ArtifactDescriptor

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

the class LocalArtifactRepositoryTest method getP2Location.

@Test
public void getP2Location() {
    LocalArtifactRepository repo = new LocalArtifactRepository(localRepoIndices);
    ArtifactDescriptor desc = newBundleArtifactDescriptor(false);
    Assert.assertEquals(new File(baseDir, "p2/osgi/bundle/org.eclipse.tycho.test.p2/1.0.0/org.eclipse.tycho.test.p2-1.0.0.jar"), repo.internalGetArtifactStorageLocation(desc));
    ProcessingStepDescriptor[] steps = new ProcessingStepDescriptor[] { new ProcessingStepDescriptor("org.eclipse.equinox.p2.processing.Pack200Unpacker", null, true) };
    desc.setProcessingSteps(steps);
    desc.setProperty(IArtifactDescriptor.FORMAT, "packed");
    Assert.assertEquals(new File(baseDir, "p2/osgi/bundle/org.eclipse.tycho.test.p2/1.0.0/org.eclipse.tycho.test.p2-1.0.0-pack200.jar.pack.gz"), repo.internalGetArtifactStorageLocation(desc));
}
Also used : ArtifactDescriptor(org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor) IArtifactDescriptor(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor) ProcessingStepDescriptor(org.eclipse.equinox.p2.repository.artifact.spi.ProcessingStepDescriptor) File(java.io.File) Test(org.junit.Test)

Example 29 with ArtifactDescriptor

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

the class LocalArtifactRepositoryTest method testGetRawArtifactDummy.

@Test
public void testGetRawArtifactDummy() throws ProvisionException, IOException {
    LocalArtifactRepository repo = new LocalArtifactRepository(localRepoIndices);
    ArtifactDescriptor p2Artifact = newBundleArtifactDescriptor(false);
    byte[] content = new byte[] { 111, 112 };
    writeDummyArtifact(repo, p2Artifact, content);
    Assert.assertTrue(repo.contains(p2Artifact.getArtifactKey()));
    ByteArrayOutputStream destination = new ByteArrayOutputStream();
    repo.getRawArtifact(p2Artifact, destination, new NullProgressMonitor());
    Assert.assertArrayEquals(content, destination.toByteArray());
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) ArtifactDescriptor(org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor) IArtifactDescriptor(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor) ByteArrayOutputStream(java.io.ByteArrayOutputStream) 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