Search in sources :

Example 1 with ProbeRawArtifactSink

use of org.eclipse.tycho.repository.streaming.testutil.ProbeRawArtifactSink in project tycho by eclipse.

the class LocalArtifactRepositoryP2APITest method readSizeOfRawArtifact.

private int readSizeOfRawArtifact(IArtifactDescriptor descriptor) throws ArtifactSinkException {
    // don't use the member here because getArtifact is not the method under test here
    ProbeRawArtifactSink temporarySink = newRawArtifactSinkFor(descriptor);
    subject.getRawArtifact(temporarySink, null);
    return temporarySink.committedBytes();
}
Also used : ProbeRawArtifactSink(org.eclipse.tycho.repository.streaming.testutil.ProbeRawArtifactSink)

Example 2 with ProbeRawArtifactSink

use of org.eclipse.tycho.repository.streaming.testutil.ProbeRawArtifactSink in project tycho by eclipse.

the class CompositeArtifactProviderTestBase method testGetNonExistingRawArtifact.

@Test
public void testGetNonExistingRawArtifact() throws Exception {
    rawTestSink = new ProbeRawArtifactSink(canonicalDescriptorFor(NOT_CONTAINED_ARTIFACT_KEY));
    status = subject.getRawArtifact(rawTestSink, null);
    assertThat(rawTestSink.writeIsStarted(), is(false));
    assertThat(status, is(errorStatus()));
    assertThat(status.getCode(), is(ProvisionException.ARTIFACT_NOT_FOUND));
    assertThat(status, statusWithMessageWhich(containsString("is not available in")));
}
Also used : ProbeRawArtifactSink(org.eclipse.tycho.repository.streaming.testutil.ProbeRawArtifactSink) Test(org.junit.Test)

Example 3 with ProbeRawArtifactSink

use of org.eclipse.tycho.repository.streaming.testutil.ProbeRawArtifactSink in project tycho by eclipse.

the class CompositeArtifactProviderTestBase method testGetRawArtifactSucceedsInSecondAttempt.

@Test
public void testGetRawArtifactSucceedsInSecondAttempt() throws Exception {
    subject = createCompositeArtifactProvider(REPO_BUNLDE_AB_PACK_CORRUPT, REPO_BUNDLE_AB);
    rawTestSink = new ProbeRawArtifactSink(packedDescriptorFor(BUNDLE_A_KEY));
    status = subject.getRawArtifact(rawTestSink, null);
    assertThat(status, is(warningStatus()));
    assertThat(status.getMessage(), containsString("Some attempts to read"));
    assertThat(asList(status.getChildren()), hasItem(errorStatus()));
    assertThat(asList(status.getChildren()), hasItem(okStatus()));
    assertThat(rawTestSink.md5AsHex(), is(BUNDLE_A_PACKED_CONTENT_MD5));
}
Also used : ProbeRawArtifactSink(org.eclipse.tycho.repository.streaming.testutil.ProbeRawArtifactSink) Test(org.junit.Test)

Example 4 with ProbeRawArtifactSink

use of org.eclipse.tycho.repository.streaming.testutil.ProbeRawArtifactSink in project tycho by eclipse.

the class TargetPlatformBundlePublisherTest method artifactMD5Of.

private static String artifactMD5Of(IArtifactKey key, IRawArtifactProvider artifactProvider) throws Exception {
    ProbeRawArtifactSink probeSink = ProbeRawArtifactSink.newRawArtifactSinkFor(new ArtifactDescriptor(key));
    artifactProvider.getArtifact(probeSink, null);
    return probeSink.md5AsHex();
}
Also used : ProbeRawArtifactSink(org.eclipse.tycho.repository.streaming.testutil.ProbeRawArtifactSink) ArtifactDescriptor(org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor) IArtifactDescriptor(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor)

Aggregations

ProbeRawArtifactSink (org.eclipse.tycho.repository.streaming.testutil.ProbeRawArtifactSink)4 Test (org.junit.Test)2 IArtifactDescriptor (org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor)1 ArtifactDescriptor (org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor)1