@Test public void createVmGroupSuccess() throws Exception { commonVmGroupMockInitializations(); VmInputs vmInputs = getVmInputs(); List<String> vmList = getList(); whenNew(ResponseHelper.class).withArguments(any(ConnectionResources.class), any(ManagedObjectReference.class)) .thenReturn(getResponseHelper(connectionResourcesMock, taskMock, true)); Map<String, String> resultMap = clusterComputeResourceService.createVmGroup(httpInputsMock, vmInputs, vmList); commonVerifications(); assertionsSuccess(resultMap); }
public Map<String, String> createVmGroup(HttpInputs httpInputs, VmInputs vmInputs, List<String> vmNameList) throws Exception { ConnectionResources connectionResources = new ConnectionResources(httpInputs); try { ClusterVmGroup clusterVmGroup = new ClusterVmGroup(); clusterVmGroup.setName(vmInputs.getVmGroupName()); clusterVmGroup.getVm().addAll(getVmManagedObjectReferences(vmNameList, connectionResources)); return createGroup(vmInputs, connectionResources, clusterVmGroup); } finally { if (httpInputs.isCloseSession()) { connectionResources.getConnection().disconnect(); clearConnectionFromContext(httpInputs.getGlobalSessionObject()); } } }
ClusterComputeResourceService { public Map<String, String> createVmGroup(HttpInputs httpInputs, VmInputs vmInputs, List<String> vmNameList) throws Exception { ConnectionResources connectionResources = new ConnectionResources(httpInputs); try { ClusterVmGroup clusterVmGroup = new ClusterVmGroup(); clusterVmGroup.setName(vmInputs.getVmGroupName()); clusterVmGroup.getVm().addAll(getVmManagedObjectReferences(vmNameList, connectionResources)); return createGroup(vmInputs, connectionResources, clusterVmGroup); } finally { if (httpInputs.isCloseSession()) { connectionResources.getConnection().disconnect(); clearConnectionFromContext(httpInputs.getGlobalSessionObject()); } } } }
ClusterComputeResourceService { public Map<String, String> createVmGroup(HttpInputs httpInputs, VmInputs vmInputs, List<String> vmNameList) throws Exception { ConnectionResources connectionResources = new ConnectionResources(httpInputs); try { ClusterVmGroup clusterVmGroup = new ClusterVmGroup(); clusterVmGroup.setName(vmInputs.getVmGroupName()); clusterVmGroup.getVm().addAll(getVmManagedObjectReferences(vmNameList, connectionResources)); return createGroup(vmInputs, connectionResources, clusterVmGroup); } finally { if (httpInputs.isCloseSession()) { connectionResources.getConnection().disconnect(); clearConnectionFromContext(httpInputs.getGlobalSessionObject()); } } }  }
ClusterComputeResourceService { public Map<String, String> createVmGroup(HttpInputs httpInputs, VmInputs vmInputs, List<String> vmNameList) throws Exception { ConnectionResources connectionResources = new ConnectionResources(httpInputs); try { ClusterVmGroup clusterVmGroup = new ClusterVmGroup(); clusterVmGroup.setName(vmInputs.getVmGroupName()); clusterVmGroup.getVm().addAll(getVmManagedObjectReferences(vmNameList, connectionResources)); return createGroup(vmInputs, connectionResources, clusterVmGroup); } 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 Map<String, String> createVmGroup(HttpInputs httpInputs, VmInputs vmInputs, List<String> vmNameList) throws Exception { ConnectionResources connectionResources = new ConnectionResources(httpInputs); try { ClusterVmGroup clusterVmGroup = new ClusterVmGroup(); clusterVmGroup.setName(vmInputs.getVmGroupName()); clusterVmGroup.getVm().addAll(getVmManagedObjectReferences(vmNameList, connectionResources)); return createGroup(vmInputs, connectionResources, clusterVmGroup); } 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);  }