@Test
  public void testGetAllStorageIdsForImageIds() {
    Guid sdIdShared = Guid.newGuid();
    Guid sdId1 = Guid.newGuid();
    Guid sdId2 = Guid.newGuid();

    disk1.setStorageIds(new ArrayList<Guid>(Arrays.asList(sdId1, sdIdShared)));
    disk2.setStorageIds(new ArrayList<Guid>(Arrays.asList(sdId2, sdIdShared)));

    Set<Guid> result = ImagesHandler.getAllStorageIdsForImageIds(Arrays.asList(disk1, disk2));

    assertEquals("Wrong number of Guids returned", 3, result.size());
    assertTrue("Wrong Guids returned", result.containsAll(Arrays.asList(sdId1, sdId2, sdIdShared)));
  }
 @Override
 protected void executeCommand() {
   final DiskImage newDiskImage = getParameters().getDiskImage();
   newDiskImage.setDiskAlias(
       ImagesHandler.getDiskAliasWithDefault(
           newDiskImage, generateDefaultAliasForRegiteredDisk(Calendar.getInstance())));
   ArrayList<Guid> storageIds = new ArrayList<>();
   storageIds.add(getParameters().getStorageDomainId());
   newDiskImage.setStorageIds(storageIds);
   addDiskImageToDb(newDiskImage, getCompensationContext());
   getReturnValue().setActionReturnValue(newDiskImage.getId());
   getReturnValue().setSucceeded(true);
 }
  /** <exception>VdcDAL.IrsBrokerIRSErrorException. */
  public DiskImage buildImageEntity(Map<String, Object> xmlRpcStruct) {
    DiskImage newImage = new DiskImage();
    try {
      newImage.setImageId(new Guid((String) xmlRpcStruct.get(IrsProperties.uuid)));

      newImage.setParentId(new Guid((String) xmlRpcStruct.get(IrsProperties.parent)));
      newImage.setDescription((String) xmlRpcStruct.get(IrsProperties.description));
      newImage.setImageStatus(
          EnumUtils.valueOf(
              ImageStatus.class, (String) xmlRpcStruct.get(IrsProperties.ImageStatus), true));
      if (xmlRpcStruct.containsKey(IrsProperties.size)) {
        newImage.setSize(Long.parseLong(xmlRpcStruct.get(IrsProperties.size).toString()) * 512);
      }
      if (xmlRpcStruct.containsKey("capacity")) {
        newImage.setSize(Long.parseLong(xmlRpcStruct.get("capacity").toString()));
      }
      if (xmlRpcStruct.containsKey("truesize")) {
        newImage.setActualSizeInBytes(Long.parseLong(xmlRpcStruct.get("truesize").toString()));
      }
      if (xmlRpcStruct.containsKey("ctime")) {
        long secsSinceEpoch = Long.parseLong(xmlRpcStruct.get("ctime").toString());
        newImage.setCreationDate(MakeDTFromCTime(secsSinceEpoch));
      }
      if (xmlRpcStruct.containsKey("mtime")) {
        long secsSinceEpoch = Long.parseLong(xmlRpcStruct.get("mtime").toString());
        newImage.setLastModifiedDate(MakeDTFromCTime(secsSinceEpoch));
      }
      if (xmlRpcStruct.containsKey("domain")) {
        newImage.setStorageIds(
            new ArrayList<Guid>(Arrays.asList(new Guid(xmlRpcStruct.get("domain").toString()))));
      }
      if (xmlRpcStruct.containsKey("image")) {
        newImage.setimage_group_id(new Guid(xmlRpcStruct.get("image").toString()));
      }
      if (xmlRpcStruct.containsKey("type")) {
        newImage.setVolumeType(
            EnumUtils.valueOf(VolumeType.class, xmlRpcStruct.get("type").toString(), true));
      }
      if (xmlRpcStruct.containsKey("format")) {
        newImage.setvolumeFormat(
            EnumUtils.valueOf(VolumeFormat.class, xmlRpcStruct.get("format").toString(), true));
      }
    } catch (RuntimeException ex) {
      log.errorFormat("irsBroker::buildImageEntity::Failed building DIskImage");
      printReturnValue();
      log.error(ex.getMessage(), ex);
      newImage = null;
    }

    return newImage;
  }