コード例 #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 testExamineStorageSubSystemCommandFullCloneFlagForVmwareNull() {
   when(destDataStoreTO.isFullCloneFlag()).thenReturn(null);
   _resource.examineStorageSubSystemCommandFullCloneFlagForVmware(storageCmd, params);
   verify(destDataTO).getDataStore();
   verify(destDataStoreTO).isFullCloneFlag();
   assertTrue(params.isEmpty());
 }