@Test public void testUpdateSuccess() { final Volume volume = Mockito.mock(Volume.class); updateVolumeCmd._volumeService = volumeService; updateVolumeCmd._responseGenerator = responseGenerator; Mockito.when(volume.getAccountId()).thenReturn(1L); Mockito.when(responseGenerator.findVolumeById(Mockito.anyLong())).thenReturn(volume); Mockito.when(volumeService.updateVolume(Mockito.eq(1L), Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyLong(), Mockito.anyBoolean(), Mockito.anyString(), Mockito.eq(1L), Mockito.anyString(), Mockito.any(DiskControllerType.class))).thenReturn(volume); final VolumeResponse response = new VolumeResponse(); Mockito.when(responseGenerator.createVolumeResponse(ResponseObject.ResponseView.Restricted, volume)).thenReturn(response); updateVolumeCmd.execute(); }
@Override public void execute() { CallContext.current().setEventDetails("Volume Id: " + getId()); final Volume result = _volumeService.updateVolume(getId(), getVolumeName(), getPath(), getState(), getStorageId(), getDisplayVolume(), getCustomId(), getEntityOwnerId(), getChainInfo(), getDiskController()); if (result != null) { final VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Restricted, result); response.setResponseName(getCommandName()); setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update volume"); } }
UpdateVolumeCmd extends BaseAsyncCustomIdCmd { @Override public void execute() { CallContext.current().setEventDetails("Volume Id: " + getId()); final Volume result = _volumeService.updateVolume(getId(), getVolumeName(), getPath(), getState(), getStorageId(), getDisplayVolume(), getCustomId(), getEntityOwnerId(), getChainInfo(), getDiskController()); if (result != null) { final VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Restricted, result); response.setResponseName(getCommandName()); setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update volume"); } } }
UpdateVolumeCmd extends BaseAsyncCustomIdCmd { @Override public void execute() { CallContext.current().setEventDetails("Volume Id: " + getId()); final Volume result = _volumeService.updateVolume(getId(), getVolumeName(), getPath(), getState(), getStorageId(), getDisplayVolume(), getCustomId(), getEntityOwnerId(), getChainInfo(), getDiskController()); if (result != null) { final VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Restricted, result); response.setResponseName(getCommandName()); setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update volume"); } }  }
UpdateVolumeCmd extends BaseAsyncCustomIdCmd { @Override public void execute() { CallContext.current().setEventDetails("Volume Id: " + getId()); final Volume result = _volumeService.updateVolume(getId(), getVolumeName(), getPath(), getState(), getStorageId(), getDisplayVolume(), getCustomId(), getEntityOwnerId(), getChainInfo(), getDiskController()); if (result != null) { final VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Restricted, result); response.setResponseName(getCommandName()); setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update volume"); } }  @Override String getEventType(); @Override String getEventDescription(); @Override Long getInstanceId(); @Override ApiCommandJobType getInstanceType(); Long getId(); String getPath(); String getVolumeName(); Long getStorageId(); String getState(); @Override void execute(); Boolean getDisplayVolume(); String getChainInfo(); DiskControllerType getDiskController(); @Override String getCommandName(); @Override long getEntityOwnerId(); @Override void checkUuid(); }
UpdateVolumeCmd extends BaseAsyncCustomIdCmd { @Override public void execute() { CallContext.current().setEventDetails("Volume Id: " + getId()); final Volume result = _volumeService.updateVolume(getId(), getVolumeName(), getPath(), getState(), getStorageId(), getDisplayVolume(), getCustomId(), getEntityOwnerId(), getChainInfo(), getDiskController()); if (result != null) { final VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Restricted, result); response.setResponseName(getCommandName()); setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update volume"); } }  @Override String getEventType(); @Override String getEventDescription(); @Override Long getInstanceId(); @Override ApiCommandJobType getInstanceType(); Long getId(); String getPath(); String getVolumeName(); Long getStorageId(); String getState(); @Override void execute(); Boolean getDisplayVolume(); String getChainInfo(); DiskControllerType getDiskController(); @Override String getCommandName(); @Override long getEntityOwnerId(); @Override void checkUuid(); static final Logger s_logger; }