コード例 #1
0
  @Before
  public void setup() throws Exception {
    MockitoAnnotations.initMocks(this);
    storageCmd = PowerMockito.mock(CopyCommand.class);
    doReturn(context).when(_resource).getServiceContext(null);
    when(cmd.getVirtualMachine()).thenReturn(vmSpec);

    when(storageCmd.getSrcTO()).thenReturn(srcDataTO);
    when(srcDataTO.getDataStore()).thenReturn(srcDataNfsTO);
    when(srcDataNfsTO.getNfsVersion()).thenReturn(NFS_VERSION);
    when(videoCard.getVideoRamSizeInKB()).thenReturn(VIDEO_CARD_MEMORY_SIZE);
    when(volume.getPath()).thenReturn(VOLUME_PATH);

    when(storageCmd.getDestTO()).thenReturn(destDataTO);
    when(destDataTO.getHypervisorType()).thenReturn(HypervisorType.VMware);
    when(destDataTO.getDataStore()).thenReturn(destDataStoreTO);
    when(destDataStoreTO.isFullCloneFlag()).thenReturn(FULL_CLONE_FLAG);
    when(volume.getPath()).thenReturn(VOLUME_PATH);
    when(vmSpec.getDetails()).thenReturn(specsArray);

    when(vmMo.getContext()).thenReturn(context);
    when(vmMo.getRunningHost()).thenReturn(host);
    when(host.getMor()).thenReturn(hostRef);
    when(context.getVimClient()).thenReturn(client);
    when(client.getMoRefProp(hostRef, "parent")).thenReturn(computeRef);
    when(client.getMoRefProp(computeRef, "environmentBrowser")).thenReturn(envRef);
    when(context.getService()).thenReturn(vimService);
    when(vimService.queryTargetCapabilities(envRef, hostRef)).thenReturn(hostCapability);
    when(hostCapability.isNestedHVSupported()).thenReturn(true);
  }
コード例 #2
0
 @Test
 public void testExamineStorageSubSystemCommandNfsVersionNotPresent() {
   when(srcDataNfsTO.getNfsVersion()).thenReturn(NFS_VERSION_NOT_PRESENT);
   _resource.examineStorageSubSystemCommandNfsVersion(storageCmd, params);
   assertTrue(params.isEmpty());
 }
コード例 #3
0
 @Test
 public void testgetNfsVersionFromNfsTONfsVersionNull() {
   when(srcDataNfsTO.getNfsVersion()).thenReturn(NFS_VERSION_NOT_PRESENT);
   assertFalse(_resource.getStorageNfsVersionFromNfsTO(srcDataNfsTO));
 }