@Test public void testCreateHostGroup() throws Exception { Map<String, String> expectedResultMap = new HashMap<>(); whenNew(ClusterComputeResourceService.class).withNoArguments().thenReturn(clusterComputeResourceServiceMock); when(clusterComputeResourceServiceMock.createHostGroup(any(HttpInputs.class), any(VmInputs.class), any(List.class))).thenReturn(expectedResultMap); Map<String, String> actualResultMap = createHostGroup.createHostGroup("", "", "", "", "", "", "", "", "", "", "", null); verify(clusterComputeResourceServiceMock, times(1)).createHostGroup(any(HttpInputs.class), any(VmInputs.class), any(List.class)); assertNotNull(actualResultMap); assertEquals(expectedResultMap, actualResultMap); }
@Action(name = "Create DRS Host Group", outputs = { @Output(Outputs.RETURN_CODE), @Output(Outputs.RETURN_RESULT), @Output(Outputs.EXCEPTION) }, responses = { @Response(text = Outputs.SUCCESS, field = Outputs.RETURN_CODE, value = Outputs.RETURN_CODE_SUCCESS, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED), @Response(text = Outputs.FAILURE, field = Outputs.RETURN_CODE, value = Outputs.RETURN_CODE_FAILURE, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR, isOnFail = true) }) public Map<String, String> createHostGroup(@Param(value = HOST, required = true) String host, @Param(value = PORT) String port, @Param(value = PROTOCOL) String protocol, @Param(value = USERNAME, required = true) String username, @Param(value = PASSWORD, encrypted = true) String password, @Param(value = TRUST_EVERYONE) String trustEveryone, @Param(value = CLOSE_SESSION) String closeSession, @Param(value = CLUSTER_NAME, required = true) String clusterName, @Param(value = HOST_GROUP_NAME, required = true) String hostGroupName, @Param(value = HOST_LIST, required = true) String hostList, @Param(value = DELIMITER) String delimiter, @Param(value = VMWARE_GLOBAL_SESSION_OBJECT) GlobalSessionObject<Map<String, Connection>> globalSessionObject) { try { final HttpInputs httpInputs = new HttpInputs.HttpInputsBuilder() .withHost(host) .withPort(port) .withProtocol(protocol) .withUsername(username) .withPassword(password) .withTrustEveryone(defaultIfEmpty(trustEveryone, FALSE)) .withCloseSession(defaultIfEmpty(closeSession, TRUE)) .withGlobalSessionObject(globalSessionObject) .build(); final VmInputs vmInputs = new VmInputs.VmInputsBuilder() .withClusterName(clusterName) .withHostGroupName(hostGroupName) .build(); return new ClusterComputeResourceService() .createHostGroup(httpInputs, vmInputs, CollectionUtilities.toList(hostList, InputUtils.getDefaultDelimiter(delimiter, COMMA_DELIMITER))); } catch (Exception ex) { return OutputUtilities.getFailureResultsMap(ex); } }
CreateHostGroup { @Action(name = "Create DRS Host Group", outputs = { @Output(Outputs.RETURN_CODE), @Output(Outputs.RETURN_RESULT), @Output(Outputs.EXCEPTION) }, responses = { @Response(text = Outputs.SUCCESS, field = Outputs.RETURN_CODE, value = Outputs.RETURN_CODE_SUCCESS, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED), @Response(text = Outputs.FAILURE, field = Outputs.RETURN_CODE, value = Outputs.RETURN_CODE_FAILURE, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR, isOnFail = true) }) public Map<String, String> createHostGroup(@Param(value = HOST, required = true) String host, @Param(value = PORT) String port, @Param(value = PROTOCOL) String protocol, @Param(value = USERNAME, required = true) String username, @Param(value = PASSWORD, encrypted = true) String password, @Param(value = TRUST_EVERYONE) String trustEveryone, @Param(value = CLOSE_SESSION) String closeSession, @Param(value = CLUSTER_NAME, required = true) String clusterName, @Param(value = HOST_GROUP_NAME, required = true) String hostGroupName, @Param(value = HOST_LIST, required = true) String hostList, @Param(value = DELIMITER) String delimiter, @Param(value = VMWARE_GLOBAL_SESSION_OBJECT) GlobalSessionObject<Map<String, Connection>> globalSessionObject) { try { final HttpInputs httpInputs = new HttpInputs.HttpInputsBuilder() .withHost(host) .withPort(port) .withProtocol(protocol) .withUsername(username) .withPassword(password) .withTrustEveryone(defaultIfEmpty(trustEveryone, FALSE)) .withCloseSession(defaultIfEmpty(closeSession, TRUE)) .withGlobalSessionObject(globalSessionObject) .build(); final VmInputs vmInputs = new VmInputs.VmInputsBuilder() .withClusterName(clusterName) .withHostGroupName(hostGroupName) .build(); return new ClusterComputeResourceService() .createHostGroup(httpInputs, vmInputs, CollectionUtilities.toList(hostList, InputUtils.getDefaultDelimiter(delimiter, COMMA_DELIMITER))); } catch (Exception ex) { return OutputUtilities.getFailureResultsMap(ex); } } }
CreateHostGroup { @Action(name = "Create DRS Host Group", outputs = { @Output(Outputs.RETURN_CODE), @Output(Outputs.RETURN_RESULT), @Output(Outputs.EXCEPTION) }, responses = { @Response(text = Outputs.SUCCESS, field = Outputs.RETURN_CODE, value = Outputs.RETURN_CODE_SUCCESS, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED), @Response(text = Outputs.FAILURE, field = Outputs.RETURN_CODE, value = Outputs.RETURN_CODE_FAILURE, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR, isOnFail = true) }) public Map<String, String> createHostGroup(@Param(value = HOST, required = true) String host, @Param(value = PORT) String port, @Param(value = PROTOCOL) String protocol, @Param(value = USERNAME, required = true) String username, @Param(value = PASSWORD, encrypted = true) String password, @Param(value = TRUST_EVERYONE) String trustEveryone, @Param(value = CLOSE_SESSION) String closeSession, @Param(value = CLUSTER_NAME, required = true) String clusterName, @Param(value = HOST_GROUP_NAME, required = true) String hostGroupName, @Param(value = HOST_LIST, required = true) String hostList, @Param(value = DELIMITER) String delimiter, @Param(value = VMWARE_GLOBAL_SESSION_OBJECT) GlobalSessionObject<Map<String, Connection>> globalSessionObject) { try { final HttpInputs httpInputs = new HttpInputs.HttpInputsBuilder() .withHost(host) .withPort(port) .withProtocol(protocol) .withUsername(username) .withPassword(password) .withTrustEveryone(defaultIfEmpty(trustEveryone, FALSE)) .withCloseSession(defaultIfEmpty(closeSession, TRUE)) .withGlobalSessionObject(globalSessionObject) .build(); final VmInputs vmInputs = new VmInputs.VmInputsBuilder() .withClusterName(clusterName) .withHostGroupName(hostGroupName) .build(); return new ClusterComputeResourceService() .createHostGroup(httpInputs, vmInputs, CollectionUtilities.toList(hostList, InputUtils.getDefaultDelimiter(delimiter, COMMA_DELIMITER))); } catch (Exception ex) { return OutputUtilities.getFailureResultsMap(ex); } }  }
CreateHostGroup { @Action(name = "Create DRS Host Group", outputs = { @Output(Outputs.RETURN_CODE), @Output(Outputs.RETURN_RESULT), @Output(Outputs.EXCEPTION) }, responses = { @Response(text = Outputs.SUCCESS, field = Outputs.RETURN_CODE, value = Outputs.RETURN_CODE_SUCCESS, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED), @Response(text = Outputs.FAILURE, field = Outputs.RETURN_CODE, value = Outputs.RETURN_CODE_FAILURE, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR, isOnFail = true) }) public Map<String, String> createHostGroup(@Param(value = HOST, required = true) String host, @Param(value = PORT) String port, @Param(value = PROTOCOL) String protocol, @Param(value = USERNAME, required = true) String username, @Param(value = PASSWORD, encrypted = true) String password, @Param(value = TRUST_EVERYONE) String trustEveryone, @Param(value = CLOSE_SESSION) String closeSession, @Param(value = CLUSTER_NAME, required = true) String clusterName, @Param(value = HOST_GROUP_NAME, required = true) String hostGroupName, @Param(value = HOST_LIST, required = true) String hostList, @Param(value = DELIMITER) String delimiter, @Param(value = VMWARE_GLOBAL_SESSION_OBJECT) GlobalSessionObject<Map<String, Connection>> globalSessionObject) { try { final HttpInputs httpInputs = new HttpInputs.HttpInputsBuilder() .withHost(host) .withPort(port) .withProtocol(protocol) .withUsername(username) .withPassword(password) .withTrustEveryone(defaultIfEmpty(trustEveryone, FALSE)) .withCloseSession(defaultIfEmpty(closeSession, TRUE)) .withGlobalSessionObject(globalSessionObject) .build(); final VmInputs vmInputs = new VmInputs.VmInputsBuilder() .withClusterName(clusterName) .withHostGroupName(hostGroupName) .build(); return new ClusterComputeResourceService() .createHostGroup(httpInputs, vmInputs, CollectionUtilities.toList(hostList, InputUtils.getDefaultDelimiter(delimiter, COMMA_DELIMITER))); } catch (Exception ex) { return OutputUtilities.getFailureResultsMap(ex); } }  @Action(name = "Create DRS Host Group", outputs = { @Output(Outputs.RETURN_CODE), @Output(Outputs.RETURN_RESULT), @Output(Outputs.EXCEPTION) }, responses = { @Response(text = Outputs.SUCCESS, field = Outputs.RETURN_CODE, value = Outputs.RETURN_CODE_SUCCESS, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED), @Response(text = Outputs.FAILURE, field = Outputs.RETURN_CODE, value = Outputs.RETURN_CODE_FAILURE, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR, isOnFail = true) }) Map<String, String> createHostGroup(@Param(value = HOST, required = true) String host,
                                               @Param(value = PORT) String port,
                                               @Param(value = PROTOCOL) String protocol,
                                               @Param(value = USERNAME, required = true) String username,
                                               @Param(value = PASSWORD, encrypted = true) String password,
                                               @Param(value = TRUST_EVERYONE) String trustEveryone,
                                               @Param(value = CLOSE_SESSION) String closeSession,
                                               @Param(value = CLUSTER_NAME, required = true) String clusterName,
                                               @Param(value = HOST_GROUP_NAME, required = true) String hostGroupName,
                                               @Param(value = HOST_LIST, required = true) String hostList,
                                               @Param(value = DELIMITER) String delimiter,
                                               @Param(value = VMWARE_GLOBAL_SESSION_OBJECT) GlobalSessionObject<Map<String, Connection>> globalSessionObject); }
