@Test public void customizeLinuxGuestProtocolFailure() throws Exception { Map<String, String> resultMap = linuxGuest.customizeLinuxGuest("", "", "myProtocol", "", "", "", "", "", "", "", "", "", "", "", "", null); verify(guestServiceMock, never()).customizeVM(any(HttpInputs.class), any(VmInputs.class), any(GuestInputs.class), anyBoolean()); assertNotNull(resultMap); assertEquals(-1, Integer.parseInt(resultMap.get("returnCode"))); assertEquals("Unsupported protocol value: [myProtocol]. Valid values are: https, http.", resultMap.get("returnResult")); }
@Action(name = "Customize Linux Guest", 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> customizeLinuxGuest(@Param(value = Inputs.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 = VM_NAME, required = true) String virtualMachineName, @Param(value = COMPUTER_NAME, required = true) String computerName, @Param(value = DOMAIN) String domain, @Param(value = IP_ADDRESS) String ipAddress, @Param(value = SUBNET_MASK) String subnetMask, @Param(value = DEFAULT_GATEWAY) String defaultGateway, @Param(value = UTC_CLOCK) String hwClockUTC, @Param(value = TIME_ZONE) String timeZone, @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().withVirtualMachineName(virtualMachineName).build(); final GuestInputs guestInputs = new GuestInputs.GuestInputsBuilder() .withComputerName(computerName) .withDomain(domain) .withIpAddress(ipAddress) .withSubnetMask(subnetMask) .withDefaultGateway(defaultGateway) .withHwClockUTC(hwClockUTC) .withTimeZone(timeZone) .build(); return new GuestService().customizeVM(httpInputs, vmInputs, guestInputs, false); } catch (Exception ex) { return OutputUtilities.getFailureResultsMap(ex); } }
CustomizeLinuxGuest { @Action(name = "Customize Linux Guest", 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> customizeLinuxGuest(@Param(value = Inputs.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 = VM_NAME, required = true) String virtualMachineName, @Param(value = COMPUTER_NAME, required = true) String computerName, @Param(value = DOMAIN) String domain, @Param(value = IP_ADDRESS) String ipAddress, @Param(value = SUBNET_MASK) String subnetMask, @Param(value = DEFAULT_GATEWAY) String defaultGateway, @Param(value = UTC_CLOCK) String hwClockUTC, @Param(value = TIME_ZONE) String timeZone, @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().withVirtualMachineName(virtualMachineName).build(); final GuestInputs guestInputs = new GuestInputs.GuestInputsBuilder() .withComputerName(computerName) .withDomain(domain) .withIpAddress(ipAddress) .withSubnetMask(subnetMask) .withDefaultGateway(defaultGateway) .withHwClockUTC(hwClockUTC) .withTimeZone(timeZone) .build(); return new GuestService().customizeVM(httpInputs, vmInputs, guestInputs, false); } catch (Exception ex) { return OutputUtilities.getFailureResultsMap(ex); } } }
CustomizeLinuxGuest { @Action(name = "Customize Linux Guest", 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> customizeLinuxGuest(@Param(value = Inputs.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 = VM_NAME, required = true) String virtualMachineName, @Param(value = COMPUTER_NAME, required = true) String computerName, @Param(value = DOMAIN) String domain, @Param(value = IP_ADDRESS) String ipAddress, @Param(value = SUBNET_MASK) String subnetMask, @Param(value = DEFAULT_GATEWAY) String defaultGateway, @Param(value = UTC_CLOCK) String hwClockUTC, @Param(value = TIME_ZONE) String timeZone, @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().withVirtualMachineName(virtualMachineName).build(); final GuestInputs guestInputs = new GuestInputs.GuestInputsBuilder() .withComputerName(computerName) .withDomain(domain) .withIpAddress(ipAddress) .withSubnetMask(subnetMask) .withDefaultGateway(defaultGateway) .withHwClockUTC(hwClockUTC) .withTimeZone(timeZone) .build(); return new GuestService().customizeVM(httpInputs, vmInputs, guestInputs, false); } catch (Exception ex) { return OutputUtilities.getFailureResultsMap(ex); } }  }
CustomizeLinuxGuest { @Action(name = "Customize Linux Guest", 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> customizeLinuxGuest(@Param(value = Inputs.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 = VM_NAME, required = true) String virtualMachineName, @Param(value = COMPUTER_NAME, required = true) String computerName, @Param(value = DOMAIN) String domain, @Param(value = IP_ADDRESS) String ipAddress, @Param(value = SUBNET_MASK) String subnetMask, @Param(value = DEFAULT_GATEWAY) String defaultGateway, @Param(value = UTC_CLOCK) String hwClockUTC, @Param(value = TIME_ZONE) String timeZone, @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().withVirtualMachineName(virtualMachineName).build(); final GuestInputs guestInputs = new GuestInputs.GuestInputsBuilder() .withComputerName(computerName) .withDomain(domain) .withIpAddress(ipAddress) .withSubnetMask(subnetMask) .withDefaultGateway(defaultGateway) .withHwClockUTC(hwClockUTC) .withTimeZone(timeZone) .build(); return new GuestService().customizeVM(httpInputs, vmInputs, guestInputs, false); } catch (Exception ex) { return OutputUtilities.getFailureResultsMap(ex); } }  @Action(name = "Customize Linux Guest", 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> customizeLinuxGuest(@Param(value = Inputs.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 = VM_NAME, required = true) String virtualMachineName,
                                                   @Param(value = COMPUTER_NAME, required = true) String computerName,
                                                   @Param(value = DOMAIN) String domain,
                                                   @Param(value = IP_ADDRESS) String ipAddress,
                                                   @Param(value = SUBNET_MASK) String subnetMask,
                                                   @Param(value = DEFAULT_GATEWAY) String defaultGateway,
                                                   @Param(value = UTC_CLOCK) String hwClockUTC,
                                                   @Param(value = TIME_ZONE) String timeZone,
                                                   @Param(value = VMWARE_GLOBAL_SESSION_OBJECT) GlobalSessionObject<Map<String, Connection>> globalSessionObject); }
CustomizeLinuxGuest { @Action(name = "Customize Linux Guest", 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> customizeLinuxGuest(@Param(value = Inputs.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 = VM_NAME, required = true) String virtualMachineName, @Param(value = COMPUTER_NAME, required = true) String computerName, @Param(value = DOMAIN) String domain, @Param(value = IP_ADDRESS) String ipAddress, @Param(value = SUBNET_MASK) String subnetMask, @Param(value = DEFAULT_GATEWAY) String defaultGateway, @Param(value = UTC_CLOCK) String hwClockUTC, @Param(value = TIME_ZONE) String timeZone, @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().withVirtualMachineName(virtualMachineName).build(); final GuestInputs guestInputs = new GuestInputs.GuestInputsBuilder() .withComputerName(computerName) .withDomain(domain) .withIpAddress(ipAddress) .withSubnetMask(subnetMask) .withDefaultGateway(defaultGateway) .withHwClockUTC(hwClockUTC) .withTimeZone(timeZone) .build(); return new GuestService().customizeVM(httpInputs, vmInputs, guestInputs, false); } catch (Exception ex) { return OutputUtilities.getFailureResultsMap(ex); } }  @Action(name = "Customize Linux Guest", 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> customizeLinuxGuest(@Param(value = Inputs.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 = VM_NAME, required = true) String virtualMachineName,
                                                   @Param(value = COMPUTER_NAME, required = true) String computerName,
                                                   @Param(value = DOMAIN) String domain,
                                                   @Param(value = IP_ADDRESS) String ipAddress,
                                                   @Param(value = SUBNET_MASK) String subnetMask,
                                                   @Param(value = DEFAULT_GATEWAY) String defaultGateway,
                                                   @Param(value = UTC_CLOCK) String hwClockUTC,
                                                   @Param(value = TIME_ZONE) String timeZone,
                                                   @Param(value = VMWARE_GLOBAL_SESSION_OBJECT) GlobalSessionObject<Map<String, Connection>> globalSessionObject);  }