use of org.eclipse.equinox.p2.repository.artifact.IArtifactRequest in project tycho by eclipse.
the class LocalArtifactRepositoryTest method testGetArtifactsErrorRequest.
@Test
public void testGetArtifactsErrorRequest() {
LocalArtifactRepository repo = new LocalArtifactRepository(localRepoIndices);
IArtifactRequest errorRequest = new IArtifactRequest() {
@Override
public void perform(IArtifactRepository sourceRepository, IProgressMonitor monitor) {
}
@Override
public IStatus getResult() {
return new Status(IStatus.ERROR, "test-bundle", "Error");
}
@Override
public IArtifactKey getArtifactKey() {
return null;
}
};
IStatus status = repo.getArtifacts(new IArtifactRequest[] { errorRequest }, new NullProgressMonitor());
assertThat(status, not(okStatus()));
}
use of org.eclipse.equinox.p2.repository.artifact.IArtifactRequest in project tycho by eclipse.
the class RepositoryArtifactProviderTest method createArtifactRepositoryMock.
private static IArtifactRepository createArtifactRepositoryMock() {
/*
* Create an IArtifactRepository mock instance with the default implementation of
* org.eclipse.equinox.p2.repository.artifact.IArtifactRepository.getArtifacts(
* IArtifactRequest[], IProgressMonitor)
*/
IArtifactRepository partialMock = mock(AbstractArtifactRepository2.class);
when(partialMock.getArtifacts(any(IArtifactRequest[].class), any(IProgressMonitor.class))).thenCallRealMethod();
return partialMock;
}
use of org.eclipse.equinox.p2.repository.artifact.IArtifactRequest in project tycho by eclipse.
the class AbstractArtifactRepository2 method getArtifacts.
// add default implementations missing in AbstractArtifactRepository
@Override
public IStatus getArtifacts(IArtifactRequest[] requests, IProgressMonitor monitor) {
SubMonitor subMonitor = SubMonitor.convert(monitor, requests.length);
try {
MultiStatus result = new MultiStatus(BUNDLE_ID, 0, "Error while getting requested artifacts", null);
for (IArtifactRequest request : requests) {
request.perform(this, subMonitor.newChild(1));
result.add(request.getResult());
}
if (!result.isOK()) {
return result;
} else {
return Status.OK_STATUS;
}
} finally {
monitor.done();
}
}
Aggregations