use of org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor in project tycho by eclipse.
the class CompositeArtifactProviderTestBase method testGetPackedRawArtifact.
@Test
public void testGetPackedRawArtifact() throws Exception {
IArtifactDescriptor packedBundleB = subject.getArtifactDescriptors(BUNDLE_B_KEY)[0];
rawTestSink = newRawArtifactSinkFor(packedBundleB);
status = subject.getRawArtifact(rawTestSink, null);
assertThat(rawTestSink.md5AsHex(), is(TestRepositoryContent.BUNDLE_B_PACKED_CONTENT_MD5));
}
use of org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor in project tycho by eclipse.
the class RemoteArtifactTransferPolicyTest method loadDescriptorsFromRepository.
static IArtifactDescriptor[] loadDescriptorsFromRepository(String repository, P2Context p2Context) throws Exception {
IArtifactRepositoryManager repoManager = (IArtifactRepositoryManager) p2Context.getAgent().getService(IArtifactRepositoryManager.SERVICE_NAME);
File repoPath = ResourceUtil.resourceFile("repositories/rawformats/" + repository);
IArtifactRepository loadedRepo = repoManager.loadRepository(repoPath.toURI(), new NullProgressMonitor());
return loadedRepo.getArtifactDescriptors(DEFAULT_KEY);
}
use of org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor in project tycho by eclipse.
the class PackedFormatMirroringArtifactProvider method downloadMostSpecificNeededFormatOfArtifact.
@Override
protected IStatus downloadMostSpecificNeededFormatOfArtifact(IArtifactKey key) throws ProvisionException, ArtifactSinkException {
IArtifactDescriptor[] allDescriptors = remoteProviders.getArtifactDescriptors(key);
IArtifactDescriptor packedDescriptor = findPackedDescriptor(allDescriptors);
if (packedDescriptor != null) {
// TODO 393004 remove "maven-groupId", etc. properties to force storage as p2/osgi/bundle...
return downloadRawArtifact(packedDescriptor);
} else {
logger.debug("No remote repository provides " + key.getId() + "_" + key.getVersion() + " in packed format. Only the canonical format will be available in the build.");
return downloadCanonicalArtifact(key);
}
}
use of org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor in project tycho by eclipse.
the class RepositoryArtifactProviderTest method testGetArtifactWithInfiniteMirrorFailures.
@Test
public void testGetArtifactWithInfiniteMirrorFailures() throws Exception {
IArtifactRepository failingMirrorsRepository = createArtifactRepositoryMock();
when(failingMirrorsRepository.contains(BUNDLE_A_KEY)).thenReturn(true);
when(failingMirrorsRepository.getArtifactDescriptors(BUNDLE_A_KEY)).thenReturn(new IArtifactDescriptor[] { canonicalDescriptorFor(BUNDLE_A_KEY) });
when(failingMirrorsRepository.getArtifact(argThat(is(canonicalDescriptorFor(BUNDLE_A_KEY))), any(OutputStream.class), any(IProgressMonitor.class))).thenReturn(errorWithRetry("mirror failure"));
subject = new RepositoryArtifactProvider(Collections.singletonList(failingMirrorsRepository), TRANSFER_POLICY);
testSink = newArtifactSinkFor(BUNDLE_A_KEY);
// should give up if all mirrors fail
status = subject.getArtifact(testSink, null);
assertThat(status, is(errorStatus()));
}
use of org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor in project tycho by eclipse.
the class ModuleArtifactRepository method load.
private void load() throws ProvisionException {
try {
FileInputStream p2DataFileStream = new FileInputStream(p2DataFile);
try {
Set<IArtifactDescriptor> descriptors = new ArtifactsIO().readXML(p2DataFileStream);
for (IArtifactDescriptor descriptor : descriptors) {
ModuleArtifactDescriptor internalDescriptor = getInternalDescriptorFromLoadedDescriptor(descriptor, p2DataFile);
// TODO check that GAV properties match module GAV
internalAddInternalDescriptor(internalDescriptor);
}
} finally {
p2DataFileStream.close();
}
} catch (IOException e) {
throw failedReadException(p2DataFile, null, e);
}
}
Aggregations