CreateHostGroup { @Action(name = "Create DRS Host Group", outputs = { @Output(Outputs.RETURN_CODE), @Output(Outputs.RETURN_RESULT), @Output(Outputs.EXCEPTION) }, responses = { @Response(text = Outputs.SUCCESS, field = Outputs.RETURN_CODE, value = Outputs.RETURN_CODE_SUCCESS, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED), @Response(text = Outputs.FAILURE, field = Outputs.RETURN_CODE, value = Outputs.RETURN_CODE_FAILURE, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR, isOnFail = true) }) public Map<String, String> createHostGroup(@Param(value = HOST, required = true) String host, @Param(value = PORT) String port, @Param(value = PROTOCOL) String protocol, @Param(value = USERNAME, required = true) String username, @Param(value = PASSWORD, encrypted = true) String password, @Param(value = TRUST_EVERYONE) String trustEveryone, @Param(value = CLOSE_SESSION) String closeSession, @Param(value = CLUSTER_NAME, required = true) String clusterName, @Param(value = HOST_GROUP_NAME, required = true) String hostGroupName, @Param(value = HOST_LIST, required = true) String hostList, @Param(value = DELIMITER) String delimiter, @Param(value = VMWARE_GLOBAL_SESSION_OBJECT) GlobalSessionObject<Map<String, Connection>> globalSessionObject) { try { final HttpInputs httpInputs = new HttpInputs.HttpInputsBuilder() .withHost(host) .withPort(port) .withProtocol(protocol) .withUsername(username) .withPassword(password) .withTrustEveryone(defaultIfEmpty(trustEveryone, FALSE)) .withCloseSession(defaultIfEmpty(closeSession, TRUE)) .withGlobalSessionObject(globalSessionObject) .build(); final VmInputs vmInputs = new VmInputs.VmInputsBuilder() .withClusterName(clusterName) .withHostGroupName(hostGroupName) .build(); return new ClusterComputeResourceService() .createHostGroup(httpInputs, vmInputs, CollectionUtilities.toList(hostList, InputUtils.getDefaultDelimiter(delimiter, COMMA_DELIMITER))); } catch (Exception ex) { return OutputUtilities.getFailureResultsMap(ex); } }  @Action(name = "Create DRS Host Group", outputs = { @Output(Outputs.RETURN_CODE), @Output(Outputs.RETURN_RESULT), @Output(Outputs.EXCEPTION) }, responses = { @Response(text = Outputs.SUCCESS, field = Outputs.RETURN_CODE, value = Outputs.RETURN_CODE_SUCCESS, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED), @Response(text = Outputs.FAILURE, field = Outputs.RETURN_CODE, value = Outputs.RETURN_CODE_FAILURE, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR, isOnFail = true) }) Map<String, String> createHostGroup(@Param(value = HOST, required = true) String host,
                                               @Param(value = PORT) String port,
                                               @Param(value = PROTOCOL) String protocol,
                                               @Param(value = USERNAME, required = true) String username,
                                               @Param(value = PASSWORD, encrypted = true) String password,
                                               @Param(value = TRUST_EVERYONE) String trustEveryone,
                                               @Param(value = CLOSE_SESSION) String closeSession,
                                               @Param(value = CLUSTER_NAME, required = true) String clusterName,
                                               @Param(value = HOST_GROUP_NAME, required = true) String hostGroupName,
                                               @Param(value = HOST_LIST, required = true) String hostList,
                                               @Param(value = DELIMITER) String delimiter,
                                               @Param(value = VMWARE_GLOBAL_SESSION_OBJECT) GlobalSessionObject<Map<String, Connection>> globalSessionObject);  }