Search in sources :

Example 6 with IArtifactDescriptor

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

the class FeatureRootfileArtifactRepositoryTest method testRepoWithAttachedArtifactsAndConfigurations.

@Test
public void testRepoWithAttachedArtifactsAndConfigurations() throws Exception {
    FeatureRootfileArtifactRepository subject = new FeatureRootfileArtifactRepository(createPublisherInfo(true), tempFolder.newFolder("testrootfiles"));
    IArtifactDescriptor artifactDescriptor = createArtifactDescriptor(PublisherHelper.BINARY_ARTIFACT_CLASSIFIER, "org.eclipse.tycho.test.p2.win32.win32.x86");
    subject.getOutputStream(artifactDescriptor).close();
    assertAttachedArtifact(subject.getPublishedArtifacts(), 1, "root.win32.win32.x86", "org.eclipse.tycho.test.p2.win32.win32.x86-1.0.0-root.zip");
    Set<IArtifactDescriptor> artifactDescriptors = subject.getArtifactDescriptors();
    Assert.assertEquals(1, artifactDescriptors.size());
    IArtifactDescriptor descriptor = artifactDescriptors.iterator().next();
    assertMavenProperties(descriptor, "root.win32.win32.x86");
}
Also used : IArtifactDescriptor(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor) FeatureRootAdviceTest(org.eclipse.tycho.p2.impl.publisher.rootfiles.FeatureRootAdviceTest) Test(org.junit.Test)

Example 7 with IArtifactDescriptor

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

the class FeatureRootfileArtifactRepositoryTest method testRepoWithoutMavenAdvice.

@Test(expected = ProvisionException.class)
public void testRepoWithoutMavenAdvice() throws Exception {
    FeatureRootfileArtifactRepository subject = new FeatureRootfileArtifactRepository(createPublisherInfo(false), tempFolder.newFolder("testrootfiles"));
    IArtifactDescriptor artifactDescriptor = createArtifactDescriptor(PublisherHelper.BINARY_ARTIFACT_CLASSIFIER, "org.eclipse.tycho.test.p2");
    subject.getOutputStream(artifactDescriptor).close();
}
Also used : IArtifactDescriptor(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor) FeatureRootAdviceTest(org.eclipse.tycho.p2.impl.publisher.rootfiles.FeatureRootAdviceTest) Test(org.junit.Test)

Example 8 with IArtifactDescriptor

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

the class FeatureRootfileArtifactRepositoryTest method testRepoWithAttachedArtifacts.

@Test
public void testRepoWithAttachedArtifacts() throws Exception {
    FeatureRootfileArtifactRepository subject = new FeatureRootfileArtifactRepository(createPublisherInfo(true), tempFolder.newFolder("testrootfiles"));
    IArtifactDescriptor artifactDescriptor = createArtifactDescriptor(PublisherHelper.BINARY_ARTIFACT_CLASSIFIER, "org.eclipse.tycho.test.p2");
    subject.getOutputStream(artifactDescriptor).close();
    assertAttachedArtifact(subject.getPublishedArtifacts(), 1, "root", "org.eclipse.tycho.test.p2-1.0.0-root.zip");
    Set<IArtifactDescriptor> artifactDescriptors = subject.getArtifactDescriptors();
    Assert.assertEquals(1, artifactDescriptors.size());
    IArtifactDescriptor descriptor = artifactDescriptors.iterator().next();
    assertMavenProperties(descriptor, "root");
}
Also used : IArtifactDescriptor(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor) FeatureRootAdviceTest(org.eclipse.tycho.p2.impl.publisher.rootfiles.FeatureRootAdviceTest) Test(org.junit.Test)

Example 9 with IArtifactDescriptor

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

the class AbstractArtifactRepository2 method getArtifact.

// implementations for old get(Raw)Artifact methods
/**
 * {@inheritDoc}
 *
 * @deprecated Obsolete. Use {@link #getArtifact(IArtifactSink, IProgressMonitor)} instead.
 */
// TODO make final?
@Override
@Deprecated
public IStatus getArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) {
    try {
        // use any format for getting the canonical artifact
        IArtifactKey requestedKey = descriptor.getArtifactKey();
        IStatus status = getArtifact(writeToStream(requestedKey, destination), monitor);
        setStatusOnStreamIfPossible(destination, status);
        return status;
    } catch (ArtifactSinkException e) {
        // the sink used shouldn't throw this exception
        return new Status(IStatus.ERROR, BUNDLE_ID, e.getMessage(), e);
    }
}
Also used : MultiStatus(org.eclipse.core.runtime.MultiStatus) Status(org.eclipse.core.runtime.Status) IStatus(org.eclipse.core.runtime.IStatus) IArtifactKey(org.eclipse.equinox.p2.metadata.IArtifactKey) IStatus(org.eclipse.core.runtime.IStatus) ArtifactSinkException(org.eclipse.tycho.repository.p2base.artifact.provider.streaming.ArtifactSinkException)

Example 10 with IArtifactDescriptor

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

the class ArtifactRepositoryBaseImpl method getRawArtifact.

@Override
public final IStatus getRawArtifact(IRawArtifactSink sink, IProgressMonitor monitor) throws ArtifactSinkException {
    canWriteToSink(sink);
    IArtifactDescriptor descriptor = sink.getArtifactFormatToBeWritten();
    if (!contains(descriptor)) {
        return errorStatus("Artifact " + descriptor + " is not available in the repository " + getLocation(), null, ProvisionException.ARTIFACT_NOT_FOUND);
    }
    IStatus status = readRawArtifact(descriptor, sink.beginWrite());
    closeSinkAccordingToStatus(sink, status);
    return status;
}
Also used : IArtifactDescriptor(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor) IStatus(org.eclipse.core.runtime.IStatus)

Aggregations

IArtifactDescriptor (org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor)32 Test (org.junit.Test)16 File (java.io.File)9 IStatus (org.eclipse.core.runtime.IStatus)8 IArtifactKey (org.eclipse.equinox.p2.metadata.IArtifactKey)7 IInstallableUnit (org.eclipse.equinox.p2.metadata.IInstallableUnit)6 OutputStream (java.io.OutputStream)5 ArtifactDescriptor (org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor)5 IOException (java.io.IOException)4 IArtifactRepository (org.eclipse.equinox.p2.repository.artifact.IArtifactRepository)4 FeatureRootAdviceTest (org.eclipse.tycho.p2.impl.publisher.rootfiles.FeatureRootAdviceTest)4 ArtifactsIO (org.eclipse.tycho.p2.maven.repository.xmlio.ArtifactsIO)4 IP2Artifact (org.eclipse.tycho.p2.metadata.IP2Artifact)4 BufferedOutputStream (java.io.BufferedOutputStream)3 FileOutputStream (java.io.FileOutputStream)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 FileInputStream (java.io.FileInputStream)2 ArrayList (java.util.ArrayList)2 LinkedHashMap (java.util.LinkedHashMap)2 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)2