コード例 #1
0
 @SuppressWarnings("unchecked")
 @Test
 public void checkStorageProcessorAndHandlerNfsVersionAttributeVersionSet() {
   _resource.storageNfsVersion = NFS_VERSION;
   _resource.checkStorageProcessorAndHandlerNfsVersionAttribute(storageCmd);
   verify(_resource, never())
       .examineStorageSubSystemCommandNfsVersion(Matchers.eq(storageCmd), any(EnumMap.class));
 }
コード例 #2
0
 @Test
 public void testSetNewVRamSizeVmVideoCardPresent() throws Exception {
   when(vmMo3dgpu.getAllDeviceList()).thenReturn(Arrays.asList(videoCard, virtualDevice));
   _resource.setNewVRamSizeVmVideoCard(vmMo3dgpu, VRAM_MEMORY_SIZE, vmConfigSpec);
   verify(_resource)
       .modifyVmVideoCardVRamSize(videoCard, vmMo3dgpu, VRAM_MEMORY_SIZE, vmConfigSpec);
 }
コード例 #3
0
  // Test successful scaling up the vm
  @Test
  public void testScaleVMF1() throws Exception {
    when(_resource.getHyperHost(context, null)).thenReturn(hyperHost);
    doReturn("i-2-3-VM").when(cmd).getVmName();
    when(hyperHost.findVmOnHyperHost("i-2-3-VM")).thenReturn(vmMo);
    doReturn(536870912L).when(vmSpec).getMinRam();
    doReturn(1).when(vmSpec).getCpus();
    doReturn(1000).when(vmSpec).getMinSpeed();
    doReturn(1000).when(vmSpec).getMaxSpeed();
    doReturn(536870912L).when(vmSpec).getMaxRam();
    doReturn(false).when(vmSpec).getLimitCpuUse();
    when(vmMo.configureVm(vmConfigSpec)).thenReturn(true);

    _resource.execute(cmd);
    verify(_resource).execute(cmd);
  }
コード例 #4
0
 @Test
 public void testExamineStorageSubSystemCommandFullCloneFlagForVmwareNull() {
   when(destDataStoreTO.isFullCloneFlag()).thenReturn(null);
   _resource.examineStorageSubSystemCommandFullCloneFlagForVmware(storageCmd, params);
   verify(destDataTO).getDataStore();
   verify(destDataStoreTO).isFullCloneFlag();
   assertTrue(params.isEmpty());
 }
コード例 #5
0
 @Test
 public void testFindVmOnDatacenter() throws Exception {
   when(hyperHost.getHyperHostDatacenter()).thenReturn(mor);
   when(datacenter.getMor()).thenReturn(mor);
   when(datacenter.findVm(VOLUME_PATH)).thenReturn(vmMo);
   whenNew(DatacenterMO.class).withArguments(context, mor).thenReturn(datacenter);
   VirtualMachineMO result = _resource.findVmOnDatacenter(context, hyperHost, volume);
   assertEquals(vmMo, result);
 }
コード例 #6
0
  @Test
  public void testConfigureVideoCardSvgaVramProvided() throws Exception {
    Map<String, String> specDetails = new HashMap<String, String>();
    specDetails.put("svga.vramSize", String.valueOf(VRAM_MEMORY_SIZE));
    when(vmSpec3dgpu.getDetails()).thenReturn(specDetails);

    _resource.configureVideoCard(vmMo3dgpu, vmSpec3dgpu, vmConfigSpec);
    verify(_resource).setNewVRamSizeVmVideoCard(vmMo3dgpu, VRAM_MEMORY_SIZE, vmConfigSpec);
  }
コード例 #7
0
 @Test
 public void testExamineStorageSubSystemCommandFullCloneFlagForVmware() {
   EnumMap<VmwareStorageProcessorConfigurableFields, Object> params2 =
       _resource.examineStorageSubSystemCommandFullCloneFlagForVmware(storageCmd, params);
   verify(destDataTO).getDataStore();
   verify(destDataStoreTO, times(2)).isFullCloneFlag();
   assertEquals(1, params2.size());
   assertEquals(
       FULL_CLONE_FLAG, params2.get(VmwareStorageProcessorConfigurableFields.FULL_CLONE_FLAG));
 }
コード例 #8
0
  @Test
  public void testConfigureSpecVideoCardNewVRamSize() {
    when(vmConfigSpec.getDeviceChange()).thenReturn(new ArrayList<VirtualDeviceConfigSpec>());
    _resource.configureSpecVideoCardNewVRamSize(videoCard, VRAM_MEMORY_SIZE, vmConfigSpec);

    InOrder inOrder = Mockito.inOrder(videoCard, vmConfigSpec);
    inOrder.verify(videoCard).setVideoRamSizeInKB(VRAM_MEMORY_SIZE);
    inOrder.verify(videoCard).setUseAutoDetect(false);
    inOrder.verify(vmConfigSpec).getDeviceChange();
  }
コード例 #9
0
 @Test
 public void testSetNewVRamSizeVmVideoCardNotPresent() throws Exception {
   when(vmMo3dgpu.getAllDeviceList()).thenReturn(Arrays.asList(virtualDevice));
   _resource.setNewVRamSizeVmVideoCard(vmMo3dgpu, VRAM_MEMORY_SIZE, vmConfigSpec);
   verify(_resource, never())
       .modifyVmVideoCardVRamSize(
           any(VirtualMachineVideoCard.class),
           eq(vmMo3dgpu),
           eq(VRAM_MEMORY_SIZE),
           eq(vmConfigSpec));
 }
