use of org.eclipse.tycho.repository.p2base.artifact.provider.streaming.ArtifactSinkException in project tycho by eclipse.
the class LocalArtifactRepositoryP2APITest method testGetArtifactToBrokenSink.
@Test(expected = ArtifactSinkException.class)
public void testGetArtifactToBrokenSink() throws Exception {
IArtifactSink brokenSink = new IArtifactSink() {
@Override
public IArtifactKey getArtifactToBeWritten() {
return ARTIFACT_A_KEY;
}
@Override
public boolean canBeginWrite() {
return true;
}
@Override
public OutputStream beginWrite() {
return testOutputStream;
}
@Override
public void commitWrite() throws ArtifactSinkException {
throw new ArtifactSinkException("simulated error on commit");
}
@Override
public void abortWrite() {
}
};
subject.getArtifact(brokenSink, null);
}
use of org.eclipse.tycho.repository.p2base.artifact.provider.streaming.ArtifactSinkException in project tycho by eclipse.
the class AbstractArtifactRepository2 method getRawArtifact.
/**
* {@inheritDoc}
*
* @deprecated Obsolete. Use {@link #getRawArtifact(IRawArtifactSink, IProgressMonitor)}
* instead.
*/
// TODO make final?
@Override
@Deprecated
public IStatus getRawArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) {
try {
IStatus status = getRawArtifact(rawWriteToStream(descriptor, 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);
}
}
use of org.eclipse.tycho.repository.p2base.artifact.provider.streaming.ArtifactSinkException 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);
}
}
Aggregations