VolumeObject implements VolumeInfo { @Override public boolean stateTransit(Volume.Event event) { boolean result = false; try { volumeVO = volumeDao.findById(volumeVO.getId()); if(volumeVO != null) { result = _volStateMachine.transitTo(volumeVO, event, null, volumeDao); volumeVO = volumeDao.findById(volumeVO.getId()); } } catch (NoTransitionException e) { String errorMessage = "Failed to transit volume: " + getVolumeId() + ", due to: " + e.toString(); s_logger.debug(errorMessage); throw new CloudRuntimeException(errorMessage); } return result; } VolumeObject(); static VolumeObject getVolumeObject(DataStore dataStore, VolumeVO volumeVO); @Override String getAttachedVmName(); @Override VirtualMachine getAttachedVM(); @Override String getUuid(); void setUuid(String uuid); @Override String get_iScsiName(); void setSize(Long size); @Override Volume.State getState(); @Override DataStore getDataStore(); @Override Long getSize(); @Override Long getMinIops(); @Override Long getMaxIops(); @Override Integer getHypervisorSnapshotReserve(); @Override boolean isDisplayVolume(); @Override boolean isDisplay(); long getVolumeId(); @Override boolean stateTransit(Volume.Event event); @Override Long getBytesReadRate(); @Override Long getBytesWriteRate(); @Override Long getIopsReadRate(); @Override Long getIopsWriteRate(); @Override DiskCacheMode getCacheMode(); void update(); @Override long getId(); @Override boolean isAttachedVM(); @Override String getUri(); @Override DataObjectType getType(); @Override void processEvent(ObjectInDataStoreStateMachine.Event event); @Override void processEventOnly(ObjectInDataStoreStateMachine.Event event); @Override String getName(); @Override Long getInstanceId(); @Override String getFolder(); @Override String getPath(); @Override Long getPodId(); @Override long getDataCenterId(); @Override Type getVolumeType(); @Override Long getPoolId(); @Override Date getAttached(); @Override Long getDeviceId(); @Override Date getCreated(); @Override Long getDiskOfferingId(); @Override String getChainInfo(); @Override boolean isRecreatable(); @Override long getUpdatedCount(); @Override void incrUpdatedCount(); @Override Date getUpdated(); @Override String getReservationId(); @Override void setReservationId(String reserv); @Override long getAccountId(); @Override long getDomainId(); @Override Long getTemplateId(); @Override void addPayload(Object data); @Override Object getpayload(); VolumeVO getVolume(); @Override HypervisorType getHypervisorType(); @Override Long getLastPoolId(); @Override DataTO getTO(); @Override void processEvent(ObjectInDataStoreStateMachine.Event event, Answer answer); @Override void incRefCount(); @Override void decRefCount(); @Override Long getRefCount(); @Override void processEventOnly(ObjectInDataStoreStateMachine.Event event, Answer answer); @Override ImageFormat getFormat(); @Override ProvisioningType getProvisioningType(); @Override boolean delete(); @Override Long getVmSnapshotChainSize(); @Override Class<?> getEntityType();  }
@Test public void testStateTransit() { boolean result = volumeObject.stateTransit(Volume.Event.OperationFailed); Assert.assertFalse("since the volume doesnt exist in the db, the operation should fail but, should not throw any exception", result); }