コード例 #10
0
 @SuppressWarnings("unchecked")
 @Test
 public void checkStorageProcessorAndHandlerNfsVersionAttributeVersionNotSet() {
   _resource.checkStorageProcessorAndHandlerNfsVersionAttribute(storageCmd);
   verify(_resource)
       .examineStorageSubSystemCommandNfsVersion(Matchers.eq(storageCmd), any(EnumMap.class));
   verify(_resource)
       .examineStorageSubSystemCommandFullCloneFlagForVmware(
           Matchers.eq(storageCmd), any(EnumMap.class));
   verify(_resource).reconfigureProcessorByHandler(any(EnumMap.class));
   assertEquals(NFS_VERSION, _resource.storageNfsVersion);
 }
コード例 #11
0
  @Test
  public void testConfigNestedHVSupportFlagTrue() throws Exception {
    specsArray.put(VmDetailConstants.NESTED_VIRTUALIZATION_FLAG, "true");
    _resource.configNestedHVSupport(vmMo, vmSpec, vmConfigSpec);
    verify(vmMo).getRunningHost();
    verify(host).getMor();
    verify(context, times(2)).getVimClient();
    verify(client).getMoRefProp(hostRef, "parent");
    verify(client).getMoRefProp(computeRef, "environmentBrowser");
    verify(context).getService();
    verify(vimService).queryTargetCapabilities(envRef, hostRef);
    verify(hostCapability).isNestedHVSupported();

    verify(vmConfigSpec).setNestedHVEnabled(true);
  }
コード例 #12
0
 @Test
 public void testgetNfsVersionFromNfsTONfsVersion() {
   assertTrue(_resource.getStorageNfsVersionFromNfsTO(srcDataNfsTO));
 }
コード例 #13
0
 @Test(expected = CloudRuntimeException.class)
 public void testFindVmOnDatacenterNullHyperHostReference() throws Exception {
   when(hyperHost.getMor()).thenReturn(null);
   _resource.findVmOnDatacenter(context, hyperHost, volume);
 }
コード例 #14
0
 @Test
 public void testConfigureVideoCardNotSvgaVramProvided() throws Exception {
   _resource.configureVideoCard(vmMo3dgpu, vmSpec3dgpu, vmConfigSpec);
   verify(_resource, never()).setNewVRamSizeVmVideoCard(vmMo3dgpu, VRAM_MEMORY_SIZE, vmConfigSpec);
 }
コード例 #15
0
 @Test
 public void testModifyVmVideoCardVRamSizeDifferentVramSizes() {
   _resource.modifyVmVideoCardVRamSize(videoCard, vmMo3dgpu, VRAM_MEMORY_SIZE, vmConfigSpec);
   verify(_resource).configureSpecVideoCardNewVRamSize(videoCard, VRAM_MEMORY_SIZE, vmConfigSpec);
 }
コード例 #16
0
 @Test
 public void testExamineStorageSubSystemCommandFullCloneFlagForHypervisorNotVmware() {
   when(destDataTO.getHypervisorType()).thenReturn(HypervisorType.XenServer);
   _resource.examineStorageSubSystemCommandFullCloneFlagForVmware(storageCmd, params);
   verify(destDataTO, never()).getDataStore();
 }
コード例 #17
0
 @Test
 public void testExamineStorageSubSystemCommandNfsVersion() {
   _resource.examineStorageSubSystemCommandNfsVersion(storageCmd, params);
   assertEquals(1, params.size());
   assertEquals(NFS_VERSION, params.get(VmwareStorageProcessorConfigurableFields.NFS_VERSION));
 }
コード例 #18
0
 @Test
 public void testExamineStorageSubSystemCommandNfsVersionNotPresent() {
   when(srcDataNfsTO.getNfsVersion()).thenReturn(NFS_VERSION_NOT_PRESENT);
   _resource.examineStorageSubSystemCommandNfsVersion(storageCmd, params);
   assertTrue(params.isEmpty());
 }
コード例 #19
0
 @Test
 public void testgetNfsVersionFromNfsTONfsVersionNull() {
   when(srcDataNfsTO.getNfsVersion()).thenReturn(NFS_VERSION_NOT_PRESENT);
   assertFalse(_resource.getStorageNfsVersionFromNfsTO(srcDataNfsTO));
 }
コード例 #20
0
 @Test
 public void testgetNfsVersionFromNfsTONull() {
   assertFalse(_resource.getStorageNfsVersionFromNfsTO(null));
 }
コード例 #21
0
 @Test
 public void testModifyVmVideoCardVRamSizeEqualSizes() {
   _resource.modifyVmVideoCardVRamSize(videoCard, vmMo3dgpu, VIDEO_CARD_MEMORY_SIZE, vmConfigSpec);
   verify(_resource, never())
       .configureSpecVideoCardNewVRamSize(videoCard, VIDEO_CARD_MEMORY_SIZE, vmConfigSpec);
 }
コード例 #22
0
 @Test
 public void testConfigNestedHVSupportFlagFalse() throws Exception {
   specsArray.put(VmDetailConstants.NESTED_VIRTUALIZATION_FLAG, "false");
   _resource.configNestedHVSupport(vmMo, vmSpec, vmConfigSpec);
   verify(vmMo, never()).getRunningHost();
 }
コード例 #23
0
 @Test
 public void testSetCurrentNfsVersionInProcessorAndHandler() {
   params.put(VmwareStorageProcessorConfigurableFields.NFS_VERSION, NFS_VERSION);
   _resource.reconfigureProcessorByHandler(params);
   verify(storageHandler).reconfigureStorageProcessor(params);
 }