use of org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor in project tycho by eclipse.
the class ArtifactTransferPolicyBase method sortFormatsByPreference.
@Override
public final List<IArtifactDescriptor> sortFormatsByPreference(IArtifactDescriptor[] artifactDescriptors) {
LinkedList<IArtifactDescriptor> result = new LinkedList<>();
IArtifactDescriptor canonical = null;
IArtifactDescriptor packed = null;
for (IArtifactDescriptor descriptor : artifactDescriptors) {
if (isCanonicalFormat(descriptor)) {
canonical = descriptor;
} else if (isPack200Format(descriptor)) {
packed = descriptor;
} else {
result.add(descriptor);
}
}
insertCanonicalAndPacked(canonical, packed, result);
return result;
}
use of org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor in project tycho by eclipse.
the class VerifierServiceImpl method verifyAllArtifactContent.
private boolean verifyAllArtifactContent(IArtifactRepository repository, MavenLogger logger) {
boolean valid = true;
IQueryResult<IArtifactKey> allKeys = repository.query(new ExpressionMatchQuery<>(IArtifactKey.class, ExpressionUtil.TRUE_EXPRESSION), null);
for (Iterator<IArtifactKey> keyIt = allKeys.iterator(); keyIt.hasNext(); ) {
IArtifactKey key = keyIt.next();
IArtifactDescriptor[] descriptors = repository.getArtifactDescriptors(key);
for (IArtifactDescriptor descriptor : descriptors) {
valid &= verifyArtifactContent(repository, logger, descriptor);
}
}
return valid;
}
use of org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor in project tycho by eclipse.
the class ArtifactRepositoryTestUtils method packedDescriptorFor.
public static IArtifactDescriptor packedDescriptorFor(IArtifactKey key) {
ArtifactDescriptor result = new ArtifactDescriptor(key);
result.setProcessingSteps(new IProcessingStepDescriptor[] { new ProcessingStepDescriptor("org.eclipse.equinox.p2.processing.Pack200Unpacker", null, true) });
result.setProperty(IArtifactDescriptor.FORMAT, IArtifactDescriptor.FORMAT_PACKED);
return result;
}
use of org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor in project tycho by eclipse.
the class ModuleArtifactRepositoryTest method testReadingWithOtherDescriptorType.
@Test
public void testReadingWithOtherDescriptorType() throws Exception {
subject = ModuleArtifactRepository.restoreInstance(null, existingModuleDir);
IArtifactDescriptor originalDescriptor = subject.getArtifactDescriptors(BUNDLE_ARTIFACT_KEY)[0];
IArtifactDescriptor equivalentDescriptor = new ArtifactDescriptor(originalDescriptor);
assertThat(subject.contains(BUNDLE_ARTIFACT_KEY), is(true));
assertThat(subject.contains(originalDescriptor), is(true));
assertThat(subject.contains(equivalentDescriptor), is(true));
}
use of org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor in project tycho by eclipse.
the class ModuleArtifactRepositoryTest method testRemovingWithOtherDescriptorType.
@Test
public void testRemovingWithOtherDescriptorType() throws Exception {
// existingModuleDir points to the original source files -> use temporary repository instead so that we don't edit source files
subject = ModuleArtifactRepository.createInstance(null, tempManager.newFolder("targetDir"));
// TODO write via sink
OutputStream outputStream = subject.getOutputStream(newDescriptor(BINARY_ARTIFACT_KEY));
writeAndClose(outputStream, BINARY_ARTIFACT_SIZE);
IArtifactDescriptor originalDescriptor = subject.getArtifactDescriptors(BINARY_ARTIFACT_KEY)[0];
IArtifactDescriptor equivalentDescriptor = new ArtifactDescriptor(originalDescriptor);
// self-test: now the key/descriptor should be contained
assertThat(subject.contains(BINARY_ARTIFACT_KEY), is(true));
assertThat(subject.contains(originalDescriptor), is(true));
assertThat(subject.contains(equivalentDescriptor), is(true));
subject.removeDescriptor(equivalentDescriptor);
assertThat(subject.contains(equivalentDescriptor), is(false));
assertThat(subject.contains(originalDescriptor), is(false));
assertThat(subject.contains(BUNDLE_ARTIFACT_KEY), is(false));
}
Aggregations