当前位置: 首页>>代码示例>>Java>>正文


Java CustomizationSpec类代码示例

本文整理汇总了Java中com.vmware.vim25.CustomizationSpec的典型用法代码示例。如果您正苦于以下问题:Java CustomizationSpec类的具体用法?Java CustomizationSpec怎么用?Java CustomizationSpec使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CustomizationSpec类属于com.vmware.vim25包,在下文中一共展示了CustomizationSpec类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setUp

import com.vmware.vim25.CustomizationSpec; //导入依赖的package包/类
@BeforeMethod
@Override
protected void setUp() throws Exception {
  super.setUp();
  myIdxStorage = createTempDir();
  FakeModel.instance().addDatacenter("dc");
  FakeModel.instance().addFolder("cf").setParent("dc", Datacenter.class);
  FakeModel.instance().addResourcePool("rp").setParentFolder("cf");
  FakeModel.instance().addVM("image1").setParentFolder("cf");
  FakeModel.instance().addVM("image2").setParentFolder("cf");
  FakeModel.instance().addVM("image_template").setParentFolder("cf");
  FakeModel.instance().addVMSnapshot("image2", "snap");
  FakeModel.instance().getCustomizationSpecs().put("someCustomization", new CustomizationSpec());
  FakeModel.instance().getCustomizationSpecs().put("linux", new CustomizationSpec());
  myFakeApiConnector = new FakeApiConnector(TEST_SERVER_UUID, PROFILE_ID, null);
  setInternalProperty("teamcity.vsphere.instance.status.update.delay.ms", "250");
  myTaskManager = new MyExposingVmwareUpdateTaskManager();
}
 
开发者ID:JetBrains,项目名称:teamcity-vmware-plugin,代码行数:19,代码来源:VmwarePooledUpdateInstanceTaskTest.java

示例2: customizeNic

