public IStatus getArtifact(
     IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) {
   ProcessingStepHandler handler = new ProcessingStepHandler();
   destination =
       handler.createAndLink(
           getProvisioningAgent(), descriptor.getProcessingSteps(), null, destination, monitor);
   testhandler.download(keysToLocations.get(descriptor.getArtifactKey()), destination, monitor);
   return Status.OK_STATUS;
 }
 public void removeDescriptor(IArtifactKey key, IProgressMonitor monitor) {
   for (IArtifactDescriptor nextDescriptor : artifactDescriptors) {
     if (key.equals(nextDescriptor.getArtifactKey())) artifactDescriptors.remove(nextDescriptor);
   }
   if (keysToLocations.containsKey(key)) {
     URI theLocation = keysToLocations.get(key);
     locationsToContents.remove(theLocation);
     keysToLocations.remove(key);
   }
 }
 public IStatus download(URI toDownload, OutputStream target, IProgressMonitor pm) {
   byte[] contents = locationsToContents.get(toDownload);
   if (contents == null)
     Assert.fail(
         "Attempt to download missing artifact in TestArtifactRepository: " + toDownload);
   try {
     target.write(contents);
   } catch (IOException e) {
     e.printStackTrace();
     Assert.fail("Unexpected exception in TestArtifactRepository" + e.getMessage());
   }
   return Status.OK_STATUS;
 }
 public IStatus getRawArtifact(
     IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) {
   return testhandler.download(
       keysToLocations.get(descriptor.getArtifactKey()), destination, monitor);
 }
 public boolean contains(IArtifactKey key) {
   return keysToLocations.get(key) != null;
 }
 public boolean contains(IArtifactDescriptor descriptor) {
   return keysToLocations.get(descriptor.getArtifactKey()) != null;
 }
 public URI getArtifact(IArtifactKey key) {
   return keysToLocations.get(key);
 }