private static VDSReturnValue createGetVGInfoReturnValue(List<LUNs> luns) {
    VDSReturnValue returnValue = new VDSReturnValue();
    returnValue.setSucceeded(true);
    returnValue.setReturnValue(luns);

    return returnValue;
  }
 private void expectGetDeviceList() {
   VDSReturnValue returnValue = new VDSReturnValue();
   returnValue.setSucceeded(true);
   returnValue.setReturnValue(setUpLunsFromDeviceList());
   when(vdsBrokerFrontendMock.runVdsCommand(
           eq(VDSCommandType.GetDeviceList), any(GetDeviceListVDSCommandParameters.class)))
       .thenReturn(returnValue);
 }
 private void mockGetStorageDomainInfoVdsCommand(StorageDomainStatic storageDomain) {
   Pair<StorageDomainStatic, Guid> pairResult = new Pair<>(storageDomain, null);
   VDSReturnValue returnValueForGetStorageDomainInfo = new VDSReturnValue();
   returnValueForGetStorageDomainInfo.setSucceeded(true);
   returnValueForGetStorageDomainInfo.setReturnValue(pairResult);
   when(vdsBrokerFrontend.runVdsCommand(
           eq(VDSCommandType.HSMGetStorageDomainInfo),
           any(HSMGetStorageDomainInfoVDSCommandParameters.class)))
       .thenReturn(returnValueForGetStorageDomainInfo);
 }
  private VDSReturnValue createGetStorageDomainInfoReturnValue() {
    VDSReturnValue returnValue = new VDSReturnValue();
    returnValue.setSucceeded(true);

    StorageDomain storageDomain = new StorageDomain();
    storageDomain.setId(storageDomainId);

    Pair<StorageDomainStatic, Object> pair = new Pair<>(storageDomain.getStorageStaticData(), null);
    returnValue.setReturnValue(pair);

    return returnValue;
  }
  private void mockBackend(boolean succeeded, EngineError errorCode) {
    doReturn(backend).when(cmd).getBackend();
    doNothing().when(cmd).startSubStep();
    doReturn(asyncTaskToBeReturned).when(cmd).handleTaskReturn(asyncTaskToBeReturned);
    doNothing().when(cmd).updateBricksWithTaskID(asyncTaskToBeReturned);

    VDSReturnValue vdsReturnValue = new VDSReturnValue();
    vdsReturnValue.setReturnValue(asyncTaskToBeReturned);
    vdsReturnValue.setSucceeded(succeeded);
    if (!succeeded) {
      vdsReturnValue.setVdsError(new VDSError(errorCode, ""));
    }
    when(vdsBrokerFrontend.runVdsCommand(
            eq(VDSCommandType.StartRemoveGlusterVolumeBricks),
            argThat(anyGlusterVolumeRemoveBricksVDSParameters())))
        .thenReturn(vdsReturnValue);
  }
  /** Test query execution */
  private void internalExecuteQuery() {
    // Run 'GetDeviceList' command
    VDSReturnValue returnValue = new VDSReturnValue();
    returnValue.setSucceeded(true);
    returnValue.setReturnValue(lunsInput);
    when(vdsBrokerFrontendMock.RunVdsCommand(
            eq(VDSCommandType.GetDeviceList), any(GetDeviceListVDSCommandParameters.class)))
        .thenReturn(returnValue);

    // Return 'lunsFromDb'
    when(lunDaoMock.getAll()).thenReturn(lunsFromDb);

    // Execute command
    getQuery().executeQueryCommand();

    // Assert the query's results
    List<LUNs> lunsActual = getQuery().getQueryReturnValue().getReturnValue();

    assertEquals(lunsExpected, lunsActual);
  }
 private VDSReturnValue getVDSReturnValue() {
   VDSReturnValue returnValue = new VDSReturnValue();
   returnValue.setSucceeded(true);
   returnValue.setReturnValue(expectedServers);
   return returnValue;
 }