import com.vmware.vim25.CustomizationSpec; //导入依赖的package包/类
public void customizeNic(String macAddress, String hostName, String address,
        SubnetState subnetState, CustomizationSpec template) {
    // remove existing mapping
    template.getNicSettingMap().removeIf(x -> Objects.equals(x.getMacAddress(), macAddress));

    CustomizationAdapterMapping mapping = new CustomizationAdapterMapping();
    mapping.setMacAddress(macAddress);
    CustomizationIPSettings adapter = new CustomizationIPSettings();
    mapping.setAdapter(adapter);

    adapter.setSubnetMask(cidr2mask(subnetState.subnetCIDR));
    adapter.getGateway().add(subnetState.gatewayAddress);
    adapter.setDnsDomain(subnetState.domain);
    CustomizationFixedIp ipGen = new CustomizationFixedIp();
    ipGen.setIpAddress(address);
    adapter.setIp(ipGen);

    template.getNicSettingMap().add(mapping);

    if (isLinux()) {
        CustomizationLinuxPrep identity = new CustomizationLinuxPrep();
        template.setIdentity(identity);
        identity.setDomain(subnetState.domain);

        CustomizationFixedName name = new CustomizationFixedName();
        if (hostName == null || hostName.isEmpty()) {
            hostName = makeHostName(UriUtils.getLastPathSegment(this.state.documentSelfLink));
        }
        name.setName(hostName);
        identity.setHostName(name);

        template.setOptions(new CustomizationLinuxOptions());
    }
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:35,代码来源:CustomizationClient.java

示例3: customizeDns

import com.vmware.vim25.CustomizationSpec; //导入依赖的package包/类
public void customizeDns(List<String> dnsServers, List<String> dnsSearchDomains,
        CustomizationSpec template) {
    CustomizationGlobalIPSettings settings = new CustomizationGlobalIPSettings();
    if (dnsServers != null) {
        settings.getDnsServerList().addAll(dnsServers);
    }

    if (dnsSearchDomains != null) {
        settings.getDnsSuffixList().addAll(dnsSearchDomains);
    }

    template.setGlobalIPSettings(settings);
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:14,代码来源:CustomizationClient.java

示例4: configureVirtualMachineCloneSpec

import com.vmware.vim25.CustomizationSpec; //导入依赖的package包/类
private VirtualMachineCloneSpec configureVirtualMachineCloneSpec(VirtualMachineRelocateSpec rSpec, String linuxName, boolean postConfiguration) throws Exception {

      VirtualMachineCloneSpec cloneSpec = new VirtualMachineCloneSpec();
      cloneSpec.setPowerOn(true);
      cloneSpec.setTemplate(false);
      //cloneSpec.setSnapshot(currentSnapshot.getMOR());
      cloneSpec.setLocation(rSpec);
      if (postConfiguration) {
         CustomizationSpec customizationSpec = new CustomizationSpec();
         CustomizationLinuxPrep linuxPrep = new CustomizationLinuxPrep();
         CustomizationFixedName fixedName = new CustomizationFixedName();
         fixedName.setName(linuxName);
         linuxPrep.setHostName(fixedName);
         linuxPrep.setDomain("");
         linuxPrep.setHwClockUTC(true);
         //linuxPrep.setTimeZone("Etc/UTC");
         customizationSpec.setIdentity(linuxPrep);
         customizationSpec.setGlobalIPSettings(new CustomizationGlobalIPSettings());
         CustomizationAdapterMapping[] nicSettingMap = new CustomizationAdapterMapping[1];
         nicSettingMap[0] = new CustomizationAdapterMapping();
         nicSettingMap[0].adapter = new CustomizationIPSettings();
         nicSettingMap[0].adapter.setIp(new CustomizationDhcpIpGenerator());
         customizationSpec.setNicSettingMap(nicSettingMap);
         cloneSpec.setCustomization(customizationSpec);
      }


      return cloneSpec;
   }
 
开发者ID:igreenfield,项目名称:jcloud-vsphere,代码行数:30,代码来源:MasterToVirtualMachineCloneSpec.java

示例5: getCustomizationSpec

import com.vmware.vim25.CustomizationSpec; //导入依赖的package包/类
@Override
public CustomizationSpec getCustomizationSpec(final String name) throws VmwareCheckedCloudException {
  final CustomizationSpec spec = FakeModel.instance().getCustomizationSpec(name);
  if (spec == null){
    throw new VmwareCheckedCloudException("Unable to get Customization Spec '" + name + "'");
  }
  return spec;
}
 
开发者ID:JetBrains,项目名称:teamcity-vmware-plugin,代码行数:9,代码来源:FakeApiConnector.java

示例6: customizeVM

import com.vmware.vim25.CustomizationSpec; //导入依赖的package包/类
/**
 * Method used to connect to specified data center and customize the windows OS based virtual machine identified
 * by the inputs provided.
 *
 * @param httpInputs  Object that has all the inputs necessary to made a connection to data center
 * @param vmInputs    Object that has all the specific inputs necessary to identify the targeted virtual machine
 * @param guestInputs Object that has all specific inputs necessary to customize specified virtual machine
 * @return Map with String as key and value that contains returnCode of the operation, success message with task id
 *         of the execution or failure message and the exception if there is one
 * @throws Exception
 */
public Map<String, String> customizeVM(HttpInputs httpInputs, VmInputs vmInputs, GuestInputs guestInputs, boolean isWin)
        throws Exception {
    ConnectionResources connectionResources = new ConnectionResources(httpInputs, vmInputs);
    try {
        ManagedObjectReference vmMor = new MorObjectHandler()
                .getMor(connectionResources, ManagedObjectType.VIRTUAL_MACHINE.getValue(), vmInputs.getVirtualMachineName());
        if (vmMor != null) {
            CustomizationSpec customizationSpec = isWin ? new GuestConfigSpecs().getWinCustomizationSpec(guestInputs)
                    : new GuestConfigSpecs().getLinuxCustomizationSpec(guestInputs);

            connectionResources.getVimPortType().checkCustomizationSpec(vmMor, customizationSpec);
            ManagedObjectReference task = connectionResources.getVimPortType().customizeVMTask(vmMor, customizationSpec);

            return new ResponseHelper(connectionResources, task)
                    .getResultsMap("Success: The [" +
                    vmInputs.getVirtualMachineName() + "] VM was successfully customized. The taskId is: " +
                    task.getValue(), "Failure: The [" + vmInputs.getVirtualMachineName() + "] VM could not be customized.");
        } else {
            return ResponseUtils.getVmNotFoundResultsMap(vmInputs);
        }
    } catch (Exception ex) {
        return ResponseUtils.getResultsMap(ex.toString(), Outputs.RETURN_CODE_FAILURE);
    } finally {
        if (httpInputs.isCloseSession()) {
            connectionResources.getConnection().disconnect();
            clearConnectionFromContext(httpInputs.getGlobalSessionObject());
        }
    }
}
 
开发者ID:CloudSlang,项目名称:cs-actions,代码行数:41,代码来源:GuestService.java

示例7: customizeWinVMSuccess

import com.vmware.vim25.CustomizationSpec; //导入依赖的package包/类
@Test
public void customizeWinVMSuccess() throws Exception {
    whenNew(MorObjectHandler.class).withNoArguments().thenReturn(morObjectHandlerMock);
    when(httpInputsMock.isCloseSession()).thenReturn(true);
    when(morObjectHandlerMock.getMor(any(ConnectionResources.class), anyString(), anyString())).thenReturn(vmMorMock);
    whenNew(GuestConfigSpecs.class).withNoArguments().thenReturn(guestConfigSpecsMock);
    when(guestConfigSpecsMock.getWinCustomizationSpec(any(GuestInputs.class))).thenReturn(customizationSpecMock);
    doNothing().when(vimPortMock).checkCustomizationSpec(any(ManagedObjectReference.class), any(CustomizationSpec.class));
    when(vimPortMock.customizeVMTask(any(ManagedObjectReference.class), any(CustomizationSpec.class))).thenReturn(taskMock);
    whenNew(ResponseHelper.class).withArguments(any(ConnectionResources.class), any(ManagedObjectReference.class))
            .thenReturn(getResponseHelper(connectionResourcesMock, taskMock, true));

    VmInputs vmInputs = new VmInputs.VmInputsBuilder().withVirtualMachineName("testWinVMName").build();
    GuestInputs guestInputs = new GuestInputs.GuestInputsBuilder()
            .withRebootOption("noreboot").withLicenseDataMode("perServer").build();

    Map<String, String> results = guestService.customizeVM(httpInputsMock, vmInputs, guestInputs, true);

    verifyConnection();
    verify(morObjectHandlerMock, times(1)).getMor(any(ConnectionResources.class), anyString(), anyString());
    verify(guestConfigSpecsMock, times(1)).getWinCustomizationSpec(any(GuestInputs.class));
    verify(vimPortMock, times(1)).checkCustomizationSpec(any(ManagedObjectReference.class), any(CustomizationSpec.class));
    verify(vimPortMock, times(1)).customizeVMTask(any(ManagedObjectReference.class), any(CustomizationSpec.class));
    verify(taskMock, times(1)).getValue();

    assertNotNull(results);
    assertEquals(0, Integer.parseInt(results.get("returnCode")));
    assertEquals("Success: The [testWinVMName] VM was successfully customized. The taskId is: task-12345", results.get("returnResult"));
}
 
开发者ID:CloudSlang,项目名称:cs-actions,代码行数:30,代码来源:GuestServiceTest.java

示例8: customizeWinVMFailure

import com.vmware.vim25.CustomizationSpec; //导入依赖的package包/类
@Test
public void customizeWinVMFailure() throws Exception {
    whenNew(MorObjectHandler.class).withNoArguments().thenReturn(morObjectHandlerMock);
    when(httpInputsMock.isCloseSession()).thenReturn(true);
    when(morObjectHandlerMock.getMor(any(ConnectionResources.class), anyString(), anyString())).thenReturn(vmMorMock);
    whenNew(GuestConfigSpecs.class).withNoArguments().thenReturn(guestConfigSpecsMock);
    when(guestConfigSpecsMock.getWinCustomizationSpec(any(GuestInputs.class))).thenReturn(customizationSpecMock);
    doNothing().when(vimPortMock).checkCustomizationSpec(any(ManagedObjectReference.class), any(CustomizationSpec.class));
    when(vimPortMock.customizeVMTask(any(ManagedObjectReference.class), any(CustomizationSpec.class))).thenReturn(taskMock);
    whenNew(ResponseHelper.class).withArguments(any(ConnectionResources.class), any(ManagedObjectReference.class))
            .thenReturn(getResponseHelper(connectionResourcesMock, taskMock, false));

    VmInputs vmInputs = new VmInputs.VmInputsBuilder().withVirtualMachineName("testWinVMName").build();
    GuestInputs guestInputs = new GuestInputs.GuestInputsBuilder()
            .withRebootOption("noreboot").withLicenseDataMode("perServer").build();

    Map<String, String> results = guestService.customizeVM(httpInputsMock, vmInputs, guestInputs, true);

    verifyConnection();
    verify(morObjectHandlerMock, times(1)).getMor(any(ConnectionResources.class), anyString(), anyString());
    verify(guestConfigSpecsMock, times(1)).getWinCustomizationSpec(any(GuestInputs.class));
    verify(vimPortMock, times(1)).checkCustomizationSpec(any(ManagedObjectReference.class), any(CustomizationSpec.class));
    verify(vimPortMock, times(1)).customizeVMTask(any(ManagedObjectReference.class), any(CustomizationSpec.class));
    verify(taskMock, times(1)).getValue();

    assertNotNull(results);
    assertEquals(-1, Integer.parseInt(results.get("returnCode")));
    assertEquals("Failure: The [testWinVMName] VM could not be customized.", results.get("returnResult"));
}
 
开发者ID:CloudSlang,项目名称:cs-actions,代码行数:30,代码来源:GuestServiceTest.java

示例9: customizeWinVMNotFound

import com.vmware.vim25.CustomizationSpec; //导入依赖的package包/类
@Test
public void customizeWinVMNotFound() throws Exception {
    whenNew(MorObjectHandler.class).withNoArguments().thenReturn(morObjectHandlerMock);
    when(httpInputsMock.isCloseSession()).thenReturn(true);
    when(morObjectHandlerMock.getMor(any(ConnectionResources.class), anyString(), anyString())).thenReturn(null);
    whenNew(GuestConfigSpecs.class).withNoArguments().thenReturn(guestConfigSpecsMock);
    when(guestConfigSpecsMock.getWinCustomizationSpec(any(GuestInputs.class))).thenReturn(customizationSpecMock);
    doNothing().when(vimPortMock).checkCustomizationSpec(any(ManagedObjectReference.class), any(CustomizationSpec.class));
    when(vimPortMock.customizeVMTask(any(ManagedObjectReference.class), any(CustomizationSpec.class))).thenReturn(taskMock);
    whenNew(ResponseHelper.class).withArguments(any(ConnectionResources.class), any(ManagedObjectReference.class))
            .thenReturn(getResponseHelper(connectionResourcesMock, taskMock, true));

    VmInputs vmInputs = new VmInputs.VmInputsBuilder().withVirtualMachineName("testWinVMName").build();
    GuestInputs guestInputs = new GuestInputs.GuestInputsBuilder()
            .withRebootOption("noreboot").withLicenseDataMode("perServer").build();

    Map<String, String> results = guestService.customizeVM(httpInputsMock, vmInputs, guestInputs, true);

    verify(connectionResourcesMock, times(1)).getConnection();
    verify(connectionMock, times(1)).disconnect();
    verify(morObjectHandlerMock, times(1)).getMor(any(ConnectionResources.class), anyString(), anyString());
    verify(connectionResourcesMock, never()).getVimPortType();
    verify(guestConfigSpecsMock, never()).getWinCustomizationSpec(any(GuestInputs.class));
    verify(vimPortMock, never()).checkCustomizationSpec(any(ManagedObjectReference.class), any(CustomizationSpec.class));
    verify(vimPortMock, never()).customizeVMTask(any(ManagedObjectReference.class), any(CustomizationSpec.class));
    verify(taskMock, never()).getValue();

    assertNotNull(results);
    assertEquals(-1, Integer.parseInt(results.get("returnCode")));
    assertEquals("Could not find the [testWinVMName] VM.", results.get("returnResult"));
}
 
开发者ID:CloudSlang,项目名称:cs-actions,代码行数:32,代码来源:GuestServiceTest.java

示例10: customizeLinuxVMSuccess

import com.vmware.vim25.CustomizationSpec; //导入依赖的package包/类
@Test
public void customizeLinuxVMSuccess() throws Exception {
    whenNew(MorObjectHandler.class).withNoArguments().thenReturn(morObjectHandlerMock);
    when(httpInputsMock.isCloseSession()).thenReturn(true);
    when(morObjectHandlerMock.getMor(any(ConnectionResources.class), anyString(), anyString())).thenReturn(vmMorMock);
    whenNew(GuestConfigSpecs.class).withNoArguments().thenReturn(guestConfigSpecsMock);
    when(guestConfigSpecsMock.getLinuxCustomizationSpec(any(GuestInputs.class))).thenReturn(customizationSpecMock);
    doNothing().when(vimPortMock).checkCustomizationSpec(any(ManagedObjectReference.class), any(CustomizationSpec.class));
    when(vimPortMock.customizeVMTask(any(ManagedObjectReference.class), any(CustomizationSpec.class))).thenReturn(taskMock);
    whenNew(ResponseHelper.class).withArguments(any(ConnectionResources.class), any(ManagedObjectReference.class))
            .thenReturn(getResponseHelper(connectionResourcesMock, taskMock, true));

    VmInputs vmInputs = new VmInputs.VmInputsBuilder().withVirtualMachineName("testLinuxVMName").build();
    GuestInputs guestInputs = new GuestInputs.GuestInputsBuilder().build();

    Map<String, String> results = guestService.customizeVM(httpInputsMock, vmInputs, guestInputs, false);

    verifyConnection();
    verify(morObjectHandlerMock, times(1)).getMor(any(ConnectionResources.class), anyString(), anyString());
    verify(guestConfigSpecsMock, times(1)).getLinuxCustomizationSpec(any(GuestInputs.class));
    verify(vimPortMock, times(1)).checkCustomizationSpec(any(ManagedObjectReference.class), any(CustomizationSpec.class));
    verify(vimPortMock, times(1)).customizeVMTask(any(ManagedObjectReference.class), any(CustomizationSpec.class));
    verify(taskMock, times(1)).getValue();

    assertNotNull(results);
    assertEquals(0, Integer.parseInt(results.get("returnCode")));
    assertEquals("Success: The [testLinuxVMName] VM was successfully customized. The taskId is: task-12345", results.get("returnResult"));
}
 
开发者ID:CloudSlang,项目名称:cs-actions,代码行数:29,代码来源:GuestServiceTest.java

示例11: customizeLinuxVMFailure

import com.vmware.vim25.CustomizationSpec; //导入依赖的package包/类
@Test
public void customizeLinuxVMFailure() throws Exception {
    whenNew(MorObjectHandler.class).withNoArguments().thenReturn(morObjectHandlerMock);
    when(httpInputsMock.isCloseSession()).thenReturn(true);
    when(morObjectHandlerMock.getMor(any(ConnectionResources.class), anyString(), anyString())).thenReturn(vmMorMock);
    whenNew(GuestConfigSpecs.class).withNoArguments().thenReturn(guestConfigSpecsMock);
    when(guestConfigSpecsMock.getLinuxCustomizationSpec(any(GuestInputs.class))).thenReturn(customizationSpecMock);
    doNothing().when(vimPortMock).checkCustomizationSpec(any(ManagedObjectReference.class), any(CustomizationSpec.class));
    when(vimPortMock.customizeVMTask(any(ManagedObjectReference.class), any(CustomizationSpec.class))).thenReturn(taskMock);
    whenNew(ResponseHelper.class).withArguments(any(ConnectionResources.class), any(ManagedObjectReference.class))
            .thenReturn(getResponseHelper(connectionResourcesMock, taskMock, false));

    VmInputs vmInputs = new VmInputs.VmInputsBuilder().withVirtualMachineName("testLinuxVMName").build();
    GuestInputs guestInputs = new GuestInputs.GuestInputsBuilder().build();

    Map<String, String> results = guestService.customizeVM(httpInputsMock, vmInputs, guestInputs, false);

    verifyConnection();
    verify(morObjectHandlerMock, times(1)).getMor(any(ConnectionResources.class), anyString(), anyString());
    verify(guestConfigSpecsMock, times(1)).getLinuxCustomizationSpec(any(GuestInputs.class));
    verify(vimPortMock, times(1)).checkCustomizationSpec(any(ManagedObjectReference.class), any(CustomizationSpec.class));
    verify(vimPortMock, times(1)).customizeVMTask(any(ManagedObjectReference.class), any(CustomizationSpec.class));
    verify(taskMock, times(1)).getValue();

    assertNotNull(results);
    assertEquals(-1, Integer.parseInt(results.get("returnCode")));
    assertEquals("Failure: The [testLinuxVMName] VM could not be customized.", results.get("returnResult"));
}
 
开发者ID:CloudSlang,项目名称:cs-actions,代码行数:29,代码来源:GuestServiceTest.java

示例12: customizeLinuxVMNotFound

import com.vmware.vim25.CustomizationSpec; //导入依赖的package包/类
@Test
public void customizeLinuxVMNotFound() throws Exception {
    whenNew(MorObjectHandler.class).withNoArguments().thenReturn(morObjectHandlerMock);
    when(httpInputsMock.isCloseSession()).thenReturn(true);
    when(morObjectHandlerMock.getMor(any(ConnectionResources.class), anyString(), anyString())).thenReturn(null);
    whenNew(GuestConfigSpecs.class).withNoArguments().thenReturn(guestConfigSpecsMock);
    when(guestConfigSpecsMock.getLinuxCustomizationSpec(any(GuestInputs.class))).thenReturn(customizationSpecMock);
    doNothing().when(vimPortMock).checkCustomizationSpec(any(ManagedObjectReference.class), any(CustomizationSpec.class));
    when(vimPortMock.customizeVMTask(any(ManagedObjectReference.class), any(CustomizationSpec.class))).thenReturn(taskMock);
    whenNew(ResponseHelper.class).withArguments(any(ConnectionResources.class), any(ManagedObjectReference.class))
            .thenReturn(getResponseHelper(connectionResourcesMock, taskMock, true));

    VmInputs vmInputs = new VmInputs.VmInputsBuilder().withVirtualMachineName("testLinuxVMName").build();
    GuestInputs guestInputs = new GuestInputs.GuestInputsBuilder().build();

    Map<String, String> results = guestService.customizeVM(httpInputsMock, vmInputs, guestInputs, false);

    verify(connectionResourcesMock, times(1)).getConnection();
    verify(connectionMock, times(1)).disconnect();
    verify(morObjectHandlerMock, times(1)).getMor(any(ConnectionResources.class), anyString(), anyString());
    verify(connectionResourcesMock, never()).getVimPortType();
    verify(guestConfigSpecsMock, never()).getLinuxCustomizationSpec(any(GuestInputs.class));
    verify(vimPortMock, never()).checkCustomizationSpec(any(ManagedObjectReference.class), any(CustomizationSpec.class));
    verify(vimPortMock, never()).customizeVMTask(any(ManagedObjectReference.class), any(CustomizationSpec.class));
    verify(taskMock, never()).getValue();

    assertNotNull(results);
    assertEquals(-1, Integer.parseInt(results.get("returnCode")));
    assertEquals("Could not find the [testLinuxVMName] VM.", results.get("returnResult"));
}
 
开发者ID:CloudSlang,项目名称:cs-actions,代码行数:31,代码来源:GuestServiceTest.java

示例13: customizeLinuxVMException

import com.vmware.vim25.CustomizationSpec; //导入依赖的package包/类
@Test
public void customizeLinuxVMException() throws Exception {
    whenNew(MorObjectHandler.class).withNoArguments().thenReturn(morObjectHandlerMock);
    when(httpInputsMock.isCloseSession()).thenReturn(true);
    when(morObjectHandlerMock.getMor(any(ConnectionResources.class), anyString(), anyString())).thenReturn(vmMorMock);
    whenNew(GuestConfigSpecs.class).withNoArguments().thenReturn(guestConfigSpecsMock);
    when(guestConfigSpecsMock.getLinuxCustomizationSpec(any(GuestInputs.class))).thenReturn(customizationSpecMock);
    doNothing().when(vimPortMock).checkCustomizationSpec(any(ManagedObjectReference.class), any(CustomizationSpec.class));
    when(vimPortMock.customizeVMTask(any(ManagedObjectReference.class), any(CustomizationSpec.class))).thenReturn(null);
    whenNew(ResponseHelper.class).withArguments(any(ConnectionResources.class), any(ManagedObjectReference.class))
            .thenReturn(getResponseHelper(connectionResourcesMock, taskMock, true));

    VmInputs vmInputs = new VmInputs.VmInputsBuilder().withVirtualMachineName("testLinuxVMName").build();
    GuestInputs guestInputs = new GuestInputs.GuestInputsBuilder().build();

    Map<String, String> results = guestService.customizeVM(httpInputsMock, vmInputs, guestInputs, false);

    verify(connectionResourcesMock, times(1)).getConnection();
    verify(connectionMock, times(1)).disconnect();
    verify(morObjectHandlerMock, times(1)).getMor(any(ConnectionResources.class), anyString(), anyString());
    verify(connectionResourcesMock, times(2)).getVimPortType();
    verify(guestConfigSpecsMock, times(1)).getLinuxCustomizationSpec(any(GuestInputs.class));
    verify(vimPortMock, times(1)).checkCustomizationSpec(any(ManagedObjectReference.class), any(CustomizationSpec.class));
    verify(vimPortMock, times(1)).customizeVMTask(any(ManagedObjectReference.class), any(CustomizationSpec.class));
    verify(taskMock, never()).getValue();

    assertNotNull(results);
    assertEquals(-1, Integer.parseInt(results.get("returnCode")));
    assertEquals("java.lang.NullPointerException", results.get("returnResult"));
}
 
开发者ID:CloudSlang,项目名称:cs-actions,代码行数:31,代码来源:GuestServiceTest.java

示例14: customizeGuest

import com.vmware.vim25.CustomizationSpec; //导入依赖的package包/类
public ManagedObjectReference customizeGuest(ManagedObjectReference vm, CustomizationSpec spec)
        throws RuntimeFaultFaultMsg, CustomizationFaultFaultMsg {
    return connection.getVimPort().customizeVMTask(vm, spec);
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:5,代码来源:CustomizationClient.java

示例15: getCustomizationSpecs

import com.vmware.vim25.CustomizationSpec; //导入依赖的package包/类
public Map<String, CustomizationSpec> getCustomizationSpecs() {
  return myCustomizationSpecs;
}
 
开发者ID:JetBrains,项目名称:teamcity-vmware-plugin,代码行数:4,代码来源:FakeModel.java


注:本文中的com.vmware.vim25.CustomizationSpec类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。