@Test public void testValidateRestartPriority() throws Exception { Method method = ModifyVmOverrides.class.getDeclaredMethod(VALIDATE_RESTART_PRIORITY_METHOD, String.class); method.setAccessible(true); assertEquals(CLUSTER_RESTART_PRIORITY, method.invoke(action, CLUSTER_RESTART_PRIORITY)); assertEquals(DISABLED, method.invoke(action, DISABLED)); assertEquals(HIGH, method.invoke(action, HIGH)); assertEquals(MEDIUM, method.invoke(action, MEDIUM)); assertEquals(LOW, method.invoke(action, LOW)); thrownException.expectMessage(INVALID_RESTART_PRIORITY_MSG); method.invoke(action, WRONG_RESTART_PRIORITY); }
private String validateRestartPriority(final String restartPriority) { final List<String> restartPriorities = Arrays.asList(CLUSTER_RESTART_PRIORITY, DISABLED, HIGH, MEDIUM, LOW); for (final String str : restartPriorities) { if (str.equalsIgnoreCase(restartPriority)) { return restartPriority; } } throw new RuntimeException(INVALID_RESTART_PRIORITY_MSG + StringUtils.join(restartPriorities, SEPARATOR)); }
ModifyVmOverrides { private String validateRestartPriority(final String restartPriority) { final List<String> restartPriorities = Arrays.asList(CLUSTER_RESTART_PRIORITY, DISABLED, HIGH, MEDIUM, LOW); for (final String str : restartPriorities) { if (str.equalsIgnoreCase(restartPriority)) { return restartPriority; } } throw new RuntimeException(INVALID_RESTART_PRIORITY_MSG + StringUtils.join(restartPriorities, SEPARATOR)); } }
ModifyVmOverrides { private String validateRestartPriority(final String restartPriority) { final List<String> restartPriorities = Arrays.asList(CLUSTER_RESTART_PRIORITY, DISABLED, HIGH, MEDIUM, LOW); for (final String str : restartPriorities) { if (str.equalsIgnoreCase(restartPriority)) { return restartPriority; } } throw new RuntimeException(INVALID_RESTART_PRIORITY_MSG + StringUtils.join(restartPriorities, SEPARATOR)); }  }
ModifyVmOverrides { private String validateRestartPriority(final String restartPriority) { final List<String> restartPriorities = Arrays.asList(CLUSTER_RESTART_PRIORITY, DISABLED, HIGH, MEDIUM, LOW); for (final String str : restartPriorities) { if (str.equalsIgnoreCase(restartPriority)) { return restartPriority; } } throw new RuntimeException(INVALID_RESTART_PRIORITY_MSG + StringUtils.join(restartPriorities, SEPARATOR)); }  @Action(name = "Modify VM Overrides Priorities", 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> modifyVmOverrides(@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 = HOSTNAME, required = true) String hostname,
                                                 @Param(value = VM_NAME) String virtualMachineName,
                                                 @Param(value = VM_ID) String virtualMachineId,
                                                 @Param(value = CLUSTER_NAME, required = true) String clusterName,
                                                 @Param(value = RESTART_PRIORITY, required = true) String restartPriority,
                                                 @Param(value = VMWARE_GLOBAL_SESSION_OBJECT) GlobalSessionObject<Map<String, Connection>> globalSessionObject); }
ModifyVmOverrides { private String validateRestartPriority(final String restartPriority) { final List<String> restartPriorities = Arrays.asList(CLUSTER_RESTART_PRIORITY, DISABLED, HIGH, MEDIUM, LOW); for (final String str : restartPriorities) { if (str.equalsIgnoreCase(restartPriority)) { return restartPriority; } } throw new RuntimeException(INVALID_RESTART_PRIORITY_MSG + StringUtils.join(restartPriorities, SEPARATOR)); }  @Action(name = "Modify VM Overrides Priorities", 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> modifyVmOverrides(@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 = HOSTNAME, required = true) String hostname,
                                                 @Param(value = VM_NAME) String virtualMachineName,
                                                 @Param(value = VM_ID) String virtualMachineId,
                                                 @Param(value = CLUSTER_NAME, required = true) String clusterName,
                                                 @Param(value = RESTART_PRIORITY, required = true) String restartPriority,
                                                 @Param(value = VMWARE_GLOBAL_SESSION_OBJECT) GlobalSessionObject<Map<String, Connection>> globalSessionObject);  }