@Test public void getVmOverrideWithVmInformationAndConfigurationsSuccess() throws Exception { commonVmMockInitializations(); VmInputs vmInputs = new VmInputs.VmInputsBuilder() .withVirtualMachineId(VM_ID_VALUE) .build(); String result = clusterComputeResourceServiceSpy.getVmOverride(httpInputsMock, vmInputs); assertNotNull(result); assertEquals(DAS_RESTART_PRIORITY, result); }
public String getVmOverride(final HttpInputs httpInputs, final VmInputs vmInputs) throws Exception { ConnectionResources connectionResources = new ConnectionResources(httpInputs, vmInputs); try { final ManagedObjectReference clusterMor = new MorObjectHandler().getSpecificMor(connectionResources, connectionResources.getMorRootFolder(), ClusterParameter.CLUSTER_COMPUTE_RESOURCE.getValue(), vmInputs.getClusterName()); final ClusterConfigInfoEx clusterConfigInfoEx = getClusterConfiguration(connectionResources, clusterMor, vmInputs.getClusterName()); final String restartPriority; if (StringUtilities.isNotBlank(vmInputs.getVirtualMachineId()) || StringUtilities.isNotBlank(vmInputs.getVirtualMachineName())) { final ManagedObjectReference vmMor = getVirtualMachineReference(vmInputs, connectionResources); restartPriority = getVmRestartPriority(clusterConfigInfoEx, vmMor); } else { restartPriority = getVmRestartPriority(clusterConfigInfoEx); } return restartPriority; } finally { if (httpInputs.isCloseSession()) { connectionResources.getConnection().disconnect(); clearConnectionFromContext(httpInputs.getGlobalSessionObject()); } } }
ClusterComputeResourceService { public String getVmOverride(final HttpInputs httpInputs, final VmInputs vmInputs) throws Exception { ConnectionResources connectionResources = new ConnectionResources(httpInputs, vmInputs); try { final ManagedObjectReference clusterMor = new MorObjectHandler().getSpecificMor(connectionResources, connectionResources.getMorRootFolder(), ClusterParameter.CLUSTER_COMPUTE_RESOURCE.getValue(), vmInputs.getClusterName()); final ClusterConfigInfoEx clusterConfigInfoEx = getClusterConfiguration(connectionResources, clusterMor, vmInputs.getClusterName()); final String restartPriority; if (StringUtilities.isNotBlank(vmInputs.getVirtualMachineId()) || StringUtilities.isNotBlank(vmInputs.getVirtualMachineName())) { final ManagedObjectReference vmMor = getVirtualMachineReference(vmInputs, connectionResources); restartPriority = getVmRestartPriority(clusterConfigInfoEx, vmMor); } else { restartPriority = getVmRestartPriority(clusterConfigInfoEx); } return restartPriority; } finally { if (httpInputs.isCloseSession()) { connectionResources.getConnection().disconnect(); clearConnectionFromContext(httpInputs.getGlobalSessionObject()); } } } }
ClusterComputeResourceService { public String getVmOverride(final HttpInputs httpInputs, final VmInputs vmInputs) throws Exception { ConnectionResources connectionResources = new ConnectionResources(httpInputs, vmInputs); try { final ManagedObjectReference clusterMor = new MorObjectHandler().getSpecificMor(connectionResources, connectionResources.getMorRootFolder(), ClusterParameter.CLUSTER_COMPUTE_RESOURCE.getValue(), vmInputs.getClusterName()); final ClusterConfigInfoEx clusterConfigInfoEx = getClusterConfiguration(connectionResources, clusterMor, vmInputs.getClusterName()); final String restartPriority; if (StringUtilities.isNotBlank(vmInputs.getVirtualMachineId()) || StringUtilities.isNotBlank(vmInputs.getVirtualMachineName())) { final ManagedObjectReference vmMor = getVirtualMachineReference(vmInputs, connectionResources); restartPriority = getVmRestartPriority(clusterConfigInfoEx, vmMor); } else { restartPriority = getVmRestartPriority(clusterConfigInfoEx); } return restartPriority; } finally { if (httpInputs.isCloseSession()) { connectionResources.getConnection().disconnect(); clearConnectionFromContext(httpInputs.getGlobalSessionObject()); } } }  }
ClusterComputeResourceService { public String getVmOverride(final HttpInputs httpInputs, final VmInputs vmInputs) throws Exception { ConnectionResources connectionResources = new ConnectionResources(httpInputs, vmInputs); try { final ManagedObjectReference clusterMor = new MorObjectHandler().getSpecificMor(connectionResources, connectionResources.getMorRootFolder(), ClusterParameter.CLUSTER_COMPUTE_RESOURCE.getValue(), vmInputs.getClusterName()); final ClusterConfigInfoEx clusterConfigInfoEx = getClusterConfiguration(connectionResources, clusterMor, vmInputs.getClusterName()); final String restartPriority; if (StringUtilities.isNotBlank(vmInputs.getVirtualMachineId()) || StringUtilities.isNotBlank(vmInputs.getVirtualMachineName())) { final ManagedObjectReference vmMor = getVirtualMachineReference(vmInputs, connectionResources); restartPriority = getVmRestartPriority(clusterConfigInfoEx, vmMor); } else { restartPriority = getVmRestartPriority(clusterConfigInfoEx); } return restartPriority; } finally { if (httpInputs.isCloseSession()) { connectionResources.getConnection().disconnect(); clearConnectionFromContext(httpInputs.getGlobalSessionObject()); } } }  Map<String, String> updateOrAddVmOverride(final HttpInputs httpInputs, final VmInputs vmInputs, final String restartPriority); String getVmOverride(final HttpInputs httpInputs, final VmInputs vmInputs); Map<String, String> createVmGroup(HttpInputs httpInputs, VmInputs vmInputs, List<String> vmNameList); Map<String, String> deleteVmGroup(HttpInputs httpInputs, VmInputs vmInputs); String listGroups(HttpInputs httpInputs, String clusterName, String delimiter, Class clazz); Map<String, String> createHostGroup(HttpInputs httpInputs, VmInputs vmInputs, List<String> hostNameList); Map<String, String> deleteHostGroup(HttpInputs httpInputs, VmInputs vmInputs); Map<String, String> createAffinityRule(HttpInputs httpInputs, VmInputs vmInputs,
                                                  String affineHostGroupName, String antiAffineHostGroupName); Map<String, String> deleteClusterRule(HttpInputs httpInputs, VmInputs vmInputs); }
