Source:
public void testArtifactProcessingSteps() { File packedRepoLocation = getTestData("27.0", "/testData/mirror/mirrorPackedRepo"); IArtifactRepository packedRepo = null; IArtifactRepository destinationRepo = null; try { packedRepo = getArtifactRepositoryManager().loadRepository(packedRepoLocation.toURI(), null); destinationRepo = getArtifactRepositoryManager().createRepository(destRepoLocation.toURI(), "Test Repo", IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, null); } catch (ProvisionException e1) { fail(""); } IQueryResult<IArtifactKey> keys = packedRepo.query(ArtifactKeyQuery.ALL_KEYS, null); for (Iterator<IArtifactKey> iterator = keys.iterator(); iterator.hasNext();) { IArtifactKey key = iterator.next(); IArtifactDescriptor[] srcDescriptors = packedRepo.getArtifactDescriptors(key); for (IArtifactDescriptor srcDescriptor : srcDescriptors) { if (!(srcDescriptor.getProperty(IArtifactDescriptor.FORMAT) == null) && srcDescriptor.getProperty(IArtifactDescriptor.FORMAT).equals(IArtifactDescriptor.FORMAT_PACKED)) { IArtifactDescriptor newDescriptor = new ArtifactDescriptor(key); Map<String, String> properties = new OrderedProperties(); properties.putAll(srcDescriptor.getProperties()); properties.remove(IArtifactDescriptor.FORMAT); ((ArtifactDescriptor) newDescriptor).addProperties(properties); try (final OutputStream repositoryStream = destinationRepo.getOutputStream(newDescriptor)) { if (repositoryStream == null) return; packedRepo.getArtifact(srcDescriptor, repositoryStream, new NullProgressMonitor()); }catch (ProvisionException e) { fail("27.1", e); }catch (IOException e) { fail("27.2", e); } IArtifactDescriptor[] destDescriptors = destinationRepo.getArtifactDescriptors(key); boolean canonicalFound = false; for (int l = 0; !canonicalFound && (l < destDescriptors.length); l++) { if (destDescriptors[l].getProcessingSteps().length == 0) canonicalFound = true; } if (!canonicalFound) fail("27.3 no canonical found for " + key.toString()); assertEqualArtifacts("27.3", (SimpleArtifactRepository) destinationRepo, (SimpleArtifactRepository) packedRepo); } } } }

Target:
public void testArtifactProcessingSteps() { File packedRepoLocation = getTestData("27.0", "/testData/mirror/mirrorPackedRepo"); IArtifactRepository packedRepo = null; IArtifactRepository destinationRepo = null; try { packedRepo = getArtifactRepositoryManager().loadRepository(packedRepoLocation.toURI(), null); destinationRepo = getArtifactRepositoryManager().createRepository(destRepoLocation.toURI(), "Test Repo", IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, null); } catch (ProvisionException e1) { fail(""); } IQueryResult<IArtifactKey> keys = packedRepo.query(ArtifactKeyQuery.ALL_KEYS, null); for (Iterator<IArtifactKey> iterator = keys.iterator(); iterator.hasNext();) { IArtifactKey key = iterator.next(); IArtifactDescriptor[] srcDescriptors = packedRepo.getArtifactDescriptors(key); for (IArtifactDescriptor srcDescriptor : srcDescriptors) { if (!(srcDescriptor.getProperty(IArtifactDescriptor.FORMAT) == null) && srcDescriptor.getProperty(IArtifactDescriptor.FORMAT).equals(IArtifactDescriptor.FORMAT_PACKED)) { IArtifactDescriptor newDescriptor = new ArtifactDescriptor(key); Map<String, String> properties = new OrderedProperties(); properties.putAll(srcDescriptor.getProperties()); properties.remove(IArtifactDescriptor.FORMAT); ((ArtifactDescriptor) newDescriptor).addProperties(properties); try (OutputStream repositoryStream = destinationRepo.getOutputStream(newDescriptor)) { if (repositoryStream == null) return; packedRepo.getArtifact(srcDescriptor, repositoryStream, new NullProgressMonitor()); }catch (ProvisionException e) { fail("27.1", e); }catch (IOException e) { fail("27.2", e); } IArtifactDescriptor[] destDescriptors = destinationRepo.getArtifactDescriptors(key); boolean canonicalFound = false; for (int l = 0; !canonicalFound && (l < destDescriptors.length); l++) { if (destDescriptors[l].getProcessingSteps().length == 0) canonicalFound = true; } if (!canonicalFound) fail("27.3 no canonical found for " + key.toString()); assertEqualArtifacts("27.3", (SimpleArtifactRepository) destinationRepo, (SimpleArtifactRepository) packedRepo); } } } }