ClusterComputeResourceService { public String getVmOverride(final HttpInputs httpInputs, final VmInputs vmInputs) throws Exception { ConnectionResources connectionResources = new ConnectionResources(httpInputs, vmInputs); try { final ManagedObjectReference clusterMor = new MorObjectHandler().getSpecificMor(connectionResources, connectionResources.getMorRootFolder(), ClusterParameter.CLUSTER_COMPUTE_RESOURCE.getValue(), vmInputs.getClusterName()); final ClusterConfigInfoEx clusterConfigInfoEx = getClusterConfiguration(connectionResources, clusterMor, vmInputs.getClusterName()); final String restartPriority; if (StringUtilities.isNotBlank(vmInputs.getVirtualMachineId()) || StringUtilities.isNotBlank(vmInputs.getVirtualMachineName())) { final ManagedObjectReference vmMor = getVirtualMachineReference(vmInputs, connectionResources); restartPriority = getVmRestartPriority(clusterConfigInfoEx, vmMor); } else { restartPriority = getVmRestartPriority(clusterConfigInfoEx); } return restartPriority; } finally { if (httpInputs.isCloseSession()) { connectionResources.getConnection().disconnect(); clearConnectionFromContext(httpInputs.getGlobalSessionObject()); } } }  Map<String, String> updateOrAddVmOverride(final HttpInputs httpInputs, final VmInputs vmInputs, final String restartPriority); String getVmOverride(final HttpInputs httpInputs, final VmInputs vmInputs); Map<String, String> createVmGroup(HttpInputs httpInputs, VmInputs vmInputs, List<String> vmNameList); Map<String, String> deleteVmGroup(HttpInputs httpInputs, VmInputs vmInputs); String listGroups(HttpInputs httpInputs, String clusterName, String delimiter, Class clazz); Map<String, String> createHostGroup(HttpInputs httpInputs, VmInputs vmInputs, List<String> hostNameList); Map<String, String> deleteHostGroup(HttpInputs httpInputs, VmInputs vmInputs); Map<String, String> createAffinityRule(HttpInputs httpInputs, VmInputs vmInputs,
                                                  String affineHostGroupName, String antiAffineHostGroupName); Map<String, String> deleteClusterRule(HttpInputs httpInputs, VmInputs vmInputs);  }