diff options
author | Pamela Dragosh <pdragosh@research.att.com> | 2018-09-11 14:11:01 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-09-11 14:11:01 +0000 |
commit | d0e40f777cae70a2635d87b0b503ba500e03e5f2 (patch) | |
tree | 6d44235579a9aed987c5bd5d47c1c112b3d70a39 | |
parent | 91a15073980a970220fe9ba67df18bf04bb8488b (diff) | |
parent | d100854291559df1426ea1e64351872ae2d3867b (diff) |
Merge "Checkstyle changes for apex model"
141 files changed, 4366 insertions, 4005 deletions
diff --git a/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/ApexCLIEditorMain.java b/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/ApexCLIEditorMain.java index c7f7c7bb1..718c75a96 100644 --- a/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/ApexCLIEditorMain.java +++ b/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/ApexCLIEditorMain.java @@ -25,7 +25,7 @@ import java.util.Arrays; import java.util.Set; import java.util.TreeSet; -import org.onap.policy.apex.model.utilities.json.JSONHandler; +import org.onap.policy.apex.model.utilities.json.JsonHandler; import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; @@ -77,7 +77,7 @@ public class ApexCLIEditorMain { // Read the command definitions try { - commands = new JSONHandler<CLICommands>().read(CLICommands.class, parameters.getMetadataStream()); + commands = new JsonHandler<CLICommands>().read(CLICommands.class, parameters.getMetadataStream()); } catch (final Exception e) { LOGGER.error("start of Apex command line editor failed, error reading command metadata from {}", parameters.getMetadataLocation(), e); @@ -97,7 +97,7 @@ public class ApexCLIEditorMain { // Read the Apex properties try { - apexModelProperties = new JSONHandler<ApexModelProperties>().read(ApexModelProperties.class, + apexModelProperties = new JsonHandler<ApexModelProperties>().read(ApexModelProperties.class, parameters.getApexPropertiesStream()); } catch (final Exception e) { LOGGER.error("start of Apex command line editor failed, error reading Apex model properties from " diff --git a/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/ApexModelHandler.java b/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/ApexModelHandler.java index bfa2239f2..2cf2633b2 100644 --- a/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/ApexModelHandler.java +++ b/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/ApexModelHandler.java @@ -26,7 +26,7 @@ import java.lang.reflect.Method; import java.util.Properties; import java.util.TreeMap; -import org.onap.policy.apex.model.modelapi.ApexAPIResult; +import org.onap.policy.apex.model.modelapi.ApexApiResult; import org.onap.policy.apex.model.modelapi.ApexModel; import org.onap.policy.apex.model.modelapi.ApexModelFactory; @@ -62,8 +62,8 @@ public class ApexModelHandler { return; } - final ApexAPIResult result = apexModel.loadFromFile(modelFileName); - if (result.isNOK()) { + final ApexApiResult result = apexModel.loadFromFile(modelFileName); + if (result.isNok()) { throw new CLIException(result.getMessages().get(0)); } } @@ -76,7 +76,7 @@ public class ApexModelHandler { * @param writer A writer to which to write output * @return the result of the executed command */ - public ApexAPIResult executeCommand(final CLICommand command, + public ApexApiResult executeCommand(final CLICommand command, final TreeMap<String, CLIArgumentValue> argumentValues, final PrintWriter writer) { // Get the method final Method apiMethod = getCommandMethod(command); @@ -87,8 +87,8 @@ public class ApexModelHandler { try { final Object returnObject = apiMethod.invoke(apexModel, parameterArray); - if (returnObject instanceof ApexAPIResult) { - final ApexAPIResult result = (ApexAPIResult) returnObject; + if (returnObject instanceof ApexApiResult) { + final ApexApiResult result = (ApexApiResult) returnObject; writer.println(result); return result; } else { @@ -176,9 +176,9 @@ public class ApexModelHandler { * @return the string */ public String writeModelToString(final PrintWriter messageWriter) { - final ApexAPIResult result = apexModel.listModel(); + final ApexApiResult result = apexModel.listModel(); - if (result.isOK()) { + if (result.isOk()) { return result.getMessage(); } else { return null; diff --git a/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/CLICommand.java b/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/CLICommand.java index 7f4333cd8..40c0a40a5 100644 --- a/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/CLICommand.java +++ b/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/CLICommand.java @@ -27,7 +27,7 @@ import org.onap.policy.apex.model.utilities.Assertions; /** * This class represents a single Apex CLI command that is issued to the Apex Editor Java API - * {@link org.onap.policy.apex.model.modelapi.ApexEditorAPI}. + * {@link org.onap.policy.apex.model.modelapi.ApexEditorApi}. * * @author Liam Fallon (liam.fallon@ericsson.com) */ diff --git a/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/CLIEditorLoop.java b/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/CLIEditorLoop.java index 4eacde04b..a574099bf 100644 --- a/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/CLIEditorLoop.java +++ b/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/CLIEditorLoop.java @@ -39,8 +39,8 @@ import java.util.Map.Entry; import java.util.Properties; import java.util.TreeMap; -import org.onap.policy.apex.model.modelapi.ApexAPIResult; -import org.onap.policy.apex.model.modelapi.ApexAPIResult.RESULT; +import org.onap.policy.apex.model.modelapi.ApexApiResult; +import org.onap.policy.apex.model.modelapi.ApexApiResult.Result; import org.onap.policy.apex.model.utilities.TextFileUtils; import org.onap.policy.apex.model.utilities.TreeMapUtils; @@ -102,8 +102,8 @@ public class CLIEditorLoop { // The main loop for command handing, it continues until EOF on the input stream or until a // quit command int errorCount = 0; - ApexAPIResult result = new ApexAPIResult(); - while (result.getResult() != RESULT.FINISHED) { + ApexApiResult result = new ApexApiResult(); + while (result.getResult() != Result.FINISHED) { if (!parameters.isIgnoreCommandFailures() && errorCount > 0) { break; } @@ -184,7 +184,7 @@ public class CLIEditorLoop { // Execute the command, a FINISHED result means a command causes the loop to // leave execution result = executeCommand(command, argumentValues, writer); - if (result.isNOK()) { + if (result.isNok()) { errorCount++; } } @@ -381,7 +381,7 @@ public class CLIEditorLoop { * @param writer The writer to use for any output from the command * @return the result of execution of the command */ - private ApexAPIResult executeCommand(final CLICommand command, + private ApexApiResult executeCommand(final CLICommand command, final TreeMap<String, CLIArgumentValue> argumentValues, final PrintWriter writer) { if (command.isSystemCommand()) { return exceuteSystemCommand(command, writer); @@ -397,7 +397,7 @@ public class CLIEditorLoop { * @param writer The writer to use for any output from the command * @return the result of execution of the command */ - private ApexAPIResult exceuteSystemCommand(final CLICommand command, final PrintWriter writer) { + private ApexApiResult exceuteSystemCommand(final CLICommand command, final PrintWriter writer) { if ("back".equals(command.getName())) { return executeBackCommand(); } else if ("help".equals(command.getName())) { @@ -405,7 +405,7 @@ public class CLIEditorLoop { } else if ("quit".equals(command.getName())) { return executeQuitCommand(); } else { - return new ApexAPIResult(RESULT.SUCCESS); + return new ApexApiResult(Result.SUCCESS); } } @@ -414,11 +414,11 @@ public class CLIEditorLoop { * * @return the result of execution of the command */ - private ApexAPIResult executeBackCommand() { + private ApexApiResult executeBackCommand() { if (keywordNodeDeque.size() > 1) { keywordNodeDeque.pop(); } - return new ApexAPIResult(RESULT.SUCCESS); + return new ApexApiResult(Result.SUCCESS); } /** @@ -426,8 +426,8 @@ public class CLIEditorLoop { * * @return the result of execution of the command */ - private ApexAPIResult executeQuitCommand() { - return new ApexAPIResult(RESULT.FINISHED); + private ApexApiResult executeQuitCommand() { + return new ApexApiResult(Result.FINISHED); } /** @@ -436,11 +436,11 @@ public class CLIEditorLoop { * @param writer The writer to use for output from the command * @return the result of execution of the command */ - private ApexAPIResult executeHelpCommand(final PrintWriter writer) { + private ApexApiResult executeHelpCommand(final PrintWriter writer) { for (final CLICommand command : keywordNodeDeque.peek().getCommands()) { writer.println(command.getHelp()); } - return new ApexAPIResult(RESULT.SUCCESS); + return new ApexApiResult(Result.SUCCESS); } /** diff --git a/auth/cli-editor/src/main/resources/etc/editor/Commands.json b/auth/cli-editor/src/main/resources/etc/editor/Commands.json index 54ad92a2b..fd5a77557 100644 --- a/auth/cli-editor/src/main/resources/etc/editor/Commands.json +++ b/auth/cli-editor/src/main/resources/etc/editor/Commands.json @@ -173,7 +173,7 @@ "description": "model description, omit to generate a description" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.createModel", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createModel", "description": "Create an Apex model." }, { @@ -183,7 +183,7 @@ "list" ], "argumentList": [], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.listModel", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listModel", "description": "List an Apex model, list all the concepts in the model" }, { @@ -193,7 +193,7 @@ "delete" ], "argumentList": [], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.deleteModel", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deleteModel", "description": "Delete an Apex model, clear all the concepts in the model" }, { @@ -224,7 +224,7 @@ "description": "concept description, omit to generate a description" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.createKeyInformation", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createKeyInformation", "description": "Create key information" }, { @@ -255,7 +255,7 @@ "description": "concept description, omit to not update" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.updateKeyInformation", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.updateKeyInformation", "description": "Update key information" }, { @@ -276,7 +276,7 @@ "description": "starting version of the concept for the key information, omit to list all versions" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.ListKeyInformation", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.ListKeyInformation", "description": "List key information" }, { @@ -297,7 +297,7 @@ "description": "version of the concept for the key information, omit to delete all versions" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.deleteKeyInformation", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deleteKeyInformation", "description": "Delete key information" }, { @@ -318,7 +318,7 @@ "description": "version of the concept for the key information, omit to validate all versions" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.validateKeyInformation", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.validateKeyInformation", "description": "Validate key information" }, { @@ -359,7 +359,7 @@ "description": "schema description, omit to generate a description" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.createContextSchema", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createContextSchema", "description": "Create a schema." }, { @@ -400,7 +400,7 @@ "description": "schema description, omit to generate a description" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.updateContextSchema", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.updateContextSchema", "description": "Update a schema." }, { @@ -421,7 +421,7 @@ "description": "starting version of the schema, omit to list all versions" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.listContextSchemas", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listContextSchemas", "description": "List schemas." }, { @@ -442,7 +442,7 @@ "description": "version of the schema, omit to delete all versions" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.deleteContextSchema", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deleteContextSchema", "description": "Delete a schema." }, { @@ -463,7 +463,7 @@ "description": "starting version of the schema, omit to list all versions" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.validateContextSchemas", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.validateContextSchemas", "description": "Validate context schemas." }, { @@ -509,7 +509,7 @@ "description": "event description, omit to generate a description" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.createEvent", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createEvent", "description": "Create an event." }, { @@ -555,7 +555,7 @@ "description": "event description, omit to not update" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.updateEvent", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.updateEvent", "description": "Update an event." }, { @@ -576,7 +576,7 @@ "description": "starting version of the event, omit to list all versions" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.listEvent", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listEvent", "description": "List events." }, { @@ -597,7 +597,7 @@ "description": "version of the event, omit to delete all versions" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.deleteEvent", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deleteEvent", "description": "Delete an event." }, { @@ -618,7 +618,7 @@ "description": "starting version of the event, omit to list all versions" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.validateEvent", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.validateEvent", "description": "Validate events." }, { @@ -660,7 +660,7 @@ "description": "indicates if the parameter is optional, if omitted, the parameter is mandatory" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.createEventPar", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createEventPar", "description": "Create an event parameter." }, { @@ -687,7 +687,7 @@ "description": "name of the parameter, omit to list all parameters of the event" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.listEventPar", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listEventPar", "description": "List event parameters." }, { @@ -714,7 +714,7 @@ "description": "of the parameter, omit to delete all parameters" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.deleteEventPar", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deleteEventPar", "description": "Delete an event parameter." }, { @@ -765,7 +765,7 @@ "description": "album description, omit to generate a description" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.createContextAlbum", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createContextAlbum", "description": "Create a context album." }, { @@ -816,7 +816,7 @@ "description": "album description, omit to not update" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.updateContextAlbum", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.updateContextAlbum", "description": "Update a context album." }, { @@ -837,7 +837,7 @@ "description": "starting version of the context album, omit to list all versions" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.listContextAlbum", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listContextAlbum", "description": "List context albums." }, { @@ -858,7 +858,7 @@ "description": "version of the context album, omit to delete versions" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.deleteContextAlbum", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deleteContextAlbum", "description": "Delete a context album." }, { @@ -879,7 +879,7 @@ "description": "starting version of the context album, omit to list all versions" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.validateContextAlbum", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.validateContextAlbum", "description": "Validate context albums." }, { @@ -910,7 +910,7 @@ "description": "task description, omit to generate a description" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.createTask", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createTask", "description": "Create a task." }, { @@ -941,7 +941,7 @@ "description": "task description, omit to not update" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.updateTask", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.updateTask", "description": "Update a task." }, { @@ -962,7 +962,7 @@ "description": "starting version of the task, omit to list all versions" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.listTask", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listTask", "description": "List tasks." }, { @@ -983,7 +983,7 @@ "description": "version of the task, omit to use the latest version" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.deleteTask", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deleteTask", "description": "Delete a task." }, { @@ -1004,7 +1004,7 @@ "description": "starting version of the task, omit to list all versions" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.validateTask", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.validateTask", "description": "Validate tasks." }, { @@ -1036,7 +1036,7 @@ "description": "the source code for the logic of the task" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.createTaskLogic", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createTaskLogic", "description": "Create logic for a task." }, { @@ -1068,7 +1068,7 @@ "description": "the source code for the logic of the task, omit to not update" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.updateTaskLogic", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.updateTaskLogic", "description": "Update logic for a task." }, { @@ -1090,7 +1090,7 @@ "description": "version of the task, omit to list the latest version" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.listTaskLogic", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listTaskLogic", "description": "List task logic." }, { @@ -1112,7 +1112,7 @@ "description": "version of the task, omit to use the latest version" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.deleteTaskLogic", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deleteTaskLogic", "description": "Delete logic for a task." }, { @@ -1154,7 +1154,7 @@ "description": "indicates if the field is optional, if omitted, the field is mandatory" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.createTaskInputField", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createTaskInputField", "description": "Create a task input field." }, { @@ -1181,7 +1181,7 @@ "description": "field name of the input field, omit to list all input fields of the task" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.listTaskInputField", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listTaskInputField", "description": "List task input fields." }, { @@ -1208,7 +1208,7 @@ "description": "of the input field, omit to delete all input fields" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.deleteTaskInputField", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deleteTaskInputField", "description": "Delete a task input field." }, { @@ -1250,7 +1250,7 @@ "description": "indicates if the field is optional, if omitted, the field is mandatory" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.createTaskOutputField", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createTaskOutputField", "description": "Create a task output field." }, { @@ -1277,7 +1277,7 @@ "description": "field name of the output field, omit to list all output fields of the task" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.listTaskOutputField", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listTaskOutputField", "description": "List task output fields." }, { @@ -1304,7 +1304,7 @@ "description": "of the output field, omit to delete all output fields" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.deleteTaskOutputField", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deleteTaskOutputField", "description": "Delete a task output field." }, { @@ -1336,7 +1336,7 @@ "description": "of the parameter" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.createTaskParameter", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createTaskParameter", "description": "Create a task parameter." }, { @@ -1363,7 +1363,7 @@ "description": "name of the parameter, omit to list all parameters of the task" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.listTaskParameter", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listTaskParameter", "description": "List task parameters." }, { @@ -1390,7 +1390,7 @@ "description": "of the parameter, omit to delete all task parameters" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.deleteTaskParameter", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deleteTaskParameter", "description": "Delete a task parameter." }, { @@ -1422,7 +1422,7 @@ "description": "version of the context album for the context reference, omit to use the latest version" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.createTaskContextRef", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createTaskContextRef", "description": "Create a task context reference." }, { @@ -1454,7 +1454,7 @@ "description": "version of the context album for the context reference, omit to use the latest version" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.listTaskContextRef", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listTaskContextRef", "description": "List task context references." }, { @@ -1486,7 +1486,7 @@ "description": "version of the context album for the context reference, omit to use the latest version" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.deleteTaskContextRef", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deleteTaskContextRef", "description": "Delete a task context reference." }, { @@ -1527,7 +1527,7 @@ "description": "policy description, omit to generate a description" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.createPolicy", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createPolicy", "description": "Create a policy." }, { @@ -1568,7 +1568,7 @@ "description": "policy description, omit to not update" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.updatePolicy", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.updatePolicy", "description": "Update a policy." }, { @@ -1589,7 +1589,7 @@ "description": "starting version of the policy, omit to list all versions" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.listPolicy", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listPolicy", "description": "List policies." }, { @@ -1610,7 +1610,7 @@ "description": "version of the policy, omit to use the latest version" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.deletePolicy", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deletePolicy", "description": "Delete a policy." }, { @@ -1631,7 +1631,7 @@ "description": "starting version of the policy, omit to list all versions" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.validatePolicy", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.validatePolicy", "description": "Validate policies." }, { @@ -1678,7 +1678,7 @@ "description": "the default task version, omit to use the latest version" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.createPolicyState", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createPolicyState", "description": "Create a policy state." }, { @@ -1725,7 +1725,7 @@ "description": "the default task version, set to use latest version of default task" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.updatePolicyState", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.updatePolicyState", "description": "Update a policy state." }, { @@ -1752,7 +1752,7 @@ "description": "of the state, omit to list all states of the policy" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.listPolicyState", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listPolicyState", "description": "List policy states." }, { @@ -1779,7 +1779,7 @@ "description": "of the state, omit to delete all states" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.deletePolicyState", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deletePolicyState", "description": "Delete a policy state." }, { @@ -1817,7 +1817,7 @@ "description": "the source code for the logic of the state" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.createPolicyStateTaskSelectionLogic", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createPolicyStateTaskSelectionLogic", "description": "Create task selection logic for a state." }, { @@ -1855,7 +1855,7 @@ "description": "the source code for the logic of the state, omit to not update" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.updatePolicyStateTaskSelectionLogic", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.updatePolicyStateTaskSelectionLogic", "description": "Update task selection logic for a state." }, { @@ -1883,7 +1883,7 @@ "description": "of the state" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.listPolicyStateTaskSelectionLogic", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listPolicyStateTaskSelectionLogic", "description": "List task selection logic for a state." }, { @@ -1911,7 +1911,7 @@ "description": "of the state" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.deletePolicyStateTaskSelectionLogic", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deletePolicyStateTaskSelectionLogic", "description": "Delete task selection logic for a state." }, { @@ -1959,7 +1959,7 @@ "description": "for this state to transition to, omit if this is the last state that the policy transitions to on this branch" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.createPolicyStateOutput", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createPolicyStateOutput", "description": "Create a policy state output." }, { @@ -1992,7 +1992,7 @@ "description": "of the state output, omit to list all outputs of the state" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.listPolicyStateOutput", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listPolicyStateOutput", "description": "List policy state outputs." }, { @@ -2025,7 +2025,7 @@ "description": "of the state output, omit to delete all state outputs" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.deletePolicyStateOutput", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deletePolicyStateOutput", "description": "Delete a policy state output." }, { @@ -2068,7 +2068,7 @@ "description": "the source code for the logic of the state" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.createPolicyStateFinalizerLogic", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createPolicyStateFinalizerLogic", "description": "Create policy finalizer logic for a state." }, { @@ -2111,7 +2111,7 @@ "description": "the source code for the logic of the state, omit to not update" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.updatePolicyStateFinalizerLogic", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.updatePolicyStateFinalizerLogic", "description": "Update policy finalizer logic for a state." }, { @@ -2144,7 +2144,7 @@ "description": "name of the state finalizer logic" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.listPolicyStateFinalizerLogic", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listPolicyStateFinalizerLogic", "description": "List policy finalizer logic for a state." }, { @@ -2177,7 +2177,7 @@ "description": "name of the state finalizer logic" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.deletePolicyStateFinalizerLogic", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deletePolicyStateFinalizerLogic", "description": "Delete policy finalizer logic for a state." }, { @@ -2230,7 +2230,7 @@ "description": "the name of the state output or state state finalizer logic to handle the task output" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.createPolicyStateTaskRef", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createPolicyStateTaskRef", "description": "Create a policy state task reference." }, { @@ -2268,7 +2268,7 @@ "description": "version of the task, omit to use the latest version" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.listPolicyStateTaskRef", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listPolicyStateTaskRef", "description": "List policy state task references." }, { @@ -2306,7 +2306,7 @@ "description": "version of the task, omit to use the latest version" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.deletePolicyStateTaskRef", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deletePolicyStateTaskRef", "description": "Delete a policy state task reference." }, { @@ -2344,7 +2344,7 @@ "description": "version of the context album for the context reference, omit to use the latest version" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.createPolicyStateContextRef", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.createPolicyStateContextRef", "description": "Create a policy state context reference." }, { @@ -2382,7 +2382,7 @@ "description": "version of the context album for the context reference, omit to use the latest version" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.listPolicyStateContextRef", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.listPolicyStateContextRef", "description": "List policy state context references." }, { @@ -2420,7 +2420,7 @@ "description": "version of the context album for the context reference, omit to use the latest version" } ], - "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorAPI.deletePolicyStateContextRef", + "apiMethod": "org.onap.policy.apex.model.modelapi.ApexEditorApi.deletePolicyStateContextRef", "description": "Delete a policy state context reference." } ] diff --git a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/ApexEditorRestResource.java b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/ApexEditorRestResource.java index 83ca529f6..cd52035a5 100644 --- a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/ApexEditorRestResource.java +++ b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/ApexEditorRestResource.java @@ -59,8 +59,8 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo; import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum; import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema; import org.onap.policy.apex.model.eventmodel.concepts.AxEvent; -import org.onap.policy.apex.model.modelapi.ApexAPIResult; -import org.onap.policy.apex.model.modelapi.ApexAPIResult.RESULT; +import org.onap.policy.apex.model.modelapi.ApexApiResult; +import org.onap.policy.apex.model.modelapi.ApexApiResult.Result; import org.onap.policy.apex.model.modelapi.ApexModel; import org.onap.policy.apex.model.modelapi.ApexModelFactory; import org.onap.policy.apex.model.policymodel.concepts.AxPolicy; @@ -123,19 +123,19 @@ public class ApexEditorRestResource { * * @return the result of finding the session Apex model and setting it */ - private ApexAPIResult initialiseSessionForChanges() { + private ApexApiResult initialiseSessionForChanges() { if (sessionID < 0) { - return new ApexAPIResult(RESULT.FAILED, "Session ID \"" + sessionID + "\" is negative"); + return new ApexApiResult(Result.FAILED, "Session ID \"" + sessionID + "\" is negative"); } if (!SESSIONMODELMAP.containsKey(sessionID)) { - return new ApexAPIResult(RESULT.FAILED, "A session with session ID \"" + sessionID + "\" does not exist"); + return new ApexApiResult(Result.FAILED, "A session with session ID \"" + sessionID + "\" does not exist"); } if (sessionApexModel == null) { sessionApexModel = SESSIONMODELMAP.get(sessionID).clone(); } - return new ApexAPIResult(); + return new ApexApiResult(); } /** @@ -144,19 +144,19 @@ public class ApexEditorRestResource { * * @return the result of finding the session Apex model and setting it */ - private ApexAPIResult initialiseSessionForReadOnly() { + private ApexApiResult initialiseSessionForReadOnly() { if (sessionID < 0) { - return new ApexAPIResult(RESULT.FAILED, "Session ID \"" + sessionID + "\" is negative"); + return new ApexApiResult(Result.FAILED, "Session ID \"" + sessionID + "\" is negative"); } if (!SESSIONMODELMAP.containsKey(sessionID)) { - return new ApexAPIResult(RESULT.FAILED, "A session with session ID \"" + sessionID + "\" does not exist"); + return new ApexApiResult(Result.FAILED, "A session with session ID \"" + sessionID + "\" does not exist"); } if (sessionApexModel == null) { sessionApexModel = SESSIONMODELMAP.get(sessionID); } - return new ApexAPIResult(); + return new ApexApiResult(); } /** @@ -165,16 +165,16 @@ public class ApexEditorRestResource { * * @return the result of committing the session Apex model */ - private ApexAPIResult commitChanges() { + private ApexApiResult commitChanges() { if (sessionApexModel == null) { - return new ApexAPIResult(RESULT.FAILED, "Cannot commit a changes for Session ID \"" + sessionID + return new ApexApiResult(Result.FAILED, "Cannot commit a changes for Session ID \"" + sessionID + "\", because it has not been initialised / started"); } SESSIONMODELMAP.put(sessionID, sessionApexModel); - return new ApexAPIResult(); + return new ApexApiResult(); } /** @@ -182,39 +182,39 @@ public class ApexEditorRestResource { * will be allocated. If successful the new sessionID will be available in the first message in * the result. * - * @return an ApexAPIResult object. If successful then {@link ApexAPIResult#isOK()} will return - * true. Any messages/errors can be retrieved using {@link ApexAPIResult#getMessages()}. + * @return an ApexAPIResult object. If successful then {@link ApexApiResult#isOk()} will return + * true. Any messages/errors can be retrieved using {@link ApexApiResult#getMessages()}. * This includes the session id for this session. */ @GET @Path("Session/Create") - public ApexAPIResult createSession() { - ApexAPIResult ret = null; + public ApexApiResult createSession() { + ApexApiResult ret = null; LOGGER.entry(); try { if (sessionID != -1) { - ret = new ApexAPIResult(RESULT.FAILED, "Session ID must be set to -1 to create sessions: " + sessionID); + ret = new ApexApiResult(Result.FAILED, "Session ID must be set to -1 to create sessions: " + sessionID); return ret; } final int newSessionID = nextSession; if (SESSIONMODELMAP.containsKey(newSessionID)) { - ret = new ApexAPIResult(RESULT.FAILED, "Session already exists for session: " + newSessionID); + ret = new ApexApiResult(Result.FAILED, "Session already exists for session: " + newSessionID); return ret; } SESSIONMODELMAP.put(newSessionID, new ApexModelFactory().createApexModel(null, true)); nextSession++; - ret = new ApexAPIResult(RESULT.SUCCESS, Integer.toString(newSessionID)); + ret = new ApexApiResult(Result.SUCCESS, Integer.toString(newSessionID)); return ret; } catch (final Exception e) { LOGGER.catching(e); throw e; } finally { - LOGGER.exit((ret == null ? false : ret.isOK())); - LOGGER.info("Session/Create" + (ret != null && ret.isOK() ? ": OK" : ": Not OK")); + LOGGER.exit((ret == null ? false : ret.isOk())); + LOGGER.info("Session/Create" + (ret != null && ret.isOk() ? ": OK" : ": Not OK")); } } @@ -223,22 +223,22 @@ public class ApexEditorRestResource { * * @param jsonString the JSON string to be parsed. The returned value(s) will be similar to * {@link AxPolicyModel}, with merged {@linkplain AxKeyInfo} for the root object. - * @return an ApexAPIResult object. If successful then {@link ApexAPIResult#isOK()} will return - * true. Any messages/errors can be retrieved using {@link ApexAPIResult#getMessages()} + * @return an ApexAPIResult object. If successful then {@link ApexApiResult#isOk()} will return + * true. Any messages/errors can be retrieved using {@link ApexApiResult#getMessages()} */ @PUT @Path("/Model/Load") - public ApexAPIResult loadFromString(final String jsonString) { - ApexAPIResult ret = null; + public ApexApiResult loadFromString(final String jsonString) { + ApexApiResult ret = null; LOGGER.entry(jsonString); try { ret = initialiseSessionForChanges(); - if (ret.isNOK()) { + if (ret.isNok()) { return ret; } ret = sessionApexModel.loadFromString(jsonString); - if (ret.isOK()) { + if (ret.isOk()) { commitChanges(); } return ret; @@ -246,8 +246,8 @@ public class ApexEditorRestResource { LOGGER.catching(e); throw e; } finally { - LOGGER.exit((ret == null ? false : ret.isOK())); - LOGGER.info("Model/Load" + (ret != null && ret.isOK() ? ": OK" : ": Not OK")); + LOGGER.exit((ret == null ? false : ret.isOk())); + LOGGER.info("Model/Load" + (ret != null && ret.isOk() ? ": OK" : ": Not OK")); } } @@ -255,17 +255,17 @@ public class ApexEditorRestResource { * Analyse the model and return analysis results. If successful the analysis results will be * available in the messages in the result. * - * @return an ApexAPIResult object. If successful then {@link ApexAPIResult#isOK()} will return - * true. Any messages/errors can be retrieved using {@link ApexAPIResult#getMessages()} + * @return an ApexAPIResult object. If successful then {@link ApexApiResult#isOk()} will return + * true. Any messages/errors can be retrieved using {@link ApexApiResult#getMessages()} */ @GET @Path("Model/Analyse") - public ApexAPIResult analyse() { - ApexAPIResult ret = null; + public ApexApiResult analyse() { + ApexApiResult ret = null; LOGGER.entry(); try { ret = initialiseSessionForReadOnly(); - if (ret.isNOK()) { + if (ret.isNok()) { return ret; } @@ -275,8 +275,8 @@ public class ApexEditorRestResource { LOGGER.catching(e); throw e; } finally { - LOGGER.exit((ret == null ? false : ret.isOK())); - LOGGER.info("Model/Analyse" + (ret != null && ret.isOK() ? ": OK" : ": Not OK")); + LOGGER.exit((ret == null ? false : ret.isOk())); + LOGGER.info("Model/Analyse" + (ret != null && ret.isOk() ? ": OK" : ": Not OK")); } } @@ -284,17 +284,17 @@ public class ApexEditorRestResource { * Validate the model and return validation results. If successful the validation results will * be available in the messages in the result. * - * @return an ApexAPIResult object. If successful then {@link ApexAPIResult#isOK()} will return - * true. Any messages/errors can be retrieved using {@link ApexAPIResult#getMessages()} + * @return an ApexAPIResult object. If successful then {@link ApexApiResult#isOk()} will return + * true. Any messages/errors can be retrieved using {@link ApexApiResult#getMessages()} */ @GET @Path("Model/Validate") - public ApexAPIResult validate() { - ApexAPIResult ret = null; + public ApexApiResult validate() { + ApexApiResult ret = null; LOGGER.entry(); try { ret = initialiseSessionForReadOnly(); - if (ret.isNOK()) { + if (ret.isNok()) { return ret; } @@ -306,8 +306,8 @@ public class ApexEditorRestResource { LOGGER.catching(e); throw e; } finally { - LOGGER.exit((ret == null ? false : ret.isOK())); - LOGGER.info("Model/Validate" + (ret != null && ret.isOK() ? ": OK" : ": Not OK")); + LOGGER.exit((ret == null ? false : ret.isOk())); + LOGGER.info("Model/Validate" + (ret != null && ret.isOk() ? ": OK" : ": Not OK")); } } @@ -316,17 +316,17 @@ public class ApexEditorRestResource { * * @param jsonString the JSON string to be parsed containing the new model. See * {@linkplain BeanModel} - * @return an ApexAPIResult object. If successful then {@link ApexAPIResult#isOK()} will return - * true. Any messages/errors can be retrieved using {@link ApexAPIResult#getMessages()} + * @return an ApexAPIResult object. If successful then {@link ApexApiResult#isOk()} will return + * true. Any messages/errors can be retrieved using {@link ApexApiResult#getMessages()} */ @POST @Path("Model/Create") - public ApexAPIResult createModel(final String jsonString) { - ApexAPIResult ret = null; + public ApexApiResult createModel(final String jsonString) { + ApexApiResult ret = null; LOGGER.entry(jsonString); try { ret = initialiseSessionForChanges(); - if (ret.isNOK()) { + if (ret.isNok()) { return ret; } @@ -334,10 +334,10 @@ public class ApexEditorRestResource { ret = sessionApexModel.createModel(jsonbean.getName(), jsonbean.getVersion(), jsonbean.getUuid(), jsonbean.getDescription()); - if (ret.isOK()) { + if (ret.isOk()) { ret = addKeyInfo2Messages(ret); } - if (ret.isOK()) { + if (ret.isOk()) { commitChanges(); } return ret; @@ -345,8 +345,8 @@ public class ApexEditorRestResource { LOGGER.catching(e); throw e; } finally { - LOGGER.exit((ret == null ? false : ret.isOK())); - LOGGER.info("Model/Create" + (ret != null && ret.isOK() ? ": OK" : ": Not OK")); + LOGGER.exit((ret == null ? false : ret.isOk())); + LOGGER.info("Model/Create" + (ret != null && ret.isOk() ? ": OK" : ": Not OK")); } } @@ -355,24 +355,24 @@ public class ApexEditorRestResource { * * @param jsonString the JSON string to be parsed containing the updated model. See * {@linkplain BeanModel} - * @return an ApexAPIResult object. If successful then {@link ApexAPIResult#isOK()} will return - * true. Any messages/errors can be retrieved using {@link ApexAPIResult#getMessages()} + * @return an ApexAPIResult object. If successful then {@link ApexApiResult#isOk()} will return + * true. Any messages/errors can be retrieved using {@link ApexApiResult#getMessages()} */ @PUT @Path("Model/Update") - public ApexAPIResult updateModel(final String jsonString) { - ApexAPIResult ret = null; + public ApexApiResult updateModel(final String jsonString) { + ApexApiResult ret = null; LOGGER.entry(jsonString); try { ret = initialiseSessionForChanges(); - if (ret.isNOK()) { + if (ret.isNok()) { return ret; } final BeanModel jsonbean = RestUtils.getJSONParameters(jsonString, BeanModel.class); ret = sessionApexModel.updateModel(jsonbean.getName(), jsonbean.getVersion(), jsonbean.getUuid(), jsonbean.getDescription()); - if (ret.isOK()) { + if (ret.isOk()) { commitChanges(); } return ret; @@ -380,8 +380,8 @@ public class ApexEditorRestResource { LOGGER.catching(e); throw e; } finally { - LOGGER.exit((ret == null ? false : ret.isOK())); - LOGGER.info("Model/Update" + (ret != null && ret.isOK() ? ": OK" : ": Not OK")); + LOGGER.exit((ret == null ? false : ret.isOk())); + LOGGER.info("Model/Update" + (ret != null && ret.isOk() ? ": OK" : ": Not OK")); } } @@ -389,17 +389,17 @@ public class ApexEditorRestResource { * Gets the key for the model for this session. If successful the model key will be available in * the first message in the result. See {@linkplain AxKey} * - * @return an ApexAPIResult object. If successful then {@link ApexAPIResult#isOK()} will return - * true. Any messages/errors can be retrieved using {@link ApexAPIResult#getMessages()} + * @return an ApexAPIResult object. If successful then {@link ApexApiResult#isOk()} will return + * true. Any messages/errors can be retrieved using {@link ApexApiResult#getMessages()} */ @GET @Path("Model/GetKey") - public ApexAPIResult getModelKey() { - ApexAPIResult ret = null; + public ApexApiResult getModelKey() { + ApexApiResult ret = null; LOGGER.entry(); try { ret = initialiseSessionForReadOnly(); - if (ret.isNOK()) { + if (ret.isNok()) { return ret; } @@ -409,8 +409,8 @@ public class ApexEditorRestResource { LOGGER.catching(e); throw e; } finally { - LOGGER.exit((ret == null ? false : ret.isOK())); - LOGGER.info("Model/GetKey" + (ret != null && ret.isOK() ? ": OK" : ": Not OK")); + LOGGER.exit((ret == null ? false : ret.isOk())); + LOGGER.info("Model/GetKey" + (ret != null && ret.isOk() ? ": OK" : ": Not OK")); } } @@ -419,22 +419,22 @@ public class ApexEditorRestResource { * message in the result. The returned value will be similar to a {@link AxPolicyModel}, with * merged {@linkplain AxKeyInfo} for the root object. * - * @return an ApexAPIResult object. If successful then {@link ApexAPIResult#isOK()} will return - * true. Any messages/errors can be retrieved using {@link ApexAPIResult#getMessages()} + * @return an ApexAPIResult object. If successful then {@link ApexApiResult#isOk()} will return + * true. Any messages/errors can be retrieved using {@link ApexApiResult#getMessages()} */ @GET @Path("Model/Get") - public ApexAPIResult listModel() { - ApexAPIResult ret = null; + public ApexApiResult listModel() { + ApexApiResult ret = null; LOGGER.entry(); try { ret = initialiseSessionForReadOnly(); - if (ret.isNOK()) { + if (ret.isNok()) { return ret; } ret = sessionApexModel.listModel(); - if (ret.isNOK()) { + if (ret.isNok()) { return ret; } @@ -444,8 +444,8 @@ public class ApexEditorRestResource { LOGGER.catching(e); throw e; } finally { - LOGGER.exit((ret == null ? false : ret.isOK())); - LOGGER.info("Model/Get" + (ret != null && ret.isOK() ? ": OK" : ": Not OK")); + LOGGER.exit((ret == null ? false : ret.isOk())); + LOGGER.info("Model/Get" + (ret != null && ret.isOk() ? ": OK" : ": Not OK")); } } @@ -457,17 +457,17 @@ public class ApexEditorRestResource { @GET @Path("Model/Download") public String downloadModel() { - ApexAPIResult ret = null; + ApexApiResult ret = null; LOGGER.entry(); try { ret = initialiseSessionForReadOnly(); - if (ret.isNOK()) { + if (ret.isNok()) { throw new IllegalStateException("Cannot download file: " + ret.getMessage()); } ret = sessionApexModel.listModel(); - if (ret.isNOK()) { + if (ret.isNok()) { throw new IllegalStateException("Cannot download file: " + ret.getMessage()); } @@ -477,31 +477,31 @@ public class ApexEditorRestResource { throw e; } finally { if (ret != null) { - LOGGER.exit(ret.isOK()); + LOGGER.exit(ret.isOk()); } - LOGGER.info("Model/Download" + (ret != null && ret.isOK() ? ": OK" : ": Not OK")); + LOGGER.info("Model/Download" + (ret != null && ret.isOk() ? ": OK" : ": Not OK")); } } /** * Delete the model for this session. * - * @return an ApexAPIResult object. If successful then {@link ApexAPIResult#isOK()} will return - * true. Any messages/errors can be retrieved using {@link ApexAPIResult#getMessages()} + * @return an ApexAPIResult object. If successful then {@link ApexApiResult#isOk()} will return + * true. Any messages/errors can be retrieved using {@link ApexApiResult#getMessages()} */ @DELETE @Path("Model/Delete") - public ApexAPIResult deleteModel() { - ApexAPIResult ret = null; + public ApexApiResult deleteModel() { + ApexApiResult ret = null; LOGGER.entry(); try { ret = initialiseSessionForChanges(); - if (ret.isNOK()) { + if (ret.isNok()) { return ret; } ret = sessionApexModel.deleteModel(); - if (ret.isOK()) { + if (ret.isOk()) { commitChanges(); } return ret; @@ -509,8 +509,8 @@ public class ApexEditorRestResource { LOGGER.catching(e); throw e; } finally { - LOGGER.exit((ret == null ? false : ret.isOK())); - LOGGER.info("Model/Delete" + (ret != null && ret.isOK() ? ": OK" : ": Not OK")); + LOGGER.exit((ret == null ? false : ret.isOk())); + LOGGER.info("Model/Delete" + (ret != null && ret.isOk() ? ": OK" : ": Not OK")); } } @@ -520,20 +520,20 @@ public class ApexEditorRestResource { * * @param name the name to search for. If null or empty, then all names will be queried * @param version the version to search for. If null then all versions will be searched for. - * @return an ApexAPIResult object. If successful then {@link ApexAPIResult#isOK()} will return - * true. Any messages/errors can be retrieved using {@link ApexAPIResult#getMessages()} + * @return an ApexAPIResult object. If successful then {@link ApexApiResult#isOk()} will return + * true. Any messages/errors can be retrieved using {@link ApexApiResult#getMessages()} */ @GET @Path("KeyInformation/Get") - public ApexAPIResult listKeyInformation(@QueryParam("name") final String name, + public ApexApiResult listKeyInformation(@QueryParam("name") final String name, @QueryParam("version") final String version) { - ApexAPIResult ret = null; + ApexApiResult ret = null; String name1 = name; String version1 = version; LOGGER.entry(name1, version1); try { ret = initialiseSessionForReadOnly(); - if (ret.isNOK()) { + if (ret.isNok()) { return ret; } @@ -550,8 +550,8 @@ public class ApexEditorRestResource { LOGGER.catching(e); throw e; } finally { - LOGGER.exit((ret == null ? false : ret.isOK())); - LOGGER.info("KeyInformation/Get" + (ret != null && ret.isOK() ? ": OK" : ": Not OK")); + LOGGER.exit((ret == null ? false : ret.isOk())); + LOGGER.info("KeyInformation/Get" + (ret != null && ret.isOk() ? ": OK" : ": Not OK")); } } @@ -559,17 +559,17 @@ public class ApexEditorRestResource { * Creates a context schema with the information in the JSON string passed. * * @param jsonString the JSON string to be parsed. See {@linkplain BeanContextSchema} - * @return an ApexAPIResult object. If successful then {@link ApexAPIResult#isOK()} will return - * true. Any messages/errors can be retrieved using {@link ApexAPIResult#getMessages()} + * @return an ApexAPIResult object. If successful then {@link ApexApiResult#isOk()} will return + * true. Any messages/errors can be retrieved using {@link ApexApiResult#getMessages()} */ @POST @Path("ContextSchema/Create") - public ApexAPIResult createContextSchema(final String jsonString) { - ApexAPIResult ret = null; + public ApexApiResult createContextSchema(final String jsonString) { + ApexApiResult ret = null; LOGGER.entry(jsonString); try { ret = initialiseSessionForChanges(); - if (ret.isNOK()) { + if (ret.isNok()) { return ret; } @@ -577,7 +577,7 @@ public class ApexEditorRestResource { ret = sessionApexModel.createContextSchema(jsonbean.getName(), jsonbean.getVersion(), jsonbean.getSchemaFlavour(), jsonbean.getSchemaDefinition(), jsonbean.getUuid(), jsonbean.getDescription()); - if (ret.isOK()) { + if (ret.isOk()) { commitChanges(); } return ret; @@ -585,8 +585,8 @@ public class ApexEditorRestResource { LOGGER.catching(e); throw e; } finally { - LOGGER.exit((ret == null ? false : ret.isOK())); - LOGGER.info("ContextSchema/Create" + (ret != null && ret.isOK() ? ": OK" : ": Not OK")); + LOGGER.exit((ret == null ? false : ret.isOk())); + LOGGER.info("ContextSchema/Create" + (ret != null && ret.isOk() ? ": OK" : ": Not OK")); } } @@ -594,17 +594,17 @@ public class ApexEditorRestResource { * Update a context schema with the information in the JSON string passed. * * @param jsonString the JSON string to be parsed. See {@linkplain BeanContextSchema} - * @return an ApexAPIResult object. If successful then {@link ApexAPIResult#isOK()} will return - * true. Any messages/errors can be retrieved using {@link ApexAPIResult#getMessages()} + * @return an ApexAPIResult object. If successful then {@link ApexApiResult#isOk()} will return + * true. Any messages/errors can be retrieved using {@link ApexApiResult#getMessages()} */ @PUT @Path("ContextSchema/Update") - public ApexAPIResult updateContextSchema(final String jsonString) { - ApexAPIResult ret = null; + public ApexApiResult updateContextSchema(final String jsonString) { + ApexApiResult ret = null; LOGGER.entry(jsonString); try { ret = initialiseSessionForChanges(); - if (ret.isNOK()) { + if (ret.isNok()) { return ret; } @@ -613,7 +613,7 @@ public class ApexEditorRestResource { ret = sessionApexModel.updateContextSchema(jsonbean.getName(), jsonbean.getVersion(), jsonbean.getSchemaFlavour(), jsonbean.getSchemaDefinition(), jsonbean.getUuid(), jsonbean.getDescription()); - if (ret.isOK()) { + if (ret.isOk()) { commitChanges(); } return ret; @@ -621,8 +621,8 @@ public class ApexEditorRestResource { LOGGER.catching(e); throw e; } finally { - LOGGER.exit((ret == null ? false : ret.isOK())); - LOGGER.info("ContextSchema/Update" + (ret != null && ret.isOK() ? ": OK" : ": Not OK")); + LOGGER.exit((ret == null ? false : ret.isOk())); + LOGGER.info("ContextSchema/Update" + (ret != null && ret.isOk() ? ": OK" : ": Not OK")); } } @@ -633,20 +633,20 @@ public class ApexEditorRestResource { * * @param name the name to search for. If null or empty, then all names will be queried * @param version the version to search for. If null then all versions will be searched for. - * @return an ApexAPIResult object. If successful then {@link ApexAPIResult#isOK()} will return - * true. Any messages/errors can be retrieved using {@link ApexAPIResult#getMessages()} + * @return an ApexAPIResult object. If successful then {@link ApexApiResult#isOk()} will return + * true. Any messages/errors can be retrieved using {@link ApexApiResult#getMessages()} */ @GET @Path("ContextSchema/Get") - public ApexAPIResult listContextSchemas(@QueryParam("name") final String name, + public ApexApiResult listContextSchemas(@QueryParam("name") final String name, @QueryParam("version") final String version) { - ApexAPIResult ret = null; + ApexApiResult ret = null; String name1 = name; String version1 = version; LOGGER.entry(name1, version1); try { ret = initialiseSessionForReadOnly(); - if (ret.isNOK()) { + if (ret.isNok()) { return ret; } @@ -658,7 +658,7 @@ public class ApexEditorRestResource { } ret = sessionApexModel.listContextSchemas(name1, version1); - if (ret.isNOK()) { + if (ret.isNok()) { return ret; } @@ -668,8 +668,8 @@ public class ApexEditorRestResource { LOGGER.catching(e); throw e; } finally { - LOGGER.exit((ret == null ? false : ret.isOK())); - LOGGER.info("ContextSchema/Get" + (ret != null && ret.isOK() ? ": OK" : ": Not OK")); + LOGGER.exit((ret == null ? false : ret.isOk())); + LOGGER.info("ContextSchema/Get" + (ret != null && ret.isOk() ? ": OK" : ": Not OK")); } } @@ -678,20 +678,20 @@ public class ApexEditorRestResource { * * @param name the name to search for. If null or empty, then all names will be queried * @param version the version to search for. If null then all versions will be searched for. - * @return an ApexAPIResult object. If successful then {@link ApexAPIResult#isOK()} will return - * true. Any messages/errors can be retrieved using {@link ApexAPIResult#getMessages()} + * @return an ApexAPIResult object. If successful then {@link ApexApiResult#isOk()} will return + * true. Any messages/errors can be retrieved using {@link ApexApiResult#getMessages()} */ @DELETE @Path("ContextSchema/Delete") - public ApexAPIResult deleteContextSchema(@QueryParam("name") final String name, + public ApexApiResult deleteContextSchema(@QueryParam("name") final String name, @QueryParam("version") final String version) { - ApexAPIResult ret = null; + ApexApiResult ret = null; String name1 = name; String version1 = version; LOGGER.entry(name1, version1); try { ret = initialiseSessionForChanges(); - if (ret.isNOK()) { + if (ret.isNok()) { return ret; } @@ -703,7 +703,7 @@ public class ApexEditorRestResource { } ret = sessionApexModel.deleteContextSchema(name1, version1); - if (ret.isOK()) { + if (ret.isOk()) { commitChanges(); } return ret; @@ -711,8 +711,8 @@ public class ApexEditorRestResource { LOGGER.catching(e); throw e; } finally { - LOGGER.exit((ret == null ? false : ret.isOK())); - LOGGER.info("ContextSchema/Delete" + (ret != null && ret.isOK() ? ": OK" : ": Not OK")); + LOGGER.exit((ret == null ? false : ret.isOk())); + LOGGER.info("ContextSchema/Delete" + (ret != null && ret.isOk() ? ": OK" : ": Not OK")); } } @@ -722,14 +722,14 @@ public class ApexEditorRestResource { * * @param name the name to search for. If null or empty, then all names will be queried * @param version the version to search for. If null then all versions will be searched for. - * @return an ApexAPIResult object. If successful then {@link ApexAPIResult#isOK()} will return - * true. Any messages/errors can be retrieved using {@link ApexAPIResult#getMessages()} + * @return an ApexAPIResult object. If successful then {@link ApexApiResult#isOk()} will return + * true. Any messages/errors can be retrieved using {@link ApexApiResult#getMessages()} */ @GET @Path("Validate/ContextSchema") - public ApexAPIResult validateContextSchemas(@QueryParam("name") final String name, + public ApexApiResult validateContextSchemas(@QueryParam("name") final String name, @QueryParam("version") final String version) { - ApexAPIResult ret = null; + ApexApiResult ret = null; String name1 = name; String version1 = version; LOGGER.entry(name1, version1); @@ -742,12 +742,12 @@ public class ApexEditorRestResource { } ret = initialiseSessionForReadOnly(); - if (ret.isNOK()) { + if (ret.isNok()) { return ret; } ret = sessionApexModel.validateContextSchemas(name1, version1); - if (ret.isNOK()) { + if (ret.isNok()) { return ret; } @@ -757,8 +757,8 @@ public class ApexEditorRestResource { LOGGER.catching(e); throw e; } finally { - LOGGER.exit((ret == null ? false : ret.isOK())); - LOGGER.info("Validate/ContextSchema" + (ret != null && ret.isOK() ? ": OK" : ": Not OK")); + LOGGER.exit((ret == null ? false : ret.isOk())); + LOGGER.info("Validate/ContextSchema" + (ret != null && ret.isOk() ? ": OK" : ": Not OK")); } } @@ -766,17 +766,17 @@ public class ApexEditorRestResource { * Creates a context album with the information in the JSON string passed. * * @param jsonString the JSON string to be parsed. See {@linkplain BeanContextAlbum} - * @return an ApexAPIResult object. If successful then {@link ApexAPIResult#isOK()} will return - * true. Any messages/errors can be retrieved using {@link ApexAPIResult#getMessages()} + * @return an ApexAPIResult object. If successful then {@link ApexApiResult#isOk()} will return + * true. Any messages/errors can be retrieved using {@link ApexApiResult#getMessages()} */ @POST @Path("ContextAlbum/Create") - public ApexAPIResult createContextAlbum(final String jsonString) { - ApexAPIResult ret = null; + public ApexApiResult createContextAlbum(final String jsonString) { + ApexApiResult ret = null; LOGGER.entry(jsonString); try { ret = initialiseSessionForChanges(); - if (ret.isNOK()) { + if (ret.isNok()) { return ret; } @@ -785,7 +785,7 @@ public class ApexEditorRestResource { ret = sessionApexModel.createContextAlbum(jsonbean.getName(), jsonbean.getVersion(), jsonbean.getScope(), Boolean.toString(jsonbean.getWriteable()), jsonbean.getItemSchema().getName(), jsonbean.getItemSchema().getVersion(), jsonbean.getUuid(), jsonbean.getDescription()); - if (ret.isOK()) { + if (ret.isOk()) { commitChanges(); } return ret; @@ -793,8 +793,8 @@ public class ApexEditorRestResource { LOGGER.catching(e); throw e; } finally { - LOGGER.exit((ret == null ? false : ret.isOK())); - LOGGER.info("ContextAlbum/Create" + (ret != null && ret.isOK() ? ": OK" : ": Not OK")); + LOGGER.exit((ret == null ? false : ret.isOk())); + LOGGER.info("ContextAlbum/Create" + (ret != null && ret.isOk() ? ": OK" : ": Not OK")); } } @@ -802,17 +802,17 @@ public class ApexEditorRestResource { * Update a context album with the information in the JSON string passed. * * @param jsonString the JSON string to be parsed. See {@linkplain BeanContextAlbum} - * @return an ApexAPIResult object. If successful then {@link ApexAPIResult#isOK()} will return - * true. Any messages/errors can be retrieved using {@link ApexAPIResult#getMessages()} + * @return an ApexAPIResult object. If successful then {@link ApexApiResult#isOk()} will return + * true. Any messages/errors can be retrieved using {@link ApexApiResult#getMessages()} */ @PUT @Path("ContextAlbum/Update") - public ApexAPIResult updateContextAlbum(final String jsonString) { - ApexAPIResult ret = null; + public ApexApiResult updateContextAlbum(final String jsonString) { + ApexApiResult ret = null; LOGGER.entry(jsonString); try { ret = initialiseSessionForChanges(); - if (ret.isNOK()) { + if (ret.isNok()) { return ret; } @@ -821,7 +821,7 @@ public class ApexEditorRestResource { ret = sessionApexModel.updateContextAlbum(jsonbean.getName(), jsonbean.getVersion(), jsonbean.getScope(), Boolean.toString(jsonbean.getWriteable()), jsonbean.getItemSchema().getName(), jsonbean.getItemSchema().getVersion(), jsonbean.getUuid(), jsonbean.getDescription()); - if (ret.isOK()) { + if (ret.isOk()) { commitChanges(); } return ret; @@ -829,8 +829,8 @@ public class ApexEditorRestResource { LOGGER.catching(e); throw e; } finally { - LOGGER.exit((ret == null ? false : ret.isOK())); - LOGGER.info("ContextAlbum/Update" + (ret != null && ret.isOK() ? ": OK" : ": Not OK")); + LOGGER.exit((ret == null ? false : ret.isOk())); + LOGGER.info("ContextAlbum/Update" + (ret != null && ret.isOk() ? ": OK" : ": Not OK")); } } @@ -841,20 +841,20 @@ public class ApexEditorRestResource { * * @param name the name to search for. If null or empty, then all names will be queried * @param version the version to search for. If null then all versions will be searched for. - * @return an ApexAPIResult object. If successful then {@link ApexAPIResult#isOK()} will return - * true. Any messages/errors can be retrieved using {@link ApexAPIResult#getMessages()} + * @return an ApexAPIResult object. If successful then {@link ApexApiResult#isOk()} will return + * true. Any messages/errors can be retrieved using {@link ApexApiResult#getMessages()} */ @GET @Path("ContextAlbum/Get") - public ApexAPIResult listContextAlbums(@QueryParam("name") final String name, + public ApexApiResult listContextAlbums(@QueryParam("name") final String name, @QueryParam("version") final String version) { - ApexAPIResult ret = null; + ApexApiResult ret = null; String name1 = name; String version1 = version; LOGGER.entry(name1, version1); try { ret = initialiseSessionForReadOnly(); - if (ret.isNOK()) { + if (ret.isNok()) { return ret; } @@ -866,7 +866,7 @@ public class ApexEditorRestResource { } ret = sessionApexModel.listContextAlbum(name1, version1); - if (ret.isNOK()) { + if (ret.isNok()) { return ret; } @@ -876,8 +876,8 @@ public class ApexEditorRestResource { LOGGER.catching(e); throw e; } finally { - LOGGER.exit((ret == null ? false : ret.isOK())); - LOGGER.info("ContextAlbum/Get" + (ret != null && ret.isOK() ? ": OK" : ": Not OK")); + LOGGER.exit((ret == null ? false : ret.isOk())); + LOGGER.info("ContextAlbum/Get" + (ret != null && ret.isOk() ? ": OK" : ": Not OK")); } } @@ -886,20 +886,20 @@ public class ApexEditorRestResource { * * @param name the name to search for. If null or empty, then all names will be queried * @param version the version to search for. If null then all versions will be searched for. - * @return an ApexAPIResult object. If successful then {@link ApexAPIResult#isOK()} will return - * true. Any messages/errors can be retrieved using {@link ApexAPIResult#getMessages()} + * @return an ApexAPIResult object. If successful then {@link ApexApiResult#isOk()} will return + * true. Any messages/errors can be retrieved using {@link ApexApiResult#getMessages()} */ @DELETE @Path("ContextAlbum/Delete") - public ApexAPIResult deleteContextAlbum(@QueryParam("name") final String name, + public ApexApiResult deleteContextAlbum(@QueryParam("name") final String name, @QueryParam("version") final String version) { - ApexAPIResult ret = null; + ApexApiResult ret = null; String name1 = name; String version1 = version; LOGGER.entry(name1, version1); try { ret = initialiseSessionForChanges(); - if (ret.isNOK()) { + if (ret.isNok()) { return ret; } @@ -911,7 +911,7 @@ public class ApexEditorRestResource { } ret = sessionApexModel.deleteContextAlbum(name1, version1); - if (ret.isOK()) { + if (ret.isOk()) { commitChanges(); } return ret; @@ -919,8 +919,8 @@ public class ApexEditorRestResource { LOGGER.catching(e); throw e; } finally { - LOGGER.exit((ret == null ? false : ret.isOK())); - LOGGER.info("ContextAlbum/Delete" + (ret != null && ret.isOK() ? ": OK" : ": Not OK")); + LOGGER.exit((ret == null ? false : ret.isOk())); + LOGGER.info("ContextAlbum/Delete" + (ret != null && ret.isOk() ? ": OK" : ": Not OK")); } } @@ -930,14 +930,14 @@ public class ApexEditorRestResource { * * @param name the name to search for. If null or empty, then all names will be queried * @param version the version to search for. If null then all versions will be searched for. - * @return an ApexAPIResult object. If successful then {@link ApexAPIResult#isOK()} will return - * true. Any messages/errors can be retrieved using {@link ApexAPIResult#getMessages()} + * @return an ApexAPIResult object. If successful then {@link ApexApiResult#isOk()} will return + * true. Any messages/errors can be retrieved using {@link ApexApiResult#getMessages()} */ @GET @Path("Validate/ContextAlbum") - public ApexAPIResult validateContextAlbums(@QueryParam("name") final String name, + public ApexApiResult validateContextAlbums(@QueryParam("name") final String name, @QueryParam("version") final String version) { - ApexAPIResult ret = null; + ApexApiResult ret = null; String name1 = name; String version1 = version; LOGGER.entry(name1, version1); @@ -950,12 +950,12 @@ public class ApexEditorRestResource { } ret = initialiseSessionForReadOnly(); - if (ret.isNOK()) { + if (ret.isNok()) { return ret; } ret = sessionApexModel.listContextAlbum(name1, version1); - if (ret.isNOK()) { + if (ret.isNok()) { return ret; } @@ -965,8 +965,8 @@ public class ApexEditorRestResource { LOGGER.catching(e); throw e; } finally { - LOGGER.exit((ret == null ? false : ret.isOK())); - LOGGER.info("Validate/ContextAlbum" + (ret != null && ret.isOK() ? ": OK" : ": Not OK")); + LOGGER.exit((ret == null ? false : ret.isOk())); + LOGGER.info("Validate/ContextAlbum" + (ret != null && ret.isOk() ? ": OK" : ": Not OK")); } } @@ -974,17 +974,17 @@ public class ApexEditorRestResource { * Creates an event with the information in the JSON string passed. * * @param jsonString the JSON string to be parsed. See {@linkplain BeanEvent} - * @return an ApexAPIResult object. If successful then {@link ApexAPIResult#isOK()} will return - * true. Any messages/errors can be retrieved using {@link ApexAPIResult#getMessages()} + * @return an ApexAPIResult object. If successful then {@link ApexApiResult#isOk()} will return + * true. Any messages/errors can be retrieved using {@link ApexApiResult#getMessages()} */ @POST @Path("Event/Create") - public ApexAPIResult createEvent(final String jsonString) { - ApexAPIResult ret = null; + public ApexApiResult createEvent(final String jsonString) { + ApexApiResult ret = null; LOGGER.entry(jsonString); try { ret = initialiseSessionForChanges(); - if (ret.isNOK()) { + if (ret.isNok()) { return ret; } @@ -992,22 +992,22 @@ public class ApexEditorRestResource { ret = sessionApexModel.createEvent(jsonbean.getName(), jsonbean.getVersion(), jsonbean.getNameSpace(), jsonbean.getSource(), jsonbean.getTarget(), jsonbean.getUuid(), jsonbean.getDescription()); - if (ret.isNOK()) { + if (ret.isNok()) { return ret; } if (jsonbean.getParameters() != null) { for (final Entry<String, BeanField> p : jsonbean.getParameters().entrySet()) { if (p.getValue() == null) { - ret = new ApexAPIResult(RESULT.FAILED, "Null event parameter information for parameter \"" + ret = new ApexApiResult(Result.FAILED, "Null event parameter information for parameter \"" + p.getKey() + "\" in event " + jsonbean.getName() + ":" + jsonbean.getVersion() + ". The event was created, but there was an error adding the event parameters." + " The event has only been partially defined."); return ret; } - final ApexAPIResult rettmp = + final ApexApiResult rettmp = sessionApexModel.createEventPar(jsonbean.getName(), jsonbean.getVersion(), p.getKey(), p.getValue().getName(), p.getValue().getVersion(), p.getValue().getOptional()); - if (rettmp.isNOK()) { + if (rettmp.isNok()) { rettmp.addMessage("Failed to add event parameter information for parameter \"" + p.getKey() + "\" in event " + jsonbean.getName() + ":" + jsonbean.getVersion() + ". The event was created, but there was an error adding the event parameters." @@ -1017,7 +1017,7 @@ public class ApexEditorRestResource { } } } - if (ret.isOK()) { + if (ret.isOk()) { commitChanges(); } return ret; @@ -1025,8 +1025,8 @@ public class ApexEditorRestResource { LOGGER.catching(e); throw e; } finally { - LOGGER.exit((ret == null ? false : ret.isOK())); - LOGGER.info("Event/Create" + (ret != null && ret.isOK() ? ": OK" : ": Not OK")); + LOGGER.exit((ret == null ? false : ret.isOk())); + LOGGER.info("Event/Create" + (ret != null && ret.isOk() ? ": OK" : ": Not OK")); } } @@ -1034,17 +1034,17 @@ public class ApexEditorRestResource { * Update an event with the information in the JSON string passed. * * @param jsonString the JSON string to be parsed. See {@linkplain BeanEvent} - * @return an ApexAPIResult object. If successful then {@link ApexAPIResult#isOK()} will return - * true. Any messages/errors can be retrieved using {@link ApexAPIResult#getMessages()} + * @return an ApexAPIResult object. If successful then {@link ApexApiResult#isOk()} will return + * true. Any messages/errors can be retrieved using {@link ApexApiResult#getMessages()} */ @PUT @Path("Event/Update") - public ApexAPIResult updateEvent(final String jsonString) { - ApexAPIResult ret = null; + public ApexApiResult updateEvent(final String jsonString) { + ApexApiResult ret = null; LOGGER.entry(jsonString); try { ret = initialiseSessionForChanges(); - if (ret.isNOK()) { + if (ret.isNok()) { return ret; } @@ -1052,18 +1052,18 @@ public class ApexEditorRestResource { if (jsonbean.getName() == null || jsonbean.getName().equals("") || jsonbean.getVersion() == null || jsonbean.getVersion().equals("")) { - ret = new ApexAPIResult(RESULT.FAILED, "Null/Empty event name/version (\"" + jsonbean.getName() + ":" + ret = new ApexApiResult(Result.FAILED, "Null/Empty event name/version (\"" + jsonbean.getName() + ":" + jsonbean.getVersion() + "\" passed to UpdateEvent"); return ret; } ret = sessionApexModel.deleteEvent(jsonbean.getName(), jsonbean.getVersion()); - if (ret.isNOK()) { + if (ret.isNok()) { return ret; } ret = createEvent(jsonString); - if (ret.isOK()) { + if (ret.isOk()) { commitChanges(); } return ret; @@ -1071,8 +1071,8 @@ public class ApexEditorRestResource { LOGGER.catching(e); throw e; } finally { - LOGGER.exit((ret == null ? false : ret.isOK())); - LOGGER.info("Event/Update" + (ret != null && ret.isOK() ? ": OK" : ": Not OK")); + LOGGER.exit((ret == null ? false : ret.isOk())); + LOGGER.info("Event/Update" + (ret != null && ret.isOk() ? ": OK" : ": Not OK")); } } @@ -1083,19 +1083,19 @@ public class ApexEditorRestResource { * * @param name the name to search for. If null or empty, then all names will be queried * @param version the version to search for. If null then all versions will be searched for. - * @return an ApexAPIResult object. If successful then {@link ApexAPIResult#isOK()} will return - * true. Any messages/errors can be retrieved using {@link ApexAPIResult#getMessages()} + * @return an ApexAPIResult object. If successful then {@link ApexApiResult#isOk()} will return + * true. Any messages/errors can be retrieved using {@link ApexApiResult#getMessages()} */ @GET @Path("Event/Get") - public ApexAPIResult listEvent(@QueryParam("name") final String name, @QueryParam("version") final String version) { - ApexAPIResult ret = null; + public ApexApiResult listEvent(@QueryParam("name") final String name, @QueryParam("version") final String version) { + ApexApiResult ret = null; String name1 = name; String version1 = version; LOGGER.entry(name1, version1); try { ret = initialiseSessionForReadOnly(); - if (ret.isNOK()) { + if (ret.isNok()) { return ret; } @@ -1107,7 +1107,7 @@ public class ApexEditorRestResource { } ret = sessionApexModel.listEvent(name1, version1); - if (ret.isNOK()) { + if (ret.isNok()) { return ret; } @@ -1117,8 +1117,8 @@ public class ApexEditorRestResource { LOGGER.catching(e); throw e; } finally { - LOGGER.exit((ret == null ? false : ret.isOK())); - LOGGER.info("Event/Get" + (ret != null && ret.isOK() ? ": OK" : ": Not OK")); + LOGGER.exit((ret == null ? false : ret.isOk())); + LOGGER.info("Event/Get" + (ret != null && ret.isOk() ? ": OK" : ": Not OK")); } } @@ -1127,14 +1127,14 @@ public class ApexEditorRestResource { * * @param name the name to search for. If null or empty, then all names will be queried * @param version the version to search for. If null then all versions will be searched for. - * @return an ApexAPIResult object. If successful then {@link ApexAPIResult#isOK()} will return - * true. Any messages/errors can be retrieved using {@link ApexAPIResult#getMessages()} + * @return an ApexAPIResult object. If successful then {@link ApexApiResult#isOk()} will return + * true. Any messages/errors can be retrieved using {@link ApexApiResult#getMessages()} */ @DELETE @Path("Event/Delete") - public ApexAPIResult deleteEvent(@QueryParam("name") final String name, + public ApexApiResult deleteEvent(@QueryParam("name") final String name, @QueryParam("version") final String version) { - ApexAPIResult ret = null; + ApexApiResult ret = null; String name1 = name; String version1 = version; LOGGER.entry(name1, version1); @@ -1147,12 +1147,12 @@ public class ApexEditorRestResource { } ret = initialiseSessionForChanges(); - if (ret.isNOK()) { + if (ret.isNok()) { return ret; } ret = sessionApexModel.deleteEvent(name1, version1); - if (ret.isOK()) { + if (ret.isOk()) { commitChanges(); } return ret; @@ -1160,8 +1160,8 @@ public class ApexEditorRestResource { LOGGER.catching(e); throw e; } finally { - LOGGER.exit((ret == null ? false : ret.isOK())); - LOGGER.info("Event/Delete" + (ret != null && ret.isOK() ? ": OK" : ": Not OK")); + LOGGER.exit((ret == null ? false : ret.isOk())); + LOGGER.info("Event/Delete" + (ret != null && ret.isOk() ? ": OK" : ": Not OK")); } } @@ -1171,20 +1171,20 @@ public class ApexEditorRestResource { * * @param name the name to search for. If null or empty, then all names will be queried * @param version the version to search for. If null then all versions will be searched for. - * @return an ApexAPIResult object. If successful then {@link ApexAPIResult#isOK()} will return - * true. Any messages/errors can be retrieved using {@link ApexAPIResult#getMessages()} + * @return an ApexAPIResult object. If successful then {@link ApexApiResult#isOk()} will return + * true. Any messages/errors can be retrieved using {@link ApexApiResult#getMessages()} */ @GET @Path("Validate/Event") - public ApexAPIResult validateEvent(@QueryParam("name") final String name, + public ApexApiResult validateEvent(@QueryParam("name") final String name, @QueryParam("version") final String version) { - ApexAPIResult ret = null; + ApexApiResult ret = null; String name1 = name; String version1 = version; LOGGER.entry(name1, version1); try { ret = initialiseSessionForReadOnly(); - if (ret.isNOK()) { + if (ret.isNok()) { return ret; } @@ -1196,7 +1196,7 @@ public class ApexEditorRestResource { } ret = sessionApexModel.listEvent(name1, version1); - if (ret.isNOK()) { + if (ret.isNok()) { return ret; } @@ -1206,8 +1206,8 @@ public class ApexEditorRestResource { LOGGER.catching(e); throw e; } finally { - LOGGER.exit((ret == null ? false : ret.isOK())); - LOGGER.info("Validate/Event" + (ret != null && ret.isOK() ? ": OK" : ": Not OK")); + LOGGER.exit((ret == null ? false : ret.isOk())); + LOGGER.info("Validate/Event" + (ret != null && ret.isOk() ? ": OK" : ": Not OK")); } } @@ -1215,18 +1215,18 @@ public class ApexEditorRestResource { * Creates a task with the information in the JSON string passed. * * @param jsonString the JSON string to be parsed. See {@linkplain BeanTask} - * @return an ApexAPIResult object. If successful then {@link ApexAPIResult#isOK()} will return - * true. Any messages/errors can be retrieved using {@link ApexAPIResult#getMessages()} + * @return an ApexAPIResult object. If successful then {@link ApexApiResult#isOk()} will return + * true. Any messages/errors can be retrieved using {@link ApexApiResult#getMessages()} */ @POST @Path("Task/Create") - public ApexAPIResult createTask(final String jsonString) { - ApexAPIResult ret = null; - ApexAPIResult tempres = null; + public ApexApiResult createTask(final String jsonString) { + ApexApiResult ret = null; + ApexApiResult tempres = null; LOGGER.entry(jsonString); try { ret = initialiseSessionForChanges(); - if (ret.isNOK()) { + if (ret.isNok()) { return ret; } @@ -1234,20 +1234,20 @@ public class ApexEditorRestResource { ret = sessionApexModel.createTask(jsonbean.getName(), jsonbean.getVersion(), jsonbean.getUuid(), jsonbean.getDescription()); - if (ret.isNOK()) { + if (ret.isNok()) { return ret; } if (jsonbean.getInputFields() != null) { for (final Entry<String, BeanField> fin : jsonbean.getInputFields().entrySet()) { if (fin.getValue() == null) { - ret = new ApexAPIResult(RESULT.FAILED, "Null task input field information for field \"" + ret = new ApexApiResult(Result.FAILED, "Null task input field information for field \"" + fin.getKey() + "\" in task " + jsonbean.getName() + ":" + jsonbean.getVersion() + ". The task was created, but there was an error adding the input fields." + " The task has only been partially defined."); return ret; } if (fin.getKey() == null || !fin.getKey().equals(fin.getValue().getLocalName())) { - ret = new ApexAPIResult(RESULT.FAILED, "Invalid task input field information for field \"" + ret = new ApexApiResult(Result.FAILED, "Invalid task input field information for field \"" + fin.getKey() + "\" in task " + jsonbean.getName() + ":" + jsonbean.getVersion() + ". The localName of the field (\"" + fin.getValue().getLocalName() + "\") is not the same as the field name. " @@ -1258,7 +1258,7 @@ public class ApexEditorRestResource { tempres = sessionApexModel.createTaskInputField(jsonbean.getName(), jsonbean.getVersion(), fin.getKey(), fin.getValue().getName(), fin.getValue().getVersion(), fin.getValue().getOptional()); - if (tempres.isNOK()) { + if (tempres.isNok()) { tempres.addMessage("Failed to add task input field information for field \"" + fin.getKey() + "\" in task " + jsonbean.getName() + ":" + jsonbean.getVersion() + ". The task was created, but there was an error adding the input fields." @@ -1271,14 +1271,14 @@ public class ApexEditorRestResource { if (jsonbean.getOutputFields() != null) { for (final Entry<String, BeanField> fout : jsonbean.getOutputFields().entrySet()) { if (fout.getValue() == null) { - ret = new ApexAPIResult(RESULT.FAILED, "Null task output field information for field \"" + ret = new ApexApiResult(Result.FAILED, "Null task output field information for field \"" + fout.getKey() + "\" in task " + jsonbean.getName() + ":" + jsonbean.getVersion() + ". The task was created, but there was an error adding the output fields." + " The task has only been partially defined."); return ret; } if (fout.getKey() == null || !fout.getKey().equals(fout.getValue().getLocalName())) { - ret = new ApexAPIResult(RESULT.FAILED, "Invalid task output field information for field \"" + ret = new ApexApiResult(Result.FAILED, "Invalid task output field information for field \"" + fout.getKey() + "\" in task " + jsonbean.getName() + ":" + jsonbean.getVersion() + ". The localName of the field (\"" + fout.getValue().getLocalName() + "\") is not the same as the field name. " @@ -1289,7 +1289,7 @@ public class ApexEditorRestResource { tempres = sessionApexModel.createTaskOutputField(jsonbean.getName(), jsonbean.getVersion(), fout.getKey(), fout.getValue().getName(), fout.getValue().getVersion(), fout.getValue().getOptional()); - if (tempres.isNOK()) { + if (tempres.isNok()) { tempres.addMessage("Failed to add task output field information for field \"" + fout.getKey() + "\" in task " + jsonbean.getName() + ":" + jsonbean.getVersion() + ". The task was created, but there was an error adding the output fields." @@ -1303,7 +1303,7 @@ public class ApexEditorRestResource { final BeanLogic logic = jsonbean.getTaskLogic(); tempres = sessionApexModel.createTaskLogic(jsonbean.getName(), jsonbean.getVersion(), logic.getLogicFlavour(), logic.getLogic()); - if (tempres.isNOK()) { + if (tempres.isNok()) { tempres.addMessage("Failed to add task logic in task " + jsonbean.getName() + ":" + jsonbean.getVersion() + ". The task was created, but there was an error adding the logic." @@ -1316,7 +1316,7 @@ public class ApexEditorRestResource { for (final Entry<String, BeanTaskParameter> param : jsonbean.getParameters().entrySet()) { if (param.getKey() == null || param.getValue() == null || !param.getKey().equals(param.getValue().getParameterName())) { - ret = new ApexAPIResult(RESULT.FAILED, + ret = new ApexApiResult(Result.FAILED, "Null or invalid task parameter information for parameter \"" + param.getKey() + "\" in task " + jsonbean.getName() + ":" + jsonbean.getVersion() + ". The task was created, but there was an error adding the parameters." @@ -1325,7 +1325,7 @@ public class ApexEditorRestResource { } tempres = sessionApexModel.createTaskParameter(jsonbean.getName(), jsonbean.getVersion(), param.getValue().getParameterName(), param.getValue().getDefaultValue()); - if (tempres.isNOK()) { + if (tempres.isNok()) { tempres.addMessage("Failed to add task parameter \"" + param.getKey() + "\" in task " + jsonbean.getName() + ":" + jsonbean.getVersion() + ". The task was created, but there was an error adding the parameters." @@ -1338,7 +1338,7 @@ public class ApexEditorRestResource { if (jsonbean.getContexts() != null) { for (final BeanKeyRef contextalbum : jsonbean.getContexts()) { if (contextalbum.getName() == null || contextalbum.getVersion() == null) { - ret = new ApexAPIResult(RESULT.FAILED, + ret = new ApexApiResult(Result.FAILED, "Null or invalid context album reference information in task " + jsonbean.getName() + ":" + jsonbean.getVersion() + ". The task was created, but there was an error adding the" @@ -1347,8 +1347,8 @@ public class ApexEditorRestResource { } tempres = sessionApexModel.createTaskContextRef(jsonbean.getName(), jsonbean.getVersion(), contextalbum.getName(), contextalbum.getVersion()); - if (tempres.isNOK()) { - ret = new ApexAPIResult(RESULT.FAILED, + if (tempres.isNok()) { + ret = new ApexApiResult(Result.FAILED, "Failed to add context album reference information in task " + jsonbean.getName() + ":" + jsonbean.getVersion() + ". The task was created, but there was an error adding the" @@ -1357,7 +1357,7 @@ public class ApexEditorRestResource { } } } - if (ret.isOK()) { + if (ret.isOk()) { commitChanges(); } return ret; @@ -1365,8 +1365,8 @@ public class ApexEditorRestResource { LOGGER.catching(e); throw e; } finally { - LOGGER.exit((ret == null ? false : ret.isOK())); - LOGGER.info("Task/Create" + (ret != null && ret.isOK() ? ": OK" : ": Not OK")); + LOGGER.exit((ret == null ? false : ret.isOk())); + LOGGER.info("Task/Create" + (ret != null && ret.isOk() ? ": OK" : ": Not OK")); } } @@ -1374,17 +1374,17 @@ public class ApexEditorRestResource { * Update a task with the information in the JSON string passed. * * @param jsonString the JSON string to be parsed. See {@linkplain BeanTask} - * @return an ApexAPIResult object. If successful then {@link ApexAPIResult#isOK()} will return - * true. Any messages/errors can be retrieved using {@link ApexAPIResult#getMessages()} + * @return an ApexAPIResult object. If successful then {@link ApexApiResult#isOk()} will return + * true. Any messages/errors can be retrieved using {@link ApexApiResult#getMessages()} */ @PUT @Path("Task/Update") - public ApexAPIResult updateTask(final String jsonString) { - ApexAPIResult ret = null; + public ApexApiResult updateTask(final String jsonString) { + ApexApiResult ret = null; LOGGER.entry(jsonString); try { ret = initialiseSessionForChanges(); - if (ret.isNOK()) { + if (ret.isNok()) { return ret; } @@ -1392,18 +1392,18 @@ public class ApexEditorRestResource { if (jsonbean.getName() == null || jsonbean.getName().equals("") || jsonbean.getVersion() == null || jsonbean.getVersion().equals("")) { - ret = new ApexAPIResult(RESULT.FAILED, "Null/Empty task name/version (\"" + jsonbean.getName() + ":" + ret = new ApexApiResult(Result.FAILED, "Null/Empty task name/version (\"" + jsonbean.getName() + ":" + jsonbean.getVersion() + "\" passed to UpdateTask"); return ret; } ret = sessionApexModel.deleteTask(jsonbean.getName(), jsonbean.getVersion()); - if (ret.isNOK()) { + if (ret.isNok()) { return ret; } ret = createTask(jsonString); - if (ret.isOK()) { + if (ret.isOk()) { commitChanges(); } return ret; @@ -1411,8 +1411,8 @@ public class ApexEditorRestResource { LOGGER.catching(e); throw e; } finally { - LOGGER.exit((ret == null ? false : ret.isOK())); - LOGGER.info("Task/Update" + (ret != null && ret.isOK() ? ": OK" : ": Not OK")); + LOGGER.exit((ret == null ? false : ret.isOk())); + LOGGER.info("Task/Update" + (ret != null && ret.isOk() ? ": OK" : ": Not OK")); } } @@ -1423,19 +1423,19 @@ public class ApexEditorRestResource { * * @param name the name to search for. If null or empty, then all names will be queried * @param version the version to search for. If null then all versions will be searched for. - * @return an ApexAPIResult object. If successful then {@link ApexAPIResult#isOK()} will return - * true. Any messages/errors can be retrieved using {@link ApexAPIResult#getMessages()} + * @return an ApexAPIResult object. If successful then {@link ApexApiResult#isOk()} will return + * true. Any messages/errors can be retrieved using {@link ApexApiResult#getMessages()} */ @GET @Path("Task/Get") - public ApexAPIResult listTask(@QueryParam("name") final String name, @QueryParam("version") final String version) { - ApexAPIResult ret = null; + public ApexApiResult listTask(@QueryParam("name") final String name, @QueryParam("version") final String version) { + ApexApiResult ret = null; String name1 = name; String version1 = version; LOGGER.entry(name1, version1); try { ret = initialiseSessionForReadOnly(); - if (ret.isNOK()) { + if (ret.isNok()) { return ret; } @@ -1447,7 +1447,7 @@ public class ApexEditorRestResource { } ret = sessionApexModel.listTask(name1, version1); - if (ret.isNOK()) { + if (ret.isNok()) { return ret; } @@ -1457,8 +1457,8 @@ public class ApexEditorRestResource { LOGGER.catching(e); throw e; } finally { - LOGGER.exit((ret == null ? false : ret.isOK())); - LOGGER.info("Task/Get" + (ret != null && ret.isOK() ? ": OK" : ": Not OK")); + LOGGER.exit((ret == null ? false : ret.isOk())); + LOGGER.info("Task/Get" + (ret != null && ret.isOk() ? ": OK" : ": Not OK")); } } @@ -1467,20 +1467,20 @@ public class ApexEditorRestResource { * * @param name the name to search for. If null or empty, then all names will be queried * @param version the version to search for. If null then all versions will be searched for. - * @return an ApexAPIResult object. If successful then {@link ApexAPIResult#isOK()} will return - * true. Any messages/errors can be retrieved using {@link ApexAPIResult#getMessages()} + * @return an ApexAPIResult object. If successful then {@link ApexApiResult#isOk()} will return + * true. Any messages/errors can be retrieved using {@link ApexApiResult#getMessages()} */ @DELETE @Path("Task/Delete") - public ApexAPIResult deleteTask(@QueryParam("name") final String name, + public ApexApiResult deleteTask(@QueryParam("name") final String name, @QueryParam("version") final String version) { - ApexAPIResult ret = null; + ApexApiResult ret = null; String name1 = name; String version1 = version; LOGGER.entry(name1, version1); try { ret = initialiseSessionForChanges(); - if (ret.isNOK()) { + if (ret.isNok()) { return ret; } @@ -1495,7 +1495,7 @@ public class ApexEditorRestResource { // in the task, so // deleting the task removes all of these ret = sessionApexModel.deleteTask(name1, version1); - if (ret.isOK()) { + if (ret.isOk()) { commitChanges(); } return ret; @@ -1503,8 +1503,8 @@ public class ApexEditorRestResource { LOGGER.catching(e); throw e; } finally { - LOGGER.exit((ret == null ? false : ret.isOK())); - LOGGER.info("Task/Delete" + (ret != null && ret.isOK() ? ": OK" : ": Not OK")); + LOGGER.exit((ret == null ? false : ret.isOk())); + LOGGER.info("Task/Delete" + (ret != null && ret.isOk() ? ": OK" : ": Not OK")); } } @@ -1514,20 +1514,20 @@ public class ApexEditorRestResource { * * @param name the name to search for. If null or empty, then all names will be queried * @param version the version to search for. If null then all versions will be searched for. - * @return an ApexAPIResult object. If successful then {@link ApexAPIResult#isOK()} will return - * true. Any messages/errors can be retrieved using {@link ApexAPIResult#getMessages()} + * @return an ApexAPIResult object. If successful then {@link ApexApiResult#isOk()} will return + * true. Any messages/errors can be retrieved using {@link ApexApiResult#getMessages()} */ @GET @Path("Validate/Task") - public ApexAPIResult validateTask(@QueryParam("name") final String name, + public ApexApiResult validateTask(@QueryParam("name") final String name, @QueryParam("version") final String version) { - ApexAPIResult ret = null; + ApexApiResult ret = null; String name1 = name; String version1 = version; LOGGER.entry(name1, version1); try { ret = initialiseSessionForReadOnly(); - if (ret.isNOK()) { + if (ret.isNok()) { return ret; } @@ -1539,7 +1539,7 @@ public class ApexEditorRestResource { } ret = sessionApexModel.listTask(name1, version1); - if (ret.isNOK()) { + if (ret.isNok()) { return ret; } @@ -1549,8 +1549,8 @@ public class ApexEditorRestResource { LOGGER.catching(e); throw e; } finally { - LOGGER.exit((ret == null ? false : ret.isOK())); - LOGGER.info("Validate/Task" + (ret != null && ret.isOK() ? ": OK" : ": Not OK")); + LOGGER.exit((ret == null ? false : ret.isOk())); + LOGGER.info("Validate/Task" + (ret != null && ret.isOk() ? ": OK" : ": Not OK")); } } @@ -1559,19 +1559,19 @@ public class ApexEditorRestResource { * Creates a policy with the information in the JSON string passed. * * @param jsonString the JSON string to be parsed See {@linkplain BeanPolicy} - * @return an ApexAPIResult object. If successful then {@link ApexAPIResult#isOK()} will return - * true. Any messages/errors can be retrieved using {@link ApexAPIResult#getMessages()} + * @return an ApexAPIResult object. If successful then {@link ApexApiResult#isOk()} will return + * true. Any messages/errors can be retrieved using {@link ApexApiResult#getMessages()} */ @POST @Path("Policy/Create") - public ApexAPIResult createPolicy(final String jsonString) { + public ApexApiResult createPolicy(final String jsonString) { - ApexAPIResult ret = null; - ApexAPIResult tempres = null; + ApexApiResult ret = null; + ApexApiResult tempres = null; LOGGER.entry(jsonString); try { ret = initialiseSessionForChanges(); - if (ret.isNOK()) { + if (ret.isNok()) { return ret; } @@ -1581,12 +1581,12 @@ public class ApexEditorRestResource { ret = sessionApexModel.createPolicy(policyname, policyversion, jsonbean.getTemplate(), jsonbean.getFirstState(), jsonbean.getUuid(), jsonbean.getDescription()); - if (ret.isNOK()) { + if (ret.isNok()) { return ret; } if (jsonbean.getStates() == null || jsonbean.getStates().isEmpty()) { - ret = new ApexAPIResult(RESULT.FAILED, "Null or empty state map; no states defined for policy \"" + ret = new ApexApiResult(Result.FAILED, "Null or empty state map; no states defined for policy \"" + policyname + ":" + policyversion + "\". The policy was created, but there was an error adding states." + " The policy has only been partially defined."); @@ -1599,21 +1599,21 @@ public class ApexEditorRestResource { final String statename = e.getKey(); final BeanState state = e.getValue(); if (state == null) { - ret = new ApexAPIResult(RESULT.FAILED, "Null or invalid state information for state \"" + statename + ret = new ApexApiResult(Result.FAILED, "Null or invalid state information for state \"" + statename + "\" for policy \"" + policyname + ":" + policyversion + "\". The policy was created, but there was an error adding the state." + " The policy has only been partially defined."); return ret; } if (state.getTrigger() == null) { - ret = new ApexAPIResult(RESULT.FAILED, "Null or invalid state trigger for state \"" + statename + ret = new ApexApiResult(Result.FAILED, "Null or invalid state trigger for state \"" + statename + "\" for policy \"" + policyname + ":" + policyversion + "\". The policy was created, but there was an error adding the state." + " The policy has only been partially defined."); return ret; } if (state.getDefaultTask() == null) { - ret = new ApexAPIResult(RESULT.FAILED, "Null or invalid default task for state \"" + statename + ret = new ApexApiResult(Result.FAILED, "Null or invalid default task for state \"" + statename + "\" for policy \"" + policyname + ":" + policyversion + "\". The policy was created, but there was an error adding the state." + " The policy has only been partially defined."); @@ -1622,7 +1622,7 @@ public class ApexEditorRestResource { tempres = sessionApexModel.createPolicyState(policyname, policyversion, statename, state.getTrigger().getName(), state.getTrigger().getVersion(), state.getDefaultTask().getName(), state.getDefaultTask().getVersion()); - if (tempres.isNOK()) { + if (tempres.isNok()) { ret = tempres; return ret; } @@ -1636,7 +1636,7 @@ public class ApexEditorRestResource { if (tsl != null) { tempres = sessionApexModel.createPolicyStateTaskSelectionLogic(policyname, policyversion, statename, tsl.getLogicFlavour(), tsl.getLogic()); - if (tempres.isNOK()) { + if (tempres.isNok()) { tempres.addMessage("Failed to add task selection logic for state \"" + statename + "\" for" + " policy \"" + policyname + ":" + policyversion + "\". The policy was created, but there was an error adding the task selection logic " @@ -1650,7 +1650,7 @@ public class ApexEditorRestResource { if (contexts != null) { for (final BeanKeyRef c : contexts) { if (c == null) { - ret = new ApexAPIResult(RESULT.FAILED, + ret = new ApexApiResult(Result.FAILED, "Null or invalid context reference \"" + c + "\" for" + " state \"" + statename + "\" for policy \"" + policyname + ":" + policyversion + "\". The policy was created, but there was an error adding the context " @@ -1659,7 +1659,7 @@ public class ApexEditorRestResource { } tempres = sessionApexModel.createPolicyStateContextRef(policyname, policyversion, statename, c.getName(), c.getVersion()); - if (tempres.isNOK()) { + if (tempres.isNok()) { tempres.addMessage("Failed to add context reference \"" + c + "\" for state \"" + statename + "\" for policy \"" + policyname + ":" + policyversion + "\". The policy was created, but there was an error adding the context reference " @@ -1676,7 +1676,7 @@ public class ApexEditorRestResource { final String finalizername = f.getKey(); final BeanLogic finalizer = f.getValue(); if (finalizername == null || finalizer == null) { - ret = new ApexAPIResult(RESULT.FAILED, + ret = new ApexApiResult(Result.FAILED, "Null or invalid finalizer information for finalizer " + "named \"" + finalizername + "\" in state \"" + statename + "\" for policy \"" + policyname + ":" + policyversion @@ -1686,7 +1686,7 @@ public class ApexEditorRestResource { } tempres = sessionApexModel.createPolicyStateFinalizerLogic(policyname, policyversion, statename, finalizername, finalizer.getLogicFlavour(), finalizer.getLogic()); - if (tempres.isNOK()) { + if (tempres.isNok()) { tempres.addMessage("Failed to add finalizer information for finalizer named \"" + finalizername + "\" in" + " state \"" + statename + "\" for policy \"" + policyname + ":" + policyversion @@ -1699,7 +1699,7 @@ public class ApexEditorRestResource { } final Map<String, BeanStateOutput> outputs = state.getStateOutputs(); if (outputs == null || outputs.isEmpty()) { - ret = new ApexAPIResult(RESULT.FAILED, + ret = new ApexApiResult(Result.FAILED, "No state outputs have been defined in state \"" + statename + "\" for policy \"" + policyname + ":" + policyversion + "\". The policy and state were created, but there was an error adding state" @@ -1710,7 +1710,7 @@ public class ApexEditorRestResource { final String outputname = o.getKey(); final BeanStateOutput output = o.getValue(); if (outputname == null || output == null || output.getEvent() == null) { - ret = new ApexAPIResult(RESULT.FAILED, + ret = new ApexApiResult(Result.FAILED, "Null or invalid output information for output named \"" + outputname + "\" in state \"" + statename + "\" for policy \"" + policyname + ":" + policyversion + "\". The policy and state were created, but there was an error adding the" @@ -1719,7 +1719,7 @@ public class ApexEditorRestResource { } tempres = sessionApexModel.createPolicyStateOutput(policyname, policyversion, statename, outputname, output.getEvent().getName(), output.getEvent().getVersion(), output.getNextState()); - if (tempres.isNOK()) { + if (tempres.isNok()) { tempres.addMessage("Failed to add output information for output named \"" + outputname + "\" in state \"" + statename + "\" for policy \"" + policyname + ":" + policyversion + "\". The policy and state were created, but there was an error adding the output." @@ -1731,7 +1731,7 @@ public class ApexEditorRestResource { final Map<String, BeanStateTaskRef> taskmap = state.getTasks(); if (taskmap == null || taskmap.isEmpty()) { - ret = new ApexAPIResult(RESULT.FAILED, + ret = new ApexApiResult(Result.FAILED, "No tasks have been defined in state \"" + statename + "\" for policy \"" + policyname + ":" + policyversion + "\". The policy and state were created, but there was an error adding tasks." @@ -1742,7 +1742,7 @@ public class ApexEditorRestResource { final String tasklocalname = t.getKey(); final BeanStateTaskRef taskref = t.getValue(); if (tasklocalname == null || taskref == null || taskref.getTask() == null) { - ret = new ApexAPIResult(RESULT.FAILED, + ret = new ApexApiResult(Result.FAILED, "Null or invalid task information for task named \"" + tasklocalname + "\" in state \"" + statename + "\" for for policy \"" + policyname + ":" + policyversion + "\". The policy and state were created, but there was an error adding the " @@ -1752,7 +1752,7 @@ public class ApexEditorRestResource { tempres = sessionApexModel.createPolicyStateTaskRef(policyname, policyversion, statename, tasklocalname, taskref.getTask().getName(), taskref.getTask().getVersion(), taskref.getOutputType(), taskref.getOutputName()); - if (tempres.isNOK()) { + if (tempres.isNok()) { tempres.addMessage("Failed to add task reference \"" + t + "\" for state \"" + statename + "\" for policy \"" + policyname + ":" + policyversion + "\". The policy was created, but there was an error adding the task reference for" @@ -1763,7 +1763,7 @@ public class ApexEditorRestResource { } } - if (ret.isOK()) { + if (ret.isOk()) { commitChanges(); } return ret; @@ -1771,8 +1771,8 @@ public class ApexEditorRestResource { LOGGER.catching(e); throw e; } finally { - LOGGER.exit((ret == null ? false : ret.isOK())); - LOGGER.info("Policy/Create" + (ret != null && ret.isOK() ? ": OK" : ": Not OK")); + LOGGER.exit((ret == null ? false : ret.isOk())); + LOGGER.info("Policy/Create" + (ret != null && ret.isOk() ? ": OK" : ": Not OK")); } } // CHECKSTYLE:ON: MethodLength @@ -1782,18 +1782,18 @@ public class ApexEditorRestResource { * * @param firstStatePeriodic indicates if periodic event should be created and added to model * @param jsonString the JSON string to be parsed. See {@linkplain BeanPolicy} - * @return an ApexAPIResult object. If successful then {@link ApexAPIResult#isOK()} will return - * true. Any messages/errors can be retrieved using {@link ApexAPIResult#getMessages()} + * @return an ApexAPIResult object. If successful then {@link ApexApiResult#isOk()} will return + * true. Any messages/errors can be retrieved using {@link ApexApiResult#getMessages()} */ @PUT @Path("Policy/Update") - public ApexAPIResult updatePolicy(@QueryParam("firstStatePeriodic") final boolean firstStatePeriodic, + public ApexApiResult updatePolicy(@QueryParam("firstStatePeriodic") final boolean firstStatePeriodic, final String jsonString) { - ApexAPIResult ret = null; + ApexApiResult ret = null; LOGGER.entry(jsonString); try { ret = initialiseSessionForChanges(); - if (ret.isNOK()) { + if (ret.isNok()) { return ret; } @@ -1801,18 +1801,18 @@ public class ApexEditorRestResource { if (jsonbean.getName() == null || jsonbean.getName().equals("") || jsonbean.getVersion() == null || jsonbean.getVersion().equals("")) { - ret = new ApexAPIResult(RESULT.FAILED, "Null/Empty Policy name/version (\"" + jsonbean.getName() + ":" + ret = new ApexApiResult(Result.FAILED, "Null/Empty Policy name/version (\"" + jsonbean.getName() + ":" + jsonbean.getVersion() + "\" passed to UpdatePolicy"); return ret; } ret = sessionApexModel.deletePolicy(jsonbean.getName(), jsonbean.getVersion()); - if (ret.isNOK()) { + if (ret.isNok()) { return ret; } if (firstStatePeriodic) { - final ApexAPIResult existingPeriodicEvent = sessionApexModel.listEvent("PeriodicEvent", null); - if (existingPeriodicEvent.isNOK()) { + final ApexApiResult existingPeriodicEvent = sessionApexModel.listEvent("PeriodicEvent", null); + if (existingPeriodicEvent.isNok()) { final String periodicEventString = "{\"name\":\"PeriodicEvent\",\"version\":\"0.0.1\"," + "\"uuid\":\"44236da1-3d47-4988-8033-b6fee9d6a0f4\"," @@ -1820,13 +1820,13 @@ public class ApexEditorRestResource { + "'PeriodicEvent:0.0.1'\",\"source\":\"System\",\"target\":\"Apex\"," + "\"nameSpace\":\"org.onap.policy.apex.domains.aadm.events\",\"parameters\":{}}"; ret = createEvent(periodicEventString); - if (ret.isNOK()) { + if (ret.isNok()) { return ret; } } } ret = createPolicy(jsonString); - if (ret.isOK()) { + if (ret.isOk()) { commitChanges(); } return ret; @@ -1834,8 +1834,8 @@ public class ApexEditorRestResource { LOGGER.catching(e); throw e; } finally { - LOGGER.exit((ret == null ? false : ret.isOK())); - LOGGER.info("Policy/Update" + (ret != null && ret.isOK() ? ": OK" : ": Not OK")); + LOGGER.exit((ret == null ? false : ret.isOk())); + LOGGER.info("Policy/Update" + (ret != null && ret.isOk() ? ": OK" : ": Not OK")); } } @@ -1846,20 +1846,20 @@ public class ApexEditorRestResource { * * @param name the name to search for. If null or empty, then all names will be queried * @param version the version to search for. If null then all versions will be searched for. - * @return an ApexAPIResult object. If successful then {@link ApexAPIResult#isOK()} will return - * true. Any messages/errors can be retrieved using {@link ApexAPIResult#getMessages()} + * @return an ApexAPIResult object. If successful then {@link ApexApiResult#isOk()} will return + * true. Any messages/errors can be retrieved using {@link ApexApiResult#getMessages()} */ @GET @Path("Policy/Get") - public ApexAPIResult listPolicy(@QueryParam("name") final String name, + public ApexApiResult listPolicy(@QueryParam("name") final String name, @QueryParam("version") final String version) { - ApexAPIResult ret = null; + ApexApiResult ret = null; String name1 = name; String version1 = version; LOGGER.entry(name1, version1); try { ret = initialiseSessionForReadOnly(); - if (ret.isNOK()) { + if (ret.isNok()) { return ret; } @@ -1872,7 +1872,7 @@ public class ApexEditorRestResource { ret = sessionApexModel.listPolicy(name1, version1); - if (ret.isNOK()) { + if (ret.isNok()) { return ret; } @@ -1882,8 +1882,8 @@ public class ApexEditorRestResource { LOGGER.catching(e); throw e; } finally { - LOGGER.exit((ret == null ? false : ret.isOK())); - LOGGER.info("Policy/Get" + (ret != null && ret.isOK() ? ": OK" : ": Not OK")); + LOGGER.exit((ret == null ? false : ret.isOk())); + LOGGER.info("Policy/Get" + (ret != null && ret.isOk() ? ": OK" : ": Not OK")); } } @@ -1892,20 +1892,20 @@ public class ApexEditorRestResource { * * @param name the name to search for. If null or empty, then all names will be queried * @param version the version to search for. If null then all versions will be searched for. - * @return an ApexAPIResult object. If successful then {@link ApexAPIResult#isOK()} will return - * true. Any messages/errors can be retrieved using {@link ApexAPIResult#getMessages()} + * @return an ApexAPIResult object. If successful then {@link ApexApiResult#isOk()} will return + * true. Any messages/errors can be retrieved using {@link ApexApiResult#getMessages()} */ @DELETE @Path("Policy/Delete") - public ApexAPIResult deletePolicy(@QueryParam("name") final String name, + public ApexApiResult deletePolicy(@QueryParam("name") final String name, @QueryParam("version") final String version) { - ApexAPIResult ret = null; + ApexApiResult ret = null; String name1 = name; String version1 = version; LOGGER.entry(name1, version1); try { ret = initialiseSessionForChanges(); - if (ret.isNOK()) { + if (ret.isNok()) { return ret; } @@ -1920,7 +1920,7 @@ public class ApexEditorRestResource { // in the task, so // deleting the task removes all of these ret = sessionApexModel.deletePolicy(name1, version1); - if (ret.isOK()) { + if (ret.isOk()) { commitChanges(); } return ret; @@ -1928,8 +1928,8 @@ public class ApexEditorRestResource { LOGGER.catching(e); throw e; } finally { - LOGGER.exit((ret == null ? false : ret.isOK())); - LOGGER.info("Policy/Delete" + (ret != null && ret.isOK() ? ": OK" : ": Not OK")); + LOGGER.exit((ret == null ? false : ret.isOk())); + LOGGER.info("Policy/Delete" + (ret != null && ret.isOk() ? ": OK" : ": Not OK")); } } @@ -1943,12 +1943,12 @@ public class ApexEditorRestResource { * @return The list result, containing json augmented representations of objects stored in its * "messages" array */ - private ApexAPIResult addKeyInfo2Messages(final ApexAPIResult result) { - if (result.isNOK()) { + private ApexApiResult addKeyInfo2Messages(final ApexApiResult result) { + if (result.isNok()) { return result; } - final ApexAPIResult ret = new ApexAPIResult(result.getResult()); + final ApexApiResult ret = new ApexApiResult(result.getResult()); ret.setMessages(result.getMessages()); final List<String> messages = result.getMessages(); @@ -2006,9 +2006,9 @@ public class ApexEditorRestResource { String desc = null; if (name != null && version != null) { - final ApexAPIResult keyInfoResult = sessionApexModel.listKeyInformation(name, version); + final ApexApiResult keyInfoResult = sessionApexModel.listKeyInformation(name, version); final List<String> keyInfoMessages = keyInfoResult.getMessages(); - if (keyInfoResult.isOK() && keyInfoMessages != null && keyInfoMessages.size() > 0) { + if (keyInfoResult.isOk() && keyInfoMessages != null && keyInfoMessages.size() > 0) { final String keyInfoJson = keyInfoMessages.get(0); final JsonObject keyInfoJsonObject = gson.fromJson(keyInfoJson, JsonObject.class); if (keyInfoJsonObject != null && keyInfoJsonObject.get("apexKeyInfo") != null @@ -2032,7 +2032,7 @@ public class ApexEditorRestResource { ret.setMessages(augmessages); if (messages.size() != augmessages.size()) { - ret.setResult(RESULT.OTHER_ERROR); + ret.setResult(Result.OTHER_ERROR); ret.addMessage("Failed to add KeyInfo to all results. Results are not complete"); } @@ -2045,7 +2045,7 @@ public class ApexEditorRestResource { */ protected static int createCorruptSession() { final ApexEditorRestResource apexEditorRestResource = new ApexEditorRestResource(); - final ApexAPIResult result = apexEditorRestResource.createSession(); + final ApexApiResult result = apexEditorRestResource.createSession(); final int corruptSessionId = new Integer(result.getMessages().get(0)); SESSIONMODELMAP.put(corruptSessionId, null); diff --git a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/package-info.java b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/package-info.java index 7e61cc9e6..503e0bd52 100644 --- a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/package-info.java +++ b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/package-info.java @@ -20,7 +20,7 @@ /** * Implements the RESTful editor for Apex. It implements a RESTful service towards the - * {@link org.onap.policy.apex.model.modelapi.ApexEditorAPI} Java interface for use by clients over + * {@link org.onap.policy.apex.model.modelapi.ApexEditorApi} Java interface for use by clients over * REST. It also provides a web-based client written in Javascript. * * @author Liam Fallon (liam.fallon@ericsson.com) diff --git a/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/RestInterfaceTest.java b/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/RestInterfaceTest.java index 012167b51..dc1e1137b 100644 --- a/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/RestInterfaceTest.java +++ b/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/RestInterfaceTest.java @@ -43,7 +43,7 @@ import org.onap.policy.apex.client.editor.rest.ApexEditorMain.EditorState; import org.onap.policy.apex.model.basicmodel.concepts.ApexException; import org.onap.policy.apex.model.basicmodel.handling.ApexModelReader; import org.onap.policy.apex.model.basicmodel.handling.ApexModelStringWriter; -import org.onap.policy.apex.model.modelapi.ApexAPIResult; +import org.onap.policy.apex.model.modelapi.ApexApiResult; import org.onap.policy.apex.model.policymodel.concepts.AxPolicy; import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; import org.onap.policy.common.utils.resources.ResourceUtils; @@ -148,8 +148,8 @@ public class RestInterfaceTest { * @return the session ID */ private static int createNewSession() { - final ApexAPIResult responseMsg = target.path("editor/-1/Session/Create").request().get(ApexAPIResult.class); - assertEquals(responseMsg.getResult(), ApexAPIResult.RESULT.SUCCESS); + final ApexApiResult responseMsg = target.path("editor/-1/Session/Create").request().get(ApexApiResult.class); + assertEquals(responseMsg.getResult(), ApexApiResult.Result.SUCCESS); assertTrue(responseMsg.getMessages().size() == 1); return Integer.parseInt(responseMsg.getMessages().get(0)); } @@ -162,8 +162,8 @@ public class RestInterfaceTest { */ private void uploadPolicy(final int sessionID, final String modelAsJsonString) { final Builder requestbuilder = target.path("editor/" + sessionID + "/Model/Load").request(); - final ApexAPIResult responseMsg = requestbuilder.put(Entity.json(modelAsJsonString), ApexAPIResult.class); - assertTrue(responseMsg.isOK()); + final ApexApiResult responseMsg = requestbuilder.put(Entity.json(modelAsJsonString), ApexApiResult.class); + assertTrue(responseMsg.isOk()); } /** @@ -180,9 +180,9 @@ public class RestInterfaceTest { uploadPolicy(sessionID, localmodelString); - final ApexAPIResult responseMsg = target.path("editor/" + sessionID + "/Policy/Get") - .queryParam("name", "Policy0").queryParam("version", "0.0.1").request().get(ApexAPIResult.class); - assertTrue(responseMsg.isOK()); + final ApexApiResult responseMsg = target.path("editor/" + sessionID + "/Policy/Get") + .queryParam("name", "Policy0").queryParam("version", "0.0.1").request().get(ApexApiResult.class); + assertTrue(responseMsg.isOk()); // The string in responseMsg.Messages[0] is a JSON representation of a AxPolicy object. Lets parse it final String returnedPolicyAsString = responseMsg.getMessages().get(0); diff --git a/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/TestApexEditorRestResource.java b/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/TestApexEditorRestResource.java index 1fb3a0a00..4d45289b1 100644 --- a/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/TestApexEditorRestResource.java +++ b/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/TestApexEditorRestResource.java @@ -32,8 +32,8 @@ import javax.ws.rs.core.MediaType; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.test.JerseyTest; import org.junit.Test; -import org.onap.policy.apex.model.modelapi.ApexAPIResult; -import org.onap.policy.apex.model.modelapi.ApexAPIResult.RESULT; +import org.onap.policy.apex.model.modelapi.ApexApiResult; +import org.onap.policy.apex.model.modelapi.ApexApiResult.Result; import org.onap.policy.apex.model.utilities.TextFileUtils; /** @@ -48,202 +48,202 @@ public class TestApexEditorRestResource extends JerseyTest { @Test public void testSessionCreate() { - ApexAPIResult result = target("editor/-2/Session/Create").request().get(ApexAPIResult.class); - assertEquals(RESULT.FAILED, result.getResult()); + ApexApiResult result = target("editor/-2/Session/Create").request().get(ApexApiResult.class); + assertEquals(Result.FAILED, result.getResult()); - result = target("editor/-1/Session/Create").request().get(ApexAPIResult.class); - assertEquals(RESULT.SUCCESS, result.getResult()); + result = target("editor/-1/Session/Create").request().get(ApexApiResult.class); + assertEquals(Result.SUCCESS, result.getResult()); final int sessionId = new Integer(result.getMessages().get(0)); - result = target("editor/-1/Session/Create").request().get(ApexAPIResult.class); - assertEquals(RESULT.SUCCESS, result.getResult()); + result = target("editor/-1/Session/Create").request().get(ApexApiResult.class); + assertEquals(Result.SUCCESS, result.getResult()); final int corruptSessionId = ApexEditorRestResource.createCorruptSession(); try { - target("editor/" + corruptSessionId + "/Model/Analyse").request().get(ApexAPIResult.class); + target("editor/" + corruptSessionId + "/Model/Analyse").request().get(ApexApiResult.class); } catch (final Exception e) { assertEquals("HTTP 500 Request failed.", e.getMessage()); } - result = target("editor/" + sessionId + "/Model/Analyse").request().get(ApexAPIResult.class); - assertEquals(RESULT.SUCCESS, result.getResult()); - result = target("editor/-12345/Model/Analyse").request().get(ApexAPIResult.class); - assertEquals(RESULT.FAILED, result.getResult()); - result = target("editor/12345/Model/Analyse").request().get(ApexAPIResult.class); - assertEquals(RESULT.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/Model/Analyse").request().get(ApexApiResult.class); + assertEquals(Result.SUCCESS, result.getResult()); + result = target("editor/-12345/Model/Analyse").request().get(ApexApiResult.class); + assertEquals(Result.FAILED, result.getResult()); + result = target("editor/12345/Model/Analyse").request().get(ApexApiResult.class); + assertEquals(Result.FAILED, result.getResult()); try { - target("editor/" + corruptSessionId + "/Model/Validate").request().get(ApexAPIResult.class); + target("editor/" + corruptSessionId + "/Model/Validate").request().get(ApexApiResult.class); } catch (final Exception e) { assertEquals("HTTP 500 Request failed.", e.getMessage()); } - result = target("editor/" + sessionId + "/Model/Validate").request().get(ApexAPIResult.class); - assertEquals(RESULT.FAILED, result.getResult()); - result = target("editor/-12345/Model/Validate").request().get(ApexAPIResult.class); - assertEquals(RESULT.FAILED, result.getResult()); - result = target("editor/12345/Model/Validate").request().get(ApexAPIResult.class); - assertEquals(RESULT.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/Model/Validate").request().get(ApexApiResult.class); + assertEquals(Result.FAILED, result.getResult()); + result = target("editor/-12345/Model/Validate").request().get(ApexApiResult.class); + assertEquals(Result.FAILED, result.getResult()); + result = target("editor/12345/Model/Validate").request().get(ApexApiResult.class); + assertEquals(Result.FAILED, result.getResult()); final String modelString = "{" + "\"name\" : \"Hello\"," + "\"version\" : \"0.0.2\"," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002699\"," + "\"description\" : \"A description of the model\"" + "}"; final Entity<String> csEntity = Entity.entity(modelString, MediaType.APPLICATION_JSON); - result = target("editor/-12345/Model/Create").request().post(csEntity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); - result = target("editor/-12345/Model/Create").request().post(csEntity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); - result = target("editor/1234545/Model/Create").request().post(csEntity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); - result = target("editor/" + sessionId + "/Model/Create").request().post(csEntity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + result = target("editor/-12345/Model/Create").request().post(csEntity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); + result = target("editor/-12345/Model/Create").request().post(csEntity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); + result = target("editor/1234545/Model/Create").request().post(csEntity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/Model/Create").request().post(csEntity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); try { - target("editor/" + corruptSessionId + "/Model/Create").request().post(csEntity, ApexAPIResult.class); + target("editor/" + corruptSessionId + "/Model/Create").request().post(csEntity, ApexApiResult.class); } catch (final Exception e) { assertEquals("HTTP 500 Request failed.", e.getMessage()); } - result = target("editor/-12345/Model/Update").request().put(csEntity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); - result = target("editor/-12345/Model/Update").request().put(csEntity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); - result = target("editor/1234545/Model/Update").request().put(csEntity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); - result = target("editor/" + sessionId + "/Model/Update").request().put(csEntity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + result = target("editor/-12345/Model/Update").request().put(csEntity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); + result = target("editor/-12345/Model/Update").request().put(csEntity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); + result = target("editor/1234545/Model/Update").request().put(csEntity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/Model/Update").request().put(csEntity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); try { - target("editor/" + corruptSessionId + "/Model/Update").request().put(csEntity, ApexAPIResult.class); + target("editor/" + corruptSessionId + "/Model/Update").request().put(csEntity, ApexApiResult.class); } catch (final Exception e) { assertEquals("HTTP 500 Request failed.", e.getMessage()); } try { - result = target("editor/" + corruptSessionId + "/Model/GetKey").request().get(ApexAPIResult.class); + result = target("editor/" + corruptSessionId + "/Model/GetKey").request().get(ApexApiResult.class); } catch (final Exception e) { assertEquals("HTTP 500 Request failed.", e.getMessage()); } - result = target("editor/" + sessionId + "/Model/GetKey").request().get(ApexAPIResult.class); - assertEquals(RESULT.SUCCESS, result.getResult()); - result = target("editor/-12345/Model/GetKey").request().get(ApexAPIResult.class); - assertEquals(RESULT.FAILED, result.getResult()); - result = target("editor/12345/Model/GetKey").request().get(ApexAPIResult.class); - assertEquals(RESULT.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/Model/GetKey").request().get(ApexApiResult.class); + assertEquals(Result.SUCCESS, result.getResult()); + result = target("editor/-12345/Model/GetKey").request().get(ApexApiResult.class); + assertEquals(Result.FAILED, result.getResult()); + result = target("editor/12345/Model/GetKey").request().get(ApexApiResult.class); + assertEquals(Result.FAILED, result.getResult()); try { - result = target("editor/" + corruptSessionId + "/Model/Get").request().get(ApexAPIResult.class); + result = target("editor/" + corruptSessionId + "/Model/Get").request().get(ApexApiResult.class); } catch (final Exception e) { assertEquals("HTTP 500 Request failed.", e.getMessage()); } - result = target("editor/" + sessionId + "/Model/Get").request().get(ApexAPIResult.class); - assertEquals(RESULT.SUCCESS, result.getResult()); - result = target("editor/-12345/Model/Get").request().get(ApexAPIResult.class); - assertEquals(RESULT.FAILED, result.getResult()); - result = target("editor/12345/Model/Get").request().get(ApexAPIResult.class); - assertEquals(RESULT.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/Model/Get").request().get(ApexApiResult.class); + assertEquals(Result.SUCCESS, result.getResult()); + result = target("editor/-12345/Model/Get").request().get(ApexApiResult.class); + assertEquals(Result.FAILED, result.getResult()); + result = target("editor/12345/Model/Get").request().get(ApexApiResult.class); + assertEquals(Result.FAILED, result.getResult()); try { - result = target("editor/" + corruptSessionId + "/Model/Download").request().get(ApexAPIResult.class); + result = target("editor/" + corruptSessionId + "/Model/Download").request().get(ApexApiResult.class); } catch (final Exception e) { assertEquals("HTTP 500 Request failed.", e.getMessage()); } - result = target("editor/" + sessionId + "/Model/Download").request().get(ApexAPIResult.class); - assertEquals(RESULT.SUCCESS, result.getResult()); + result = target("editor/" + sessionId + "/Model/Download").request().get(ApexApiResult.class); + assertEquals(Result.SUCCESS, result.getResult()); try { - target("editor/-12345/Model/Download").request().get(ApexAPIResult.class); + target("editor/-12345/Model/Download").request().get(ApexApiResult.class); fail("test should throw an exception here"); } catch (final Exception e) { assertEquals("HTTP 500 Request failed.", e.getMessage()); } try { - target("editor/12345/Model/Download").request().get(ApexAPIResult.class); + target("editor/12345/Model/Download").request().get(ApexApiResult.class); fail("test should throw an exception here"); } catch (final Exception e) { assertEquals("HTTP 500 Request failed.", e.getMessage()); } try { - result = target("editor/" + corruptSessionId + "/KeyInformation/Get").request().get(ApexAPIResult.class); + result = target("editor/" + corruptSessionId + "/KeyInformation/Get").request().get(ApexApiResult.class); } catch (final Exception e) { assertEquals("HTTP 500 Request failed.", e.getMessage()); } - result = target("editor/" + sessionId + "/KeyInformation/Get").request().get(ApexAPIResult.class); - assertEquals(RESULT.SUCCESS, result.getResult()); - result = target("editor/-12345/KeyInformation/Get").request().get(ApexAPIResult.class); - assertEquals(RESULT.FAILED, result.getResult()); - result = target("editor/12345/KeyInformation/Get").request().get(ApexAPIResult.class); - assertEquals(RESULT.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/KeyInformation/Get").request().get(ApexApiResult.class); + assertEquals(Result.SUCCESS, result.getResult()); + result = target("editor/-12345/KeyInformation/Get").request().get(ApexApiResult.class); + assertEquals(Result.FAILED, result.getResult()); + result = target("editor/12345/KeyInformation/Get").request().get(ApexApiResult.class); + assertEquals(Result.FAILED, result.getResult()); try { - result = target("editor/" + corruptSessionId + "/Model/Delete").request().delete(ApexAPIResult.class); + result = target("editor/" + corruptSessionId + "/Model/Delete").request().delete(ApexApiResult.class); } catch (final Exception e) { assertEquals("HTTP 500 Request failed.", e.getMessage()); } - result = target("editor/" + sessionId + "/Model/Delete").request().delete(ApexAPIResult.class); - assertEquals(RESULT.SUCCESS, result.getResult()); - result = target("editor/-12345/Model/Delete").request().delete(ApexAPIResult.class); - assertEquals(RESULT.FAILED, result.getResult()); - result = target("editor/12345/Model/Delete").request().delete(ApexAPIResult.class); - assertEquals(RESULT.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/Model/Delete").request().delete(ApexApiResult.class); + assertEquals(Result.SUCCESS, result.getResult()); + result = target("editor/-12345/Model/Delete").request().delete(ApexApiResult.class); + assertEquals(Result.FAILED, result.getResult()); + result = target("editor/12345/Model/Delete").request().delete(ApexApiResult.class); + assertEquals(Result.FAILED, result.getResult()); } @Test public void testContextSchema() throws IOException { - ApexAPIResult result = target("editor/-1/Session/Create").request().get(ApexAPIResult.class); - assertEquals(RESULT.SUCCESS, result.getResult()); + ApexApiResult result = target("editor/-1/Session/Create").request().get(ApexApiResult.class); + assertEquals(Result.SUCCESS, result.getResult()); final int sessionId = new Integer(result.getMessages().get(0)); final int corruptSessionId = ApexEditorRestResource.createCorruptSession(); - result = target("editor/-12345/Validate/ContextSchema").request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + result = target("editor/-12345/Validate/ContextSchema").request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); try { - target("editor/" + corruptSessionId + "/Validate/ContextSchema").request().get(ApexAPIResult.class); + target("editor/" + corruptSessionId + "/Validate/ContextSchema").request().get(ApexApiResult.class); } catch (final Exception e) { assertEquals("HTTP 500 Request failed.", e.getMessage()); } - result = target("editor/" + sessionId + "/Validate/ContextSchema").request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, result.getResult()); + result = target("editor/" + sessionId + "/Validate/ContextSchema").request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = target("editor/" + sessionId + "/Validate/ContextSchema").queryParam("name", (String) null) - .queryParam("version", (String) null).request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, result.getResult()); + .queryParam("version", (String) null).request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = target("editor/" + sessionId + "/Validate/ContextSchema").queryParam("name", "%%%$£") - .queryParam("version", (String) null).request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + .queryParam("version", (String) null).request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); final String modelString = TextFileUtils.getTextFileAsString("src/test/resources/models/PolicyModel.json"); Entity<String> modelEntity = Entity.entity("Somewhere over the rainbow", MediaType.APPLICATION_JSON); - result = target("editor/" + -12345 + "/Model/Load").request().put(modelEntity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); - result = target("editor/" + 12345 + "/Model/Load").request().put(modelEntity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); - result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + result = target("editor/" + -12345 + "/Model/Load").request().put(modelEntity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); + result = target("editor/" + 12345 + "/Model/Load").request().put(modelEntity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); modelEntity = Entity.entity("", MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); modelEntity = Entity.entity(modelString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = target("editor/" + sessionId + "/ContextSchema/Get").queryParam("name", (String) null) - .queryParam("version", (String) null).request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + .queryParam("version", (String) null).request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); try { target("editor/" + corruptSessionId + "/ContextSchema/Get").queryParam("name", (String) null) - .queryParam("version", (String) null).request().get(ApexAPIResult.class); + .queryParam("version", (String) null).request().get(ApexApiResult.class); } catch (final Exception e) { assertEquals("HTTP 500 Request failed.", e.getMessage()); } @@ -253,16 +253,16 @@ public class TestApexEditorRestResource extends JerseyTest { + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\"," + "\"description\" : \"A description of hello\"" + "}"; Entity<String> csEntity = Entity.entity(csString, MediaType.APPLICATION_JSON); - result = target("editor/-12345/ContextSchema/Create").request().post(csEntity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); - result = target("editor/1234545/ContextSchema/Create").request().post(csEntity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); - result = target("editor/" + sessionId + "/ContextSchema/Create").request().post(csEntity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + result = target("editor/-12345/ContextSchema/Create").request().post(csEntity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); + result = target("editor/1234545/ContextSchema/Create").request().post(csEntity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/ContextSchema/Create").request().post(csEntity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); try { target("editor/" + corruptSessionId + "/ContextSchema/Create").request().post(csEntity, - ApexAPIResult.class); + ApexApiResult.class); } catch (final Exception e) { assertEquals("HTTP 500 Request failed.", e.getMessage()); } @@ -272,109 +272,109 @@ public class TestApexEditorRestResource extends JerseyTest { + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\"," + "\"description\" : \"A description of hello\"" + "}"; csEntity = Entity.entity(csString, MediaType.APPLICATION_JSON); - result = target("editor/-12345/ContextSchema/Update").request().put(csEntity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); - result = target("editor/1234545/ContextSchema/Update").request().put(csEntity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); - result = target("editor/" + sessionId + "/ContextSchema/Update").request().put(csEntity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + result = target("editor/-12345/ContextSchema/Update").request().put(csEntity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); + result = target("editor/1234545/ContextSchema/Update").request().put(csEntity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/ContextSchema/Update").request().put(csEntity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); try { - target("editor/" + corruptSessionId + "/ContextSchema/Update").request().put(csEntity, ApexAPIResult.class); + target("editor/" + corruptSessionId + "/ContextSchema/Update").request().put(csEntity, ApexApiResult.class); } catch (final Exception e) { assertEquals("HTTP 500 Request failed.", e.getMessage()); } result = target("editor/" + sessionId + "/ContextSchema/Get").queryParam("name", "Hello") - .queryParam("version", (String) null).request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + .queryParam("version", (String) null).request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = target("editor/" + sessionId + "/ContextSchema/Get").queryParam("name", "NonExistant") - .queryParam("version", (String) null).request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, result.getResult()); + .queryParam("version", (String) null).request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = target("editor/-123345/ContextSchema/Get").queryParam("name", (String) null) - .queryParam("version", (String) null).request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + .queryParam("version", (String) null).request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = target("editor/123345/ContextSchema/Get").queryParam("name", (String) null) - .queryParam("version", (String) null).request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + .queryParam("version", (String) null).request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); try { target("editor/" + corruptSessionId + "/ContextSchema/Get").queryParam("name", "Hello") - .queryParam("version", (String) null).request().get(ApexAPIResult.class); + .queryParam("version", (String) null).request().get(ApexApiResult.class); } catch (final Exception e) { assertEquals("HTTP 500 Request failed.", e.getMessage()); } result = target("editor/" + sessionId + "/Validate/ContextSchema").queryParam("name", (String) null) - .queryParam("version", (String) null).request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + .queryParam("version", (String) null).request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); try { target("editor/" + corruptSessionId + "/ContextSchema/Delete").queryParam("name", "Hello") - .queryParam("version", "0.0.2").request().delete(ApexAPIResult.class); + .queryParam("version", "0.0.2").request().delete(ApexApiResult.class); } catch (final Exception e) { assertEquals("HTTP 500 Request failed.", e.getMessage()); } result = target("editor/-123345/ContextSchema/Delete").queryParam("name", (String) null) - .queryParam("version", (String) null).request().delete(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + .queryParam("version", (String) null).request().delete(ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = target("editor/123345/ContextSchema/Delete").queryParam("name", (String) null) - .queryParam("version", (String) null).request().delete(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + .queryParam("version", (String) null).request().delete(ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = target("editor/" + sessionId + "/ContextSchema/Delete").queryParam("name", "Hello") - .queryParam("version", "0.0.2").request().delete(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + .queryParam("version", "0.0.2").request().delete(ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = target("editor/" + sessionId + "/ContextSchema/Delete").queryParam("name", (String) null) - .queryParam("version", (String) null).request().delete(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + .queryParam("version", (String) null).request().delete(ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); } @Test public void testContextAlbum() throws IOException { - ApexAPIResult result = target("editor/-1/Session/Create").request().get(ApexAPIResult.class); - assertEquals(RESULT.SUCCESS, result.getResult()); + ApexApiResult result = target("editor/-1/Session/Create").request().get(ApexApiResult.class); + assertEquals(Result.SUCCESS, result.getResult()); final int sessionId = new Integer(result.getMessages().get(0)); final int corruptSessionId = ApexEditorRestResource.createCorruptSession(); - result = target("editor/-12345/Validate/ContextAlbum").request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + result = target("editor/-12345/Validate/ContextAlbum").request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); try { - target("editor/" + corruptSessionId + "/Validate/ContextAlbum").request().get(ApexAPIResult.class); + target("editor/" + corruptSessionId + "/Validate/ContextAlbum").request().get(ApexApiResult.class); } catch (final Exception e) { assertEquals("HTTP 500 Request failed.", e.getMessage()); } - result = target("editor/" + sessionId + "/Validate/ContextAlbum").request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + result = target("editor/" + sessionId + "/Validate/ContextAlbum").request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = target("editor/" + sessionId + "/Validate/ContextAlbum").queryParam("name", (String) null) - .queryParam("version", (String) null).request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + .queryParam("version", (String) null).request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = target("editor/" + sessionId + "/Validate/ContextAlbum").queryParam("name", "%%%$£") - .queryParam("version", (String) null).request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + .queryParam("version", (String) null).request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); final String modelString = TextFileUtils.getTextFileAsString("src/test/resources/models/PolicyModel.json"); Entity<String> modelEntity = Entity.entity("Somewhere over the rainbow", MediaType.APPLICATION_JSON); - result = target("editor/" + -12345 + "/Model/Load").request().put(modelEntity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); - result = target("editor/" + 12345 + "/Model/Load").request().put(modelEntity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); - result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + result = target("editor/" + -12345 + "/Model/Load").request().put(modelEntity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); + result = target("editor/" + 12345 + "/Model/Load").request().put(modelEntity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); modelEntity = Entity.entity("", MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); modelEntity = Entity.entity(modelString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = target("editor/" + sessionId + "/ContextAlbum/Get").queryParam("name", (String) null) - .queryParam("version", (String) null).request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + .queryParam("version", (String) null).request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); String caString = "{" + "\"name\" : \"Hello\"," + "\"version\" : \"0.0.2\"," + "\"scope\" : \"Domain\"," + "\"writeable\" : false," @@ -382,15 +382,15 @@ public class TestApexEditorRestResource extends JerseyTest { + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\"," + "\"description\" : \"A description of hello\"" + "}"; Entity<String> caEntity = Entity.entity(caString, MediaType.APPLICATION_JSON); - result = target("editor/-12345/ContextAlbum/Create").request().post(caEntity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); - result = target("editor/1234545/ContextAlbum/Create").request().post(caEntity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); - result = target("editor/" + sessionId + "/ContextAlbum/Create").request().post(caEntity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + result = target("editor/-12345/ContextAlbum/Create").request().post(caEntity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); + result = target("editor/1234545/ContextAlbum/Create").request().post(caEntity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/ContextAlbum/Create").request().post(caEntity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); try { - target("editor/" + corruptSessionId + "/ContextAlbum/Create").request().post(caEntity, ApexAPIResult.class); + target("editor/" + corruptSessionId + "/ContextAlbum/Create").request().post(caEntity, ApexApiResult.class); } catch (final Exception e) { assertEquals("HTTP 500 Request failed.", e.getMessage()); } @@ -401,127 +401,127 @@ public class TestApexEditorRestResource extends JerseyTest { + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\"," + "\"description\" : \"A description of hello\"" + "}"; caEntity = Entity.entity(caString, MediaType.APPLICATION_JSON); - result = target("editor/-12345/ContextAlbum/Update").request().put(caEntity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); - result = target("editor/1234545/ContextAlbum/Update").request().put(caEntity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); - result = target("editor/" + sessionId + "/ContextAlbum/Update").request().put(caEntity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + result = target("editor/-12345/ContextAlbum/Update").request().put(caEntity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); + result = target("editor/1234545/ContextAlbum/Update").request().put(caEntity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/ContextAlbum/Update").request().put(caEntity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); try { - target("editor/" + corruptSessionId + "/ContextAlbum/Update").request().put(caEntity, ApexAPIResult.class); + target("editor/" + corruptSessionId + "/ContextAlbum/Update").request().put(caEntity, ApexApiResult.class); } catch (final Exception e) { assertEquals("HTTP 500 Request failed.", e.getMessage()); } try { target("editor/" + corruptSessionId + "/ContextAlbum/Get").queryParam("name", "Hello") - .queryParam("version", (String) null).request().get(ApexAPIResult.class); + .queryParam("version", (String) null).request().get(ApexApiResult.class); } catch (final Exception e) { assertEquals("HTTP 500 Request failed.", e.getMessage()); } result = target("editor/" + sessionId + "/ContextAlbum/Get").queryParam("name", "Hello") - .queryParam("version", (String) null).request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + .queryParam("version", (String) null).request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = target("editor/" + sessionId + "/ContextAlbum/Get").queryParam("name", "IDontExist") - .queryParam("version", (String) null).request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, result.getResult()); + .queryParam("version", (String) null).request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = target("editor/-123345/ContextAlbum/Get").queryParam("name", (String) null) - .queryParam("version", (String) null).request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + .queryParam("version", (String) null).request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = target("editor/123345/ContextAlbum/Get").queryParam("name", (String) null) - .queryParam("version", (String) null).request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + .queryParam("version", (String) null).request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = target("editor/" + sessionId + "/Validate/ContextAlbum").queryParam("name", (String) null) - .queryParam("version", (String) null).request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + .queryParam("version", (String) null).request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); try { target("editor/" + corruptSessionId + "/ContextAlbum/Delete").queryParam("name", (String) null) - .queryParam("version", (String) null).request().delete(ApexAPIResult.class); + .queryParam("version", (String) null).request().delete(ApexApiResult.class); } catch (final Exception e) { assertEquals("HTTP 500 Request failed.", e.getMessage()); } result = target("editor/-123345/ContextAlbum/Delete").queryParam("name", (String) null) - .queryParam("version", (String) null).request().delete(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + .queryParam("version", (String) null).request().delete(ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = target("editor/123345/ContextAlbum/Delete").queryParam("name", (String) null) - .queryParam("version", (String) null).request().delete(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + .queryParam("version", (String) null).request().delete(ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = target("editor/" + sessionId + "/ContextAlbum/Delete").queryParam("name", "Hello") - .queryParam("version", "0.0.2").request().delete(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + .queryParam("version", "0.0.2").request().delete(ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = target("editor/" + sessionId + "/ContextAlbum/Delete").queryParam("name", (String) null) - .queryParam("version", (String) null).request().delete(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + .queryParam("version", (String) null).request().delete(ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); } @Test public void testEvent() throws IOException { final int corruptSessionId = ApexEditorRestResource.createCorruptSession(); - ApexAPIResult result = target("editor/-1/Session/Create").request().get(ApexAPIResult.class); - assertEquals(RESULT.SUCCESS, result.getResult()); + ApexApiResult result = target("editor/-1/Session/Create").request().get(ApexApiResult.class); + assertEquals(Result.SUCCESS, result.getResult()); final int sessionId = new Integer(result.getMessages().get(0)); - result = target("editor/-12345/Validate/Event").request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + result = target("editor/-12345/Validate/Event").request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); - result = target("editor/" + sessionId + "/Validate/Event").request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + result = target("editor/" + sessionId + "/Validate/Event").request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); try { - target("editor/" + corruptSessionId + "/Validate/Event").request().get(ApexAPIResult.class); + target("editor/" + corruptSessionId + "/Validate/Event").request().get(ApexApiResult.class); } catch (final Exception e) { assertEquals("HTTP 500 Request failed.", e.getMessage()); } result = target("editor/" + sessionId + "/Validate/Event").queryParam("name", (String) null) - .queryParam("version", (String) null).request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + .queryParam("version", (String) null).request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = target("editor/" + sessionId + "/Validate/Event").queryParam("name", "%%%$£") - .queryParam("version", (String) null).request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + .queryParam("version", (String) null).request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); final String modelString = TextFileUtils.getTextFileAsString("src/test/resources/models/PolicyModel.json"); Entity<String> modelEntity = Entity.entity("Somewhere over the rainbow", MediaType.APPLICATION_JSON); - result = target("editor/" + -12345 + "/Model/Load").request().put(modelEntity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); - result = target("editor/" + 12345 + "/Model/Load").request().put(modelEntity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); - result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + result = target("editor/" + -12345 + "/Model/Load").request().put(modelEntity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); + result = target("editor/" + 12345 + "/Model/Load").request().put(modelEntity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); modelEntity = Entity.entity("", MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); modelEntity = Entity.entity(modelString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = target("editor/" + sessionId + "/Event/Get").queryParam("name", (String) null) - .queryParam("version", (String) null).request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + .queryParam("version", (String) null).request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); String entityString = "{" + "\"name\" : \"Hello\"," + "\"version\" : \"0.0.2\"," + "\"namespace\" : \"somewhere.over.the.rainbow\"," + "\"source\" : \"beginning\"," + "\"target\" : \"end\"," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\"," + "\"description\" : \"A description of hello\"" + "}"; Entity<String> entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/-12345/Event/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); - result = target("editor/1234545/Event/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); - result = target("editor/" + sessionId + "/Event/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); - result = target("editor/" + sessionId + "/Event/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.CONCEPT_EXISTS, result.getResult()); + result = target("editor/-12345/Event/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); + result = target("editor/1234545/Event/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/Event/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); + result = target("editor/" + sessionId + "/Event/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult()); try { - target("editor/" + corruptSessionId + "/Event/Create").request().post(entity, ApexAPIResult.class); + target("editor/" + corruptSessionId + "/Event/Create").request().post(entity, ApexApiResult.class); } catch (final Exception e) { assertEquals("HTTP 500 Request failed.", e.getMessage()); } @@ -532,8 +532,8 @@ public class TestApexEditorRestResource extends JerseyTest { + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Event/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + result = target("editor/" + sessionId + "/Event/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); entityString = "{" + "\"name\" : \"HowsItGoing\"," + "\"version\" : \"0.0.2\"," + "\"namespace\" : \"somewhere.over.the.rainbow\"," + "\"source\" : \"beginning\"," @@ -543,8 +543,8 @@ public class TestApexEditorRestResource extends JerseyTest { + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Event/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + result = target("editor/" + sessionId + "/Event/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); entityString = "{" + "\"name\" : \"Hi\"," + "\"version\" : \"0.0.2\"," + "\"namespace\" : \"somewhere.over.the.rainbow\"," + "\"source\" : \"beginning\"," @@ -552,8 +552,8 @@ public class TestApexEditorRestResource extends JerseyTest { + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Event/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/Event/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); entityString = "{" + "\"name\" : \"GoodDay\"," + "\"version\" : \"0.0.2\"," + "\"namespace\" : \"somewhere.over.the.rainbow\"," + "\"source\" : \"beginning\"," @@ -563,8 +563,8 @@ public class TestApexEditorRestResource extends JerseyTest { + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Event/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, result.getResult()); + result = target("editor/" + sessionId + "/Event/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); entityString = "{" + "\"name\" : \"Hello\"," + "\"version\" : \"0.0.2\"," + "\"namespace\" : \"somewhere.over.someone.elses.rainbow\"," @@ -572,15 +572,15 @@ public class TestApexEditorRestResource extends JerseyTest { + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/-12345/Event/Update").request().put(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); - result = target("editor/1234545/Event/Update").request().put(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); - result = target("editor/" + sessionId + "/Event/Update").request().put(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + result = target("editor/-12345/Event/Update").request().put(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); + result = target("editor/1234545/Event/Update").request().put(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/Event/Update").request().put(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); try { - target("editor/" + corruptSessionId + "/Event/Update").request().put(entity, ApexAPIResult.class); + target("editor/" + corruptSessionId + "/Event/Update").request().put(entity, ApexApiResult.class); } catch (final Exception e) { assertEquals("HTTP 500 Request failed.", e.getMessage()); } @@ -591,8 +591,8 @@ public class TestApexEditorRestResource extends JerseyTest { + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Event/Update").request().put(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/Event/Update").request().put(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); entityString = "{" + "\"name\" : \"NonExistantEvent\"," + "\"version\" : \"0.0.2\"," + "\"namespace\" : \"somewhere.over.someone.elses.rainbow\"," @@ -600,122 +600,122 @@ public class TestApexEditorRestResource extends JerseyTest { + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Event/Update").request().put(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, result.getResult()); + result = target("editor/" + sessionId + "/Event/Update").request().put(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = target("editor/" + sessionId + "/Event/Get").queryParam("name", "Hello") - .queryParam("version", (String) null).request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + .queryParam("version", (String) null).request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = target("editor/" + sessionId + "/Event/Get").queryParam("name", "IDontExist") - .queryParam("version", (String) null).request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, result.getResult()); + .queryParam("version", (String) null).request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = target("editor/-123345/Event/Get").queryParam("name", (String) null) - .queryParam("version", (String) null).request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + .queryParam("version", (String) null).request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = target("editor/123345/Event/Get").queryParam("name", (String) null) - .queryParam("version", (String) null).request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + .queryParam("version", (String) null).request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); try { target("editor/" + corruptSessionId + "/Event/Get").queryParam("name", "Hello") - .queryParam("version", (String) null).request().get(ApexAPIResult.class); + .queryParam("version", (String) null).request().get(ApexApiResult.class); } catch (final Exception e) { assertEquals("HTTP 500 Request failed.", e.getMessage()); } result = target("editor/" + sessionId + "/Validate/Event").queryParam("name", (String) null) - .queryParam("version", (String) null).request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + .queryParam("version", (String) null).request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = target("editor/-12345/Validate/Event").queryParam("name", (String) null) - .queryParam("version", (String) null).request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + .queryParam("version", (String) null).request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = target("editor/12345/Validate/Event").queryParam("name", (String) null) - .queryParam("version", (String) null).request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + .queryParam("version", (String) null).request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); try { target("editor/" + corruptSessionId + "/Event/Delete").queryParam("name", (String) null) - .queryParam("version", (String) null).request().delete(ApexAPIResult.class); + .queryParam("version", (String) null).request().delete(ApexApiResult.class); } catch (final Exception e) { assertEquals("HTTP 500 Request failed.", e.getMessage()); } result = target("editor/-123345/Event/Delete").queryParam("name", (String) null) - .queryParam("version", (String) null).request().delete(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + .queryParam("version", (String) null).request().delete(ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = target("editor/123345/Event/Delete").queryParam("name", (String) null) - .queryParam("version", (String) null).request().delete(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + .queryParam("version", (String) null).request().delete(ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = target("editor/" + sessionId + "/Event/Delete").queryParam("name", "Hello") - .queryParam("version", "0.0.2").request().delete(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + .queryParam("version", "0.0.2").request().delete(ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = target("editor/" + sessionId + "/Event/Delete").queryParam("name", (String) null) - .queryParam("version", (String) null).request().delete(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + .queryParam("version", (String) null).request().delete(ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); } @Test public void testTask() throws IOException { final int corruptSessionId = ApexEditorRestResource.createCorruptSession(); - ApexAPIResult result = target("editor/-1/Session/Create").request().get(ApexAPIResult.class); - assertEquals(RESULT.SUCCESS, result.getResult()); + ApexApiResult result = target("editor/-1/Session/Create").request().get(ApexApiResult.class); + assertEquals(Result.SUCCESS, result.getResult()); final int sessionId = new Integer(result.getMessages().get(0)); - result = target("editor/-12345/Validate/Task").request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + result = target("editor/-12345/Validate/Task").request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); - result = target("editor/" + sessionId + "/Validate/Task").request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + result = target("editor/" + sessionId + "/Validate/Task").request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); try { - target("editor/" + corruptSessionId + "/Validate/Task").request().get(ApexAPIResult.class); + target("editor/" + corruptSessionId + "/Validate/Task").request().get(ApexApiResult.class); } catch (final Exception e) { assertEquals("HTTP 500 Request failed.", e.getMessage()); } result = target("editor/" + sessionId + "/Validate/Task").queryParam("name", (String) null) - .queryParam("version", (String) null).request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + .queryParam("version", (String) null).request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = target("editor/" + sessionId + "/Validate/Task").queryParam("name", "%%%$£") - .queryParam("version", (String) null).request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + .queryParam("version", (String) null).request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); final String modelString = TextFileUtils.getTextFileAsString("src/test/resources/models/PolicyModel.json"); Entity<String> modelEntity = Entity.entity("Somewhere over the rainbow", MediaType.APPLICATION_JSON); - result = target("editor/" + -12345 + "/Model/Load").request().put(modelEntity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); - result = target("editor/" + 12345 + "/Model/Load").request().put(modelEntity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); - result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + result = target("editor/" + -12345 + "/Model/Load").request().put(modelEntity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); + result = target("editor/" + 12345 + "/Model/Load").request().put(modelEntity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); modelEntity = Entity.entity("", MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); modelEntity = Entity.entity(modelString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = target("editor/" + sessionId + "/Event/Get").queryParam("name", (String) null) - .queryParam("version", (String) null).request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + .queryParam("version", (String) null).request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); String entityString = "{" + "\"name\" : \"Hello\"," + "\"version\" : \"0.0.2\"," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\"," + "\"description\" : \"A description of hello\"" + "}"; Entity<String> entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/-12345/Task/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); - result = target("editor/1234545/Task/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); - result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); - result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.CONCEPT_EXISTS, result.getResult()); + result = target("editor/-12345/Task/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); + result = target("editor/1234545/Task/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); + result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult()); try { - target("editor/" + corruptSessionId + "/Task/Create").request().post(entity, ApexAPIResult.class); + target("editor/" + corruptSessionId + "/Task/Create").request().post(entity, ApexApiResult.class); } catch (final Exception e) { assertEquals("HTTP 500 Request failed.", e.getMessage()); } @@ -724,8 +724,8 @@ public class TestApexEditorRestResource extends JerseyTest { + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); entityString = "{" + "\"name\" : \"HowsItGoing\"," + "\"version\" : \"0.0.2\"," + "\"inputFields\" : {\"IField0\" : {\"name\" : \"StringType\", \"version\" : \"0.0.1\", " @@ -733,16 +733,16 @@ public class TestApexEditorRestResource extends JerseyTest { + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); entityString = "{" + "\"name\" : \"Hi\"," + "\"version\" : \"0.0.2\"," + "\"inputFields\" : {\"IField0\" : null}," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); entityString = "{" + "\"name\" : \"GoodDay\"," + "\"version\" : \"0.0.2\"," + "\"inputFields\" : {\"IField0\" : {\"name\" : \"NonExistantType\", \"version\" : \"0.0.1\", " @@ -750,8 +750,8 @@ public class TestApexEditorRestResource extends JerseyTest { + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, result.getResult()); + result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); entityString = "{" + "\"name\" : \"Howdy\"," + "\"version\" : \"0.0.2\"," + "\"inputFields\" : {\"IField0\" : {\"name\" : \"NonExistantType\", \"version\" : \"0.0.1\", " @@ -759,8 +759,8 @@ public class TestApexEditorRestResource extends JerseyTest { + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); entityString = "{" + "\"name\" : \"HowsItGoing2\"," + "\"version\" : \"0.0.2\"," + "\"outputFields\" : {\"OField0\" : {\"name\" : \"StringType\", \"version\" : \"0.0.1\", " @@ -768,16 +768,16 @@ public class TestApexEditorRestResource extends JerseyTest { + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); entityString = "{" + "\"name\" : \"Hi2\"," + "\"version\" : \"0.0.2\"," + "\"outputFields\" : {\"OField0\" : null}," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); entityString = "{" + "\"name\" : \"GoodDay2\"," + "\"version\" : \"0.0.2\"," + "\"outputFields\" : {\"OField0\" : {\"name\" : \"NonExistantType\", \"version\" : \"0.0.1\"," @@ -785,8 +785,8 @@ public class TestApexEditorRestResource extends JerseyTest { + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, result.getResult()); + result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); entityString = "{" + "\"name\" : \"Howdy2\"," + "\"version\" : \"0.0.2\"," + "\"outputFields\" : {\"OField0\" : {\"name\" : \"NonExistantType\", \"version\" : \"0.0.1\", " @@ -794,23 +794,23 @@ public class TestApexEditorRestResource extends JerseyTest { + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); entityString = "{" + "\"name\" : \"HowsItGoing3\"," + "\"version\" : \"0.0.2\"," + "\"taskLogic\" : {\"logicFlavour\" : \"LemonAndLime\", \"logic\" : \"lots of lemons," + " lots of lime\"}," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); entityString = "{" + "\"name\" : \"Hi3\"," + "\"version\" : \"0.0.2\"," + "\"taskLogic\" : null," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); entityString = "{" + "\"name\" : \"GoodDay3\"," + "\"version\" : \"0.0.2\"," + "\"namespace\" : \"somewhere.over.the.rainbow\"," + "\"source\" : \"beginning\"," @@ -819,16 +819,16 @@ public class TestApexEditorRestResource extends JerseyTest { + " lots of lime\"}," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); entityString = "{" + "\"name\" : \"Howdy3\"," + "\"version\" : \"0.0.2\"," + "\"taskLogic\" : {\"logicFlavour\" : \"LemonAndLime\", \"logic\" : null}," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); entityString = "{" + "\"name\" : \"HowsItGoing4\"," + "\"version\" : \"0.0.2\"," + "\"parameters\" : {\"Par0\" : {\"parameterName\" : \"Par0\", " @@ -836,16 +836,16 @@ public class TestApexEditorRestResource extends JerseyTest { + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); entityString = "{" + "\"name\" : \"Hi4\"," + "\"version\" : \"0.0.2\"," + "\"parameters\" : {\"Par0\" : null}," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); entityString = "{" + "\"name\" : \"GoodDay4\"," + "\"version\" : \"0.0.2\"," + "\"parameters\" : {\"Par0\" : {\"parameterName\" : \"NotPar0\", \"defaultValue\" : " @@ -853,61 +853,61 @@ public class TestApexEditorRestResource extends JerseyTest { + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); entityString = "{" + "\"name\" : \"Howdy4\"," + "\"version\" : \"0.0.2\"," + "\"parameters\" : {\"Par0\" : {\"parameterName\" : \"MyParameter\", \"defaultValue\" : null}}," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); entityString = "{" + "\"name\" : \"HowsItGoing5\"," + "\"version\" : \"0.0.2\"," + "\"contexts\" : [{\"name\" : \"contextAlbum0\", \"version\" : \"0.0.1\"}]," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); entityString = "{" + "\"name\" : \"Hi5\"," + "\"version\" : \"0.0.2\"," + "\"contexts\" : []," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); entityString = "{" + "\"name\" : \"GoodDay5\"," + "\"version\" : \"0.0.2\"," + "\"contexts\" : [{\"name\" : \"NonExistantType\", \"version\" : \"0.0.1\"}]," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); entityString = "{" + "\"name\" : \"Howdy5\"," + "\"version\" : \"0.0.2\"," + "\"contexts\" : [{\"name\" : null, \"version\" : \"0.0.1\"}]," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); entityString = "{" + "\"name\" : \"Hello\"," + "\"version\" : \"0.0.2\"," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/-12345/Task/Update").request().put(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); - result = target("editor/1234545/Task/Update").request().put(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); - result = target("editor/" + sessionId + "/Task/Update").request().put(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + result = target("editor/-12345/Task/Update").request().put(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); + result = target("editor/1234545/Task/Update").request().put(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/Task/Update").request().put(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); try { - target("editor/" + corruptSessionId + "/Task/Update").request().put(entity, ApexAPIResult.class); + target("editor/" + corruptSessionId + "/Task/Update").request().put(entity, ApexApiResult.class); } catch (final Exception e) { assertEquals("HTTP 500 Request failed.", e.getMessage()); } @@ -916,116 +916,116 @@ public class TestApexEditorRestResource extends JerseyTest { + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Task/Update").request().put(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/Task/Update").request().put(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); entityString = "{" + "\"name\" : \"NonExistantEvent\"," + "\"version\" : \"0.0.2\"," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Task/Update").request().put(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, result.getResult()); + result = target("editor/" + sessionId + "/Task/Update").request().put(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = target("editor/" + sessionId + "/Task/Get").queryParam("name", "Hello") - .queryParam("version", (String) null).request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + .queryParam("version", (String) null).request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = target("editor/" + sessionId + "/Task/Get").queryParam("name", (String) null) - .queryParam("version", (String) null).request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + .queryParam("version", (String) null).request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = target("editor/" + sessionId + "/Task/Get").queryParam("name", "IDontExist") - .queryParam("version", (String) null).request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, result.getResult()); + .queryParam("version", (String) null).request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = target("editor/-123345/Task/Get").queryParam("name", (String) null) - .queryParam("version", (String) null).request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + .queryParam("version", (String) null).request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = target("editor/123345/Task/Get").queryParam("name", (String) null).queryParam("version", (String) null) - .request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + .request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); try { target("editor/" + corruptSessionId + "/Task/Get").queryParam("name", "Hello") - .queryParam("version", (String) null).request().get(ApexAPIResult.class); + .queryParam("version", (String) null).request().get(ApexApiResult.class); } catch (final Exception e) { assertEquals("HTTP 500 Request failed.", e.getMessage()); } result = target("editor/" + sessionId + "/Validate/Event").queryParam("name", (String) null) - .queryParam("version", (String) null).request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + .queryParam("version", (String) null).request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = target("editor/-12345/Validate/Event").queryParam("name", (String) null) - .queryParam("version", (String) null).request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + .queryParam("version", (String) null).request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = target("editor/12345/Validate/Event").queryParam("name", (String) null) - .queryParam("version", (String) null).request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + .queryParam("version", (String) null).request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); try { target("editor/" + corruptSessionId + "/Task/Delete").queryParam("name", (String) null) - .queryParam("version", (String) null).request().delete(ApexAPIResult.class); + .queryParam("version", (String) null).request().delete(ApexApiResult.class); } catch (final Exception e) { assertEquals("HTTP 500 Request failed.", e.getMessage()); } result = target("editor/-123345/Task/Delete").queryParam("name", (String) null) - .queryParam("version", (String) null).request().delete(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + .queryParam("version", (String) null).request().delete(ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = target("editor/123345/Task/Delete").queryParam("name", (String) null) - .queryParam("version", (String) null).request().delete(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + .queryParam("version", (String) null).request().delete(ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = target("editor/" + sessionId + "/Task/Delete").queryParam("name", "Hello") - .queryParam("version", "0.0.2").request().delete(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + .queryParam("version", "0.0.2").request().delete(ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = target("editor/" + sessionId + "/Task/Delete").queryParam("name", (String) null) - .queryParam("version", (String) null).request().delete(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + .queryParam("version", (String) null).request().delete(ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); } @Test public void testPolicy() throws IOException { final int corruptSessionId = ApexEditorRestResource.createCorruptSession(); - ApexAPIResult result = target("editor/-1/Session/Create").request().get(ApexAPIResult.class); - assertEquals(RESULT.SUCCESS, result.getResult()); + ApexApiResult result = target("editor/-1/Session/Create").request().get(ApexApiResult.class); + assertEquals(Result.SUCCESS, result.getResult()); final int sessionId = new Integer(result.getMessages().get(0)); - result = target("editor/-12345/Model/Validate").request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + result = target("editor/-12345/Model/Validate").request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); - result = target("editor/" + sessionId + "/Model/Validate").request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/Model/Validate").request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); try { - target("editor/" + corruptSessionId + "/Model/Validate").request().get(ApexAPIResult.class); + target("editor/" + corruptSessionId + "/Model/Validate").request().get(ApexApiResult.class); } catch (final Exception e) { assertEquals("HTTP 500 Request failed.", e.getMessage()); } result = target("editor/" + sessionId + "/Model/Validate").queryParam("name", (String) null) - .queryParam("version", (String) null).request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + .queryParam("version", (String) null).request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = target("editor/" + sessionId + "/Model/Validate").queryParam("name", "%%%$£") - .queryParam("version", (String) null).request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + .queryParam("version", (String) null).request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); final String modelString = TextFileUtils.getTextFileAsString("src/test/resources/models/PolicyModel.json"); Entity<String> modelEntity = Entity.entity("Somewhere over the rainbow", MediaType.APPLICATION_JSON); - result = target("editor/" + -12345 + "/Model/Load").request().put(modelEntity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); - result = target("editor/" + 12345 + "/Model/Load").request().put(modelEntity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); - result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + result = target("editor/" + -12345 + "/Model/Load").request().put(modelEntity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); + result = target("editor/" + 12345 + "/Model/Load").request().put(modelEntity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); modelEntity = Entity.entity("", MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); modelEntity = Entity.entity(modelString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = target("editor/" + sessionId + "/Event/Get").queryParam("name", (String) null) - .queryParam("version", (String) null).request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + .queryParam("version", (String) null).request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); String entityString = "{" + "\"name\" : \"Hello\"," + "\"version\" : \"0.0.2\"," + "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\"," @@ -1040,17 +1040,17 @@ public class TestApexEditorRestResource extends JerseyTest { + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\"," + "\"description\" : \"A description of hello\"" + "}"; Entity<String> entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/-12345/Policy/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); - result = target("editor/1234545/Policy/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); - result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); - result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.CONCEPT_EXISTS, result.getResult()); + result = target("editor/-12345/Policy/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); + result = target("editor/1234545/Policy/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); + result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult()); try { - target("editor/" + corruptSessionId + "/Policy/Create").request().post(entity, ApexAPIResult.class); + target("editor/" + corruptSessionId + "/Policy/Create").request().post(entity, ApexApiResult.class); } catch (final Exception e) { assertEquals("HTTP 500 Request failed.", e.getMessage()); } @@ -1060,8 +1060,8 @@ public class TestApexEditorRestResource extends JerseyTest { + "\"states\" : null," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); entityString = "{" + "\"name\" : \"HelloAnother\"," + "\"version\" : \"0.0.2\"," + "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\"," @@ -1076,8 +1076,8 @@ public class TestApexEditorRestResource extends JerseyTest { + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); entityString = "{" + "\"name\" : \"Hello2\"," + "\"version\" : \"0.0.2\"," + "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\"," @@ -1092,8 +1092,8 @@ public class TestApexEditorRestResource extends JerseyTest { + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); entityString = "{" + "\"name\" : \"Hello3\"," + "\"version\" : \"0.0.2\"," + "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\"," @@ -1107,8 +1107,8 @@ public class TestApexEditorRestResource extends JerseyTest { + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); entityString = "{" + "\"name\" : \"Hello4\"," + "\"version\" : \"0.0.2\"," + "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\"," @@ -1121,8 +1121,8 @@ public class TestApexEditorRestResource extends JerseyTest { + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); entityString = "{" + "\"name\" : \"Hello5\"," + "\"version\" : \"0.0.2\"," + "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\"," @@ -1135,8 +1135,8 @@ public class TestApexEditorRestResource extends JerseyTest { + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); entityString = "{" + "\"name\" : \"Hello6\"," + "\"version\" : \"0.0.2\"," + "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\"," @@ -1151,8 +1151,8 @@ public class TestApexEditorRestResource extends JerseyTest { + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, result.getResult()); + result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); entityString = "{" + "\"name\" : \"Hello7\"," + "\"version\" : \"0.0.2\"," + "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\"," @@ -1160,8 +1160,8 @@ public class TestApexEditorRestResource extends JerseyTest { + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); entityString = "{" + "\"name\" : \"Hello8\"," + "\"version\" : \"0.0.2\"," + "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\"," @@ -1176,8 +1176,8 @@ public class TestApexEditorRestResource extends JerseyTest { + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, result.getResult()); + result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); entityString = "{" + "\"name\" : \"Hello9\"," + "\"version\" : \"0.0.2\"," + "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\"," @@ -1191,9 +1191,9 @@ public class TestApexEditorRestResource extends JerseyTest { + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexAPIResult.class); + result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexApiResult.class); System.err.println(result); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); entityString = "{" + "\"name\" : \"Hello10\"," + "\"version\" : \"0.0.2\"," + "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\"," @@ -1209,8 +1209,8 @@ public class TestApexEditorRestResource extends JerseyTest { + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, result.getResult()); + result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); entityString = "{" + "\"name\" : \"Hello11\"," + "\"version\" : \"0.0.2\"," + "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\"," @@ -1225,8 +1225,8 @@ public class TestApexEditorRestResource extends JerseyTest { + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); entityString = "{" + "\"name\" : \"Hello12\"," + "\"version\" : \"0.0.2\"," + "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\"," @@ -1244,8 +1244,8 @@ public class TestApexEditorRestResource extends JerseyTest { + " }" + "}," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); entityString = "{" + "\"name\" : \"Hello13\"," + "\"version\" : \"0.0.2\"," + "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\"," @@ -1263,8 +1263,8 @@ public class TestApexEditorRestResource extends JerseyTest { + " }" + "}," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); entityString = "{" + "\"name\" : \"Hello14\"," + "\"version\" : \"0.0.2\"," + "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\"," @@ -1284,8 +1284,8 @@ public class TestApexEditorRestResource extends JerseyTest { + " }" + "}," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); entityString = "{" + "\"name\" : \"Hello15\"," + "\"version\" : \"0.0.2\"," + "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\"," @@ -1305,8 +1305,8 @@ public class TestApexEditorRestResource extends JerseyTest { + " }" + "}," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, result.getResult()); + result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); entityString = "{" + "\"name\" : \"Hello16\"," + "\"version\" : \"0.0.2\"," + "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\"," @@ -1325,8 +1325,8 @@ public class TestApexEditorRestResource extends JerseyTest { + " }" + "}," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); entityString = "{" + "\"name\" : \"Hello17\"," + "\"version\" : \"0.0.2\"," + "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\"," @@ -1349,8 +1349,8 @@ public class TestApexEditorRestResource extends JerseyTest { + " }" + " }" + "}," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); entityString = "{" + "\"name\" : \"Hello18\"," + "\"version\" : \"0.0.2\"," + "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\"," @@ -1371,8 +1371,8 @@ public class TestApexEditorRestResource extends JerseyTest { + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); entityString = "{" + "\"name\" : \"Hello19\"," + "\"version\" : \"0.0.2\"," + "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\"," @@ -1394,8 +1394,8 @@ public class TestApexEditorRestResource extends JerseyTest { + "}," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); entityString = "{" + "\"name\" : \"HelloAnother\"," + "\"version\" : \"0.0.2\"," + "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\"," @@ -1410,19 +1410,19 @@ public class TestApexEditorRestResource extends JerseyTest { + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\"," + "\"description\" : \"A better description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/-12345/Policy/Update").request().put(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); - result = target("editor/1234545/Policy/Update").request().put(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); - result = target("editor/" + sessionId + "/Policy/Update").request().put(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + result = target("editor/-12345/Policy/Update").request().put(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); + result = target("editor/1234545/Policy/Update").request().put(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/Policy/Update").request().put(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = target("editor/" + sessionId + "/Policy/Update").queryParam("firstStatePeriodic", "true").request() - .put(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + .put(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); try { - target("editor/" + corruptSessionId + "/Policy/Update").request().put(entity, ApexAPIResult.class); + target("editor/" + corruptSessionId + "/Policy/Update").request().put(entity, ApexApiResult.class); } catch (final Exception e) { assertEquals("HTTP 500 Request failed.", e.getMessage()); } @@ -1440,8 +1440,8 @@ public class TestApexEditorRestResource extends JerseyTest { + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\"," + "\"description\" : \"A better description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Policy/Update").request().put(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + result = target("editor/" + sessionId + "/Policy/Update").request().put(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); entityString = "{" + "\"name\" : \"IDontExist\"," + "\"version\" : \"0.0.2\"," + "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\"," @@ -1456,60 +1456,60 @@ public class TestApexEditorRestResource extends JerseyTest { + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\"," + "\"description\" : \"A better description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); - result = target("editor/" + sessionId + "/Policy/Update").request().put(entity, ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, result.getResult()); + result = target("editor/" + sessionId + "/Policy/Update").request().put(entity, ApexApiResult.class); + assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = target("editor/" + sessionId + "/Policy/Get").queryParam("name", "Hello") - .queryParam("version", (String) null).request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + .queryParam("version", (String) null).request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = target("editor/" + sessionId + "/Policy/Get").queryParam("name", "IDontExist") - .queryParam("version", (String) null).request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, result.getResult()); + .queryParam("version", (String) null).request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = target("editor/" + sessionId + "/Policy/Get").queryParam("name", (String) null) - .queryParam("version", (String) null).request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + .queryParam("version", (String) null).request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = target("editor/-123345/Policy/Get").queryParam("name", (String) null) - .queryParam("version", (String) null).request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + .queryParam("version", (String) null).request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = target("editor/123345/Policy/Get").queryParam("name", (String) null) - .queryParam("version", (String) null).request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + .queryParam("version", (String) null).request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); try { target("editor/" + corruptSessionId + "/Policy/Get").queryParam("name", "Hello") - .queryParam("version", (String) null).request().get(ApexAPIResult.class); + .queryParam("version", (String) null).request().get(ApexApiResult.class); } catch (final Exception e) { assertEquals("HTTP 500 Request failed.", e.getMessage()); } result = target("editor/" + sessionId + "/Validate/Event").queryParam("name", (String) null) - .queryParam("version", (String) null).request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + .queryParam("version", (String) null).request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = target("editor/-12345/Validate/Event").queryParam("name", (String) null) - .queryParam("version", (String) null).request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + .queryParam("version", (String) null).request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = target("editor/12345/Validate/Event").queryParam("name", (String) null) - .queryParam("version", (String) null).request().get(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + .queryParam("version", (String) null).request().get(ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); try { target("editor/" + corruptSessionId + "/Policy/Delete").queryParam("name", (String) null) - .queryParam("version", (String) null).request().delete(ApexAPIResult.class); + .queryParam("version", (String) null).request().delete(ApexApiResult.class); } catch (final Exception e) { assertEquals("HTTP 500 Request failed.", e.getMessage()); } result = target("editor/-123345/Policy/Delete").queryParam("name", (String) null) - .queryParam("version", (String) null).request().delete(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + .queryParam("version", (String) null).request().delete(ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = target("editor/123345/Policy/Delete").queryParam("name", (String) null) - .queryParam("version", (String) null).request().delete(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + .queryParam("version", (String) null).request().delete(ApexApiResult.class); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = target("editor/" + sessionId + "/Policy/Delete").queryParam("name", "Hello") - .queryParam("version", "0.0.2").request().delete(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + .queryParam("version", "0.0.2").request().delete(ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = target("editor/" + sessionId + "/Policy/Delete").queryParam("name", (String) null) - .queryParam("version", (String) null).request().delete(ApexAPIResult.class); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + .queryParam("version", (String) null).request().delete(ApexApiResult.class); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); } } diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/ContextAlbumImpl.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/ContextAlbumImpl.java index 305f14c8d..0f991ba36 100644 --- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/ContextAlbumImpl.java +++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/ContextAlbumImpl.java @@ -424,7 +424,7 @@ public final class ContextAlbumImpl implements ContextAlbum { } // Sanity check on incoming context - Assertions.argumentNotNull(incomingContextAlbum, ContextRuntimeException.class, + Assertions.argumentOfClassNotNull(incomingContextAlbum, ContextRuntimeException.class, "cannot update context, context album is null"); // Iterate over the incoming context diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/DistributorFactory.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/DistributorFactory.java index dba81d321..55df01b40 100644 --- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/DistributorFactory.java +++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/DistributorFactory.java @@ -49,7 +49,7 @@ public class DistributorFactory { public Distributor getDistributor(final AxArtifactKey key) throws ContextException { LOGGER.entry("Distributor factory, key=" + key); - Assertions.argumentNotNull(key, ContextException.class, "Parameter \"key\" may not be null"); + Assertions.argumentOfClassNotNull(key, ContextException.class, "Parameter \"key\" may not be null"); // Get the class for the distributor using reflection final DistributorParameters distributorParameters = ParameterService diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/jvmlocal/JVMLocalDistributor.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/jvmlocal/JvmLocalDistributor.java index cb9a77883..701c59342 100644 --- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/jvmlocal/JVMLocalDistributor.java +++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/jvmlocal/JvmLocalDistributor.java @@ -34,14 +34,14 @@ import org.slf4j.ext.XLoggerFactory; * * @author Liam Fallon (liam.fallon@ericsson.com) */ -public class JVMLocalDistributor extends AbstractDistributor { +public class JvmLocalDistributor extends AbstractDistributor { // Logger for this class - private static final XLogger LOGGER = XLoggerFactory.getXLogger(JVMLocalDistributor.class); + private static final XLogger LOGGER = XLoggerFactory.getXLogger(JvmLocalDistributor.class); /** * Create an instance of a JVM Local Context Distributor. */ - public JVMLocalDistributor() { + public JvmLocalDistributor() { super(); } diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/locking/LockManagerFactory.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/locking/LockManagerFactory.java index c45e3bd27..3e9120672 100644 --- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/locking/LockManagerFactory.java +++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/locking/LockManagerFactory.java @@ -66,8 +66,8 @@ public class LockManagerFactory { // Check the class is a lock manager if (!(lockManagerObject instanceof LockManager)) { - LOGGER.error("Specified Apex context lock manager plugin class \"{}\" does not implement the LockManager interface", - pluginClass); + LOGGER.error("Specified Apex context lock manager plugin class \"{}\" " + + "does not implement the LockManager interface", pluginClass); throw new ContextException("Specified Apex context lock manager plugin class \"" + pluginClass + "\" does not implement the LockManager interface"); } diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/locking/jvmlocal/JVMLocalLockManager.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/locking/jvmlocal/JvmLocalLockManager.java index 5e71557b8..721aa7f3c 100644 --- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/locking/jvmlocal/JVMLocalLockManager.java +++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/locking/jvmlocal/JvmLocalLockManager.java @@ -32,7 +32,7 @@ import org.onap.policy.apex.context.impl.locking.AbstractLockManager; * * @author Liam Fallon (liam.fallon@ericsson.com) */ -public class JVMLocalLockManager extends AbstractLockManager { +public class JvmLocalLockManager extends AbstractLockManager { /* * (non-Javadoc) * diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/persistence/PersistorFactory.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/persistence/PersistorFactory.java index 34fa15dcb..60de80a7f 100644 --- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/persistence/PersistorFactory.java +++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/persistence/PersistorFactory.java @@ -48,7 +48,7 @@ public class PersistorFactory { */ public Persistor createPersistor(final AxArtifactKey key) throws ContextException { LOGGER.entry("persistor factory, key=" + key); - Assertions.argumentNotNull(key, ContextException.class, "Parameter \"key\" may not be null"); + Assertions.argumentOfClassNotNull(key, ContextException.class, "Parameter \"key\" may not be null"); final PersistorParameters persistorParameters = ParameterService .get(ContextParameterConstants.PERSISTENCE_GROUP_NAME); @@ -67,8 +67,8 @@ public class PersistorFactory { // Check the class is a persistor if (!(persistorObject instanceof Persistor)) { - LOGGER.error("Specified Apex context persistor plugin class \"{}\" does not implement the ContextDistributor interface", - pluginClass); + LOGGER.error("Specified Apex context persistor plugin class \"{}\" " + + "does not implement the ContextDistributor interface", pluginClass); throw new ContextException("Specified Apex context persistor plugin class \"" + pluginClass + "\" does not implement the ContextDistributor interface"); } diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/AbstractSchemaHelper.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/AbstractSchemaHelper.java index 5513cc7e6..bb22827cd 100644 --- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/AbstractSchemaHelper.java +++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/AbstractSchemaHelper.java @@ -32,8 +32,8 @@ import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; /** - * This class implements the {@link SchemaHelper} functionality that is common across all - * implementations. Schema helpers for specific schema mechanisms specialize this class. + * This class implements the {@link SchemaHelper} functionality that is common across all implementations. Schema + * helpers for specific schema mechanisms specialize this class. * * @author Liam Fallon (liam.fallon@ericsson.com) */ @@ -62,14 +62,15 @@ public abstract class AbstractSchemaHelper implements SchemaHelper { /* * (non-Javadoc) * - * @see - * org.onap.policy.apex.context.SchemaHelper#init(org.onap.policy.apex.model.basicmodel.concepts - * .AxKey, org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema) + * @see org.onap.policy.apex.context.SchemaHelper#init(org.onap.policy.apex.model.basicmodel.concepts .AxKey, + * org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema) */ @Override public void init(final AxKey incomingUserKey, final AxContextSchema incomingSchema) throws ContextRuntimeException { - Assertions.argumentNotNull(incomingUserKey, ContextRuntimeException.class, "incomingUserKey may not be null"); - Assertions.argumentNotNull(incomingSchema, ContextRuntimeException.class, "incomingSchema may not be null"); + Assertions.argumentOfClassNotNull(incomingUserKey, ContextRuntimeException.class, + "incomingUserKey may not be null"); + Assertions.argumentOfClassNotNull(incomingSchema, ContextRuntimeException.class, + "incomingSchema may not be null"); this.userKey = incomingUserKey; this.schema = incomingSchema; @@ -123,8 +124,8 @@ public abstract class AbstractSchemaHelper implements SchemaHelper { @Override public Object createNewInstance() { if (schemaClass == null) { - final String returnString = - userKey.getId() + ": could not create an instance, schema class for the schema is null"; + final String returnString = userKey.getId() + + ": could not create an instance, schema class for the schema is null"; LOGGER.warn(returnString); throw new ContextRuntimeException(returnString); } @@ -132,9 +133,9 @@ public abstract class AbstractSchemaHelper implements SchemaHelper { try { return schemaClass.newInstance(); } catch (final Exception e) { - final String returnString = - userKey.getId() + ": could not create an instance of class \"" + schemaClass.getCanonicalName() - + "\" using the default constructor \"" + schemaClass.getSimpleName() + "()\""; + final String returnString = userKey.getId() + ": could not create an instance of class \"" + + schemaClass.getCanonicalName() + "\" using the default constructor \"" + + schemaClass.getSimpleName() + "()\""; LOGGER.warn(returnString, e); throw new ContextRuntimeException(returnString, e); } @@ -148,8 +149,8 @@ public abstract class AbstractSchemaHelper implements SchemaHelper { @Override public Object createNewInstance(final String stringValue) { if (schemaClass == null) { - final String returnString = - userKey.getId() + ": could not create an instance, schema class for the schema is null"; + final String returnString = userKey.getId() + + ": could not create an instance, schema class for the schema is null"; LOGGER.warn(returnString); throw new ContextRuntimeException(returnString); } @@ -161,9 +162,9 @@ public abstract class AbstractSchemaHelper implements SchemaHelper { // Invoke the constructor return stringConstructor.newInstance(stringValue); } catch (final Exception e) { - final String returnString = - userKey.getId() + ": could not create an instance of class \"" + schemaClass.getCanonicalName() - + "\" using the string constructor \"" + schemaClass.getSimpleName() + "(String)\""; + final String returnString = userKey.getId() + ": could not create an instance of class \"" + + schemaClass.getCanonicalName() + "\" using the string constructor \"" + + schemaClass.getSimpleName() + "(String)\""; LOGGER.warn(returnString, e); throw new ContextRuntimeException(returnString); } diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/SchemaHelperFactory.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/SchemaHelperFactory.java index c6120c783..efc89b50d 100644 --- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/SchemaHelperFactory.java +++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/SchemaHelperFactory.java @@ -54,15 +54,16 @@ public class SchemaHelperFactory { */ public SchemaHelper createSchemaHelper(final AxKey owningEntityKey, final AxArtifactKey schemaKey) { LOGGER.entry("schema helper factory, owningEntityKey=" + owningEntityKey); - Assertions.argumentNotNull(owningEntityKey, ContextRuntimeException.class, - "Parameter \"owningEntityKey\" may not be null"); - Assertions.argumentNotNull(schemaKey, ContextRuntimeException.class, "Parameter \"schemaKey\" may not be null"); + Assertions.argumentOfClassNotNull(owningEntityKey, ContextRuntimeException.class, + "Parameter \"owningEntityKey\" may not be null"); + Assertions.argumentOfClassNotNull(schemaKey, ContextRuntimeException.class, + "Parameter \"schemaKey\" may not be null"); // Get the schema for items in the album final AxContextSchema schema = ModelService.getModel(AxContextSchemas.class).get(schemaKey); if (schema == null) { - final String resultString = - "schema \"" + schemaKey.getId() + "\" for entity " + owningEntityKey.getId() + " does not exist"; + final String resultString = "schema \"" + schemaKey.getId() + "\" for entity " + owningEntityKey.getId() + + " does not exist"; LOGGER.warn(resultString); throw new ContextRuntimeException(resultString); } @@ -71,11 +72,11 @@ public class SchemaHelperFactory { final SchemaParameters schemaParameters = ParameterService.get(ContextParameterConstants.SCHEMA_GROUP_NAME); // Get the class for the schema helper from the schema parameters - final SchemaHelperParameters schemaHelperParameters = - schemaParameters.getSchemaHelperParameters(schema.getSchemaFlavour()); + final SchemaHelperParameters schemaHelperParameters = schemaParameters + .getSchemaHelperParameters(schema.getSchemaFlavour()); if (schemaHelperParameters == null) { final String resultString = "context schema helper parameters not found for context schema \"" - + schema.getSchemaFlavour() + "\""; + + schema.getSchemaFlavour() + "\""; LOGGER.warn(resultString); throw new ContextRuntimeException(resultString); } @@ -87,7 +88,7 @@ public class SchemaHelperFactory { schemaHelperObject = Class.forName(pluginClass).newInstance(); } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { final String resultString = "Apex context schema helper class not found for context schema helper plugin \"" - + pluginClass + "\""; + + pluginClass + "\""; LOGGER.warn(resultString, e); throw new ContextRuntimeException(resultString, e); } @@ -95,7 +96,7 @@ public class SchemaHelperFactory { // Check the class is a schema helper if (!(schemaHelperObject instanceof SchemaHelper)) { final String resultString = "Specified Apex context schema helper plugin class \"" + pluginClass - + "\" does not implement the SchemaHelper interface"; + + "\" does not implement the SchemaHelper interface"; LOGGER.warn(resultString); throw new ContextRuntimeException(resultString); } @@ -107,7 +108,7 @@ public class SchemaHelperFactory { schemaHelper.init(owningEntityKey.getKey(), schema); LOGGER.exit("Schema Helper factory, owningEntityKey=" + owningEntityKey + ", selected schema helper of class " - + schemaHelper.getClass()); + + schemaHelper.getClass()); return schemaHelper; } } diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/DistributorParameters.java b/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/DistributorParameters.java index e3f58cae4..79310a0e2 100644 --- a/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/DistributorParameters.java +++ b/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/DistributorParameters.java @@ -20,7 +20,7 @@ package org.onap.policy.apex.context.parameters; -import org.onap.policy.apex.context.impl.distribution.jvmlocal.JVMLocalDistributor; +import org.onap.policy.apex.context.impl.distribution.jvmlocal.JvmLocalDistributor; import org.onap.policy.common.parameters.GroupValidationResult; import org.onap.policy.common.parameters.ParameterGroup; @@ -33,7 +33,7 @@ import org.onap.policy.common.parameters.ParameterGroup; */ public class DistributorParameters implements ParameterGroup { /** The default distributor makes context albums available to all threads in a single JVM. */ - public static final String DEFAULT_DISTRIBUTOR_PLUGIN_CLASS = JVMLocalDistributor.class.getCanonicalName(); + public static final String DEFAULT_DISTRIBUTOR_PLUGIN_CLASS = JvmLocalDistributor.class.getCanonicalName(); private String name; private String pluginClass = DEFAULT_DISTRIBUTOR_PLUGIN_CLASS; diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/LockManagerParameters.java b/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/LockManagerParameters.java index 27fc05a0b..ed23af1b6 100644 --- a/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/LockManagerParameters.java +++ b/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/LockManagerParameters.java @@ -20,7 +20,7 @@ package org.onap.policy.apex.context.parameters; -import org.onap.policy.apex.context.impl.locking.jvmlocal.JVMLocalLockManager; +import org.onap.policy.apex.context.impl.locking.jvmlocal.JvmLocalLockManager; import org.onap.policy.common.parameters.GroupValidationResult; import org.onap.policy.common.parameters.ParameterGroup; @@ -35,7 +35,7 @@ public class LockManagerParameters implements ParameterGroup { /** * The default lock manager can lock context album instance across all threads in a single JVM. */ - public static final String DEFAULT_LOCK_MANAGER_PLUGIN_CLASS = JVMLocalLockManager.class.getCanonicalName(); + public static final String DEFAULT_LOCK_MANAGER_PLUGIN_CLASS = JvmLocalLockManager.class.getCanonicalName(); private String name; private String pluginClass = DEFAULT_LOCK_MANAGER_PLUGIN_CLASS; diff --git a/context/context-management/src/test/java/org/onap/policy/apex/context/impl/ContextAlbumImplTest.java b/context/context-management/src/test/java/org/onap/policy/apex/context/impl/ContextAlbumImplTest.java index 0208b7a9c..25928716e 100644 --- a/context/context-management/src/test/java/org/onap/policy/apex/context/impl/ContextAlbumImplTest.java +++ b/context/context-management/src/test/java/org/onap/policy/apex/context/impl/ContextAlbumImplTest.java @@ -34,7 +34,7 @@ import org.onap.policy.apex.context.ContextAlbum; import org.onap.policy.apex.context.ContextException; import org.onap.policy.apex.context.ContextRuntimeException; import org.onap.policy.apex.context.Distributor; -import org.onap.policy.apex.context.impl.distribution.jvmlocal.JVMLocalDistributor; +import org.onap.policy.apex.context.impl.distribution.jvmlocal.JvmLocalDistributor; import org.onap.policy.apex.context.impl.schema.java.JavaSchemaHelperParameters; import org.onap.policy.apex.context.parameters.ContextParameterConstants; import org.onap.policy.apex.context.parameters.ContextParameters; @@ -57,7 +57,7 @@ public class ContextAlbumImplTest { public static void prepareForTest() { final ContextParameters contextParameters = new ContextParameters(); contextParameters.getLockManagerParameters() - .setPluginClass("org.onap.policy.apex.context.impl.locking.jvmlocal.JVMLocalLockManager"); + .setPluginClass("org.onap.policy.apex.context.impl.locking.jvmlocal.JvmLocalLockManager"); contextParameters.setName(ContextParameterConstants.MAIN_GROUP_NAME); contextParameters.getDistributorParameters().setName(ContextParameterConstants.DISTRIBUTOR_GROUP_NAME); @@ -76,6 +76,9 @@ public class ContextAlbumImplTest { ParameterService.register(schemaParameters); } + /** + * Clear down the test data. + */ @AfterClass public static void cleanUpAfterTest() { ParameterService.deregister(ContextParameterConstants.DISTRIBUTOR_GROUP_NAME); @@ -107,7 +110,7 @@ public class ContextAlbumImplTest { } try { - new ContextAlbumImpl(new AxContextAlbum(), new JVMLocalDistributor(), null); + new ContextAlbumImpl(new AxContextAlbum(), new JvmLocalDistributor(), null); fail("this test should throw an exception"); } catch (IllegalArgumentException e) { assertEquals("Album map may not be null", e.getMessage()); @@ -116,7 +119,7 @@ public class ContextAlbumImplTest { } try { - new ContextAlbumImpl(new AxContextAlbum(), new JVMLocalDistributor(), new LinkedHashMap<String, Object>()); + new ContextAlbumImpl(new AxContextAlbum(), new JvmLocalDistributor(), new LinkedHashMap<String, Object>()); fail("this test should throw an exception"); } catch (ApexRuntimeException e) { assertEquals("Model for org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas " @@ -138,7 +141,7 @@ public class ContextAlbumImplTest { true, AxArtifactKey.getNullKey()); try { - new ContextAlbumImpl(axContextAlbum, new JVMLocalDistributor(), new LinkedHashMap<String, Object>()); + new ContextAlbumImpl(axContextAlbum, new JvmLocalDistributor(), new LinkedHashMap<String, Object>()); fail("this test should throw an exception"); } catch (ContextException e) { assertEquals("could not initiate schema management for context album AxContextAlbum", @@ -146,7 +149,7 @@ public class ContextAlbumImplTest { } axContextAlbum.setItemSchema(simpleStringSchema.getKey()); - Distributor distributor = new JVMLocalDistributor(); + Distributor distributor = new JvmLocalDistributor(); distributor.init(axContextAlbum.getKey()); ContextAlbum album = new ContextAlbumImpl(axContextAlbum, distributor, new LinkedHashMap<String, Object>()); diff --git a/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelperInstanceCreationTest.java b/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelperInstanceCreationTest.java index a71ba3675..800a7011d 100644 --- a/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelperInstanceCreationTest.java +++ b/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelperInstanceCreationTest.java @@ -25,12 +25,10 @@ import static org.junit.Assert.fail; import org.junit.AfterClass; import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; import org.onap.policy.apex.context.SchemaHelper; import org.onap.policy.apex.context.impl.schema.SchemaHelperFactory; import org.onap.policy.apex.context.parameters.ContextParameterConstants; -import org.onap.policy.apex.context.parameters.ContextParameters; import org.onap.policy.apex.context.parameters.SchemaParameters; import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; import org.onap.policy.apex.model.basicmodel.concepts.AxKey; diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateLocaleItem.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateLocaleItem.java index 0c94bcb1d..efad26052 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateLocaleItem.java +++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateLocaleItem.java @@ -107,7 +107,7 @@ public class TestContextDateLocaleItem implements Serializable { * * @return the TZ value */ - public String getTZValue() { + public String getTzValue() { return timeZoneString; } @@ -116,7 +116,7 @@ public class TestContextDateLocaleItem implements Serializable { * * @param tzValue the TZ value */ - public void setTZValue(final String tzValue) { + public void setTzValue(final String tzValue) { this.timeZoneString = TimeZone.getTimeZone(tzValue).getDisplayName(); } @@ -125,7 +125,7 @@ public class TestContextDateLocaleItem implements Serializable { * * @return the dst */ - public boolean getDST() { + public boolean getDst() { return dst; } @@ -134,7 +134,7 @@ public class TestContextDateLocaleItem implements Serializable { * * @param newDst the dst */ - public void setDST(final boolean newDst) { + public void setDst(final boolean newDst) { this.dst = newDst; } @@ -143,7 +143,7 @@ public class TestContextDateLocaleItem implements Serializable { * * @return the UTC offset */ - public int getUTCOffset() { + public int getUtcOffset() { return utcOffset; } @@ -152,7 +152,7 @@ public class TestContextDateLocaleItem implements Serializable { * * @param newUtcOffset the UTC offset */ - public void setUTCOffset(final int newUtcOffset) { + public void setUtcOffset(final int newUtcOffset) { this.utcOffset = newUtcOffset; } diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateTzItem.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateTzItem.java index 7d3ed80d5..7e1e32924 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateTzItem.java +++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateTzItem.java @@ -91,7 +91,7 @@ public class TestContextDateTzItem implements Serializable { * * @return the TZ value */ - public String getTZValue() { + public String getTzValue() { return timeZoneString; } @@ -100,7 +100,7 @@ public class TestContextDateTzItem implements Serializable { * * @param tzValue the TZ value */ - public void setTZValue(final String tzValue) { + public void setTzValue(final String tzValue) { this.timeZoneString = TimeZone.getTimeZone(tzValue).getDisplayName(); } @@ -109,7 +109,7 @@ public class TestContextDateTzItem implements Serializable { * * @return the dst */ - public boolean getDST() { + public boolean getDst() { return dst; } @@ -118,7 +118,7 @@ public class TestContextDateTzItem implements Serializable { * * @param newDst the dst */ - public void setDST(final boolean newDst) { + public void setDst(final boolean newDst) { this.dst = newDst; } diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextInstantiation.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextInstantiation.java index 0fd013da7..084220c2f 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextInstantiation.java +++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextInstantiation.java @@ -190,8 +190,8 @@ public class ContextInstantiation { final AxContextModel externalContextModel = TestContextAlbumFactory.createExternalContextModel(); final TestContextDateTzItem tci9A = new TestContextDateTzItem(tci9); - final TestContextDateLocaleItem tciAA = new TestContextDateLocaleItem(tciA); - final TestExternalContextItem externalContext = getTestExternalContextItem(testDate, tci9A, tciAA); + final TestContextDateLocaleItem tciA_A = new TestContextDateLocaleItem(tciA); + final TestExternalContextItem externalContext = getTestExternalContextItem(testDate, tci9A, tciA_A); final Map<String, Object> valueMap2 = new HashMap<>(); valueMap2.put(EXTERNAL_CONTEXT, externalContext); @@ -226,7 +226,7 @@ public class ContextInstantiation { assertEquals(tci9A.getDateValue().getTime(), externalContextItem.getTestExternalContextItem009().getDateValue().getTime()); - assertEquals(tciAA.getDateValue().getTime(), + assertEquals(tciA_A.getDateValue().getTime(), externalContextItem.getTestExternalContextItem00A().getDateValue().getTime()); assertEquals(TEST_TREE_SET, externalContextItem.getTestExternalContextItem00B().getSetValue()); assertEquals(TEST_HASH_MAP, externalContextItem.getTestExternalContextItem00C().getMapValue()); @@ -275,7 +275,7 @@ public class ContextInstantiation { assertEquals("album \"ExternalContextAlbum:0.0.1\" null values are illegal on key " + "\"TestExternalContextItem00A\" for put()", e.getMessage()); } - assertEquals(tciAA, externalContextItem.getTestExternalContextItem00A()); + assertEquals(tciA_A, externalContextItem.getTestExternalContextItem00A()); // Should return the hash set assertEquals(TEST_TREE_SET, externalContextItem.getTestExternalContextItem00B().getSetValue()); @@ -471,9 +471,9 @@ public class ContextInstantiation { private TestContextDateLocaleItem getTestContextDateLocaleItem(final Date testDate) { final TestContextDateLocaleItem tciA = new TestContextDateLocaleItem(); tciA.setDateValue(new TestContextDateItem(testDate)); - tciA.setTZValue(TIME_ZONE.getDisplayName()); - tciA.setDST(true); - tciA.setUTCOffset(-600); + tciA.setTzValue(TIME_ZONE.getDisplayName()); + tciA.setDst(true); + tciA.setUtcOffset(-600); tciA.setLocale(Locale.ENGLISH); return tciA; } @@ -481,13 +481,13 @@ public class ContextInstantiation { private TestContextDateTzItem getTestContextDateTzItem(final Date testDate) { final TestContextDateTzItem tci9 = new TestContextDateTzItem(); tci9.setDateValue(new TestContextDateItem(testDate)); - tci9.setTZValue(TIME_ZONE.getDisplayName()); - tci9.setDST(true); + tci9.setTzValue(TIME_ZONE.getDisplayName()); + tci9.setDst(true); return tci9; } private TestExternalContextItem getTestExternalContextItem(final Date testDate, final TestContextDateTzItem tci9A, - final TestContextDateLocaleItem tciAA) { + final TestContextDateLocaleItem tciAa) { final TestExternalContextItem externalContext = new TestExternalContextItem(); final TestContextBooleanItem testExternalContextItem000 = new TestContextBooleanItem(false); @@ -513,7 +513,7 @@ public class ContextInstantiation { externalContext.setTestExternalContextItem007(testExternalContextItem007); externalContext.setTestExternalContextItem008(testExternalContextItem008); externalContext.setTestExternalContextItem009(tci9A); - externalContext.setTestExternalContextItem00A(tciAA); + externalContext.setTestExternalContextItem00A(tciAa); externalContext.setTestExternalContextItem00B(testExternalContextItem00B); externalContext.setTestExternalContextItem00C(testExternalContextItem00C); return externalContext; diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextUpdate.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextUpdate.java index 8f066c8e3..95d14324c 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextUpdate.java +++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextUpdate.java @@ -149,9 +149,9 @@ public class ContextUpdate { private TestContextDateLocaleItem getTestContextDateLocaleItem() { final TestContextDateLocaleItem tciA = new TestContextDateLocaleItem(); tciA.setDateValue(new TestContextDateItem(new Date())); - tciA.setTZValue(TIME_ZONE.getDisplayName()); - tciA.setDST(true); - tciA.setUTCOffset(-600); + tciA.setTzValue(TIME_ZONE.getDisplayName()); + tciA.setDst(true); + tciA.setUtcOffset(-600); tciA.setLocale(Locale.ENGLISH); return tciA; } diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/SequentialContextInstantiation.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/SequentialContextInstantiation.java index 4041c079d..244bd7d24 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/SequentialContextInstantiation.java +++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/SequentialContextInstantiation.java @@ -253,9 +253,9 @@ public class SequentialContextInstantiation { // Should return null assertNull(dateAlbum.get("ItemNull")); // Put should return the previous contextItem - tciA00.setDST(false); + tciA00.setDst(false); final TestContextDateLocaleItem tciA03_clone = new TestContextDateLocaleItem(tciA03); - tciA03_clone.setDST(true); + tciA03_clone.setDst(true); TestContextDateLocaleItem retItem = (TestContextDateLocaleItem) dateAlbum.put("Item03", tciA03_clone); assertEquals(tciA03, retItem); retItem = (TestContextDateLocaleItem) dateAlbum.put("Item03", tciA03); @@ -332,17 +332,17 @@ public class SequentialContextInstantiation { private TestContextDateTzItem getTestContextDateTzItem(final Date testDate) { final TestContextDateTzItem tci9 = new TestContextDateTzItem(); tci9.setDateValue(new TestContextDateItem(testDate)); - tci9.setTZValue(TimeZone.getTimeZone("Europe/Dublin").getDisplayName()); - tci9.setDST(true); + tci9.setTzValue(TimeZone.getTimeZone("Europe/Dublin").getDisplayName()); + tci9.setDst(true); return tci9; } private TestContextDateLocaleItem getTestContextDateLocaleItem() { final TestContextDateLocaleItem tciA00 = new TestContextDateLocaleItem(); tciA00.setDateValue(new TestContextDateItem(new Date())); - tciA00.setTZValue(TIME_ZONE.getDisplayName()); - tciA00.setDST(true); - tciA00.setUTCOffset(-600); + tciA00.setTzValue(TIME_ZONE.getDisplayName()); + tciA00.setDst(true); + tciA00.setUtcOffset(-600); tciA00.setLocale(Locale.ENGLISH); return tciA00; } diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContext.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContext.java index 4f6dd9b1f..88cdccc88 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContext.java +++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContext.java @@ -96,7 +96,7 @@ public class ConcurrentContext { } else { // Spawn JVMs to run the tests for (int j = 0; j < configrationProvider.getJvmCount(); j++) { - final ConcurrentContextJVMThread task = new ConcurrentContextJVMThread(j, configrationProvider); + final ConcurrentContextJvmThread task = new ConcurrentContextJvmThread(j, configrationProvider); tasks.add(task); executorService.execute(task); } diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJVM.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJvm.java index 0f6900dbb..7d7548569 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJVM.java +++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJvm.java @@ -54,9 +54,9 @@ import org.slf4j.ext.XLoggerFactory; * * @author Liam Fallon (liam.fallon@ericsson.com) */ -public final class ConcurrentContextJVM { +public final class ConcurrentContextJvm { // Logger for this class - private static final XLogger LOGGER = XLoggerFactory.getXLogger(ConcurrentContextJVM.class); + private static final XLogger LOGGER = XLoggerFactory.getXLogger(ConcurrentContextJvm.class); private static final int IPV4_ADDRESS_LENGTH = 4; @@ -66,7 +66,7 @@ public final class ConcurrentContextJVM { private final ConfigrationProvider configrationProvider; - private ConcurrentContextJVM(final int jvmNo, final ConfigrationProvider configrationProvider) { + private ConcurrentContextJvm(final int jvmNo, final ConfigrationProvider configrationProvider) { this.jvmNo = jvmNo; this.configrationProvider = configrationProvider; final String name = configrationProvider.getTestName() + ":ConcurrentContextThread_" + jvmNo; @@ -157,8 +157,8 @@ public final class ConcurrentContextJVM { try { final ConfigrationProvider configrationProvider = new ConfigrationProviderImpl(testName, 1, threadCount, threadLoops, albumSize, lockType); - final ConcurrentContextJVM concurrentContextJVM = new ConcurrentContextJVM(jvmNo, configrationProvider); - concurrentContextJVM.execute(); + final ConcurrentContextJvm concurrentContextJvm = new ConcurrentContextJvm(jvmNo, configrationProvider); + concurrentContextJvm.execute(); } catch (final Exception e) { LOGGER.error("error running test in JVM", e); diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJVMThread.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJvmThread.java index 0c2aa7a90..339c95d26 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJVMThread.java +++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJvmThread.java @@ -43,15 +43,15 @@ import org.slf4j.ext.XLoggerFactory; * * @author Liam Fallon (liam.fallon@ericsson.com) */ -public class ConcurrentContextJVMThread implements Runnable, Closeable { +public class ConcurrentContextJvmThread implements Runnable, Closeable { // Logger for this class - private static final XLogger LOGGER = XLoggerFactory.getXLogger(ConcurrentContextJVMThread.class); + private static final XLogger LOGGER = XLoggerFactory.getXLogger(ConcurrentContextJvmThread.class); private final int jvm; private final ConfigrationProvider configrationProvider; private Process process = null; - public ConcurrentContextJVMThread(final int jvm, final ConfigrationProvider configrationProvider) { + public ConcurrentContextJvmThread(final int jvm, final ConfigrationProvider configrationProvider) { this.jvm = jvm; this.configrationProvider = configrationProvider; } @@ -70,7 +70,7 @@ public class ConcurrentContextJVMThread implements Runnable, Closeable { commandList.add("-Xmx512m"); commandList.add("-cp"); commandList.add(System.getProperty("java.class.path")); - commandList.add(ConcurrentContextJVM.class.getCanonicalName()); + commandList.add(ConcurrentContextJvm.class.getCanonicalName()); commandList.add(configrationProvider.getTestName()); commandList.add(new Integer(jvm).toString()); commandList.add(new Integer(configrationProvider.getThreadCount()).toString()); diff --git a/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/distribution/TestContextAlbumUpdate.java b/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/distribution/TestContextAlbumUpdate.java index 6b9ba15ad..54440370c 100644 --- a/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/distribution/TestContextAlbumUpdate.java +++ b/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/distribution/TestContextAlbumUpdate.java @@ -24,7 +24,7 @@ import java.io.IOException; import org.junit.After; import org.junit.Before; import org.junit.Test; -import org.onap.policy.apex.context.impl.distribution.jvmlocal.JVMLocalDistributor; +import org.onap.policy.apex.context.impl.distribution.jvmlocal.JvmLocalDistributor; import org.onap.policy.apex.context.impl.schema.java.JavaSchemaHelperParameters; import org.onap.policy.apex.context.parameters.ContextParameterConstants; import org.onap.policy.apex.context.parameters.ContextParameters; @@ -42,6 +42,9 @@ public class TestContextAlbumUpdate { private SchemaParameters schemaParameters; private ContextParameters contextParameters; + /** + * Set up context data. + */ @Before public void beforeTest() { contextParameters = new ContextParameters(); @@ -55,7 +58,7 @@ public class TestContextAlbumUpdate { ParameterService.register(contextParameters.getDistributorParameters()); ParameterService.register(contextParameters.getLockManagerParameters()); ParameterService.register(contextParameters.getPersistorParameters()); - + schemaParameters = new SchemaParameters(); schemaParameters.setName(ContextParameterConstants.SCHEMA_GROUP_NAME); schemaParameters.getSchemaHelperParameterMap().put("JAVA", new JavaSchemaHelperParameters()); @@ -63,6 +66,9 @@ public class TestContextAlbumUpdate { ParameterService.register(schemaParameters); } + /** + * Clear down context data. + */ @After public void afterTest() { ParameterService.deregister(schemaParameters); @@ -74,17 +80,17 @@ public class TestContextAlbumUpdate { } @Test - public void testContextAlbumUpdateJVMLocalVarSet() throws ApexModelException, IOException, ApexException { + public void testContextAlbumUpdateJvmLocalVarSet() throws ApexModelException, IOException, ApexException { logger.debug("Running testContextAlbumUpdateJVMLocalVarSet test . . ."); - contextParameters.getDistributorParameters().setPluginClass(JVMLocalDistributor.class.getCanonicalName()); + contextParameters.getDistributorParameters().setPluginClass(JvmLocalDistributor.class.getCanonicalName()); new ContextAlbumUpdate().testContextAlbumUpdate(); logger.debug("Ran testContextAlbumUpdateJVMLocalVarSet test"); } @Test - public void testContextAlbumUpdateJVMLocalVarNotSet() throws ApexModelException, IOException, ApexException { + public void testContextAlbumUpdateJvmLocalVarNotSet() throws ApexModelException, IOException, ApexException { logger.debug("Running testContextAlbumUpdateJVMLocalVarNotSet test . . ."); new ContextAlbumUpdate().testContextAlbumUpdate(); diff --git a/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/distribution/TestContextInstantiation.java b/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/distribution/TestContextInstantiation.java index b10bc685c..ba402da24 100644 --- a/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/distribution/TestContextInstantiation.java +++ b/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/distribution/TestContextInstantiation.java @@ -24,7 +24,7 @@ import java.io.IOException; import org.junit.After; import org.junit.Before; import org.junit.Test; -import org.onap.policy.apex.context.impl.distribution.jvmlocal.JVMLocalDistributor; +import org.onap.policy.apex.context.impl.distribution.jvmlocal.JvmLocalDistributor; import org.onap.policy.apex.context.impl.schema.java.JavaSchemaHelperParameters; import org.onap.policy.apex.context.parameters.ContextParameterConstants; import org.onap.policy.apex.context.parameters.ContextParameters; @@ -47,6 +47,9 @@ public class TestContextInstantiation { private SchemaParameters schemaParameters; private ContextParameters contextParameters; + /** + * Set up context for tests. + */ @Before public void beforeTest() { contextParameters = new ContextParameters(); @@ -68,6 +71,9 @@ public class TestContextInstantiation { ParameterService.register(schemaParameters); } + /** + * Clear down context for tests. + */ @After public void afterTest() { ParameterService.deregister(schemaParameters); @@ -79,17 +85,17 @@ public class TestContextInstantiation { } @Test - public void testContextInstantiationJVMLocalVarSet() throws ApexModelException, IOException, ApexException { + public void testContextInstantiationJvmLocalVarSet() throws ApexModelException, IOException, ApexException { logger.debug("Running testContextInstantiationJVMLocalVarSet test . . ."); - contextParameters.getDistributorParameters().setPluginClass(JVMLocalDistributor.class.getCanonicalName()); + contextParameters.getDistributorParameters().setPluginClass(JvmLocalDistributor.class.getCanonicalName()); new ContextInstantiation().testContextInstantiation(); logger.debug("Ran testContextInstantiationJVMLocalVarSet test"); } @Test - public void testContextInstantiationJVMLocalVarNotSet() throws ApexModelException, IOException, ApexException { + public void testContextInstantiationJvmLocalVarNotSet() throws ApexModelException, IOException, ApexException { logger.debug("Running testContextInstantiationJVMLocalVarNotSet test . . ."); new ContextInstantiation().testContextInstantiation(); diff --git a/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/distribution/TestContextUpdate.java b/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/distribution/TestContextUpdate.java index 07a0cbe47..8ef8bf005 100644 --- a/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/distribution/TestContextUpdate.java +++ b/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/distribution/TestContextUpdate.java @@ -25,7 +25,7 @@ import java.io.IOException; import org.junit.After; import org.junit.Before; import org.junit.Test; -import org.onap.policy.apex.context.impl.distribution.jvmlocal.JVMLocalDistributor; +import org.onap.policy.apex.context.impl.distribution.jvmlocal.JvmLocalDistributor; import org.onap.policy.apex.context.impl.schema.java.JavaSchemaHelperParameters; import org.onap.policy.apex.context.parameters.ContextParameterConstants; import org.onap.policy.apex.context.parameters.ContextParameters; @@ -48,6 +48,9 @@ public class TestContextUpdate { private SchemaParameters schemaParameters; private ContextParameters contextParameters; + /** + * Set up context for tests. + */ @Before public void beforeTest() { contextParameters = new ContextParameters(); @@ -69,6 +72,9 @@ public class TestContextUpdate { ParameterService.register(schemaParameters); } + /** + * Clear down context for tests. + */ @After public void afterTest() { ParameterService.deregister(schemaParameters); @@ -80,17 +86,17 @@ public class TestContextUpdate { } @Test - public void testContextUpdateJVMLocalVarSet() throws ApexModelException, IOException, ApexException { + public void testContextUpdateJvmLocalVarSet() throws ApexModelException, IOException, ApexException { logger.debug("Running testContextUpdateJVMLocalVarSet test . . ."); - contextParameters.getDistributorParameters().setPluginClass(JVMLocalDistributor.class.getCanonicalName()); + contextParameters.getDistributorParameters().setPluginClass(JvmLocalDistributor.class.getCanonicalName()); new ContextUpdate().testContextUpdate(); logger.debug("Ran testContextUpdateJVMLocalVarSet test"); } @Test - public void testContextUpdateJVMLocalVarNotSet() throws ApexModelException, IOException, ApexException { + public void testContextUpdateJvmLocalVarNotSet() throws ApexModelException, IOException, ApexException { logger.debug("Running testContextUpdateJVMLocalVarNotSet test . . ."); new ContextUpdate().testContextUpdate(); diff --git a/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/distribution/TestSequentialContextInstantiation.java b/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/distribution/TestSequentialContextInstantiation.java index b37c8eafa..d1cdc6d97 100644 --- a/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/distribution/TestSequentialContextInstantiation.java +++ b/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/distribution/TestSequentialContextInstantiation.java @@ -24,7 +24,7 @@ import java.io.IOException; import org.junit.After; import org.junit.Before; import org.junit.Test; -import org.onap.policy.apex.context.impl.distribution.jvmlocal.JVMLocalDistributor; +import org.onap.policy.apex.context.impl.distribution.jvmlocal.JvmLocalDistributor; import org.onap.policy.apex.context.impl.schema.java.JavaSchemaHelperParameters; import org.onap.policy.apex.context.parameters.ContextParameterConstants; import org.onap.policy.apex.context.parameters.ContextParameters; @@ -43,10 +43,13 @@ import org.slf4j.ext.XLoggerFactory; public class TestSequentialContextInstantiation { // Logger for this class private static final XLogger logger = XLoggerFactory.getXLogger(TestSequentialContextInstantiation.class); - + private SchemaParameters schemaParameters; private ContextParameters contextParameters; + /** + * Set up context for tests. + */ @Before public void beforeTest() { contextParameters = new ContextParameters(); @@ -60,7 +63,7 @@ public class TestSequentialContextInstantiation { ParameterService.register(contextParameters.getDistributorParameters()); ParameterService.register(contextParameters.getLockManagerParameters()); ParameterService.register(contextParameters.getPersistorParameters()); - + schemaParameters = new SchemaParameters(); schemaParameters.setName(ContextParameterConstants.SCHEMA_GROUP_NAME); schemaParameters.getSchemaHelperParameterMap().put("JAVA", new JavaSchemaHelperParameters()); @@ -68,6 +71,9 @@ public class TestSequentialContextInstantiation { ParameterService.register(schemaParameters); } + /** + * Clear down context for tests. + */ @After public void afterTest() { ParameterService.deregister(schemaParameters); @@ -79,20 +85,20 @@ public class TestSequentialContextInstantiation { } @Test - public void testSequentialContextInstantiationJVMLocalVarSet() - throws ApexModelException, IOException, ApexException { + public void testSequentialContextInstantiationJvmLocalVarSet() + throws ApexModelException, IOException, ApexException { logger.debug("Running testSequentialContextInstantiationJVMLocalVarSet test . . ."); - contextParameters.getDistributorParameters().setPluginClass(JVMLocalDistributor.class.getCanonicalName()); - + contextParameters.getDistributorParameters().setPluginClass(JvmLocalDistributor.class.getCanonicalName()); + new SequentialContextInstantiation().testSequentialContextInstantiation(); logger.debug("Ran testSequentialContextInstantiationJVMLocalVarSet test"); } @Test - public void testSequentialContextInstantiationJVMLocalVarNotSet() - throws ApexModelException, IOException, ApexException { + public void testSequentialContextInstantiationJvmLocalVarNotSet() + throws ApexModelException, IOException, ApexException { logger.debug("Running testSequentialContextInstantiationJVMLocalVarNotSet test . . ."); new ContextParameters(); diff --git a/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/locking/TestConcurrentContext.java b/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/locking/TestConcurrentContext.java index 8fca90b07..ed9aff0c1 100644 --- a/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/locking/TestConcurrentContext.java +++ b/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/locking/TestConcurrentContext.java @@ -31,8 +31,8 @@ import java.util.Map; import org.junit.After; import org.junit.Before; import org.junit.Test; -import org.onap.policy.apex.context.impl.distribution.jvmlocal.JVMLocalDistributor; -import org.onap.policy.apex.context.impl.locking.jvmlocal.JVMLocalLockManager; +import org.onap.policy.apex.context.impl.distribution.jvmlocal.JvmLocalDistributor; +import org.onap.policy.apex.context.impl.locking.jvmlocal.JvmLocalLockManager; import org.onap.policy.apex.context.impl.schema.java.JavaSchemaHelperParameters; import org.onap.policy.apex.context.parameters.ContextParameterConstants; import org.onap.policy.apex.context.parameters.ContextParameters; @@ -66,6 +66,9 @@ public class TestConcurrentContext { private SchemaParameters schemaParameters; private ContextParameters contextParameters; + /** + * Set up context for tests. + */ @Before public void beforeTest() { contextParameters = new ContextParameters(); @@ -87,6 +90,9 @@ public class TestConcurrentContext { ParameterService.register(schemaParameters); } + /** + * Clear down context for tests. + */ @After public void afterTest() { ParameterService.deregister(schemaParameters); @@ -98,10 +104,10 @@ public class TestConcurrentContext { } @Test - public void testConcurrentContextJVMLocalVarSet() throws Exception { + public void testConcurrentContextJvmLocalVarSet() throws Exception { logger.debug("Running testConcurrentContextJVMLocalVarSet test . . ."); - contextParameters.getLockManagerParameters().setPluginClass(JVMLocalLockManager.class.getCanonicalName()); + contextParameters.getLockManagerParameters().setPluginClass(JvmLocalLockManager.class.getCanonicalName()); final ConfigrationProvider configrationProvider = getConfigrationProvider("JVMLocalVarSet", TEST_JVM_COUNT_SINGLE_JVM, TEST_THREAD_COUNT_SINGLE_JVM, TEST_THREAD_LOOPS); @@ -120,7 +126,7 @@ public class TestConcurrentContext { } @Test - public void testConcurrentContextJVMLocalNoVarSet() throws Exception { + public void testConcurrentContextJvmLocalNoVarSet() throws Exception { logger.debug("Running testConcurrentContextJVMLocalNoVarSet test . . ."); final ConfigrationProvider configrationProvider = getConfigrationProvider("JVMLocalNoVarSet", @@ -139,11 +145,11 @@ public class TestConcurrentContext { } @Test - public void testConcurrentContextMultiJVMNoLock() throws Exception { + public void testConcurrentContextMultiJvmNoLock() throws Exception { logger.debug("Running testConcurrentContextMultiJVMNoLock test . . ."); - contextParameters.getDistributorParameters().setPluginClass(JVMLocalDistributor.class.getCanonicalName()); - contextParameters.getLockManagerParameters().setPluginClass(JVMLocalLockManager.class.getCanonicalName()); + contextParameters.getDistributorParameters().setPluginClass(JvmLocalDistributor.class.getCanonicalName()); + contextParameters.getLockManagerParameters().setPluginClass(JvmLocalLockManager.class.getCanonicalName()); final ConfigrationProvider configrationProvider = getConfigrationProvider("testConcurrentContextMultiJVMNoLock", TEST_JVM_COUNT_MULTI_JVM, TEST_THREAD_COUNT_MULTI_JVM, TEST_THREAD_LOOPS); diff --git a/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/persistence/TestPersistentContextInstantiation.java b/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/persistence/TestPersistentContextInstantiation.java index c8628935c..9aad0ad78 100644 --- a/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/persistence/TestPersistentContextInstantiation.java +++ b/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/persistence/TestPersistentContextInstantiation.java @@ -83,6 +83,9 @@ public class TestPersistentContextInstantiation { new File("derby.log").delete(); } + /** + * Set up context for tests. + */ @Before public void beforeTest() { contextParameters = new ContextParameters(); @@ -104,6 +107,9 @@ public class TestPersistentContextInstantiation { ParameterService.register(schemaParameters); } + /** + * Clear down context for tests. + */ @After public void afterTest() { ParameterService.deregister(schemaParameters); @@ -166,8 +172,8 @@ public class TestPersistentContextInstantiation { final TestContextDateItem testDate = new TestContextDateItem(new Date()); final TestContextDateLocaleItem tci00A = new TestContextDateLocaleItem(); tci00A.setDateValue(testDate); - tci00A.setTZValue(TimeZone.getTimeZone("Europe/Dublin").toString()); - tci00A.setDST(true); + tci00A.setTzValue(TimeZone.getTimeZone("Europe/Dublin").toString()); + tci00A.setDst(true); final Map<String, Object> valueMap1 = new HashMap<String, Object>(); valueMap1.put("TestPolicyContextItem00A", tci00A); @@ -176,7 +182,7 @@ public class TestPersistentContextInstantiation { assertEquals(((TestContextDateLocaleItem) contextAlbumForDate.get("TestPolicyContextItem00A")).getDateValue(), testDate); - assertEquals(((TestContextDateLocaleItem) contextAlbumForDate.get("TestPolicyContextItem00A")).getDST(), true); + assertEquals(((TestContextDateLocaleItem) contextAlbumForDate.get("TestPolicyContextItem00A")).getDst(), true); contextAlbumForDate.flush(); diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutor.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutor.java index 3bbcc13dc..687c3b305 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutor.java +++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutor.java @@ -20,7 +20,7 @@ package org.onap.policy.apex.core.engine.executor; -import static org.onap.policy.apex.model.utilities.Assertions.argumentNotNull; +import static org.onap.policy.apex.model.utilities.Assertions.argumentOfClassNotNull; import java.util.Map; @@ -97,7 +97,7 @@ public abstract class StateFinalizerExecutor public void prepare() throws StateMachineException { LOGGER.debug("prepare:" + finalizerLogic.getId() + "," + finalizerLogic.getLogicFlavour() + "," + finalizerLogic.getLogic()); - argumentNotNull(finalizerLogic.getLogic(), StateMachineException.class, "task logic cannot be null."); + argumentOfClassNotNull(finalizerLogic.getLogic(), StateMachineException.class, "task logic cannot be null."); } /* diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskExecutor.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskExecutor.java index 8dd2575b0..de2f7b821 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskExecutor.java +++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskExecutor.java @@ -20,7 +20,7 @@ package org.onap.policy.apex.core.engine.executor; -import static org.onap.policy.apex.model.utilities.Assertions.argumentNotNull; +import static org.onap.policy.apex.model.utilities.Assertions.argumentOfClassNotNull; import java.util.Iterator; import java.util.Map; @@ -101,7 +101,7 @@ public abstract class TaskExecutor public void prepare() throws StateMachineException { LOGGER.debug("prepare:" + axTask.getKey().getId() + "," + axTask.getTaskLogic().getLogicFlavour() + "," + axTask.getTaskLogic().getLogic()); - argumentNotNull(axTask.getTaskLogic().getLogic(), StateMachineException.class, "task logic cannot be null."); + argumentOfClassNotNull(axTask.getTaskLogic().getLogic(), StateMachineException.class, "task logic cannot be null."); } /* diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/impl/ExecutorFactoryImpl.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/impl/ExecutorFactoryImpl.java index 6bb9ce2a3..d1f07e19a 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/impl/ExecutorFactoryImpl.java +++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/impl/ExecutorFactoryImpl.java @@ -69,7 +69,7 @@ public class ExecutorFactoryImpl extends ExecutorFactory { public ExecutorFactoryImpl() throws StateMachineException { final EngineParameters engineParameters = ParameterService.get(EngineParameterConstants.MAIN_GROUP_NAME); - Assertions.argumentNotNull(engineParameters, StateMachineException.class, + Assertions.argumentOfClassNotNull(engineParameters, StateMachineException.class, "Parameter \"engineParameters\" may not be null"); // Instantiate each executor class map entry diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/ApexDaoFactory.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/ApexDaoFactory.java index 82838edf1..47996d88d 100644 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/ApexDaoFactory.java +++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/ApexDaoFactory.java @@ -43,7 +43,8 @@ public class ApexDaoFactory { * @throws ApexException on invalid JPA plugins */ public ApexDao createApexDao(final DaoParameters daoParameters) throws ApexException { - Assertions.argumentNotNull(daoParameters, ApexException.class, "Parameter \"daoParameters\" may not be null"); + Assertions.argumentOfClassNotNull(daoParameters, ApexException.class, + "Parameter \"daoParameters\" may not be null"); // Get the class for the DAO using reflection Object apexDaoObject = null; @@ -52,15 +53,15 @@ public class ApexDaoFactory { } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { LOGGER.error("Apex DAO class not found for DAO plugin \"" + daoParameters.getPluginClass() + "\"", e); throw new ApexException( - "Apex DAO class not found for DAO plugin \"" + daoParameters.getPluginClass() + "\"", e); + "Apex DAO class not found for DAO plugin \"" + daoParameters.getPluginClass() + "\"", e); } // Check the class is an Apex DAO if (!(apexDaoObject instanceof ApexDao)) { LOGGER.error("Specified Apex DAO plugin class \"" + daoParameters.getPluginClass() - + "\" does not implement the ApexDao interface"); + + "\" does not implement the ApexDao interface"); throw new ApexException("Specified Apex DAO plugin class \"" + daoParameters.getPluginClass() - + "\" does not implement the ApexDao interface"); + + "\" does not implement the ApexDao interface"); } return (ApexDao) apexDaoObject; diff --git a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbum.java b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbum.java index 32555662e..564e2d48c 100644 --- a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbum.java +++ b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbum.java @@ -46,22 +46,22 @@ import org.onap.policy.apex.model.utilities.Assertions; /** * This class is used to define an album of context. - * <p> - * A context album is a distributed map of context that will be distributed across all process instances that require + * + * <p>A context album is a distributed map of context that will be distributed across all process instances that require * access to it. This class defines the schema (structure) of the items in the context album, whether the items on the * context album are writable or not, and what the scope of the context album is. - * <p> - * The structure of items (objects) the context album is defined as a schema, which is understood by whatever schema + * + * <p>The structure of items (objects) the context album is defined as a schema, which is understood by whatever schema * implementation is being used for the context album. - * <p> - * The scope of a context album is a string field, understood by whatever distribution mechanism is being used for the - * context album. The distribution mechanism uses the scope of the context album to decide to which executable entities - * a given context album is distributed. - * <p> - * The writable flag on a context album defines whether users of a context album can write to the context album or just - * read objects from the context album. - * <p> - * Validation checks that the album key and the context schema key are not null and that the scope field is not + * + * <p>The scope of a context album is a string field, understood by whatever distribution mechanism is being used for + * the context album. The distribution mechanism uses the scope of the context album to decide to which executable + * entities a given context album is distributed. + * + * <p>The writable flag on a context album defines whether users of a context album can write to the context album or + * just read objects from the context album. + * + * <p>Validation checks that the album key and the context schema key are not null and that the scope field is not * undefined and matches the regular expression SCOPE_REGEXP. */ @Entity @@ -69,8 +69,8 @@ import org.onap.policy.apex.model.utilities.Assertions; @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name = "apexContextAlbum", namespace = "http://www.onap.org/policy/apex-pdp") -@XmlType(name = "AxContextAlbum", namespace = "http://www.onap.org/policy/apex-pdp", - propOrder = { "key", "scope", "isWritable", "itemSchema" }) +@XmlType(name = "AxContextAlbum", namespace = "http://www.onap.org/policy/apex-pdp", propOrder = + { "key", "scope", "isWritable", "itemSchema" }) public class AxContextAlbum extends AxConcept { private static final String SCOPE_STRING = "scope"; @@ -113,8 +113,8 @@ public class AxContextAlbum extends AxConcept { /** * The default constructor creates a context album with a null artifact key. The scope of the context album is set - * as SCOPE_UNDEFINED, the album is writable, and the artifact key of the context schema is set to the null - * artifact key. + * as SCOPE_UNDEFINED, the album is writable, and the artifact key of the context schema is set to the null artifact + * key. */ public AxContextAlbum() { this(new AxArtifactKey()); @@ -124,7 +124,7 @@ public class AxContextAlbum extends AxConcept { } /** - * Copy constructor + * Copy constructor. * * @param copyConcept the concept to copy from */ @@ -134,8 +134,8 @@ public class AxContextAlbum extends AxConcept { /** * The keyed constructor creates a context album with the specified artifact key. The scope of the context album is - * set as SCOPE_UNDEFINED, the album is writable, and the artifact key of the context schema is set to the - * null artifact key. + * set as SCOPE_UNDEFINED, the album is writable, and the artifact key of the context schema is set to the null + * artifact key. * * @param key the key of the context album */ @@ -152,7 +152,7 @@ public class AxContextAlbum extends AxConcept { * @param itemSchema the artifact key of the context schema to use for this context album */ public AxContextAlbum(final AxArtifactKey key, final String scope, final boolean isWritable, - final AxArtifactKey itemSchema) { + final AxArtifactKey itemSchema) { super(); Assertions.argumentNotNull(key, "key may not be null"); Assertions.argumentNotNull(scope, "scope may not be null"); @@ -264,26 +264,26 @@ public class AxContextAlbum extends AxConcept { AxValidationResult result = resultIn; if (key.equals(AxArtifactKey.getNullKey())) { - result.addValidationMessage( - new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key is a null key")); + result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, + "key is a null key")); } result = key.validate(result); if (scope.replaceAll("\\s+$", "").length() == 0 || scope.equals(SCOPE_UNDEFINED)) { - result.addValidationMessage( - new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, "scope is not defined")); + result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, + "scope is not defined")); } try { Assertions.validateStringParameter(SCOPE_STRING, scope, SCOPE_REGEXP); } catch (final IllegalArgumentException e) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "scope invalid-" + e.getMessage())); + "scope invalid-" + e.getMessage())); } if (itemSchema.equals(AxArtifactKey.getNullKey())) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "itemSchema reference is a null key, an item schema must be specified")); + "itemSchema reference is a null key, an item schema must be specified")); } result = itemSchema.validate(result); diff --git a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbums.java b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbums.java index a6e2ad9ac..9df11ae25 100644 --- a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbums.java +++ b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbums.java @@ -51,22 +51,22 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.Validat import org.onap.policy.apex.model.utilities.Assertions; /** - * This class is a context album container and holds a map of the context albums for an entire Apex - * model. All Apex models that use context albums must have an {@link AxContextAlbums} field. The - * {@link AxContextAlbums} class implements the helper methods of the {@link AxConceptGetter} - * interface to allow {@link AxContextAlbum} instances to be retrieved by calling methods directly - * on this class without referencing the contained map. - * <p> - * Validation checks that the container key is not null. An observation is issued if no context - * albums are defined in the container. If context albums do exist, they are checked to ensure that - * keys and values are not null and that the map key matches the key in the map value for all album - * entries. Each context album entry is then validated individually. + * This class is a context album container and holds a map of the context albums for an entire Apex model. All Apex + * models that use context albums must have an {@link AxContextAlbums} field. The {@link AxContextAlbums} class + * implements the helper methods of the {@link AxConceptGetter} interface to allow {@link AxContextAlbum} instances to + * be retrieved by calling methods directly on this class without referencing the contained map. + * + * <p>Validation checks that the container key is not null. An observation is issued if no context albums are defined in + * the container. If context albums do exist, they are checked to ensure that keys and values are not null and that the + * map key matches the key in the map value for all album entries. Each context album entry is then validated + * individually. */ @Entity @Table(name = "AxContextAlbums") @XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "AxContextAlbums", namespace = "http://www.onap.org/policy/apex-pdp", propOrder = {"key", "albums"}) +@XmlType(name = "AxContextAlbums", namespace = "http://www.onap.org/policy/apex-pdp", propOrder = + { "key", "albums" }) public final class AxContextAlbums extends AxConcept implements AxConceptGetter<AxContextAlbum> { private static final long serialVersionUID = -4844259809024470975L; @@ -84,15 +84,15 @@ public final class AxContextAlbums extends AxConcept implements AxConceptGetter< // @formatter:on /** - * The Default Constructor creates a {@link AxContextAlbums} object with a null artifact key and - * creates an empty context album map. + * The Default Constructor creates a {@link AxContextAlbums} object with a null artifact key and creates an empty + * context album map. */ public AxContextAlbums() { this(new AxArtifactKey()); } /** - * Copy constructor + * Copy constructor. * * @param copyConcept the concept to copy from */ @@ -101,8 +101,8 @@ public final class AxContextAlbums extends AxConcept implements AxConceptGetter< } /** - * The Key Constructor creates a {@link AxContextAlbums} object with the given artifact key and - * creates an empty context album map. + * The Key Constructor creates a {@link AxContextAlbums} object with the given artifact key and creates an empty + * context album map. * * @param key the key of the context album container */ @@ -127,15 +127,14 @@ public final class AxContextAlbums extends AxConcept implements AxConceptGetter< } /** - * When a model is unmarshalled from disk or from the database, the context album map is - * returned as a raw hash map. This method is called by JAXB after unmarshaling and is used to - * convert the hash map to a {@link NavigableMap} so that it will work with the - * {@link AxConceptGetter} interface. + * When a model is unmarshalled from disk or from the database, the context album map is returned as a raw hash map. + * This method is called by JAXB after unmarshaling and is used to convert the hash map to a {@link NavigableMap} so + * that it will work with the {@link AxConceptGetter} interface. * - * @param u the unmarshaler that is unmarshaling the model + * @param unmarsaller the unmarshaler that is unmarshaling the model * @param parent the parent object of this object in the unmarshaler */ - public void afterUnmarshal(final Unmarshaller u, final Object parent) { + public void afterUnmarshal(final Unmarshaller unmarsaller, final Object parent) { // The map must be navigable to allow name and version searching, unmarshaling returns a // hash map final NavigableMap<AxArtifactKey, AxContextAlbum> navigableAlbums = new TreeMap<>(); @@ -236,8 +235,7 @@ public final class AxContextAlbums extends AxConcept implements AxConceptGetter< /* * (non-Javadoc) * - * @see - * org.onap.policy.apex.model.basicmodel.concepts.AxConcept#validate(org.onap.policy.apex.model. + * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#validate(org.onap.policy.apex.model. * basicmodel.concepts.AxValidationResult) */ @Override @@ -245,23 +243,24 @@ public final class AxContextAlbums extends AxConcept implements AxConceptGetter< AxValidationResult result = resultIn; if (key.equals(AxArtifactKey.getNullKey())) { - result.addValidationMessage( - new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key is a null key")); + result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, + "key is a null key")); } result = key.validate(result); if (albums.size() == 0) { - result.addValidationMessage( - new AxValidationMessage(key, this.getClass(), ValidationResult.OBSERVATION, "albums are empty")); + result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.OBSERVATION, + "albums are empty")); } else { for (final Entry<AxArtifactKey, AxContextAlbum> contextAlbumEntry : albums.entrySet()) { if (contextAlbumEntry.getKey().equals(AxArtifactKey.getNullKey())) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "key on context album entry " + contextAlbumEntry.getKey() + " may not be the null key")); + "key on context album entry " + contextAlbumEntry.getKey() + + " may not be the null key")); } else if (contextAlbumEntry.getValue() == null) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "value on context album entry " + contextAlbumEntry.getKey() + " may not be null")); + "value on context album entry " + contextAlbumEntry.getKey() + " may not be null")); } else { validateContextAlbumKey(result, contextAlbumEntry); @@ -274,19 +273,19 @@ public final class AxContextAlbums extends AxConcept implements AxConceptGetter< } private void validateContextAlbumKey(final AxValidationResult result, - final Entry<AxArtifactKey, AxContextAlbum> contextAlbumEntry) { + final Entry<AxArtifactKey, AxContextAlbum> contextAlbumEntry) { if (!contextAlbumEntry.getKey().equals(contextAlbumEntry.getValue().getKey())) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "key on context album entry key " + contextAlbumEntry.getKey() - + " does not equal context album value key " + contextAlbumEntry.getValue().getKey())); + "key on context album entry key " + contextAlbumEntry.getKey() + + " does not equal context album value key " + + contextAlbumEntry.getValue().getKey())); } } /* * (non-Javadoc) * - * @see - * org.onap.policy.apex.model.basicmodel.concepts.AxConcept#copyTo(org.onap.policy.apex.model. + * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#copyTo(org.onap.policy.apex.model. * basicmodel.concepts.AxConcept) */ @Override @@ -301,7 +300,7 @@ public final class AxContextAlbums extends AxConcept implements AxConceptGetter< final Map<AxArtifactKey, AxContextAlbum> newContextAlbum = new TreeMap<>(); for (final Entry<AxArtifactKey, AxContextAlbum> contextAlbumEntry : albums.entrySet()) { newContextAlbum.put(new AxArtifactKey(contextAlbumEntry.getKey()), - new AxContextAlbum(contextAlbumEntry.getValue())); + new AxContextAlbum(contextAlbumEntry.getValue())); } copy.setAlbumsMap(newContextAlbum); @@ -399,13 +398,12 @@ public final class AxContextAlbums extends AxConcept implements AxConceptGetter< /* * (non-Javadoc) * - * @see org.onap.policy.apex.model.basicmodel.concepts.AxConceptGetter#get(java.lang.String, - * java.lang.String) + * @see org.onap.policy.apex.model.basicmodel.concepts.AxConceptGetter#get(java.lang.String, java.lang.String) */ @Override public AxContextAlbum get(final String conceptKeyName, final String conceptKeyVersion) { return new AxConceptGetterImpl<>((NavigableMap<AxArtifactKey, AxContextAlbum>) albums).get(conceptKeyName, - conceptKeyVersion); + conceptKeyVersion); } /* @@ -421,12 +419,11 @@ public final class AxContextAlbums extends AxConcept implements AxConceptGetter< /* * (non-Javadoc) * - * @see org.onap.policy.apex.model.basicmodel.concepts.AxConceptGetter#getAll(java.lang.String, - * java.lang.String) + * @see org.onap.policy.apex.model.basicmodel.concepts.AxConceptGetter#getAll(java.lang.String, java.lang.String) */ @Override public Set<AxContextAlbum> getAll(final String conceptKeyName, final String conceptKeyVersion) { return new AxConceptGetterImpl<>((NavigableMap<AxArtifactKey, AxContextAlbum>) albums).getAll(conceptKeyName, - conceptKeyVersion); + conceptKeyVersion); } } diff --git a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextModel.java b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextModel.java index 2aa6fc70a..56983f37b 100644 --- a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextModel.java +++ b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextModel.java @@ -48,8 +48,8 @@ import org.onap.policy.apex.model.utilities.Assertions; * constructed that just contains context and the key information for that context. The model contains schema * definitions and the definitions of context albums that use those schemas. In the case where Apex context is being * used without policy or independent of policy, an Apex context model is sufficient to get Apex context working. - * <p> - * Validation runs {@link AxModel} validation on the model. In addition, the {@link AxContextSchemas} and + * + * <p>Validation runs {@link AxModel} validation on the model. In addition, the {@link AxContextSchemas} and * {@link AxContextAlbums} validation is run on the context schemas and albums in the model. */ @Entity @@ -102,7 +102,7 @@ public class AxContextModel extends AxModel { } /** - * Copy constructor + * Copy constructor. * * @param copyConcept the concept to copy from */ diff --git a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextSchema.java b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextSchema.java index 87c89376e..5dad2e9e8 100644 --- a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextSchema.java +++ b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextSchema.java @@ -50,24 +50,24 @@ import org.onap.policy.apex.model.utilities.Assertions; * schema flavour defines the type of schema being defined and the schema itself defines the schema. The schema flavour * is used by Apex to look up and load a plugin class that understands and interprets the schema definition and can * create instances of classes for the schema. - * <p> - * An {@link AxContextSchema} is used to define each parameter in Apex events, the messages that enter, exit, and are + * + * <p>An {@link AxContextSchema} is used to define each parameter in Apex events, the messages that enter, exit, and are * passed internally in Apex. In addition, an Apex {@link AxContextAlbum} instances hold a map of * {@link AxContextSchema} instances to represent the context being managed as an {@link AxContextAlbum}. For example, * the state of all cells in a mobile network might be represented as an {@link AxContextAlbum} with its * {@link AxContextSchema} being defined as @code cell} objects. - * <p> - * Validation checks that the schema key is not null. It also checks that the schema flavour is defined and matches the - * regular expression SCHEMA_FLAVOUR_REGEXP. Finally, validation checks that the defined schema is not a blank - * or empty string. + * + * <p>Validation checks that the schema key is not null. It also checks that the schema flavour is defined and matches + * the regular expression SCHEMA_FLAVOUR_REGEXP. Finally, validation checks that the defined schema is not a blank or + * empty string. */ @Entity @Table(name = "AxContextSchema") @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name = "apexContextSchema", namespace = "http://www.onap.org/policy/apex-pdp") -@XmlType(name = "AxContextSchema", namespace = "http://www.onap.org/policy/apex-pdp", - propOrder = { "key", "schemaFlavour", "schemaDefinition" }) +@XmlType(name = "AxContextSchema", namespace = "http://www.onap.org/policy/apex-pdp", propOrder = + { "key", "schemaFlavour", "schemaDefinition" }) public class AxContextSchema extends AxConcept { private static final String SCHEMA_FLAVOUR = "schemaFlavour"; @@ -108,7 +108,7 @@ public class AxContextSchema extends AxConcept { } /** - * Copy constructor + * Copy constructor. * * @param copyConcept the concept to copy from */ @@ -222,28 +222,28 @@ public class AxContextSchema extends AxConcept { AxValidationResult result = resultIn; if (key.equals(AxArtifactKey.getNullKey())) { - result.addValidationMessage( - new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key is a null key")); + result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, + "key is a null key")); } result = key.validate(result); if (schemaFlavour.replaceAll(WHITESPACE_REGEXP, "").length() == 0 - || schemaFlavour.equals(SCHEMA_FLAVOUR_UNDEFINED)) { + || schemaFlavour.equals(SCHEMA_FLAVOUR_UNDEFINED)) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "schema flavour is not defined")); + "schema flavour is not defined")); } try { Assertions.validateStringParameter(SCHEMA_FLAVOUR, schemaFlavour, SCHEMA_FLAVOUR_REGEXP); } catch (final IllegalArgumentException e) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "schema flavour invalid-" + e.getMessage())); + "schema flavour invalid-" + e.getMessage())); } if (schemaDefinition.replaceAll(WHITESPACE_REGEXP, "").length() == 0) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "no schemaDefinition specified, schemaDefinition may not be blank")); + "no schemaDefinition specified, schemaDefinition may not be blank")); } return result; diff --git a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextSchemas.java b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextSchemas.java index df94a87a9..2b31aa425 100644 --- a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextSchemas.java +++ b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextSchemas.java @@ -55,8 +55,8 @@ import org.onap.policy.apex.model.utilities.Assertions; * models that use context schemas must have an {@link AxContextSchemas} field. The {@link AxContextSchemas} class * implements the helper methods of the {@link AxConceptGetter} interface to allow {@link AxContextSchema} instances to * be retrieved by calling methods directly on this class without referencing the contained map. - * <p> - * Validation checks that the container key is not null. An error is issued if no context schemas are defined in the + * + * <p>Validation checks that the container key is not null. An error is issued if no context schemas are defined in the * container. Each context schema entry is checked to ensure that its key and value are not null and that the key * matches the key in the map value. Each context schema entry is then validated individually. */ @@ -64,7 +64,8 @@ import org.onap.policy.apex.model.utilities.Assertions; @Table(name = "AxContextSchemas") @XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "AxContextSchemas", namespace = "http://www.onap.org/policy/apex-pdp", propOrder = { "key", "schemas" }) +@XmlType(name = "AxContextSchemas", namespace = "http://www.onap.org/policy/apex-pdp", propOrder = + { "key", "schemas" }) public class AxContextSchemas extends AxConcept implements AxConceptGetter<AxContextSchema> { private static final long serialVersionUID = -3203734282886453582L; @@ -93,7 +94,7 @@ public class AxContextSchemas extends AxConcept implements AxConceptGetter<AxCon } /** - * Copy constructor + * Copy constructor. * * @param copyConcept the concept to copy from */ @@ -132,10 +133,10 @@ public class AxContextSchemas extends AxConcept implements AxConceptGetter<AxCon * map. This method is called by JAXB after unmarshaling and is used to convert the hash map to a * {@link NavigableMap} so that it will work with the {@link AxConceptGetter} interface. * - * @param u the unmarshaler that is unmarshaling the model + * @param unmarshaller the unmarshaler that is unmarshaling the model * @param parent the parent object of this object in the unmarshaler */ - public void afterUnmarshal(final Unmarshaller u, final Object parent) { + public void afterUnmarshal(final Unmarshaller unmarshaller, final Object parent) { // The map must be navigable to allow name and version searching, unmarshaling returns a // hash map final NavigableMap<AxArtifactKey, AxContextSchema> navigableContextSchemas = new TreeMap<>(); @@ -208,28 +209,31 @@ public class AxContextSchemas extends AxConcept implements AxConceptGetter<AxCon AxValidationResult result = resultIn; if (key.equals(AxArtifactKey.getNullKey())) { - result.addValidationMessage( - new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key is a null key")); + result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, + "key is a null key")); } result = key.validate(result); if (schemas.size() == 0) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "contextSchemas may not be empty")); + "contextSchemas may not be empty")); } else { for (final Entry<AxArtifactKey, AxContextSchema> contextSchemaEntry : schemas.entrySet()) { if (contextSchemaEntry.getKey().equals(AxArtifactKey.getNullKey())) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "key on schemas entry " + contextSchemaEntry.getKey() + " may not be the null key")); + "key on schemas entry " + contextSchemaEntry.getKey() + + " may not be the null key")); } else if (contextSchemaEntry.getValue() == null) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "value on schemas entry " + contextSchemaEntry.getKey() + " may not be null")); + "value on schemas entry " + contextSchemaEntry.getKey() + " may not be null")); } else { if (!contextSchemaEntry.getKey().equals(contextSchemaEntry.getValue().getKey())) { - result.addValidationMessage(new AxValidationMessage(key, this.getClass(), - ValidationResult.INVALID, "key on schemas entry " + contextSchemaEntry.getKey() - + " does not equal entry key " + contextSchemaEntry.getValue().getKey())); + result.addValidationMessage( + new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, + "key on schemas entry " + contextSchemaEntry.getKey() + + " does not equal entry key " + + contextSchemaEntry.getValue().getKey())); } result = contextSchemaEntry.getValue().validate(result); @@ -291,7 +295,7 @@ public class AxContextSchemas extends AxConcept implements AxConceptGetter<AxCon final Map<AxArtifactKey, AxContextSchema> newcontextSchemas = new TreeMap<>(); for (final Entry<AxArtifactKey, AxContextSchema> contextSchemasEntry : schemas.entrySet()) { newcontextSchemas.put(new AxArtifactKey(contextSchemasEntry.getKey()), - new AxContextSchema(contextSchemasEntry.getValue())); + new AxContextSchema(contextSchemasEntry.getValue())); } copy.setSchemasMap(newcontextSchemas); @@ -393,7 +397,7 @@ public class AxContextSchemas extends AxConcept implements AxConceptGetter<AxCon @Override public AxContextSchema get(final String conceptKeyName, final String conceptKeyVersion) { return new AxConceptGetterImpl<>((NavigableMap<AxArtifactKey, AxContextSchema>) schemas).get(conceptKeyName, - conceptKeyVersion); + conceptKeyVersion); } /* @@ -414,6 +418,6 @@ public class AxContextSchemas extends AxConcept implements AxConceptGetter<AxCon @Override public Set<AxContextSchema> getAll(final String conceptKeyName, final String conceptKeyVersion) { return new AxConceptGetterImpl<>((NavigableMap<AxArtifactKey, AxContextSchema>) schemas).getAll(conceptKeyName, - conceptKeyVersion); + conceptKeyVersion); } } diff --git a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextAlbums.java b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextAlbums.java index 839e19835..6ba0b2fa6 100644 --- a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextAlbums.java +++ b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextAlbums.java @@ -35,6 +35,8 @@ import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum; import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbums; /** + * Context album tests. + * * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TestContextAlbums { @@ -62,7 +64,7 @@ public class TestContextAlbums { fail("test should throw an exception here"); } catch (final Exception e) { assertEquals("parameter \"scope\": value \"\", does not match regular expression \"[A-Za-z0-9\\-_]+\"", - e.getMessage()); + e.getMessage()); } album.setScope("NewAlbumScope"); @@ -114,9 +116,9 @@ public class TestContextAlbums { album.clean(); final AxContextAlbum clonedAlbum = new AxContextAlbum(album); - assertEquals( - "AxContextAlbum:(key=AxArtifactKey:(name=NewAlbumName,version=0.0.1),scope=NewAlbumScope,isWritable=true,itemSchema=AxArtifactKey:(name=AlbumSchemaName,version=0.0.1))", - clonedAlbum.toString()); + assertEquals("AxContextAlbum:(key=AxArtifactKey:(name=NewAlbumName,version=0.0.1)," + + "scope=NewAlbumScope,isWritable=true,itemSchema=" + + "AxArtifactKey:(name=AlbumSchemaName,version=0.0.1))", clonedAlbum.toString()); assertFalse(album.hashCode() == 0); @@ -134,13 +136,13 @@ public class TestContextAlbums { assertEquals(0, album.compareTo(clonedAlbum)); assertNotEquals(0, album.compareTo(null)); assertNotEquals(0, album.compareTo(new AxArtifactKey())); - assertNotEquals(0, - album.compareTo(new AxContextAlbum(new AxArtifactKey(), "Scope", false, AxArtifactKey.getNullKey()))); + assertNotEquals(0, album.compareTo( + new AxContextAlbum(new AxArtifactKey(), "Scope", false, AxArtifactKey.getNullKey()))); assertNotEquals(0, album.compareTo(new AxContextAlbum(newKey, "Scope", false, AxArtifactKey.getNullKey()))); + assertNotEquals(0, album + .compareTo(new AxContextAlbum(newKey, "NewAlbumScope", false, AxArtifactKey.getNullKey()))); assertNotEquals(0, - album.compareTo(new AxContextAlbum(newKey, "NewAlbumScope", false, AxArtifactKey.getNullKey()))); - assertNotEquals(0, - album.compareTo(new AxContextAlbum(newKey, "NewAlbumScope", true, AxArtifactKey.getNullKey()))); + album.compareTo(new AxContextAlbum(newKey, "NewAlbumScope", true, AxArtifactKey.getNullKey()))); assertEquals(0, album.compareTo(new AxContextAlbum(newKey, "NewAlbumScope", true, albumSchemaKey))); final AxContextAlbums albums = new AxContextAlbums(); @@ -182,8 +184,8 @@ public class TestContextAlbums { albums.clean(); final AxContextAlbums clonedAlbums = new AxContextAlbums(albums); - assertTrue(clonedAlbums.toString() - .startsWith("AxContextAlbums:(AxContextAlbums:(key=AxArtifactKey:(name=AlbumsKey,version=0.0.1)")); + assertTrue(clonedAlbums.toString().startsWith( + "AxContextAlbums:(AxContextAlbums:(key=AxArtifactKey:(name=AlbumsKey,version=0.0.1)")); assertFalse(albums.hashCode() == 0); diff --git a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextModel.java b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextModel.java index 163e50018..290183e5f 100644 --- a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextModel.java +++ b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextModel.java @@ -34,6 +34,8 @@ import org.onap.policy.apex.model.contextmodel.concepts.AxContextModel; import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas; /** + * Context model tests. + * * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TestContextModel { @@ -43,19 +45,21 @@ public class TestContextModel { assertNotNull(new AxContextModel()); assertNotNull(new AxContextModel(new AxArtifactKey())); assertNotNull(new AxContextModel(new AxArtifactKey(), new AxContextSchemas(), new AxKeyInformation())); - assertNotNull(new AxContextModel(new AxArtifactKey(), new AxContextSchemas(), new AxContextAlbums(), new AxKeyInformation())); - + assertNotNull(new AxContextModel(new AxArtifactKey(), new AxContextSchemas(), new AxContextAlbums(), + new AxKeyInformation())); + final AxArtifactKey modelKey = new AxArtifactKey("ModelKey", "0.0.1"); final AxArtifactKey schemasKey = new AxArtifactKey("SchemasKey", "0.0.1"); final AxArtifactKey albumsKey = new AxArtifactKey("SchemasKey", "0.0.1"); final AxArtifactKey keyInfoKey = new AxArtifactKey("SchemasKey", "0.0.1"); - final AxContextModel model = new AxContextModel(modelKey, new AxContextSchemas(schemasKey), new AxContextAlbums(albumsKey), new AxKeyInformation(keyInfoKey)); + final AxContextModel model = new AxContextModel(modelKey, new AxContextSchemas(schemasKey), + new AxContextAlbums(albumsKey), new AxKeyInformation(keyInfoKey)); model.register(); - + model.clean(); assertNotNull(model); assertEquals("AxContextModel:(AxContextModel:(key=AxArtifactKey:", model.toString().substring(0, 50)); - + final AxContextModel clonedModel = new AxContextModel(model); assertFalse(model.hashCode() == 0); @@ -64,19 +68,29 @@ public class TestContextModel { assertTrue(model.equals(clonedModel)); assertFalse(model.equals("Hello")); assertFalse(model.equals(new AxContextModel(new AxArtifactKey()))); - assertFalse(model.equals(new AxContextModel(new AxArtifactKey(), new AxContextSchemas(), new AxContextAlbums(), new AxKeyInformation()))); - assertFalse(model.equals(new AxContextModel(modelKey, new AxContextSchemas(), new AxContextAlbums(), new AxKeyInformation()))); - assertFalse(model.equals(new AxContextModel(modelKey, new AxContextSchemas(), new AxContextAlbums(), new AxKeyInformation(keyInfoKey)))); - assertFalse(model.equals(new AxContextModel(modelKey, new AxContextSchemas(schemasKey), new AxContextAlbums(), new AxKeyInformation(keyInfoKey)))); - assertTrue(model.equals(new AxContextModel(modelKey, new AxContextSchemas(schemasKey), new AxContextAlbums(albumsKey), new AxKeyInformation(keyInfoKey)))); + assertFalse(model.equals(new AxContextModel(new AxArtifactKey(), new AxContextSchemas(), new AxContextAlbums(), + new AxKeyInformation()))); + assertFalse(model.equals(new AxContextModel(modelKey, new AxContextSchemas(), new AxContextAlbums(), + new AxKeyInformation()))); + assertFalse(model.equals(new AxContextModel(modelKey, new AxContextSchemas(), new AxContextAlbums(), + new AxKeyInformation(keyInfoKey)))); + assertFalse(model.equals(new AxContextModel(modelKey, new AxContextSchemas(schemasKey), new AxContextAlbums(), + new AxKeyInformation(keyInfoKey)))); + assertTrue(model.equals(new AxContextModel(modelKey, new AxContextSchemas(schemasKey), + new AxContextAlbums(albumsKey), new AxKeyInformation(keyInfoKey)))); assertEquals(0, model.compareTo(model)); assertEquals(0, model.compareTo(clonedModel)); assertNotEquals(0, model.compareTo(new AxArtifactKey())); - assertNotEquals(0, model.compareTo(new AxContextModel(new AxArtifactKey(), new AxContextSchemas(), new AxContextAlbums(), new AxKeyInformation()))); - assertNotEquals(0, model.compareTo(new AxContextModel(modelKey, new AxContextSchemas(), new AxContextAlbums(), new AxKeyInformation()))); - assertNotEquals(0, model.compareTo(new AxContextModel(modelKey, new AxContextSchemas(), new AxContextAlbums(), new AxKeyInformation(keyInfoKey)))); - assertNotEquals(0, model.compareTo(new AxContextModel(modelKey, new AxContextSchemas(schemasKey), new AxContextAlbums(), new AxKeyInformation(keyInfoKey)))); - assertEquals(0, model.compareTo(new AxContextModel(modelKey, new AxContextSchemas(schemasKey), new AxContextAlbums(albumsKey), new AxKeyInformation(keyInfoKey)))); + assertNotEquals(0, model.compareTo(new AxContextModel(new AxArtifactKey(), new AxContextSchemas(), + new AxContextAlbums(), new AxKeyInformation()))); + assertNotEquals(0, model.compareTo(new AxContextModel(modelKey, new AxContextSchemas(), new AxContextAlbums(), + new AxKeyInformation()))); + assertNotEquals(0, model.compareTo(new AxContextModel(modelKey, new AxContextSchemas(), new AxContextAlbums(), + new AxKeyInformation(keyInfoKey)))); + assertNotEquals(0, model.compareTo(new AxContextModel(modelKey, new AxContextSchemas(schemasKey), + new AxContextAlbums(), new AxKeyInformation(keyInfoKey)))); + assertEquals(0, model.compareTo(new AxContextModel(modelKey, new AxContextSchemas(schemasKey), + new AxContextAlbums(albumsKey), new AxKeyInformation(keyInfoKey)))); } } diff --git a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextSchemas.java b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextSchemas.java index 02dfd6fb1..a8dde7781 100644 --- a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextSchemas.java +++ b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextSchemas.java @@ -35,7 +35,7 @@ import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema; import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas; /** - * @author Liam Fallon (liam.fallon@ericsson.com) + * Context schema tests. */ public class TestContextSchemas { @@ -44,8 +44,8 @@ public class TestContextSchemas { assertNotNull(new AxContextSchema()); assertNotNull(new AxContextSchema(new AxArtifactKey(), "SchemaFlavour", "SchemaDefinition")); - final AxContextSchema schema = - new AxContextSchema(new AxArtifactKey("SchemaName", "0.0.1"), "SchemaFlavour", "SchemaDefinition"); + final AxContextSchema schema = new AxContextSchema(new AxArtifactKey("SchemaName", "0.0.1"), "SchemaFlavour", + "SchemaDefinition"); assertNotNull(schema); final AxArtifactKey newKey = new AxArtifactKey("NewSchemaName", "0.0.1"); @@ -57,9 +57,8 @@ public class TestContextSchemas { schema.setSchemaFlavour(""); fail("test should throw an exception here"); } catch (final Exception e) { - assertEquals( - "parameter \"schemaFlavour\": value \"\", does not match regular expression \"[A-Za-z0-9\\-_]+\"", - e.getMessage()); + assertEquals("parameter \"schemaFlavour\": value \"\", " + + "does not match regular expression \"[A-Za-z0-9\\-_]+\"", e.getMessage()); } schema.setSchemaFlavour("NewSchemaFlavour"); @@ -105,16 +104,16 @@ public class TestContextSchemas { schema.clean(); final AxContextSchema clonedSchema = new AxContextSchema(schema); - assertEquals( - "AxContextSchema:(key=AxArtifactKey:(name=NewSchemaName,version=0.0.1),schemaFlavour=NewSchemaFlavour,schemaDefinition=NewSchemaDefinition)", - clonedSchema.toString()); + assertEquals("AxContextSchema:(key=AxArtifactKey:(name=NewSchemaName,version=0.0.1)," + + "schemaFlavour=NewSchemaFlavour,schemaDefinition=NewSchemaDefinition)", + clonedSchema.toString()); assertFalse(schema.hashCode() == 0); assertTrue(schema.equals(schema)); assertTrue(schema.equals(clonedSchema)); assertFalse(schema.equals(null)); - assertFalse(schema.equals("Hello")); + assertFalse(schema.equals((Object) "Hello")); assertFalse(schema.equals(new AxContextSchema(new AxArtifactKey(), "Flavour", "Def"))); assertFalse(schema.equals(new AxContextSchema(newKey, "Flavour", "Def"))); assertFalse(schema.equals(new AxContextSchema(newKey, "NewSchemaFlavour", "Def"))); @@ -169,14 +168,14 @@ public class TestContextSchemas { final AxContextSchemas clonedSchemas = new AxContextSchemas(schemas); assertTrue(clonedSchemas.toString() - .startsWith("AxContextSchemas:(key=AxArtifactKey:(name=SchemasKey,version=0.0.1),")); + .startsWith("AxContextSchemas:(key=AxArtifactKey:(name=SchemasKey,version=0.0.1),")); assertFalse(schemas.hashCode() == 0); assertTrue(schemas.equals(schemas)); assertTrue(schemas.equals(clonedSchemas)); assertFalse(schemas.equals(null)); - assertFalse(schemas.equals("Hello")); + assertFalse(schemas.equals((Object) "Hello")); assertFalse(schemas.equals(new AxContextSchemas(new AxArtifactKey()))); assertEquals(0, schemas.compareTo(schemas)); diff --git a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestApexContextModel.java b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestApexContextModel.java index 10609ec9b..94a36844f 100644 --- a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestApexContextModel.java +++ b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestApexContextModel.java @@ -34,10 +34,21 @@ import org.onap.policy.apex.model.basicmodel.dao.DaoParameters; import org.onap.policy.apex.model.basicmodel.test.TestApexModel; import org.onap.policy.apex.model.contextmodel.concepts.AxContextModel; +/** + * Apex context model tests. + * + * @author liam + * + */ public class TestApexContextModel { private Connection connection; TestApexModel<AxContextModel> testApexModel; + /** + * Set up tests. + * + * @throws Exception a testing exception + */ @Before public void setup() throws Exception { Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance(); @@ -83,17 +94,17 @@ public class TestApexContextModel { } @Test - public void testModelWriteReadXML() throws Exception { + public void testModelWriteReadXml() throws Exception { testApexModel.testApexModelWriteReadXml(); } @Test - public void testModelWriteReadJSON() throws Exception { + public void testModelWriteReadJson() throws Exception { testApexModel.testApexModelWriteReadJson(); } @Test - public void testModelWriteReadJPA() throws Exception { + public void testModelWriteReadJpa() throws Exception { final DaoParameters DaoParameters = new DaoParameters(); DaoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao"); DaoParameters.setPersistenceUnit("DAOTest"); @@ -104,24 +115,39 @@ public class TestApexContextModel { private static final String VALID_MODEL_STRING = "***validation of model successful***"; private static final String OBSERVATION_MODEL_STRING = "\n" - + "***observations noted during validation of model***\n" - + "AxArtifactKey:(name=contextAlbum1,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo:OBSERVATION:description is blank\n" - + "********************************"; + + "***observations noted during validation of model***\n" + + "AxArtifactKey:(name=contextAlbum1,version=0.0.1):" + + "org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo:OBSERVATION:description is blank\n" + + "********************************"; private static final String WARNING_MODEL_STRING = "\n" + "***warnings issued during validation of model***\n" - + "AxArtifactKey:(name=contextAlbum1,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo:WARNING:UUID is a zero UUID: 00000000-0000-0000-0000-000000000000\n" - + "********************************"; + + "AxArtifactKey:(name=contextAlbum1,version=0.0.1):" + + "org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo:WARNING:" + + "UUID is a zero UUID: 00000000-0000-0000-0000-000000000000\n" + + "********************************"; private static final String INVALID_MODEL_STRING = "\n" + "***validation of model failed***\n" - + "AxArtifactKey:(name=StringType,version=0.0.1):org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema:INVALID:no schemaDefinition specified, schemaDefinition may not be blank\n" - + "AxArtifactKey:(name=contextAlbum0,version=0.0.1):org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum:INVALID:scope is not defined\n" - + "********************************"; + + "AxArtifactKey:(name=StringType,version=0.0.1):" + + "org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema:INVALID:" + + "no schemaDefinition specified, schemaDefinition may not be blank\n" + + "AxArtifactKey:(name=contextAlbum0,version=0.0.1):" + + "org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum:INVALID:" + + "scope is not defined\n" + "********************************"; private static final String INVALID_MODEL_MALSTRUCTURED_STRING = "\n" + "***validation of model failed***\n" - + "AxArtifactKey:(name=ContextModel,version=0.0.1):org.onap.policy.apex.model.contextmodel.concepts.AxContextModel:INVALID:key information not found for key AxArtifactKey:(name=contextAlbum1,version=0.0.2)\n" - + "AxArtifactKey:(name=contextAlbum1,version=0.0.1):org.onap.policy.apex.model.contextmodel.concepts.AxContextModel:WARNING:key not found for key information entry\n" - + "AxArtifactKey:(name=ContextSchemas,version=0.0.1):org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas:INVALID:key on schemas entry AxArtifactKey:(name=MapType,version=0.0.1) does not equal entry key AxArtifactKey:(name=MapType,version=0.0.2)\n" - + "AxArtifactKey:(name=contextAlbums,version=0.0.1):org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbums:INVALID:key on context album entry key AxArtifactKey:(name=contextAlbum1,version=0.0.1) does not equal context album value key AxArtifactKey:(name=contextAlbum1,version=0.0.2)\n" - + "********************************"; + + "AxArtifactKey:(name=ContextModel,version=0.0.1):" + + "org.onap.policy.apex.model.contextmodel.concepts.AxContextModel:INVALID:" + + "key information not found for key AxArtifactKey:(name=contextAlbum1,version=0.0.2)\n" + + "AxArtifactKey:(name=contextAlbum1,version=0.0.1):" + + "org.onap.policy.apex.model.contextmodel.concepts.AxContextModel:WARNING:" + + "key not found for key information entry\n" + "AxArtifactKey:(name=ContextSchemas,version=0.0.1):" + + "org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas:INVALID:" + + "key on schemas entry AxArtifactKey:(name=MapType,version=0.0.1) " + + "does not equal entry key AxArtifactKey:(name=MapType,version=0.0.2)\n" + + "AxArtifactKey:(name=contextAlbums,version=0.0.1):" + + "org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbums:INVALID:" + + "key on context album entry key AxArtifactKey:(name=contextAlbum1,version=0.0.1) " + + "does not equal context album value key AxArtifactKey:(name=contextAlbum1,version=0.0.2)\n" + + "********************************"; } diff --git a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestContextComparison.java b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestContextComparison.java index 794cfa9f7..65295c13b 100644 --- a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestContextComparison.java +++ b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestContextComparison.java @@ -33,6 +33,8 @@ import org.onap.policy.apex.model.contextmodel.handling.ContextComparer; import org.onap.policy.apex.model.utilities.comparison.KeyedMapDifference; /** + * Test context comparisons. + * * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TestContextComparison { @@ -42,122 +44,145 @@ public class TestContextComparison { private AxContextModel shellModel; private AxContextModel singleEntryModel; + /** + * Set up tests. + */ @Before public void getContext() { final TestContextComparisonFactory factory = new TestContextComparisonFactory(); - emptyModel = factory.getEmptyModel(); - fullModel = factory.getFullModel(); + emptyModel = factory.getEmptyModel(); + fullModel = factory.getFullModel(); noGlobalContextModel = factory.getNoGlobalContextModel(); - shellModel = factory.getShellModel(); - singleEntryModel = factory.getSingleEntryModel(); + shellModel = factory.getShellModel(); + singleEntryModel = factory.getSingleEntryModel(); } - + @Test public void testEmptyEmpty() { - final KeyedMapDifference<AxArtifactKey, AxContextSchema> schemaResult = new ContextComparer().compare(emptyModel.getSchemas(), emptyModel.getSchemas()); + final KeyedMapDifference<AxArtifactKey, AxContextSchema> schemaResult = new ContextComparer() + .compare(emptyModel.getSchemas(), emptyModel.getSchemas()); assertNotNull(schemaResult); assertTrue(emptyModel.getSchemas().getSchemasMap().equals(schemaResult.getIdenticalValues())); - final KeyedMapDifference<AxArtifactKey, AxContextAlbum> albumResult = new ContextComparer().compare(emptyModel.getAlbums(), emptyModel.getAlbums()); + final KeyedMapDifference<AxArtifactKey, AxContextAlbum> albumResult = new ContextComparer() + .compare(emptyModel.getAlbums(), emptyModel.getAlbums()); assertNotNull(albumResult); assertTrue(emptyModel.getAlbums().getAlbumsMap().equals(albumResult.getIdenticalValues())); } - + @Test public void testEmptyFull() { - final KeyedMapDifference<AxArtifactKey, AxContextSchema> schemaResult = new ContextComparer().compare(emptyModel.getSchemas(), fullModel.getSchemas()); + final KeyedMapDifference<AxArtifactKey, AxContextSchema> schemaResult = new ContextComparer() + .compare(emptyModel.getSchemas(), fullModel.getSchemas()); assertNotNull(schemaResult); assertTrue(fullModel.getSchemas().getSchemasMap().equals(schemaResult.getRightOnly())); - final KeyedMapDifference<AxArtifactKey, AxContextAlbum> albumResult = new ContextComparer().compare(emptyModel.getAlbums(), fullModel.getAlbums()); + final KeyedMapDifference<AxArtifactKey, AxContextAlbum> albumResult = new ContextComparer() + .compare(emptyModel.getAlbums(), fullModel.getAlbums()); assertNotNull(albumResult); assertTrue(fullModel.getAlbums().getAlbumsMap().equals(albumResult.getRightOnly())); } - + @Test public void testFullEmpty() { - final KeyedMapDifference<AxArtifactKey, AxContextSchema> schemaResult = new ContextComparer().compare(fullModel.getSchemas(), emptyModel.getSchemas()); + final KeyedMapDifference<AxArtifactKey, AxContextSchema> schemaResult = new ContextComparer() + .compare(fullModel.getSchemas(), emptyModel.getSchemas()); assertNotNull(schemaResult); assertTrue(fullModel.getSchemas().getSchemasMap().equals(schemaResult.getLeftOnly())); - final KeyedMapDifference<AxArtifactKey, AxContextAlbum> albumResult = new ContextComparer().compare(fullModel.getAlbums(), emptyModel.getAlbums()); + final KeyedMapDifference<AxArtifactKey, AxContextAlbum> albumResult = new ContextComparer() + .compare(fullModel.getAlbums(), emptyModel.getAlbums()); assertNotNull(albumResult); assertTrue(fullModel.getAlbums().getAlbumsMap().equals(albumResult.getLeftOnly())); } - + @Test public void testEmptyNoGlobalContext() { - final KeyedMapDifference<AxArtifactKey, AxContextSchema> schemaResult = new ContextComparer().compare(emptyModel.getSchemas(), noGlobalContextModel.getSchemas()); + final KeyedMapDifference<AxArtifactKey, AxContextSchema> schemaResult = new ContextComparer() + .compare(emptyModel.getSchemas(), noGlobalContextModel.getSchemas()); assertNotNull(schemaResult); assertTrue(noGlobalContextModel.getSchemas().getSchemasMap().equals(schemaResult.getRightOnly())); - final KeyedMapDifference<AxArtifactKey, AxContextAlbum> albumResult = new ContextComparer().compare(emptyModel.getAlbums(), noGlobalContextModel.getAlbums()); + final KeyedMapDifference<AxArtifactKey, AxContextAlbum> albumResult = new ContextComparer() + .compare(emptyModel.getAlbums(), noGlobalContextModel.getAlbums()); assertNotNull(albumResult); assertTrue(noGlobalContextModel.getAlbums().getAlbumsMap().equals(albumResult.getRightOnly())); } - + @Test public void testNoGlobalContextEmpty() { - final KeyedMapDifference<AxArtifactKey, AxContextSchema> schemaResult = new ContextComparer().compare(noGlobalContextModel.getSchemas(), emptyModel.getSchemas()); + final KeyedMapDifference<AxArtifactKey, AxContextSchema> schemaResult = new ContextComparer() + .compare(noGlobalContextModel.getSchemas(), emptyModel.getSchemas()); assertNotNull(schemaResult); assertTrue(noGlobalContextModel.getSchemas().getSchemasMap().equals(schemaResult.getLeftOnly())); - final KeyedMapDifference<AxArtifactKey, AxContextAlbum> albumResult = new ContextComparer().compare(noGlobalContextModel.getAlbums(), emptyModel.getAlbums()); + final KeyedMapDifference<AxArtifactKey, AxContextAlbum> albumResult = new ContextComparer() + .compare(noGlobalContextModel.getAlbums(), emptyModel.getAlbums()); assertNotNull(albumResult); assertTrue(noGlobalContextModel.getAlbums().getAlbumsMap().equals(albumResult.getLeftOnly())); } - + @Test public void testEmptyShell() { - final KeyedMapDifference<AxArtifactKey, AxContextSchema> schemaResult = new ContextComparer().compare(emptyModel.getSchemas(), shellModel.getSchemas()); + final KeyedMapDifference<AxArtifactKey, AxContextSchema> schemaResult = new ContextComparer() + .compare(emptyModel.getSchemas(), shellModel.getSchemas()); assertNotNull(schemaResult); assertTrue(shellModel.getSchemas().getSchemasMap().equals(schemaResult.getRightOnly())); - final KeyedMapDifference<AxArtifactKey, AxContextAlbum> albumResult = new ContextComparer().compare(emptyModel.getAlbums(), shellModel.getAlbums()); + final KeyedMapDifference<AxArtifactKey, AxContextAlbum> albumResult = new ContextComparer() + .compare(emptyModel.getAlbums(), shellModel.getAlbums()); assertNotNull(albumResult); assertTrue(shellModel.getAlbums().getAlbumsMap().equals(albumResult.getRightOnly())); } - + @Test public void testShellEmpty() { - final KeyedMapDifference<AxArtifactKey, AxContextSchema> schemaResult = new ContextComparer().compare(shellModel.getSchemas(), emptyModel.getSchemas()); + final KeyedMapDifference<AxArtifactKey, AxContextSchema> schemaResult = new ContextComparer() + .compare(shellModel.getSchemas(), emptyModel.getSchemas()); assertNotNull(schemaResult); assertTrue(shellModel.getSchemas().getSchemasMap().equals(schemaResult.getLeftOnly())); - final KeyedMapDifference<AxArtifactKey, AxContextAlbum> albumResult = new ContextComparer().compare(shellModel.getAlbums(), emptyModel.getAlbums()); + final KeyedMapDifference<AxArtifactKey, AxContextAlbum> albumResult = new ContextComparer() + .compare(shellModel.getAlbums(), emptyModel.getAlbums()); assertNotNull(albumResult); assertTrue(shellModel.getAlbums().getAlbumsMap().equals(albumResult.getLeftOnly())); } - + @Test public void testEmptySingleEntry() { - final KeyedMapDifference<AxArtifactKey, AxContextSchema> schemaResult = new ContextComparer().compare(emptyModel.getSchemas(), singleEntryModel.getSchemas()); + final KeyedMapDifference<AxArtifactKey, AxContextSchema> schemaResult = new ContextComparer() + .compare(emptyModel.getSchemas(), singleEntryModel.getSchemas()); assertNotNull(schemaResult); assertTrue(singleEntryModel.getSchemas().getSchemasMap().equals(schemaResult.getRightOnly())); - final KeyedMapDifference<AxArtifactKey, AxContextAlbum> albumResult = new ContextComparer().compare(emptyModel.getAlbums(), singleEntryModel.getAlbums()); + final KeyedMapDifference<AxArtifactKey, AxContextAlbum> albumResult = new ContextComparer() + .compare(emptyModel.getAlbums(), singleEntryModel.getAlbums()); assertNotNull(albumResult); assertTrue(singleEntryModel.getAlbums().getAlbumsMap().equals(albumResult.getRightOnly())); } - + @Test public void testSingleEntryEmpty() { - final KeyedMapDifference<AxArtifactKey, AxContextSchema> schemaResult = new ContextComparer().compare(singleEntryModel.getSchemas(), emptyModel.getSchemas()); + final KeyedMapDifference<AxArtifactKey, AxContextSchema> schemaResult = new ContextComparer() + .compare(singleEntryModel.getSchemas(), emptyModel.getSchemas()); assertNotNull(schemaResult); assertTrue(singleEntryModel.getSchemas().getSchemasMap().equals(schemaResult.getLeftOnly())); - final KeyedMapDifference<AxArtifactKey, AxContextAlbum> albumResult = new ContextComparer().compare(singleEntryModel.getAlbums(), emptyModel.getAlbums()); + final KeyedMapDifference<AxArtifactKey, AxContextAlbum> albumResult = new ContextComparer() + .compare(singleEntryModel.getAlbums(), emptyModel.getAlbums()); assertNotNull(albumResult); assertTrue(singleEntryModel.getAlbums().getAlbumsMap().equals(albumResult.getLeftOnly())); } - + @Test public void testFullFull() { - final KeyedMapDifference<AxArtifactKey, AxContextSchema> schemaResult = new ContextComparer().compare(fullModel.getSchemas(), fullModel.getSchemas()); + final KeyedMapDifference<AxArtifactKey, AxContextSchema> schemaResult = new ContextComparer() + .compare(fullModel.getSchemas(), fullModel.getSchemas()); assertNotNull(schemaResult); assertTrue(fullModel.getSchemas().getSchemasMap().equals(schemaResult.getIdenticalValues())); - final KeyedMapDifference<AxArtifactKey, AxContextAlbum> albumResult = new ContextComparer().compare(fullModel.getAlbums(), fullModel.getAlbums()); + final KeyedMapDifference<AxArtifactKey, AxContextAlbum> albumResult = new ContextComparer() + .compare(fullModel.getAlbums(), fullModel.getAlbums()); assertNotNull(albumResult); assertTrue(fullModel.getAlbums().getAlbumsMap().equals(albumResult.getIdenticalValues())); } diff --git a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestContextComparisonFactory.java b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestContextComparisonFactory.java index 2c6f8e172..f7c7a1345 100644 --- a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestContextComparisonFactory.java +++ b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestContextComparisonFactory.java @@ -26,12 +26,16 @@ import org.onap.policy.apex.model.contextmodel.concepts.AxContextModel; import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema; /** - * This class creates sample Policy Models + * This class creates sample Policy Models. * * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TestContextComparisonFactory { + /** + * Get a full context model. + * @return the model + */ public AxContextModel getFullModel() { final AxContextSchema testContextSchema000 = new AxContextSchema(new AxArtifactKey("TestContextSchema000", "0.0.1"), "JAVA", @@ -69,6 +73,10 @@ public class TestContextComparisonFactory { return new AxContextModel(new AxArtifactKey("Context", "0.0.1")); } + /** + * Get a skeleton model. + * @return The model + */ public AxContextModel getShellModel() { final AxContextSchema testContextSchema000 = new AxContextSchema(new AxArtifactKey("TestContextSchema000", "0.0.1"), "JAVA", @@ -88,6 +96,10 @@ public class TestContextComparisonFactory { return contextModel; } + /** + * Get a single entry model. + * @return The single entry model + */ public AxContextModel getSingleEntryModel() { final AxContextSchema testContextSchema000 = new AxContextSchema(new AxArtifactKey("TestContextSchema000", "0.0.1"), "JAVA", @@ -104,6 +116,10 @@ public class TestContextComparisonFactory { return contextModel; } + /** + * Get a model with no global entries. + * @return the model + */ public AxContextModel getNoGlobalContextModel() { final AxContextSchema testContextSchema000 = new AxContextSchema(new AxArtifactKey("TestContextSchema000", "0.0.1"), "JAVA", diff --git a/model/engine-model/src/main/java/org/onap/policy/apex/model/enginemodel/concepts/AxEngineModel.java b/model/engine-model/src/main/java/org/onap/policy/apex/model/enginemodel/concepts/AxEngineModel.java index b7733c6a3..9b015552a 100644 --- a/model/engine-model/src/main/java/org/onap/policy/apex/model/enginemodel/concepts/AxEngineModel.java +++ b/model/engine-model/src/main/java/org/onap/policy/apex/model/enginemodel/concepts/AxEngineModel.java @@ -55,8 +55,8 @@ import org.onap.policy.apex.model.utilities.Assertions; * is used by an Apex engine to pass its current execution state to any system that wishes to query * that information. The time stamp of the engine model is the time at which the state and * statistics of the engine were read. - * <p> - * Validation checks that the current state {@link AxEngineState} is defined and that the time stamp + * + * <p>Validation checks that the current state {@link AxEngineState} is defined and that the time stamp * is set on the engine model. */ @Entity @@ -100,7 +100,7 @@ public class AxEngineModel extends AxContextModel { } /** - * Copy constructor + * Copy constructor. * * @param copyConcept the concept to copy from */ diff --git a/model/engine-model/src/main/java/org/onap/policy/apex/model/enginemodel/concepts/AxEngineStats.java b/model/engine-model/src/main/java/org/onap/policy/apex/model/enginemodel/concepts/AxEngineStats.java index 077065bb5..896794ce7 100644 --- a/model/engine-model/src/main/java/org/onap/policy/apex/model/enginemodel/concepts/AxEngineStats.java +++ b/model/engine-model/src/main/java/org/onap/policy/apex/model/enginemodel/concepts/AxEngineStats.java @@ -108,7 +108,7 @@ public class AxEngineStats extends AxConcept { } /** - * Copy constructor + * Copy constructor. * * @param copyConcept the concept to copy from */ diff --git a/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/concepts/TestEngineModel.java b/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/concepts/TestEngineModel.java index 79537cfaf..2c1ab4bff 100644 --- a/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/concepts/TestEngineModel.java +++ b/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/concepts/TestEngineModel.java @@ -37,6 +37,7 @@ import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbums; import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas; /** + * Test engine models. * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TestEngineModel { diff --git a/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/concepts/TestEngineStats.java b/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/concepts/TestEngineStats.java index 6346e59f7..fb99e265b 100644 --- a/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/concepts/TestEngineStats.java +++ b/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/concepts/TestEngineStats.java @@ -34,6 +34,7 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult; /** + * Test engine statistics. * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TestEngineStats { diff --git a/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/handling/TestApexEngineModel.java b/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/handling/TestApexEngineModel.java index c8076aab7..10abbf3fe 100644 --- a/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/handling/TestApexEngineModel.java +++ b/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/handling/TestApexEngineModel.java @@ -38,6 +38,11 @@ public class TestApexEngineModel { private Connection connection; TestApexModel<AxEngineModel> testApexModel; + /** + * Set up the test. + * + * @throws Exception errors from test setup + */ @Before public void setup() throws Exception { Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance(); @@ -71,17 +76,17 @@ public class TestApexEngineModel { } @Test - public void testModelWriteReadXML() throws Exception { + public void testModelWriteReadXml() throws Exception { testApexModel.testApexModelWriteReadXml(); } @Test - public void testModelWriteReadJSON() throws Exception { + public void testModelWriteReadJson() throws Exception { testApexModel.testApexModelWriteReadJson(); } @Test - public void testModelWriteReadJPA() throws Exception { + public void testModelWriteReadJpa() throws Exception { final DaoParameters DaoParameters = new DaoParameters(); DaoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao"); DaoParameters.setPersistenceUnit("DAOTest"); @@ -92,11 +97,14 @@ public class TestApexEngineModel { private static final String VALID_MODEL_STRING = "***validation of model successful***"; private static final String INVALID_MODEL_STRING = "\n" + "***validation of model failed***\n" - + "AxArtifactKey:(name=AnEngine,version=0.0.1):org.onap.policy.apex.model.enginemodel.concepts.AxEngineModel:INVALID:AxEngineModel - state is UNDEFINED\n" - + "********************************"; + + "AxArtifactKey:(name=AnEngine,version=0.0.1):" + + "org.onap.policy.apex.model.enginemodel.concepts.AxEngineModel:INVALID:" + + "AxEngineModel - state is UNDEFINED\n" + "********************************"; private static final String INVALID_MODEL_MALSTRUCTURED_STRING = "\n" + "***validation of model failed***\n" - + "AxArtifactKey:(name=AnEngine,version=0.0.1):org.onap.policy.apex.model.enginemodel.concepts.AxEngineModel:INVALID:AxEngineModel - timestamp is not set\n" - + "AxArtifactKey:(name=AnEngine,version=0.0.1):org.onap.policy.apex.model.enginemodel.concepts.AxEngineModel:INVALID:AxEngineModel - state is UNDEFINED\n" - + "********************************"; + + "AxArtifactKey:(name=AnEngine,version=0.0.1):" + + "org.onap.policy.apex.model.enginemodel.concepts.AxEngineModel:INVALID:" + + "AxEngineModel - timestamp is not set\n" + "AxArtifactKey:(name=AnEngine,version=0.0.1):" + + "org.onap.policy.apex.model.enginemodel.concepts.AxEngineModel:INVALID:" + + "AxEngineModel - state is UNDEFINED\n" + "********************************"; } diff --git a/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/handling/TestApexEngineModelCreator.java b/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/handling/TestApexEngineModelCreator.java index 4a4a0cc88..732fd2235 100644 --- a/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/handling/TestApexEngineModelCreator.java +++ b/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/handling/TestApexEngineModelCreator.java @@ -82,6 +82,9 @@ public class TestApexEngineModelCreator implements TestApexModelCreator<AxEngine return engineModel; } + /** + * Get a malstructured model. + */ public AxEngineModel getMalstructuredModel() { final AxEngineModel engineModel = getModel(); diff --git a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvent.java b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvent.java index 4944f1b8a..099ee2260 100644 --- a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvent.java +++ b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvent.java @@ -53,20 +53,20 @@ import org.onap.policy.apex.model.utilities.Assertions; * This class defines an Apex event. An {@link AxEvent} is used to kick off execution of policies in Apex and is emitted * by policies when they completer execution. In addition, Apex uses {@link AxEvent} instances internally to pass * control from one Apex state to the next during execution. - * <p> - * The {@link AxArtifactKey} of an event uniquely identifies it in an Apex system and the name field in the key is the - * name of the event. - * <p> - * Each {@link AxEvent} has a name space, which is usually set to identify the domain of application of an event. For + * + * <p>The {@link AxArtifactKey} of an event uniquely identifies it in an Apex system and the name field in the key is + * the name of the event. + * + * <p>Each {@link AxEvent} has a name space, which is usually set to identify the domain of application of an event. For * example a 4G cell power event might have the name space {@code org.onap.radio.4g} and the name {@code PowerEvent}. * The source and target of the event are reserved to hold an identifier that defines the sender and receiver of an * event respectively. The definition and structure of these fields is reserved for future use and their use by * applications is currently not recommended. - * <p> - * The parameters that an event has are defined as a map of {@link AxField} instances. - * <p> - * Validation checks that the event key is valid. If name space is a blank string, a warning is issued. Blank source or - * target fields result in observations being issued. An event may not have any parameters. If it has parameters, the + * + * <p>The parameters that an event has are defined as a map of {@link AxField} instances. + * + * <p>Validation checks that the event key is valid. If name space is a blank string, a warning is issued. Blank source + * or target fields result in observations being issued. An event may not have any parameters. If it has parameters, the * name and value of each parameter entry is checked to ensure they are not null. Then the local name of each parameter * is checked to ensure it matches the event parameter key on the event. Finally, the parent key of each parameter is * checked to ensure it matches the event key. @@ -76,8 +76,8 @@ import org.onap.policy.apex.model.utilities.Assertions; @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name = "apexEvent", namespace = "http://www.onap.org/policy/apex-pdp") -@XmlType(name = "AxEvent", namespace = "http://www.onap.org/policy/apex-pdp", - propOrder = { "key", "nameSpace", "source", "target", "parameterMap" }) +@XmlType(name = "AxEvent", namespace = "http://www.onap.org/policy/apex-pdp", propOrder = + { "key", "nameSpace", "source", "target", "parameterMap" }) public class AxEvent extends AxConcept { private static final long serialVersionUID = -1460388382582984269L; @@ -116,7 +116,7 @@ public class AxEvent extends AxConcept { } /** - * Copy constructor + * Copy constructor. * * @param copyConcept the concept to copy from */ @@ -168,7 +168,7 @@ public class AxEvent extends AxConcept { * @param parameterMap the map of parameters that the event has */ public AxEvent(final AxArtifactKey key, final String nameSpace, final String source, final String target, - final SortedMap<String, AxField> parameterMap) { + final SortedMap<String, AxField> parameterMap) { super(); Assertions.argumentNotNull(key, "key may not be null"); Assertions.argumentNotNull(nameSpace, "nameSpace may not be null"); @@ -198,10 +198,10 @@ public class AxEvent extends AxConcept { * parameter map are not set. This method is called by JAXB after unmarshaling and is used to set the parent key of * the {@link AxField} instances in the parameter map to be the key of the event that contains them. * - * @param u the unmarshaler that is unmarshaling the model + * @param unmarshaler the unmarshaler that is unmarshaling the model * @param parent the parent object of this object in the unmarshaler */ - public void afterUnmarshal(final Unmarshaller u, final Object parent) { + public void afterUnmarshal(final Unmarshaller unmarshaler, final Object parent) { for (final AxField parameter : parameterMap.values()) { parameter.getKey().setParentArtifactKey(key); } @@ -343,34 +343,34 @@ public class AxEvent extends AxConcept { AxValidationResult result = resultIn; if (key.equals(AxArtifactKey.getNullKey())) { - result.addValidationMessage( - new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key is a null key")); + result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, + "key is a null key")); } result = key.validate(result); if (nameSpace.replaceAll(WHITESPACE_REGEXP, "").length() == 0) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.WARNING, - "nameSpace on event is blank")); + "nameSpace on event is blank")); } if (source.replaceAll(WHITESPACE_REGEXP, "").length() == 0) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.OBSERVATION, - "source on event is blank")); + "source on event is blank")); } if (target.replaceAll(WHITESPACE_REGEXP, "").length() == 0) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.OBSERVATION, - "target on event is blank")); + "target on event is blank")); } for (final Entry<String, AxField> eventParameterEntry : parameterMap.entrySet()) { if (eventParameterEntry.getKey() == null || eventParameterEntry.getKey().equals(AxKey.NULL_KEY_NAME)) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "key on parameter " + eventParameterEntry.getKey() + " may not be the null key")); + "key on parameter " + eventParameterEntry.getKey() + " may not be the null key")); } else if (eventParameterEntry.getValue() == null) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "value on parameter " + eventParameterEntry.getKey() + " may not be null")); + "value on parameter " + eventParameterEntry.getKey() + " may not be null")); } else { result = vaidateEventParameters(eventParameterEntry, result); } @@ -380,24 +380,25 @@ public class AxEvent extends AxConcept { } /** - * Validate an event parameter entry + * Validate an event parameter entry. * * @param eventParameterEntry the event parameter entry * @param result the validation result to append to * @return The validation result */ private AxValidationResult vaidateEventParameters(final Entry<String, AxField> eventParameterEntry, - final AxValidationResult result) { + final AxValidationResult result) { if (!eventParameterEntry.getKey().equals(eventParameterEntry.getValue().getKey().getLocalName())) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "key on parameter " + eventParameterEntry.getKey() + " does not equal parameter field local name " - + eventParameterEntry.getValue().getKey().getLocalName())); + "key on parameter " + eventParameterEntry.getKey() + + " does not equal parameter field local name " + + eventParameterEntry.getValue().getKey().getLocalName())); } if (!eventParameterEntry.getValue().getKey().getParentArtifactKey().equals(key)) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "parent key on parameter field " + eventParameterEntry.getValue().getKey() - + " does not equal event key")); + "parent key on parameter field " + eventParameterEntry.getValue().getKey() + + " does not equal event key")); } return eventParameterEntry.getValue().validate(result); diff --git a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEventModel.java b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEventModel.java index 3447ff8f9..cab46cd39 100644 --- a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEventModel.java +++ b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEventModel.java @@ -48,8 +48,8 @@ import org.onap.policy.apex.model.utilities.Assertions; * A container class for an Apex event model. This class is a container class that allows an Apex model to be * constructed that contains events and context and the key information for those events and context. The model contains * schema definitions and the definitions of events that use those schemas. - * <p> - * Validation runs {@link AxModel} validation on the model. In addition, the {@link AxContextSchemas} and + * + * <p>Validation runs {@link AxModel} validation on the model. In addition, the {@link AxContextSchemas} and * {@link AxEvents} validation is run on the context schemas and events in the model. */ @@ -86,7 +86,7 @@ public class AxEventModel extends AxModel { } /** - * Copy constructor + * Copy constructor. * * @param copyConcept the concept to copy from */ diff --git a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvents.java b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvents.java index df398c2c9..e973f2ead 100644 --- a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvents.java +++ b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvents.java @@ -55,16 +55,17 @@ import org.onap.policy.apex.model.utilities.Assertions; * events must have an {@link AxEvents} field. The {@link AxEvents} class implements the helper methods of the * {@link AxConceptGetter} interface to allow {@link AxEvents} instances to be retrieved by calling methods directly on * this class without referencing the contained map. - * <p> - * Validation checks that the container key is not null. An error is issued if no events are defined in the container. - * Each event entry is checked to ensure that its key and value are not null and that the key matches the key in the map - * value. Each event entry is then validated individually. + * + * <p>Validation checks that the container key is not null. An error is issued if no events are defined in the + * container. Each event entry is checked to ensure that its key and value are not null and that the key matches the key + * in the map value. Each event entry is then validated individually. */ @Entity @Table(name = "AxEvents") @XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "AxEvents", namespace = "http://www.onap.org/policy/apex-pdp", propOrder = { "key", "eventMap" }) +@XmlType(name = "AxEvents", namespace = "http://www.onap.org/policy/apex-pdp", propOrder = + { "key", "eventMap" }) public class AxEvents extends AxConcept implements AxConceptGetter<AxEvent> { private static final long serialVersionUID = 4290442590545820316L; @@ -93,7 +94,7 @@ public class AxEvents extends AxConcept implements AxConceptGetter<AxEvent> { } /** - * Copy constructor + * Copy constructor. * * @param copyConcept the concept to copy from */ @@ -131,10 +132,10 @@ public class AxEvents extends AxConcept implements AxConceptGetter<AxEvent> { * method is called by JAXB after unmarshaling and is used to convert the hash map to a {@link NavigableMap} so that * it will work with the {@link AxConceptGetter} interface. * - * @param u the unmarshaler that is unmarshaling the model + * @param unmarshaler the unmarshaler that is unmarshaling the model * @param parent the parent object of this object in the unmarshaler */ - public void afterUnmarshal(final Unmarshaller u, final Object parent) { + public void afterUnmarshal(final Unmarshaller unmarshaler, final Object parent) { // The map must be navigable to allow name and version searching, unmarshaling returns a hash map final NavigableMap<AxArtifactKey, AxEvent> navigableEventMap = new TreeMap<>(); navigableEventMap.putAll(eventMap); @@ -209,28 +210,30 @@ public class AxEvents extends AxConcept implements AxConceptGetter<AxEvent> { AxValidationResult result = resultIn; if (key.equals(AxArtifactKey.getNullKey())) { - result.addValidationMessage( - new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key is a null key")); + result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, + "key is a null key")); } result = key.validate(result); if (eventMap.size() == 0) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "eventMap may not be empty")); + "eventMap may not be empty")); } else { for (final Entry<AxArtifactKey, AxEvent> eventEntry : eventMap.entrySet()) { if (eventEntry.getKey().equals(AxArtifactKey.getNullKey())) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "key on event entry " + eventEntry.getKey() + " may not be the null key")); + "key on event entry " + eventEntry.getKey() + " may not be the null key")); } else if (eventEntry.getValue() == null) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "value on event entry " + eventEntry.getKey() + " may not be null")); + "value on event entry " + eventEntry.getKey() + " may not be null")); } else { if (!eventEntry.getKey().equals(eventEntry.getValue().getKey())) { - result.addValidationMessage(new AxValidationMessage(key, this.getClass(), - ValidationResult.INVALID, "key on event entry key " + eventEntry.getKey() - + " does not equal event value key " + eventEntry.getValue().getKey())); + result.addValidationMessage( + new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, + "key on event entry key " + eventEntry.getKey() + + " does not equal event value key " + + eventEntry.getValue().getKey())); } result = eventEntry.getValue().validate(result); @@ -394,7 +397,7 @@ public class AxEvents extends AxConcept implements AxConceptGetter<AxEvent> { @Override public AxEvent get(final String conceptKeyName, final String conceptKeyVersion) { return new AxConceptGetterImpl<>((NavigableMap<AxArtifactKey, AxEvent>) eventMap).get(conceptKeyName, - conceptKeyVersion); + conceptKeyVersion); } /* @@ -415,6 +418,6 @@ public class AxEvents extends AxConcept implements AxConceptGetter<AxEvent> { @Override public Set<AxEvent> getAll(final String conceptKeyName, final String conceptKeyVersion) { return new AxConceptGetterImpl<>((NavigableMap<AxArtifactKey, AxEvent>) eventMap).getAll(conceptKeyName, - conceptKeyVersion); + conceptKeyVersion); } } diff --git a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxField.java b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxField.java index 4aee0ebca..6b38ca7a8 100644 --- a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxField.java +++ b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxField.java @@ -52,12 +52,12 @@ import org.onap.policy.apex.model.utilities.Assertions; /** * In Apex, a field is an input or output parameter to or from a concept. For example, the parameters of an event are * fields and the input and output of a task is defined as a collection of fields. - * <p> - * A field has an {@link AxReferenceKey} key that defines its name and parent, and a {@link AxArtifactKey} key to a + * + * <p>A field has an {@link AxReferenceKey} key that defines its name and parent, and a {@link AxArtifactKey} key to a * context schema that defines the structure of the data atom that holds the value of the field. Fields can be specified * as being optional but are mandatory by default. - * <p> - * Validation checks that the field key and the field schema reference key are not null. + * + * <p>Validation checks that the field key and the field schema reference key are not null. */ @Entity @Table(name = "AxField") @@ -65,8 +65,8 @@ import org.onap.policy.apex.model.utilities.Assertions; @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name = "apexField", namespace = "http://www.onap.org/policy/apex-pdp") -@XmlType(name = "AxField", namespace = "http://www.onap.org/policy/apex-pdp", - propOrder = { "key", "fieldSchemaKey", "optional" }) +@XmlType(name = "AxField", namespace = "http://www.onap.org/policy/apex-pdp", propOrder = + { "key", "fieldSchemaKey", "optional" }) public class AxField extends AxConcept { private static final String KEY_MAY_NOT_BE_NULL = "key may not be null"; @@ -113,7 +113,7 @@ public class AxField extends AxConcept { } /** - * Copy constructor + * Copy constructor. * * @param copyConcept the concept to copy from */ @@ -269,15 +269,15 @@ public class AxField extends AxConcept { AxValidationResult result = resultIn; if (key.equals(AxReferenceKey.getNullKey())) { - result.addValidationMessage( - new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key is a null key")); + result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, + "key is a null key")); } result = key.validate(result); if (fieldSchemaKey.equals(AxArtifactKey.getNullKey())) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "fieldSchemaKey is a null key: " + fieldSchemaKey)); + "fieldSchemaKey is a null key: " + fieldSchemaKey)); } return fieldSchemaKey.validate(result); } diff --git a/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/TestEventModel.java b/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/TestEventModel.java index dbff0666d..a5d3a349a 100644 --- a/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/TestEventModel.java +++ b/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/TestEventModel.java @@ -34,6 +34,7 @@ import org.onap.policy.apex.model.eventmodel.concepts.AxEventModel; import org.onap.policy.apex.model.eventmodel.concepts.AxEvents; /** + * Test event models. * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TestEventModel { diff --git a/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/TestEvents.java b/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/TestEvents.java index 309359fa2..36ef6ade5 100644 --- a/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/TestEvents.java +++ b/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/TestEvents.java @@ -40,6 +40,7 @@ import org.onap.policy.apex.model.eventmodel.concepts.AxEvents; import org.onap.policy.apex.model.eventmodel.concepts.AxField; /** + * Test events. * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TestEvents { diff --git a/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/TestField.java b/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/TestField.java index 8d2e8a686..75fced1b0 100644 --- a/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/TestField.java +++ b/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/TestField.java @@ -36,6 +36,8 @@ import org.onap.policy.apex.model.eventmodel.concepts.AxInputField; import org.onap.policy.apex.model.eventmodel.concepts.AxOutputField; /** + * Test fields. + * * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TestField { @@ -106,9 +108,9 @@ public class TestField { field.clean(); final AxField clonedField = new AxField(field); - assertEquals( - "AxField:(key=AxReferenceKey:(parentKeyName=FieldName,parentKeyVersion=0.0.1,parentLocalName=PLN,localName=LN),fieldSchemaKey=AxArtifactKey:(name=SchemaName,version=0.0.1),optional=true)", - clonedField.toString()); + assertEquals("AxField:(key=AxReferenceKey:(parentKeyName=FieldName,parentKeyVersion=0.0.1," + + "parentLocalName=PLN,localName=LN),fieldSchemaKey=" + + "AxArtifactKey:(name=SchemaName,version=0.0.1),optional=true)", clonedField.toString()); assertFalse(field.hashCode() == 0); @@ -126,7 +128,7 @@ public class TestField { assertNotEquals(0, field.compareTo(new AxArtifactKey())); assertNotEquals(0, field.compareTo(null)); assertNotEquals(0, - field.compareTo(new AxField(AxReferenceKey.getNullKey(), AxArtifactKey.getNullKey(), false))); + field.compareTo(new AxField(AxReferenceKey.getNullKey(), AxArtifactKey.getNullKey(), false))); assertNotEquals(0, field.compareTo(new AxField(fieldKey, AxArtifactKey.getNullKey(), false))); assertNotEquals(0, field.compareTo(new AxField(fieldKey, schemaKey, false))); assertEquals(0, field.compareTo(new AxField(fieldKey, schemaKey, true))); diff --git a/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/TestApexEventModel.java b/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/TestApexEventModel.java index abb3a3480..643bdfaa2 100644 --- a/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/TestApexEventModel.java +++ b/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/TestApexEventModel.java @@ -38,6 +38,11 @@ public class TestApexEventModel { private Connection connection; TestApexModel<AxEventModel> testApexModel; + /** + * Set up the test. + * + * @throws Exception exceptions from the test + */ @Before public void setup() throws Exception { Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance(); @@ -83,17 +88,17 @@ public class TestApexEventModel { } @Test - public void testModelWriteReadXML() throws Exception { + public void testModelWriteReadXml() throws Exception { testApexModel.testApexModelWriteReadXml(); } @Test - public void testModelWriteReadJSON() throws Exception { + public void testModelWriteReadJson() throws Exception { testApexModel.testApexModelWriteReadJson(); } @Test - public void testModelWriteReadJPA() throws Exception { + public void testModelWriteReadJpa() throws Exception { final DaoParameters DaoParameters = new DaoParameters(); DaoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao"); DaoParameters.setPersistenceUnit("DAOTest"); @@ -104,81 +109,200 @@ public class TestApexEventModel { private static final String VALID_MODEL_STRING = "***validation of model successful***"; private static final String OBSERVATION_MODEL_STRING = "\n" - + "***observations noted during validation of model***\n" - + "AxArtifactKey:(name=event0,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n" - + "AxArtifactKey:(name=event0,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n" - + "AxArtifactKey:(name=event1,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n" - + "AxArtifactKey:(name=event1,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n" - + "AxArtifactKey:(name=event2,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n" - + "AxArtifactKey:(name=event2,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n" - + "********************************"; + + "***observations noted during validation of model***\n" + + "AxArtifactKey:(name=event0,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n" + + "AxArtifactKey:(name=event0,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n" + + "AxArtifactKey:(name=event1,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n" + + "AxArtifactKey:(name=event1,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n" + + "AxArtifactKey:(name=event2,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n" + + "AxArtifactKey:(name=event2,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n" + + "********************************"; private static final String WARNING_MODEL_STRING = "\n" + "***warnings issued during validation of model***\n" - + "AxArtifactKey:(name=event0,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:WARNING:nameSpace on event is blank\n" - + "AxArtifactKey:(name=event0,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n" - + "AxArtifactKey:(name=event0,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n" - + "AxArtifactKey:(name=event1,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:WARNING:nameSpace on event is blank\n" - + "AxArtifactKey:(name=event1,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n" - + "AxArtifactKey:(name=event1,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n" - + "AxArtifactKey:(name=event2,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:WARNING:nameSpace on event is blank\n" - + "AxArtifactKey:(name=event2,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n" - + "AxArtifactKey:(name=event2,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n" - + "********************************"; + + "AxArtifactKey:(name=event0,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:WARNING:nameSpace on event is blank\n" + + "AxArtifactKey:(name=event0,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n" + + "AxArtifactKey:(name=event0,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n" + + "AxArtifactKey:(name=event1,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:WARNING:nameSpace on event is blank\n" + + "AxArtifactKey:(name=event1,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n" + + "AxArtifactKey:(name=event1,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n" + + "AxArtifactKey:(name=event2,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:WARNING:nameSpace on event is blank\n" + + "AxArtifactKey:(name=event2,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n" + + "AxArtifactKey:(name=event2,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n" + + "********************************"; private static final String INVALID_MODEL_STRING = "\n" + "***validation of model failed***\n" - + "AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation:INVALID:keyInfoMap may not be empty\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for key AxArtifactKey:(name=smallEventModel,version=0.0.1)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for key AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for key AxArtifactKey:(name=Schemas,version=0.0.1)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for key AxArtifactKey:(name=BigIntType,version=0.0.1)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for key AxArtifactKey:(name=BooleanType,version=0.0.1)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for key AxArtifactKey:(name=IntType,version=0.0.1)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for key AxArtifactKey:(name=MapType,version=0.0.1)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for key AxArtifactKey:(name=SetType,version=0.0.1)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for key AxArtifactKey:(name=StringType,version=0.0.1)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for key AxArtifactKey:(name=smallEventMap,version=0.0.1)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for key AxArtifactKey:(name=event0,version=0.0.1)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for parent key of key AxReferenceKey:(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=par0)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for parent key of key AxReferenceKey:(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=par1)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for parent key of key AxReferenceKey:(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=par2)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for parent key of key AxReferenceKey:(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=par3)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for parent key of key AxReferenceKey:(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=par4)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for parent key of key AxReferenceKey:(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=par5)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for parent key of key AxReferenceKey:(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=par6)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for key AxArtifactKey:(name=event1,version=0.0.1)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for parent key of key AxReferenceKey:(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=theOnlyPar)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:duplicate key AxArtifactKey:(name=event1,version=0.0.1) found\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for key AxArtifactKey:(name=event1,version=0.0.1)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:duplicate key AxReferenceKey:(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=theOnlyPar) found\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for parent key of key AxReferenceKey:(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=theOnlyPar)\n" - + "AxArtifactKey:(name=event0,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n" - + "AxArtifactKey:(name=event0,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n" - + "AxArtifactKey:(name=event1,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n" - + "AxArtifactKey:(name=event1,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n" - + "AxArtifactKey:(name=event1,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:INVALID:parent key on parameter field AxReferenceKey:(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=theOnlyPar) does not equal event key\n" - + "AxArtifactKey:(name=smallEventMap,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvents:INVALID:key on event entry key AxArtifactKey:(name=event2,version=0.0.1) does not equal event value key AxArtifactKey:(name=event1,version=0.0.1)\n" - + "AxArtifactKey:(name=event1,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n" - + "AxArtifactKey:(name=event1,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n" - + "AxArtifactKey:(name=event1,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:INVALID:parent key on parameter field AxReferenceKey:(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=theOnlyPar) does not equal event key\n" - + "********************************"; + + "AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1):" + + "org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation:INVALID:" + + "keyInfoMap may not be empty\n" + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" + + "key information not found for key AxArtifactKey:(name=smallEventModel,version=0.0.1)\n" + + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" + + "key information not found for key AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1)\n" + + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" + + "key information not found for key AxArtifactKey:(name=Schemas,version=0.0.1)\n" + + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" + + "key information not found for key AxArtifactKey:(name=BigIntType,version=0.0.1)\n" + + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" + + "key information not found for key AxArtifactKey:(name=BooleanType,version=0.0.1)\n" + + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" + + "key information not found for key AxArtifactKey:(name=IntType,version=0.0.1)\n" + + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" + + "key information not found for key AxArtifactKey:(name=MapType,version=0.0.1)\n" + + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" + + "key information not found for key AxArtifactKey:(name=SetType,version=0.0.1)\n" + + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" + + "key information not found for key AxArtifactKey:(name=StringType,version=0.0.1)\n" + + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" + + "key information not found for key AxArtifactKey:(name=smallEventMap,version=0.0.1)\n" + + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" + + "key information not found for key AxArtifactKey:(name=event0,version=0.0.1)\n" + + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" + + "key information not found for parent key of key AxReferenceKey:" + + "(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=par0)\n" + + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" + + "key information not found for parent key of key AxReferenceKey:" + + "(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=par1)\n" + + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" + + "key information not found for parent key of key AxReferenceKey:" + + "(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=par2)\n" + + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" + + "key information not found for parent key of key AxReferenceKey:" + + "(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=par3)\n" + + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" + + "key information not found for parent key of key AxReferenceKey:" + + "(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=par4)\n" + + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" + + "key information not found for parent key of key AxReferenceKey:" + + "(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=par5)\n" + + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" + + "key information not found for parent key of key AxReferenceKey:" + + "(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=par6)\n" + + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" + + "key information not found for key AxArtifactKey:(name=event1,version=0.0.1)\n" + + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" + + "key information not found for parent key of key AxReferenceKey:" + + "(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=theOnlyPar)\n" + + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" + + "duplicate key AxArtifactKey:(name=event1,version=0.0.1) found\n" + + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" + + "key information not found for key AxArtifactKey:(name=event1,version=0.0.1)\n" + + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" + + "duplicate key AxReferenceKey:(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL," + + "localName=theOnlyPar) found\n" + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" + + "key information not found for parent key of key AxReferenceKey:" + + "(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=theOnlyPar)\n" + + "AxArtifactKey:(name=event0,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n" + + "AxArtifactKey:(name=event0,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n" + + "AxArtifactKey:(name=event1,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n" + + "AxArtifactKey:(name=event1,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n" + + "AxArtifactKey:(name=event1,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:INVALID:" + + "parent key on parameter field AxReferenceKey:(parentKeyName=event0,parentKeyVersion=0.0.1," + + "parentLocalName=NULL,localName=theOnlyPar) does not equal event key\n" + + "AxArtifactKey:(name=smallEventMap,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEvents:INVALID:" + + "key on event entry key AxArtifactKey:(name=event2,version=0.0.1) does not equal event value key " + + "AxArtifactKey:(name=event1,version=0.0.1)\n" + "AxArtifactKey:(name=event1,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n" + + "AxArtifactKey:(name=event1,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n" + + "AxArtifactKey:(name=event1,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:INVALID:" + + "parent key on parameter field AxReferenceKey:(parentKeyName=event0,parentKeyVersion=0.0.1," + + "parentLocalName=NULL,localName=theOnlyPar) does not equal event key\n" + + "********************************"; private static final String INVALID_MODEL_MALSTRUCTURED_STRING = "\n" + "***validation of model failed***\n" - + "AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation:INVALID:keyInfoMap may not be empty\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for key AxArtifactKey:(name=smallEventModel,version=0.0.1)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for key AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for key AxArtifactKey:(name=Schemas,version=0.0.1)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for key AxArtifactKey:(name=SetType,version=0.0.1)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for key AxArtifactKey:(name=smallEventMap,version=0.0.1)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for key AxArtifactKey:(name=event1,version=0.0.1)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for parent key of key AxReferenceKey:(parentKeyName=event1,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=theOnlyPar)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:duplicate key AxArtifactKey:(name=event1,version=0.0.1) found\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for key AxArtifactKey:(name=event1,version=0.0.1)\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:duplicate key AxReferenceKey:(parentKeyName=event1,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=theOnlyPar) found\n" - + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for parent key of key AxReferenceKey:(parentKeyName=event1,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=theOnlyPar)\n" - + "AxArtifactKey:(name=event1,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n" - + "AxArtifactKey:(name=event1,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n" - + "AxArtifactKey:(name=smallEventMap,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvents:INVALID:key on event entry key AxArtifactKey:(name=event2,version=0.0.1) does not equal event value key AxArtifactKey:(name=event1,version=0.0.1)\n" - + "AxArtifactKey:(name=event1,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n" - + "AxArtifactKey:(name=event1,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n" - + "********************************"; + + "AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1):" + + "org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation:INVALID:" + + "keyInfoMap may not be empty\n" + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" + + "key information not found for key AxArtifactKey:(name=smallEventModel,version=0.0.1)\n" + + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" + + "key information not found for key AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1)\n" + + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" + + "key information not found for key AxArtifactKey:(name=Schemas,version=0.0.1)\n" + + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" + + "key information not found for key AxArtifactKey:(name=SetType,version=0.0.1)\n" + + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" + + "key information not found for key AxArtifactKey:(name=smallEventMap,version=0.0.1)\n" + + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" + + "key information not found for key AxArtifactKey:(name=event1,version=0.0.1)\n" + + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" + + "key information not found for parent key of key AxReferenceKey:" + + "(parentKeyName=event1,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=theOnlyPar)\n" + + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" + + "duplicate key AxArtifactKey:(name=event1,version=0.0.1) found\n" + + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" + + "key information not found for key AxArtifactKey:(name=event1,version=0.0.1)\n" + + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" + + "duplicate key AxReferenceKey:(parentKeyName=event1,parentKeyVersion=0.0.1," + + "parentLocalName=NULL,localName=theOnlyPar) found\n" + + "AxArtifactKey:(name=smallEventModel,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:" + + "key information not found for parent key of key AxReferenceKey:" + + "(parentKeyName=event1,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=theOnlyPar)\n" + + "AxArtifactKey:(name=event1,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n" + + "AxArtifactKey:(name=event1,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n" + + "AxArtifactKey:(name=smallEventMap,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEvents:INVALID:" + + "key on event entry key AxArtifactKey:(name=event2,version=0.0.1) does not equal event value key " + + "AxArtifactKey:(name=event1,version=0.0.1)\n" + "AxArtifactKey:(name=event1,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n" + + "AxArtifactKey:(name=event1,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n" + + "********************************"; } diff --git a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/ApexAPIResult.java b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/ApexApiResult.java index 2e4328fc5..ae2609e1d 100644 --- a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/ApexAPIResult.java +++ b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/ApexApiResult.java @@ -39,14 +39,14 @@ import javax.xml.bind.annotation.XmlRootElement; */ @XmlRootElement @XmlAccessorType(XmlAccessType.NONE) -public class ApexAPIResult { +public class ApexApiResult { /** * This enumeration is used to represent the result status of a call on the {@link ApexModel} * API. */ @XmlEnum(value = String.class) - public enum RESULT { + public enum Result { /** The method call succeeded. */ SUCCESS, /** The method call succeeded and all operations are now completed. */ @@ -73,14 +73,14 @@ public class ApexAPIResult { OTHER_ERROR } - private RESULT result; + private Result result; private List<String> messages = new ArrayList<>(); /** * The Default Constructor creates a result for a successful operation with no messages. */ - public ApexAPIResult() { - result = RESULT.SUCCESS; + public ApexApiResult() { + result = Result.SUCCESS; } /** @@ -88,7 +88,7 @@ public class ApexAPIResult { * * @param result the result status to use on this result */ - public ApexAPIResult(final RESULT result) { + public ApexApiResult(final Result result) { this.result = result; } @@ -98,7 +98,7 @@ public class ApexAPIResult { * @param result the result status to use on this result * @param message the message to return with the result */ - public ApexAPIResult(final RESULT result, final String message) { + public ApexApiResult(final Result result, final String message) { this.result = result; addMessage(message); } @@ -111,7 +111,7 @@ public class ApexAPIResult { * @param result the result status to use on this result * @param throwable the throwable object from which to add the message and stack trace */ - public ApexAPIResult(final RESULT result, final Throwable throwable) { + public ApexApiResult(final Result result, final Throwable throwable) { this.result = result; addThrowable(throwable); } @@ -125,7 +125,7 @@ public class ApexAPIResult { * @param message the message to return with the result * @param throwable the throwable object from which to add the message and stack trace */ - public ApexAPIResult(final RESULT result, final String message, final Throwable throwable) { + public ApexApiResult(final Result result, final String message, final Throwable throwable) { this.result = result; addMessage(message); addThrowable(throwable); @@ -138,8 +138,8 @@ public class ApexAPIResult { * @return true, if the result indicates the API operation succeeded */ @XmlAttribute(required = true) - public boolean isOK() { - return result == RESULT.SUCCESS || result == RESULT.FINISHED; + public boolean isOk() { + return result == Result.SUCCESS || result == Result.FINISHED; } /** @@ -148,8 +148,8 @@ public class ApexAPIResult { * * @return true, if the result indicates the API operation did not succeed */ - public boolean isNOK() { - return !isOK(); + public boolean isNok() { + return !isOk(); } /** @@ -158,7 +158,7 @@ public class ApexAPIResult { * @return the result status */ @XmlAttribute(required = true) - public RESULT getResult() { + public Result getResult() { return result; } @@ -167,7 +167,7 @@ public class ApexAPIResult { * * @param result the result status */ - public void setResult(final RESULT result) { + public void setResult(final Result result) { this.result = result; } @@ -236,11 +236,11 @@ public class ApexAPIResult { } /** - * Gets a representation of the {@link ApexAPIResult} instance as a JSON string. + * Gets a representation of the {@link ApexApiResult} instance as a JSON string. * * @return the result instance JSON string */ - public String toJSON() { + public String toJson() { final StringBuilder builder = new StringBuilder(); builder.append("{\n"); diff --git a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/ApexEditorAPI.java b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/ApexEditorApi.java index 617cbc786..741fbdc90 100644 --- a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/ApexEditorAPI.java +++ b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/ApexEditorApi.java @@ -23,7 +23,7 @@ package org.onap.policy.apex.model.modelapi; /** * The Interface ApexEditorAPI is used to manipulate Apex models. */ -public interface ApexEditorAPI { +public interface ApexEditorApi { /* * Model API Methods */ @@ -37,7 +37,7 @@ public interface ApexEditorAPI { * @param description model description, set to null to generate a description * @return result of the operation */ - ApexAPIResult createModel(final String name, final String version, final String uuid, final String description); + ApexApiResult createModel(final String name, final String version, final String uuid, final String description); /** * Update model. @@ -48,28 +48,28 @@ public interface ApexEditorAPI { * @param description policy description, set to null to not update * @return result of the operation */ - ApexAPIResult updateModel(final String name, final String version, final String uuid, final String description); + ApexApiResult updateModel(final String name, final String version, final String uuid, final String description); /** * Get the key of an Apex model. * * @return the result of the operation */ - ApexAPIResult getModelKey(); + ApexApiResult getModelKey(); /** * List an Apex model. * * @return the result of the operation */ - ApexAPIResult listModel(); + ApexApiResult listModel(); /** * Delete an Apex model, clear all the concepts in the model. * * @return the result of the operation */ - ApexAPIResult deleteModel(); + ApexApiResult deleteModel(); /* * Key Information API Methods @@ -85,7 +85,7 @@ public interface ApexEditorAPI { * @param description key information description, set to null to generate a description * @return result of the operation */ - ApexAPIResult createKeyInformation(final String name, final String version, final String uuid, + ApexApiResult createKeyInformation(final String name, final String version, final String uuid, final String description); /** @@ -98,7 +98,7 @@ public interface ApexEditorAPI { * @param description key information description, set to null to not update * @return result of the operation */ - ApexAPIResult updateKeyInformation(final String name, final String version, final String uuid, + ApexApiResult updateKeyInformation(final String name, final String version, final String uuid, final String description); /** @@ -109,7 +109,7 @@ public interface ApexEditorAPI { * all versions * @return result of the operation */ - ApexAPIResult listKeyInformation(final String name, final String version); + ApexApiResult listKeyInformation(final String name, final String version); /** * Delete key information. @@ -119,7 +119,7 @@ public interface ApexEditorAPI { * versions * @return result of the operation */ - ApexAPIResult deleteKeyInformation(final String name, final String version); + ApexApiResult deleteKeyInformation(final String name, final String version); /** * Validate key information. @@ -129,7 +129,7 @@ public interface ApexEditorAPI { * versions * @return result of the operation */ - ApexAPIResult validateKeyInformation(final String name, final String version); + ApexApiResult validateKeyInformation(final String name, final String version); /* * Context Schema API Methods @@ -146,7 +146,7 @@ public interface ApexEditorAPI { * @param description context schema description, set to null to generate a description * @return result of the operation */ - ApexAPIResult createContextSchema(final String name, final String version, final String schemaFlavour, + ApexApiResult createContextSchema(final String name, final String version, final String schemaFlavour, final String schemaDefinition, final String uuid, final String description); /** @@ -160,7 +160,7 @@ public interface ApexEditorAPI { * @param description context schema description, set to null to not update * @return result of the operation */ - ApexAPIResult updateContextSchema(final String name, final String version, final String schemaFlavour, + ApexApiResult updateContextSchema(final String name, final String version, final String schemaFlavour, final String schemaDefinition, final String uuid, final String description); /** @@ -170,7 +170,7 @@ public interface ApexEditorAPI { * @param version starting version of the context schema, set to null to list all versions * @return result of the operation */ - ApexAPIResult listContextSchemas(final String name, final String version); + ApexApiResult listContextSchemas(final String name, final String version); /** * Delete a context schema. @@ -179,7 +179,7 @@ public interface ApexEditorAPI { * @param version version of the context schema, set to null to delete all versions * @return result of the operation */ - ApexAPIResult deleteContextSchema(final String name, final String version); + ApexApiResult deleteContextSchema(final String name, final String version); /** * Validate context schemas. @@ -188,7 +188,7 @@ public interface ApexEditorAPI { * @param version starting version of the context schema, set to null to list all versions * @return result of the operation */ - ApexAPIResult validateContextSchemas(final String name, final String version); + ApexApiResult validateContextSchemas(final String name, final String version); /* * Event API Methods @@ -206,7 +206,7 @@ public interface ApexEditorAPI { * @param description event description, set to null to generate a description * @return result of the operation */ - ApexAPIResult createEvent(final String name, final String version, final String nameSpace, final String source, + ApexApiResult createEvent(final String name, final String version, final String nameSpace, final String source, final String target, final String uuid, final String description); /** @@ -221,7 +221,7 @@ public interface ApexEditorAPI { * @param description event description, set to null to not update * @return result of the operation */ - ApexAPIResult updateEvent(final String name, final String version, final String nameSpace, final String source, + ApexApiResult updateEvent(final String name, final String version, final String nameSpace, final String source, final String target, final String uuid, final String description); /** @@ -231,7 +231,7 @@ public interface ApexEditorAPI { * @param version starting version of the event, set to null to list all versions * @return result of the operation */ - ApexAPIResult listEvent(final String name, final String version); + ApexApiResult listEvent(final String name, final String version); /** * Delete an event. @@ -240,7 +240,7 @@ public interface ApexEditorAPI { * @param version version of the event, set to null to delete all versions * @return result of the operation */ - ApexAPIResult deleteEvent(final String name, final String version); + ApexApiResult deleteEvent(final String name, final String version); /** * Validate events. @@ -249,7 +249,7 @@ public interface ApexEditorAPI { * @param version starting version of the event, set to null to list all versions * @return result of the operation */ - ApexAPIResult validateEvent(final String name, final String version); + ApexApiResult validateEvent(final String name, final String version); /** * Create an event parameter. @@ -263,7 +263,7 @@ public interface ApexEditorAPI { * @param optional true if the event parameter is optional, false otherwise * @return result of the operation */ - ApexAPIResult createEventPar(final String name, final String version, final String parName, + ApexApiResult createEventPar(final String name, final String version, final String parName, final String contextSchemaName, final String contextSchemaVersion, boolean optional); /** @@ -274,7 +274,7 @@ public interface ApexEditorAPI { * @param parName name of the parameter, set to null to list all parameters of the event * @return result of the operation */ - ApexAPIResult listEventPar(final String name, final String version, final String parName); + ApexApiResult listEventPar(final String name, final String version, final String parName); /** * Delete an event parameter. @@ -284,7 +284,7 @@ public interface ApexEditorAPI { * @param parName of the parameter, set to null to delete all parameters * @return result of the operation */ - ApexAPIResult deleteEventPar(final String name, final String version, final String parName); + ApexApiResult deleteEventPar(final String name, final String version, final String parName); /* * Context Album API Methods @@ -306,7 +306,7 @@ public interface ApexEditorAPI { * @return result of the operation */ // CHECKSTYLE:OFF: checkstyle:parameterNumber - ApexAPIResult createContextAlbum(final String name, final String version, final String scope, final String writable, + ApexApiResult createContextAlbum(final String name, final String version, final String scope, final String writable, final String contextSchemaName, final String contextSchemaVersion, final String uuid, final String description); // CHECKSTYLE:ON: checkstyle:parameterNumber @@ -327,7 +327,7 @@ public interface ApexEditorAPI { * @return result of the operation */ // CHECKSTYLE:OFF: checkstyle:parameterNumber - ApexAPIResult updateContextAlbum(final String name, final String version, final String scope, final String writable, + ApexApiResult updateContextAlbum(final String name, final String version, final String scope, final String writable, final String contextSchemaName, final String contextSchemaVersion, final String uuid, final String description); // CHECKSTYLE:ON: checkstyle:parameterNumber @@ -339,7 +339,7 @@ public interface ApexEditorAPI { * @param version starting version of the context album, set to null to list all versions * @return result of the operation */ - ApexAPIResult listContextAlbum(final String name, final String version); + ApexApiResult listContextAlbum(final String name, final String version); /** * Delete a context album. @@ -348,7 +348,7 @@ public interface ApexEditorAPI { * @param version version of the context album, set to null to delete versions * @return result of the operation */ - ApexAPIResult deleteContextAlbum(final String name, final String version); + ApexApiResult deleteContextAlbum(final String name, final String version); /** * Validate context albums. @@ -357,7 +357,7 @@ public interface ApexEditorAPI { * @param version starting version of the context album, set to null to list all versions * @return result of the operation */ - ApexAPIResult validateContextAlbum(final String name, final String version); + ApexApiResult validateContextAlbum(final String name, final String version); /* * Task API Methods @@ -372,7 +372,7 @@ public interface ApexEditorAPI { * @param description task description, set to null to generate a description * @return result of the operation */ - ApexAPIResult createTask(final String name, final String version, final String uuid, final String description); + ApexApiResult createTask(final String name, final String version, final String uuid, final String description); /** * Update a task. @@ -383,7 +383,7 @@ public interface ApexEditorAPI { * @param description task description, set to null to not update * @return result of the operation */ - ApexAPIResult updateTask(final String name, final String version, final String uuid, final String description); + ApexApiResult updateTask(final String name, final String version, final String uuid, final String description); /** * List tasks. @@ -392,7 +392,7 @@ public interface ApexEditorAPI { * @param version starting version of the task, set to null to list all versions * @return result of the operation */ - ApexAPIResult listTask(final String name, final String version); + ApexApiResult listTask(final String name, final String version); /** * Delete a task. @@ -401,7 +401,7 @@ public interface ApexEditorAPI { * @param version version of the task, set to null to use the latest version * @return result of the operation */ - ApexAPIResult deleteTask(final String name, final String version); + ApexApiResult deleteTask(final String name, final String version); /** * Validate tasks. @@ -410,7 +410,7 @@ public interface ApexEditorAPI { * @param version starting version of the task, set to null to list all versions * @return result of the operation */ - ApexAPIResult validateTask(final String name, final String version); + ApexApiResult validateTask(final String name, final String version); /** * Create logic for a task. @@ -422,7 +422,7 @@ public interface ApexEditorAPI { * @param logic the source code for the logic of the task * @return result of the operation */ - ApexAPIResult createTaskLogic(final String name, final String version, final String logicFlavour, + ApexApiResult createTaskLogic(final String name, final String version, final String logicFlavour, final String logic); /** @@ -434,7 +434,7 @@ public interface ApexEditorAPI { * @param logic the source code for the logic of the task, set to null to not update * @return result of the operation */ - ApexAPIResult updateTaskLogic(final String name, final String version, final String logicFlavour, + ApexApiResult updateTaskLogic(final String name, final String version, final String logicFlavour, final String logic); /** @@ -444,7 +444,7 @@ public interface ApexEditorAPI { * @param version version of the task, set to null to list the latest version * @return result of the operation */ - ApexAPIResult listTaskLogic(final String name, final String version); + ApexApiResult listTaskLogic(final String name, final String version); /** * Delete logic for a task. @@ -453,7 +453,7 @@ public interface ApexEditorAPI { * @param version version of the task, set to null to use the latest version * @return result of the operation */ - ApexAPIResult deleteTaskLogic(final String name, final String version); + ApexApiResult deleteTaskLogic(final String name, final String version); /** * Create a task input field. @@ -467,7 +467,7 @@ public interface ApexEditorAPI { * @param optional true if the task field is optional, false otherwise * @return result of the operation */ - ApexAPIResult createTaskInputField(final String name, final String version, final String fieldName, + ApexApiResult createTaskInputField(final String name, final String version, final String fieldName, final String contextSchemaName, final String contextSchemaVersion, boolean optional); /** @@ -479,7 +479,7 @@ public interface ApexEditorAPI { * task * @return result of the operation */ - ApexAPIResult listTaskInputField(final String name, final String version, final String fieldName); + ApexApiResult listTaskInputField(final String name, final String version, final String fieldName); /** * Delete a task input field. @@ -489,7 +489,7 @@ public interface ApexEditorAPI { * @param fieldName of the input field, set to null to delete all input fields * @return result of the operation */ - ApexAPIResult deleteTaskInputField(final String name, final String version, final String fieldName); + ApexApiResult deleteTaskInputField(final String name, final String version, final String fieldName); /** * Create a task output field. @@ -503,7 +503,7 @@ public interface ApexEditorAPI { * @param optional true if the task field is optional, false otherwise * @return result of the operation */ - ApexAPIResult createTaskOutputField(final String name, final String version, final String fieldName, + ApexApiResult createTaskOutputField(final String name, final String version, final String fieldName, final String contextSchemaName, final String contextSchemaVersion, boolean optional); /** @@ -515,7 +515,7 @@ public interface ApexEditorAPI { * task * @return result of the operation */ - ApexAPIResult listTaskOutputField(final String name, final String version, final String fieldName); + ApexApiResult listTaskOutputField(final String name, final String version, final String fieldName); /** * Delete a task output field. @@ -525,7 +525,7 @@ public interface ApexEditorAPI { * @param fieldName of the output field, set to null to delete all output fields * @return result of the operation */ - ApexAPIResult deleteTaskOutputField(final String name, final String version, final String fieldName); + ApexApiResult deleteTaskOutputField(final String name, final String version, final String fieldName); /** * Create a task parameter. @@ -536,7 +536,7 @@ public interface ApexEditorAPI { * @param defaultValue of the parameter * @return result of the operation */ - ApexAPIResult createTaskParameter(final String name, final String version, final String parName, + ApexApiResult createTaskParameter(final String name, final String version, final String parName, final String defaultValue); /** @@ -547,7 +547,7 @@ public interface ApexEditorAPI { * @param parName name of the parameter, set to null to list all parameters of the task * @return result of the operation */ - ApexAPIResult listTaskParameter(final String name, final String version, final String parName); + ApexApiResult listTaskParameter(final String name, final String version, final String parName); /** * Delete a task parameter. @@ -557,7 +557,7 @@ public interface ApexEditorAPI { * @param parName of the parameter, set to null to delete all task parameters * @return result of the operation */ - ApexAPIResult deleteTaskParameter(final String name, final String version, final String parName); + ApexApiResult deleteTaskParameter(final String name, final String version, final String parName); /** * Create a task context album reference. @@ -569,7 +569,7 @@ public interface ApexEditorAPI { * to null to use the latest version * @return result of the operation */ - ApexAPIResult createTaskContextRef(final String name, final String version, final String contextAlbumName, + ApexApiResult createTaskContextRef(final String name, final String version, final String contextAlbumName, final String contextAlbumVersion); /** @@ -583,7 +583,7 @@ public interface ApexEditorAPI { * to null to use the latest version * @return result of the operation */ - ApexAPIResult listTaskContextRef(final String name, final String version, final String contextAlbumName, + ApexApiResult listTaskContextRef(final String name, final String version, final String contextAlbumName, final String contextAlbumVersion); /** @@ -597,7 +597,7 @@ public interface ApexEditorAPI { * to null to use the latest version * @return result of the operation */ - ApexAPIResult deleteTaskContextRef(final String name, final String version, final String contextAlbumName, + ApexApiResult deleteTaskContextRef(final String name, final String version, final String contextAlbumName, final String contextAlbumVersion); /* @@ -615,7 +615,7 @@ public interface ApexEditorAPI { * @param description policy description, set to null to generate a description * @return result of the operation */ - ApexAPIResult createPolicy(final String name, final String version, final String template, final String firstState, + ApexApiResult createPolicy(final String name, final String version, final String template, final String firstState, final String uuid, final String description); /** @@ -629,7 +629,7 @@ public interface ApexEditorAPI { * @param description policy description, set to null to not update * @return result of the operation */ - ApexAPIResult updatePolicy(final String name, final String version, final String template, final String firstState, + ApexApiResult updatePolicy(final String name, final String version, final String template, final String firstState, final String uuid, final String description); /** @@ -639,7 +639,7 @@ public interface ApexEditorAPI { * @param version starting version of the policy, set to null to list all versions * @return result of the operation */ - ApexAPIResult listPolicy(final String name, final String version); + ApexApiResult listPolicy(final String name, final String version); /** * Delete a policy. @@ -648,7 +648,7 @@ public interface ApexEditorAPI { * @param version version of the policy, set to null to use the latest version * @return result of the operation */ - ApexAPIResult deletePolicy(final String name, final String version); + ApexApiResult deletePolicy(final String name, final String version); /** * Validate policies. @@ -657,7 +657,7 @@ public interface ApexEditorAPI { * @param version starting version of the policy, set to null to list all versions * @return result of the operation */ - ApexAPIResult validatePolicy(final String name, final String version); + ApexApiResult validatePolicy(final String name, final String version); /** * Create a policy state. @@ -672,7 +672,7 @@ public interface ApexEditorAPI { * @param defaltTaskVersion the default task version, set to null to use the latest version * @return result of the operation */ - ApexAPIResult createPolicyState(final String name, final String version, final String stateName, + ApexApiResult createPolicyState(final String name, final String version, final String stateName, final String triggerName, final String triggerVersion, final String defaultTaskName, final String defaltTaskVersion); @@ -689,7 +689,7 @@ public interface ApexEditorAPI { * @param defaltTaskVersion the default task version, set to use latest version of default task * @return result of the operation */ - ApexAPIResult updatePolicyState(final String name, final String version, final String stateName, + ApexApiResult updatePolicyState(final String name, final String version, final String stateName, final String triggerName, final String triggerVersion, final String defaultTaskName, final String defaltTaskVersion); @@ -701,7 +701,7 @@ public interface ApexEditorAPI { * @param stateName of the state, set to null to list all states of the policy * @return result of the operation */ - ApexAPIResult listPolicyState(final String name, final String version, final String stateName); + ApexApiResult listPolicyState(final String name, final String version, final String stateName); /** * Delete a policy state. @@ -711,7 +711,7 @@ public interface ApexEditorAPI { * @param stateName of the state, set to null to delete all states * @return result of the operation */ - ApexAPIResult deletePolicyState(final String name, final String version, final String stateName); + ApexApiResult deletePolicyState(final String name, final String version, final String stateName); /** * Create task selection logic for a state. @@ -724,7 +724,7 @@ public interface ApexEditorAPI { * @param logic the source code for the logic of the state * @return result of the operation */ - ApexAPIResult createPolicyStateTaskSelectionLogic(final String name, final String version, final String stateName, + ApexApiResult createPolicyStateTaskSelectionLogic(final String name, final String version, final String stateName, final String logicFlavour, final String logic); /** @@ -737,7 +737,7 @@ public interface ApexEditorAPI { * @param logic the source code for the logic of the state, set to null to not update * @return result of the operation */ - ApexAPIResult updatePolicyStateTaskSelectionLogic(final String name, final String version, final String stateName, + ApexApiResult updatePolicyStateTaskSelectionLogic(final String name, final String version, final String stateName, final String logicFlavour, final String logic); /** @@ -748,7 +748,7 @@ public interface ApexEditorAPI { * @param stateName of the state * @return result of the operation */ - ApexAPIResult listPolicyStateTaskSelectionLogic(final String name, final String version, final String stateName); + ApexApiResult listPolicyStateTaskSelectionLogic(final String name, final String version, final String stateName); /** * Delete task selection logic for a state. @@ -758,7 +758,7 @@ public interface ApexEditorAPI { * @param stateName of the state * @return result of the operation */ - ApexAPIResult deletePolicyStateTaskSelectionLogic(final String name, final String version, final String stateName); + ApexApiResult deletePolicyStateTaskSelectionLogic(final String name, final String version, final String stateName); /** * Create a policy state output. @@ -774,7 +774,7 @@ public interface ApexEditorAPI { * the policy transitions to on this branch * @return result of the operation */ - ApexAPIResult createPolicyStateOutput(final String name, final String version, final String stateName, + ApexApiResult createPolicyStateOutput(final String name, final String version, final String stateName, final String outputName, final String eventName, final String eventVersion, final String nextState); /** @@ -786,7 +786,7 @@ public interface ApexEditorAPI { * @param outputName of the state output, set to null to list all outputs of the state * @return result of the operation */ - ApexAPIResult listPolicyStateOutput(final String name, final String version, final String stateName, + ApexApiResult listPolicyStateOutput(final String name, final String version, final String stateName, final String outputName); /** @@ -798,7 +798,7 @@ public interface ApexEditorAPI { * @param outputName of the state output, set to null to delete all state outputs * @return result of the operation */ - ApexAPIResult deletePolicyStateOutput(final String name, final String version, final String stateName, + ApexApiResult deletePolicyStateOutput(final String name, final String version, final String stateName, final String outputName); /** @@ -813,7 +813,7 @@ public interface ApexEditorAPI { * @param logic the source code for the logic of the state * @return result of the operation */ - ApexAPIResult createPolicyStateFinalizerLogic(final String name, final String version, final String stateName, + ApexApiResult createPolicyStateFinalizerLogic(final String name, final String version, final String stateName, final String finalizerLogicName, final String logicFlavour, final String logic); /** @@ -828,7 +828,7 @@ public interface ApexEditorAPI { * @param logic the source code for the logic of the state, set to null to not update * @return result of the operation */ - ApexAPIResult updatePolicyStateFinalizerLogic(final String name, final String version, final String stateName, + ApexApiResult updatePolicyStateFinalizerLogic(final String name, final String version, final String stateName, final String finalizerLogicName, final String logicFlavour, final String logic); /** @@ -840,7 +840,7 @@ public interface ApexEditorAPI { * @param finalizerLogicName name of the state finalizer logic * @return result of the operation */ - ApexAPIResult listPolicyStateFinalizerLogic(final String name, final String version, final String stateName, + ApexApiResult listPolicyStateFinalizerLogic(final String name, final String version, final String stateName, final String finalizerLogicName); /** @@ -852,7 +852,7 @@ public interface ApexEditorAPI { * @param finalizerLogicName name of the state finalizer logic * @return result of the operation */ - ApexAPIResult deletePolicyStateFinalizerLogic(final String name, final String version, final String stateName, + ApexApiResult deletePolicyStateFinalizerLogic(final String name, final String version, final String stateName, final String finalizerLogicName); /** @@ -871,7 +871,7 @@ public interface ApexEditorAPI { * @return result of the operation */ // CHECKSTYLE:OFF: checkstyle:parameterNumber - ApexAPIResult createPolicyStateTaskRef(final String name, final String version, final String stateName, + ApexApiResult createPolicyStateTaskRef(final String name, final String version, final String stateName, final String taskLocalName, final String taskName, final String taskVersion, final String outputType, final String outputName); // CHECKSTYLE:ON: checkstyle:parameterNumber @@ -886,7 +886,7 @@ public interface ApexEditorAPI { * @param taskVersion version of the task, set to null to use the latest version * @return result of the operation */ - ApexAPIResult listPolicyStateTaskRef(final String name, final String version, final String stateName, + ApexApiResult listPolicyStateTaskRef(final String name, final String version, final String stateName, final String taskName, final String taskVersion); /** @@ -899,7 +899,7 @@ public interface ApexEditorAPI { * @param taskVersion version of the task, set to null to use the latest version * @return result of the operation */ - ApexAPIResult deletePolicyStateTaskRef(final String name, final String version, final String stateName, + ApexApiResult deletePolicyStateTaskRef(final String name, final String version, final String stateName, final String taskName, final String taskVersion); /** @@ -913,7 +913,7 @@ public interface ApexEditorAPI { * to null to use the latest version * @return result of the operation */ - ApexAPIResult createPolicyStateContextRef(final String name, final String version, final String stateName, + ApexApiResult createPolicyStateContextRef(final String name, final String version, final String stateName, final String contextAlbumName, final String contextAlbumVersion); /** @@ -928,7 +928,7 @@ public interface ApexEditorAPI { * to null to use the latest version * @return result of the operation */ - ApexAPIResult listPolicyStateContextRef(final String name, final String version, final String stateName, + ApexApiResult listPolicyStateContextRef(final String name, final String version, final String stateName, final String contextAlbumName, final String contextAlbumVersion); /** @@ -943,6 +943,6 @@ public interface ApexEditorAPI { * to null to use the latest version * @return result of the operation */ - ApexAPIResult deletePolicyStateContextRef(final String name, final String version, final String stateName, + ApexApiResult deletePolicyStateContextRef(final String name, final String version, final String stateName, final String contextAlbumName, final String contextAlbumVersion); } diff --git a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/ApexModel.java b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/ApexModel.java index 8b4d4a91b..9771b6186 100644 --- a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/ApexModel.java +++ b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/ApexModel.java @@ -28,7 +28,7 @@ import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; * * @author Liam Fallon (liam.fallon@ericsson.com) */ -public interface ApexModel extends ApexEditorAPI { +public interface ApexModel extends ApexEditorApi { /** * Make a deep copy of the Model. * @@ -42,7 +42,7 @@ public interface ApexModel extends ApexEditorAPI { * @param modelString the string with the model * @return the result of the operation */ - ApexAPIResult loadFromString(String modelString); + ApexApiResult loadFromString(String modelString); /** * Load an Apex model from a file. @@ -50,7 +50,7 @@ public interface ApexModel extends ApexEditorAPI { * @param fileName the file name of the file with the model * @return the result of the operation */ - ApexAPIResult loadFromFile(String fileName); + ApexApiResult loadFromFile(String fileName); /** * Save an Apex model to a file. @@ -59,26 +59,26 @@ public interface ApexModel extends ApexEditorAPI { * @param xmlFlag if true, save the file in XML format, otherwise save the file in the default JSON format * @return the result of the operation */ - ApexAPIResult saveToFile(String fileName, boolean xmlFlag); + ApexApiResult saveToFile(String fileName, boolean xmlFlag); /** * Load an Apex model from a database. * * @param modelName the name of the model to load - * @param modelVersion the version of the model to load, loads the policy model from the database with this name, if more than one exist, an exception is - * thrown - * @param DaoParameters the parameters to use to access the database over JDBC + * @param modelVersion the version of the model to load, loads the policy model from the database with this name, if + * more than one exist, an exception is thrown + * @param daoParameters the parameters to use to access the database over JDBC * @return the result of the operation */ - ApexAPIResult loadFromDatabase(String modelName, String modelVersion, DaoParameters DaoParameters); + ApexApiResult loadFromDatabase(String modelName, String modelVersion, DaoParameters daoParameters); /** * Save an Apex model to a database. * - * @param DaoParameters the parameters to use to access the database over JDBC + * @param daoParameters the parameters to use to access the database over JDBC * @return the result of the operation */ - ApexAPIResult saveToDatabase(DaoParameters DaoParameters); + ApexApiResult saveToDatabase(DaoParameters daoParameters); /** * Read an APEX model from a location identified by a URL. @@ -86,7 +86,7 @@ public interface ApexModel extends ApexEditorAPI { * @param urlString the url string * @return the result of the operation */ - ApexAPIResult readFromURL(String urlString); + ApexApiResult readFromUrl(String urlString); /** * Write an APEX model to a location identified by a URL. @@ -95,21 +95,21 @@ public interface ApexModel extends ApexEditorAPI { * @param xmlFlag if true, save the file in XML format, otherwise save the file in the default JSON format * @return the result of the operation */ - ApexAPIResult writeToURL(String urlString, boolean xmlFlag); + ApexApiResult writeToUrl(String urlString, boolean xmlFlag); /** * Analyse an Apex model that shows the concept usage references of a policy model. * * @return the result of the operation */ - ApexAPIResult analyse(); + ApexApiResult analyse(); /** * Validate an Apex model, checking all concepts and references in the model. * * @return the result of the operation */ - ApexAPIResult validate(); + ApexApiResult validate(); /** * Compare to Apex models, returning the differences between the models. @@ -119,7 +119,7 @@ public interface ApexModel extends ApexEditorAPI { * @param keysOnly only returns the keys that are different when set, when not set values are also returned * @return the result of the operation */ - ApexAPIResult compare(String otherModelFileName, boolean diffsOnly, boolean keysOnly); + ApexApiResult compare(String otherModelFileName, boolean diffsOnly, boolean keysOnly); /** * Compare two Apex models, returning the differences between the models. @@ -129,45 +129,50 @@ public interface ApexModel extends ApexEditorAPI { * @param keysOnly only returns the keys that are different when set, when not set values are also returned * @return the result of the operation */ - ApexAPIResult compareWithString(String otherModelString, boolean diffsOnly, boolean keysOnly); + ApexApiResult compareWithString(String otherModelString, boolean diffsOnly, boolean keysOnly); /** * Split out a sub model from an Apex model that contains a given subset of the policies in the original model. * - * @param targetModelName the file name of the target model in which to store the model split out from the original model - * @param splitOutPolicies the policies form the original model to include in the split out model, specified as a comma delimited list of policy names + * @param targetModelName the file name of the target model in which to store the model split out from the original + * model + * @param splitOutPolicies the policies form the original model to include in the split out model, specified as a + * comma delimited list of policy names * @return the result of the operation */ - ApexAPIResult split(String targetModelName, String splitOutPolicies); + ApexApiResult split(String targetModelName, String splitOutPolicies); /** - * Split out a sub model from an Apex model that contains a given subset of the policies in the original model, return the split model in the result as a - * string. + * Split out a sub model from an Apex model that contains a given subset of the policies in the original model, + * return the split model in the result as a string. * - * @param splitOutPolicies the policies form the original model to include in the split out model, specified as a comma delimited list of policy names + * @param splitOutPolicies the policies form the original model to include in the split out model, specified as a + * comma delimited list of policy names * @return the result of the operation */ - ApexAPIResult split(String splitOutPolicies); + ApexApiResult split(String splitOutPolicies); /** * Merge two Apex models together. * * @param mergeInModelName the file name of the model to merge into the current model - * @param keepOriginal if this flag is set to true, if a concept exists in both models, the original model copy of that concept is kept, if the flag is set - * to false, then the copy of the concept from the mergeInModel overwrites the concept in the original model + * @param keepOriginal if this flag is set to true, if a concept exists in both models, the original model copy of + * that concept is kept, if the flag is set to false, then the copy of the concept from the mergeInModel + * overwrites the concept in the original model * @return the result of the operation */ - ApexAPIResult merge(String mergeInModelName, boolean keepOriginal); + ApexApiResult merge(String mergeInModelName, boolean keepOriginal); /** * Merge two Apex models together. * * @param otherModelString the model to merge as a string - * @param keepOriginal if this flag is set to true, if a concept exists in both models, the original model copy of that concept is kept, if the flag is set - * to false, then the copy of the concept from the mergeInModel overwrites the concept in the original model + * @param keepOriginal if this flag is set to true, if a concept exists in both models, the original model copy of + * that concept is kept, if the flag is set to false, then the copy of the concept from the mergeInModel + * overwrites the concept in the original model * @return the result of the operation */ - ApexAPIResult mergeWithString(String otherModelString, boolean keepOriginal); + ApexApiResult mergeWithString(String otherModelString, boolean keepOriginal); /** * Get the raw policy model being used by this model. @@ -182,7 +187,7 @@ public interface ApexModel extends ApexEditorAPI { * @param policyModel the policy model */ void setPolicyModel(AxPolicyModel policyModel); - + /** * Builds the raw policy model being used by this model. * diff --git a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ApexModelImpl.java b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ApexModelImpl.java index 429d3c66f..c15eadc7d 100644 --- a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ApexModelImpl.java +++ b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ApexModelImpl.java @@ -23,7 +23,7 @@ package org.onap.policy.apex.model.modelapi.impl; import java.util.Properties; import org.onap.policy.apex.model.basicmodel.dao.DaoParameters; -import org.onap.policy.apex.model.modelapi.ApexAPIResult; +import org.onap.policy.apex.model.modelapi.ApexApiResult; import org.onap.policy.apex.model.modelapi.ApexModel; import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; @@ -114,7 +114,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String, java.lang.String, java.lang.String) */ @Override - public ApexAPIResult createModel(final String name, final String version, final String uuid, + public ApexApiResult createModel(final String name, final String version, final String uuid, final String description) { return modelFacade.createModel(name, version, uuid, description); } @@ -126,7 +126,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String, java.lang.String, java.lang.String) */ @Override - public ApexAPIResult updateModel(final String name, final String version, final String uuid, + public ApexApiResult updateModel(final String name, final String version, final String uuid, final String description) { return modelFacade.updateModel(name, version, uuid, description); } @@ -137,7 +137,7 @@ public final class ApexModelImpl implements ApexModel { * @see org.onap.policy.apex.core.modelapi.ApexEditorAPI#getModelKey() */ @Override - public ApexAPIResult getModelKey() { + public ApexApiResult getModelKey() { return modelFacade.getModelKey(); } @@ -147,7 +147,7 @@ public final class ApexModelImpl implements ApexModel { * @see org.onap.policy.apex.auth.api.ApexEditorAPI#listModel() */ @Override - public ApexAPIResult listModel() { + public ApexApiResult listModel() { return modelFacade.listModel(); } @@ -157,7 +157,7 @@ public final class ApexModelImpl implements ApexModel { * @see org.onap.policy.apex.auth.api.ApexEditorAPI#deleteModel() */ @Override - public ApexAPIResult deleteModel() { + public ApexApiResult deleteModel() { return modelFacade.deleteModel(); } @@ -168,7 +168,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String, java.lang.String, java.lang.String) */ @Override - public ApexAPIResult createKeyInformation(final String name, final String version, final String uuid, + public ApexApiResult createKeyInformation(final String name, final String version, final String uuid, final String description) { return keyInformationFacade.createKeyInformation(name, version, uuid, description); } @@ -180,7 +180,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String, java.lang.String, java.lang.String) */ @Override - public ApexAPIResult updateKeyInformation(final String name, final String version, final String uuid, + public ApexApiResult updateKeyInformation(final String name, final String version, final String uuid, final String description) { return keyInformationFacade.updateKeyInformation(name, version, uuid, description); } @@ -192,7 +192,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String) */ @Override - public ApexAPIResult listKeyInformation(final String name, final String version) { + public ApexApiResult listKeyInformation(final String name, final String version) { return keyInformationFacade.listKeyInformation(name, version); } @@ -203,7 +203,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String) */ @Override - public ApexAPIResult deleteKeyInformation(final String name, final String version) { + public ApexApiResult deleteKeyInformation(final String name, final String version) { return keyInformationFacade.deleteKeyInformation(name, version); } @@ -214,7 +214,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String) */ @Override - public ApexAPIResult validateKeyInformation(final String name, final String version) { + public ApexApiResult validateKeyInformation(final String name, final String version) { return keyInformationFacade.validateKeyInformation(name, version); } @@ -225,7 +225,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String) */ @Override - public ApexAPIResult createContextSchema(final String name, final String version, final String schemaFlavour, + public ApexApiResult createContextSchema(final String name, final String version, final String schemaFlavour, final String schemaDefinition, final String uuid, final String description) { return contextSchemaFacade.createContextSchema(name, version, schemaFlavour, schemaDefinition, uuid, description); @@ -238,7 +238,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String) */ @Override - public ApexAPIResult updateContextSchema(final String name, final String version, final String schemaFlavour, + public ApexApiResult updateContextSchema(final String name, final String version, final String schemaFlavour, final String schemaDefinition, final String uuid, final String description) { return contextSchemaFacade.updateContextSchema(name, version, schemaFlavour, schemaDefinition, uuid, description); @@ -251,7 +251,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String) */ @Override - public ApexAPIResult listContextSchemas(final String name, final String version) { + public ApexApiResult listContextSchemas(final String name, final String version) { return contextSchemaFacade.listContextSchemas(name, version); } @@ -262,7 +262,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String) */ @Override - public ApexAPIResult deleteContextSchema(final String name, final String version) { + public ApexApiResult deleteContextSchema(final String name, final String version) { return contextSchemaFacade.deleteContextSchema(name, version); } @@ -273,7 +273,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String) */ @Override - public ApexAPIResult validateContextSchemas(final String name, final String version) { + public ApexApiResult validateContextSchemas(final String name, final String version) { return contextSchemaFacade.validateContextSchemas(name, version); } @@ -285,7 +285,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String) */ @Override - public ApexAPIResult createEvent(final String name, final String version, final String nameSpace, + public ApexApiResult createEvent(final String name, final String version, final String nameSpace, final String source, final String target, final String uuid, final String description) { return eventFacade.createEvent(name, version, nameSpace, source, target, uuid, description); } @@ -298,7 +298,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String) */ @Override - public ApexAPIResult updateEvent(final String name, final String version, final String nameSpace, + public ApexApiResult updateEvent(final String name, final String version, final String nameSpace, final String source, final String target, final String uuid, final String description) { return eventFacade.updateEvent(name, version, nameSpace, source, target, uuid, description); } @@ -310,7 +310,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String) */ @Override - public ApexAPIResult listEvent(final String name, final String version) { + public ApexApiResult listEvent(final String name, final String version) { return eventFacade.listEvent(name, version); } @@ -321,7 +321,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String) */ @Override - public ApexAPIResult deleteEvent(final String name, final String version) { + public ApexApiResult deleteEvent(final String name, final String version) { return eventFacade.deleteEvent(name, version); } @@ -332,7 +332,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String) */ @Override - public ApexAPIResult validateEvent(final String name, final String version) { + public ApexApiResult validateEvent(final String name, final String version) { return eventFacade.validateEvent(name, version); } @@ -343,7 +343,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String, java.lang.String, java.lang.String, java.lang.String, boolean) */ @Override - public ApexAPIResult createEventPar(final String name, final String version, final String parName, + public ApexApiResult createEventPar(final String name, final String version, final String parName, final String contextSchemaName, final String contextSchemaVersion, final boolean optional) { return eventFacade.createEventPar(name, version, parName, contextSchemaName, contextSchemaVersion, optional); } @@ -355,7 +355,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String, java.lang.String) */ @Override - public ApexAPIResult listEventPar(final String name, final String version, final String parName) { + public ApexApiResult listEventPar(final String name, final String version, final String parName) { return eventFacade.listEventPar(name, version, parName); } @@ -366,7 +366,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String, java.lang.String) */ @Override - public ApexAPIResult deleteEventPar(final String name, final String version, final String parName) { + public ApexApiResult deleteEventPar(final String name, final String version, final String parName) { return eventFacade.deleteEventPar(name, version, parName); } @@ -379,7 +379,7 @@ public final class ApexModelImpl implements ApexModel { */ @Override // CHECKSTYLE:OFF: checkstyle:parameterNumber - public ApexAPIResult createContextAlbum(final String name, final String version, final String scope, + public ApexApiResult createContextAlbum(final String name, final String version, final String scope, final String writable, final String contextSchemaName, final String contextSchemaVersion, final String uuid, final String description) { return contextAlbumFacade.createContextAlbum(name, version, scope, writable, contextSchemaName, @@ -396,7 +396,7 @@ public final class ApexModelImpl implements ApexModel { */ // CHECKSTYLE:OFF: checkstyle:parameterNumber @Override - public ApexAPIResult updateContextAlbum(final String name, final String version, final String scope, + public ApexApiResult updateContextAlbum(final String name, final String version, final String scope, final String writable, final String contextSchemaName, final String contextSchemaVersion, final String uuid, final String description) { return contextAlbumFacade.updateContextAlbum(name, version, scope, writable, contextSchemaName, @@ -411,7 +411,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String) */ @Override - public ApexAPIResult listContextAlbum(final String name, final String version) { + public ApexApiResult listContextAlbum(final String name, final String version) { return contextAlbumFacade.listContextAlbum(name, version); } @@ -422,7 +422,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String) */ @Override - public ApexAPIResult deleteContextAlbum(final String name, final String version) { + public ApexApiResult deleteContextAlbum(final String name, final String version) { return contextAlbumFacade.deleteContextAlbum(name, version); } @@ -433,7 +433,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String) */ @Override - public ApexAPIResult validateContextAlbum(final String name, final String version) { + public ApexApiResult validateContextAlbum(final String name, final String version) { return contextAlbumFacade.validateContextAlbum(name, version); } @@ -444,7 +444,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String, java.lang.String, java.lang.String) */ @Override - public ApexAPIResult createTask(final String name, final String version, final String uuid, + public ApexApiResult createTask(final String name, final String version, final String uuid, final String description) { return taskFacade.createTask(name, version, uuid, description); } @@ -456,7 +456,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String, java.lang.String, java.lang.String) */ @Override - public ApexAPIResult updateTask(final String name, final String version, final String uuid, + public ApexApiResult updateTask(final String name, final String version, final String uuid, final String description) { return taskFacade.updateTask(name, version, uuid, description); } @@ -467,7 +467,7 @@ public final class ApexModelImpl implements ApexModel { * @see org.onap.policy.apex.auth.api.ApexEditorAPI#listTask(java.lang.String, java.lang.String) */ @Override - public ApexAPIResult listTask(final String name, final String version) { + public ApexApiResult listTask(final String name, final String version) { return taskFacade.listTask(name, version); } @@ -478,7 +478,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String) */ @Override - public ApexAPIResult deleteTask(final String name, final String version) { + public ApexApiResult deleteTask(final String name, final String version) { return taskFacade.deleteTask(name, version); } @@ -489,7 +489,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String) */ @Override - public ApexAPIResult validateTask(final String name, final String version) { + public ApexApiResult validateTask(final String name, final String version) { return taskFacade.validateTask(name, version); } @@ -500,7 +500,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String, java.lang.String, java.lang.String) */ @Override - public ApexAPIResult createTaskLogic(final String name, final String version, final String logicFlavour, + public ApexApiResult createTaskLogic(final String name, final String version, final String logicFlavour, final String logic) { return taskFacade.createTaskLogic(name, version, logicFlavour, logic); } @@ -512,7 +512,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String, java.lang.String, java.lang.String) */ @Override - public ApexAPIResult updateTaskLogic(final String name, final String version, final String logicFlavour, + public ApexApiResult updateTaskLogic(final String name, final String version, final String logicFlavour, final String logic) { return taskFacade.updateTaskLogic(name, version, logicFlavour, logic); } @@ -524,7 +524,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String) */ @Override - public ApexAPIResult listTaskLogic(final String name, final String version) { + public ApexApiResult listTaskLogic(final String name, final String version) { return taskFacade.listTaskLogic(name, version); } @@ -535,7 +535,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String) */ @Override - public ApexAPIResult deleteTaskLogic(final String name, final String version) { + public ApexApiResult deleteTaskLogic(final String name, final String version) { return taskFacade.deleteTaskLogic(name, version); } @@ -546,7 +546,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.boolean) */ @Override - public ApexAPIResult createTaskInputField(final String name, final String version, final String fieldName, + public ApexApiResult createTaskInputField(final String name, final String version, final String fieldName, final String dataTypeName, final String dataTypeVersion, final boolean optional) { return taskFacade.createTaskInputField(name, version, fieldName, dataTypeName, dataTypeVersion, optional); } @@ -558,7 +558,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String, java.lang.String) */ @Override - public ApexAPIResult listTaskInputField(final String name, final String version, final String fieldName) { + public ApexApiResult listTaskInputField(final String name, final String version, final String fieldName) { return taskFacade.listTaskInputField(name, version, fieldName); } @@ -569,7 +569,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String, java.lang.String) */ @Override - public ApexAPIResult deleteTaskInputField(final String name, final String version, final String fieldName) { + public ApexApiResult deleteTaskInputField(final String name, final String version, final String fieldName) { return taskFacade.deleteTaskInputField(name, version, fieldName); } @@ -580,7 +580,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.boolean) */ @Override - public ApexAPIResult createTaskOutputField(final String name, final String version, final String fieldName, + public ApexApiResult createTaskOutputField(final String name, final String version, final String fieldName, final String dataTypeName, final String dataTypeVersion, final boolean optional) { return taskFacade.createTaskOutputField(name, version, fieldName, dataTypeName, dataTypeVersion, optional); } @@ -592,7 +592,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String, java.lang.String) */ @Override - public ApexAPIResult listTaskOutputField(final String name, final String version, final String fieldName) { + public ApexApiResult listTaskOutputField(final String name, final String version, final String fieldName) { return taskFacade.listTaskOutputField(name, version, fieldName); } @@ -603,7 +603,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String, java.lang.String) */ @Override - public ApexAPIResult deleteTaskOutputField(final String name, final String version, final String fieldName) { + public ApexApiResult deleteTaskOutputField(final String name, final String version, final String fieldName) { return taskFacade.deleteTaskOutputField(name, version, fieldName); } @@ -614,7 +614,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String, java.lang.String, java.lang.String) */ @Override - public ApexAPIResult createTaskParameter(final String name, final String version, final String parName, + public ApexApiResult createTaskParameter(final String name, final String version, final String parName, final String defaultValue) { return taskFacade.createTaskParameter(name, version, parName, defaultValue); } @@ -626,7 +626,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String, java.lang.String) */ @Override - public ApexAPIResult listTaskParameter(final String name, final String version, final String parName) { + public ApexApiResult listTaskParameter(final String name, final String version, final String parName) { return taskFacade.listTaskParameter(name, version, parName); } @@ -637,7 +637,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String, java.lang.String) */ @Override - public ApexAPIResult deleteTaskParameter(final String name, final String version, final String parName) { + public ApexApiResult deleteTaskParameter(final String name, final String version, final String parName) { return taskFacade.deleteTaskParameter(name, version, parName); } @@ -648,7 +648,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String, java.lang.String, java.lang.String) */ @Override - public ApexAPIResult createTaskContextRef(final String name, final String version, final String contextAlbumName, + public ApexApiResult createTaskContextRef(final String name, final String version, final String contextAlbumName, final String contextAlbumVersion) { return taskFacade.createTaskContextRef(name, version, contextAlbumName, contextAlbumVersion); } @@ -660,7 +660,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String, java.lang.String, java.lang.String) */ @Override - public ApexAPIResult listTaskContextRef(final String name, final String version, final String contextAlbumName, + public ApexApiResult listTaskContextRef(final String name, final String version, final String contextAlbumName, final String contextAlbumVersion) { return taskFacade.listTaskContextRef(name, version, contextAlbumName, contextAlbumVersion); } @@ -672,7 +672,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String, java.lang.String, java.lang.String) */ @Override - public ApexAPIResult deleteTaskContextRef(final String name, final String version, final String contextAlbumName, + public ApexApiResult deleteTaskContextRef(final String name, final String version, final String contextAlbumName, final String contextAlbumVersion) { return taskFacade.deleteTaskContextRef(name, version, contextAlbumName, contextAlbumVersion); } @@ -684,7 +684,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String) */ @Override - public ApexAPIResult createPolicy(final String name, final String version, final String template, + public ApexApiResult createPolicy(final String name, final String version, final String template, final String firstState, final String uuid, final String description) { return policyFacade.createPolicy(name, version, template, firstState, uuid, description); } @@ -696,7 +696,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String) */ @Override - public ApexAPIResult updatePolicy(final String name, final String version, final String template, + public ApexApiResult updatePolicy(final String name, final String version, final String template, final String firstState, final String uuid, final String description) { return policyFacade.updatePolicy(name, version, template, firstState, uuid, description); } @@ -708,7 +708,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String) */ @Override - public ApexAPIResult listPolicy(final String name, final String version) { + public ApexApiResult listPolicy(final String name, final String version) { return policyFacade.listPolicy(name, version); } @@ -719,7 +719,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String) */ @Override - public ApexAPIResult deletePolicy(final String name, final String version) { + public ApexApiResult deletePolicy(final String name, final String version) { return policyFacade.deletePolicy(name, version); } @@ -730,7 +730,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String) */ @Override - public ApexAPIResult validatePolicy(final String name, final String version) { + public ApexApiResult validatePolicy(final String name, final String version) { return policyFacade.validatePolicy(name, version); } @@ -742,7 +742,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String) */ @Override - public ApexAPIResult createPolicyState(final String name, final String version, final String stateName, + public ApexApiResult createPolicyState(final String name, final String version, final String stateName, final String triggerName, final String triggerVersion, final String defaultTaskName, final String defaltTaskVersion) { return policyFacade.createPolicyState(name, version, stateName, triggerName, triggerVersion, defaultTaskName, @@ -757,7 +757,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String) */ @Override - public ApexAPIResult updatePolicyState(final String name, final String version, final String stateName, + public ApexApiResult updatePolicyState(final String name, final String version, final String stateName, final String triggerName, final String triggerVersion, final String defaultTaskName, final String defaltTaskVersion) { return policyFacade.updatePolicyState(name, version, stateName, triggerName, triggerVersion, defaultTaskName, @@ -771,7 +771,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String, java.lang.String) */ @Override - public ApexAPIResult listPolicyState(final String name, final String version, final String stateName) { + public ApexApiResult listPolicyState(final String name, final String version, final String stateName) { return policyFacade.listPolicyState(name, version, stateName); } @@ -782,7 +782,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String, java.lang.String) */ @Override - public ApexAPIResult deletePolicyState(final String name, final String version, final String stateName) { + public ApexApiResult deletePolicyState(final String name, final String version, final String stateName) { return policyFacade.deletePolicyState(name, version, stateName); } @@ -794,7 +794,7 @@ public final class ApexModelImpl implements ApexModel { * String, java.lang.String, java.lang.String, java.lang.String, java.lang.String) */ @Override - public ApexAPIResult createPolicyStateTaskSelectionLogic(final String name, final String version, + public ApexApiResult createPolicyStateTaskSelectionLogic(final String name, final String version, final String stateName, final String logicFlavour, final String logic) { return policyFacade.createPolicyStateTaskSelectionLogic(name, version, stateName, logicFlavour, logic); } @@ -807,7 +807,7 @@ public final class ApexModelImpl implements ApexModel { * String, java.lang.String, java.lang.String, java.lang.String, java.lang.String) */ @Override - public ApexAPIResult updatePolicyStateTaskSelectionLogic(final String name, final String version, + public ApexApiResult updatePolicyStateTaskSelectionLogic(final String name, final String version, final String stateName, final String logicFlavour, final String logic) { return policyFacade.updatePolicyStateTaskSelectionLogic(name, version, stateName, logicFlavour, logic); } @@ -819,7 +819,7 @@ public final class ApexModelImpl implements ApexModel { * String, java.lang.String, java.lang.String) */ @Override - public ApexAPIResult listPolicyStateTaskSelectionLogic(final String name, final String version, + public ApexApiResult listPolicyStateTaskSelectionLogic(final String name, final String version, final String stateName) { return policyFacade.listPolicyStateTaskSelectionLogic(name, version, stateName); } @@ -832,7 +832,7 @@ public final class ApexModelImpl implements ApexModel { * String, java.lang.String, java.lang.String) */ @Override - public ApexAPIResult deletePolicyStateTaskSelectionLogic(final String name, final String version, + public ApexApiResult deletePolicyStateTaskSelectionLogic(final String name, final String version, final String stateName) { return policyFacade.deletePolicyStateTaskSelectionLogic(name, version, stateName); } @@ -845,7 +845,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String) */ @Override - public ApexAPIResult createPolicyStateOutput(final String name, final String version, final String stateName, + public ApexApiResult createPolicyStateOutput(final String name, final String version, final String stateName, final String outputName, final String eventName, final String eventVersion, final String nextState) { return policyFacade.createPolicyStateOutput(name, version, stateName, outputName, eventName, eventVersion, nextState); @@ -858,7 +858,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String, java.lang.String, java.lang.String) */ @Override - public ApexAPIResult listPolicyStateOutput(final String name, final String version, final String stateName, + public ApexApiResult listPolicyStateOutput(final String name, final String version, final String stateName, final String outputName) { return policyFacade.listPolicyStateOutput(name, version, stateName, outputName); } @@ -870,7 +870,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String, java.lang.String, java.lang.String) */ @Override - public ApexAPIResult deletePolicyStateOutput(final String name, final String version, final String stateName, + public ApexApiResult deletePolicyStateOutput(final String name, final String version, final String stateName, final String outputName) { return policyFacade.deletePolicyStateOutput(name, version, stateName, outputName); } @@ -884,7 +884,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String) */ @Override - public ApexAPIResult createPolicyStateFinalizerLogic(final String name, final String version, + public ApexApiResult createPolicyStateFinalizerLogic(final String name, final String version, final String stateName, final String finalizerLogicName, final String logicFlavour, final String logic) { return policyFacade.createPolicyStateFinalizerLogic(name, version, stateName, finalizerLogicName, logicFlavour, logic); @@ -899,7 +899,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String) */ @Override - public ApexAPIResult updatePolicyStateFinalizerLogic(final String name, final String version, + public ApexApiResult updatePolicyStateFinalizerLogic(final String name, final String version, final String stateName, final String finalizerLogicName, final String logicFlavour, final String logic) { return policyFacade.updatePolicyStateFinalizerLogic(name, version, stateName, finalizerLogicName, logicFlavour, logic); @@ -913,7 +913,7 @@ public final class ApexModelImpl implements ApexModel { * String, java.lang.String, java.lang.String, java.lang.String) */ @Override - public ApexAPIResult listPolicyStateFinalizerLogic(final String name, final String version, final String stateName, + public ApexApiResult listPolicyStateFinalizerLogic(final String name, final String version, final String stateName, final String finalizerLogicName) { return policyFacade.listPolicyStateFinalizerLogic(name, version, stateName, finalizerLogicName); } @@ -926,7 +926,7 @@ public final class ApexModelImpl implements ApexModel { * String, java.lang.String, java.lang.String, java.lang.String) */ @Override - public ApexAPIResult deletePolicyStateFinalizerLogic(final String name, final String version, + public ApexApiResult deletePolicyStateFinalizerLogic(final String name, final String version, final String stateName, final String finalizerLogicName) { return policyFacade.deletePolicyStateFinalizerLogic(name, version, stateName, finalizerLogicName); } @@ -941,7 +941,7 @@ public final class ApexModelImpl implements ApexModel { */ @Override // CHECKSTYLE:OFF: checkstyle:parameterNumber - public ApexAPIResult createPolicyStateTaskRef(final String name, final String version, final String stateName, + public ApexApiResult createPolicyStateTaskRef(final String name, final String version, final String stateName, final String taskLocalName, final String taskName, final String taskVersion, final String outputType, final String outputName) { return policyFacade.createPolicyStateTaskRef(name, version, stateName, taskLocalName, taskName, taskVersion, @@ -956,7 +956,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String, java.lang.String, java.lang.String, java.lang.String) */ @Override - public ApexAPIResult listPolicyStateTaskRef(final String name, final String version, final String stateName, + public ApexApiResult listPolicyStateTaskRef(final String name, final String version, final String stateName, final String taskName, final String taskVersion) { return policyFacade.listPolicyStateTaskRef(name, version, stateName, taskName, taskVersion); } @@ -968,7 +968,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String, java.lang.String, java.lang.String, java.lang.String) */ @Override - public ApexAPIResult deletePolicyStateTaskRef(final String name, final String version, final String stateName, + public ApexApiResult deletePolicyStateTaskRef(final String name, final String version, final String stateName, final String taskName, final String taskVersion) { return policyFacade.deletePolicyStateTaskRef(name, version, stateName, taskName, taskVersion); } @@ -981,7 +981,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String, java.lang.String, java.lang.String, java.lang.String) */ @Override - public ApexAPIResult createPolicyStateContextRef(final String name, final String version, final String stateName, + public ApexApiResult createPolicyStateContextRef(final String name, final String version, final String stateName, final String contextAlbumName, final String contextAlbumVersion) { return policyFacade.createPolicyStateContextRef(name, version, stateName, contextAlbumName, contextAlbumVersion); @@ -994,7 +994,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String, java.lang.String, java.lang.String, java.lang.String) */ @Override - public ApexAPIResult listPolicyStateContextRef(final String name, final String version, final String stateName, + public ApexApiResult listPolicyStateContextRef(final String name, final String version, final String stateName, final String contextAlbumName, final String contextAlbumVersion) { return policyFacade.listPolicyStateContextRef(name, version, stateName, contextAlbumName, contextAlbumVersion); } @@ -1007,7 +1007,7 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String, java.lang.String, java.lang.String, java.lang.String) */ @Override - public ApexAPIResult deletePolicyStateContextRef(final String name, final String version, final String stateName, + public ApexApiResult deletePolicyStateContextRef(final String name, final String version, final String stateName, final String contextAlbumName, final String contextAlbumVersion) { return policyFacade.deletePolicyStateContextRef(name, version, stateName, contextAlbumName, contextAlbumVersion); @@ -1019,7 +1019,7 @@ public final class ApexModelImpl implements ApexModel { * @see org.onap.policy.apex.core.modelapi.ApexModel#loadFromString(java.lang.String) */ @Override - public ApexAPIResult loadFromString(final String modelString) { + public ApexApiResult loadFromString(final String modelString) { return modelHandlerFacade.loadFromString(modelString); } @@ -1030,7 +1030,7 @@ public final class ApexModelImpl implements ApexModel { */ @Override // CHECKSTYLE:OFF: checkstyle:HiddenField - public ApexAPIResult loadFromFile(final String fileName) { + public ApexApiResult loadFromFile(final String fileName) { this.fileName = fileName; return modelHandlerFacade.loadFromFile(fileName); } @@ -1042,7 +1042,7 @@ public final class ApexModelImpl implements ApexModel { * @see org.onap.policy.apex.auth.api.ApexModel#saveToFile(java.lang.String, boolean) */ @Override - public ApexAPIResult saveToFile(final String saveFileName, final boolean xmlFlag) { + public ApexApiResult saveToFile(final String saveFileName, final boolean xmlFlag) { if (saveFileName == null) { return modelHandlerFacade.saveToFile(fileName, xmlFlag); } else { @@ -1057,9 +1057,9 @@ public final class ApexModelImpl implements ApexModel { * java.lang.String, org.onap.policy.apex.model.basicmodel.dao.DaoParameters) */ @Override - public ApexAPIResult loadFromDatabase(final String modelName, final String modelVersion, - final DaoParameters DaoParameters) { - return modelHandlerFacade.loadFromDatabase(modelName, modelVersion, DaoParameters); + public ApexApiResult loadFromDatabase(final String modelName, final String modelVersion, + final DaoParameters daoParameters) { + return modelHandlerFacade.loadFromDatabase(modelName, modelVersion, daoParameters); } /* @@ -1069,8 +1069,8 @@ public final class ApexModelImpl implements ApexModel { * basicmodel. dao.DaoParameters) */ @Override - public ApexAPIResult saveToDatabase(final DaoParameters DaoParameters) { - return modelHandlerFacade.saveToDatabase(DaoParameters); + public ApexApiResult saveToDatabase(final DaoParameters daoParameters) { + return modelHandlerFacade.saveToDatabase(daoParameters); } /* @@ -1079,8 +1079,8 @@ public final class ApexModelImpl implements ApexModel { * @see org.onap.policy.apex.auth.api.ApexModel#readFromURL(java.lang.String) */ @Override - public ApexAPIResult readFromURL(final String urlString) { - return modelHandlerFacade.readFromURL(urlString); + public ApexApiResult readFromUrl(final String urlString) { + return modelHandlerFacade.readFromUrl(urlString); } /* @@ -1089,8 +1089,8 @@ public final class ApexModelImpl implements ApexModel { * @see org.onap.policy.apex.auth.api.ApexModel#writeToURL(java.lang.String, boolean) */ @Override - public ApexAPIResult writeToURL(final String urlString, final boolean xmlFlag) { - return modelHandlerFacade.writeToURL(urlString, xmlFlag); + public ApexApiResult writeToUrl(final String urlString, final boolean xmlFlag) { + return modelHandlerFacade.writeToUrl(urlString, xmlFlag); } /* @@ -1099,7 +1099,7 @@ public final class ApexModelImpl implements ApexModel { * @see org.onap.policy.apex.auth.api.ApexModel#analyse() */ @Override - public ApexAPIResult analyse() { + public ApexApiResult analyse() { return modelHandlerFacade.analyse(); } @@ -1109,7 +1109,7 @@ public final class ApexModelImpl implements ApexModel { * @see org.onap.policy.apex.auth.api.ApexModel#validate() */ @Override - public ApexAPIResult validate() { + public ApexApiResult validate() { return modelHandlerFacade.validate(); } @@ -1119,7 +1119,7 @@ public final class ApexModelImpl implements ApexModel { * @see org.onap.policy.apex.auth.api.ApexModel#compare(java.lang.String, boolean, boolean) */ @Override - public ApexAPIResult compare(final String otherModelFileName, final boolean diffsOnly, final boolean keysOnly) { + public ApexApiResult compare(final String otherModelFileName, final boolean diffsOnly, final boolean keysOnly) { return modelHandlerFacade.compare(otherModelFileName, diffsOnly, keysOnly); } @@ -1130,7 +1130,7 @@ public final class ApexModelImpl implements ApexModel { * boolean, boolean) */ @Override - public ApexAPIResult compareWithString(final String otherModelString, final boolean diffsOnly, + public ApexApiResult compareWithString(final String otherModelString, final boolean diffsOnly, final boolean keysOnly) { return modelHandlerFacade.compareWithString(otherModelString, diffsOnly, keysOnly); } @@ -1141,7 +1141,7 @@ public final class ApexModelImpl implements ApexModel { * @see org.onap.policy.apex.auth.api.ApexModel#split(java.lang.String, java.lang.String) */ @Override - public ApexAPIResult split(final String targetModelFileName, final String splitOutPolicies) { + public ApexApiResult split(final String targetModelFileName, final String splitOutPolicies) { return modelHandlerFacade.split(targetModelFileName, splitOutPolicies); } @@ -1151,7 +1151,7 @@ public final class ApexModelImpl implements ApexModel { * @see org.onap.policy.apex.core.modelapi.ApexModel#split(java.lang.String) */ @Override - public ApexAPIResult split(final String splitOutPolicies) { + public ApexApiResult split(final String splitOutPolicies) { return modelHandlerFacade.split(splitOutPolicies); } @@ -1161,7 +1161,7 @@ public final class ApexModelImpl implements ApexModel { * @see org.onap.policy.apex.auth.api.ApexModel#merge(java.lang.String, boolean) */ @Override - public ApexAPIResult merge(final String mergeInModelFileName, final boolean keepOriginal) { + public ApexApiResult merge(final String mergeInModelFileName, final boolean keepOriginal) { return modelHandlerFacade.merge(mergeInModelFileName, keepOriginal); } @@ -1171,7 +1171,7 @@ public final class ApexModelImpl implements ApexModel { * @see org.onap.policy.apex.core.modelapi.ApexModel#mergeWithString(java.lang.String, boolean) */ @Override - public ApexAPIResult mergeWithString(final String otherModelString, final boolean keepOriginal) { + public ApexApiResult mergeWithString(final String otherModelString, final boolean keepOriginal) { return modelHandlerFacade.mergeWithString(otherModelString, keepOriginal); } diff --git a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ContextAlbumFacade.java b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ContextAlbumFacade.java index 840242569..ad5b74c3a 100644 --- a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ContextAlbumFacade.java +++ b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ContextAlbumFacade.java @@ -28,7 +28,7 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; import org.onap.policy.apex.model.basicmodel.handling.ApexModelStringWriter; import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum; import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema; -import org.onap.policy.apex.model.modelapi.ApexAPIResult; +import org.onap.policy.apex.model.modelapi.ApexApiResult; import org.onap.policy.apex.model.modelapi.ApexModel; /** @@ -86,7 +86,7 @@ public class ContextAlbumFacade { * @return result of the operation */ // CHECKSTYLE:OFF: checkstyle:parameterNumber - public ApexAPIResult createContextAlbum(final String name, final String version, final String scope, + public ApexApiResult createContextAlbum(final String name, final String version, final String scope, final String writable, final String contextSchemaName, final String contextSchemaVersion, final String uuid, final String description) { try { @@ -99,14 +99,14 @@ public class ContextAlbumFacade { } if (apexModel.getPolicyModel().getAlbums().getAlbumsMap().containsKey(key)) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_EXISTS, CONCEPT + key.getId() + " already exists"); } final AxContextSchema schema = apexModel.getPolicyModel().getSchemas().get(contextSchemaName, contextSchemaVersion); if (schema == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + contextSchemaName + ':' + contextSchemaVersion + DOES_NOT_EXIST); } @@ -129,7 +129,7 @@ public class ContextAlbumFacade { return keyInformationFacade.createKeyInformation(name, version, uuid, description); } } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } // CHECKSTYLE:ON: checkstyle:parameterNumber @@ -150,13 +150,13 @@ public class ContextAlbumFacade { * @return result of the operation */ // CHECKSTYLE:OFF: checkstyle:parameterNumber - public ApexAPIResult updateContextAlbum(final String name, final String version, final String scope, + public ApexApiResult updateContextAlbum(final String name, final String version, final String scope, final String writable, final String contextSchemaName, final String contextSchemaVersion, final String uuid, final String description) { try { final AxContextAlbum contextAlbum = apexModel.getPolicyModel().getAlbums().get(name, version); if (contextAlbum == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + DOES_NOT_EXIST); } @@ -175,7 +175,7 @@ public class ContextAlbumFacade { final AxContextSchema schema = apexModel.getPolicyModel().getSchemas().get(contextSchemaName, contextSchemaVersion); if (schema == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + contextSchemaName + ':' + contextSchemaVersion + DOES_NOT_EXIST); } contextAlbum.setItemSchema(schema.getKey()); @@ -183,7 +183,7 @@ public class ContextAlbumFacade { return keyInformationFacade.updateKeyInformation(name, version, uuid, description); } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } // CHECKSTYLE:ON: checkstyle:parameterNumber @@ -195,22 +195,22 @@ public class ContextAlbumFacade { * @param version starting version of the context album, set to null to list all versions * @return result of the operation */ - public ApexAPIResult listContextAlbum(final String name, final String version) { + public ApexApiResult listContextAlbum(final String name, final String version) { try { final Set<AxContextAlbum> contextAlbumSet = apexModel.getPolicyModel().getAlbums().getAll(name, version); if (name != null && contextAlbumSet.isEmpty()) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT_S + name + ':' + version + DO_ES_NOT_EXIST); } - final ApexAPIResult result = new ApexAPIResult(); + final ApexApiResult result = new ApexApiResult(); for (final AxContextAlbum contextAlbum : contextAlbumSet) { result.addMessage(new ApexModelStringWriter<AxContextAlbum>(false).writeString(contextAlbum, AxContextAlbum.class, jsonMode)); } return result; } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -221,25 +221,25 @@ public class ContextAlbumFacade { * @param version version of the context album, set to null to delete versions * @return result of the operation */ - public ApexAPIResult deleteContextAlbum(final String name, final String version) { + public ApexApiResult deleteContextAlbum(final String name, final String version) { try { if (version != null) { final AxArtifactKey key = new AxArtifactKey(name, version); if (apexModel.getPolicyModel().getAlbums().getAlbumsMap().remove(key) != null) { - return new ApexAPIResult(); + return new ApexApiResult(); } else { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + key.getId() + DOES_NOT_EXIST); } } final Set<AxContextAlbum> contextAlbumSet = apexModel.getPolicyModel().getAlbums().getAll(name, version); if (contextAlbumSet.isEmpty()) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT_S + name + ':' + version + DO_ES_NOT_EXIST); } - final ApexAPIResult result = new ApexAPIResult(); + final ApexApiResult result = new ApexApiResult(); for (final AxContextAlbum contextAlbum : contextAlbumSet) { result.addMessage(new ApexModelStringWriter<AxContextAlbum>(false).writeString(contextAlbum, AxContextAlbum.class, jsonMode)); @@ -248,7 +248,7 @@ public class ContextAlbumFacade { } return result; } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -259,15 +259,15 @@ public class ContextAlbumFacade { * @param version starting version of the context album, set to null to list all versions * @return result of the operation */ - public ApexAPIResult validateContextAlbum(final String name, final String version) { + public ApexApiResult validateContextAlbum(final String name, final String version) { try { final Set<AxContextAlbum> contextAlbumSet = apexModel.getPolicyModel().getAlbums().getAll(name, version); if (contextAlbumSet.isEmpty()) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT_S + name + ':' + version + DO_ES_NOT_EXIST); } - final ApexAPIResult result = new ApexAPIResult(); + final ApexApiResult result = new ApexApiResult(); for (final AxContextAlbum contextAlbum : contextAlbumSet) { final AxValidationResult validationResult = contextAlbum.validate(new AxValidationResult()); result.addMessage(new ApexModelStringWriter<AxArtifactKey>(false).writeString(contextAlbum.getKey(), @@ -276,7 +276,7 @@ public class ContextAlbumFacade { } return result; } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } } diff --git a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ContextSchemaFacade.java b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ContextSchemaFacade.java index 620f229f1..6bcf8ecbf 100644 --- a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ContextSchemaFacade.java +++ b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ContextSchemaFacade.java @@ -27,7 +27,7 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; import org.onap.policy.apex.model.basicmodel.handling.ApexModelStringWriter; import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema; -import org.onap.policy.apex.model.modelapi.ApexAPIResult; +import org.onap.policy.apex.model.modelapi.ApexApiResult; import org.onap.policy.apex.model.modelapi.ApexModel; import org.onap.policy.apex.model.utilities.Assertions; @@ -37,13 +37,13 @@ import org.onap.policy.apex.model.utilities.Assertions; * @author Liam Fallon (liam.fallon@ericsson.com) */ public class ContextSchemaFacade { - private static final String CONCEPT = "concept "; - private static final String CONCEPT_S = "concept(s) "; + private static final String CONCEPT = "concept "; + private static final String CONCEPT_S = "concept(s) "; private static final String DOES_NOT_EXIST = " does not exist"; - private static final String DO_ES_NOT_EXIST = " do(es) not exist"; - private static final String ALREADY_EXISTS = " already exists"; + private static final String DO_ES_NOT_EXIST = " do(es) not exist"; + private static final String ALREADY_EXISTS = " already exists"; - // Apex model we're working towards + // Apex model we're working towards private final ApexModel apexModel; // Properties to use for the model @@ -81,8 +81,8 @@ public class ContextSchemaFacade { * @param description context schema description, set to null to generate a description * @return result of the operation */ - public ApexAPIResult createContextSchema(final String name, final String version, final String schemaFlavour, final String schemaDefinition, - final String uuid, final String description) { + public ApexApiResult createContextSchema(final String name, final String version, final String schemaFlavour, + final String schemaDefinition, final String uuid, final String description) { try { Assertions.argumentNotNull(schemaFlavour, "schemaFlavour may not be null"); @@ -90,26 +90,24 @@ public class ContextSchemaFacade { key.setName(name); if (version != null) { key.setVersion(version); - } - else { + } else { key.setVersion(apexProperties.getProperty("DEFAULT_CONCEPT_VERSION")); } if (apexModel.getPolicyModel().getSchemas().getSchemasMap().containsKey(key)) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, CONCEPT + key.getId() + ALREADY_EXISTS); + return new ApexApiResult(ApexApiResult.Result.CONCEPT_EXISTS, CONCEPT + key.getId() + ALREADY_EXISTS); } - apexModel.getPolicyModel().getSchemas().getSchemasMap().put(key, new AxContextSchema(key, schemaFlavour, schemaDefinition)); + apexModel.getPolicyModel().getSchemas().getSchemasMap().put(key, + new AxContextSchema(key, schemaFlavour, schemaDefinition)); if (apexModel.getPolicyModel().getKeyInformation().getKeyInfoMap().containsKey(key)) { return keyInformationFacade.updateKeyInformation(name, version, uuid, description); - } - else { + } else { return keyInformationFacade.createKeyInformation(name, version, uuid, description); } - } - catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + } catch (final Exception e) { + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -124,12 +122,13 @@ public class ContextSchemaFacade { * @param description context schema description, set to null to not update * @return result of the operation */ - public ApexAPIResult updateContextSchema(final String name, final String version, final String schemaFlavour, final String schemaDefinition, - final String uuid, final String description) { + public ApexApiResult updateContextSchema(final String name, final String version, final String schemaFlavour, + final String schemaDefinition, final String uuid, final String description) { try { final AxContextSchema schema = apexModel.getPolicyModel().getSchemas().get(name, version); if (schema == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + DOES_NOT_EXIST); + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, + CONCEPT + name + ':' + version + DOES_NOT_EXIST); } if (schemaFlavour != null) { @@ -141,9 +140,8 @@ public class ContextSchemaFacade { } return keyInformationFacade.updateKeyInformation(name, version, uuid, description); - } - catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + } catch (final Exception e) { + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -154,21 +152,22 @@ public class ContextSchemaFacade { * @param version starting version of the context schema, set to null to list all versions * @return result of the operation */ - public ApexAPIResult listContextSchemas(final String name, final String version) { + public ApexApiResult listContextSchemas(final String name, final String version) { try { final Set<AxContextSchema> schemaSet = apexModel.getPolicyModel().getSchemas().getAll(name, version); if (name != null && schemaSet.isEmpty()) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, CONCEPT_S + name + ':' + version + DO_ES_NOT_EXIST); + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, + CONCEPT_S + name + ':' + version + DO_ES_NOT_EXIST); } - final ApexAPIResult result = new ApexAPIResult(); + final ApexApiResult result = new ApexApiResult(); for (final AxContextSchema schema : schemaSet) { - result.addMessage(new ApexModelStringWriter<AxContextSchema>(false).writeString(schema, AxContextSchema.class, jsonMode)); + result.addMessage(new ApexModelStringWriter<AxContextSchema>(false).writeString(schema, + AxContextSchema.class, jsonMode)); } return result; - } - catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + } catch (final Exception e) { + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -179,35 +178,38 @@ public class ContextSchemaFacade { * @param version version of the context schema, set to null to delete all versions * @return result of the operation */ - public ApexAPIResult deleteContextSchema(final String name, final String version) { + public ApexApiResult deleteContextSchema(final String name, final String version) { try { if (version != null) { final AxArtifactKey key = new AxArtifactKey(name, version); - final AxContextSchema removedSchema = apexModel.getPolicyModel().getSchemas().getSchemasMap().remove(key); + final AxContextSchema removedSchema = apexModel.getPolicyModel().getSchemas().getSchemasMap() + .remove(key); if (removedSchema != null) { - return new ApexAPIResult(ApexAPIResult.RESULT.SUCCESS, - new ApexModelStringWriter<AxContextSchema>(false).writeString(removedSchema, AxContextSchema.class, jsonMode)); - } - else { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, CONCEPT + key.getId() + DOES_NOT_EXIST); + return new ApexApiResult(ApexApiResult.Result.SUCCESS, + new ApexModelStringWriter<AxContextSchema>(false).writeString(removedSchema, + AxContextSchema.class, jsonMode)); + } else { + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, + CONCEPT + key.getId() + DOES_NOT_EXIST); } } final Set<AxContextSchema> schemaSet = apexModel.getPolicyModel().getSchemas().getAll(name, version); if (schemaSet.isEmpty()) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, CONCEPT_S + name + ':' + version + DO_ES_NOT_EXIST); + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, + CONCEPT_S + name + ':' + version + DO_ES_NOT_EXIST); } - final ApexAPIResult result = new ApexAPIResult(); + final ApexApiResult result = new ApexApiResult(); for (final AxContextSchema schema : schemaSet) { - result.addMessage(new ApexModelStringWriter<AxContextSchema>(false).writeString(schema, AxContextSchema.class, jsonMode)); + result.addMessage(new ApexModelStringWriter<AxContextSchema>(false).writeString(schema, + AxContextSchema.class, jsonMode)); apexModel.getPolicyModel().getSchemas().getSchemasMap().remove(schema.getKey()); keyInformationFacade.deleteKeyInformation(name, version); } return result; - } - catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + } catch (final Exception e) { + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -218,23 +220,24 @@ public class ContextSchemaFacade { * @param version starting version of the context schema, set to null to list all versions * @return result of the operation */ - public ApexAPIResult validateContextSchemas(final String name, final String version) { + public ApexApiResult validateContextSchemas(final String name, final String version) { try { final Set<AxContextSchema> schemaSet = apexModel.getPolicyModel().getSchemas().getAll(name, version); if (schemaSet.isEmpty()) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, CONCEPT_S + name + ':' + version + DO_ES_NOT_EXIST); + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, + CONCEPT_S + name + ':' + version + DO_ES_NOT_EXIST); } - final ApexAPIResult result = new ApexAPIResult(); + final ApexApiResult result = new ApexApiResult(); for (final AxContextSchema schema : schemaSet) { final AxValidationResult validationResult = schema.validate(new AxValidationResult()); - result.addMessage(new ApexModelStringWriter<AxArtifactKey>(false).writeString(schema.getKey(), AxArtifactKey.class, jsonMode)); + result.addMessage(new ApexModelStringWriter<AxArtifactKey>(false).writeString(schema.getKey(), + AxArtifactKey.class, jsonMode)); result.addMessage(validationResult.toString()); } return result; - } - catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + } catch (final Exception e) { + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } } diff --git a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/EventFacade.java b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/EventFacade.java index 4706ff70a..645ad9a08 100644 --- a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/EventFacade.java +++ b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/EventFacade.java @@ -30,7 +30,7 @@ import org.onap.policy.apex.model.basicmodel.handling.ApexModelStringWriter; import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema; import org.onap.policy.apex.model.eventmodel.concepts.AxEvent; import org.onap.policy.apex.model.eventmodel.concepts.AxField; -import org.onap.policy.apex.model.modelapi.ApexAPIResult; +import org.onap.policy.apex.model.modelapi.ApexApiResult; import org.onap.policy.apex.model.modelapi.ApexModel; import org.onap.policy.apex.model.utilities.Assertions; @@ -87,7 +87,7 @@ public class EventFacade { * @param description event description, set to null to generate a description * @return result of the operation */ - public ApexAPIResult createEvent(final String name, final String version, final String nameSpace, + public ApexApiResult createEvent(final String name, final String version, final String nameSpace, final String source, final String target, final String uuid, final String description) { try { final AxArtifactKey key = new AxArtifactKey(); @@ -99,7 +99,7 @@ public class EventFacade { } if (apexModel.getPolicyModel().getEvents().getEventMap().containsKey(key)) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, CONCEPT + key.getId() + ALREADY_EXISTS); + return new ApexApiResult(ApexApiResult.Result.CONCEPT_EXISTS, CONCEPT + key.getId() + ALREADY_EXISTS); } final AxEvent event = new AxEvent(key); @@ -116,7 +116,7 @@ public class EventFacade { return keyInformationFacade.createKeyInformation(name, version, uuid, description); } } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -132,12 +132,12 @@ public class EventFacade { * @param description event description, set to null to not update * @return result of the operation */ - public ApexAPIResult updateEvent(final String name, final String version, final String nameSpace, + public ApexApiResult updateEvent(final String name, final String version, final String nameSpace, final String source, final String target, final String uuid, final String description) { try { final AxEvent event = apexModel.getPolicyModel().getEvents().get(name, version); if (event == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + DOES_NOT_EXIST); } @@ -153,7 +153,7 @@ public class EventFacade { return keyInformationFacade.updateKeyInformation(name, version, uuid, description); } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -164,22 +164,22 @@ public class EventFacade { * @param version starting version of the event, set to null to list all versions * @return result of the operation */ - public ApexAPIResult listEvent(final String name, final String version) { + public ApexApiResult listEvent(final String name, final String version) { try { final Set<AxEvent> eventSet = apexModel.getPolicyModel().getEvents().getAll(name, version); if (name != null && eventSet.isEmpty()) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT_S + name + ':' + version + DO_ES_NOT_EXIST); } - final ApexAPIResult result = new ApexAPIResult(); + final ApexApiResult result = new ApexApiResult(); for (final AxEvent event : eventSet) { result.addMessage( new ApexModelStringWriter<AxEvent>(false).writeString(event, AxEvent.class, jsonMode)); } return result; } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -190,27 +190,27 @@ public class EventFacade { * @param version version of the event, set to null to delete all versions * @return result of the operation */ - public ApexAPIResult deleteEvent(final String name, final String version) { + public ApexApiResult deleteEvent(final String name, final String version) { try { if (version != null) { final AxArtifactKey key = new AxArtifactKey(name, version); final AxEvent removedEvent = apexModel.getPolicyModel().getEvents().getEventMap().remove(key); if (removedEvent != null) { - return new ApexAPIResult(ApexAPIResult.RESULT.SUCCESS, new ApexModelStringWriter<AxEvent>(false) + return new ApexApiResult(ApexApiResult.Result.SUCCESS, new ApexModelStringWriter<AxEvent>(false) .writeString(removedEvent, AxEvent.class, jsonMode)); } else { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + key.getId() + DOES_NOT_EXIST); } } final Set<AxEvent> eventSet = apexModel.getPolicyModel().getEvents().getAll(name, version); if (eventSet.isEmpty()) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT_S + name + ':' + version + DO_ES_NOT_EXIST); } - final ApexAPIResult result = new ApexAPIResult(); + final ApexApiResult result = new ApexApiResult(); for (final AxEvent event : eventSet) { result.addMessage( new ApexModelStringWriter<AxEvent>(false).writeString(event, AxEvent.class, jsonMode)); @@ -219,7 +219,7 @@ public class EventFacade { } return result; } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -230,15 +230,15 @@ public class EventFacade { * @param version starting version of the event, set to null to list all versions * @return result of the operation */ - public ApexAPIResult validateEvent(final String name, final String version) { + public ApexApiResult validateEvent(final String name, final String version) { try { final Set<AxEvent> eventSet = apexModel.getPolicyModel().getEvents().getAll(name, version); if (eventSet.isEmpty()) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT_S + name + ':' + version + DO_ES_NOT_EXIST); } - final ApexAPIResult result = new ApexAPIResult(); + final ApexApiResult result = new ApexApiResult(); for (final AxEvent event : eventSet) { final AxValidationResult validationResult = event.validate(new AxValidationResult()); result.addMessage(new ApexModelStringWriter<AxArtifactKey>(false).writeString(event.getKey(), @@ -247,7 +247,7 @@ public class EventFacade { } return result; } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -263,35 +263,35 @@ public class EventFacade { * @param optional true if the event parameter is optional, false otherwise * @return result of the operation */ - public ApexAPIResult createEventPar(final String name, final String version, final String parName, + public ApexApiResult createEventPar(final String name, final String version, final String parName, final String contextSchemaName, final String contextSchemaVersion, final boolean optional) { try { Assertions.argumentNotNull(parName, "parName may not be null"); final AxEvent event = apexModel.getPolicyModel().getEvents().get(name, version); if (event == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + DOES_NOT_EXIST); } final AxReferenceKey refKey = new AxReferenceKey(event.getKey(), parName); if (event.getParameterMap().containsKey(refKey.getLocalName())) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_EXISTS, CONCEPT + refKey.getId() + ALREADY_EXISTS); } final AxContextSchema schema = apexModel.getPolicyModel().getSchemas().get(contextSchemaName, contextSchemaVersion); if (schema == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + contextSchemaName + ':' + contextSchemaVersion + DOES_NOT_EXIST); } event.getParameterMap().put(refKey.getLocalName(), new AxField(refKey, schema.getKey(), optional)); - return new ApexAPIResult(); + return new ApexApiResult(); } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -303,30 +303,30 @@ public class EventFacade { * @param parName name of the parameter, set to null to list all parameters of the event * @return result of the operation */ - public ApexAPIResult listEventPar(final String name, final String version, final String parName) { + public ApexApiResult listEventPar(final String name, final String version, final String parName) { try { final AxEvent event = apexModel.getPolicyModel().getEvents().get(name, version); if (event == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + DOES_NOT_EXIST); } if (parName != null) { final AxField eventField = event.getParameterMap().get(parName); if (eventField != null) { - return new ApexAPIResult(ApexAPIResult.RESULT.SUCCESS, + return new ApexApiResult(ApexApiResult.Result.SUCCESS, new ApexModelStringWriter<AxField>(false).writeString(eventField, AxField.class, jsonMode)); } else { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + ':' + parName + DOES_NOT_EXIST); } } else { if (event.getParameterMap().size() == 0) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, "no parameters defined on event " + event.getKey().getId()); } - final ApexAPIResult result = new ApexAPIResult(); + final ApexApiResult result = new ApexApiResult(); for (final AxField eventPar : event.getParameterMap().values()) { result.addMessage( new ApexModelStringWriter<AxField>(false).writeString(eventPar, AxField.class, jsonMode)); @@ -334,7 +334,7 @@ public class EventFacade { return result; } } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -346,15 +346,15 @@ public class EventFacade { * @param parName of the parameter, set to null to delete all parameters * @return result of the operation */ - public ApexAPIResult deleteEventPar(final String name, final String version, final String parName) { + public ApexApiResult deleteEventPar(final String name, final String version, final String parName) { try { final AxEvent event = apexModel.getPolicyModel().getEvents().get(name, version); if (event == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + DOES_NOT_EXIST); } - final ApexAPIResult result = new ApexAPIResult(); + final ApexApiResult result = new ApexApiResult(); if (parName != null) { if (event.getParameterMap().containsKey(parName)) { result.addMessage(new ApexModelStringWriter<AxField>(false) @@ -362,12 +362,12 @@ public class EventFacade { event.getParameterMap().remove(parName); return result; } else { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + ':' + parName + DOES_NOT_EXIST); } } else { if (event.getParameterMap().size() == 0) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, "no parameters defined on event " + event.getKey().getId()); } @@ -379,7 +379,7 @@ public class EventFacade { return result; } } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } } diff --git a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/KeyInformationFacade.java b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/KeyInformationFacade.java index e3e3db0c9..7cbcfc713 100644 --- a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/KeyInformationFacade.java +++ b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/KeyInformationFacade.java @@ -28,7 +28,7 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; import org.onap.policy.apex.model.basicmodel.handling.ApexModelStringWriter; -import org.onap.policy.apex.model.modelapi.ApexAPIResult; +import org.onap.policy.apex.model.modelapi.ApexApiResult; import org.onap.policy.apex.model.modelapi.ApexModel; /** @@ -76,7 +76,7 @@ public class KeyInformationFacade { * @param description key information description, set to null to generate a description * @return result of the operation */ - public ApexAPIResult createKeyInformation(final String name, final String version, final String uuid, + public ApexApiResult createKeyInformation(final String name, final String version, final String uuid, final String description) { try { final AxArtifactKey key = new AxArtifactKey(); @@ -88,7 +88,7 @@ public class KeyInformationFacade { } if (apexModel.getPolicyModel().getKeyInformation().getKeyInfoMap().containsKey(key)) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, CONCEPT + key.getId() + ALREADY_EXISTS); + return new ApexApiResult(ApexApiResult.Result.CONCEPT_EXISTS, CONCEPT + key.getId() + ALREADY_EXISTS); } final AxKeyInfo keyInfo = new AxKeyInfo(key); @@ -102,9 +102,9 @@ public class KeyInformationFacade { keyInfo.setUuid(AxKeyInfo.generateReproducibleUuid(keyInfo.getId() + keyInfo.getDescription())); } apexModel.getPolicyModel().getKeyInformation().getKeyInfoMap().put(key, keyInfo); - return new ApexAPIResult(); + return new ApexApiResult(); } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -118,12 +118,12 @@ public class KeyInformationFacade { * @param description key information description, set to null to not update * @return result of the operation */ - public ApexAPIResult updateKeyInformation(final String name, final String version, final String uuid, + public ApexApiResult updateKeyInformation(final String name, final String version, final String uuid, final String description) { try { final AxKeyInfo keyInfo = apexModel.getPolicyModel().getKeyInformation().get(name, version); if (keyInfo == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ":" + version + DOES_NOT_EXIST); } @@ -138,9 +138,9 @@ public class KeyInformationFacade { keyInfo.setUuid(AxKeyInfo.generateReproducibleUuid(keyInfo.getId() + keyInfo.getDescription())); } - return new ApexAPIResult(); + return new ApexApiResult(); } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -152,22 +152,22 @@ public class KeyInformationFacade { * all versions * @return result of the operation */ - public ApexAPIResult listKeyInformation(final String name, final String version) { + public ApexApiResult listKeyInformation(final String name, final String version) { try { final Set<AxKeyInfo> keyInfoSet = apexModel.getPolicyModel().getKeyInformation().getAll(name, version); if (name != null && keyInfoSet.isEmpty()) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT_S + name + ':' + version + DO_ES_NOT_EXIST); } - final ApexAPIResult result = new ApexAPIResult(); + final ApexApiResult result = new ApexApiResult(); for (final AxKeyInfo keyInfo : keyInfoSet) { result.addMessage( new ApexModelStringWriter<AxKeyInfo>(false).writeString(keyInfo, AxKeyInfo.class, jsonMode)); } return result; } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -179,28 +179,28 @@ public class KeyInformationFacade { * versions * @return result of the operation */ - public ApexAPIResult deleteKeyInformation(final String name, final String version) { + public ApexApiResult deleteKeyInformation(final String name, final String version) { try { if (version != null) { final AxArtifactKey key = new AxArtifactKey(name, version); final AxKeyInfo removedKeyInfo = apexModel.getPolicyModel().getKeyInformation().getKeyInfoMap().remove(key); if (removedKeyInfo != null) { - return new ApexAPIResult(ApexAPIResult.RESULT.SUCCESS, new ApexModelStringWriter<AxKeyInfo>(false) + return new ApexApiResult(ApexApiResult.Result.SUCCESS, new ApexModelStringWriter<AxKeyInfo>(false) .writeString(removedKeyInfo, AxKeyInfo.class, jsonMode)); } else { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + key.getId() + DOES_NOT_EXIST); } } final Set<AxKeyInfo> keyInfoSet = apexModel.getPolicyModel().getKeyInformation().getAll(name, version); if (keyInfoSet.isEmpty()) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT_S + name + ':' + version + DO_ES_NOT_EXIST); } - final ApexAPIResult result = new ApexAPIResult(); + final ApexApiResult result = new ApexApiResult(); for (final AxKeyInfo keyInfo : keyInfoSet) { result.addMessage( new ApexModelStringWriter<AxKeyInfo>(false).writeString(keyInfo, AxKeyInfo.class, jsonMode)); @@ -208,7 +208,7 @@ public class KeyInformationFacade { } return result; } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -220,15 +220,15 @@ public class KeyInformationFacade { * versions * @return result of the operation */ - public ApexAPIResult validateKeyInformation(final String name, final String version) { + public ApexApiResult validateKeyInformation(final String name, final String version) { try { final Set<AxKeyInfo> keyInfoSet = apexModel.getPolicyModel().getKeyInformation().getAll(name, version); if (keyInfoSet.isEmpty()) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT_S + name + ':' + version + DO_ES_NOT_EXIST); } - final ApexAPIResult result = new ApexAPIResult(); + final ApexApiResult result = new ApexApiResult(); for (final AxKeyInfo keyInfo : keyInfoSet) { final AxValidationResult validationResult = keyInfo.validate(new AxValidationResult()); result.addMessage(new ApexModelStringWriter<AxArtifactKey>(false).writeString(keyInfo.getKey(), @@ -237,7 +237,7 @@ public class KeyInformationFacade { } return result; } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } diff --git a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ModelFacade.java b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ModelFacade.java index 65be2ae82..a44032634 100644 --- a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ModelFacade.java +++ b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ModelFacade.java @@ -24,7 +24,7 @@ import java.util.Properties; import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; import org.onap.policy.apex.model.basicmodel.handling.ApexModelStringWriter; -import org.onap.policy.apex.model.modelapi.ApexAPIResult; +import org.onap.policy.apex.model.modelapi.ApexApiResult; import org.onap.policy.apex.model.modelapi.ApexModel; import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; import org.onap.policy.apex.model.utilities.Assertions; @@ -80,7 +80,7 @@ public class ModelFacade { * @param description model description, set to null to generate a description * @return result of the operation */ - public ApexAPIResult createModel(final String name, final String version, final String uuid, + public ApexApiResult createModel(final String name, final String version, final String uuid, final String description) { try { final AxArtifactKey key = new AxArtifactKey(); @@ -92,26 +92,26 @@ public class ModelFacade { if (defaultVersion != null) { key.setVersion(defaultVersion); } else { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, CONCEPT + name + NO_VERSION_SPECIFIED); + return new ApexApiResult(ApexApiResult.Result.FAILED, CONCEPT + name + NO_VERSION_SPECIFIED); } } if (!apexModel.getPolicyModel().getKey().equals(AxArtifactKey.getNullKey())) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_EXISTS, CONCEPT + apexModel.getPolicyModel().getKey().getId() + ALREADY_CREATED); } apexModel.setPolicyModel(new AxPolicyModel(key)); - ApexAPIResult result; + ApexApiResult result; result = keyInformationFacade.createKeyInformation(name, version, uuid, description); - if (result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)) { + if (result.getResult().equals(ApexApiResult.Result.SUCCESS)) { apexModel.getPolicyModel().getKeyInformation().generateKeyInfo(apexModel.getPolicyModel()); } return result; } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -124,7 +124,7 @@ public class ModelFacade { * @param description policy description, set to null to not update * @return result of the operation */ - public ApexAPIResult updateModel(final String name, final String version, final String uuid, + public ApexApiResult updateModel(final String name, final String version, final String uuid, final String description) { try { final AxArtifactKey key = new AxArtifactKey(); @@ -136,19 +136,19 @@ public class ModelFacade { if (defaultVersion != null) { key.setVersion(defaultVersion); } else { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, + return new ApexApiResult(ApexApiResult.Result.FAILED, CONCEPT + apexModel.getPolicyModel().getKey().getId() + NO_VERSION_SPECIFIED); } } if (apexModel.getPolicyModel().getKey().equals(AxArtifactKey.getNullKey())) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + apexModel.getPolicyModel().getKey().getId() + DOES_NOT_EXIST); } return keyInformationFacade.updateKeyInformation(name, version, uuid, description); } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -157,15 +157,15 @@ public class ModelFacade { * * @return the result of the operation */ - public ApexAPIResult getModelKey() { + public ApexApiResult getModelKey() { try { - final ApexAPIResult result = new ApexAPIResult(); + final ApexApiResult result = new ApexApiResult(); final AxArtifactKey modelkey = apexModel.getPolicyModel().getKey(); result.addMessage(new ApexModelStringWriter<AxArtifactKey>(false).writeString(modelkey, AxArtifactKey.class, jsonMode)); return result; } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -174,14 +174,14 @@ public class ModelFacade { * * @return the result of the operation */ - public ApexAPIResult listModel() { + public ApexApiResult listModel() { try { - final ApexAPIResult result = new ApexAPIResult(); + final ApexApiResult result = new ApexApiResult(); result.addMessage(new ApexModelStringWriter<AxPolicyModel>(false).writeString(apexModel.getPolicyModel(), AxPolicyModel.class, jsonMode)); return result; } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -190,7 +190,7 @@ public class ModelFacade { * * @return the result of the operation */ - public ApexAPIResult deleteModel() { + public ApexApiResult deleteModel() { // @formatter:off apexModel.getPolicyModel().getSchemas() .getSchemasMap() .clear(); apexModel.getPolicyModel().getEvents() .getEventMap() .clear(); @@ -202,6 +202,6 @@ public class ModelFacade { apexModel.setPolicyModel(new AxPolicyModel()); - return new ApexAPIResult(); + return new ApexApiResult(); } } diff --git a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ModelHandlerFacade.java b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ModelHandlerFacade.java index 5e54744d5..0f6bd0830 100644 --- a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ModelHandlerFacade.java +++ b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ModelHandlerFacade.java @@ -45,7 +45,7 @@ import org.onap.policy.apex.model.basicmodel.handling.ApexModelFileWriter; import org.onap.policy.apex.model.basicmodel.handling.ApexModelReader; import org.onap.policy.apex.model.basicmodel.handling.ApexModelStringWriter; import org.onap.policy.apex.model.basicmodel.handling.ApexModelWriter; -import org.onap.policy.apex.model.modelapi.ApexAPIResult; +import org.onap.policy.apex.model.modelapi.ApexApiResult; import org.onap.policy.apex.model.modelapi.ApexModel; import org.onap.policy.apex.model.policymodel.concepts.AxPolicy; import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; @@ -84,8 +84,7 @@ public class ModelHandlerFacade { * * @param apexModel the apex model to manipulate * @param apexProperties properties for the model - * @param jsonMode set to true to return JSON strings in list and delete operations, otherwise - * set to false + * @param jsonMode set to true to return JSON strings in list and delete operations, otherwise set to false */ public ModelHandlerFacade(final ApexModel apexModel, final Properties apexProperties, final boolean jsonMode) { Assertions.argumentNotNull(apexModel, "apexModel may not be null"); @@ -101,15 +100,15 @@ public class ModelHandlerFacade { * @param modelString the string with the model * @return the result of the operation */ - public ApexAPIResult loadFromString(final String modelString) { + public ApexApiResult loadFromString(final String modelString) { Assertions.argumentNotNull(modelString, "modelString may not be null"); if (!apexModel.getPolicyModel().getKey().equals(AxArtifactKey.getNullKey())) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, - MODEL + apexModel.getPolicyModel().getKey().getId() + ALREADY_LOADED); + return new ApexApiResult(ApexApiResult.Result.CONCEPT_EXISTS, + MODEL + apexModel.getPolicyModel().getKey().getId() + ALREADY_LOADED); } - ApexAPIResult result = new ApexAPIResult(); + ApexApiResult result = new ApexApiResult(); AxPolicyModel newPolicyModel = loadModelFromString(modelString, result); apexModel.setPolicyModel(newPolicyModel != null ? newPolicyModel : new AxPolicyModel()); @@ -122,15 +121,15 @@ public class ModelHandlerFacade { * @param fileName the file name of the file with the model * @return the result of the operation */ - public ApexAPIResult loadFromFile(final String fileName) { + public ApexApiResult loadFromFile(final String fileName) { Assertions.argumentNotNull(fileName, FILE_NAME_MAY_NOT_BE_NULL); if (!apexModel.getPolicyModel().getKey().equals(AxArtifactKey.getNullKey())) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, - MODEL + apexModel.getPolicyModel().getKey().getId() + ALREADY_LOADED); + return new ApexApiResult(ApexApiResult.Result.CONCEPT_EXISTS, + MODEL + apexModel.getPolicyModel().getKey().getId() + ALREADY_LOADED); } - ApexAPIResult result = new ApexAPIResult(); + ApexApiResult result = new ApexApiResult(); AxPolicyModel newPolicyModel = loadModelFromFile(fileName, result); apexModel.setPolicyModel(newPolicyModel != null ? newPolicyModel : new AxPolicyModel()); @@ -141,11 +140,10 @@ public class ModelHandlerFacade { * Save an Apex model to a file. * * @param fileName the file name - * @param xmlFlag if true, save the file in XML format, otherwise save the file in the default - * JSON format + * @param xmlFlag if true, save the file in XML format, otherwise save the file in the default JSON format * @return the result of the operation */ - public ApexAPIResult saveToFile(final String fileName, final boolean xmlFlag) { + public ApexApiResult saveToFile(final String fileName, final boolean xmlFlag) { Assertions.argumentNotNull(fileName, FILE_NAME_MAY_NOT_BE_NULL); ApexModelFileWriter<AxPolicyModel> apexModelFileWriter = new ApexModelFileWriter<>(false); @@ -156,9 +154,9 @@ public class ModelHandlerFacade { } else { apexModelFileWriter.apexModelWriteJsonFile(apexModel.getPolicyModel(), AxPolicyModel.class, fileName); } - return new ApexAPIResult(); + return new ApexApiResult(); } catch (ApexException e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -166,38 +164,38 @@ public class ModelHandlerFacade { * Load an Apex model from a database. * * @param modelName the name of the model to load - * @param modelVersion the version of the model to load, loads the policy model from the - * database with this name, if more than one exist, an exception is thrown - * @param DaoParameters the parameters to use to access the database over JDBC + * @param modelVersion the version of the model to load, loads the policy model from the database with this name, if + * more than one exist, an exception is thrown + * @param daoParameters the parameters to use to access the database over JDBC * @return the result of the operation */ - public ApexAPIResult loadFromDatabase(final String modelName, final String modelVersion, - final DaoParameters DaoParameters) { + public ApexApiResult loadFromDatabase(final String modelName, final String modelVersion, + final DaoParameters daoParameters) { Assertions.argumentNotNull(modelName, "modelName may not be null"); - Assertions.argumentNotNull(DaoParameters, "DaoParameters may not be null"); + Assertions.argumentNotNull(daoParameters, "DaoParameters may not be null"); if (!apexModel.getPolicyModel().getKey().equals(AxArtifactKey.getNullKey())) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, - MODEL + apexModel.getPolicyModel().getKey().getId() + ALREADY_LOADED); + return new ApexApiResult(ApexApiResult.Result.CONCEPT_EXISTS, + MODEL + apexModel.getPolicyModel().getKey().getId() + ALREADY_LOADED); } ApexDao apexDao = null; try { - apexDao = new ApexDaoFactory().createApexDao(DaoParameters); - apexDao.init(DaoParameters); + apexDao = new ApexDaoFactory().createApexDao(daoParameters); + apexDao.init(daoParameters); // Single specific model requested if (modelVersion != null) { - AxPolicyModel daoPolicyModel = - apexDao.get(AxPolicyModel.class, new AxArtifactKey(modelName, modelVersion)); + AxPolicyModel daoPolicyModel = apexDao.get(AxPolicyModel.class, + new AxArtifactKey(modelName, modelVersion)); if (daoPolicyModel != null) { apexModel.setPolicyModel(daoPolicyModel); - return new ApexAPIResult(); + return new ApexApiResult(); } else { apexModel.setPolicyModel(new AxPolicyModel()); - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, "no policy model with name " + modelName - + " and version " + modelVersion + FOUND_IN_DATABASE); + return new ApexApiResult(ApexApiResult.Result.FAILED, "no policy model with name " + modelName + + " and version " + modelVersion + FOUND_IN_DATABASE); } } // Fishing expedition @@ -205,7 +203,7 @@ public class ModelHandlerFacade { return searchInDatabase(modelName, apexDao, apexModel); } } catch (ApexException | ApexRuntimeException e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } finally { if (apexDao != null) { apexDao.close(); @@ -221,7 +219,7 @@ public class ModelHandlerFacade { * @param apexModel the APEX model we are loading the found model into * @return the result of the operation */ - private ApexAPIResult searchInDatabase(String modelName, ApexDao apexDao, ApexModel apexModel) { + private ApexApiResult searchInDatabase(String modelName, ApexDao apexDao, ApexModel apexModel) { AxPolicyModel foundPolicyModel = null; List<AxPolicyModel> policyModelList = apexDao.getAll(AxPolicyModel.class); @@ -230,39 +228,39 @@ public class ModelHandlerFacade { if (foundPolicyModel == null) { foundPolicyModel = dbPolicyModel; } else { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, - "more than one policy model with name " + modelName + FOUND_IN_DATABASE); + return new ApexApiResult(ApexApiResult.Result.FAILED, + "more than one policy model with name " + modelName + FOUND_IN_DATABASE); } } } if (foundPolicyModel != null) { apexModel.setPolicyModel(foundPolicyModel); - return new ApexAPIResult(); + return new ApexApiResult(); } else { apexModel.setPolicyModel(new AxPolicyModel()); - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, - "no policy model with name " + modelName + FOUND_IN_DATABASE); + return new ApexApiResult(ApexApiResult.Result.FAILED, + "no policy model with name " + modelName + FOUND_IN_DATABASE); } } /** * Save an Apex model to a database. * - * @param DaoParameters the parameters to use to access the database over JDBC + * @param daoParameters the parameters to use to access the database over JDBC * @return the result of the operation */ - public ApexAPIResult saveToDatabase(final DaoParameters DaoParameters) { + public ApexApiResult saveToDatabase(final DaoParameters daoParameters) { ApexDao apexDao = null; try { - apexDao = new ApexDaoFactory().createApexDao(DaoParameters); - apexDao.init(DaoParameters); + apexDao = new ApexDaoFactory().createApexDao(daoParameters); + apexDao.init(daoParameters); apexDao.create(apexModel.getPolicyModel()); - return new ApexAPIResult(); + return new ApexApiResult(); } catch (ApexException e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } finally { if (apexDao != null) { apexDao.close(); @@ -276,19 +274,19 @@ public class ModelHandlerFacade { * @param urlString the url string * @return the result of the operation */ - public ApexAPIResult readFromURL(final String urlString) { + public ApexApiResult readFromUrl(final String urlString) { Assertions.argumentNotNull(urlString, "urlString may not be null"); if (!apexModel.getPolicyModel().getKey().equals(AxArtifactKey.getNullKey())) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, - MODEL + apexModel.getPolicyModel().getKey().getId() + ALREADY_LOADED); + return new ApexApiResult(ApexApiResult.Result.CONCEPT_EXISTS, + MODEL + apexModel.getPolicyModel().getKey().getId() + ALREADY_LOADED); } - URL apexModelURL; + URL apexModelUrl; try { - apexModelURL = new URL(urlString); + apexModelUrl = new URL(urlString); } catch (MalformedURLException e) { - ApexAPIResult result = new ApexAPIResult(ApexAPIResult.RESULT.FAILED); + ApexApiResult result = new ApexApiResult(ApexApiResult.Result.FAILED); result.addMessage("URL string " + urlString + " is not a valid URL"); result.addThrowable(e); return result; @@ -297,12 +295,12 @@ public class ModelHandlerFacade { try { ApexModelReader<AxPolicyModel> apexModelReader = new ApexModelReader<>(AxPolicyModel.class); apexModelReader.setValidateFlag(false); - AxPolicyModel newPolicyModel = apexModelReader.read(apexModelURL.openStream()); + AxPolicyModel newPolicyModel = apexModelReader.read(apexModelUrl.openStream()); apexModel.setPolicyModel(newPolicyModel != null ? newPolicyModel : new AxPolicyModel()); - return new ApexAPIResult(); + return new ApexApiResult(); } catch (ApexModelException | IOException e) { apexModel.setPolicyModel(new AxPolicyModel()); - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -310,18 +308,17 @@ public class ModelHandlerFacade { * Write an APEX model to a location identified by a URL. * * @param urlString the URL to read the model from - * @param xmlFlag if true, save the file in XML format, otherwise save the file in the default - * JSON format + * @param xmlFlag if true, save the file in XML format, otherwise save the file in the default JSON format * @return the result of the operation */ - public ApexAPIResult writeToURL(final String urlString, final boolean xmlFlag) { + public ApexApiResult writeToUrl(final String urlString, final boolean xmlFlag) { Assertions.argumentNotNull(urlString, "urlString may not be null"); - URL apexModelURL; + URL apexModelUrl; try { - apexModelURL = new URL(urlString); + apexModelUrl = new URL(urlString); } catch (MalformedURLException e) { - ApexAPIResult result = new ApexAPIResult(ApexAPIResult.RESULT.FAILED); + ApexApiResult result = new ApexApiResult(ApexApiResult.Result.FAILED); result.addMessage("URL string " + urlString + " is not a valid URL"); result.addThrowable(e); return result; @@ -333,13 +330,13 @@ public class ModelHandlerFacade { apexModelWriter.setJsonOutput(!xmlFlag); // Open the URL for output and write the model - URLConnection urlConnection = apexModelURL.openConnection(); + URLConnection urlConnection = apexModelUrl.openConnection(); urlConnection.setDoOutput(true); apexModelWriter.write(apexModel.getPolicyModel(), urlConnection.getOutputStream()); - return new ApexAPIResult(); + return new ApexApiResult(); } catch (ApexModelException | IOException e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -348,9 +345,9 @@ public class ModelHandlerFacade { * * @return the result of the operation */ - public ApexAPIResult analyse() { + public ApexApiResult analyse() { PolicyAnalysisResult analysisResult = new PolicyAnalyser().analyse(apexModel.getPolicyModel()); - return new ApexAPIResult(ApexAPIResult.RESULT.SUCCESS, analysisResult.toString()); + return new ApexApiResult(ApexApiResult.Result.SUCCESS, analysisResult.toString()); } /** @@ -358,20 +355,20 @@ public class ModelHandlerFacade { * * @return the result of the operation */ - public ApexAPIResult validate() { - ApexAPIResult result = new ApexAPIResult(); + public ApexApiResult validate() { + ApexApiResult result = new ApexApiResult(); try { AxValidationResult validationResult = apexModel.getPolicyModel().validate(new AxValidationResult()); if (!validationResult.isValid()) { - result.setResult(ApexAPIResult.RESULT.FAILED); + result.setResult(ApexApiResult.Result.FAILED); } result.addMessage(new ApexModelStringWriter<AxArtifactKey>(false) - .writeString(apexModel.getPolicyModel().getKey(), AxArtifactKey.class, jsonMode)); + .writeString(apexModel.getPolicyModel().getKey(), AxArtifactKey.class, jsonMode)); result.addMessage(validationResult.toString()); return result; } catch (Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -380,27 +377,26 @@ public class ModelHandlerFacade { * * @param otherModelFileName the file name of the other model * @param diffsOnly only returns differences between the model when set - * @param keysOnly only returns the keys that are different when set, when not set values are - * also returned + * @param keysOnly only returns the keys that are different when set, when not set values are also returned * @return the result of the operation */ - public ApexAPIResult compare(final String otherModelFileName, final boolean diffsOnly, final boolean keysOnly) { - ApexAPIResult result = new ApexAPIResult(); + public ApexApiResult compare(final String otherModelFileName, final boolean diffsOnly, final boolean keysOnly) { + ApexApiResult result = new ApexApiResult(); try { AxPolicyModel otherPolicyModel = loadModelFromFile(otherModelFileName, result); - if (!result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)) { + if (!result.getResult().equals(ApexApiResult.Result.SUCCESS)) { return result; } - PolicyModelComparer policyModelComparer = - new PolicyModelComparer(apexModel.getPolicyModel(), otherPolicyModel); + PolicyModelComparer policyModelComparer = new PolicyModelComparer(apexModel.getPolicyModel(), + otherPolicyModel); result.addMessage(new ApexModelStringWriter<AxArtifactKey>(false) - .writeString(apexModel.getPolicyModel().getKey(), AxArtifactKey.class, jsonMode)); + .writeString(apexModel.getPolicyModel().getKey(), AxArtifactKey.class, jsonMode)); result.addMessage(policyModelComparer.toString()); return result; } catch (Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -409,42 +405,40 @@ public class ModelHandlerFacade { * * @param otherModelString the other model as a string * @param diffsOnly only returns differences between the model when set - * @param keysOnly only returns the keys that are different when set, when not set values are - * also returned + * @param keysOnly only returns the keys that are different when set, when not set values are also returned * @return the result of the operation */ - public ApexAPIResult compareWithString(final String otherModelString, final boolean diffsOnly, - final boolean keysOnly) { - ApexAPIResult result = new ApexAPIResult(); + public ApexApiResult compareWithString(final String otherModelString, final boolean diffsOnly, + final boolean keysOnly) { + ApexApiResult result = new ApexApiResult(); try { AxPolicyModel otherPolicyModel = loadModelFromString(otherModelString, result); - if (!result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)) { + if (!result.getResult().equals(ApexApiResult.Result.SUCCESS)) { return result; } - PolicyModelComparer policyModelComparer = - new PolicyModelComparer(apexModel.getPolicyModel(), otherPolicyModel); + PolicyModelComparer policyModelComparer = new PolicyModelComparer(apexModel.getPolicyModel(), + otherPolicyModel); result.addMessage(new ApexModelStringWriter<AxArtifactKey>(false) - .writeString(apexModel.getPolicyModel().getKey(), AxArtifactKey.class, jsonMode)); + .writeString(apexModel.getPolicyModel().getKey(), AxArtifactKey.class, jsonMode)); result.addMessage(policyModelComparer.toString()); return result; } catch (Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } /** - * Split out a sub model from an Apex model that contains a given subset of the policies in the - * original model. + * Split out a sub model from an Apex model that contains a given subset of the policies in the original model. * - * @param targetModelName the file name of the target model in which to store the model split - * out from the original model - * @param splitOutPolicies the policies form the original model to include in the split out - * model, specified as a comma delimited list of policy names + * @param targetModelName the file name of the target model in which to store the model split out from the original + * model + * @param splitOutPolicies the policies form the original model to include in the split out model, specified as a + * comma delimited list of policy names * @return the result of the operation */ - public ApexAPIResult split(final String targetModelName, final String splitOutPolicies) { + public ApexApiResult split(final String targetModelName, final String splitOutPolicies) { Set<AxArtifactKey> requiredPolicySet = new LinkedHashSet<>(); // Split the policy names on comma @@ -458,40 +452,40 @@ public class ModelHandlerFacade { if (requiredPolicy != null) { requiredPolicySet.add(requiredPolicy.getKey()); } else { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, - "policy for policy name " + policyName + " not found in model"); + return new ApexApiResult(ApexApiResult.Result.FAILED, + "policy for policy name " + policyName + " not found in model"); } } try { - AxPolicyModel splitPolicyModel = - PolicyModelSplitter.getSubPolicyModel(apexModel.getPolicyModel(), requiredPolicySet, false); + AxPolicyModel splitPolicyModel = PolicyModelSplitter.getSubPolicyModel(apexModel.getPolicyModel(), + requiredPolicySet, false); ApexModelFileWriter<AxPolicyModel> apexModelFileWriter = new ApexModelFileWriter<>(false); apexModelFileWriter.apexModelWriteJsonFile(splitPolicyModel, AxPolicyModel.class, targetModelName); - return new ApexAPIResult(); + return new ApexApiResult(); } catch (ApexException e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } /** - * Split out a sub model from an Apex model that contains a given subset of the policies in the - * original model, return the split model in the result as a string. + * Split out a sub model from an Apex model that contains a given subset of the policies in the original model, + * return the split model in the result as a string. * - * @param splitOutPolicies the policies form the original model to include in the split out - * model, specified as a comma delimited list of policy names + * @param splitOutPolicies the policies form the original model to include in the split out model, specified as a + * comma delimited list of policy names * @return the result of the operation */ - public ApexAPIResult split(final String splitOutPolicies) { - ApexAPIResult splitResult = new ApexAPIResult(); + public ApexApiResult split(final String splitOutPolicies) { + ApexApiResult splitResult = new ApexApiResult(); File tempSplitPolicyFile = null; try { tempSplitPolicyFile = File.createTempFile("ApexTempPolicy", null); // Split the policy into a temporary file splitResult = split(tempSplitPolicyFile.getCanonicalPath(), splitOutPolicies); - if (splitResult.isNOK()) { + if (splitResult.isNok()) { return splitResult; } @@ -502,8 +496,8 @@ public class ModelHandlerFacade { splitResult.addMessage(splitPolicyModelString); return splitResult; } catch (Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, - "split of policy model " + apexModel.getPolicyModel().getId() + " failed", e); + return new ApexApiResult(ApexApiResult.Result.FAILED, + "split of policy model " + apexModel.getPolicyModel().getId() + " failed", e); } finally { if (tempSplitPolicyFile != null) { try { @@ -519,26 +513,26 @@ public class ModelHandlerFacade { * Merge two Apex models together. * * @param mergeInModelName the file name of the model to merge into the current model - * @param keepOriginal if this flag is set to true, if a concept exists in both models, the - * original model copy of that concept is kept, if the flag is set to false, then the - * copy of the concept from the mergeInModel overwrites the concept in the original model + * @param keepOriginal if this flag is set to true, if a concept exists in both models, the original model copy of + * that concept is kept, if the flag is set to false, then the copy of the concept from the mergeInModel + * overwrites the concept in the original model * @return the result of the operation */ - public ApexAPIResult merge(final String mergeInModelName, final boolean keepOriginal) { - ApexAPIResult result = new ApexAPIResult(); + public ApexApiResult merge(final String mergeInModelName, final boolean keepOriginal) { + ApexApiResult result = new ApexApiResult(); AxPolicyModel mergeInPolicyModel = loadModelFromFile(mergeInModelName, result); - if (!result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)) { + if (!result.getResult().equals(ApexApiResult.Result.SUCCESS)) { return result; } try { AxPolicyModel mergedPolicyModel = PolicyModelMerger.getMergedPolicyModel(apexModel.getPolicyModel(), - mergeInPolicyModel, keepOriginal, false); + mergeInPolicyModel, keepOriginal, false); apexModel.setPolicyModel(mergedPolicyModel != null ? mergedPolicyModel : new AxPolicyModel()); - return new ApexAPIResult(); + return new ApexApiResult(); } catch (ApexModelException e) { apexModel.setPolicyModel(new AxPolicyModel()); - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -546,26 +540,26 @@ public class ModelHandlerFacade { * Merge two Apex models together. * * @param otherModelString the model to merge as a string - * @param keepOriginal if this flag is set to true, if a concept exists in both models, the - * original model copy of that concept is kept, if the flag is set to false, then the - * copy of the concept from the mergeInModel overwrites the concept in the original model + * @param keepOriginal if this flag is set to true, if a concept exists in both models, the original model copy of + * that concept is kept, if the flag is set to false, then the copy of the concept from the mergeInModel + * overwrites the concept in the original model * @return the result of the operation */ - public ApexAPIResult mergeWithString(final String otherModelString, final boolean keepOriginal) { - ApexAPIResult result = new ApexAPIResult(); + public ApexApiResult mergeWithString(final String otherModelString, final boolean keepOriginal) { + ApexApiResult result = new ApexApiResult(); AxPolicyModel mergeInPolicyModel = loadModelFromString(otherModelString, result); - if (!result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)) { + if (!result.getResult().equals(ApexApiResult.Result.SUCCESS)) { return result; } try { AxPolicyModel mergedPolicyModel = PolicyModelMerger.getMergedPolicyModel(apexModel.getPolicyModel(), - mergeInPolicyModel, keepOriginal, false); + mergeInPolicyModel, keepOriginal, false); apexModel.setPolicyModel(mergedPolicyModel != null ? mergedPolicyModel : new AxPolicyModel()); - return new ApexAPIResult(); + return new ApexApiResult(); } catch (ApexModelException e) { apexModel.setPolicyModel(new AxPolicyModel()); - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -576,14 +570,14 @@ public class ModelHandlerFacade { * @param result the result of the operation * @return the model */ - private AxPolicyModel loadModelFromFile(final String fileName, final ApexAPIResult result) { + private AxPolicyModel loadModelFromFile(final String fileName, final ApexApiResult result) { Assertions.argumentNotNull(fileName, FILE_NAME_MAY_NOT_BE_NULL); AxPolicyModel readModel = null; - final URL apexModelURL = ResourceUtils.getLocalFile(fileName); - if (apexModelURL == null) { - result.setResult(ApexAPIResult.RESULT.FAILED); + final URL apexModelUrl = ResourceUtils.getLocalFile(fileName); + if (apexModelUrl == null) { + result.setResult(ApexApiResult.Result.FAILED); result.addMessage("file " + fileName + " not found"); return null; } @@ -591,11 +585,11 @@ public class ModelHandlerFacade { try { ApexModelReader<AxPolicyModel> apexModelReader = new ApexModelReader<>(AxPolicyModel.class); apexModelReader.setValidateFlag(false); - readModel = apexModelReader.read(apexModelURL.openStream()); - result.setResult(ApexAPIResult.RESULT.SUCCESS); + readModel = apexModelReader.read(apexModelUrl.openStream()); + result.setResult(ApexApiResult.Result.SUCCESS); return readModel; } catch (Exception e) { - result.setResult(ApexAPIResult.RESULT.FAILED); + result.setResult(ApexApiResult.Result.FAILED); result.addThrowable(e); return null; } @@ -608,7 +602,7 @@ public class ModelHandlerFacade { * @param result the result of the operation * @return the model */ - private AxPolicyModel loadModelFromString(final String modelString, final ApexAPIResult result) { + private AxPolicyModel loadModelFromString(final String modelString, final ApexApiResult result) { Assertions.argumentNotNull(modelString, "modelString may not be null"); AxPolicyModel readModel = null; @@ -619,10 +613,10 @@ public class ModelHandlerFacade { ApexModelReader<AxPolicyModel> apexModelReader = new ApexModelReader<>(AxPolicyModel.class); apexModelReader.setValidateFlag(false); readModel = apexModelReader.read(modelStringStream); - result.setResult(ApexAPIResult.RESULT.SUCCESS); + result.setResult(ApexApiResult.Result.SUCCESS); return readModel; } catch (Exception e) { - result.setResult(ApexAPIResult.RESULT.FAILED); + result.setResult(ApexApiResult.Result.FAILED); result.addThrowable(e); return null; } diff --git a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/PolicyFacade.java b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/PolicyFacade.java index 1fe6d3599..1d07b2e8c 100644 --- a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/PolicyFacade.java +++ b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/PolicyFacade.java @@ -33,7 +33,7 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; import org.onap.policy.apex.model.basicmodel.handling.ApexModelStringWriter; import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum; import org.onap.policy.apex.model.eventmodel.concepts.AxEvent; -import org.onap.policy.apex.model.modelapi.ApexAPIResult; +import org.onap.policy.apex.model.modelapi.ApexApiResult; import org.onap.policy.apex.model.modelapi.ApexModel; import org.onap.policy.apex.model.policymodel.concepts.AxPolicy; import org.onap.policy.apex.model.policymodel.concepts.AxState; @@ -99,7 +99,7 @@ public class PolicyFacade { * @param description policy description, set to null to generate a description * @return result of the operation */ - public ApexAPIResult createPolicy(final String name, final String version, final String template, + public ApexApiResult createPolicy(final String name, final String version, final String template, final String firstState, final String uuid, final String description) { try { final AxArtifactKey key = new AxArtifactKey(); @@ -110,17 +110,17 @@ public class PolicyFacade { key.setVersion(apexProperties.getProperty("DEFAULT_CONCEPT_VERSION")); } - String t = template; - if (t == null) { - t = apexProperties.getProperty("DEFAULT_POLICY_TEMPLATE"); + String templateString = template; + if (templateString == null) { + templateString = apexProperties.getProperty("DEFAULT_POLICY_TEMPLATE"); } if (apexModel.getPolicyModel().getPolicies().getPolicyMap().containsKey(key)) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, CONCEPT + key.getId() + ALREADY_EXISTS); + return new ApexApiResult(ApexApiResult.Result.CONCEPT_EXISTS, CONCEPT + key.getId() + ALREADY_EXISTS); } final AxPolicy policy = new AxPolicy(key); - policy.setTemplate(t); + policy.setTemplate(templateString); policy.setFirstState(firstState); apexModel.getPolicyModel().getPolicies().getPolicyMap().put(key, policy); @@ -131,7 +131,7 @@ public class PolicyFacade { return keyInformationFacade.createKeyInformation(name, version, uuid, description); } } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -146,12 +146,12 @@ public class PolicyFacade { * @param description policy description, set to null to not update * @return result of the operation */ - public ApexAPIResult updatePolicy(final String name, final String version, final String template, + public ApexApiResult updatePolicy(final String name, final String version, final String template, final String firstState, final String uuid, final String description) { try { final AxPolicy policy = apexModel.getPolicyModel().getPolicies().get(name, version); if (policy == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + DOES_NOT_EXIST); } @@ -164,7 +164,7 @@ public class PolicyFacade { return keyInformationFacade.updateKeyInformation(name, version, uuid, description); } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -175,22 +175,22 @@ public class PolicyFacade { * @param version starting version of the policy, set to null to list all versions * @return result of the operation */ - public ApexAPIResult listPolicy(final String name, final String version) { + public ApexApiResult listPolicy(final String name, final String version) { try { final Set<AxPolicy> policySet = apexModel.getPolicyModel().getPolicies().getAll(name, version); if (name != null && policySet.isEmpty()) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT_S + name + ':' + version + DO_ES_NOT_EXIST); } - final ApexAPIResult result = new ApexAPIResult(); + final ApexApiResult result = new ApexApiResult(); for (final AxPolicy policy : policySet) { result.addMessage( new ApexModelStringWriter<AxPolicy>(false).writeString(policy, AxPolicy.class, jsonMode)); } return result; } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -201,27 +201,27 @@ public class PolicyFacade { * @param version version of the policy, set to null to use the latest version * @return result of the operation */ - public ApexAPIResult deletePolicy(final String name, final String version) { + public ApexApiResult deletePolicy(final String name, final String version) { try { if (version != null) { final AxArtifactKey key = new AxArtifactKey(name, version); final AxPolicy removedPolicy = apexModel.getPolicyModel().getPolicies().getPolicyMap().remove(key); if (removedPolicy != null) { - return new ApexAPIResult(ApexAPIResult.RESULT.SUCCESS, new ApexModelStringWriter<AxPolicy>(false) + return new ApexApiResult(ApexApiResult.Result.SUCCESS, new ApexModelStringWriter<AxPolicy>(false) .writeString(removedPolicy, AxPolicy.class, jsonMode)); } else { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + key.getId() + DOES_NOT_EXIST); } } final Set<AxPolicy> policySet = apexModel.getPolicyModel().getPolicies().getAll(name, version); if (policySet.isEmpty()) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT_S + name + ':' + version + DO_ES_NOT_EXIST); } - final ApexAPIResult result = new ApexAPIResult(); + final ApexApiResult result = new ApexApiResult(); for (final AxPolicy policy : policySet) { result.addMessage( new ApexModelStringWriter<AxPolicy>(false).writeString(policy, AxPolicy.class, jsonMode)); @@ -230,7 +230,7 @@ public class PolicyFacade { } return result; } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -241,15 +241,15 @@ public class PolicyFacade { * @param version starting version of the policy, set to null to list all versions * @return result of the operation */ - public ApexAPIResult validatePolicy(final String name, final String version) { + public ApexApiResult validatePolicy(final String name, final String version) { try { final Set<AxPolicy> policySet = apexModel.getPolicyModel().getPolicies().getAll(name, version); if (policySet.isEmpty()) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT_S + name + ':' + version + DO_ES_NOT_EXIST); } - final ApexAPIResult result = new ApexAPIResult(); + final ApexApiResult result = new ApexApiResult(); for (final AxPolicy policy : policySet) { final AxValidationResult validationResult = policy.validate(new AxValidationResult()); result.addMessage(new ApexModelStringWriter<AxArtifactKey>(false).writeString(policy.getKey(), @@ -258,7 +258,7 @@ public class PolicyFacade { } return result; } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -275,7 +275,7 @@ public class PolicyFacade { * @param defaltTaskVersion the default task version, set to null to use the latest version * @return result of the operation */ - public ApexAPIResult createPolicyState(final String name, final String version, final String stateName, + public ApexApiResult createPolicyState(final String name, final String version, final String stateName, final String triggerName, final String triggerVersion, final String defaultTaskName, final String defaltTaskVersion) { try { @@ -283,26 +283,26 @@ public class PolicyFacade { final AxPolicy policy = apexModel.getPolicyModel().getPolicies().get(name, version); if (policy == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + DOES_NOT_EXIST); } final AxReferenceKey refKey = new AxReferenceKey(policy.getKey(), stateName); if (policy.getStateMap().containsKey(refKey.getLocalName())) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_EXISTS, CONCEPT + refKey.getId() + ALREADY_EXISTS); } final AxEvent triggerEvent = apexModel.getPolicyModel().getEvents().get(triggerName, triggerVersion); if (triggerEvent == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + triggerName + ':' + triggerVersion + DOES_NOT_EXIST); } final AxTask defaultTask = apexModel.getPolicyModel().getTasks().get(defaultTaskName, defaltTaskVersion); if (defaultTask == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + defaultTaskName + ':' + defaltTaskVersion + DOES_NOT_EXIST); } @@ -311,9 +311,9 @@ public class PolicyFacade { state.setDefaultTask(defaultTask.getKey()); policy.getStateMap().put(state.getKey().getLocalName(), state); - return new ApexAPIResult(); + return new ApexApiResult(); } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -330,7 +330,7 @@ public class PolicyFacade { * @param defaltTaskVersion the default task version, set to use latest version of default task * @return result of the operation */ - public ApexAPIResult updatePolicyState(final String name, final String version, final String stateName, + public ApexApiResult updatePolicyState(final String name, final String version, final String stateName, final String triggerName, final String triggerVersion, final String defaultTaskName, final String defaltTaskVersion) { try { @@ -338,20 +338,20 @@ public class PolicyFacade { final AxPolicy policy = apexModel.getPolicyModel().getPolicies().get(name, version); if (policy == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + DOES_NOT_EXIST); } final AxState state = policy.getStateMap().get(stateName); if (state == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + policy.getKey().getId() + ':' + stateName + DOES_NOT_EXIST); } if (triggerName != null) { final AxEvent triggerEvent = apexModel.getPolicyModel().getEvents().get(triggerName, triggerVersion); if (triggerEvent == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + triggerName + ':' + triggerVersion + DOES_NOT_EXIST); } state.setTrigger(triggerEvent.getKey()); @@ -361,15 +361,15 @@ public class PolicyFacade { final AxTask defaultTask = apexModel.getPolicyModel().getTasks().get(defaultTaskName, defaltTaskVersion); if (defaultTask == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + defaultTaskName + ':' + defaltTaskVersion + DOES_NOT_EXIST); } state.setDefaultTask(defaultTask.getKey()); } - return new ApexAPIResult(); + return new ApexApiResult(); } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -381,29 +381,29 @@ public class PolicyFacade { * @param stateName of the state, set to null to list all states of the policy * @return result of the operation */ - public ApexAPIResult listPolicyState(final String name, final String version, final String stateName) { + public ApexApiResult listPolicyState(final String name, final String version, final String stateName) { try { final AxPolicy policy = apexModel.getPolicyModel().getPolicies().get(name, version); if (policy == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + DOES_NOT_EXIST); } if (stateName != null) { final AxState state = policy.getStateMap().get(stateName); if (state != null) { - return new ApexAPIResult(ApexAPIResult.RESULT.SUCCESS, + return new ApexApiResult(ApexApiResult.Result.SUCCESS, new ApexModelStringWriter<AxState>(false).writeString(state, AxState.class, jsonMode)); } else { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + ':' + state + DOES_NOT_EXIST); } } else { if (policy.getStateMap().size() == 0) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, "no states defined on policy " + policy.getKey().getId()); } - final ApexAPIResult result = new ApexAPIResult(); + final ApexApiResult result = new ApexApiResult(); for (final AxState state : policy.getStateMap().values()) { result.addMessage( new ApexModelStringWriter<AxState>(false).writeString(state, AxState.class, jsonMode)); @@ -411,7 +411,7 @@ public class PolicyFacade { return result; } } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -423,15 +423,15 @@ public class PolicyFacade { * @param stateName of the state, set to null to delete all states * @return result of the operation */ - public ApexAPIResult deletePolicyState(final String name, final String version, final String stateName) { + public ApexApiResult deletePolicyState(final String name, final String version, final String stateName) { try { final AxPolicy policy = apexModel.getPolicyModel().getPolicies().get(name, version); if (policy == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + DOES_NOT_EXIST); } - final ApexAPIResult result = new ApexAPIResult(); + final ApexApiResult result = new ApexApiResult(); if (stateName != null) { if (policy.getStateMap().containsKey(stateName)) { result.addMessage(new ApexModelStringWriter<AxState>(false) @@ -439,12 +439,12 @@ public class PolicyFacade { policy.getStateMap().remove(stateName); return result; } else { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + ':' + stateName + DOES_NOT_EXIST); } } else { if (policy.getStateMap().size() == 0) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, "no states defined on policy " + policy.getKey().getId()); } for (final AxState state : policy.getStateMap().values()) { @@ -455,7 +455,7 @@ public class PolicyFacade { return result; } } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -470,20 +470,20 @@ public class PolicyFacade { * @param logic the source code for the logic of the state * @return result of the operation */ - public ApexAPIResult createPolicyStateTaskSelectionLogic(final String name, final String version, + public ApexApiResult createPolicyStateTaskSelectionLogic(final String name, final String version, final String stateName, final String logicFlavour, final String logic) { try { Assertions.argumentNotNull(stateName, STATE_NAME_MAY_NOT_BE_NULL); final AxPolicy policy = apexModel.getPolicyModel().getPolicies().get(name, version); if (policy == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + DOES_NOT_EXIST); } final AxState state = policy.getStateMap().get(stateName); if (state == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + policy.getKey().getId() + ':' + stateName + DOES_NOT_EXIST); } @@ -492,14 +492,14 @@ public class PolicyFacade { final AxReferenceKey refKey = new AxReferenceKey(state.getKey(), "TaskSelectionLogic"); if (!state.getTaskSelectionLogic().getKey().getLocalName().equals(AxKey.NULL_KEY_NAME)) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_EXISTS, CONCEPT + refKey.getId() + ALREADY_EXISTS); } state.setTaskSelectionLogic(new AxTaskSelectionLogic(refKey, logicFlavour, logic)); - return new ApexAPIResult(); + return new ApexApiResult(); } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -513,25 +513,25 @@ public class PolicyFacade { * @param logic the source code for the logic of the state, set to null to not update * @return result of the operation */ - public ApexAPIResult updatePolicyStateTaskSelectionLogic(final String name, final String version, + public ApexApiResult updatePolicyStateTaskSelectionLogic(final String name, final String version, final String stateName, final String logicFlavour, final String logic) { try { Assertions.argumentNotNull(stateName, STATE_NAME_MAY_NOT_BE_NULL); final AxPolicy policy = apexModel.getPolicyModel().getPolicies().get(name, version); if (policy == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + DOES_NOT_EXIST); } final AxState state = policy.getStateMap().get(stateName); if (state == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + policy.getKey().getId() + ':' + stateName + DOES_NOT_EXIST); } if (state.getTaskSelectionLogic().getKey().getLocalName().equals(AxKey.NULL_KEY_NAME)) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + state.getTaskSelectionLogic().getKey().getId() + DOES_NOT_EXIST); } @@ -543,9 +543,9 @@ public class PolicyFacade { taskSelectionLogic.setLogic(logic); } - return new ApexAPIResult(); + return new ApexApiResult(); } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -557,28 +557,28 @@ public class PolicyFacade { * @param stateName of the state * @return result of the operation */ - public ApexAPIResult listPolicyStateTaskSelectionLogic(final String name, final String version, + public ApexApiResult listPolicyStateTaskSelectionLogic(final String name, final String version, final String stateName) { try { Assertions.argumentNotNull(stateName, STATE_NAME_MAY_NOT_BE_NULL); final AxPolicy policy = apexModel.getPolicyModel().getPolicies().get(name, version); if (policy == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + DOES_NOT_EXIST); } final AxState state = policy.getStateMap().get(stateName); if (state == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + policy.getKey().getId() + ':' + stateName + DOES_NOT_EXIST); } - return new ApexAPIResult(ApexAPIResult.RESULT.SUCCESS, + return new ApexApiResult(ApexApiResult.Result.SUCCESS, new ApexModelStringWriter<AxTaskSelectionLogic>(false).writeString(state.getTaskSelectionLogic(), AxTaskSelectionLogic.class, jsonMode)); } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -590,35 +590,35 @@ public class PolicyFacade { * @param stateName of the state * @return result of the operation */ - public ApexAPIResult deletePolicyStateTaskSelectionLogic(final String name, final String version, + public ApexApiResult deletePolicyStateTaskSelectionLogic(final String name, final String version, final String stateName) { try { Assertions.argumentNotNull(stateName, STATE_NAME_MAY_NOT_BE_NULL); final AxPolicy policy = apexModel.getPolicyModel().getPolicies().get(name, version); if (policy == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + DOES_NOT_EXIST); } final AxState state = policy.getStateMap().get(stateName); if (state == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + policy.getKey().getId() + ':' + stateName + DOES_NOT_EXIST); } if (state.getTaskSelectionLogic().getKey().getLocalName().equals(AxKey.NULL_KEY_NAME)) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + state.getTaskSelectionLogic().getKey().getId() + DOES_NOT_EXIST); } - final ApexAPIResult result = new ApexAPIResult(); + final ApexApiResult result = new ApexApiResult(); result.addMessage(new ApexModelStringWriter<AxTaskSelectionLogic>(false) .writeString(state.getTaskSelectionLogic(), AxTaskSelectionLogic.class, jsonMode)); state.setTaskSelectionLogic(new AxTaskSelectionLogic()); return result; } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -636,7 +636,7 @@ public class PolicyFacade { * the policy transitions to on this branch * @return result of the operation */ - public ApexAPIResult createPolicyStateOutput(final String name, final String version, final String stateName, + public ApexApiResult createPolicyStateOutput(final String name, final String version, final String stateName, final String outputName, final String eventName, final String eventVersion, final String nextState) { try { Assertions.argumentNotNull(stateName, STATE_NAME_MAY_NOT_BE_NULL); @@ -644,46 +644,46 @@ public class PolicyFacade { final AxPolicy policy = apexModel.getPolicyModel().getPolicies().get(name, version); if (policy == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, "Policy concept " + name + ':' + version + DOES_NOT_EXIST); } final AxState state = policy.getStateMap().get(stateName); if (state == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, "State concept " + policy.getKey().getId() + ':' + stateName + DOES_NOT_EXIST); } final AxReferenceKey refKey = new AxReferenceKey(state.getKey(), outputName); if (state.getStateOutputs().containsKey(refKey.getLocalName())) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_EXISTS, "Output concept " + refKey.getId() + ALREADY_EXISTS); } final AxEvent event = apexModel.getPolicyModel().getEvents().get(eventName, eventVersion); if (event == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, "Event concept " + eventName + ':' + eventVersion + DOES_NOT_EXIST); } AxReferenceKey nextStateKey = AxReferenceKey.getNullKey(); if (nextState != null && !(AxReferenceKey.getNullKey().getLocalName().equals(nextState))) { if (state.getKey().getLocalName().equals(nextState)) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, + return new ApexApiResult(ApexApiResult.Result.FAILED, "next state " + nextState + " of a state cannot be the state itself"); } nextStateKey = new AxReferenceKey(state.getKey().getParentArtifactKey(), nextState); if (!policy.getStateMap().containsKey(nextState)) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, "Next state concept " + nextStateKey.getId() + DOES_NOT_EXIST); } } state.getStateOutputs().put(refKey.getLocalName(), new AxStateOutput(refKey, event.getKey(), nextStateKey)); - return new ApexAPIResult(); + return new ApexApiResult(); } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -696,40 +696,40 @@ public class PolicyFacade { * @param outputName of the state output, set to null to list all outputs of the state * @return result of the operation */ - public ApexAPIResult listPolicyStateOutput(final String name, final String version, final String stateName, + public ApexApiResult listPolicyStateOutput(final String name, final String version, final String stateName, final String outputName) { try { Assertions.argumentNotNull(stateName, STATE_NAME_MAY_NOT_BE_NULL); final AxPolicy policy = apexModel.getPolicyModel().getPolicies().get(name, version); if (policy == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + DOES_NOT_EXIST); } final AxState state = policy.getStateMap().get(stateName); if (state == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + policy.getKey().getId() + ':' + stateName + DOES_NOT_EXIST); } if (outputName != null) { final AxStateOutput stateOutput = state.getStateOutputs().get(outputName); if (stateOutput != null) { - return new ApexAPIResult(ApexAPIResult.RESULT.SUCCESS, + return new ApexApiResult(ApexApiResult.Result.SUCCESS, new ApexModelStringWriter<AxStateOutput>(false).writeString(stateOutput, AxStateOutput.class, jsonMode)); } else { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + state.getKey().getId() + ':' + outputName + DOES_NOT_EXIST); } } else { if (state.getStateOutputs().size() == 0) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, "no state output concepts exist for state " + state.getKey().getId()); } - final ApexAPIResult result = new ApexAPIResult(); + final ApexApiResult result = new ApexApiResult(); for (final AxStateOutput stateOutput : state.getStateOutputs().values()) { result.addMessage(new ApexModelStringWriter<AxStateOutput>(false).writeString(stateOutput, @@ -738,7 +738,7 @@ public class PolicyFacade { return result; } } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -751,42 +751,42 @@ public class PolicyFacade { * @param outputName of the state output, set to null to delete all state outputs * @return result of the operation */ - public ApexAPIResult deletePolicyStateOutput(final String name, final String version, final String stateName, + public ApexApiResult deletePolicyStateOutput(final String name, final String version, final String stateName, final String outputName) { try { Assertions.argumentNotNull(stateName, STATE_NAME_MAY_NOT_BE_NULL); final AxPolicy policy = apexModel.getPolicyModel().getPolicies().get(name, version); if (policy == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + DOES_NOT_EXIST); } final AxState state = policy.getStateMap().get(stateName); if (state == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + policy.getKey().getId() + ':' + stateName + DOES_NOT_EXIST); } if (outputName != null) { final AxStateOutput stateOutput = state.getStateOutputs().get(outputName); if (stateOutput != null) { - final ApexAPIResult result = new ApexAPIResult(ApexAPIResult.RESULT.SUCCESS, + final ApexApiResult result = new ApexApiResult(ApexApiResult.Result.SUCCESS, new ApexModelStringWriter<AxStateOutput>(false).writeString(stateOutput, AxStateOutput.class, jsonMode)); state.getStateOutputs().remove(outputName); return result; } else { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + state.getKey().getId() + ':' + outputName + DOES_NOT_EXIST); } } else { if (state.getStateOutputs().size() == 0) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, "no state output concepts exist for state " + state.getKey().getId()); } - final ApexAPIResult result = new ApexAPIResult(); + final ApexApiResult result = new ApexApiResult(); for (final Entry<String, AxStateOutput> stateOutputEntry : state.getStateOutputs().entrySet()) { result.addMessage(new ApexModelStringWriter<AxStateOutput>(false) @@ -796,7 +796,7 @@ public class PolicyFacade { return result; } } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -812,7 +812,7 @@ public class PolicyFacade { * @param logic the source code for the logic of the state * @return result of the operation */ - public ApexAPIResult createPolicyStateFinalizerLogic(final String name, final String version, + public ApexApiResult createPolicyStateFinalizerLogic(final String name, final String version, final String stateName, final String finalizerLogicName, final String logicFlavour, final String logic) { try { Assertions.argumentNotNull(stateName, STATE_NAME_MAY_NOT_BE_NULL); @@ -820,28 +820,28 @@ public class PolicyFacade { final AxPolicy policy = apexModel.getPolicyModel().getPolicies().get(name, version); if (policy == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + DOES_NOT_EXIST); } final AxState state = policy.getStateMap().get(stateName); if (state == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + policy.getKey().getId() + ':' + stateName + DOES_NOT_EXIST); } final AxReferenceKey refKey = new AxReferenceKey(state.getKey(), finalizerLogicName); if (state.getStateFinalizerLogicMap().containsKey(refKey.getLocalName())) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_EXISTS, CONCEPT + refKey.getId() + ALREADY_EXISTS); } state.getStateFinalizerLogicMap().put(finalizerLogicName, new AxStateFinalizerLogic(refKey, logicFlavour, logic)); - return new ApexAPIResult(); + return new ApexApiResult(); } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -857,7 +857,7 @@ public class PolicyFacade { * @param logic the source code for the logic of the state, set to null to not update * @return result of the operation */ - public ApexAPIResult updatePolicyStateFinalizerLogic(final String name, final String version, + public ApexApiResult updatePolicyStateFinalizerLogic(final String name, final String version, final String stateName, final String finalizerLogicName, final String logicFlavour, final String logic) { try { Assertions.argumentNotNull(stateName, STATE_NAME_MAY_NOT_BE_NULL); @@ -865,13 +865,13 @@ public class PolicyFacade { final AxPolicy policy = apexModel.getPolicyModel().getPolicies().get(name, version); if (policy == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + DOES_NOT_EXIST); } final AxState state = policy.getStateMap().get(stateName); if (state == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + policy.getKey().getId() + ':' + stateName + DOES_NOT_EXIST); } @@ -879,7 +879,7 @@ public class PolicyFacade { final AxStateFinalizerLogic stateFinalizerLogic = state.getStateFinalizerLogicMap().get(refKey.getKey().getLocalName()); if (stateFinalizerLogic == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, STATE_FINALIZER_LOGIC + refKey.getId() + DOES_NOT_EXIST); } @@ -890,9 +890,9 @@ public class PolicyFacade { stateFinalizerLogic.setLogic(logic); } - return new ApexAPIResult(); + return new ApexApiResult(); } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -905,20 +905,20 @@ public class PolicyFacade { * @param finalizerLogicName name of the state finalizer logic * @return result of the operation */ - public ApexAPIResult listPolicyStateFinalizerLogic(final String name, final String version, final String stateName, + public ApexApiResult listPolicyStateFinalizerLogic(final String name, final String version, final String stateName, final String finalizerLogicName) { try { Assertions.argumentNotNull(stateName, STATE_NAME_MAY_NOT_BE_NULL); final AxPolicy policy = apexModel.getPolicyModel().getPolicies().get(name, version); if (policy == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + DOES_NOT_EXIST); } final AxState state = policy.getStateMap().get(stateName); if (state == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + policy.getKey().getId() + ':' + stateName + DOES_NOT_EXIST); } @@ -927,19 +927,19 @@ public class PolicyFacade { final AxStateFinalizerLogic stateFinalizerLogic = state.getStateFinalizerLogicMap().get(refKey.getKey().getLocalName()); if (stateFinalizerLogic == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, STATE_FINALIZER_LOGIC + refKey.getId() + DOES_NOT_EXIST); } - return new ApexAPIResult(ApexAPIResult.RESULT.SUCCESS, + return new ApexApiResult(ApexApiResult.Result.SUCCESS, new ApexModelStringWriter<AxStateFinalizerLogic>(false).writeString(stateFinalizerLogic, AxStateFinalizerLogic.class, jsonMode)); } else { if (state.getStateFinalizerLogicMap().size() == 0) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, "no state finalizer logic defined on state " + state.getKey().getId()); } - final ApexAPIResult result = new ApexAPIResult(); + final ApexApiResult result = new ApexApiResult(); for (final AxStateFinalizerLogic stateFinalizerLogic : state.getStateFinalizerLogicMap().values()) { result.addMessage(new ApexModelStringWriter<AxStateFinalizerLogic>(false) .writeString(stateFinalizerLogic, AxStateFinalizerLogic.class, jsonMode)); @@ -947,7 +947,7 @@ public class PolicyFacade { return result; } } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -960,20 +960,20 @@ public class PolicyFacade { * @param finalizerLogicName name of the state finalizer logic * @return result of the operation */ - public ApexAPIResult deletePolicyStateFinalizerLogic(final String name, final String version, + public ApexApiResult deletePolicyStateFinalizerLogic(final String name, final String version, final String stateName, final String finalizerLogicName) { try { Assertions.argumentNotNull(stateName, STATE_NAME_MAY_NOT_BE_NULL); final AxPolicy policy = apexModel.getPolicyModel().getPolicies().get(name, version); if (policy == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + DOES_NOT_EXIST); } final AxState state = policy.getStateMap().get(stateName); if (state == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + policy.getKey().getId() + ':' + stateName + DOES_NOT_EXIST); } @@ -982,22 +982,22 @@ public class PolicyFacade { final AxStateFinalizerLogic stateFinalizerLogic = state.getStateFinalizerLogicMap().get(refKey.getKey().getLocalName()); if (stateFinalizerLogic == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, STATE_FINALIZER_LOGIC + refKey.getId() + DOES_NOT_EXIST); } - final ApexAPIResult result = new ApexAPIResult(); + final ApexApiResult result = new ApexApiResult(); result.addMessage(new ApexModelStringWriter<AxStateFinalizerLogic>(false) .writeString(stateFinalizerLogic, AxStateFinalizerLogic.class, jsonMode)); state.getStateFinalizerLogicMap().remove(refKey.getLocalName()); return result; } else { if (state.getStateFinalizerLogicMap().size() == 0) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, "no state finalizer logic defined on state " + state.getKey().getId()); } - final ApexAPIResult result = new ApexAPIResult(); + final ApexApiResult result = new ApexApiResult(); for (final AxStateFinalizerLogic stateFinalizerLogic : state.getStateFinalizerLogicMap().values()) { result.addMessage(new ApexModelStringWriter<AxStateFinalizerLogic>(false) .writeString(stateFinalizerLogic, AxStateFinalizerLogic.class, jsonMode)); @@ -1006,7 +1006,7 @@ public class PolicyFacade { return result; } } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -1026,7 +1026,7 @@ public class PolicyFacade { * @return result of the operation */ // CHECKSTYLE:OFF: checkstyle:parameterNumber - public ApexAPIResult createPolicyStateTaskRef(final String name, final String version, final String stateName, + public ApexApiResult createPolicyStateTaskRef(final String name, final String version, final String stateName, final String taskLocalName, final String taskName, final String taskVersion, final String outputType, final String outputName) { try { @@ -1035,24 +1035,24 @@ public class PolicyFacade { final AxPolicy policy = apexModel.getPolicyModel().getPolicies().get(name, version); if (policy == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + DOES_NOT_EXIST); } final AxState state = policy.getStateMap().get(stateName); if (state == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + policy.getKey().getId() + ':' + stateName + DOES_NOT_EXIST); } final AxTask task = apexModel.getPolicyModel().getTasks().get(taskName, taskVersion); if (task == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + taskName + ':' + taskVersion + DOES_NOT_EXIST); } if (state.getTaskReferences().containsKey(task.getKey())) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, "task " + task.getKey().getId() + return new ApexApiResult(ApexApiResult.Result.CONCEPT_EXISTS, "task " + task.getKey().getId() + " already has reference with output " + state.getTaskReferences().get(task.getKey())); } @@ -1069,23 +1069,23 @@ public class PolicyFacade { final AxStateTaskOutputType stateTaskOutputType = AxStateTaskOutputType.valueOf(outputType); if (stateTaskOutputType.equals(AxStateTaskOutputType.DIRECT)) { if (!state.getStateOutputs().containsKey(outputRefKey.getLocalName())) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, "state output concept " + outputRefKey.getId() + DOES_NOT_EXIST); } } else if (stateTaskOutputType.equals(AxStateTaskOutputType.LOGIC)) { if (!state.getStateFinalizerLogicMap().containsKey(outputRefKey.getLocalName())) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, "state finalizer logic concept " + outputRefKey.getId() + DOES_NOT_EXIST); } } else { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, "output type " + outputType + " invalid"); + return new ApexApiResult(ApexApiResult.Result.FAILED, "output type " + outputType + " invalid"); } state.getTaskReferences().put(task.getKey(), new AxStateTaskReference(refKey, stateTaskOutputType, outputRefKey)); - return new ApexAPIResult(); + return new ApexApiResult(); } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } // CHECKSTYLE:ON: checkstyle:parameterNumber @@ -1100,24 +1100,24 @@ public class PolicyFacade { * @param taskVersion version of the task, set to null to use the latest version * @return result of the operation */ - public ApexAPIResult listPolicyStateTaskRef(final String name, final String version, final String stateName, + public ApexApiResult listPolicyStateTaskRef(final String name, final String version, final String stateName, final String taskName, final String taskVersion) { try { Assertions.argumentNotNull(stateName, STATE_NAME_MAY_NOT_BE_NULL); final AxPolicy policy = apexModel.getPolicyModel().getPolicies().get(name, version); if (policy == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + DOES_NOT_EXIST); } final AxState state = policy.getStateMap().get(stateName); if (state == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + policy.getKey().getId() + ':' + stateName + DOES_NOT_EXIST); } - final ApexAPIResult result = new ApexAPIResult(); + final ApexApiResult result = new ApexApiResult(); boolean found = false; final Map<AxArtifactKey, AxStateTaskReference> taskReferences = state.getTaskReferences(); for (final Entry<AxArtifactKey, AxStateTaskReference> taskReferenceEntry : taskReferences.entrySet()) { @@ -1137,11 +1137,11 @@ public class PolicyFacade { if (found) { return result; } else { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, "no task references found for state " + state.getKey().getId()); } } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -1155,20 +1155,20 @@ public class PolicyFacade { * @param taskVersion version of the task, set to null to use the latest version * @return result of the operation */ - public ApexAPIResult deletePolicyStateTaskRef(final String name, final String version, final String stateName, + public ApexApiResult deletePolicyStateTaskRef(final String name, final String version, final String stateName, final String taskName, final String taskVersion) { try { Assertions.argumentNotNull(stateName, STATE_NAME_MAY_NOT_BE_NULL); final AxPolicy policy = apexModel.getPolicyModel().getPolicies().get(name, version); if (policy == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + DOES_NOT_EXIST); } final AxState state = policy.getStateMap().get(stateName); if (state == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + policy.getKey().getId() + ':' + stateName + DOES_NOT_EXIST); } @@ -1182,11 +1182,11 @@ public class PolicyFacade { deleteSet.add(taskReferenceKey); } if (deleteSet.isEmpty()) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + taskName + ':' + taskVersion + DOES_NOT_EXIST_ON_STATE + state.getKey().getId()); } - final ApexAPIResult result = new ApexAPIResult(); + final ApexApiResult result = new ApexApiResult(); for (final AxArtifactKey keyToDelete : deleteSet) { state.getTaskReferences().remove(keyToDelete); result.addMessage(new ApexModelStringWriter<AxArtifactKey>(false).writeString(keyToDelete, @@ -1194,7 +1194,7 @@ public class PolicyFacade { } return result; } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -1209,39 +1209,39 @@ public class PolicyFacade { * to null to use the latest version * @return result of the operation */ - public ApexAPIResult createPolicyStateContextRef(final String name, final String version, final String stateName, + public ApexApiResult createPolicyStateContextRef(final String name, final String version, final String stateName, final String contextAlbumName, final String contextAlbumVersion) { try { Assertions.argumentNotNull(stateName, STATE_NAME_MAY_NOT_BE_NULL); final AxPolicy policy = apexModel.getPolicyModel().getPolicies().get(name, version); if (policy == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + DOES_NOT_EXIST); } final AxState state = policy.getStateMap().get(stateName); if (state == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + policy.getKey().getId() + ':' + stateName + DOES_NOT_EXIST); } final AxContextAlbum contextAlbum = apexModel.getPolicyModel().getAlbums().get(contextAlbumName, contextAlbumVersion); if (contextAlbum == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + contextAlbumName + ':' + contextAlbumVersion + DOES_NOT_EXIST); } if (state.getContextAlbumReferences().contains(contextAlbum.getKey())) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, "concept album reference for concept " + return new ApexApiResult(ApexApiResult.Result.CONCEPT_EXISTS, "concept album reference for concept " + contextAlbum.getKey().getId() + " already exists in state"); } state.getContextAlbumReferences().add(contextAlbum.getKey()); - return new ApexAPIResult(); + return new ApexApiResult(); } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -1257,24 +1257,24 @@ public class PolicyFacade { * to null to use the latest version * @return result of the operation */ - public ApexAPIResult listPolicyStateContextRef(final String name, final String version, final String stateName, + public ApexApiResult listPolicyStateContextRef(final String name, final String version, final String stateName, final String contextAlbumName, final String contextAlbumVersion) { try { Assertions.argumentNotNull(stateName, STATE_NAME_MAY_NOT_BE_NULL); final AxPolicy policy = apexModel.getPolicyModel().getPolicies().get(name, version); if (policy == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + DOES_NOT_EXIST); } final AxState state = policy.getStateMap().get(stateName); if (state == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + policy.getKey().getId() + ':' + stateName + DOES_NOT_EXIST); } - final ApexAPIResult result = new ApexAPIResult(); + final ApexApiResult result = new ApexApiResult(); boolean found = false; for (final AxArtifactKey albumKey : state.getContextAlbumReferences()) { if ((contextAlbumName != null && !albumKey.getName().equals(contextAlbumName)) @@ -1286,12 +1286,12 @@ public class PolicyFacade { found = true; } if (!found) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, CONCEPT + contextAlbumName + ':' + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + contextAlbumName + ':' + contextAlbumVersion + DOES_NOT_EXIST_ON_STATE + state.getKey().getId()); } return result; } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -1307,20 +1307,20 @@ public class PolicyFacade { * to null to use the latest version * @return result of the operation */ - public ApexAPIResult deletePolicyStateContextRef(final String name, final String version, final String stateName, + public ApexApiResult deletePolicyStateContextRef(final String name, final String version, final String stateName, final String contextAlbumName, final String contextAlbumVersion) { try { Assertions.argumentNotNull(stateName, STATE_NAME_MAY_NOT_BE_NULL); final AxPolicy policy = apexModel.getPolicyModel().getPolicies().get(name, version); if (policy == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + DOES_NOT_EXIST); } final AxState state = policy.getStateMap().get(stateName); if (state == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + policy.getKey().getId() + ':' + stateName + DOES_NOT_EXIST); } @@ -1336,11 +1336,11 @@ public class PolicyFacade { deleteSet.add(albumKey); } if (deleteSet.isEmpty()) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, CONCEPT + contextAlbumName + ':' + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + contextAlbumName + ':' + contextAlbumVersion + DOES_NOT_EXIST_ON_STATE + state.getKey().getId()); } - final ApexAPIResult result = new ApexAPIResult(); + final ApexApiResult result = new ApexApiResult(); for (final AxArtifactKey keyToDelete : deleteSet) { state.getContextAlbumReferences().remove(keyToDelete); result.addMessage(new ApexModelStringWriter<AxArtifactKey>(false).writeString(keyToDelete, @@ -1348,7 +1348,7 @@ public class PolicyFacade { } return result; } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } } diff --git a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/TaskFacade.java b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/TaskFacade.java index 5cb2e7475..77bb22d52 100644 --- a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/TaskFacade.java +++ b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/TaskFacade.java @@ -33,7 +33,7 @@ import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum; import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema; import org.onap.policy.apex.model.eventmodel.concepts.AxInputField; import org.onap.policy.apex.model.eventmodel.concepts.AxOutputField; -import org.onap.policy.apex.model.modelapi.ApexAPIResult; +import org.onap.policy.apex.model.modelapi.ApexApiResult; import org.onap.policy.apex.model.modelapi.ApexModel; import org.onap.policy.apex.model.policymodel.concepts.AxTask; import org.onap.policy.apex.model.policymodel.concepts.AxTaskLogic; @@ -89,7 +89,7 @@ public class TaskFacade { * @param description task description, set to null to generate a description * @return result of the operation */ - public ApexAPIResult createTask(final String name, final String version, final String uuid, + public ApexApiResult createTask(final String name, final String version, final String uuid, final String description) { try { final AxArtifactKey key = new AxArtifactKey(); @@ -101,7 +101,7 @@ public class TaskFacade { } if (apexModel.getPolicyModel().getTasks().getTaskMap().containsKey(key)) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, CONCEPT + key.getId() + ALREADY_EXISTS); + return new ApexApiResult(ApexApiResult.Result.CONCEPT_EXISTS, CONCEPT + key.getId() + ALREADY_EXISTS); } apexModel.getPolicyModel().getTasks().getTaskMap().put(key, new AxTask(key)); @@ -112,7 +112,7 @@ public class TaskFacade { return keyInformationFacade.createKeyInformation(name, version, uuid, description); } } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -125,18 +125,18 @@ public class TaskFacade { * @param description task description, set to null to not update * @return result of the operation */ - public ApexAPIResult updateTask(final String name, final String version, final String uuid, + public ApexApiResult updateTask(final String name, final String version, final String uuid, final String description) { try { final AxTask task = apexModel.getPolicyModel().getTasks().get(name, version); if (task == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + DOES_NOT_EXIST); } return keyInformationFacade.updateKeyInformation(name, version, uuid, description); } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -147,21 +147,21 @@ public class TaskFacade { * @param version starting version of the task, set to null to list all versions * @return result of the operation */ - public ApexAPIResult listTask(final String name, final String version) { + public ApexApiResult listTask(final String name, final String version) { try { final Set<AxTask> taskSet = apexModel.getPolicyModel().getTasks().getAll(name, version); if (name != null && taskSet.isEmpty()) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT_S + name + ':' + version + DO_ES_NOT_EXIST); } - final ApexAPIResult result = new ApexAPIResult(); + final ApexApiResult result = new ApexApiResult(); for (final AxTask task : taskSet) { result.addMessage(new ApexModelStringWriter<AxTask>(false).writeString(task, AxTask.class, jsonMode)); } return result; } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -172,27 +172,27 @@ public class TaskFacade { * @param version version of the task, set to null to use the latest version * @return result of the operation */ - public ApexAPIResult deleteTask(final String name, final String version) { + public ApexApiResult deleteTask(final String name, final String version) { try { if (version != null) { final AxArtifactKey key = new AxArtifactKey(name, version); final AxTask removedTask = apexModel.getPolicyModel().getTasks().getTaskMap().remove(key); if (removedTask != null) { - return new ApexAPIResult(ApexAPIResult.RESULT.SUCCESS, + return new ApexApiResult(ApexApiResult.Result.SUCCESS, new ApexModelStringWriter<AxTask>(false).writeString(removedTask, AxTask.class, jsonMode)); } else { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + key.getId() + DOES_NOT_EXIST); } } final Set<AxTask> taskSet = apexModel.getPolicyModel().getTasks().getAll(name, version); if (taskSet.isEmpty()) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT_S + name + ':' + version + DO_ES_NOT_EXIST); } - final ApexAPIResult result = new ApexAPIResult(); + final ApexApiResult result = new ApexApiResult(); for (final AxTask task : taskSet) { result.addMessage(new ApexModelStringWriter<AxTask>(false).writeString(task, AxTask.class, jsonMode)); apexModel.getPolicyModel().getTasks().getTaskMap().remove(task.getKey()); @@ -200,7 +200,7 @@ public class TaskFacade { } return result; } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -211,15 +211,15 @@ public class TaskFacade { * @param version starting version of the task, set to null to list all versions * @return result of the operation */ - public ApexAPIResult validateTask(final String name, final String version) { + public ApexApiResult validateTask(final String name, final String version) { try { final Set<AxTask> taskSet = apexModel.getPolicyModel().getTasks().getAll(name, version); if (taskSet.isEmpty()) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT_S + name + ':' + version + DO_ES_NOT_EXIST); } - final ApexAPIResult result = new ApexAPIResult(); + final ApexApiResult result = new ApexApiResult(); for (final AxTask task : taskSet) { final AxValidationResult validationResult = task.validate(new AxValidationResult()); result.addMessage(new ApexModelStringWriter<AxArtifactKey>(false).writeString(task.getKey(), @@ -228,7 +228,7 @@ public class TaskFacade { } return result; } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -242,12 +242,12 @@ public class TaskFacade { * @param logic the source code for the logic of the task * @return result of the operation */ - public ApexAPIResult createTaskLogic(final String name, final String version, final String logicFlavour, + public ApexApiResult createTaskLogic(final String name, final String version, final String logicFlavour, final String logic) { try { final AxTask task = apexModel.getPolicyModel().getTasks().get(name, version); if (task == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + DOES_NOT_EXIST); } @@ -255,14 +255,14 @@ public class TaskFacade { final AxReferenceKey refKey = new AxReferenceKey(task.getKey(), "TaskLogic"); if (!task.getTaskLogic().getKey().getLocalName().equals(AxKey.NULL_KEY_NAME)) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_EXISTS, CONCEPT + refKey.getId() + ALREADY_EXISTS); } task.setTaskLogic(new AxTaskLogic(refKey, logicFlavour, logic)); - return new ApexAPIResult(); + return new ApexApiResult(); } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -275,17 +275,17 @@ public class TaskFacade { * @param logic the source code for the logic of the task, set to null to not update * @return result of the operation */ - public ApexAPIResult updateTaskLogic(final String name, final String version, final String logicFlavour, + public ApexApiResult updateTaskLogic(final String name, final String version, final String logicFlavour, final String logic) { try { final AxTask task = apexModel.getPolicyModel().getTasks().get(name, version); if (task == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + DOES_NOT_EXIST); } if (task.getTaskLogic().getKey().getLocalName().equals(AxKey.NULL_KEY_NAME)) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + task.getTaskLogic().getKey().getId() + DOES_NOT_EXIST); } @@ -297,9 +297,9 @@ public class TaskFacade { taskLogic.setLogic(logic); } - return new ApexAPIResult(); + return new ApexApiResult(); } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -310,18 +310,18 @@ public class TaskFacade { * @param version version of the task, set to null to list the latest version * @return result of the operation */ - public ApexAPIResult listTaskLogic(final String name, final String version) { + public ApexApiResult listTaskLogic(final String name, final String version) { try { final AxTask task = apexModel.getPolicyModel().getTasks().get(name, version); if (task == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + DOES_NOT_EXIST); } - return new ApexAPIResult(ApexAPIResult.RESULT.SUCCESS, new ApexModelStringWriter<AxTaskLogic>(false) + return new ApexApiResult(ApexApiResult.Result.SUCCESS, new ApexModelStringWriter<AxTaskLogic>(false) .writeString(task.getTaskLogic(), AxTaskLogic.class, jsonMode)); } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -332,26 +332,26 @@ public class TaskFacade { * @param version version of the task, set to null to use the latest version * @return result of the operation */ - public ApexAPIResult deleteTaskLogic(final String name, final String version) { + public ApexApiResult deleteTaskLogic(final String name, final String version) { try { final AxTask task = apexModel.getPolicyModel().getTasks().get(name, version); if (task == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + DOES_NOT_EXIST); } if (task.getTaskLogic().getKey().getLocalName().equals(AxKey.NULL_KEY_NAME)) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + task.getTaskLogic().getKey().getId() + DOES_NOT_EXIST); } - final ApexAPIResult result = new ApexAPIResult(); + final ApexApiResult result = new ApexApiResult(); result.addMessage(new ApexModelStringWriter<AxTaskLogic>(false).writeString(task.getTaskLogic(), AxTaskLogic.class, jsonMode)); task.setTaskLogic(new AxTaskLogic()); return result; } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -367,14 +367,14 @@ public class TaskFacade { * @param optional true if the task field is optional, false otherwise * @return result of the operation */ - public ApexAPIResult createTaskInputField(final String name, final String version, final String fieldName, + public ApexApiResult createTaskInputField(final String name, final String version, final String fieldName, final String contextSchemaName, final String contextSchemaVersion, final boolean optional) { try { Assertions.argumentNotNull(fieldName, "fieldName may not be null"); final AxTask task = apexModel.getPolicyModel().getTasks().get(name, version); if (task == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + DOES_NOT_EXIST); } @@ -382,21 +382,21 @@ public class TaskFacade { new AxReferenceKey(task.getKey().getName(), task.getKey().getVersion(), "inputFields", fieldName); if (task.getInputFields().containsKey(refKey.getLocalName())) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_EXISTS, CONCEPT + refKey.getId() + ALREADY_EXISTS); } final AxContextSchema schema = apexModel.getPolicyModel().getSchemas().get(contextSchemaName, contextSchemaVersion); if (schema == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + contextSchemaName + ':' + contextSchemaVersion + DOES_NOT_EXIST); } task.getInputFields().put(refKey.getLocalName(), new AxInputField(refKey, schema.getKey(), optional)); - return new ApexAPIResult(); + return new ApexApiResult(); } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -409,31 +409,31 @@ public class TaskFacade { * task * @return result of the operation */ - public ApexAPIResult listTaskInputField(final String name, final String version, final String fieldName) { + public ApexApiResult listTaskInputField(final String name, final String version, final String fieldName) { try { final AxTask task = apexModel.getPolicyModel().getTasks().get(name, version); if (task == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + DOES_NOT_EXIST); } if (fieldName != null) { final AxInputField inputField = task.getInputFields().get(fieldName); if (inputField != null) { - return new ApexAPIResult(ApexAPIResult.RESULT.SUCCESS, + return new ApexApiResult(ApexApiResult.Result.SUCCESS, new ApexModelStringWriter<AxInputField>(false).writeString(inputField, AxInputField.class, jsonMode)); } else { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + ':' + inputField + DOES_NOT_EXIST); } } else { if (task.getInputFields().size() == 0) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, "no input fields defined on task " + task.getKey().getId()); } - final ApexAPIResult result = new ApexAPIResult(); + final ApexApiResult result = new ApexApiResult(); for (final AxInputField field : task.getInputFields().values()) { result.addMessage(new ApexModelStringWriter<AxInputField>(false).writeString(field, AxInputField.class, jsonMode)); @@ -441,7 +441,7 @@ public class TaskFacade { return result; } } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -454,15 +454,15 @@ public class TaskFacade { * @param fieldName of the input field, set to null to delete all input fields * @return result of the operation */ - public ApexAPIResult deleteTaskInputField(final String name, final String version, final String fieldName) { + public ApexApiResult deleteTaskInputField(final String name, final String version, final String fieldName) { try { final AxTask task = apexModel.getPolicyModel().getTasks().get(name, version); if (task == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + DOES_NOT_EXIST); } - final ApexAPIResult result = new ApexAPIResult(); + final ApexApiResult result = new ApexApiResult(); if (fieldName != null) { if (task.getInputFields().containsKey(fieldName)) { result.addMessage(new ApexModelStringWriter<AxInputField>(false) @@ -470,12 +470,12 @@ public class TaskFacade { task.getInputFields().remove(fieldName); return result; } else { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + ':' + fieldName + DOES_NOT_EXIST); } } else { if (task.getInputFields().size() == 0) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, "no input fields defined on task " + task.getKey().getId()); } @@ -487,7 +487,7 @@ public class TaskFacade { return result; } } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -504,14 +504,14 @@ public class TaskFacade { * @param optional true if the task field is optional, false otherwise * @return result of the operation */ - public ApexAPIResult createTaskOutputField(final String name, final String version, final String fieldName, + public ApexApiResult createTaskOutputField(final String name, final String version, final String fieldName, final String contextSchemaName, final String contextSchemaVersion, final boolean optional) { try { Assertions.argumentNotNull(fieldName, "fieldName may not be null"); final AxTask task = apexModel.getPolicyModel().getTasks().get(name, version); if (task == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + DOES_NOT_EXIST); } @@ -519,21 +519,21 @@ public class TaskFacade { new AxReferenceKey(task.getKey().getName(), task.getKey().getVersion(), "outputFields", fieldName); if (task.getOutputFields().containsKey(refKey.getLocalName())) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_EXISTS, CONCEPT + refKey.getId() + ALREADY_EXISTS); } final AxContextSchema schema = apexModel.getPolicyModel().getSchemas().get(contextSchemaName, contextSchemaVersion); if (schema == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + contextSchemaName + ':' + contextSchemaVersion + DOES_NOT_EXIST); } task.getOutputFields().put(refKey.getLocalName(), new AxOutputField(refKey, schema.getKey(), optional)); - return new ApexAPIResult(); + return new ApexApiResult(); } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -546,31 +546,31 @@ public class TaskFacade { * task * @return result of the operation */ - public ApexAPIResult listTaskOutputField(final String name, final String version, final String fieldName) { + public ApexApiResult listTaskOutputField(final String name, final String version, final String fieldName) { try { final AxTask task = apexModel.getPolicyModel().getTasks().get(name, version); if (task == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + DOES_NOT_EXIST); } if (fieldName != null) { final AxOutputField outputField = task.getOutputFields().get(fieldName); if (outputField != null) { - return new ApexAPIResult(ApexAPIResult.RESULT.SUCCESS, + return new ApexApiResult(ApexApiResult.Result.SUCCESS, new ApexModelStringWriter<AxOutputField>(false).writeString(outputField, AxOutputField.class, jsonMode)); } else { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + ':' + outputField + DOES_NOT_EXIST); } } else { if (task.getOutputFields().size() == 0) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, "no output fields defined on task " + task.getKey().getId()); } - final ApexAPIResult result = new ApexAPIResult(); + final ApexApiResult result = new ApexApiResult(); for (final AxOutputField field : task.getOutputFields().values()) { result.addMessage(new ApexModelStringWriter<AxOutputField>(false).writeString(field, AxOutputField.class, jsonMode)); @@ -578,7 +578,7 @@ public class TaskFacade { return result; } } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -590,15 +590,15 @@ public class TaskFacade { * @param fieldName of the output field, set to null to delete all output fields * @return result of the operation */ - public ApexAPIResult deleteTaskOutputField(final String name, final String version, final String fieldName) { + public ApexApiResult deleteTaskOutputField(final String name, final String version, final String fieldName) { try { final AxTask task = apexModel.getPolicyModel().getTasks().get(name, version); if (task == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + DOES_NOT_EXIST); } - final ApexAPIResult result = new ApexAPIResult(); + final ApexApiResult result = new ApexApiResult(); if (fieldName != null) { if (task.getOutputFields().containsKey(fieldName)) { result.addMessage(new ApexModelStringWriter<AxOutputField>(false) @@ -606,12 +606,12 @@ public class TaskFacade { task.getOutputFields().remove(fieldName); return result; } else { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + ':' + fieldName + DOES_NOT_EXIST); } } else { if (task.getOutputFields().size() == 0) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, "no output fields defined on task " + task.getKey().getId()); } @@ -623,7 +623,7 @@ public class TaskFacade { return result; } } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -636,28 +636,28 @@ public class TaskFacade { * @param defaultValue of the parameter * @return result of the operation */ - public ApexAPIResult createTaskParameter(final String name, final String version, final String parName, + public ApexApiResult createTaskParameter(final String name, final String version, final String parName, final String defaultValue) { try { Assertions.argumentNotNull(parName, "parName may not be null"); final AxTask task = apexModel.getPolicyModel().getTasks().get(name, version); if (task == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + DOES_NOT_EXIST); } final AxReferenceKey refKey = new AxReferenceKey(task.getKey(), parName); if (task.getTaskParameters().containsKey(refKey.getLocalName())) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_EXISTS, CONCEPT + refKey.getId() + ALREADY_EXISTS); } task.getTaskParameters().put(refKey.getLocalName(), new AxTaskParameter(refKey, defaultValue)); - return new ApexAPIResult(); + return new ApexApiResult(); } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -669,31 +669,31 @@ public class TaskFacade { * @param parName name of the parameter, set to null to list all parameters of the task * @return result of the operation */ - public ApexAPIResult listTaskParameter(final String name, final String version, final String parName) { + public ApexApiResult listTaskParameter(final String name, final String version, final String parName) { try { final AxTask task = apexModel.getPolicyModel().getTasks().get(name, version); if (task == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + DOES_NOT_EXIST); } if (parName != null) { final AxTaskParameter taskParameter = task.getTaskParameters().get(parName); if (taskParameter != null) { - return new ApexAPIResult(ApexAPIResult.RESULT.SUCCESS, + return new ApexApiResult(ApexApiResult.Result.SUCCESS, new ApexModelStringWriter<AxTaskParameter>(false).writeString(taskParameter, AxTaskParameter.class, jsonMode)); } else { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + ':' + taskParameter + DOES_NOT_EXIST); } } else { if (task.getTaskParameters().size() == 0) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, "no task parameters defined on task " + task.getKey().getId()); } - final ApexAPIResult result = new ApexAPIResult(); + final ApexApiResult result = new ApexApiResult(); for (final AxTaskParameter parameter : task.getTaskParameters().values()) { result.addMessage(new ApexModelStringWriter<AxTaskParameter>(false).writeString(parameter, AxTaskParameter.class, jsonMode)); @@ -701,7 +701,7 @@ public class TaskFacade { return result; } } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -713,15 +713,15 @@ public class TaskFacade { * @param parName of the parameter, set to null to delete all task parameters * @return result of the operation */ - public ApexAPIResult deleteTaskParameter(final String name, final String version, final String parName) { + public ApexApiResult deleteTaskParameter(final String name, final String version, final String parName) { try { final AxTask task = apexModel.getPolicyModel().getTasks().get(name, version); if (task == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + DOES_NOT_EXIST); } - final ApexAPIResult result = new ApexAPIResult(); + final ApexApiResult result = new ApexApiResult(); if (parName != null) { if (task.getTaskParameters().containsKey(parName)) { result.addMessage(new ApexModelStringWriter<AxTaskParameter>(false) @@ -729,12 +729,12 @@ public class TaskFacade { task.getTaskParameters().remove(parName); return result; } else { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + ':' + parName + DOES_NOT_EXIST); } } else { if (task.getTaskParameters().size() == 0) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, "no task parameters defined on task " + task.getKey().getId()); } @@ -746,7 +746,7 @@ public class TaskFacade { return result; } } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -760,31 +760,31 @@ public class TaskFacade { * to null to use the latest version * @return result of the operation */ - public ApexAPIResult createTaskContextRef(final String name, final String version, final String contextAlbumName, + public ApexApiResult createTaskContextRef(final String name, final String version, final String contextAlbumName, final String contextAlbumVersion) { try { final AxTask task = apexModel.getPolicyModel().getTasks().get(name, version); if (task == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + DOES_NOT_EXIST); } final AxContextAlbum contextAlbum = apexModel.getPolicyModel().getAlbums().get(contextAlbumName, contextAlbumVersion); if (contextAlbum == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + contextAlbumName + ':' + contextAlbumVersion + DOES_NOT_EXIST); } if (task.getContextAlbumReferences().contains(contextAlbum.getKey())) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_EXISTS, "context album reference for concept " + return new ApexApiResult(ApexApiResult.Result.CONCEPT_EXISTS, "context album reference for concept " + contextAlbum.getKey().getId() + " already exists in task"); } task.getContextAlbumReferences().add(contextAlbum.getKey()); - return new ApexAPIResult(); + return new ApexApiResult(); } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -799,16 +799,16 @@ public class TaskFacade { * to null to use the latest version * @return result of the operation */ - public ApexAPIResult listTaskContextRef(final String name, final String version, final String contextAlbumName, + public ApexApiResult listTaskContextRef(final String name, final String version, final String contextAlbumName, final String contextAlbumVersion) { try { final AxTask task = apexModel.getPolicyModel().getTasks().get(name, version); if (task == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + DOES_NOT_EXIST); } - final ApexAPIResult result = new ApexAPIResult(); + final ApexApiResult result = new ApexApiResult(); boolean found = false; for (final AxArtifactKey albumKey : task.getContextAlbumReferences()) { if ((contextAlbumName != null && !albumKey.getName().equals(contextAlbumName)) @@ -820,12 +820,12 @@ public class TaskFacade { found = true; } if (!found) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + contextAlbumName + ':' + contextAlbumVersion + DOES_NOT_EXIST); } return result; } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } @@ -840,12 +840,12 @@ public class TaskFacade { * to null to use the latest version * @return result of the operation */ - public ApexAPIResult deleteTaskContextRef(final String name, final String version, final String contextAlbumName, + public ApexApiResult deleteTaskContextRef(final String name, final String version, final String contextAlbumName, final String contextAlbumVersion) { try { final AxTask task = apexModel.getPolicyModel().getTasks().get(name, version); if (task == null) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + name + ':' + version + DOES_NOT_EXIST); } @@ -860,10 +860,10 @@ public class TaskFacade { } if (deleteSet.isEmpty()) { - return new ApexAPIResult(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, + return new ApexApiResult(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, CONCEPT + contextAlbumName + ':' + contextAlbumVersion + DOES_NOT_EXIST); } - final ApexAPIResult result = new ApexAPIResult(); + final ApexApiResult result = new ApexApiResult(); for (final AxArtifactKey keyToDelete : deleteSet) { task.getContextAlbumReferences().remove(keyToDelete); result.addMessage(new ApexModelStringWriter<AxArtifactKey>(false).writeString(keyToDelete, @@ -871,7 +871,7 @@ public class TaskFacade { } return result; } catch (final Exception e) { - return new ApexAPIResult(ApexAPIResult.RESULT.FAILED, e); + return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } } diff --git a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/TestApexEditorAPIContextAlbum.java b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/TestApexEditorApiContextAlbum.java index ad464b187..f1b8fc84b 100644 --- a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/TestApexEditorAPIContextAlbum.java +++ b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/TestApexEditorApiContextAlbum.java @@ -26,148 +26,149 @@ import static org.junit.Assert.assertTrue; import org.junit.Test; /** + * Context album for API tests. * @author Liam Fallon (liam.fallon@ericsson.com) */ -public class TestApexEditorAPIContextAlbum { +public class TestApexEditorApiContextAlbum { @Test - public void testContextAlbumCRUD() { + public void testContextAlbumCrud() { final ApexModel apexModel = new ApexModelFactory().createApexModel(null, false); - ApexAPIResult result = apexModel.validateContextAlbum(null, null); - assertEquals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, result.getResult()); + ApexApiResult result = apexModel.validateContextAlbum(null, null); + assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.validateContextAlbum("%%%$£", null); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.loadFromFile("src/test/resources/models/PolicyModel.json"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createContextAlbum("MyMap002", "0.0.2", "APPLICATION", "true", "MapType", "0.0.1", "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createContextAlbum("MyMap012", "0.1.2", "ZOOBY", "false", "MapType", "0.0.1", "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 012"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createContextAlbum("MyMap012", "0.1.4", "UNDEFINED", null, "MapType", "0.0.1", "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 014"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createContextAlbum("MyMap012", null, null, null, null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createContextAlbum("MyMap012", null, "EPHEMERAL", null, null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createContextAlbum("MyMap012", null, "EPHEMERAL", "false", null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createContextAlbum("MyMap012", null, "EPHEMERAL", "false", "", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createContextAlbum("MyMap012", null, "EPHEMERAL", "false", "+++", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createContextAlbum("MyMap012", null, "EPHEMERAL", "false", "MapZooby", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createContextAlbum("MyMap012", null, "EPHEMERAL", "false", "MapType", "--++", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createContextAlbum("MyMap012", null, "EPHEMERAL", "false", "MapType", "0.0.2", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createContextAlbum("MyMap012", null, "EPHEMERAL", "false", "MapType", "0.0.1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createContextAlbum("MyMap012", null, "EPHEMERAL", "false", "MapType", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_EXISTS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_EXISTS)); result = apexModel.createContextAlbum("MyMap002", "0.0.2", "APPLICATION", "true", "MapType", null, "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_EXISTS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_EXISTS)); result = apexModel.createContextAlbum("MyMap011", "0.1.2", "APPLICATION", "true", "MapType", "0.0.1", "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.deleteContextAlbum("MyMap012", "0.1.2"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createContextAlbum("MyMap012", "0.1.2", "ZOOBY", "false", "MapType", "0.0.1", "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 012"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.validateContextAlbum(null, null); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.updateContextAlbum(null, null, null, null, null, null, null, null); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.updateContextAlbum("MyMap002", "0.0.2", null, null, null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updateContextAlbum("MyMap002", "0.0.2", "ZOOBY", "true", null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updateContextAlbum("MyMap002", "0.0.2", null, null, null, null, "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updateContextAlbum("MyMap012", null, null, null, null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updateContextAlbum("MyMap012", null, null, "true", null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updateContextAlbum("MyMap012", null, "APPLICATION", null, null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updateContextAlbum("MyMap015", null, null, null, null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.updateContextAlbum("MyMap014", "0.1.5", null, null, null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.updateContextAlbum("MyMap012", null, "APPLICATION", "false", null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updateContextAlbum("MyMap012", null, "APPLICATION", "false", "StringType", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updateContextAlbum("MyMap012", null, "APPLICATION", "false", "String", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.updateContextAlbum("MyMap012", null, "APPLICATION", "false", "StringType", "0.0.2", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.updateContextAlbum("MyMap012", null, "APPLICATION", "false", "StringType", "0.0.1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updateContextAlbum("MyMap012", null, "APPLICATION", "Hello", "StringType", "0.0.1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listContextAlbum("@£%%$", null); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.listContextAlbum(null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listContextAlbum("MyMap012", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listContextAlbum("MyMap012", "0.0.2"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listContextAlbum("MyMap012", "0.2.5"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listContextAlbum("MyMap014", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deleteContextAlbum("@£%%$", null); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.deleteContextAlbum("MyMap012", "0.1.1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deleteContextAlbum("MyMap012oooo", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listContextAlbum("MyMap012", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertTrue(result.getMessages().size() == 3); result = apexModel.deleteContextAlbum("MyMap012", "0.1.2"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listContextAlbum("MyMap012", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertTrue(result.getMessages().size() == 2); result = apexModel.deleteContextAlbum("MyMap012", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listContextAlbum("MyMap012", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deleteContextAlbum(null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(4, result.getMessages().size()); result = apexModel.listContextAlbum(null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(0, result.getMessages().size()); } } diff --git a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/TestApexEditorAPIContextSchema.java b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/TestApexEditorApiContextSchema.java index 7eb85da98..25ab6df6b 100644 --- a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/TestApexEditorAPIContextSchema.java +++ b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/TestApexEditorApiContextSchema.java @@ -26,127 +26,128 @@ import static org.junit.Assert.assertTrue; import org.junit.Test; /** + * Context schema for API tests. * @author Liam Fallon (liam.fallon@ericsson.com) */ -public class TestApexEditorAPIContextSchema { +public class TestApexEditorApiContextSchema { @Test - public void testContextSchemaCRUD() { + public void testContextSchemaCrud() { final ApexModel apexModel = new ApexModelFactory().createApexModel(null, false); - ApexAPIResult result = apexModel.validateContextSchemas(null, null); - assertEquals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, result.getResult()); + ApexApiResult result = apexModel.validateContextSchemas(null, null); + assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.validateContextSchemas("%%%$£", null); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.loadFromFile("src/test/resources/models/PolicyModel.json"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listContextSchemas(null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createContextSchema("Hello", "0.0.2", "Java", "java.lang.String", "1fa2e430-f2b2-11e6-bc64-92361f002671", "A description of hello"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createContextSchema("Hello", "0.1.2", "Java", "java.lang.String", "1fa2e430-f2b2-11e6-bc64-92361f002672", "A description of hola"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createContextSchema("Hello", "0.1.4", "Java", "java.lang.String", "1fa2e430-f2b2-11e6-bc64-92361f002672", "A description of connichi wa"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createContextSchema("Hello", null, "Java", "java.lang.String", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createContextSchema("Hello", null, "Java", "java.lang.String", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_EXISTS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_EXISTS)); result = apexModel.deleteContextSchema("Hello", "0.1.4"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createContextSchema("Hello", "0.1.4", "Java", "java.lang.String", "1fa2e430-f2b2-11e6-bc64-92361f002672", "A description of connichi wa"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createContextSchema("Hello2", null, null, "java.lang.String", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createContextSchema("Hello2", null, null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createContextSchema("Hello2", null, "Java", "java.lang.String", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createContextSchema("Hello", "0.1.2", "Java", "java.lang.Float", "1fa2e430-f2b2-11e6-bc64-92361f002672", "A description of hola"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_EXISTS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_EXISTS)); result = apexModel.deleteContextSchema("Hello", "0.1.4"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createContextSchema("Hello", "0.1.4", "Java", "java.lang.String", "1fa2e430-f2b2-11e6-bc64-92361f002672", "A description of connichi wa"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.validateContextSchemas(null, null); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.updateContextSchema(null, null, null, null, null, null); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.updateContextSchema("Hello", "0.0.2", null, null, null, "An updated description of hello"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updateContextSchema("Hello", "0.0.2", null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updateContextSchema("Hello", "0.1.2", "Java", "java.lang.Integer", "1fa2e430-f2b2-11e6-bc64-92361f002673", "A further updated description of hola"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updateContextSchema("Hello2", "0.0.2", null, null, null, "An updated description of hello"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listContextSchemas("@£%%$", null); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.listContextSchemas("Hello", "0.1.2"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertTrue(result.getMessages().size() == 2); result = apexModel.listContextSchemas("Hello", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertTrue(result.getMessages().size() == 4); result = apexModel.listContextSchemas(null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertTrue(result.getMessages().size() == 9); result = apexModel.deleteContextSchema("@£%%$", null); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.deleteContextSchema("Hello", "0.1.1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deleteContextSchema("Hellooooo", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listContextSchemas("Hello", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertTrue(result.getMessages().size() == 4); result = apexModel.deleteContextSchema("Hello", "0.1.2"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listContextSchemas("Hello", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertTrue(result.getMessages().size() == 3); result = apexModel.deleteContextSchema("Hello", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listContextSchemas("Hello", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listContextSchemas(null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.deleteContextSchema(null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(5, result.getMessages().size()); result = apexModel.listContextSchemas(null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(0, result.getMessages().size()); } } diff --git a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/TestApexEditorAPIEvent.java b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/TestApexEditorApiEvent.java index da9f48c25..b25c52c9c 100644 --- a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/TestApexEditorAPIEvent.java +++ b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/TestApexEditorApiEvent.java @@ -26,171 +26,172 @@ import static org.junit.Assert.assertTrue; import org.junit.Test; /** + * Test events for API tests. * @author Liam Fallon (liam.fallon@ericsson.com) */ -public class TestApexEditorAPIEvent { +public class TestApexEditorApiEvent { @Test - public void testEventCRUD() { + public void testEventCrud() { final ApexModel apexModel = new ApexModelFactory().createApexModel(null, false); - ApexAPIResult result = apexModel.validateEvent(null, null); - assertEquals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, result.getResult()); + ApexApiResult result = apexModel.validateEvent(null, null); + assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.validateEvent("%%%$£", null); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.loadFromFile("src/test/resources/models/PolicyModel.json"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createEvent("MyEvent002", "0.0.2", "My Namespace", "My Source", "my target", "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createEvent("MyEvent012", "0.1.2", "My Namespace", "My Source", "my target", "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 012"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createEvent("MyEvent012", "0.1.4", "My Namespace", "My Source", "my target", "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 014"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createEvent("MyEvent012", null, null, null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createEvent("MyEvent012", null, null, null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_EXISTS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_EXISTS)); result = apexModel.createEvent("MyEvent002", "0.0.2", "My Namespace", "My Source", "my target", "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_EXISTS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_EXISTS)); result = apexModel.createEvent("@£$%^", "0.2.5", "My Namespace", "My Source", "my target", "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.deleteEvent("MyEvent012", "0.1.4"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createEvent("MyEvent012", "0.1.4", "My Namespace", "My Source", "my target", "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 014"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.validateEvent(null, null); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.updateContextSchema(null, null, null, null, null, null); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.updateEvent("MyEvent012", "0.1.2", "Another Namespace", null, "Another target", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updateEvent("MyEvent002", "0.0.2", "My Namespace", "My Source", "my target", "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updateEvent("MyEvent012", null, null, null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updateEvent("MyEvent015", null, null, null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.updateEvent("MyEvent014", "0.1.5", null, null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.updateEvent("@£$%^^", "0.6.9", null, null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.listEvent("@£$%", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.listEvent(null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listEvent("MyEvent012", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listEvent("MyEvent012", "0.0.2"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listEvent("MyEvent012", "0.2.5"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listEvent("MyEvent123", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deleteEvent("@£$%^", "0.1.1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.deleteEvent("MyEvent012", "0.1.1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deleteEvent("MyEvent012oooo", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listEvent("MyEvent012", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertTrue(result.getMessages().size() == 3); result = apexModel.deleteEvent("MyEvent012", "0.1.2"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listEvent("MyEvent012", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertTrue(result.getMessages().size() == 2); result = apexModel.deleteEvent("MyEvent012", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listEvent("MyEvent012", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createEventPar("MyEvent123", null, "NewPar00", null, null, false); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createEventPar("MyEvent002", "4.5.6", "NewPar00", null, null, true); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createEventPar("MyEvent002", "0.1.4", "NewPar00", null, null, false); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createEventPar("MyEvent002", "0.0.2", "NewPar00", null, null, true); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createEventPar("MyEvent002", "0.0.2", "NewPar00", "eventContextItem0", null, false); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createEventPar("MyEvent002", "0.0.2", "NewPar00", "eventContextItem0", null, true); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_EXISTS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_EXISTS)); result = apexModel.createEventPar("MyEvent002", "0.0.2", "NewPar01", "eventContextItem0", "0.0.1", false); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createEventPar("MyEvent002", "0.0.2", "NewPar02", "eventContextItem0", "0.0.2", true); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createEventPar("MyEvent002", null, "NewPar02", "eventContextItem0", null, false); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createEventPar("MyEvent002", null, "NewPar03", "eventContextItem0", null, true); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listEventPar("@£%%$", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.listEventPar("MyEvent002", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listEventPar("MyEvent002", "0.0.1", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listEventPar("MyEvent002", "0.0.2", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listEventPar("MyEvent002", "0.0.2", "NewPar01"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listEventPar("MyEvent002", "0.0.2", "NewPar02"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listEventPar("MyEvent002", "0.0.2", "NewPar04"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deleteEventPar("@££%%%", "0.0.2", "NewPar04"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.deleteEventPar("NonExistantEvent", "0.0.2", "NewPar04"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); assertEquals(4, apexModel.listEventPar("MyEvent002", null, null).getMessages().size()); result = apexModel.deleteEventPar("MyEvent002", "0.0.2", "NewPar04"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); assertEquals(4, apexModel.listEventPar("MyEvent002", null, null).getMessages().size()); result = apexModel.deleteEventPar("MyEvent002", null, "NewPar02"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(3, apexModel.listEventPar("MyEvent002", null, null).getMessages().size()); result = apexModel.deleteEventPar("MyEvent002", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listEventPar("MyEvent002", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deleteEventPar("MyEvent002", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listEventPar("MyEvent002", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deleteEvent(null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(4, result.getMessages().size()); result = apexModel.listEvent(null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(0, result.getMessages().size()); } } diff --git a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/TestApexEditorAPIKeyInfo.java b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/TestApexEditorApiKeyInfo.java index c755b9064..9dae13272 100644 --- a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/TestApexEditorAPIKeyInfo.java +++ b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/TestApexEditorApiKeyInfo.java @@ -26,111 +26,112 @@ import static org.junit.Assert.assertTrue; import org.junit.Test; /** + * Key information for API tests. * @author Liam Fallon (liam.fallon@ericsson.com) */ -public class TestApexEditorAPIKeyInfo { +public class TestApexEditorApiKeyInfo { @Test - public void testKeyInfoCRUD() { + public void testKeyInfoCrud() { final ApexModel apexModel = new ApexModelFactory().createApexModel(null, false); - ApexAPIResult result = apexModel.validateKeyInformation(null, null); - assertEquals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, result.getResult()); + ApexApiResult result = apexModel.validateKeyInformation(null, null); + assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.validateKeyInformation("%%%$£", null); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.loadFromFile("src/test/resources/models/PolicyModel.json"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createKeyInformation(null, null, null, null); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.createKeyInformation("Hello", "0.0.2", "1fa2e430-f2b2-11e6-bc64-92361f002671", "A description of hello"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createKeyInformation("Hello", "0.1.2", "1fa2e430-f2b2-11e6-bc64-92361f002672", "A description of hola"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createKeyInformation("Hello", "0.1.4", "1fa2e430-f2b2-11e6-bc64-92361f002672", "A description of connichi wa"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createKeyInformation("Hello", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createKeyInformation("Hello", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_EXISTS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_EXISTS)); result = apexModel.createKeyInformation("Hello", "0.1.2", "1fa2e430-f2b2-11e6-bc64-92361f002672", "A description of hola"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_EXISTS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_EXISTS)); result = apexModel.validateKeyInformation(null, null); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.updateKeyInformation(null, null, null, null); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.updateKeyInformation("Hello", "0.0.2", null, "An updated description of hello"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updateKeyInformation("Hello", "0.0.2", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updateKeyInformation("Hello", "0.1.2", "1fa2e430-f2b2-11e6-bc64-92361f002673", "A further updated description of hola"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updateKeyInformation("Hello2", "0.0.2", null, "An updated description of hello"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listKeyInformation(null, null); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.listKeyInformation("%%%$$", null); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.listKeyInformation("Hello", "0.1.2"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertTrue(result.getMessages().size() == 2); result = apexModel.listKeyInformation("Hello", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertTrue(result.getMessages().size() == 4); result = apexModel.deleteKeyInformation("Hello", "0.1.1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deleteKeyInformation("Hellooooo", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listKeyInformation("Hello", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertTrue(result.getMessages().size() == 4); result = apexModel.listKeyInformation(null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertTrue(result.getMessages().size() == 22); result = apexModel.deleteKeyInformation("%%%$$", null); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.deleteKeyInformation("Hello", "0.1.2"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listKeyInformation("Hello", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertTrue(result.getMessages().size() == 3); result = apexModel.deleteKeyInformation("Hello", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listKeyInformation("Hello", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deleteKeyInformation(null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(18, result.getMessages().size()); result = apexModel.listKeyInformation(null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(0, result.getMessages().size()); } } diff --git a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/TestApexEditorAPIPolicy.java b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/TestApexEditorApiPolicy.java index 94861f9d4..9295ffa5f 100644 --- a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/TestApexEditorAPIPolicy.java +++ b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/TestApexEditorApiPolicy.java @@ -26,997 +26,998 @@ import static org.junit.Assert.assertTrue; import org.junit.Test; /** + * Test policies for API tests. * @author Liam Fallon (liam.fallon@ericsson.com) */ -public class TestApexEditorAPIPolicy { +public class TestApexEditorApiPolicy { @Test - public void MyTestPolicyCRUD() { + public void myTestPolicyCrud() { final ApexModel apexModel = new ApexModelFactory().createApexModel(null, false); - ApexAPIResult result = apexModel.validatePolicy(null, null); - assertEquals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, result.getResult()); + ApexApiResult result = apexModel.validatePolicy(null, null); + assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.validatePolicy("%%%$£", null); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.loadFromFile("src/test/resources/models/PolicyModel.json"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createPolicy("MyPolicy002", "0.0.2", "SomeTemplate", "AState", "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createPolicy("MyPolicy002", "0.0.2", "SomeTemplate", "AState", "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_EXISTS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_EXISTS)); result = apexModel.createPolicy("MyPolicy012", null, null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createPolicy("MyPolicy012", null, "SomeTemplate", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createPolicy("MyPolicy013", null, null, "AState", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createPolicy("MyPolicy012", null, "SomeTemplate", "AState", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createPolicy("MyPolicy002", "0.0.2", "SomeTemplate", "AState", "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_EXISTS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_EXISTS)); result = apexModel.createPolicy("MyPolicy012", "0.1.2", "SomeTemplate", "AState", "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createPolicy("MyTestPolicy", "0.0.1", "SomeTemplate", "TestState", "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.deletePolicy("MyPolicy002", "0.0.2"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createPolicy("MyPolicy002", "0.0.2", "SomeTemplate", "AState", "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.validatePolicy(null, null); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.updatePolicy("@£$$", "0.0.2", null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.updatePolicy("MyPolicy002", "0.0.2", null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updatePolicy("MyPolicy002", "0.0.1", null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.updatePolicy("MyPolicy002", "0.0.2", "SomeOtherTemplate", "BState", "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updatePolicy("MyPolicy012", null, "SomeOtherTemplate", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updatePolicy("MyPolicy012", null, null, "CState", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updatePolicy("MyPolicy012", null, "SomeOtherTemplate", "BState", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updatePolicy("MyPolicy015", null, "SomeOtherTemplate", "DState", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.updatePolicy("MyPolicy014", "0.1.5", "SomeOtherTemplate", "EState", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listPolicy("@£$%%", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.listPolicy(null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(6, result.getMessages().size()); result = apexModel.listPolicy("MyPolicy012", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(2, result.getMessages().size()); result = apexModel.listPolicy("MyPolicy012", "0.0.2"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(1, result.getMessages().size()); result = apexModel.listPolicy("MyPolicy012", "0.2.5"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listPolicy("MyPolicy014", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deletePolicy("@£$%", "0.1.1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.deletePolicy("MyPolicy012", "0.1.1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deletePolicy("MyPolicy012oooo", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listPolicy("MyPolicy012", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertTrue(result.getMessages().size() == 2); result = apexModel.deletePolicy("MyPolicy002", "0.0.2"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertTrue(result.getMessages().size() == 1); result = apexModel.listPolicy("MyPolicy012", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertTrue(result.getMessages().size() == 2); result = apexModel.deletePolicy("MyPolicy012", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertTrue(result.getMessages().size() == 2); result = apexModel.createPolicyState(null, null, null, null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createPolicyState("MyPolicy123", null, null, null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createPolicyState("MyPolicy123", null, "AState", null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createPolicyState("MyTestPolicy", "0.0.2", "AState", null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createPolicyState("MyTestPolicy", null, "AState", null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createPolicyState("MyTestPolicy", null, "AState", "ATrigger", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createPolicyState("MyTestPolicy", null, "AState", "inEvent", "0.0.2", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createPolicyState("MyTestPolicy", null, "AState", "inEvent", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createPolicyState("MyTestPolicy", null, "AState", "inEvent", "0.0.1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createPolicyState("MyTestPolicy", null, "AState", "inEvent", null, "ATask", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createPolicyState("MyTestPolicy", null, "AState", "inEvent", null, "task", "0.0.2"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createPolicyState("MyTestPolicy", null, "AState", "inEvent", null, "task", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createPolicyState("MyTestPolicy", null, "AState", "inEvent", null, "task", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_EXISTS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_EXISTS)); result = apexModel.createPolicyState("MyTestPolicy", "0.0.1", "AState", "inEvent", "0.0.1", "task", "0.0.1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_EXISTS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_EXISTS)); result = apexModel.createPolicyState("MyTestPolicy", "0.0.1", "BState", "inEvent", "0.0.1", "task", "0.0.1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createPolicyState("MyTestPolicy", "0.0.1", "CState", "inEvent", "0.0.1", "task", "0.0.1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createPolicyState("MyTestPolicy", "0.0.1", "DState", "inEvent", "0.0.1", "task", "0.0.1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updatePolicyState(null, null, null, null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.updatePolicyState("MyPolicy123", null, null, null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.updatePolicyState("MyPolicy123", null, "AState", null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.updatePolicyState("MyTestPolicy", "0.0.2", "AState", null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.updatePolicyState("MyTestPolicy", null, "AState", null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updatePolicyState("MyTestPolicy", null, "ZState", null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.updatePolicyState("MyTestPolicy", null, "AState", "ATrigger", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.updatePolicyState("MyTestPolicy", null, "AState", "inEvent", "0.0.2", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.updatePolicyState("MyTestPolicy", null, "AState", "inEvent", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updatePolicyState("MyTestPolicy", null, "AState", "inEvent", "0.0.2", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.updatePolicyState("MyTestPolicy", null, "AState", "inEvent", null, "ATask", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.updatePolicyState("MyTestPolicy", null, "AState", "inEvent", null, "task", "0.0.2"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.updatePolicyState("MyTestPolicy", null, "AState", "inEvent", null, "task", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updatePolicyState("MyTestPolicy", null, "AState", "inEvent", null, "task", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updatePolicyState("MyTestPolicy", "0.0.1", "AState", "inEvent", "0.0.1", "task", "0.0.1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updatePolicyState("MyTestPolicy", "0.0.1", "BState", "inEvent", "0.0.1", "task", "0.0.1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updatePolicyState("MyTestPolicy", "0.0.1", "CState", "inEvent", "0.0.1", "task", "0.0.1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updatePolicyState("MyTestPolicy", "0.0.1", "DState", "inEvent", "0.0.1", "task", "0.0.1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listPolicyState("MyTestPolicy", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(4, result.getMessages().size()); result = apexModel.listPolicyState(null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.listPolicyState("SomeOtherPolicy", "0.0.1", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listPolicyState("SomeOtherPolicy", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listPolicyState("MyTestPolicy", "0.0.2", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listPolicyState("MyTestPolicy", "0.0.1", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(4, result.getMessages().size()); result = apexModel.listPolicyState("MyTestPolicy", "0.0.1", "CState"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(1, result.getMessages().size()); result = apexModel.listPolicyState("MyTestPolicy", null, "CState"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(1, result.getMessages().size()); result = apexModel.listPolicyState("MyTestPolicy", "0.0.1", "AState"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(1, result.getMessages().size()); result = apexModel.listPolicyState("MyTestPolicy", "0.0.1", "EState"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deletePolicyState("@£$$", "0.0.2", "Trigger04"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); assertEquals(4, apexModel.listPolicyState("MyTestPolicy", null, null).getMessages().size()); result = apexModel.deletePolicyState("MyTestPolicy", "0.0.2", "Trigger04"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); assertEquals(4, apexModel.listPolicyState("MyTestPolicy", null, null).getMessages().size()); result = apexModel.deletePolicyState("MyTestPolicy", null, "CState"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.deletePolicyState("MyTestPolicy", null, "ZState"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); assertEquals(3, apexModel.listPolicyState("MyTestPolicy", null, null).getMessages().size()); result = apexModel.deletePolicyState("MyTestPolicy", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listPolicyState("MyTestPolicy", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deletePolicyState("MyTestPolicy", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createPolicyState("MyTestPolicy", "0.0.1", "TestState1", "inEvent", "0.0.1", "task", "0.0.1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createPolicyState("MyTestPolicy", "0.0.1", "TestState2", "outEvent0", "0.0.1", "task", "0.0.1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createPolicyState("MyTestPolicy", "0.0.1", "TestState3", "outEvent1", "0.0.1", "task", "0.0.1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createPolicyStateTaskSelectionLogic(null, null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createPolicyStateTaskSelectionLogic("MyTestPolicy", null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createPolicyStateTaskSelectionLogic("MyTestPolicy", null, "SomeState", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createPolicyStateTaskSelectionLogic("MyTestPolicy", "1.2.3", "TestState1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createPolicyStateTaskSelectionLogic("MyTestPolicy", "0.0.1", "TestState1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createPolicyStateTaskSelectionLogic("MyTestPolicy", "0.0.1", "TestState1", "NewTSL00", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createPolicyStateTaskSelectionLogic("MyTestPolicy", "0.0.1", "TestState1", "UNDEFINED", "Some Policy Logic"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createPolicyStateTaskSelectionLogic("MyTestPolicy", "0.0.1", "TestState1", "MVEL", "Some Policy Logic"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_EXISTS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_EXISTS)); result = apexModel.deletePolicyStateTaskSelectionLogic("MyTestPolicy", "0.0.1", "TestState1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createPolicyStateTaskSelectionLogic("MyTestPolicy", "0.0.1", "TestState1", "JAVA", "Some Policy Logic"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createPolicyStateTaskSelectionLogic("MyTestPolicy", "0.0.1", "TestState1", "JYTHON", "Some Policy Logic"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_EXISTS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_EXISTS)); result = apexModel.deletePolicyStateTaskSelectionLogic("MyTestPolicy", "0.0.1", "TestState1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createPolicyStateTaskSelectionLogic("MyTestPolicy", null, "TestState1", "JAVASCRIPT", "Some Policy Logic"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.deletePolicyStateTaskSelectionLogic("MyTestPolicy", "0.0.1", "TestState1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createPolicyStateTaskSelectionLogic("MyTestPolicy", null, "TestState1", "JRUBY", "Some Policy Logic"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updatePolicyStateTaskSelectionLogic(null, null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.updatePolicyStateTaskSelectionLogic("MyTestPolicy", null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.updatePolicyStateTaskSelectionLogic("MyTestPolicy", null, "TestState1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updatePolicyStateTaskSelectionLogic("MyTestPolicy", null, "TestState99", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.updatePolicyStateTaskSelectionLogic("MyTestPolicy2", null, "TestState1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.updatePolicyStateTaskSelectionLogic("MyTestPolicy1", "0.0.2", "TestState1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.updatePolicyStateTaskSelectionLogic("MyTestPolicy", "0.0.1", "TestState1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updatePolicyStateTaskSelectionLogic("MyTestPolicy", "0.0.1", "NonExistantState", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.updatePolicyStateTaskSelectionLogic("MyTestPolicy", "0.0.1", "TestState1", "", "Some Other Policy Logic"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.updatePolicyStateTaskSelectionLogic("MyTestPolicy", "0.0.1", "TestState1", "MVEL", "Some Other Policy Logic"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updatePolicyStateTaskSelectionLogic("MyPolicy012", null, "TestState1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.updatePolicyStateTaskSelectionLogic("MyTestPolicy", null, "TestState1", null, "Some Other Policy Logic"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updatePolicyStateTaskSelectionLogic("MyTestPolicy", null, "TestState1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updatePolicyStateTaskSelectionLogic("MyPolicy015", null, "TestState1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.updatePolicyStateTaskSelectionLogic("MyPolicy014", "0.1.5", "TestState1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listPolicyStateTaskSelectionLogic(null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.listPolicyStateTaskSelectionLogic("zooby", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.listPolicyStateTaskSelectionLogic("zooby", null, "looby"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listPolicyStateTaskSelectionLogic("zooby", null, "TestState1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listPolicyStateTaskSelectionLogic("MyTestPolicy", null, "looby"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listPolicyStateTaskSelectionLogic("MyTestPolicy", "0.0.2", "TestState1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listPolicyStateTaskSelectionLogic("MyTestPolicy", null, "TestState1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(1, result.getMessages().size()); result = apexModel.deletePolicyStateTaskSelectionLogic(null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.deletePolicyStateTaskSelectionLogic("zooby", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.deletePolicyStateTaskSelectionLogic("zooby", null, "looby"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deletePolicyStateTaskSelectionLogic("zooby", null, "TestState1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deletePolicyStateTaskSelectionLogic("MyTestPolicy", null, "looby"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deletePolicyStateTaskSelectionLogic("MyTestPolicy", "0.0.2", "TestState1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deletePolicyStateTaskSelectionLogic("MyTestPolicy", "0.0.1", "TestState1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listPolicyStateTaskSelectionLogic("MyTestPolicy", null, "TestState1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.deletePolicyStateTaskSelectionLogic("MyTestPolicy", "0.0.1", "TestState1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.updatePolicyStateTaskSelectionLogic("MyTestPolicy", null, "TestState1", null, "Some Other Policy Logic"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listPolicyStateTaskSelectionLogic("MyTestPolicy", null, "TestState1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(1, result.getMessages().size()); result = apexModel.createPolicyStateTaskSelectionLogic("MyTestPolicy", null, "TestState1", "JRUBY", "Some Policy Logic"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listPolicyStateTaskSelectionLogic("MyTestPolicy", null, "TestState1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.deletePolicyStateTaskSelectionLogic("MyTestPolicy", "0.0.1", "TestState1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.deletePolicyStateTaskSelectionLogic("MyTestPolicy", "0.0.1", "TestState1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createPolicyStateOutput(null, null, null, null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createPolicyStateOutput("MyTestPolicy", null, null, null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createPolicyStateOutput("MyTestPolicy", null, "SomeState", null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createPolicyStateOutput("MyTestPolicy", null, "SomeState", "SomeOutput", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createPolicyStateOutput("MyTestPolicy", "1.2.3", "TestState1", "SomeOutput", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createPolicyStateOutput("MyTestPolicy", "0.0.1", "TestState1", "SomeOutput", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createPolicyStateOutput("MyTestPolicy", "0.0.1", "TestState1", "SomeOutput", "SomeDummyEvent", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createPolicyStateOutput("MyTestPolicy", "0.0.1", "TestState1", "SomeOutput", "inEvent", "1.2.3", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createPolicyStateOutput("MyTestPolicy", "0.0.1", "TestState1", "SomeOutput", "inEvent", "0.0.1", "SomeDummyNextState"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createPolicyStateOutput("MyTestPolicy", "0.0.1", "TestState1", "SomeOutput", "inEvent", "0.0.1", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createPolicyStateOutput("MyTestPolicy", "0.0.1", "TestState1", "SomeOtherOutput", "inEvent", "0.0.1", "TestState1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createPolicyStateOutput("MyTestPolicy", "0.0.1", "TestState1", "SomeOtherOutput", "inEvent", "0.0.1", "TestState2"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createPolicyStateOutput("MyTestPolicy", "0.0.1", "TestState1", "SomeOtherOutput", "inEvent", "0.0.1", "TestState2"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_EXISTS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_EXISTS)); result = apexModel.createPolicyStateOutput("MyTestPolicy", "0.0.1", "TestState2", "AnotherOtherOutput", "outEvent0", "0.0.1", "TestState3"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createPolicyStateOutput("MyTestPolicy", "0.0.1", "TestState2", "YetAnotherOtherOutput", "outEvent0", "0.0.1", "TestState3"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listPolicyStateOutput(null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.listPolicyStateOutput("MyTestPolicy", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.listPolicyStateOutput("MyTestPolicy", "0.0.1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.listPolicyStateOutput("MyTestPolicy", "0.0.2", "TestState1", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listPolicyStateOutput("MyTestPolicy", null, "SomeState", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listPolicyStateOutput("MyTestPolicy", "0.0.1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.listPolicyStateOutput("MyTestPolicy", "0.0.1", "TestState1", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(2, result.getMessages().size()); result = apexModel.listPolicyStateOutput("MyTestPolicy", "0.0.1", "TestState2", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(2, result.getMessages().size()); result = apexModel.listPolicyStateOutput("MyTestPolicy", "0.0.1", "TestState1", "YetAnotherOtherOutput"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listPolicyStateOutput("MyTestPolicy", "0.0.1", "TestState2", "YetAnotherOtherOutput"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(1, result.getMessages().size()); result = apexModel.listPolicyStateOutput("MyTestPolicy", "0.0.1", "TestState3", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deletePolicyStateOutput(null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.deletePolicyStateOutput("MyTestPolicy", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.deletePolicyStateOutput("MyTestPolicy", "0.0.1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.deletePolicyStateOutput("MyTestPolicy", "0.0.2", "TestState1", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deletePolicyStateOutput("MyTestPolicy", null, "SomeState", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deletePolicyStateOutput("MyTestPolicy", "0.0.1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.deletePolicyStateOutput("MyTestPolicy", "0.0.1", "TestState3", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deletePolicyStateOutput("MyTestPolicy", "0.0.1", "TestState3", "DummyOutput"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listPolicyStateOutput("MyTestPolicy", null, "TestState1", null); assertEquals(2, result.getMessages().size()); result = apexModel.deletePolicyStateOutput("MyTestPolicy", null, "TestState1", "SomeOutput"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(1, result.getMessages().size()); result = apexModel.listPolicyStateOutput("MyTestPolicy", null, "TestState1", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(1, result.getMessages().size()); result = apexModel.deletePolicyStateOutput("MyTestPolicy", null, "TestState1", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(1, result.getMessages().size()); result = apexModel.listPolicyStateOutput("MyTestPolicy", null, "TestState1", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listPolicyStateOutput("MyTestPolicy", null, "TestState2", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(2, result.getMessages().size()); result = apexModel.deletePolicyStateOutput("MyTestPolicy", null, "TestState2", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(2, result.getMessages().size()); result = apexModel.listPolicyStateOutput("MyTestPolicy", null, "TestState2", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createPolicyStateOutput("MyTestPolicy", "0.0.1", "TestState1", "SomeOutput", "inEvent", "0.0.1", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createPolicyStateOutput("MyTestPolicy", "0.0.1", "TestState1", "SomeOtherOutput", "inEvent", "0.0.1", "TestState1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createPolicyStateOutput("MyTestPolicy", "0.0.1", "TestState1", "SomeOtherOutput", "inEvent", "0.0.1", "TestState2"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createPolicyStateOutput("MyTestPolicy", "0.0.1", "TestState2", "AnotherOtherOutput", "outEvent0", "0.0.1", "TestState3"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createPolicyStateOutput("MyTestPolicy", "0.0.1", "TestState2", "YetAnotherOtherOutput", "outEvent0", "0.0.1", "TestState3"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createPolicyStateFinalizerLogic(null, null, null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", null, null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", null, "SomeState", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", null, "SomeState", "SFLName01", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", "1.2.3", "TestState1", "SFLName01", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", "SFLName01", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", "SFLName01", "NewTSL00", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", "SFLName02", "UNDEFINED", "Some Policy Logic"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", "SFLName03", "MVEL", "Some Policy Logic"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", "SFLName03", "MVEL", "Some Policy Logic"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_EXISTS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_EXISTS)); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", "SFLName04", "JAVA", "Some Policy Logic"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", "SFLName05", "JYTHON", "Some Policy Logic"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", null, "TestState1", "SFLName06", "JAVASCRIPT", "Some Policy Logic"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", null, "TestState1", "SFLName07", "JRUBY", "Some Policy Logic"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updatePolicyStateFinalizerLogic(null, null, null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.updatePolicyStateFinalizerLogic("MyTestPolicy", null, null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.updatePolicyStateFinalizerLogic("MyTestPolicy", null, "TestState1", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.updatePolicyStateFinalizerLogic("MyTestPolicy", null, "TestState99", "SomeSFLName", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.updatePolicyStateFinalizerLogic("MyTestPolicy2", null, "TestState1", "SomeSFLName", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.updatePolicyStateFinalizerLogic("MyTestPolicy1", "0.0.2", "TestState1", "SomeSFLName", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.updatePolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", "NonEistantSFL", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.updatePolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", "SFLName06", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updatePolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", "SFLName06", "", "Some Other Policy Logic"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.updatePolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", "SFLName06", "MVEL", "Some Other Policy Logic"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updatePolicyStateFinalizerLogic("MyPolicy012", null, "TestState1", "SFLName06", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.updatePolicyStateFinalizerLogic("MyTestPolicy", null, "TestState1", "SFLName06", null, "Some Other Policy Logic"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updatePolicyStateFinalizerLogic("MyTestPolicy", null, "TestState1", "SFLName06", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updatePolicyStateFinalizerLogic("MyPolicy015", null, "TestState1", "SFLName06", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.updatePolicyStateFinalizerLogic("MyPolicy014", "0.1.5", "TestState1", "SFLName06", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listPolicyStateFinalizerLogic(null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.listPolicyStateFinalizerLogic("MyTestPolicy", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.listPolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.listPolicyStateFinalizerLogic("MyTestPolicy", "0.0.2", "TestState1", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listPolicyStateFinalizerLogic("MyTestPolicy", null, "SomeState", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listPolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.listPolicyStateFinalizerLogic("zooby", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.listPolicyStateFinalizerLogic("zooby", null, "looby", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listPolicyStateFinalizerLogic("zooby", null, "TestState1", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listPolicyStateFinalizerLogic("MyTestPolicy", null, "looby", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listPolicyStateFinalizerLogic("MyTestPolicy", "0.0.2", "TestState1", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listPolicyStateFinalizerLogic("MyTestPolicy", null, "TestState1", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(6, result.getMessages().size()); result = apexModel.listPolicyStateFinalizerLogic("MyTestPolicy", null, "TestState1", "SFLName06"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(1, result.getMessages().size()); result = apexModel.deletePolicyStateFinalizerLogic(null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.deletePolicyStateFinalizerLogic("MyTestPolicy", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.deletePolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.deletePolicyStateFinalizerLogic("MyTestPolicy", "0.0.2", "TestState1", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deletePolicyStateFinalizerLogic("MyTestPolicy", null, "SomeState", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deletePolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.deletePolicyStateFinalizerLogic("zooby", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.deletePolicyStateFinalizerLogic("zooby", null, "looby", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deletePolicyStateFinalizerLogic("zooby", null, "TestState1", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deletePolicyStateFinalizerLogic("MyTestPolicy", null, "looby", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deletePolicyStateFinalizerLogic("MyTestPolicy", "0.0.2", "TestState1", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deletePolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", "SFLName06"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.deletePolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", "SFLName06"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); assertEquals(1, result.getMessages().size()); result = apexModel.listPolicyStateFinalizerLogic("MyTestPolicy", null, "TestState1", "SFLName06"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listPolicyStateFinalizerLogic("MyTestPolicy", null, "TestState1", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(5, result.getMessages().size()); result = apexModel.deletePolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", "SFLName02"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.deletePolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", "SFLName02"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); assertEquals(1, result.getMessages().size()); result = apexModel.listPolicyStateFinalizerLogic("MyTestPolicy", null, "TestState1", "SFLName02"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listPolicyStateFinalizerLogic("MyTestPolicy", null, "TestState1", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(4, result.getMessages().size()); result = apexModel.deletePolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(4, result.getMessages().size()); result = apexModel.deletePolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listPolicyStateFinalizerLogic("MyTestPolicy", null, "TestState1", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", "SFLName02", "UNDEFINED", "Some Policy Logic"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", "SFLName03", "MVEL", "Some Policy Logic"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", "SFLName04", "JAVA", "Some Policy Logic"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", "SFLName05", "JYTHON", "Some Policy Logic"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", null, "TestState1", "SFLName06", "JAVASCRIPT", "Some Policy Logic"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", null, "TestState1", "SFLName07", "JRUBY", "Some Policy Logic"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createTask("TestTask0", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createTask("TestTask1", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createTask("TestTask2", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createTask("TestTask3", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createTask("TestTask4", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createPolicyStateTaskRef(null, null, null, null, null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, null, null, null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "SomeState", null, null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "SomeState", null, null, null, null, "DummyOutput"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", "1.2.3", "SomeState", null, null, null, null, "DummyOutput"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createPolicyStateTaskRef("AnyOldPolicy", "1.2.3", "SomeState", null, null, null, null, "DummyOutput"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", "0.0.1", "TestState1", "SomeTaskLocalName", null, null, null, "DummyOutput"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", "0.0.1", "TestState1", "SomeTaskLocalName", "SomeTask", "Zooby|", null, "DummyOutput"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", "0.0.1", "TestState1", "SomeTaskLocalName", "SomeTask", "0.0.1", null, "DummyOutput"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", "0.0.1", "TestState1", "SomeTaskLocalName", "task", "0.0.1", null, "DummyOutput"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", "0.0.1", "TestState1", "SomeTaskLocalName", "task", "0.0.1", "Some Policy Logic", "DummyOutput"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", "0.0.1", "TestState1", "SomeTaskLocalName", "task", "0.0.1", "DIRECT", "DummyOutput"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", "0.0.1", "TestState1", "SomeTaskLocalName", "task", "0.0.1", "LOGIC", "DummyOutput"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "TestState1", "SomeTaskLocalName", "task", "0.0.1", "DIRECT", "SFLName07"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "TestState1", "SomeTaskLocalName", "task", "0.0.1", "LOGIC", "SomeOutput"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "TestState1", "SomeTaskLocalName", "task", "0.0.1", "DIRECT", "SomeOutput"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "TestState1", "SomeTaskLocalName", "NonExistantTask", "0.0.1", "DIRECT", "SomeOutput"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "TestState1", "SomeTaskLocalName", "task", "0.0.1", "LOGIC", "SFLName07"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_EXISTS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_EXISTS)); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "TestState1", "SomeTaskLocalName", "TestTask0", "0.0.1", "LOGIC", "SFLName07"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "TestState1", "SomeTaskLocalName", "TestTask1", "0.0.1", "DIRECT", "SomeOtherOutput"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "TestState1", "SomeTaskLocalName", "TestTask2", "0.0.1", "LOGIC", "SFLName07"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "TestState1", "SomeTaskLocalName", "TestTask3", "0.0.1", "DIRECT", "SomeOtherOutput"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "TestState1", null, "TestTask4", "0.0.1", "LOGIC", "SFLName07"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "TestState1", null, "TestTask4", "0.0.1", "LOGIC", "SFLName07"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_EXISTS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_EXISTS)); result = apexModel.deletePolicyStateTaskRef("MyTestPolicy", null, "TestState1", "TestTask4", "0.0.1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "TestState1", "SomeTaskLocalName", "TestTask4", "0.0.1", "FUNKY", "SFLName07"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "TestState1", "SomeTaskLocalName", "TestTask4", "0.0.1", "UNDEFINED", "SFLName07"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "TestState1", "SomeTaskLocalName", "TestTask4", "0.0.1", "LOGIC", "SFLName07"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "TestState1", null, "TestTask0", "0.0.1", "LOGIC", "SFLName07"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_EXISTS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_EXISTS)); result = apexModel.listPolicyStateTaskRef(null, null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.listPolicyStateTaskRef("MyTestPolicy", null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.listPolicyStateTaskRef("MyTestPolicy", "0.0.1", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.listPolicyStateTaskRef("MyTestPolicy", "0.0.2", "TestState1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listPolicyStateTaskRef("MyTestPolicy", null, "SomeState", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listPolicyStateTaskRef("MyTestPolicy", "0.0.1", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.listPolicyStateTaskRef("zooby", null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.listPolicyStateTaskRef("zooby", null, "looby", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listPolicyStateTaskRef("zooby", null, "TestState1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listPolicyStateTaskRef("MyTestPolicy", null, "looby", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listPolicyStateTaskRef("MyTestPolicy", "0.0.2", "TestState1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listPolicyStateTaskRef("MyTestPolicy", null, "TestState1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(12, result.getMessages().size()); result = apexModel.listPolicyStateTaskRef("MyTestPolicy", null, "TestState1", "SomeOldTask", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listPolicyStateTaskRef("MyTestPolicy", null, "TestState1", "task", "1.0.1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); assertEquals(1, result.getMessages().size()); result = apexModel.listPolicyStateTaskRef("MyTestPolicy", null, "TestState1", "task", "0.0.1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(2, result.getMessages().size()); result = apexModel.listPolicyStateTaskRef("MyTestPolicy", null, "TestState1", "task", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(2, result.getMessages().size()); result = apexModel.deletePolicyStateTaskRef(null, null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.deletePolicyStateTaskRef("MyTestPolicy", null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.deletePolicyStateTaskRef("MyTestPolicy", "0.0.1", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.deletePolicyStateTaskRef("MyTestPolicy", "0.0.2", "TestState1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deletePolicyStateTaskRef("MyTestPolicy", null, "SomeState", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deletePolicyStateTaskRef("MyTestPolicy", "0.0.1", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.deletePolicyStateTaskRef("zooby", null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.deletePolicyStateTaskRef("zooby", null, "looby", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deletePolicyStateTaskRef("zooby", null, "TestState1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deletePolicyStateTaskRef("MyTestPolicy", null, "looby", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deletePolicyStateTaskRef("MyTestPolicy", "0.0.2", "TestState1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deletePolicyStateTaskRef("MyTestPolicy", "0.0.2", "TestState1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deletePolicyStateTaskRef("MyTestPolicy", "0.0.1", "TestState1", "ADummyTask", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deletePolicyStateTaskRef("MyTestPolicy", "0.0.1", "TestState1", "task", "0.0.2"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listPolicyStateTaskRef("MyTestPolicy", null, "TestState1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(12, result.getMessages().size()); result = apexModel.deletePolicyStateTaskRef("MyTestPolicy", null, "TestState1", "TestTask0", "0.0.1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(1, result.getMessages().size()); result = apexModel.listPolicyStateTaskRef("MyTestPolicy", null, "TestState1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(10, result.getMessages().size()); result = apexModel.deletePolicyStateTaskRef("MyTestPolicy", null, "TestState1", "TestTask2", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(1, result.getMessages().size()); result = apexModel.listPolicyStateTaskRef("MyTestPolicy", null, "TestState1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(8, result.getMessages().size()); result = apexModel.deletePolicyStateTaskRef("MyTestPolicy", null, "TestState1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(4, result.getMessages().size()); result = apexModel.listPolicyStateTaskRef("MyTestPolicy", null, "TestState1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createPolicyStateContextRef(null, null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createPolicyStateContextRef("MyTestPolicy", null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createPolicyStateContextRef("MyTestPolicy", null, "SomeState", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createPolicyStateContextRef("MyTestPolicy", null, "SomeState", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createPolicyStateContextRef("MyTestPolicy", "1.2.3", "SomeState", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createPolicyStateContextRef("AnyOldPolicy", "1.2.3", "SomeState", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createPolicyStateContextRef("MyTestPolicy", "0.0.1", "TestState1", "SomeTask", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createPolicyStateContextRef("MyTestPolicy", "0.0.1", "TestState1", "SomeTask", "Zooby|"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createPolicyStateContextRef("MyTestPolicy", "0.0.1", "TestState1", "SomeTask", "0.0.1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createPolicyStateContextRef("MyTestPolicy", "0.0.1", "TestState1", "task", "0.0.1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createPolicyStateContextRef("MyPolicy123", null, null, "AContextMap00", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createPolicyStateContextRef("MyPolicy123", null, "TestState1", "AContextMap00", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createPolicyStateContextRef("MyTestPolicy", "4.5.6", "TestState1", "AContextMap00", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createPolicyStateContextRef("MyTestPolicy", "0.1.4", "TestState1", "AContextMap00", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createPolicyStateContextRef("MyTestPolicy", "0.0.1", "TestState1", "AContextMap00", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createPolicyStateContextRef("MyTestPolicy", "0.0.1", "TestState1", "contextAlbum0", ""); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createPolicyStateContextRef("MyTestPolicy", "0.0.1", "TestState1", "contextAlbum0", "0.0.2"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createPolicyStateContextRef("MyTestPolicy", "0.0.1", "TestState1", "contextAlbum0", "0.0.1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createPolicyStateContextRef("MyTestPolicy", "0.0.1", "TestState1", "contextAlbum0", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_EXISTS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_EXISTS)); result = apexModel.createPolicyStateContextRef("MyTestPolicy", "0.0.1", "TestState1", "contextAlbum0", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_EXISTS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_EXISTS)); result = apexModel.createPolicyStateContextRef("MyTestPolicy", "0.0.1", "TestState1", "contextAlbum1", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createPolicyStateContextRef("MyTestPolicy", "0.0.1", "TestState1", "contextAlbum0", "0.0.1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_EXISTS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_EXISTS)); result = apexModel.createPolicyStateContextRef("MyTestPolicy", null, "TestState1", "contextAlbum0", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_EXISTS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_EXISTS)); result = apexModel.listPolicyStateContextRef(null, null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.listPolicyStateContextRef("MyTestPolicy", null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.listPolicyStateContextRef("MyTestPolicy", "0.0.1", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.listPolicyStateContextRef("MyTestPolicy", "0.0.2", "TestState1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listPolicyStateContextRef("MyTestPolicy", null, "SomeState", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listPolicyStateContextRef("MyTestPolicy", "0.0.1", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.listPolicyStateContextRef("zooby", null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.listPolicyStateContextRef("zooby", null, "looby", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listPolicyStateContextRef("zooby", null, "TestState1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listPolicyStateContextRef("MyTestPolicy", null, "looby", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listPolicyStateContextRef("MyTestPolicy", "0.0.2", "TestState1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listPolicyStateContextRef("MyTestPolicy", null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.listPolicyStateContextRef("MyTestPolicy", null, "TestState1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(2, result.getMessages().size()); result = apexModel.listPolicyStateContextRef("MyTestPolicy", "0.0.2", "TestState1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listPolicyStateContextRef("MyTestPolicy", "0.0.1", "TestState1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(2, result.getMessages().size()); result = apexModel.listPolicyStateContextRef("MyTestPolicy", "0.0.1", "TestState1", "contextAlbum0", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(1, result.getMessages().size()); result = apexModel.listPolicyStateContextRef("MyTestPolicy", "0.0.1", "TestState1", "contextAlbum0", "0.0.1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(1, result.getMessages().size()); result = apexModel.listPolicyStateContextRef("MyTestPolicy", "0.0.1", "TestState1", "contextAlbum0", "0.0.2"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listPolicyStateContextRef("MyTestPolicy", "0.0.1", "TestState1", "AContextMap04", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listPolicyStateContextRef("MyTestPolicy", "0.0.1", "TestState1", "contextAlbum0", "0.0.1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(1, result.getMessages().size()); result = apexModel.listPolicyStateContextRef("MyTestPolicy", "0.0.1", "TestState1", "contextAlbum0", "1.0.1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deletePolicyStateContextRef(null, null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.deletePolicyStateContextRef("MyTestPolicy", null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.deletePolicyStateContextRef("MyTestPolicy", "0.0.1", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.deletePolicyStateContextRef("MyTestPolicy", "0.0.2", "TestState1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deletePolicyStateContextRef("MyTestPolicy", null, "SomeState", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deletePolicyStateContextRef("MyTestPolicy", "0.0.1", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.deletePolicyStateContextRef("zooby", null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.deletePolicyStateContextRef("zooby", null, "looby", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deletePolicyStateContextRef("zooby", null, "TestState1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deletePolicyStateContextRef("MyTestPolicy", null, "looby", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deletePolicyStateContextRef("MyTestPolicy", "0.0.2", "TestState1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deletePolicyStateContextRef("MyTestPolicy", "0.0.2", "TestState1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deletePolicyStateContextRef("MyTestPolicy", "0.0.1", "TestState1", "ADummyContextMap", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deletePolicyStateContextRef("MyTestPolicy", "0.0.1", "TestState1", "contextAlbum0", "0.0.2"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listPolicyStateContextRef("MyTestPolicy", null, null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.deletePolicyStateContextRef("MyTestPolicy", "0.0.1", "TestState1", "AContextMap04", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deletePolicyStateContextRef("MyTestPolicy", null, "TestState1", "contextAlbum0", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.deletePolicyStateContextRef("MyTestPolicy", null, "TestState1", "contextAlbum0", "0.1.5"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deletePolicyStateContextRef("MyTestPolicy", null, "TestState1", "contextAlbum1", "0.0.1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(1, result.getMessages().size()); result = apexModel.createPolicyStateContextRef("MyTestPolicy", "0.0.1", "TestState1", "contextAlbum0", "0.0.1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.deletePolicyStateContextRef("MyTestPolicy", null, "TestState1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.deletePolicyStateContextRef("MyTestPolicy", null, "TestState1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); assertEquals(1, result.getMessages().size()); result = apexModel.listPolicyStateContextRef("MyTestPolicy", null, "TestState1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deletePolicy(null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(3, result.getMessages().size()); result = apexModel.listPolicy(null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(0, result.getMessages().size()); } } diff --git a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/TestApexEditorAPITask.java b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/TestApexEditorApiTask.java index e39da2876..9faa3653c 100644 --- a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/TestApexEditorAPITask.java +++ b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/TestApexEditorApiTask.java @@ -26,459 +26,460 @@ import static org.junit.Assert.assertTrue; import org.junit.Test; /** + * Test tasks for API tests. * @author Liam Fallon (liam.fallon@ericsson.com) */ -public class TestApexEditorAPITask { +public class TestApexEditorApiTask { @Test - public void testTaskCRUD() { + public void testTaskCrud() { final ApexModel apexModel = new ApexModelFactory().createApexModel(null, false); - ApexAPIResult result = apexModel.validateTask(null, null); - assertEquals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, result.getResult()); + ApexApiResult result = apexModel.validateTask(null, null); + assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.validateTask("%%%$£", null); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.loadFromFile("src/test/resources/models/PolicyModel.json"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createTask("@^^$^^$", "0.0.2", "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createTask("MyTask002", "0.0.2", "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createTask("MyTask002", "0.0.2", "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_EXISTS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_EXISTS)); result = apexModel.createTask("MyTask012", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createTask("MyTask012", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_EXISTS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_EXISTS)); result = apexModel.listTask(null, null); result = apexModel.createTask("MyTask002", "0.0.2", "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_EXISTS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_EXISTS)); result = apexModel.createTask("MyTask012", "0.1.2", "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.deleteTask("MyTask002", "0.0.2"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createTask("MyTask002", "0.0.2", "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.validateTask(null, null); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.updateTask("@$$$£", "0.0.2", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.updateTask("MyTask002", "0.0.2", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updateTask("MyTask002", "0.0.1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.updateTask("MyTask002", "0.0.2", "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updateTask("MyTask012", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updateTask("MyTask012", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updateTask("MyTask012", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updateTask("MyTask015", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.updateTask("MyTask014", "0.1.5", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listTask("£@£@@£@£", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.listTask(null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listTask("MyTask012", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listTask("MyTask012", "0.0.2"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listTask("MyTask012", "0.2.5"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listTask("MyTask014", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deleteTask("@£££@", "0.1.1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.deleteTask("MyTask012", "0.1.1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deleteTask("MyTask012oooo", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listTask("MyTask012", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertTrue(result.getMessages().size() == 2); result = apexModel.deleteTask("MyTask012", "0.1.2"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listTask("MyTask012", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertTrue(result.getMessages().size() == 1); result = apexModel.deleteTask("MyTask012", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listTask("MyTask012", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.updateTaskLogic("MyTask002", null, "NewLogic00", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createTaskLogic("MyTask123", null, "NewLogic00", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createTaskLogic("MyTask002", "4.5.6", "NewLogic00", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createTaskLogic("MyTask002", "0.1.4", "NewLogic00", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createTaskLogic("MyTask002", "0.0.2", "NewLogic00", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createTaskLogic("MyTask002", "0.0.2", "UNDEFINED", "Some Task Logic"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createTaskLogic("MyTask002", "0.0.2", "MVEL", "Some Task Logic"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_EXISTS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_EXISTS)); result = apexModel.deleteTaskLogic("MyTask002", "0.0.2"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createTaskLogic("MyTask002", "0.0.2", "JAVA", "Some Task Logic"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createTaskLogic("MyTask002", "0.0.2", "JYTHON", "Some Task Logic"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_EXISTS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_EXISTS)); result = apexModel.deleteTaskLogic("MyTask002", "0.0.2"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createTaskLogic("MyTask002", null, "JAVASCRIPT", "Some Task Logic"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.deleteTaskLogic("MyTask002", "0.0.2"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createTaskLogic("MyTask002", null, "JRUBY", "Some Task Logic"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updateTaskLogic("MyTask002", "0.0.2", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updateTaskLogic("MyTask002", "0.0.1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.updateTaskLogic("MyTask002", "0.0.2", "", "Some Other Task Logic"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.updateTaskLogic("MyTask002", "0.0.2", "MVEL", "Some Other Task Logic"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updateTaskLogic("MyTask012", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.updateTaskLogic("MyTask002", null, null, "Some Other Task Logic"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updateTaskLogic("MyTask002", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.updateTaskLogic("MyTask015", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.updateTaskLogic("MyTask014", "0.1.5", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listTaskLogic("MyTask002", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listTaskLogic("MyTask002", "0.0.1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listTaskLogic("MyTask002", "0.0.2"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listTaskLogic("MyTask002", "0.0.2"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listTaskLogic("MyTask002", "0.0.2"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listTaskLogic(null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.deleteTaskLogic("@£@£@£", "0.0.2"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.deleteTaskLogic("NonExistantTask", "0.0.2"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); assertEquals(1, apexModel.listTaskLogic("MyTask002", null).getMessages().size()); result = apexModel.deleteTaskLogic("MyTask002", "0.0.2"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listTaskLogic("MyTask002", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.deleteTaskLogic("MyTask002", "0.0.2"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); assertEquals(1, apexModel.listTaskLogic("MyTask002", null).getMessages().size()); result = apexModel.createTaskLogic("MyTask002", null, "JRUBY", "Some Task Logic"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listTaskLogic("MyTask002", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.deleteTaskLogic("MyTask002", "0.0.2"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.deleteTaskLogic("MyTask002", "0.0.2"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createTaskInputField("MyTask123", null, "NewField00", null, null, false); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createTaskInputField("MyTask002", "4.5.6", "NewField00", null, null, true); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createTaskInputField("MyTask002", "0.1.4", "NewField00", null, null, false); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createTaskInputField("MyTask002", "0.0.2", "NewField00", null, null, true); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createTaskInputField("MyTask002", "0.0.2", "NewField00", "eventContextItem0", null, false); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createTaskInputField("MyTask002", "0.0.2", "NewField00", "eventContextItem0", null, true); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_EXISTS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_EXISTS)); result = apexModel.createTaskInputField("MyTask002", "0.0.2", "NewField01", "eventContextItem0", "0.0.1", false); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createTaskInputField("MyTask002", "0.0.2", "NewField02", "eventContextItem0", "0.0.2", true); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createTaskInputField("MyTask002", null, "NewField02", "eventContextItem0", null, false); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createTaskInputField("MyTask002", null, "NewField03", "eventContextItem0", null, true); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listTaskInputField("@£$%", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.listTaskInputField("MyTask002", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listTaskInputField("MyTask002", "0.0.1", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listTaskInputField("MyTask002", "0.0.2", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listTaskInputField("MyTask002", "0.0.2", "NewField01"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listTaskInputField("MyTask002", "0.0.2", "NewField02"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listTaskInputField("MyTask002", "0.0.2", "NewField04"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deleteTaskInputField("@£$%", "0.0.2", "NewField04"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.deleteTaskInputField("NonExistantTask", "0.0.2", "NewField04"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); assertEquals(4, apexModel.listTaskInputField("MyTask002", null, null).getMessages().size()); result = apexModel.deleteTaskInputField("MyTask002", "0.0.2", "NewField04"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); assertEquals(4, apexModel.listTaskInputField("MyTask002", null, null).getMessages().size()); result = apexModel.deleteTaskInputField("MyTask002", null, "NewField02"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(3, apexModel.listTaskInputField("MyTask002", null, null).getMessages().size()); result = apexModel.deleteTaskInputField("MyTask002", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listTaskInputField("MyTask002", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deleteTaskInputField("MyTask002", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createTaskOutputField("MyTask123", null, "NewField00", null, null, false); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createTaskOutputField("MyTask002", "4.5.6", "NewField00", null, null, false); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createTaskOutputField("MyTask002", "0.1.4", "NewField00", null, null, false); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createTaskOutputField("MyTask002", "0.0.2", "NewField00", null, null, false); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createTaskOutputField("MyTask002", "0.0.2", "NewField00", "eventContextItem0", null, false); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createTaskOutputField("MyTask002", "0.0.2", "NewField00", "eventContextItem0", null, false); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_EXISTS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_EXISTS)); result = apexModel.createTaskOutputField("MyTask002", "0.0.2", "NewField01", "eventContextItem0", "0.0.1", false); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createTaskOutputField("MyTask002", "0.0.2", "NewField02", "eventContextItem0", "0.0.2", false); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createTaskOutputField("MyTask002", null, "NewField02", "eventContextItem0", null, false); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createTaskOutputField("MyTask002", null, "NewField03", "eventContextItem0", null, false); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listTaskOutputField("@£$%", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.listTaskOutputField("MyTask002", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listTaskOutputField("MyTask002", "0.0.1", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listTaskOutputField("MyTask002", "0.0.2", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listTaskOutputField("MyTask002", "0.0.2", "NewField01"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listTaskOutputField("MyTask002", "0.0.2", "NewField02"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listTaskOutputField("MyTask002", "0.0.2", "NewField04"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deleteTaskOutputField("@£$%", "0.0.2", "NewField04"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.deleteTaskOutputField("NonExistantTask", "0.0.2", "NewField04"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); assertEquals(4, apexModel.listTaskOutputField("MyTask002", null, null).getMessages().size()); result = apexModel.deleteTaskOutputField("MyTask002", "0.0.2", "NewField04"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); assertEquals(4, apexModel.listTaskOutputField("MyTask002", null, null).getMessages().size()); result = apexModel.deleteTaskOutputField("MyTask002", null, "NewField02"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(3, apexModel.listTaskOutputField("MyTask002", null, null).getMessages().size()); result = apexModel.deleteTaskOutputField("MyTask002", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listTaskOutputField("MyTask002", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deleteTaskOutputField("MyTask002", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createTaskParameter("MyTask123", null, "NewPar00", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createTaskParameter("MyTask002", "4.5.6", "NewPar00", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createTaskParameter("MyTask002", "0.1.4", "NewPar00", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createTaskParameter("MyTask002", "0.0.2", "NewPar00", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createTaskParameter("MyTask002", "0.0.2", "NewPar00", "eventContextItem0"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createTaskParameter("MyTask002", "0.0.2", "NewPar00", "eventContextItem0"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_EXISTS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_EXISTS)); result = apexModel.createTaskParameter("MyTask002", "0.0.2", "NewPar01", "eventContextItem0"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createTaskParameter("MyTask002", "0.0.2", "NewPar02", "eventContextItem0"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createTaskParameter("MyTask002", "0.0.2", "NewPar02", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_EXISTS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_EXISTS)); result = apexModel.createTaskParameter("MyTask002", "0.0.2", "NewPar03", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createTaskParameter("MyTask002", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createTaskParameter("MyTask002", null, null, "Default value"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.listTaskParameter("@£$%", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.listTaskParameter("MyTask002", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listTaskParameter("MyTask002", "0.0.3", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listTaskParameter("MyTask002", "0.0.2", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listTaskParameter("MyTask002", "0.0.2", "NewPar01"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listTaskParameter("MyTask002", "0.0.2", "NewPar02"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listTaskParameter("MyTask002", "0.0.2", "NewPar04"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deleteTaskParameter("@£$%", "0.0.2", "NewPar04"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.deleteTaskParameter("NonExistantTask", "0.0.2", "NewPar04"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); assertEquals(3, apexModel.listTaskParameter("MyTask002", null, null).getMessages().size()); result = apexModel.deleteTaskParameter("MyTask002", "0.0.2", "NewPar04"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); assertEquals(3, apexModel.listTaskParameter("MyTask002", null, null).getMessages().size()); result = apexModel.deleteTaskParameter("MyTask002", null, "NewPar02"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(2, apexModel.listTaskParameter("MyTask002", null, null).getMessages().size()); result = apexModel.deleteTaskParameter("MyTask002", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.listTaskParameter("MyTask002", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deleteTaskParameter("MyTask002", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createTaskContextRef("@£$$", null, "AContextMap00", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.createTaskContextRef("MyTask123", null, "AContextMap00", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createTaskContextRef("MyTask123", null, "AContextMap00", "0.0.1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createTaskContextRef("MyTask123", null, "AContextMap00", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createTaskContextRef("MyTask002", "4.5.6", "AContextMap00", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createTaskContextRef("MyTask002", "0.1.4", "AContextMap00", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createTaskContextRef("MyTask002", "0.0.2", "AContextMap00", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createTaskContextRef("MyTask002", "0.0.2", "contextAlbum2", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createTaskContextRef("MyTask002", "0.0.2", "contextAlbum0", "0.0.2"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.createTaskContextRef("MyTask002", "0.0.2", "contextAlbum0", "0.0.1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createTaskContextRef("MyTask002", "0.0.2", "contextAlbum0", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_EXISTS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_EXISTS)); result = apexModel.createTaskContextRef("MyTask002", "0.0.2", "contextAlbum1", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.createTaskContextRef("MyTask002", "0.0.2", "contextAlbum0", "0.0.1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_EXISTS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_EXISTS)); result = apexModel.createTaskContextRef("MyTask002", null, "contextAlbum0", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_EXISTS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_EXISTS)); result = apexModel.listTaskContextRef("@£$%", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.listTaskContextRef("MyTask002", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(2, result.getMessages().size()); result = apexModel.listTaskContextRef("MyTask002", "0.0.1", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listTaskContextRef("MyTask002", "0.0.2", null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(2, result.getMessages().size()); result = apexModel.listTaskContextRef("MyTask002", "0.0.2", "contextAlbum0", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(1, result.getMessages().size()); result = apexModel.listTaskContextRef("MyTask002", "0.0.2", "contextAlbum0", "0.0.1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(1, result.getMessages().size()); result = apexModel.listTaskContextRef("MyTask002", "0.0.2", "contextAlbum0", "0.0.2"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listTaskContextRef("MyTask002", "0.0.2", "AContextMap04", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.listTaskContextRef("MyTask002", "0.0.2", "contextAlbum0", "0.0.1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(1, result.getMessages().size()); result = apexModel.listTaskContextRef("MyTask002", "0.0.2", "contextAlbum1", "0.0.1"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(1, result.getMessages().size()); result = apexModel.listTaskContextRef("MyTask002", "0.0.2", "contextAlbum1", "0.0.2"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deleteTaskContextRef("@£$%", "0.0.2", "AContextMap04", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.deleteTaskContextRef("NonExistantTask", "0.0.2", "AContextMap04", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); assertEquals(2, apexModel.listTaskContextRef("MyTask002", null, null, null).getMessages().size()); result = apexModel.deleteTaskContextRef("MyTask002", "0.0.2", "AContextMap04", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deleteTaskContextRef("MyTask002", null, "contextAlbum0", "0.0.3"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deleteTaskContextRef("MyTask002", null, "contextAlbum0", "0.1.5"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deleteTaskContextRef("MyTask002", null, "contextAlbum0", null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(1, result.getMessages().size()); result = apexModel.deleteTaskContextRef("MyTask002", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(1, result.getMessages().size()); result = apexModel.listTaskContextRef("MyTask002", null, null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST)); + assertTrue(result.getResult().equals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST)); result = apexModel.deleteTask(null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(2, result.getMessages().size()); result = apexModel.listTask(null, null); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); assertEquals(0, result.getMessages().size()); } } diff --git a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/TestApexModelAPI.java b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/TestApexModelApi.java index c3521d307..9e2e1ce56 100644 --- a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/TestApexModelAPI.java +++ b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/TestApexModelApi.java @@ -40,9 +40,10 @@ import org.onap.policy.apex.model.modelapi.impl.ApexModelImpl; import org.onap.policy.apex.model.utilities.TextFileUtils; /** + * Test the apex model API. * @author Liam Fallon (liam.fallon@ericsson.com) */ -public class TestApexModelAPI { +public class TestApexModelApi { private Connection connection; @Before @@ -61,23 +62,23 @@ public class TestApexModelAPI { public void testApexModelLoadFromFile() { final ApexModel apexModel = new ApexModelFactory().createApexModel(null, false); - ApexAPIResult result = apexModel.loadFromFile("src/main/resources/models/PolicyModel.json"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + ApexApiResult result = apexModel.loadFromFile("src/main/resources/models/PolicyModel.json"); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); result = apexModel.loadFromFile("src/test/resources/models/PolicyModel.json"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.deleteModel(); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.loadFromFile("src/test/resources/models/PolicyModel.xml"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.deleteModel(); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.loadFromFile("src/test/resources/models/PolicyModel.junk"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); assertTrue(result.getMessages().get(0).equals("format of input for Apex concept is neither JSON nor XML")); } @@ -85,105 +86,105 @@ public class TestApexModelAPI { public void testApexModelSaveToFile() throws IOException { final ApexModel apexModel = new ApexModelFactory().createApexModel(null, false); - ApexAPIResult result = apexModel.loadFromFile("src/test/resources/models/PolicyModel.json"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + ApexApiResult result = apexModel.loadFromFile("src/test/resources/models/PolicyModel.json"); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); final File tempJsonModelFile = File.createTempFile("ApexModelTest", ".json"); result = apexModel.saveToFile(tempJsonModelFile.getCanonicalPath(), false); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); final ApexModel jsonApexModel = new ApexModelFactory().createApexModel(null, false); result = jsonApexModel.loadFromFile(tempJsonModelFile.getCanonicalPath()); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); tempJsonModelFile.delete(); - final File tempXMLModelFile = File.createTempFile("ApexModelTest", ".xml"); - result = apexModel.saveToFile(tempXMLModelFile.getCanonicalPath(), true); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + final File tempXmlModelFile = File.createTempFile("ApexModelTest", ".xml"); + result = apexModel.saveToFile(tempXmlModelFile.getCanonicalPath(), true); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); final ApexModel xmlApexModel = new ApexModelFactory().createApexModel(null, false); - result = xmlApexModel.loadFromFile(tempXMLModelFile.getCanonicalPath()); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); - tempXMLModelFile.delete(); + result = xmlApexModel.loadFromFile(tempXmlModelFile.getCanonicalPath()); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); + tempXmlModelFile.delete(); } @Test public void testApexModelDatabase() throws IOException { final ApexModel apexModel = new ApexModelFactory().createApexModel(null, false); - ApexAPIResult result = apexModel.loadFromFile("src/test/resources/models/PolicyModel.json"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + ApexApiResult result = apexModel.loadFromFile("src/test/resources/models/PolicyModel.json"); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); final DaoParameters DaoParameters = new DaoParameters(); DaoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao"); DaoParameters.setPersistenceUnit("DAOTest"); result = apexModel.saveToDatabase(DaoParameters); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.deleteModel(); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.loadFromDatabase("PolicyModel", "0.0.1", DaoParameters); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.deleteModel(); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.loadFromDatabase("PolicyModel", null, DaoParameters); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.deleteModel(); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); result = apexModel.loadFromDatabase("VPNPolicyModel", "0.0.1", DaoParameters); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); } @Test - public void testApexModelURL() throws IOException { + public void testApexModelUrl() throws IOException { ApexModel apexModel = new ApexModelFactory().createApexModel(null, false); - ApexAPIResult result = null; + ApexApiResult result = null; try { - result = apexModel.readFromURL(null); + result = apexModel.readFromUrl(null); fail("expecting an IllegalArgumentException"); } catch (final Exception e) { assertTrue(e instanceof IllegalArgumentException); } try { - result = apexModel.writeToURL(null, true); + result = apexModel.writeToUrl(null, true); fail("expecting an IllegalArgumentException"); } catch (final Exception e) { assertTrue(e instanceof IllegalArgumentException); } - result = apexModel.readFromURL("zooby/looby"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + result = apexModel.readFromUrl("zooby/looby"); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); - result = apexModel.writeToURL("zooby/looby", true); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + result = apexModel.writeToUrl("zooby/looby", true); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); - result = apexModel.readFromURL("zooby://zooby/looby"); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + result = apexModel.readFromUrl("zooby://zooby/looby"); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); - result = apexModel.writeToURL("zooby://zooby/looby", false); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + result = apexModel.writeToUrl("zooby://zooby/looby", false); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); apexModel = new ApexModelFactory().createApexModel(null, false); final File tempJsonModelFile = File.createTempFile("ApexModelTest", ".json"); result = apexModel.saveToFile(tempJsonModelFile.getCanonicalPath(), false); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); - final String tempFileURLString = tempJsonModelFile.toURI().toString(); - result = apexModel.readFromURL(tempFileURLString); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.SUCCESS)); + final String tempFileUrlString = tempJsonModelFile.toURI().toString(); + result = apexModel.readFromUrl(tempFileUrlString); + assertTrue(result.getResult().equals(ApexApiResult.Result.SUCCESS)); - result = apexModel.writeToURL(tempFileURLString, false); - assertTrue(result.getResult().equals(ApexAPIResult.RESULT.FAILED)); + result = apexModel.writeToUrl(tempFileUrlString, false); + assertTrue(result.getResult().equals(ApexApiResult.Result.FAILED)); assertTrue(result.getMessages().get(0).equals("protocol doesn't support output")); tempJsonModelFile.delete(); @@ -193,63 +194,63 @@ public class TestApexModelAPI { public void testApexModelMisc() throws IOException { final ApexModelImpl apexModelImpl = (ApexModelImpl) new ApexModelFactory().createApexModel(null, false); - ApexAPIResult result = null; + ApexApiResult result = null; result = apexModelImpl.getModelKey(); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModelImpl.listModel(); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModelImpl.createModel("ModelName", "0.0.1", null, null); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModelImpl.updateModel("ModelName", "0.0.1", UUID.randomUUID().toString(), "Model Description"); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); apexModelImpl.deleteModel(); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); final String modelString = TextFileUtils.getTextFileAsString("src/test/resources/models/PolicyModel.json"); result = apexModelImpl.loadFromString(modelString); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); final File tempFile = File.createTempFile("ApexModel", "json"); tempFile.deleteOnExit(); TextFileUtils.putStringAsFile(modelString, tempFile); apexModelImpl.deleteModel(); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModelImpl.loadFromFile(tempFile.getCanonicalPath()); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModelImpl.saveToFile(null, false); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModelImpl.analyse(); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModelImpl.validate(); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModelImpl.compare(tempFile.getCanonicalPath(), true, true); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModelImpl.compareWithString(modelString, true, true); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModelImpl.split("policy"); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModelImpl.split(tempFile.getCanonicalPath(), "policy"); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModelImpl.merge(tempFile.getCanonicalPath(), true); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModelImpl.mergeWithString(modelString, true); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); assertNotEquals(0, apexModelImpl.hashCode()); assertNotNull(apexModelImpl.clone()); diff --git a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/TestAPIResult.java b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/TestApiResult.java index e85357fbf..e2717e542 100644 --- a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/TestAPIResult.java +++ b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/TestApiResult.java @@ -29,34 +29,35 @@ import java.io.IOException; import java.util.Arrays; import org.junit.Test; -import org.onap.policy.apex.model.modelapi.ApexAPIResult.RESULT; +import org.onap.policy.apex.model.modelapi.ApexApiResult.Result; /** + * Test API results. * @author Liam Fallon (liam.fallon@ericsson.com) */ -public class TestAPIResult { +public class TestApiResult { @Test - public void testAPIResult() { - assertNotNull(new ApexAPIResult()); + public void testApiResult() { + assertNotNull(new ApexApiResult()); - for (final RESULT result : RESULT.values()) { - assertNotNull(new ApexAPIResult(result)); + for (final Result result : Result.values()) { + assertNotNull(new ApexApiResult(result)); } - assertNotNull(new ApexAPIResult(RESULT.SUCCESS, "Result Message")); - assertNotNull(new ApexAPIResult(RESULT.FAILED, new IOException("IO Exception message"))); - assertNotNull(new ApexAPIResult(RESULT.FAILED, "Result Message", new IOException("IO Exception message"))); + assertNotNull(new ApexApiResult(Result.SUCCESS, "Result Message")); + assertNotNull(new ApexApiResult(Result.FAILED, new IOException("IO Exception message"))); + assertNotNull(new ApexApiResult(Result.FAILED, "Result Message", new IOException("IO Exception message"))); - final ApexAPIResult result = - new ApexAPIResult(RESULT.FAILED, "Result Message", new IOException("IO Exception message")); + final ApexApiResult result = + new ApexApiResult(Result.FAILED, "Result Message", new IOException("IO Exception message")); - assertFalse(result.isOK()); - assertTrue(result.isNOK()); - assertEquals(RESULT.FAILED, result.getResult()); + assertFalse(result.isOk()); + assertTrue(result.isNok()); + assertEquals(Result.FAILED, result.getResult()); assertEquals("Result Message\nIO Exception message\njava.io.IOExce", result.getMessage().substring(0, 50)); - final ApexAPIResult result2 = new ApexAPIResult(RESULT.SUCCESS); + final ApexApiResult result2 = new ApexApiResult(Result.SUCCESS); result2.addMessage(null); assertEquals("", result2.getMessage()); result2.addMessage(""); @@ -64,8 +65,8 @@ public class TestAPIResult { result2.addMessage("funky message"); assertEquals("funky message\n", result2.getMessage()); - result2.setResult(RESULT.OTHER_ERROR); - assertEquals(RESULT.OTHER_ERROR, result2.getResult()); + result2.setResult(Result.OTHER_ERROR); + assertEquals(Result.OTHER_ERROR, result2.getResult()); final String[] messages = {"First Message", "Second Message", "Third Message"}; result2.setMessages(Arrays.asList(messages)); @@ -75,6 +76,6 @@ public class TestAPIResult { assertEquals("result: OTHER_ERROR\nFirst Message\nSecond Message\nThird Message\n", result2.toString()); assertEquals("{\n" + "\"result\": \"OTHER_ERROR\",\n" + "\"messages\": [\n" + "\"First Message\",\n" - + "\"Second Message\",\n" + "\"Third Message\"]\n" + "}\n", result2.toJSON()); + + "\"Second Message\",\n" + "\"Third Message\"]\n" + "}\n", result2.toJson()); } } diff --git a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/TestModelFacade.java b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/TestModelFacade.java index 7f946f5d3..2c937e175 100644 --- a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/TestModelFacade.java +++ b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/TestModelFacade.java @@ -53,58 +53,58 @@ public class TestModelFacade { final Properties modelProperties = new Properties(); final ModelFacade mf = new ModelFacade(apexModel, modelProperties, false); - ApexAPIResult result = mf.createModel(null, null, null, null); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + ApexApiResult result = mf.createModel(null, null, null, null); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = mf.createModel("ModelName", null, null, null); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = mf.createModel("ModelName", "0.0.1", null, null); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); modelProperties.setProperty("DEFAULT_CONCEPT_VERSION", ""); result = mf.createModel("ModelName", null, null, null); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); modelProperties.setProperty("DEFAULT_CONCEPT_VERSION", "£$£$£$"); result = mf.createModel("ModelName", null, null, null); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); modelProperties.setProperty("DEFAULT_CONCEPT_VERSION", "0.0.1"); result = mf.createModel("ModelName", null, null, null); - assertEquals(ApexAPIResult.RESULT.CONCEPT_EXISTS, result.getResult()); + assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult()); result = mf.deleteModel(); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = mf.createModel("ModelName", null, null, null); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = mf.updateModel("ModelName", null, UUID.randomUUID().toString(), "New Description"); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = mf.updateModel("ModelName", "0.0.1", UUID.randomUUID().toString(), "New Description"); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); modelProperties.remove("DEFAULT_CONCEPT_VERSION"); result = mf.updateModel("ModelName", null, UUID.randomUUID().toString(), "New Description"); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = mf.updateModel(null, null, UUID.randomUUID().toString(), "New Description"); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = mf.deleteModel(); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = mf.updateModel("name", "0.0.1", UUID.randomUUID().toString(), "New Description"); - assertEquals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, result.getResult()); + assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = mf.getModelKey(); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = mf.listModel(); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); assertEquals("AxPolicyModel:(AxPolicyModel:(key=AxArtifactKey:(n", result.getMessage().substring(0, 50)); result = mf.deleteModel(); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); assertNotNull(mf); } } diff --git a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/TestModelHandlerFacade.java b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/TestModelHandlerFacade.java index 7439cd328..22ecaf631 100644 --- a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/TestModelHandlerFacade.java +++ b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/TestModelHandlerFacade.java @@ -34,6 +34,7 @@ import org.onap.policy.apex.model.modelapi.impl.ModelHandlerFacade; import org.onap.policy.apex.model.utilities.TextFileUtils; /** + * Test the model handler facade. * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TestModelHandlerFacade { @@ -60,88 +61,88 @@ public class TestModelHandlerFacade { final ModelHandlerFacade mhf = new ModelHandlerFacade(apexModel, modelProperties, false); assertNotNull(mhf); - ApexAPIResult result = mhf.loadFromFile("src/test/resources/models/PolicyModel.json"); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + ApexApiResult result = mhf.loadFromFile("src/test/resources/models/PolicyModel.json"); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = mhf.loadFromFile("src/test/resources/models/PolicyModel.json"); - assertEquals(ApexAPIResult.RESULT.CONCEPT_EXISTS, result.getResult()); + assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult()); final String modelString = TextFileUtils.getTextFileAsString("src/test/resources/models/PolicyModel.json"); result = apexModel.deleteModel(); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = mhf.loadFromString(modelString); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = mhf.loadFromString(modelString); - assertEquals(ApexAPIResult.RESULT.CONCEPT_EXISTS, result.getResult()); + assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult()); final DaoParameters DaoParameters = new DaoParameters(); result = mhf.loadFromDatabase("SomeModel", null, DaoParameters); - assertEquals(ApexAPIResult.RESULT.CONCEPT_EXISTS, result.getResult()); + assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult()); result = apexModel.deleteModel(); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = mhf.loadFromDatabase("SomeModel", null, DaoParameters); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = mhf.saveToDatabase(DaoParameters); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); - result = mhf.readFromURL("blah://somewhere/over/the/rainbow"); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + result = mhf.readFromUrl("blah://somewhere/over/the/rainbow"); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = mhf.loadFromString(modelString); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - result = mhf.readFromURL("http://somewhere/over/the/rainbow"); - assertEquals(ApexAPIResult.RESULT.CONCEPT_EXISTS, result.getResult()); + result = mhf.readFromUrl("http://somewhere/over/the/rainbow"); + assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult()); final File tempFile = File.createTempFile("ApexModel", "json"); tempFile.deleteOnExit(); - result = mhf.writeToURL("File:///" + tempFile.getCanonicalPath(), false); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + result = mhf.writeToUrl("File:///" + tempFile.getCanonicalPath(), false); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = mhf.validate(); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.deleteModel(); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = mhf.validate(); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = mhf.compare("src/test/resources/models/NonExistant.json", true, true); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = mhf.compareWithString("zooby", true, true); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = mhf.split("FailSplit", "NonExistantPolicy"); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = mhf.split("NonExistantPolicy"); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = mhf.merge("src/test/resources/models/NonExistant.json", false); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.deleteModel(); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = mhf.merge("src/test/resources/models/PolicyModel.json", false); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = mhf.loadFromFile("src/test/resources/models/PolicyModel.json"); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = mhf.mergeWithString("@£@$@£", true); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.deleteModel(); - assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = mhf.mergeWithString(modelString, false); - assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + assertEquals(ApexApiResult.Result.FAILED, result.getResult()); } } diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxLogic.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxLogic.java index 2fc4467dc..99642d1ae 100644 --- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxLogic.java +++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxLogic.java @@ -47,18 +47,16 @@ import org.onap.policy.apex.model.basicmodel.xml.AxReferenceKeyAdapter; import org.onap.policy.apex.model.utilities.Assertions; /** - * This class holds Logic for executing a task or task selection on an Apex policy state. The - * flavour of the logic describes the type of logic being used and it may be a language identifier - * such as "Javascript" or "Jython". The logic itself is held as a string. The {@link AxLogic} - * instance is used by the Apex engine to start an executor with the required flavour. Once the - * executor is started, the Apex engine passes the logic to the executor and the executor executes - * it. In the Apex engine, executors are deployed as plugins. Apex also provides the executor with - * run-time context, which makes context such as input fields, output fields, and context albums - * available to the task at runtime. - * <p> - * Validation checks that the logic key is valid, that the logic flavour is defined and is valid - * when checked against the {@code LOGIC_FLAVOUR_REGEXP} regular expression, and that the specified - * logic string is not null or blank. + * This class holds Logic for executing a task or task selection on an Apex policy state. The flavour of the logic + * describes the type of logic being used and it may be a language identifier such as "Javascript" or "Jython". The + * logic itself is held as a string. The {@link AxLogic} instance is used by the Apex engine to start an executor with + * the required flavour. Once the executor is started, the Apex engine passes the logic to the executor and the executor + * executes it. In the Apex engine, executors are deployed as plugins. Apex also provides the executor with run-time + * context, which makes context such as input fields, output fields, and context albums available to the task at + * runtime. + * + * <p>Validation checks that the logic key is valid, that the logic flavour is defined and is valid when checked against + * the {@code LOGIC_FLAVOUR_REGEXP} regular expression, and that the specified logic string is not null or blank. */ @Entity @@ -67,8 +65,8 @@ import org.onap.policy.apex.model.utilities.Assertions; @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name = "apexLogic", namespace = "http://www.onap.org/policy/apex-pdp") -@XmlType(name = "AxLogic", namespace = "http://www.onap.org/policy/apex-pdp", - propOrder = {"key", "logicFlavour", "logic"}) +@XmlType(name = "AxLogic", namespace = "http://www.onap.org/policy/apex-pdp", propOrder = + { "key", "logicFlavour", "logic" }) public class AxLogic extends AxConcept { private static final long serialVersionUID = -4260562004005697328L; @@ -105,8 +103,8 @@ public class AxLogic extends AxConcept { private String logic; /** - * The Default Constructor creates a logic instance with a null key, undefined logic flavour and - * a null logic string. + * The Default Constructor creates a logic instance with a null key, undefined logic flavour and a null logic + * string. */ public AxLogic() { this(new AxReferenceKey()); @@ -114,7 +112,7 @@ public class AxLogic extends AxConcept { } /** - * Copy constructor + * Copy constructor. * * @param copyConcept the concept to copy from */ @@ -123,8 +121,8 @@ public class AxLogic extends AxConcept { } /** - * The Key Constructor creates a logic instance with the given reference key, undefined logic - * flavour and a null logic string. + * The Key Constructor creates a logic instance with the given reference key, undefined logic flavour and a null + * logic string. * * @param key the reference key of the logic */ @@ -133,8 +131,8 @@ public class AxLogic extends AxConcept { } /** - * This Constructor creates a logic instance with a reference key constructed from the parents - * key and the logic local name and all of its fields defined. + * This Constructor creates a logic instance with a reference key constructed from the parents key and the logic + * local name and all of its fields defined. * * @param parentKey the reference key of the parent of this logic * @param logicName the logic name, held as the local name of the reference key of this logic @@ -142,13 +140,12 @@ public class AxLogic extends AxConcept { * @param logic the actual logic as a string */ public AxLogic(final AxReferenceKey parentKey, final String logicName, final String logicFlavour, - final String logic) { + final String logic) { this(new AxReferenceKey(parentKey, logicName), logicFlavour, logic); } /** - * This Constructor creates a logic instance with the given reference key and all of its fields - * defined. + * This Constructor creates a logic instance with the given reference key and all of its fields defined. * * @param key the reference key of this logic * @param logicFlavour the flavour of this logic @@ -166,8 +163,8 @@ public class AxLogic extends AxConcept { } /** - * This Constructor creates a logic instance with the given reference key and logic flavour, the - * logic is provided by the given logic reader instance. + * This Constructor creates a logic instance with the given reference key and logic flavour, the logic is provided + * by the given logic reader instance. * * @param key the reference key of this logic * @param logicFlavour the flavour of this logic @@ -254,8 +251,7 @@ public class AxLogic extends AxConcept { /* * (non-Javadoc) * - * @see - * org.onap.policy.apex.model.basicmodel.concepts.AxConcept#validate(org.onap.policy.apex.model. + * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#validate(org.onap.policy.apex.model. * basicmodel.concepts.AxValidationResult) */ @Override @@ -263,28 +259,28 @@ public class AxLogic extends AxConcept { AxValidationResult result = resultIn; if (key.equals(AxReferenceKey.getNullKey())) { - result.addValidationMessage( - new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key is a null key")); + result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, + "key is a null key")); } result = key.validate(result); if (logicFlavour.replaceAll(WHITESPACE_REGEXP, "").length() == 0 - || logicFlavour.equals(LOGIC_FLAVOUR_UNDEFINED)) { + || logicFlavour.equals(LOGIC_FLAVOUR_UNDEFINED)) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "logic flavour is not defined")); + "logic flavour is not defined")); } try { Assertions.validateStringParameter(LOGIC_FLAVOUR_TOKEN, logicFlavour, LOGIC_FLAVOUR_REGEXP); } catch (final IllegalArgumentException e) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "logic flavour invalid-" + e.getMessage())); + "logic flavour invalid-" + e.getMessage())); } if (logic.replaceAll(WHITESPACE_REGEXP, "").length() == 0) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "no logic specified, logic may not be blank")); + "no logic specified, logic may not be blank")); } return result; @@ -327,8 +323,7 @@ public class AxLogic extends AxConcept { /* * (non-Javadoc) * - * @see - * org.onap.policy.apex.model.basicmodel.concepts.AxConcept#copyTo(org.onap.policy.apex.model. + * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#copyTo(org.onap.policy.apex.model. * basicmodel.concepts.AxConcept) */ @Override diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicies.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicies.java index 1937edac0..3be3e4a31 100644 --- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicies.java +++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicies.java @@ -51,22 +51,21 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.Validat import org.onap.policy.apex.model.utilities.Assertions; /** - * This class is a policy container and holds a map of the policies for an entire Apex model. All - * Apex models that use policies must have an {@link AxPolicies} field. The {@link AxPolicies} class - * implements the helper methods of the {@link AxConceptGetter} interface to allow {@link AxPolicy} - * instances to be retrieved by calling methods directly on this class without referencing the - * contained map. - * <p> - * Validation checks that the container key is not null. An error is issued if no policies are - * defined in the container. Each policy entry is checked to ensure that its key and value are not - * null and that the key matches the key in the map value. Each policy entry is then validated - * individually. + * This class is a policy container and holds a map of the policies for an entire Apex model. All Apex models that use + * policies must have an {@link AxPolicies} field. The {@link AxPolicies} class implements the helper methods of the + * {@link AxConceptGetter} interface to allow {@link AxPolicy} instances to be retrieved by calling methods directly on + * this class without referencing the contained map. + * + * <p>Validation checks that the container key is not null. An error is issued if no policies are defined in the + * container. Each policy entry is checked to ensure that its key and value are not null and that the key matches the + * key in the map value. Each policy entry is then validated individually. */ @Entity @Table(name = "AxPolicies") @XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "AxPolicies", namespace = "http://www.onap.org/policy/apex-pdp", propOrder = {"key", "policyMap"}) +@XmlType(name = "AxPolicies", namespace = "http://www.onap.org/policy/apex-pdp", propOrder = + { "key", "policyMap" }) public class AxPolicies extends AxConcept implements AxConceptGetter<AxPolicy> { private static final long serialVersionUID = 4290442590545820316L; @@ -87,16 +86,16 @@ public class AxPolicies extends AxConcept implements AxConceptGetter<AxPolicy> { // @formatter:on /** - * The Default Constructor creates a {@link AxPolicies} object with a null artifact key and - * creates an empty event map. + * The Default Constructor creates a {@link AxPolicies} object with a null artifact key and creates an empty event + * map. */ public AxPolicies() { this(new AxArtifactKey()); } /** - * The Key Constructor creates a {@link AxPolicies} object with the given artifact key and - * creates an empty event map. + * The Key Constructor creates a {@link AxPolicies} object with the given artifact key and creates an empty event + * map. * * @param key the key */ @@ -105,7 +104,7 @@ public class AxPolicies extends AxConcept implements AxConceptGetter<AxPolicy> { } /** - * Copy constructor + * Copy constructor. * * @param copyConcept the concept to copy from */ @@ -130,15 +129,14 @@ public class AxPolicies extends AxConcept implements AxConceptGetter<AxPolicy> { } /** - * When a model is unmarshalled from disk or from the database, the policy map is returned as a - * raw hash map. This method is called by JAXB after unmarshaling and is used to convert the - * hash map to a {@link NavigableMap} so that it will work with the {@link AxConceptGetter} - * interface. + * When a model is unmarshalled from disk or from the database, the policy map is returned as a raw hash map. This + * method is called by JAXB after unmarshaling and is used to convert the hash map to a {@link NavigableMap} so that + * it will work with the {@link AxConceptGetter} interface. * - * @param u the unmarshaler that is unmarshaling the model + * @param unmarshaler the unmarshaler that is unmarshaling the model * @param parent the parent object of this object in the unmarshaler */ - public void afterUnmarshal(final Unmarshaller u, final Object parent) { + public void afterUnmarshal(final Unmarshaller unmarshaler, final Object parent) { // The map must be navigable to allow name and version searching, unmarshaling returns a // hash map final NavigableMap<AxArtifactKey, AxPolicy> navigablePolicyMap = new TreeMap<>(); @@ -205,8 +203,7 @@ public class AxPolicies extends AxConcept implements AxConceptGetter<AxPolicy> { /* * (non-Javadoc) * - * @see - * org.onap.policy.apex.model.basicmodel.concepts.AxConcept#validate(org.onap.policy.apex.model. + * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#validate(org.onap.policy.apex.model. * basicmodel.concepts.AxValidationResult) */ @Override @@ -214,24 +211,24 @@ public class AxPolicies extends AxConcept implements AxConceptGetter<AxPolicy> { AxValidationResult result = resultIn; if (key.equals(AxArtifactKey.getNullKey())) { - result.addValidationMessage( - new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key is a null key")); + result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, + "key is a null key")); } result = key.validate(result); if (policyMap.size() == 0) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "policyMap may not be empty")); + "policyMap may not be empty")); } else { for (final Entry<AxArtifactKey, AxPolicy> policyEntry : policyMap.entrySet()) { final AxArtifactKey entryKey = policyEntry.getKey(); if (entryKey.equals(AxArtifactKey.getNullKey())) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "key on policy entry " + entryKey + " may not be the null key")); + "key on policy entry " + entryKey + " may not be the null key")); } else if (policyEntry.getValue() == null) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "value on policy entry " + entryKey + " may not be null")); + "value on policy entry " + entryKey + " may not be null")); } else { validate(result, policyEntry, entryKey); result = policyEntry.getValue().validate(result); @@ -243,11 +240,11 @@ public class AxPolicies extends AxConcept implements AxConceptGetter<AxPolicy> { } private void validate(final AxValidationResult result, final Entry<AxArtifactKey, AxPolicy> policyEntry, - final AxArtifactKey entryKey) { + final AxArtifactKey entryKey) { if (!entryKey.equals(policyEntry.getValue().getKey())) { - result.addValidationMessage( - new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key on policy entry key " - + entryKey + " does not equal policy value key " + policyEntry.getValue().getKey())); + result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, + "key on policy entry key " + entryKey + " does not equal policy value key " + + policyEntry.getValue().getKey())); } } @@ -286,8 +283,7 @@ public class AxPolicies extends AxConcept implements AxConceptGetter<AxPolicy> { /* * (non-Javadoc) * - * @see - * org.onap.policy.apex.model.basicmodel.concepts.AxConcept#copyTo(org.onap.policy.apex.model. + * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#copyTo(org.onap.policy.apex.model. * basicmodel.concepts.AxConcept) */ @Override @@ -379,8 +375,7 @@ public class AxPolicies extends AxConcept implements AxConceptGetter<AxPolicy> { /* * (non-Javadoc) * - * @see - * org.onap.policy.apex.model.basicmodel.concepts.AxConceptGetter#get(org.onap.policy.apex.model + * @see org.onap.policy.apex.model.basicmodel.concepts.AxConceptGetter#get(org.onap.policy.apex.model * .basicmodel.concepts.AxArtifactKey) */ @Override @@ -401,13 +396,12 @@ public class AxPolicies extends AxConcept implements AxConceptGetter<AxPolicy> { /* * (non-Javadoc) * - * @see org.onap.policy.apex.model.basicmodel.concepts.AxConceptGetter#get(java.lang.String, - * java.lang.String) + * @see org.onap.policy.apex.model.basicmodel.concepts.AxConceptGetter#get(java.lang.String, java.lang.String) */ @Override public AxPolicy get(final String conceptKeyName, final String conceptKeyVersion) { return new AxConceptGetterImpl<>((NavigableMap<AxArtifactKey, AxPolicy>) policyMap).get(conceptKeyName, - conceptKeyVersion); + conceptKeyVersion); } /* @@ -423,12 +417,11 @@ public class AxPolicies extends AxConcept implements AxConceptGetter<AxPolicy> { /* * (non-Javadoc) * - * @see org.onap.policy.apex.model.basicmodel.concepts.AxConceptGetter#getAll(java.lang.String, - * java.lang.String) + * @see org.onap.policy.apex.model.basicmodel.concepts.AxConceptGetter#getAll(java.lang.String, java.lang.String) */ @Override public Set<AxPolicy> getAll(final String conceptKeyName, final String conceptKeyVersion) { return new AxConceptGetterImpl<>((NavigableMap<AxArtifactKey, AxPolicy>) policyMap).getAll(conceptKeyName, - conceptKeyVersion); + conceptKeyVersion); } } diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicy.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicy.java index 8b87c41ce..a03b49f13 100644 --- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicy.java +++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicy.java @@ -51,39 +51,30 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.Validat import org.onap.policy.apex.model.utilities.Assertions; /** - * This class holds the definition of an Apex policy. A policy is made up of a tree of states, each - * represented by an {@link AxState} instance. The states of a policy are held in a map in the - * policy. The state tree is built up at policy design time by a policy editor and each state is - * connected to its next state by an {@link AxStateOutput} instance. - * <p> - * Execution of a policy is triggered by an event. A policy starts execution from its first state so - * the trigger event for the first sate is the trigger event for the entire policy. Execution from - * that first state can continue to one or more subsequent states and so on down branches of states. - * The state output of the final state in a branch has no next state, indicating the end of - * execution of that branch. Therefore, the set of output events from final states in the policy are - * the possible set of output events on the policy. A state may only be used once in the state tree - * of a policy and recursive execution of states in the same execution branch is not allowed, so the - * same state may not execute more than once on a single execution of a policy. - * <p> - * The template of a policy is a string that can be used by policy editors to store meta information - * on the policy that can be used at design time. The policy template string is not used during - * policy execution. - * <p> - * During validation of a policy, the validation checks listed below are executed: - * <ol> - * <li>The policy key must not be a null key - * <li>The policy key must be valid - * <li>If the policy template is not set, an observation is issued - * <li>At least one state must be defined - * <li>Keys and values must all be defined, that is not null - * <li>The key on each entry in the state map must match the key in the entry's value - * <li>The parent key of each state in the state map of a policy must be the key of that policy - * <li>Each state must itself be valid, see validation in {@link AxState} - * <li>The next state of the state output of each state must be defined as a state in the policy - * <li>The first state of a policy must be set - * <li>The first state of a policy must be defined in the policy - * <li>If a state is defined but is not used in a policy,a warning is issued - * <li>The state tree of the policy must be valid, see validation in {@link AxStateTree} + * This class holds the definition of an Apex policy. A policy is made up of a tree of states, each represented by an + * {@link AxState} instance. The states of a policy are held in a map in the policy. The state tree is built up at + * policy design time by a policy editor and each state is connected to its next state by an {@link AxStateOutput} + * instance. + * + * <p>Execution of a policy is triggered by an event. A policy starts execution from its first state so the trigger + * event for the first sate is the trigger event for the entire policy. Execution from that first state can continue to + * one or more subsequent states and so on down branches of states. The state output of the final state in a branch has + * no next state, indicating the end of execution of that branch. Therefore, the set of output events from final states + * in the policy are the possible set of output events on the policy. A state may only be used once in the state tree of + * a policy and recursive execution of states in the same execution branch is not allowed, so the same state may not + * execute more than once on a single execution of a policy. + * + * <p>The template of a policy is a string that can be used by policy editors to store meta information on the policy + * that can be used at design time. The policy template string is not used during policy execution. + * + * <p>During validation of a policy, the validation checks listed below are executed: <ol> <li>The policy key must not + * be a null key <li>The policy key must be valid <li>If the policy template is not set, an observation is issued <li>At + * least one state must be defined <li>Keys and values must all be defined, that is not null <li>The key on each entry + * in the state map must match the key in the entry's value <li>The parent key of each state in the state map of a + * policy must be the key of that policy <li>Each state must itself be valid, see validation in {@link AxState} <li>The + * next state of the state output of each state must be defined as a state in the policy <li>The first state of a policy + * must be set <li>The first state of a policy must be defined in the policy <li>If a state is defined but is not used + * in a policy,a warning is issued <li>The state tree of the policy must be valid, see validation in {@link AxStateTree} * </ol> */ @@ -91,8 +82,8 @@ import org.onap.policy.apex.model.utilities.Assertions; @Table(name = "AxPolicy") @XmlRootElement(name = "apexPolicy", namespace = "http://www.onap.org/policy/apex-pdp") @XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "AxPolicy", namespace = "http://www.onap.org/policy/apex-pdp", - propOrder = {"key", "template", "stateMap", "firstState"}) +@XmlType(name = "AxPolicy", namespace = "http://www.onap.org/policy/apex-pdp", propOrder = + { "key", "template", "stateMap", "firstState" }) public class AxPolicy extends AxConcept { private static final long serialVersionUID = -1775614096390365941L; @@ -118,15 +109,14 @@ public class AxPolicy extends AxConcept { private String firstState; /** - * The Default Constructor creates a policy instance with a null key, a blank template and - * undefined first state. + * The Default Constructor creates a policy instance with a null key, a blank template and undefined first state. */ public AxPolicy() { this(new AxArtifactKey()); } /** - * Copy constructor + * Copy constructor. * * @param copyConcept the concept to copy from */ @@ -135,8 +125,7 @@ public class AxPolicy extends AxConcept { } /** - * The Key Constructor creates a policy instance with the given key, a blank template and - * undefined first state. + * The Key Constructor creates a policy instance with the given key, a blank template and undefined first state. * * @param key the key of the policy */ @@ -153,7 +142,7 @@ public class AxPolicy extends AxConcept { * @param firstState the first state that will execute on this policy */ public AxPolicy(final AxArtifactKey key, final String template, final Map<String, AxState> stateMap, - final String firstState) { + final String firstState) { super(); Assertions.argumentNotNull(key, "key may not be null"); Assertions.argumentNotNull(template, "template may not be null"); @@ -167,12 +156,10 @@ public class AxPolicy extends AxConcept { } /** - * Gets a tree that holds all the possible execution paths for this policy. This method may be - * used for verification of policies, to find the branches of policy execution and the final - * states of policies. + * Gets a tree that holds all the possible execution paths for this policy. This method may be used for verification + * of policies, to find the branches of policy execution and the final states of policies. * - * @return the state tree of the policy, a tree representing the execution branches of the - * policy + * @return the state tree of the policy, a tree representing the execution branches of the policy */ public AxStateTree getStateTree() { return new AxStateTree(this, stateMap.get(firstState), null); @@ -272,8 +259,7 @@ public class AxPolicy extends AxConcept { /* * (non-Javadoc) * - * @see - * org.onap.policy.apex.model.basicmodel.concepts.AxConcept#validate(org.onap.policy.apex.model. + * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#validate(org.onap.policy.apex.model. * basicmodel.concepts.AxValidationResult) */ @Override @@ -281,20 +267,20 @@ public class AxPolicy extends AxConcept { AxValidationResult result = resultIn; if (key.equals(AxArtifactKey.getNullKey())) { - result.addValidationMessage( - new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key is a null key")); + result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, + "key is a null key")); } result = key.validate(result); if (template.trim().length() == 0) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.OBSERVATION, - "a policy template has not been specified")); + "a policy template has not been specified")); } if (stateMap.size() == 0) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "stateMap may not be empty")); + "stateMap may not be empty")); } else { for (final Entry<String, AxState> stateEntry : stateMap.entrySet()) { result = validateStateEntry(stateEntry, result); @@ -310,11 +296,11 @@ public class AxPolicy extends AxConcept { // We only check the unused states on models validated this far if (firstState.trim().length() == 0) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "no first state specified, first state may not be blank")); + "no first state specified, first state may not be blank")); } else { if (!stateMap.containsKey(firstState)) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "first state not found in stateMap")); + "first state not found in stateMap")); } else { validateStateTree(result); } @@ -324,7 +310,7 @@ public class AxPolicy extends AxConcept { } /** - * Validate a state entry + * Validate a state entry. * * @param stateEntry the state entry to validate * @param result The validation result to append to @@ -333,35 +319,37 @@ public class AxPolicy extends AxConcept { private AxValidationResult validateStateEntry(final Entry<String, AxState> stateEntry, AxValidationResult result) { if (stateEntry.getKey() == null || stateEntry.getKey().equals(AxKey.NULL_KEY_NAME)) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "key on state entry key " + stateEntry.getKey() + " may not be the null key")); + "key on state entry key " + stateEntry.getKey() + " may not be the null key")); return result; } if (stateEntry.getValue() == null) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "value on state entry value " + stateEntry.getKey() + " may not be null")); + "value on state entry value " + stateEntry.getKey() + " may not be null")); return result; } if (!stateEntry.getKey().equals(stateEntry.getValue().getKey().getLocalName())) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "key on state entry key " + stateEntry.getKey() + " does not equal state entry value local name " - + stateEntry.getValue().getKey().getLocalName())); + "key on state entry key " + stateEntry.getKey() + + " does not equal state entry value local name " + + stateEntry.getValue().getKey().getLocalName())); } if (!stateEntry.getValue().getKey().getParentArtifactKey().equals(key)) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "parent key on state entry key " + stateEntry.getValue().getKey() + " does not equal policy key")); + "parent key on state entry key " + stateEntry.getValue().getKey() + + " does not equal policy key")); } result = stateEntry.getValue().validate(result); for (final AxStateOutput stateOutput : stateEntry.getValue().getStateOutputs().values()) { if (!stateOutput.getNextState().equals(AxReferenceKey.getNullKey()) - && !stateMap.containsKey(stateOutput.getNextState().getLocalName())) { + && !stateMap.containsKey(stateOutput.getNextState().getLocalName())) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - " nextState of state " + stateEntry.getKey() + " not found in StateMap: " - + stateOutput.getNextState().getId())); + " nextState of state " + stateEntry.getKey() + " not found in StateMap: " + + stateOutput.getNextState().getId())); } } @@ -369,7 +357,7 @@ public class AxPolicy extends AxConcept { } /** - * Validate a state tree to ensure there are no circular references in it + * Validate a state tree to ensure there are no circular references in it. * * @param result The validation result to append to * @return The result of the validation @@ -386,11 +374,12 @@ public class AxPolicy extends AxConcept { for (final AxState unreferencedState : unreferencedStateSet) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.WARNING, - "state " + unreferencedState.getKey() + " is not referenced in the policy execution tree")); + "state " + unreferencedState.getKey() + + " is not referenced in the policy execution tree")); } } catch (PolicyRuntimeException pre) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.WARNING, - "state tree in policy is invalid")); + "state tree in policy is invalid")); } return result; @@ -432,8 +421,7 @@ public class AxPolicy extends AxConcept { /* * (non-Javadoc) * - * @see - * org.onap.policy.apex.model.basicmodel.concepts.AxConcept#copyTo(org.onap.policy.apex.model. + * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#copyTo(org.onap.policy.apex.model. * basicmodel.concepts.AxConcept) */ @Override diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicyModel.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicyModel.java index ad465a48e..8233a0517 100644 --- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicyModel.java +++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicyModel.java @@ -62,19 +62,19 @@ import org.onap.policy.apex.model.utilities.Assertions; * required to run policies in Apex. The model contains schema definitions, definitions of events * and context albums that use those schemas, definitions of tasks for policies and definitions of * the policies themselves. - * <p> - * An Apex policy model is an important artifact in Apex. At editing time, an Apex editor creates + * + * <p>An Apex policy model is an important artifact in Apex. At editing time, an Apex editor creates * and edits a policy model and a policy model is loaded into and is executed by an Apex engine. * Therefore, an Apex model and the set of policies that it holds is the way that the policy domain * that an Apex engine or a group of Apex engines executes across is expressed, both at design time * and run time. The Apex deployment system is responsible for deploying Apex models to and the * context they need the appropriate engines for execution. - * <p> - * Model registration is carried out by calling the {@code register()} method, which registers the + * + * <p>Model registration is carried out by calling the {@code register()} method, which registers the * policy model and all its constituent containers with the model service. The containers for * context schemas, events, context albums, tasks, policies, and key information are all registered. - * <p> - * Once a policy model is composed, the overall structure of the policy model and all its references + * + * <p>Once a policy model is composed, the overall structure of the policy model and all its references * can be validated. During validation of a policy model, the validation checks listed below are * executed: * <ol> @@ -155,7 +155,7 @@ public class AxPolicyModel extends AxModel { } /** - * Copy constructor + * Copy constructor. * * @param copyConcept the concept to copy from */ @@ -467,7 +467,7 @@ public class AxPolicyModel extends AxModel { } /** - * Validate that the references used on a state are valid + * Validate that the references used on a state are valid. * * @param state The state to check * @param result the validation result to append to @@ -518,7 +518,7 @@ public class AxPolicyModel extends AxModel { /** * Validate that the fields on tasks and events that trigger them and are output by them are - * compatible for all tasks used on a state + * compatible for all tasks used on a state. * * @param state The state to check * @param result the validation result to append to @@ -545,7 +545,7 @@ public class AxPolicyModel extends AxModel { /** * Validate that the fields on a task of a state output and the events that trigger it are - * compatible + * compatible. * * @param state The state to check * @param task The task to check diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxState.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxState.java index 6851e4859..fd1519620 100644 --- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxState.java +++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxState.java @@ -67,30 +67,30 @@ import org.onap.policy.apex.model.utilities.Assertions; * next state. The outputs of a state {@link AxStateOutput} are held as a map in the state. Each * state output contains the outgoing event of the state and optionally the next state to pass * control to. - * <p> - * A state uses tasks {@link AxTask} to execute its logic. A state holds its tasks in a map and must + * + * <p>A state uses tasks {@link AxTask} to execute its logic. A state holds its tasks in a map and must * have at least one task. A state uses Task Selection Logic {@link AxTaskSelectionLogic} to select * which task should be executed in a given execution cycle. Optional Task Selection Logic can use * fields on the incoming event and information from the context albums available on the state to * decide what task to execute in a given context. The default task of a state is the task that is * executed when task Selection Logic is not specified. In cases where only a single task is * specified on a state, the default task must be that task and the state always executes that task. - * <p> - * What happens when a state completes its execution cycle depends on the task that is selected for + * + * <p>What happens when a state completes its execution cycle depends on the task that is selected for * execution by the state. Therefore, the action to be performed a state on execution of each task * must be defined in the state as a {@link AxStateTaskReference} instance for each task defined in * the state. The {@link AxStateTaskReference} instance defines the action to be performed as either * a {@link AxStateTaskOutputType} of {@link AxStateTaskOutputType#DIRECT} or * {@link AxStateTaskOutputType#LOGIC} and contains an {@link AxReferenceKey} reference to the * instance that will complete the state output. - * <p> - * In the case of direct output, the {@link AxReferenceKey} reference in the + * + * <p>In the case of direct output, the {@link AxReferenceKey} reference in the * {@link AxStateTaskReference} instance is a reference to an {@link AxStateOutput} instance. The * state output defines the event to be emitted by the state and the next state to pass control to * if any. All fields of the executed task are marshaled onto the outgoing event automatically by * Apex. - * <p> - * In the case of logic output, the {@link AxReferenceKey} reference in the + * + * <p>In the case of logic output, the {@link AxReferenceKey} reference in the * {@link AxStateTaskReference} instance is a reference to State Finalizer Logic in an * {@link AxStateFinalizerLogic} instance, which selects the {@link AxStateOutput} that the state * will use. The state finalizer logic uses fields emitted by the executed task and information from @@ -100,13 +100,13 @@ import org.onap.policy.apex.model.utilities.Assertions; * the state. State Finalizer Logic must marshal the fields of the output event in whatever manner * it wishes; Apex does not automatically transfer the output fields from the task directly to the * output event. - * <p> - * The Task Selection Logic instance or State Finalizer Logic instances in a state may use + * + * <p>The Task Selection Logic instance or State Finalizer Logic instances in a state may use * information in context albums to arrive at their task or state output selections. The context * albums that the state uses and that should be made available to the state by Apex policy * distribution are held as a set of references to context albums in the state. - * <p> - * During validation of a state, the validation checks listed below are executed: + * + * <p>During validation of a state, the validation checks listed below are executed: * <ol> * <li>The policy key must not be a null key and must be valid, see validation in * {@link AxReferenceKey} @@ -247,7 +247,7 @@ public class AxState extends AxConcept { } /** - * Copy constructor + * Copy constructor. * * @param copyConcept the concept to copy from */ @@ -322,10 +322,10 @@ public class AxState extends AxConcept { * parent keys of all {@link AxTaskSelectionLogic}, {@link AxStateOutput}, and * {@link AxStateFinalizerLogic} instance in the state. * - * @param u the unmarshaler that is unmarshaling the model + * @param unmarshaler the unmarshaler that is unmarshaling the model * @param parent the parent object of this object in the unmarshaler */ - public void afterUnmarshal(final Unmarshaller u, final Object parent) { + public void afterUnmarshal(final Unmarshaller unmarshaler, final Object parent) { if (!taskSelectionLogic.getKey().getLocalName().equals(AxKey.NULL_KEY_NAME)) { taskSelectionLogic.getKey().setParentReferenceKey(key); } @@ -623,7 +623,7 @@ public class AxState extends AxConcept { } /** - * Validate the state outputs of the state + * Validate the state outputs of the state. * * @param result the validation result to append to */ @@ -659,7 +659,7 @@ public class AxState extends AxConcept { } /** - * Validate the context album references of the state + * Validate the context album references of the state. * * @param result the validation result to append to */ @@ -676,7 +676,7 @@ public class AxState extends AxConcept { } /** - * Validate the task selection logic of the state + * Validate the task selection logic of the state. * * @param result the validation result to append to * @return the result of the validation @@ -694,7 +694,7 @@ public class AxState extends AxConcept { } /** - * Validate all the state finalizer logic of the state + * Validate all the state finalizer logic of the state. * * @param result the validation result to append to */ @@ -717,7 +717,7 @@ public class AxState extends AxConcept { } /** - * Validate the tasks used the state + * Validate the tasks used the state. * * @param result the validation result to append to */ @@ -762,7 +762,7 @@ public class AxState extends AxConcept { } /** - * Validate the references of a task used in a state + * Validate the references of a task used in a state. * * @param taskKey The key of the task * @param taskReference the task reference of the task diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateFinalizerLogic.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateFinalizerLogic.java index 76704b051..d8ab0ce77 100644 --- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateFinalizerLogic.java +++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateFinalizerLogic.java @@ -34,14 +34,14 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey; /** * This class holds State Finalizer Logic for {@link AxState} states in Apex. It is a specialization * of the {@link AxLogic} class, so that State Finalizer Logic in Apex states can be strongly typed. - * <p> - * State Finalizer Logic is used to select the output {@link AxStateOutput} that a state will use. + * + * <p>State Finalizer Logic is used to select the output {@link AxStateOutput} that a state will use. * The logic uses fields emitted by the executed {@link AxTask} task and information from the * context albums available on a state to decide what state output {@link AxStateOutput} to select * in a given context. State Finalizer Logic must marshal the output fields from the task onto the * output event in whatever manner is appropriate for the domain being handled. - * <p> - * Validation uses standard Apex Logic validation, see validation in {@link AxLogic}. + * + * <p>Validation uses standard Apex Logic validation, see validation in {@link AxLogic}. */ @Entity @Table(name = "AxStateFinalizerLogic") diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateOutput.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateOutput.java index a0c73c260..6f6117027 100644 --- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateOutput.java +++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateOutput.java @@ -52,8 +52,8 @@ import org.onap.policy.apex.model.utilities.Assertions; * state output is selected. If no next state is defined (the next state is a null * {@link AxReferenceKey} key), then this state output outputs its event to an external system and * is an output state for the full policy. - * <p> - * During validation of a state output, the validation checks listed below are executed: + * + * <p>During validation of a state output, the validation checks listed below are executed: * <ol> * <li>The state output key must not be a null key and must be valid, see validation in * {@link AxReferenceKey} @@ -105,7 +105,7 @@ public class AxStateOutput extends AxConcept { } /** - * Copy constructor + * Copy constructor. * * @param copyConcept the concept to copy from */ diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateTaskReference.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateTaskReference.java index 8a43e371d..fdf73149f 100644 --- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateTaskReference.java +++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateTaskReference.java @@ -59,9 +59,8 @@ import org.onap.policy.apex.model.utilities.Assertions; * case of {@link AxStateTaskOutputType#LOGIC} output selection, the output reference key held in * this {@link AxStateTaskReference} instance to an instance of an {@link AxStateFinalizerLogic} * class. See the explanation in the {@link AxState} class for a full description of this handling. - * <p> - * - * During validation of a state task reference, the validation checks listed below are executed: + * + * <p>During validation of a state task reference, the validation checks listed below are executed: * <ol> * <li>The state task reference key must not be a null key and must be valid, see validation in * {@link AxReferenceKey} @@ -111,7 +110,7 @@ public class AxStateTaskReference extends AxConcept { } /** - * Copy constructor + * Copy constructor. * * @param copyConcept the concept to copy from */ diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateTree.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateTree.java index 478608ca4..0233aa6bf 100644 --- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateTree.java +++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateTree.java @@ -34,8 +34,8 @@ import org.onap.policy.apex.model.utilities.Assertions; * creates a tree that holds the state fan out branches in a policy that starts from the given top * state of the tree. Each branch from a state is held in a set of next states for the top state and * each branch in the state tree is itself a {@link AxStateTree} instance. - * <p> - * Validation checks for recursive state use, in other words validation forbids the use of a given + * + * <p>Validation checks for recursive state use, in other words validation forbids the use of a given * state more than once in a state tree. */ public class AxStateTree implements Comparable<AxStateTree> { diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTask.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTask.java index f26331671..cf8f34ce7 100644 --- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTask.java +++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTask.java @@ -60,16 +60,16 @@ import org.onap.policy.apex.model.utilities.Assertions; * This class holds the definition of a task in Apex. A task is executed by a state and performs * some domain specific logic to carry out work required to be done by a policy. The Task Logic that * is executed by a task is held in a {@link AxTaskLogic} instance. - * <p> - * A task has a set of input fields and output fields, which are passed to and are emitted from the + * + * <p>A task has a set of input fields and output fields, which are passed to and are emitted from the * task during a task execution cycle. A task may have task parameters {@link AxTaskParameter}, * which are configuration values passed to a task at initialization time. - * <p> - * The Task Logic in a task may use information in context albums to perform their domain specific + * + * <p>The Task Logic in a task may use information in context albums to perform their domain specific * work. The context albums that the task uses and that should be made available to the task by Apex * policy distribution are held as a set of references to context albums in the task. - * <p> - * During validation of a task, the validation checks listed below are executed: + * + * <p>During validation of a task, the validation checks listed below are executed: * <ol> * <li>The task key must not be a null key and must be valid, see validation in * {@link AxArtifactKey} @@ -137,7 +137,7 @@ public class AxTask extends AxConcept { } /** - * Copy constructor + * Copy constructor. * * @param copyConcept the concept to copy from */ @@ -197,10 +197,10 @@ public class AxTask extends AxConcept { * parent keys of all {@link AxInputField}, {@link AxOutputField}, and {@link AxTaskParameter} * instance in the task. * - * @param u the unmarshaler that is unmarshaling the model + * @param unmarshaler the unmarshaler that is unmarshaling the model * @param parent the parent object of this object in the unmarshaler */ - public void afterUnmarshal(final Unmarshaller u, final Object parent) { + public void afterUnmarshal(final Unmarshaller unmarshaler, final Object parent) { taskLogic.getKey().setParentArtifactKey(key); for (final AxInputField inputField : inputFields.values()) { @@ -490,7 +490,7 @@ public class AxTask extends AxConcept { } /** - * Validate a field + * Validate a field. * * @param key the key of the field to validate * @param field the field to validate @@ -516,7 +516,7 @@ public class AxTask extends AxConcept { } /** - * Validate a task parameter entry + * Validate a task parameter entry. * * @param taskParameterEntry the task parameter entry to validate * @param result The validation result to append to @@ -540,7 +540,7 @@ public class AxTask extends AxConcept { } /** - * Validate a context album reference entry + * Validate a context album reference entry. * * @param taskParameterEntry the context album reference entry to validate * @param result The validation result to append to diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTaskLogic.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTaskLogic.java index 00513e8f7..30f37ffe2 100644 --- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTaskLogic.java +++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTaskLogic.java @@ -35,12 +35,12 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey; /** * This class holds Task Logic for {@link AxTask} tasks in Apex. It is a specialization of the * {@link AxLogic} class, so that Task Logic in Apex states can be strongly typed. - * <p> - * Task Logic is used to execute tasks {@link AxTask} in Apex. The logic uses fields on the incoming + * + * <p>Task Logic is used to execute tasks {@link AxTask} in Apex. The logic uses fields on the incoming * trigger event and information from the context albums available on a task to get context during * execution. The task logic populates the output fields of the task. - * <p> - * Validation uses standard Apex Logic validation, see validation in {@link AxLogic}. + * + * <p>Validation uses standard Apex Logic validation, see validation in {@link AxLogic}. */ @Entity @Table(name = "AxTaskLogic") diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTaskParameter.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTaskParameter.java index 5ae3bfa42..236956020 100644 --- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTaskParameter.java +++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTaskParameter.java @@ -76,7 +76,7 @@ public class AxTaskParameter extends AxConcept { } /** - * Copy constructor + * Copy constructor. * * @param copyConcept the concept to copy from */ diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTaskSelectionLogic.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTaskSelectionLogic.java index 89c9418a4..32d8ef3b3 100644 --- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTaskSelectionLogic.java +++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTaskSelectionLogic.java @@ -34,12 +34,12 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey; /** * This class holds Task Selection Logic for {@link AxState} states in Apex. It is a specialization * of the {@link AxLogic} class, so that Task Selection Logic in Apex states can be strongly typed. - * <p> - * Task Selection Logic is used to select the task {@link AxTask} that a state will execute. The + * + * <p>Task Selection Logic is used to select the task {@link AxTask} that a state will execute. The * logic uses fields on the incoming trigger event and information from the context albums available * on a state to decide what task {@link AxTask} to select for execution in a given context. - * <p> - * Validation uses standard Apex Logic validation, see validation in {@link AxLogic}. + * + * <p>Validation uses standard Apex Logic validation, see validation in {@link AxLogic}. */ @Entity @Table(name = "AxTaskSelectionLogic") diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTasks.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTasks.java index 532d7d017..75fe632a6 100644 --- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTasks.java +++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTasks.java @@ -55,8 +55,8 @@ import org.onap.policy.apex.model.utilities.Assertions; * models that use tasks must have an {@link AxTasks} field. The {@link AxTasks} class implements * the helper methods of the {@link AxConceptGetter} interface to allow {@link AxTask} instances to * be retrieved by calling methods directly on this class without referencing the contained map. - * <p> - * Validation checks that the container key is not null. An error is issued if no tasks are defined + * + * <p>Validation checks that the container key is not null. An error is issued if no tasks are defined * in the container. Each task entry is checked to ensure that its key and value are not null and * that the key matches the key in the map value. Each task entry is then validated individually. */ @@ -92,7 +92,7 @@ public class AxTasks extends AxConcept implements AxConceptGetter<AxTask> { } /** - * Copy constructor + * Copy constructor. * * @param copyConcept the concept to copy from */ @@ -132,10 +132,10 @@ public class AxTasks extends AxConcept implements AxConceptGetter<AxTask> { * hash map to a {@link NavigableMap} so that it will work with the {@link AxConceptGetter} * interface. * - * @param u the unmarshaler that is unmarshaling the model + * @param unmarshaler the unmarshaler that is unmarshaling the model * @param parent the parent object of this object in the unmarshaler */ - public void afterUnmarshal(final Unmarshaller u, final Object parent) { + public void afterUnmarshal(final Unmarshaller unmarshaler, final Object parent) { // The map must be navigable to allow name and version searching, unmarshaling returns a // hash map final NavigableMap<AxArtifactKey, AxTask> navigableTaskMap = new TreeMap<>(); diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/PolicyException.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/PolicyException.java index 3b0d53f9c..271e0c2af 100644 --- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/PolicyException.java +++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/PolicyException.java @@ -43,9 +43,9 @@ public class PolicyException extends ApexException { * Instantiates a new apex policy exception with a message and a caused by exception. * * @param message the message - * @param e the exception that caused this exception to be thrown + * @param exception the exception that caused this exception to be thrown */ - public PolicyException(final String message, final Exception e) { - super(message, e); + public PolicyException(final String message, final Exception exception) { + super(message, exception); } } diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/PolicyRuntimeException.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/PolicyRuntimeException.java index dbd2fb64f..7ad293187 100644 --- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/PolicyRuntimeException.java +++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/PolicyRuntimeException.java @@ -43,9 +43,9 @@ public class PolicyRuntimeException extends ApexRuntimeException { * Instantiates a new apex policy runtime exception with a message and a caused by exception. * * @param message the message - * @param e the exception that caused this exception to be thrown + * @param exception the exception that caused this exception to be thrown */ - public PolicyRuntimeException(final String message, final Exception e) { - super(message, e); + public PolicyRuntimeException(final String message, final Exception exception) { + super(message, exception); } } diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyAnalyser.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyAnalyser.java index 99058484b..244346c99 100644 --- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyAnalyser.java +++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyAnalyser.java @@ -38,7 +38,8 @@ import org.onap.policy.apex.model.policymodel.concepts.AxTask; import org.onap.policy.apex.model.utilities.Assertions; /** - * This class analyses a policy model and shows what the usage of each context album, context item, data type, and event is. + * This class analyses a policy model and shows what the usage of each context album, context item, data type, and event + * is. * * @author Liam Fallon (liam.fallon@ericsson.com) */ diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyAnalysisResult.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyAnalysisResult.java index 2f5cd43d8..654ab2fc5 100644 --- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyAnalysisResult.java +++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyAnalysisResult.java @@ -32,7 +32,8 @@ import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum; import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; /** - * This class finds and holds the usage of context schemas, context albums, events, and tasks by the policies in a policy model. + * This class finds and holds the usage of context schemas, context albums, events, and tasks by the policies in a + * policy model. * * @author Liam Fallon (liam.fallon@ericsson.com) */ @@ -50,8 +51,8 @@ public class PolicyAnalysisResult { private final Map<AxArtifactKey, Set<AxKey>> taskUsage = new TreeMap<>(); /** - * This constructor creates a {@link PolicyAnalysisResult} instance that holds maps that contain the usage of context schemas, contxt albums, events, and - * tasks by all policies in a policy model. + * This constructor creates a {@link PolicyAnalysisResult} instance that holds maps that contain the usage of + * context schemas, contxt albums, events, and tasks by all policies in a policy model. * * @param policyModel the policy model to analyse */ @@ -60,7 +61,8 @@ public class PolicyAnalysisResult { contextSchemaUsage.put(contextSchemaKey, new TreeSet<AxKey>()); } - for (final Entry<AxArtifactKey, AxContextAlbum> contextAlbumEntry : policyModel.getAlbums().getAlbumsMap().entrySet()) { + for (final Entry<AxArtifactKey, AxContextAlbum> contextAlbumEntry : policyModel.getAlbums().getAlbumsMap() + .entrySet()) { contextAlbumUsage.put(contextAlbumEntry.getKey(), new TreeSet<AxKey>()); } diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyModelComparer.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyModelComparer.java index 545a02e89..723e8b235 100644 --- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyModelComparer.java +++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyModelComparer.java @@ -34,10 +34,9 @@ import org.onap.policy.apex.model.utilities.comparison.KeyedMapComparer; import org.onap.policy.apex.model.utilities.comparison.KeyedMapDifference; /** - * This class compares two policy models {@link AxPolicyModel} and holds the result of that - * comparison. It compares policy models on their keys, their context schema differences, their - * event differences, their context album differences, their task differences, their policy - * differences, and their key information differences. + * This class compares two policy models {@link AxPolicyModel} and holds the result of that comparison. It compares + * policy models on their keys, their context schema differences, their event differences, their context album + * differences, their task differences, their policy differences, and their key information differences. * * @author Liam Fallon (liam.fallon@ericsson.com) */ @@ -47,8 +46,7 @@ public class PolicyModelComparer { // Comparison of context schemas private final KeyDifference<AxArtifactKey> contextSchemasKeyDifference; - private KeyedMapDifference<AxArtifactKey, AxContextSchema> contextSchemaComparisonResult = - new KeyedMapDifference<>(); + private KeyedMapDifference<AxArtifactKey, AxContextSchema> contextSchemaCompareResult = new KeyedMapDifference<>(); // Comparison of events private final KeyDifference<AxArtifactKey> eventsKeyDifference; @@ -86,13 +84,14 @@ public class PolicyModelComparer { policiesKeyDifference = new KeyComparer<AxArtifactKey>().compareKeys(left.getKey(), right.getKey()); keyInformationKeyDifference = new KeyComparer<AxArtifactKey>().compareKeys(left.getKey(), right.getKey()); - contextSchemaComparisonResult = new KeyedMapComparer<AxArtifactKey, AxContextSchema>().compareMaps( + contextSchemaCompareResult = new KeyedMapComparer<AxArtifactKey, AxContextSchema>().compareMaps( left.getSchemas().getSchemasMap(), right.getSchemas().getSchemasMap()); eventComparisonResult = new KeyedMapComparer<AxArtifactKey, AxEvent>().compareMaps( left.getEvents().getEventMap(), right.getEvents().getEventMap()); contextAlbumComparisonResult = new KeyedMapComparer<AxArtifactKey, AxContextAlbum>().compareMaps( left.getAlbums().getAlbumsMap(), right.getAlbums().getAlbumsMap()); - taskComparisonResult = new KeyedMapComparer<AxArtifactKey, AxTask>().compareMaps(left.getTasks().getTaskMap(), right.getTasks().getTaskMap()); + taskComparisonResult = new KeyedMapComparer<AxArtifactKey, AxTask>() + .compareMaps(left.getTasks().getTaskMap(), right.getTasks().getTaskMap()); policyComparisonResult = new KeyedMapComparer<AxArtifactKey, AxPolicy>().compareMaps( left.getPolicies().getPolicyMap(), right.getPolicies().getPolicyMap()); keyInfoComparisonResult = new KeyedMapComparer<AxArtifactKey, AxKeyInfo>().compareMaps( @@ -124,7 +123,7 @@ public class PolicyModelComparer { * @return the difference between context schemas */ public KeyedMapDifference<AxArtifactKey, AxContextSchema> getContextSchemaComparisonResult() { - return contextSchemaComparisonResult; + return contextSchemaCompareResult; } /** @@ -242,7 +241,7 @@ public class PolicyModelComparer { builder.append("*** context schema differences ***\n"); builder.append(contextSchemasKeyDifference.asString(diffsOnly)); - builder.append(contextSchemaComparisonResult.asString(diffsOnly, keysOnly)); + builder.append(contextSchemaCompareResult.asString(diffsOnly, keysOnly)); builder.append("*** event differences ***\n"); builder.append(eventsKeyDifference.asString(diffsOnly)); diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestExceptions.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestExceptions.java index 9c7405b97..1fa3928b5 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestExceptions.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestExceptions.java @@ -30,6 +30,7 @@ import org.onap.policy.apex.model.policymodel.concepts.PolicyException; import org.onap.policy.apex.model.policymodel.concepts.PolicyRuntimeException; /** + * Test model exceptions. * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TestExceptions { diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestLogic.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestLogic.java index 3b1fc6b8f..710b360f9 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestLogic.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestLogic.java @@ -38,6 +38,8 @@ import org.onap.policy.apex.model.policymodel.concepts.AxTaskLogic; import org.onap.policy.apex.model.policymodel.concepts.AxTaskSelectionLogic; /** + * Test apex logic. + * * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TestLogic { @@ -117,9 +119,8 @@ public class TestLogic { logic.setLogicFlavour(""); fail("test shold throw an exception here"); } catch (final Exception e) { - assertEquals( - "parameter \"logicFlavour\": value \"\", does not match regular expression \"[A-Za-z0-9\\-_]+\"", - e.getMessage()); + assertEquals("parameter \"logicFlavour\": value \"\", " + + "does not match regular expression \"[A-Za-z0-9\\-_]+\"", e.getMessage()); } logic.setLogicFlavour(AxLogic.LOGIC_FLAVOUR_UNDEFINED); @@ -152,9 +153,9 @@ public class TestLogic { logic.clean(); final AxLogic clonedLogic = new AxLogic(logic); - assertEquals( - "AxLogic:(key=AxReferenceKey:(parentKeyName=LogicParentName,parentKeyVersion=0.0.1,parentLocalName=PLN,localName=LN),logicFlavour=LogicFlavour,logic=Logic)", - clonedLogic.toString()); + assertEquals("AxLogic:(key=AxReferenceKey:(parentKeyName=LogicParentName,parentKeyVersion=0.0.1," + + "parentLocalName=PLN,localName=LN),logicFlavour=LogicFlavour,logic=Logic)", + clonedLogic.toString()); assertFalse(logic.hashCode() == 0); diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestPolicies.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestPolicies.java index b2a3911bf..1e0e88c7b 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestPolicies.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestPolicies.java @@ -44,6 +44,8 @@ import org.onap.policy.apex.model.policymodel.concepts.AxStateTree; import org.onap.policy.apex.model.policymodel.handling.TestApexPolicyModelCreator; /** + * Test apex policies. + * * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TestPolicies { @@ -63,9 +65,9 @@ public class TestPolicies { final AxState firstState = new AxState(new AxReferenceKey(policy.getKey(), "FirstState")); final AxState badState = new AxState(new AxReferenceKey(policy.getKey(), "BadState")); - final AxStateOutput badSO = new AxStateOutput(badState.getKey(), AxArtifactKey.getNullKey(), - new AxReferenceKey(policyKey, "BadNextState")); - badState.getStateOutputs().put(badSO.getKey().getLocalName(), badSO); + final AxStateOutput badStateOutput = new AxStateOutput(badState.getKey(), AxArtifactKey.getNullKey(), + new AxReferenceKey(policyKey, "BadNextState")); + badState.getStateOutputs().put(badStateOutput.getKey().getLocalName(), badStateOutput); stateMap.put(firstState.getKey().getLocalName(), firstState); try { @@ -231,7 +233,7 @@ public class TestPolicies { final AxPolicy clonedPolicy = new AxPolicy(policy); assertEquals("AxPolicy:(key=AxArtifactKey:(name=policy,version=0.0.1),template=FREEFORM,sta", - clonedPolicy.toString().substring(0, 77)); + clonedPolicy.toString().substring(0, 77)); assertFalse(policy.hashCode() == 0); @@ -239,8 +241,8 @@ public class TestPolicies { assertTrue(policy.equals(clonedPolicy)); assertFalse(policy.equals(null)); assertFalse(policy.equals("Hello")); - assertFalse( - policy.equals(new AxPolicy(AxArtifactKey.getNullKey(), savedTemplate, savedStateMap, savedFirstState))); + assertFalse(policy.equals( + new AxPolicy(AxArtifactKey.getNullKey(), savedTemplate, savedStateMap, savedFirstState))); assertFalse(policy.equals(new AxPolicy(savedPolicyKey, "SomeTemplate", savedStateMap, savedFirstState))); assertFalse(policy.equals(new AxPolicy(savedPolicyKey, savedTemplate, stateMapEmpty, savedFirstState))); assertFalse(policy.equals(new AxPolicy(savedPolicyKey, savedTemplate, savedStateMap, "SomeFirstState"))); @@ -250,14 +252,14 @@ public class TestPolicies { assertEquals(0, policy.compareTo(clonedPolicy)); assertNotEquals(0, policy.compareTo(new AxArtifactKey())); assertNotEquals(0, policy.compareTo(null)); - assertNotEquals(0, policy - .compareTo(new AxPolicy(AxArtifactKey.getNullKey(), savedTemplate, savedStateMap, savedFirstState))); + assertNotEquals(0, policy.compareTo( + new AxPolicy(AxArtifactKey.getNullKey(), savedTemplate, savedStateMap, savedFirstState))); assertNotEquals(0, - policy.compareTo(new AxPolicy(savedPolicyKey, "SomeTemplate", savedStateMap, savedFirstState))); + policy.compareTo(new AxPolicy(savedPolicyKey, "SomeTemplate", savedStateMap, savedFirstState))); assertNotEquals(0, - policy.compareTo(new AxPolicy(savedPolicyKey, savedTemplate, stateMapEmpty, savedFirstState))); + policy.compareTo(new AxPolicy(savedPolicyKey, savedTemplate, stateMapEmpty, savedFirstState))); assertNotEquals(0, - policy.compareTo(new AxPolicy(savedPolicyKey, savedTemplate, savedStateMap, "SomeFirstState"))); + policy.compareTo(new AxPolicy(savedPolicyKey, savedTemplate, savedStateMap, "SomeFirstState"))); assertEquals(0, policy.compareTo(new AxPolicy(savedPolicyKey, savedTemplate, savedStateMap, savedFirstState))); assertNotNull(policy.getKeys()); @@ -315,7 +317,7 @@ public class TestPolicies { final AxPolicies clonedPolicies = new AxPolicies(policies); assertEquals("AxPolicies:(key=AxArtifactKey:(name=PoliciesKey,version=0.0.", - clonedPolicies.toString().substring(0, 60)); + clonedPolicies.toString().substring(0, 60)); assertFalse(policies.hashCode() == 0); @@ -359,18 +361,17 @@ public class TestPolicies { assertNotNull(stateTree.getNextStates()); policy.getStateMap().get("SecondState").getStateOutputs().get("stateOutput0") - .setNextState(policy.getStateMap().get("state").getKey()); + .setNextState(policy.getStateMap().get("state").getKey()); try { policy.getStateTree(); fail("test should throw an exception here"); } catch (final Exception e) { - assertEquals( - "loop detected in state tree for policy policy:0.0.1 state SecondState, next state state referenced more than once", - e.getMessage()); + assertEquals("loop detected in state tree for policy policy:0.0.1 state SecondState, " + + "next state state referenced more than once", e.getMessage()); } policy.getStateMap().get("SecondState").getStateOutputs().get("stateOutput0") - .setNextState(AxReferenceKey.getNullKey()); + .setNextState(AxReferenceKey.getNullKey()); final AxState thirdState = new AxState(policy.getStateMap().get("state")); thirdState.getKey().setLocalName("ThirdState"); @@ -378,12 +379,12 @@ public class TestPolicies { policy.getStateMap().put("ThirdState", thirdState); policy.getStateMap().get("SecondState").getStateOutputs().get("stateOutput0").setNextState(thirdState.getKey()); policy.getStateMap().get("ThirdState").getStateOutputs().get("stateOutput0") - .setNextState(AxReferenceKey.getNullKey()); + .setNextState(AxReferenceKey.getNullKey()); stateTree = policy.getStateTree(); - final AxStateOutput ssS0Clone = - new AxStateOutput(policy.getStateMap().get("SecondState").getStateOutputs().get("stateOutput0")); + final AxStateOutput ssS0Clone = new AxStateOutput( + policy.getStateMap().get("SecondState").getStateOutputs().get("stateOutput0")); ssS0Clone.getKey().setLocalName("ssS0Clone"); policy.getStateMap().get("SecondState").getStateOutputs().put("ssS0Clone", ssS0Clone); @@ -391,9 +392,8 @@ public class TestPolicies { policy.getStateTree(); fail("test should throw an exception here"); } catch (final Exception e) { - assertEquals( - "loop detected in state tree for policy policy:0.0.1 state SecondState, next state ThirdState referenced more than once", - e.getMessage()); + assertEquals("loop detected in state tree for policy policy:0.0.1 state SecondState, " + + "next state ThirdState referenced more than once", e.getMessage()); } policy.getStateMap().get("SecondState").getStateOutputs().remove("ssS0Clone"); @@ -411,9 +411,8 @@ public class TestPolicies { policy.getStateTree(); fail("test should throw an exception here"); } catch (final Exception e) { - assertEquals( - "loop detected in state tree for policy policy:0.0.1 state ThirdState, next state SecondState referenced more than once", - e.getMessage()); + assertEquals("loop detected in state tree for policy policy:0.0.1 state ThirdState, " + + "next state SecondState referenced more than once", e.getMessage()); } thirdState.getStateOutputs().get("stateOutput0").setNextState(AxReferenceKey.getNullKey()); diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestPolicyModel.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestPolicyModel.java index 5df831cc7..b2803c4f8 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestPolicyModel.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestPolicyModel.java @@ -49,6 +49,8 @@ import org.onap.policy.apex.model.policymodel.concepts.AxTasks; import org.onap.policy.apex.model.policymodel.handling.TestApexPolicyModelCreator; /** + * Test policy models. + * * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TestPolicyModel { @@ -58,7 +60,7 @@ public class TestPolicyModel { assertNotNull(new AxPolicyModel()); assertNotNull(new AxPolicyModel(new AxArtifactKey())); assertNotNull(new AxPolicyModel(new AxArtifactKey(), new AxContextSchemas(), new AxKeyInformation(), - new AxEvents(), new AxContextAlbums(), new AxTasks(), new AxPolicies())); + new AxEvents(), new AxContextAlbums(), new AxTasks(), new AxPolicies())); final AxArtifactKey modelKey = new AxArtifactKey("ModelKey", "0.0.1"); final AxArtifactKey schemasKey = new AxArtifactKey("SchemasKey", "0.0.1"); @@ -69,8 +71,8 @@ public class TestPolicyModel { final AxArtifactKey policiesKey = new AxArtifactKey("PoliciesKey", "0.0.1"); AxPolicyModel model = new AxPolicyModel(modelKey, new AxContextSchemas(schemasKey), - new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey), new AxContextAlbums(albumsKey), - new AxTasks(tasksKey), new AxPolicies(policiesKey)); + new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey), new AxContextAlbums(albumsKey), + new AxTasks(tasksKey), new AxPolicies(policiesKey)); model.register(); @@ -90,63 +92,59 @@ public class TestPolicyModel { assertFalse(model.equals("Hello")); assertFalse(model.equals(new AxPolicyModel(new AxArtifactKey()))); assertFalse(model.equals(new AxPolicyModel(AxArtifactKey.getNullKey(), new AxContextSchemas(schemasKey), - new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey), new AxContextAlbums(albumsKey), - new AxTasks(tasksKey), new AxPolicies(policiesKey)))); + new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey), new AxContextAlbums(albumsKey), + new AxTasks(tasksKey), new AxPolicies(policiesKey)))); assertFalse(model.equals(new AxPolicyModel(modelKey, new AxContextSchemas(), new AxKeyInformation(keyInfoKey), - new AxEvents(eventsKey), new AxContextAlbums(albumsKey), new AxTasks(tasksKey), - new AxPolicies(policiesKey)))); + new AxEvents(eventsKey), new AxContextAlbums(albumsKey), new AxTasks(tasksKey), + new AxPolicies(policiesKey)))); assertFalse(model.equals(new AxPolicyModel(modelKey, new AxContextSchemas(schemasKey), new AxKeyInformation(), - new AxEvents(eventsKey), new AxContextAlbums(albumsKey), new AxTasks(tasksKey), - new AxPolicies(policiesKey)))); + new AxEvents(eventsKey), new AxContextAlbums(albumsKey), new AxTasks(tasksKey), + new AxPolicies(policiesKey)))); assertFalse(model.equals(new AxPolicyModel(modelKey, new AxContextSchemas(schemasKey), - new AxKeyInformation(keyInfoKey), new AxEvents(), new AxContextAlbums(albumsKey), new AxTasks(tasksKey), - new AxPolicies(policiesKey)))); + new AxKeyInformation(keyInfoKey), new AxEvents(), new AxContextAlbums(albumsKey), + new AxTasks(tasksKey), new AxPolicies(policiesKey)))); assertFalse(model.equals(new AxPolicyModel(modelKey, new AxContextSchemas(schemasKey), - new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey), new AxContextAlbums(), new AxTasks(tasksKey), - new AxPolicies(policiesKey)))); + new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey), new AxContextAlbums(), + new AxTasks(tasksKey), new AxPolicies(policiesKey)))); assertFalse(model.equals(new AxPolicyModel(modelKey, new AxContextSchemas(schemasKey), - new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey), new AxContextAlbums(albumsKey), - new AxTasks(), new AxPolicies(policiesKey)))); + new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey), new AxContextAlbums(albumsKey), + new AxTasks(), new AxPolicies(policiesKey)))); assertFalse(model.equals(new AxPolicyModel(modelKey, new AxContextSchemas(schemasKey), - new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey), new AxContextAlbums(albumsKey), - new AxTasks(tasksKey), new AxPolicies()))); + new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey), new AxContextAlbums(albumsKey), + new AxTasks(tasksKey), new AxPolicies()))); assertTrue(model.equals(new AxPolicyModel(modelKey, new AxContextSchemas(schemasKey), - new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey), new AxContextAlbums(albumsKey), - new AxTasks(tasksKey), new AxPolicies(policiesKey)))); + new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey), new AxContextAlbums(albumsKey), + new AxTasks(tasksKey), new AxPolicies(policiesKey)))); assertEquals(0, model.compareTo(model)); assertEquals(0, model.compareTo(clonedModel)); assertNotEquals(0, model.compareTo(new AxArtifactKey())); - assertNotEquals(0, - model.compareTo(new AxPolicyModel(AxArtifactKey.getNullKey(), new AxContextSchemas(schemasKey), + assertNotEquals(0, model.compareTo(new AxPolicyModel(AxArtifactKey.getNullKey(), + new AxContextSchemas(schemasKey), new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey), + new AxContextAlbums(albumsKey), new AxTasks(tasksKey), new AxPolicies(policiesKey)))); + assertNotEquals(0, model.compareTo(new AxPolicyModel(modelKey, new AxContextSchemas(), new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey), new AxContextAlbums(albumsKey), new AxTasks(tasksKey), new AxPolicies(policiesKey)))); assertNotEquals(0, - model.compareTo(new AxPolicyModel(modelKey, new AxContextSchemas(), new AxKeyInformation(keyInfoKey), - new AxEvents(eventsKey), new AxContextAlbums(albumsKey), new AxTasks(tasksKey), - new AxPolicies(policiesKey)))); - assertNotEquals(0, - model.compareTo(new AxPolicyModel(modelKey, new AxContextSchemas(schemasKey), new AxKeyInformation(), - new AxEvents(eventsKey), new AxContextAlbums(albumsKey), new AxTasks(tasksKey), - new AxPolicies(policiesKey)))); - assertNotEquals(0, - model.compareTo(new AxPolicyModel(modelKey, new AxContextSchemas(schemasKey), + model.compareTo(new AxPolicyModel(modelKey, new AxContextSchemas(schemasKey), + new AxKeyInformation(), new AxEvents(eventsKey), new AxContextAlbums(albumsKey), + new AxTasks(tasksKey), new AxPolicies(policiesKey)))); + assertNotEquals(0, model.compareTo(new AxPolicyModel(modelKey, new AxContextSchemas(schemasKey), new AxKeyInformation(keyInfoKey), new AxEvents(), new AxContextAlbums(albumsKey), new AxTasks(tasksKey), new AxPolicies(policiesKey)))); assertNotEquals(0, - model.compareTo(new AxPolicyModel(modelKey, new AxContextSchemas(schemasKey), - new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey), new AxContextAlbums(), - new AxTasks(tasksKey), new AxPolicies(policiesKey)))); + model.compareTo(new AxPolicyModel(modelKey, new AxContextSchemas(schemasKey), + new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey), + new AxContextAlbums(), new AxTasks(tasksKey), new AxPolicies(policiesKey)))); assertNotEquals(0, - model.compareTo(new AxPolicyModel(modelKey, new AxContextSchemas(schemasKey), - new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey), new AxContextAlbums(albumsKey), - new AxTasks(), new AxPolicies(policiesKey)))); + model.compareTo(new AxPolicyModel(modelKey, new AxContextSchemas(schemasKey), + new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey), + new AxContextAlbums(albumsKey), new AxTasks(), new AxPolicies(policiesKey)))); assertNotEquals(0, - model.compareTo(new AxPolicyModel(modelKey, new AxContextSchemas(schemasKey), - new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey), new AxContextAlbums(albumsKey), - new AxTasks(tasksKey), new AxPolicies()))); - assertEquals(0, - model.compareTo(new AxPolicyModel(modelKey, new AxContextSchemas(schemasKey), + model.compareTo(new AxPolicyModel(modelKey, new AxContextSchemas(schemasKey), + new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey), + new AxContextAlbums(albumsKey), new AxTasks(tasksKey), new AxPolicies()))); + assertEquals(0, model.compareTo(new AxPolicyModel(modelKey, new AxContextSchemas(schemasKey), new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey), new AxContextAlbums(albumsKey), new AxTasks(tasksKey), new AxPolicies(policiesKey)))); @@ -168,7 +166,7 @@ public class TestPolicyModel { assertEquals(ValidationResult.VALID, result.getValidationResult()); final AxField badField = new AxField(new AxReferenceKey(model.getEvents().get("inEvent").getKey(), "BadField"), - new AxArtifactKey("NonExistantSchema", "0.0.1")); + new AxArtifactKey("NonExistantSchema", "0.0.1")); model.getEvents().get("inEvent").getParameterMap().put(badField.getKey().getLocalName(), badField); result = new AxValidationResult(); result = model.validate(result); @@ -180,7 +178,7 @@ public class TestPolicyModel { assertEquals(ValidationResult.VALID, result.getValidationResult()); final AxContextAlbum badAlbum = new AxContextAlbum(new AxArtifactKey("BadAlbum", "0.0.1"), "SomeScope", true, - new AxArtifactKey("NonExistantSchema", "0.0.1")); + new AxArtifactKey("NonExistantSchema", "0.0.1")); model.getAlbums().getAlbumsMap().put(badAlbum.getKey(), badAlbum); result = new AxValidationResult(); result = model.validate(result); @@ -191,8 +189,8 @@ public class TestPolicyModel { result = model.validate(result); assertEquals(ValidationResult.VALID, result.getValidationResult()); - final AxInputField badInField = - new AxInputField(new AxReferenceKey(model.getTasks().get("task").getKey(), "BadInField"), + final AxInputField badInField = new AxInputField( + new AxReferenceKey(model.getTasks().get("task").getKey(), "BadInField"), new AxArtifactKey("NonExistantSchema", "0.0.1")); model.getTasks().get("task").getInputFields().put(badInField.getKey().getLocalName(), badInField); result = new AxValidationResult(); @@ -204,8 +202,8 @@ public class TestPolicyModel { result = model.validate(result); assertEquals(ValidationResult.VALID, result.getValidationResult()); - final AxOutputField badOutField = - new AxOutputField(new AxReferenceKey(model.getTasks().get("task").getKey(), "BadOutField"), + final AxOutputField badOutField = new AxOutputField( + new AxReferenceKey(model.getTasks().get("task").getKey(), "BadOutField"), new AxArtifactKey("NonExistantSchema", "0.0.1")); model.getTasks().get("task").getOutputFields().put(badOutField.getKey().getLocalName(), badOutField); result = new AxValidationResult(); @@ -218,32 +216,32 @@ public class TestPolicyModel { assertEquals(ValidationResult.VALID, result.getValidationResult()); model.getTasks().get("task").getContextAlbumReferences() - .add(new AxArtifactKey("NonExistantContextAlbum", "0.0.1")); + .add(new AxArtifactKey("NonExistantContextAlbum", "0.0.1")); result = new AxValidationResult(); result = model.validate(result); assertEquals(ValidationResult.INVALID, result.getValidationResult()); model.getTasks().get("task").getContextAlbumReferences() - .remove(new AxArtifactKey("NonExistantContextAlbum", "0.0.1")); + .remove(new AxArtifactKey("NonExistantContextAlbum", "0.0.1")); result = new AxValidationResult(); result = model.validate(result); assertEquals(ValidationResult.VALID, result.getValidationResult()); model.getPolicies().get("policy").getStateMap().get("state").getContextAlbumReferences() - .add(new AxArtifactKey("NonExistantContextAlbum", "0.0.1")); + .add(new AxArtifactKey("NonExistantContextAlbum", "0.0.1")); result = new AxValidationResult(); result = model.validate(result); assertEquals(ValidationResult.INVALID, result.getValidationResult()); model.getPolicies().get("policy").getStateMap().get("state").getContextAlbumReferences() - .remove(new AxArtifactKey("NonExistantContextAlbum", "0.0.1")); + .remove(new AxArtifactKey("NonExistantContextAlbum", "0.0.1")); result = new AxValidationResult(); result = model.validate(result); assertEquals(ValidationResult.VALID, result.getValidationResult()); final AxArtifactKey savedTrigger = model.getPolicies().get("policy").getStateMap().get("state").getTrigger(); model.getPolicies().get("policy").getStateMap().get("state") - .setTrigger(new AxArtifactKey("NonExistantEvent", "0.0.1")); + .setTrigger(new AxArtifactKey("NonExistantEvent", "0.0.1")); result = new AxValidationResult(); result = model.validate(result); assertEquals(ValidationResult.INVALID, result.getValidationResult()); @@ -253,10 +251,10 @@ public class TestPolicyModel { result = model.validate(result); assertEquals(ValidationResult.VALID, result.getValidationResult()); - final AxArtifactKey savedDefaultTask = - model.getPolicies().get("policy").getStateMap().get("state").getDefaultTask(); + final AxArtifactKey savedDefaultTask = model.getPolicies().get("policy").getStateMap().get("state") + .getDefaultTask(); model.getPolicies().get("policy").getStateMap().get("state") - .setDefaultTask(new AxArtifactKey("NonExistantTask", "0.0.1")); + .setDefaultTask(new AxArtifactKey("NonExistantTask", "0.0.1")); result = new AxValidationResult(); result = model.validate(result); assertEquals(ValidationResult.INVALID, result.getValidationResult()); @@ -267,10 +265,10 @@ public class TestPolicyModel { assertEquals(ValidationResult.VALID, result.getValidationResult()); // It is OK not to have TSL - final AxTaskSelectionLogic savedTSL = - model.getPolicies().get("policy").getStateMap().get("state").getTaskSelectionLogic(); + final AxTaskSelectionLogic savedTaskSelectionLogic = model.getPolicies().get("policy").getStateMap() + .get("state").getTaskSelectionLogic(); model.getPolicies().get("policy").getStateMap().get("state") - .setTaskSelectionLogic(new AxTaskSelectionLogic(AxReferenceKey.getNullKey())); + .setTaskSelectionLogic(new AxTaskSelectionLogic(AxReferenceKey.getNullKey())); result = new AxValidationResult(); result = model.validate(result); assertEquals(ValidationResult.VALID, result.getValidationResult()); @@ -285,71 +283,72 @@ public class TestPolicyModel { result = model.validate(result); assertEquals(ValidationResult.VALID, result.getValidationResult()); - model.getPolicies().get("policy").getStateMap().get("state").setTaskSelectionLogic(savedTSL); + model.getPolicies().get("policy").getStateMap().get("state").setTaskSelectionLogic(savedTaskSelectionLogic); result = new AxValidationResult(); result = model.validate(result); assertEquals(ValidationResult.VALID, result.getValidationResult()); final AxStateOutput badStateOutput = new AxStateOutput( - new AxReferenceKey(model.getPolicies().get("policy").getStateMap().get("state").getKey(), "BadSO"), - new AxArtifactKey("NonExistantEvent", "0.0.1"), AxReferenceKey.getNullKey()); + new AxReferenceKey(model.getPolicies().get("policy").getStateMap().get("state").getKey(), + "BadSO"), + new AxArtifactKey("NonExistantEvent", "0.0.1"), AxReferenceKey.getNullKey()); model.getPolicies().get("policy").getStateMap().get("state").getStateOutputs() - .put(badStateOutput.getKey().getLocalName(), badStateOutput); + .put(badStateOutput.getKey().getLocalName(), badStateOutput); result = new AxValidationResult(); result = model.validate(result); assertEquals(ValidationResult.INVALID, result.getValidationResult()); model.getPolicies().get("policy").getStateMap().get("state").getStateOutputs() - .remove(badStateOutput.getKey().getLocalName()); + .remove(badStateOutput.getKey().getLocalName()); result = new AxValidationResult(); result = model.validate(result); assertEquals(ValidationResult.VALID, result.getValidationResult()); - final AxStateTaskReference badTR = new AxStateTaskReference( - new AxReferenceKey(model.getPolicies().get("policy").getStateMap().get("state").getKey(), - "NonExistantTask"), - AxStateTaskOutputType.LOGIC, badStateOutput.getKey()); + final AxStateTaskReference badTaskReference = new AxStateTaskReference( + new AxReferenceKey(model.getPolicies().get("policy").getStateMap().get("state").getKey(), + "NonExistantTask"), + AxStateTaskOutputType.LOGIC, badStateOutput.getKey()); model.getPolicies().get("policy").getStateMap().get("state").getTaskReferences() - .put(new AxArtifactKey("NonExistantTask", "0.0.1"), badTR); + .put(new AxArtifactKey("NonExistantTask", "0.0.1"), badTaskReference); result = new AxValidationResult(); result = model.validate(result); assertEquals(ValidationResult.INVALID, result.getValidationResult()); - badTR.setStateTaskOutputType(AxStateTaskOutputType.DIRECT); + badTaskReference.setStateTaskOutputType(AxStateTaskOutputType.DIRECT); result = new AxValidationResult(); result = model.validate(result); assertEquals(ValidationResult.INVALID, result.getValidationResult()); model.getPolicies().get("policy").getStateMap().get("state").getTaskReferences() - .remove(new AxArtifactKey("NonExistantTask", "0.0.1")); + .remove(new AxArtifactKey("NonExistantTask", "0.0.1")); result = new AxValidationResult(); result = model.validate(result); assertEquals(ValidationResult.VALID, result.getValidationResult()); final AxStateTaskReference tr = model.getPolicies().get("policy").getStateMap().get("state").getTaskReferences() - .get(new AxArtifactKey("task", "0.0.1")); + .get(new AxArtifactKey("task", "0.0.1")); - final String savedSOName = tr.getOutput().getLocalName(); + final String savedStateOutputName = tr.getOutput().getLocalName(); tr.getOutput().setLocalName("NonExistantOutput"); result = new AxValidationResult(); result = model.validate(result); assertEquals(ValidationResult.INVALID, result.getValidationResult()); - tr.getOutput().setLocalName(savedSOName); + tr.getOutput().setLocalName(savedStateOutputName); result = new AxValidationResult(); result = model.validate(result); assertEquals(ValidationResult.VALID, result.getValidationResult()); - final AxStateOutput so = - model.getPolicies().get("policy").getStateMap().get("state").getStateOutputs().get(savedSOName); + final AxStateOutput so = model.getPolicies().get("policy").getStateMap().get("state").getStateOutputs() + .get(savedStateOutputName); - final AxArtifactKey savedOE = so.getOutgingEvent(); + final AxArtifactKey savedOutEvent = so.getOutgingEvent(); so.setOutgoingEvent(new AxArtifactKey("NonExistantEvent", "0.0.1")); result = new AxValidationResult(); result = model.validate(result); assertEquals(ValidationResult.INVALID, result.getValidationResult()); - so.setOutgoingEvent(savedOE); + so.setOutgoingEvent(savedOutEvent); result = new AxValidationResult(); result = model.validate(result); assertEquals(ValidationResult.VALID, result.getValidationResult()); diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestState.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestState.java index c53fff1ca..56d0a6a82 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestState.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestState.java @@ -45,6 +45,8 @@ import org.onap.policy.apex.model.policymodel.concepts.AxStateTaskReference; import org.onap.policy.apex.model.policymodel.concepts.AxTaskSelectionLogic; /** + * Test policy states. + * * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TestState { @@ -64,7 +66,7 @@ public class TestState { assertNotNull(new AxState()); assertNotNull(new AxState(new AxReferenceKey())); assertNotNull(new AxState(new AxReferenceKey(), new AxArtifactKey(), soEmptyMap, ctxtEmptySet, - new AxTaskSelectionLogic(), sflEmptyMap, new AxArtifactKey(), trEmptyMap)); + new AxTaskSelectionLogic(), sflEmptyMap, new AxArtifactKey(), trEmptyMap)); final AxState state = new AxState(); @@ -89,25 +91,28 @@ public class TestState { assertEquals("PolicyName:0.0.1:NULL:StateName", state.getKey().getId()); assertEquals("PolicyName:0.0.1:NULL:StateName", state.getKeys().get(0).getId()); - final AxStateOutput so0 = new AxStateOutput(new AxReferenceKey(stateKey, "SO0"), triggerKey, new AxReferenceKey()); + final AxStateOutput so0 = new AxStateOutput(new AxReferenceKey(stateKey, "SO0"), triggerKey, + new AxReferenceKey()); final AxStateOutput soU = new AxStateOutput(new AxReferenceKey(stateKey, "SOU"), triggerKey, stateKeyNext); final AxStateOutput soSame = new AxStateOutput(new AxReferenceKey(stateKey, "SOU"), triggerKey, stateKey); final AxArtifactKey cr0 = new AxArtifactKey("ContextReference", "0.0.1"); final AxStateFinalizerLogic sfl = new AxStateFinalizerLogic(stateKey, "SFLogicName", "LogicFlavour", "Logic"); - final AxStateFinalizerLogic sflU = new AxStateFinalizerLogic(stateKey, "UnusedSFLogicName", "LogicFlavour", "Logic"); + final AxStateFinalizerLogic sflU = new AxStateFinalizerLogic(stateKey, "UnusedSFLogicName", "LogicFlavour", + "Logic"); final AxStateTaskReference str0 = new AxStateTaskReference(new AxReferenceKey(stateKey, "STR0"), - AxStateTaskOutputType.DIRECT, so0.getKey()); + AxStateTaskOutputType.DIRECT, so0.getKey()); final AxStateTaskReference str1 = new AxStateTaskReference(new AxReferenceKey(stateKey, "STR1"), - AxStateTaskOutputType.DIRECT, so0.getKey()); + AxStateTaskOutputType.DIRECT, so0.getKey()); final AxStateTaskReference str2 = new AxStateTaskReference(new AxReferenceKey(stateKey, "STR2"), - AxStateTaskOutputType.LOGIC, sfl.getKey()); + AxStateTaskOutputType.LOGIC, sfl.getKey()); final AxStateTaskReference strBadState = new AxStateTaskReference(new AxReferenceKey(stateKeyBad, "STR2"), - AxStateTaskOutputType.LOGIC, sfl.getKey()); - final AxStateTaskReference strBadSO = new AxStateTaskReference(new AxReferenceKey(stateKey, "STR2"), - AxStateTaskOutputType.UNDEFINED, sfl.getKey()); - final AxStateTaskReference strBadSFL = new AxStateTaskReference(new AxReferenceKey(stateKeyBad, "STR2"), - AxStateTaskOutputType.LOGIC, new AxReferenceKey(stateKey, "SomeSFL")); + AxStateTaskOutputType.LOGIC, sfl.getKey()); + final AxStateTaskReference strBadStateOutput = new AxStateTaskReference(new AxReferenceKey(stateKey, "STR2"), + AxStateTaskOutputType.UNDEFINED, sfl.getKey()); + final AxStateTaskReference strBadStateFinalizerLogic = new AxStateTaskReference( + new AxReferenceKey(stateKeyBad, "STR2"), AxStateTaskOutputType.LOGIC, + new AxReferenceKey(stateKey, "SomeSFL")); soMap.put(so0.getKey().getLocalName(), so0); ctxtSet.add(cr0); @@ -358,7 +363,7 @@ public class TestState { result = state.validate(result); assertEquals(ValidationResult.VALID, result.getValidationResult()); - trMap.put(taskKeyBad, strBadSO); + trMap.put(taskKeyBad, strBadStateOutput); result = new AxValidationResult(); result = state.validate(result); assertEquals(ValidationResult.INVALID, result.getValidationResult()); @@ -378,7 +383,7 @@ public class TestState { result = state.validate(result); assertEquals(ValidationResult.VALID, result.getValidationResult()); - trMap.put(taskKeyBad, strBadSFL); + trMap.put(taskKeyBad, strBadStateFinalizerLogic); result = new AxValidationResult(); result = state.validate(result); assertEquals(ValidationResult.INVALID, result.getValidationResult()); @@ -429,22 +434,22 @@ public class TestState { assertTrue(state.equals(clonedState)); assertFalse(state.equals(null)); assertFalse(state.equals("Hello")); - assertFalse(state - .equals(new AxState(new AxReferenceKey(), triggerKey, soMap, ctxtSet, tsl, sflMap, defTaskKey, trMap))); - assertFalse(state - .equals(new AxState(stateKey, new AxArtifactKey(), soMap, ctxtSet, tsl, sflMap, defTaskKey, trMap))); - assertFalse( - state.equals(new AxState(stateKey, triggerKey, soEmptyMap, ctxtSet, tsl, sflMap, defTaskKey, trMap))); - assertFalse( - state.equals(new AxState(stateKey, triggerKey, soMap, ctxtEmptySet, tsl, sflMap, defTaskKey, trMap))); + assertFalse(state.equals( + new AxState(new AxReferenceKey(), triggerKey, soMap, ctxtSet, tsl, sflMap, defTaskKey, trMap))); + assertFalse(state.equals( + new AxState(stateKey, new AxArtifactKey(), soMap, ctxtSet, tsl, sflMap, defTaskKey, trMap))); + assertFalse(state.equals( + new AxState(stateKey, triggerKey, soEmptyMap, ctxtSet, tsl, sflMap, defTaskKey, trMap))); + assertFalse(state.equals( + new AxState(stateKey, triggerKey, soMap, ctxtEmptySet, tsl, sflMap, defTaskKey, trMap))); assertFalse(state.equals(new AxState(stateKey, triggerKey, soMap, ctxtSet, new AxTaskSelectionLogic(), sflMap, - defTaskKey, trMap))); - assertFalse( - state.equals(new AxState(stateKey, triggerKey, soMap, ctxtSet, tsl, sflEmptyMap, defTaskKey, trMap))); - assertFalse(state - .equals(new AxState(stateKey, triggerKey, soMap, ctxtSet, tsl, sflMap, new AxArtifactKey(), trMap))); - assertFalse( - state.equals(new AxState(stateKey, triggerKey, soMap, ctxtSet, tsl, sflMap, defTaskKey, trEmptyMap))); + defTaskKey, trMap))); + assertFalse(state.equals( + new AxState(stateKey, triggerKey, soMap, ctxtSet, tsl, sflEmptyMap, defTaskKey, trMap))); + assertFalse(state.equals( + new AxState(stateKey, triggerKey, soMap, ctxtSet, tsl, sflMap, new AxArtifactKey(), trMap))); + assertFalse(state.equals( + new AxState(stateKey, triggerKey, soMap, ctxtSet, tsl, sflMap, defTaskKey, trEmptyMap))); assertTrue(state.equals(new AxState(stateKey, triggerKey, soMap, ctxtSet, tsl, sflMap, defTaskKey, trMap))); assertEquals(0, state.compareTo(state)); @@ -452,23 +457,23 @@ public class TestState { assertNotEquals(0, state.compareTo(new AxArtifactKey())); assertNotEquals(0, state.compareTo(null)); assertNotEquals(0, state.compareTo( - new AxState(new AxReferenceKey(), triggerKey, soMap, ctxtSet, tsl, sflMap, defTaskKey, trMap))); - assertNotEquals(0, state - .compareTo(new AxState(stateKey, new AxArtifactKey(), soMap, ctxtSet, tsl, sflMap, defTaskKey, trMap))); - assertNotEquals(0, state - .compareTo(new AxState(stateKey, triggerKey, soEmptyMap, ctxtSet, tsl, sflMap, defTaskKey, trMap))); - assertNotEquals(0, state - .compareTo(new AxState(stateKey, triggerKey, soMap, ctxtEmptySet, tsl, sflMap, defTaskKey, trMap))); + new AxState(new AxReferenceKey(), triggerKey, soMap, ctxtSet, tsl, sflMap, defTaskKey, trMap))); + assertNotEquals(0, state.compareTo( + new AxState(stateKey, new AxArtifactKey(), soMap, ctxtSet, tsl, sflMap, defTaskKey, trMap))); + assertNotEquals(0, state.compareTo( + new AxState(stateKey, triggerKey, soEmptyMap, ctxtSet, tsl, sflMap, defTaskKey, trMap))); + assertNotEquals(0, state.compareTo( + new AxState(stateKey, triggerKey, soMap, ctxtEmptySet, tsl, sflMap, defTaskKey, trMap))); assertNotEquals(0, state.compareTo(new AxState(stateKey, triggerKey, soMap, ctxtSet, new AxTaskSelectionLogic(), - sflMap, defTaskKey, trMap))); - assertNotEquals(0, state - .compareTo(new AxState(stateKey, triggerKey, soMap, ctxtSet, tsl, sflEmptyMap, defTaskKey, trMap))); - assertNotEquals(0, state - .compareTo(new AxState(stateKey, triggerKey, soMap, ctxtSet, tsl, sflMap, new AxArtifactKey(), trMap))); - assertNotEquals(0, state - .compareTo(new AxState(stateKey, triggerKey, soMap, ctxtSet, tsl, sflMap, defTaskKey, trEmptyMap))); - assertEquals(0, - state.compareTo(new AxState(stateKey, triggerKey, soMap, ctxtSet, tsl, sflMap, defTaskKey, trMap))); + sflMap, defTaskKey, trMap))); + assertNotEquals(0, state.compareTo( + new AxState(stateKey, triggerKey, soMap, ctxtSet, tsl, sflEmptyMap, defTaskKey, trMap))); + assertNotEquals(0, state.compareTo( + new AxState(stateKey, triggerKey, soMap, ctxtSet, tsl, sflMap, new AxArtifactKey(), trMap))); + assertNotEquals(0, state.compareTo( + new AxState(stateKey, triggerKey, soMap, ctxtSet, tsl, sflMap, defTaskKey, trEmptyMap))); + assertEquals(0, state + .compareTo(new AxState(stateKey, triggerKey, soMap, ctxtSet, tsl, sflMap, defTaskKey, trMap))); assertNotNull(state.getKeys()); } diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestStateOutput.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestStateOutput.java index 5306b7642..90b486053 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestStateOutput.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestStateOutput.java @@ -35,6 +35,8 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.Validat import org.onap.policy.apex.model.policymodel.concepts.AxStateOutput; /** + * Test state outputs. + * * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TestStateOutput { diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestStateTaskReference.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestStateTaskReference.java index eeaf19e07..90c7001b8 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestStateTaskReference.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestStateTaskReference.java @@ -36,6 +36,8 @@ import org.onap.policy.apex.model.policymodel.concepts.AxStateTaskOutputType; import org.onap.policy.apex.model.policymodel.concepts.AxStateTaskReference; /** + * Test state task references. + * * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TestStateTaskReference { @@ -44,15 +46,14 @@ public class TestStateTaskReference { public void testStateTaskReference() { assertNotNull(new AxStateTaskReference()); assertNotNull(new AxStateTaskReference(new AxReferenceKey())); - assertNotNull( - new AxStateTaskReference(new AxReferenceKey(), AxStateTaskOutputType.UNDEFINED, new AxReferenceKey())); + assertNotNull(new AxStateTaskReference(new AxReferenceKey(), AxStateTaskOutputType.UNDEFINED, + new AxReferenceKey())); assertNotNull(new AxStateTaskReference(new AxReferenceKey(), new AxArtifactKey(), - AxStateTaskOutputType.UNDEFINED, new AxReferenceKey())); + AxStateTaskOutputType.UNDEFINED, new AxReferenceKey())); AxStateTaskReference stRef = new AxStateTaskReference(); AxReferenceKey stRefKey = new AxReferenceKey("StateParent", "0.0.1", "SOState", "SOName"); - AxReferenceKey soKey = new AxReferenceKey("StateParent", "0.0.1", "SOState", "STRef0"); try { stRef.setKey(null); @@ -86,6 +87,7 @@ public class TestStateTaskReference { assertEquals("output may not be null", e.getMessage()); } + AxReferenceKey soKey = new AxReferenceKey("StateParent", "0.0.1", "SOState", "STRef0"); stRef.setOutput(soKey); assertEquals(soKey, stRef.getOutput()); @@ -134,25 +136,25 @@ public class TestStateTaskReference { assertTrue(stRef.equals(clonedStRef)); assertFalse(stRef.equals(null)); assertFalse(stRef.equals("Hello")); - assertFalse(stRef - .equals(new AxStateTaskReference(AxReferenceKey.getNullKey(), AxStateTaskOutputType.LOGIC, soKey))); + assertFalse(stRef.equals( + new AxStateTaskReference(AxReferenceKey.getNullKey(), AxStateTaskOutputType.LOGIC, soKey))); assertFalse(stRef.equals(new AxStateTaskReference(stRefKey, AxStateTaskOutputType.DIRECT, soKey))); - assertFalse( - stRef.equals(new AxStateTaskReference(stRefKey, AxStateTaskOutputType.LOGIC, new AxReferenceKey()))); + assertFalse(stRef + .equals(new AxStateTaskReference(stRefKey, AxStateTaskOutputType.LOGIC, new AxReferenceKey()))); assertTrue(stRef.equals(new AxStateTaskReference(stRefKey, AxStateTaskOutputType.LOGIC, soKey))); assertNotNull(new AxStateTaskReference(new AxReferenceKey(), new AxArtifactKey(), - AxStateTaskOutputType.UNDEFINED, new AxReferenceKey())); + AxStateTaskOutputType.UNDEFINED, new AxReferenceKey())); assertEquals(0, stRef.compareTo(stRef)); assertEquals(0, stRef.compareTo(clonedStRef)); assertNotEquals(0, stRef.compareTo(new AxArtifactKey())); assertNotEquals(0, stRef.compareTo(null)); - assertNotEquals(0, stRef - .compareTo(new AxStateTaskReference(AxReferenceKey.getNullKey(), AxStateTaskOutputType.LOGIC, soKey))); + assertNotEquals(0, stRef.compareTo( + new AxStateTaskReference(AxReferenceKey.getNullKey(), AxStateTaskOutputType.LOGIC, soKey))); assertNotEquals(0, stRef.compareTo(new AxStateTaskReference(stRefKey, AxStateTaskOutputType.DIRECT, soKey))); - assertNotEquals(0, - stRef.compareTo(new AxStateTaskReference(stRefKey, AxStateTaskOutputType.LOGIC, new AxReferenceKey()))); + assertNotEquals(0, stRef.compareTo( + new AxStateTaskReference(stRefKey, AxStateTaskOutputType.LOGIC, new AxReferenceKey()))); assertEquals(0, stRef.compareTo(new AxStateTaskReference(stRefKey, AxStateTaskOutputType.LOGIC, soKey))); assertNotNull(stRef.getKeys()); diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestTaskParameter.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestTaskParameter.java index ff6ab42b8..4eb2c4232 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestTaskParameter.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestTaskParameter.java @@ -35,6 +35,8 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.Validat import org.onap.policy.apex.model.policymodel.concepts.AxTaskParameter; /** + * Test task parameters. + * * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TestTaskParameter { @@ -89,9 +91,8 @@ public class TestTaskParameter { par.clean(); final AxTaskParameter clonedPar = new AxTaskParameter(par); - assertEquals( - "AxTaskParameter:(key=AxReferenceKey:(parentKeyName=ParParentName,parentKeyVersion=0.0.1,parentLocalName=PLN,localName=LN),defaultValue=DefaultValue)", - clonedPar.toString()); + assertEquals("AxTaskParameter:(key=AxReferenceKey:(parentKeyName=ParParentName,parentKeyVersion=0.0.1," + + "parentLocalName=PLN,localName=LN),defaultValue=DefaultValue)", clonedPar.toString()); assertFalse(par.hashCode() == 0); diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestTasks.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestTasks.java index 78691accb..4f6292f04 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestTasks.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TestTasks.java @@ -43,6 +43,8 @@ import org.onap.policy.apex.model.policymodel.concepts.AxTaskParameter; import org.onap.policy.apex.model.policymodel.concepts.AxTasks; /** + * Test policy tasks. + * * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TestTasks { @@ -302,7 +304,7 @@ public class TestTasks { final AxTasks clonedTasks = new AxTasks(tasks); assertEquals("AxTasks:(key=AxArtifactKey:(name=TasksKey,version=0.0.1),tas", - clonedTasks.toString().substring(0, 60)); + clonedTasks.toString().substring(0, 60)); assertFalse(tasks.hashCode() == 0); diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/TestApexPolicyModel.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/TestApexPolicyModel.java index 5dfeede0a..6c4fd5174 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/TestApexPolicyModel.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/TestApexPolicyModel.java @@ -39,6 +39,11 @@ public class TestApexPolicyModel { private Connection connection; TestApexModel<AxPolicyModel> testApexModel; + /** + * Set up the policy model tests. + * + * @throws Exception on setup errors + */ @Before public void setup() throws Exception { Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance(); @@ -65,7 +70,6 @@ public class TestApexPolicyModel { assertTrue(result.toString().equals(OBSERVATION_MODEL_STRING)); } - @Test public void testApexModelVaidateWarning() throws Exception { final AxValidationResult result = testApexModel.testApexModelVaidateWarning(); @@ -85,17 +89,17 @@ public class TestApexPolicyModel { } @Test - public void testModelWriteReadXML() throws Exception { + public void testModelWriteReadXml() throws Exception { testApexModel.testApexModelWriteReadXml(); } @Test - public void testModelWriteReadJSON() throws Exception { + public void testModelWriteReadJson() throws Exception { testApexModel.testApexModelWriteReadJson(); } @Test - public void testModelWriteReadJPA() throws Exception { + public void testModelWriteReadJpa() throws Exception { final DaoParameters DaoParameters = new DaoParameters(); DaoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao"); DaoParameters.setPersistenceUnit("DAOTest"); @@ -105,35 +109,71 @@ public class TestApexPolicyModel { private static final String VALID_MODEL_STRING = "***validation of model successful***"; - private static final String OBSERVATION_MODEL_STRING = - "\n" + "***observations noted during validation of model***\n" - + "AxReferenceKey:(parentKeyName=policy,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=state):org.onap.policy.apex.model.policymodel.concepts.AxState:OBSERVATION:state output stateOutput0 is not used directly by any task\n" + private static final String OBSERVATION_MODEL_STRING = "\n" + + "***observations noted during validation of model***\n" + + "AxReferenceKey:(parentKeyName=policy,parentKeyVersion=0.0.1,parentLocalName=NULL," + + "localName=state):org.onap.policy.apex.model.policymodel.concepts.AxState:OBSERVATION:" + + "state output stateOutput0 is not used directly by any task\n" + "********************************"; private static final String WARNING_MODEL_STRING = "\n" + "***warnings issued during validation of model***\n" - + "AxArtifactKey:(name=policy,version=0.0.1):org.onap.policy.apex.model.policymodel.concepts.AxPolicy:WARNING:state AxReferenceKey:(parentKeyName=policy,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=anotherState) is not referenced in the policy execution tree\n" - + "********************************"; + + "AxArtifactKey:(name=policy,version=0.0.1)" + + ":org.onap.policy.apex.model.policymodel.concepts.AxPolicy:WARNING:state AxReferenceKey:" + + "(parentKeyName=policy,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=anotherState) " + + "is not referenced in the policy execution tree\n" + "********************************"; private static final String INVALID_MODEL_STRING = "\n" + "***validation of model failed***\n" - + "AxArtifactKey:(name=contextAlbum0,version=0.0.1):org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum:INVALID:scope is not defined\n" - + "AxArtifactKey:(name=contextAlbum1,version=0.0.1):org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum:INVALID:scope is not defined\n" - + "AxReferenceKey:(parentKeyName=policy,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=state):org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel:INVALID:task output field AxOutputField:(key=AxReferenceKey:(parentKeyName=task,parentKeyVersion=0.0.1,parentLocalName=outputFields,localName=OE1PAR0),fieldSchemaKey=AxArtifactKey:(name=eventContextItem0,version=0.0.1),optional=false) for task task:0.0.1 not in output event outEvent0:0.0.1\n" - + "AxReferenceKey:(parentKeyName=policy,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=state):org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel:INVALID:task output field AxOutputField:(key=AxReferenceKey:(parentKeyName=task,parentKeyVersion=0.0.1,parentLocalName=outputFields,localName=OE1PAR1),fieldSchemaKey=AxArtifactKey:(name=eventContextItem1,version=0.0.1),optional=false) for task task:0.0.1 not in output event outEvent0:0.0.1\n" - + "********************************"; + + "AxArtifactKey:(name=contextAlbum0,version=0.0.1):" + + "org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum:INVALID:scope is not defined\n" + + "AxArtifactKey:(name=contextAlbum1,version=0.0.1):" + + "org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum:INVALID:scope is not defined\n" + + "AxReferenceKey:" + + "(parentKeyName=policy,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=state):" + + "org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel:INVALID:" + + "task output field AxOutputField:(key=AxReferenceKey:" + + "(parentKeyName=task,parentKeyVersion=0.0.1,parentLocalName=outputFields,localName=OE1PAR0)," + + "fieldSchemaKey=AxArtifactKey:(name=eventContextItem0,version=0.0.1),optional=false) for task " + + "task:0.0.1 not in output event outEvent0:0.0.1\n" + "AxReferenceKey:" + + "(parentKeyName=policy,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=state):" + + "org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel:INVALID:" + + "task output field AxOutputField:(key=AxReferenceKey:" + + "(parentKeyName=task,parentKeyVersion=0.0.1,parentLocalName=outputFields,localName=OE1PAR1)," + + "fieldSchemaKey=AxArtifactKey:(name=eventContextItem1,version=0.0.1),optional=false) for task " + + "task:0.0.1 not in output event outEvent0:0.0.1\n" + "********************************"; private static final String INVALID_MODEL_MALSTRUCTURED_STRING = "\n" + "***validation of model failed***\n" - + "AxArtifactKey:(name=policyModel_KeyInfo,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation:INVALID:keyInfoMap may not be empty\n" - + "AxArtifactKey:(name=policyModel,version=0.0.1):org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel:INVALID:key information not found for key AxArtifactKey:(name=policyModel,version=0.0.1)\n" - + "AxArtifactKey:(name=policyModel,version=0.0.1):org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel:INVALID:key information not found for key AxArtifactKey:(name=policyModel_KeyInfo,version=0.0.1)\n" - + "AxArtifactKey:(name=policyModel,version=0.0.1):org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel:INVALID:key information not found for key AxArtifactKey:(name=policyModel_Schemas,version=0.0.1)\n" - + "AxArtifactKey:(name=policyModel,version=0.0.1):org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel:INVALID:key information not found for key AxArtifactKey:(name=policyModel_Events,version=0.0.1)\n" - + "AxArtifactKey:(name=policyModel,version=0.0.1):org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel:INVALID:key information not found for key AxArtifactKey:(name=policyModel_Albums,version=0.0.1)\n" - + "AxArtifactKey:(name=policyModel,version=0.0.1):org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel:INVALID:key information not found for key AxArtifactKey:(name=policyModel_Tasks,version=0.0.1)\n" - + "AxArtifactKey:(name=policyModel,version=0.0.1):org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel:INVALID:key information not found for key AxArtifactKey:(name=policyModel_Policies,version=0.0.1)\n" - + "AxArtifactKey:(name=policyModel_Schemas,version=0.0.1):org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas:INVALID:contextSchemas may not be empty\n" - + "AxArtifactKey:(name=policyModel_Events,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvents:INVALID:eventMap may not be empty\n" - + "AxArtifactKey:(name=policyModel_Albums,version=0.0.1):org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbums:OBSERVATION:albums are empty\n" - + "AxArtifactKey:(name=policyModel_Tasks,version=0.0.1):org.onap.policy.apex.model.policymodel.concepts.AxTasks:INVALID:taskMap may not be empty\n" - + "AxArtifactKey:(name=policyModel_Policies,version=0.0.1):org.onap.policy.apex.model.policymodel.concepts.AxPolicies:INVALID:policyMap may not be empty\n" - + "********************************"; + + "AxArtifactKey:(name=policyModel_KeyInfo,version=0.0.1):" + + "org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation:INVALID:" + + "keyInfoMap may not be empty\n" + "AxArtifactKey:(name=policyModel,version=0.0.1)" + + ":org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel:INVALID:" + + "key information not found for key AxArtifactKey:(name=policyModel,version=0.0.1)\n" + + "AxArtifactKey:(name=policyModel,version=0.0.1)" + + ":org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel:INVALID:" + + "key information not found for key AxArtifactKey:(name=policyModel_KeyInfo,version=0.0.1)\n" + + "AxArtifactKey:(name=policyModel,version=0.0.1)" + + ":org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel:INVALID:" + + "key information not found for key AxArtifactKey:(name=policyModel_Schemas,version=0.0.1)\n" + + "AxArtifactKey:(name=policyModel,version=0.0.1)" + + ":org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel:INVALID:" + + "key information not found for key AxArtifactKey:(name=policyModel_Events,version=0.0.1)\n" + + "AxArtifactKey:(name=policyModel,version=0.0.1)" + + ":org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel:INVALID:" + + "key information not found for key AxArtifactKey:(name=policyModel_Albums,version=0.0.1)\n" + + "AxArtifactKey:(name=policyModel,version=0.0.1)" + + ":org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel:INVALID:" + + "key information not found for key AxArtifactKey:(name=policyModel_Tasks,version=0.0.1)\n" + + "AxArtifactKey:(name=policyModel,version=0.0.1)" + + ":org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel:INVALID:" + + "key information not found for key AxArtifactKey:(name=policyModel_Policies,version=0.0.1)\n" + + "AxArtifactKey:(name=policyModel_Schemas,version=0.0.1):" + + "org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas:INVALID:" + + "contextSchemas may not be empty\n" + "AxArtifactKey:(name=policyModel_Events,version=0.0.1):" + + "org.onap.policy.apex.model.eventmodel.concepts.AxEvents:INVALID:eventMap may not be empty\n" + + "AxArtifactKey:(name=policyModel_Albums,version=0.0.1):" + + "org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbums:OBSERVATION:albums are empty\n" + + "AxArtifactKey:(name=policyModel_Tasks,version=0.0.1)" + + ":org.onap.policy.apex.model.policymodel.concepts.AxTasks:INVALID:taskMap may not be empty\n" + + "AxArtifactKey:(name=policyModel_Policies,version=0.0.1)" + + ":org.onap.policy.apex.model.policymodel.concepts.AxPolicies:INVALID:policyMap may not be empty\n" + + "********************************"; } diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/TestApexPolicyModelCreator.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/TestApexPolicyModelCreator.java index cf2bb6524..cbcecc589 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/TestApexPolicyModelCreator.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/TestApexPolicyModelCreator.java @@ -52,20 +52,22 @@ import org.onap.policy.apex.model.policymodel.concepts.AxTaskSelectionLogic; import org.onap.policy.apex.model.policymodel.concepts.AxTasks; /** + * Model creator for model tests. + * * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TestApexPolicyModelCreator implements TestApexModelCreator<AxPolicyModel> { @Override public AxPolicyModel getModel() { - final AxContextSchema schema0 = - new AxContextSchema(new AxArtifactKey("eventContextItem0", "0.0.1"), "Java", "java.lang.String"); - final AxContextSchema schema1 = - new AxContextSchema(new AxArtifactKey("eventContextItem1", "0.0.1"), "Java", "java.lang.Long"); + final AxContextSchema schema0 = new AxContextSchema(new AxArtifactKey("eventContextItem0", "0.0.1"), "Java", + "java.lang.String"); + final AxContextSchema schema1 = new AxContextSchema(new AxArtifactKey("eventContextItem1", "0.0.1"), "Java", + "java.lang.Long"); final AxContextSchema schema2 = new AxContextSchema(new AxArtifactKey("StringType", "0.0.1"), "Java", - "org.onap.policy.apex.model.policymodel.concepts.TestContextItem000"); + "org.onap.policy.apex.model.policymodel.concepts.TestContextItem000"); final AxContextSchema schema3 = new AxContextSchema(new AxArtifactKey("MapType", "0.0.1"), "Java", - "org.onap.policy.apex.model.policymodel.concepts.TestContextItem00A"); + "org.onap.policy.apex.model.policymodel.concepts.TestContextItem00A"); final AxContextSchemas schemas = new AxContextSchemas(new AxArtifactKey("ContextSchemas", "0.0.1")); schemas.getSchemasMap().put(schema0.getKey(), schema0); @@ -73,39 +75,39 @@ public class TestApexPolicyModelCreator implements TestApexModelCreator<AxPolicy schemas.getSchemasMap().put(schema2.getKey(), schema2); schemas.getSchemasMap().put(schema3.getKey(), schema3); - final AxContextAlbum album0 = - new AxContextAlbum(new AxArtifactKey("contextAlbum0", "0.0.1"), "APPLICATION", true, schema3.getKey()); - final AxContextAlbum album1 = - new AxContextAlbum(new AxArtifactKey("contextAlbum1", "0.0.1"), "GLOBAL", false, schema2.getKey()); + final AxContextAlbum album0 = new AxContextAlbum(new AxArtifactKey("contextAlbum0", "0.0.1"), "APPLICATION", + true, schema3.getKey()); + final AxContextAlbum album1 = new AxContextAlbum(new AxArtifactKey("contextAlbum1", "0.0.1"), "GLOBAL", false, + schema2.getKey()); final AxContextAlbums albums = new AxContextAlbums(new AxArtifactKey("context", "0.0.1")); albums.getAlbumsMap().put(album0.getKey(), album0); albums.getAlbumsMap().put(album1.getKey(), album1); final AxEvent inEvent = new AxEvent(new AxArtifactKey("inEvent", "0.0.1"), - "org.onap.policy.apex.model.policymodel.events", "Source", "Target"); + "org.onap.policy.apex.model.policymodel.events", "Source", "Target"); inEvent.getParameterMap().put("IEPAR0", - new AxField(new AxReferenceKey(inEvent.getKey(), "IEPAR0"), schema0.getKey())); + new AxField(new AxReferenceKey(inEvent.getKey(), "IEPAR0"), schema0.getKey())); inEvent.getParameterMap().put("IEPAR1", - new AxField(new AxReferenceKey(inEvent.getKey(), "IEPAR1"), schema1.getKey())); + new AxField(new AxReferenceKey(inEvent.getKey(), "IEPAR1"), schema1.getKey())); final AxEvent outEvent0 = new AxEvent(new AxArtifactKey("outEvent0", "0.0.1"), - "org.onap.policy.apex.model.policymodel.events", "Source", "Target"); + "org.onap.policy.apex.model.policymodel.events", "Source", "Target"); outEvent0.getParameterMap().put("OE0PAR0", - new AxField(new AxReferenceKey(outEvent0.getKey(), "OE0PAR0"), schema0.getKey())); + new AxField(new AxReferenceKey(outEvent0.getKey(), "OE0PAR0"), schema0.getKey())); outEvent0.getParameterMap().put("OE0PAR1", - new AxField(new AxReferenceKey(outEvent0.getKey(), "OE0PAR1"), schema1.getKey())); + new AxField(new AxReferenceKey(outEvent0.getKey(), "OE0PAR1"), schema1.getKey())); outEvent0.getParameterMap().put("OE1PAR0", - new AxField(new AxReferenceKey(outEvent0.getKey(), "OE1PAR0"), schema0.getKey())); + new AxField(new AxReferenceKey(outEvent0.getKey(), "OE1PAR0"), schema0.getKey())); outEvent0.getParameterMap().put("OE1PAR1", - new AxField(new AxReferenceKey(outEvent0.getKey(), "OE1PAR1"), schema1.getKey())); + new AxField(new AxReferenceKey(outEvent0.getKey(), "OE1PAR1"), schema1.getKey())); final AxEvent outEvent1 = new AxEvent(new AxArtifactKey("outEvent1", "0.0.1"), - "org.onap.policy.apex.model.policymodel.events", "Source", "Target"); + "org.onap.policy.apex.model.policymodel.events", "Source", "Target"); outEvent1.getParameterMap().put("OE1PAR0", - new AxField(new AxReferenceKey(outEvent1.getKey(), "OE1PAR0"), schema0.getKey())); + new AxField(new AxReferenceKey(outEvent1.getKey(), "OE1PAR0"), schema0.getKey())); outEvent1.getParameterMap().put("OE1PAR1", - new AxField(new AxReferenceKey(outEvent1.getKey(), "OE1PAR1"), schema1.getKey())); + new AxField(new AxReferenceKey(outEvent1.getKey(), "OE1PAR1"), schema1.getKey())); final AxEvents events = new AxEvents(new AxArtifactKey("events", "0.0.1")); events.getEventMap().put(inEvent.getKey(), inEvent); @@ -116,37 +118,37 @@ public class TestApexPolicyModelCreator implements TestApexModelCreator<AxPolicy for (final AxField field : inEvent.getFields()) { final AxReferenceKey fieldkey = new AxReferenceKey(task.getKey().getName(), task.getKey().getVersion(), - "inputFields", field.getKey().getLocalName()); + "inputFields", field.getKey().getLocalName()); final AxInputField inputField = new AxInputField(fieldkey, field.getSchema()); task.getInputFields().put(inputField.getKey().getLocalName(), inputField); } for (final AxField field : outEvent0.getFields()) { final AxReferenceKey fieldkey = new AxReferenceKey(task.getKey().getName(), task.getKey().getVersion(), - "outputFields", field.getKey().getLocalName()); + "outputFields", field.getKey().getLocalName()); final AxOutputField outputField = new AxOutputField(fieldkey, field.getSchema()); task.getOutputFields().put(outputField.getKey().getLocalName(), outputField); } for (final AxField field : outEvent1.getFields()) { final AxReferenceKey fieldkey = new AxReferenceKey(task.getKey().getName(), task.getKey().getVersion(), - "outputFields", field.getKey().getLocalName()); + "outputFields", field.getKey().getLocalName()); final AxOutputField outputField = new AxOutputField(fieldkey, field.getSchema()); task.getOutputFields().put(outputField.getKey().getLocalName(), outputField); } - final AxTaskParameter taskPar0 = - new AxTaskParameter(new AxReferenceKey(task.getKey(), "taskParameter0"), "Task parameter 0 value"); - final AxTaskParameter taskPar1 = - new AxTaskParameter(new AxReferenceKey(task.getKey(), "taskParameter1"), "Task parameter 1 value"); + final AxTaskParameter taskPar0 = new AxTaskParameter(new AxReferenceKey(task.getKey(), "taskParameter0"), + "Task parameter 0 value"); + final AxTaskParameter taskPar1 = new AxTaskParameter(new AxReferenceKey(task.getKey(), "taskParameter1"), + "Task parameter 1 value"); task.getTaskParameters().put(taskPar0.getKey().getLocalName(), taskPar0); task.getTaskParameters().put(taskPar1.getKey().getLocalName(), taskPar1); task.getContextAlbumReferences().add(album0.getKey()); task.getContextAlbumReferences().add(album1.getKey()); - final AxTaskLogic taskLogic = - new AxTaskLogic(new AxReferenceKey(task.getKey(), "taskLogic"), "MVEL", "Some task logic"); + final AxTaskLogic taskLogic = new AxTaskLogic(new AxReferenceKey(task.getKey(), "taskLogic"), "MVEL", + "Some task logic"); task.setTaskLogic(taskLogic); final AxTasks tasks = new AxTasks(new AxArtifactKey("tasks", "0.0.1")); @@ -157,7 +159,7 @@ public class TestApexPolicyModelCreator implements TestApexModelCreator<AxPolicy final AxState state = new AxState(new AxReferenceKey(policy.getKey(), "state")); final AxTaskSelectionLogic taskSelectionLogic = new AxTaskSelectionLogic( - new AxReferenceKey(state.getKey(), "taskSelectionLogic"), "MVEL", "Some TS logic "); + new AxReferenceKey(state.getKey(), "taskSelectionLogic"), "MVEL", "Some TS logic "); state.setTrigger(inEvent.getKey()); state.getContextAlbumReferences().add(album0.getKey()); @@ -166,12 +168,12 @@ public class TestApexPolicyModelCreator implements TestApexModelCreator<AxPolicy state.setDefaultTask(task.getKey()); final AxStateOutput stateOutput0 = new AxStateOutput(new AxReferenceKey(state.getKey(), "stateOutput0"), - outEvent0.getKey(), AxReferenceKey.getNullKey()); + outEvent0.getKey(), AxReferenceKey.getNullKey()); state.getStateOutputs().put(stateOutput0.getKey().getLocalName(), stateOutput0); - final AxStateTaskReference stateTaskReference = - new AxStateTaskReference(new AxReferenceKey(state.getKey(), task.getKey().getName()), - AxStateTaskOutputType.DIRECT, stateOutput0.getKey()); + final AxStateTaskReference stateTaskReference = new AxStateTaskReference( + new AxReferenceKey(state.getKey(), task.getKey().getName()), AxStateTaskOutputType.DIRECT, + stateOutput0.getKey()); state.getTaskReferences().put(task.getKey(), stateTaskReference); @@ -203,15 +205,20 @@ public class TestApexPolicyModelCreator implements TestApexModelCreator<AxPolicy return policyModel; } + /** + * Gets another policy model. + * + * @return the model + */ public AxPolicyModel getAnotherModel() { - final AxContextSchema schema0 = - new AxContextSchema(new AxArtifactKey("eventContextItemA0", "0.0.1"), "Java", "java.lang.String"); - final AxContextSchema schema1 = - new AxContextSchema(new AxArtifactKey("eventContextItemA1", "0.0.1"), "Java", "java.lang.Long"); + final AxContextSchema schema0 = new AxContextSchema(new AxArtifactKey("eventContextItemA0", "0.0.1"), "Java", + "java.lang.String"); + final AxContextSchema schema1 = new AxContextSchema(new AxArtifactKey("eventContextItemA1", "0.0.1"), "Java", + "java.lang.Long"); final AxContextSchema schema2 = new AxContextSchema(new AxArtifactKey("StringTypeA", "0.0.1"), "Java", - "org.onap.policy.apex.model.policymodel.concepts.TestContextItem000"); + "org.onap.policy.apex.model.policymodel.concepts.TestContextItem000"); final AxContextSchema schema3 = new AxContextSchema(new AxArtifactKey("MapTypeA", "0.0.1"), "Java", - "org.onap.policy.apex.model.policymodel.concepts.TestContextItem00A"); + "org.onap.policy.apex.model.policymodel.concepts.TestContextItem00A"); final AxContextSchemas schemas = new AxContextSchemas(new AxArtifactKey("ContextSchemasA", "0.0.1")); schemas.getSchemasMap().put(schema0.getKey(), schema0); @@ -219,39 +226,39 @@ public class TestApexPolicyModelCreator implements TestApexModelCreator<AxPolicy schemas.getSchemasMap().put(schema2.getKey(), schema2); schemas.getSchemasMap().put(schema3.getKey(), schema3); - final AxContextAlbum album0 = - new AxContextAlbum(new AxArtifactKey("contextAlbumA0", "0.0.1"), "APPLICATION", true, schema3.getKey()); - final AxContextAlbum album1 = - new AxContextAlbum(new AxArtifactKey("contextAlbumA1", "0.0.1"), "GLOBAL", false, schema2.getKey()); + final AxContextAlbum album0 = new AxContextAlbum(new AxArtifactKey("contextAlbumA0", "0.0.1"), "APPLICATION", + true, schema3.getKey()); + final AxContextAlbum album1 = new AxContextAlbum(new AxArtifactKey("contextAlbumA1", "0.0.1"), "GLOBAL", false, + schema2.getKey()); final AxContextAlbums albums = new AxContextAlbums(new AxArtifactKey("contextA", "0.0.1")); albums.getAlbumsMap().put(album0.getKey(), album0); albums.getAlbumsMap().put(album1.getKey(), album1); final AxEvent inEvent = new AxEvent(new AxArtifactKey("inEventA", "0.0.1"), - "org.onap.policy.apex.model.policymodel.events", "Source", "Target"); + "org.onap.policy.apex.model.policymodel.events", "Source", "Target"); inEvent.getParameterMap().put("IEPARA0", - new AxField(new AxReferenceKey(inEvent.getKey(), "IEPARA0"), schema0.getKey())); + new AxField(new AxReferenceKey(inEvent.getKey(), "IEPARA0"), schema0.getKey())); inEvent.getParameterMap().put("IEPARA1", - new AxField(new AxReferenceKey(inEvent.getKey(), "IEPARA1"), schema1.getKey())); + new AxField(new AxReferenceKey(inEvent.getKey(), "IEPARA1"), schema1.getKey())); final AxEvent outEvent0 = new AxEvent(new AxArtifactKey("outEventA0", "0.0.1"), - "org.onap.policy.apex.model.policymodel.events", "Source", "Target"); + "org.onap.policy.apex.model.policymodel.events", "Source", "Target"); outEvent0.getParameterMap().put("OE0PARA0", - new AxField(new AxReferenceKey(outEvent0.getKey(), "OE0PARA0"), schema0.getKey())); + new AxField(new AxReferenceKey(outEvent0.getKey(), "OE0PARA0"), schema0.getKey())); outEvent0.getParameterMap().put("OE0PARA1", - new AxField(new AxReferenceKey(outEvent0.getKey(), "OE0PARA1"), schema1.getKey())); + new AxField(new AxReferenceKey(outEvent0.getKey(), "OE0PARA1"), schema1.getKey())); outEvent0.getParameterMap().put("OE1PARA0", - new AxField(new AxReferenceKey(outEvent0.getKey(), "OE1PARA0"), schema0.getKey())); + new AxField(new AxReferenceKey(outEvent0.getKey(), "OE1PARA0"), schema0.getKey())); outEvent0.getParameterMap().put("OE1PARA1", - new AxField(new AxReferenceKey(outEvent0.getKey(), "OE1PARA1"), schema1.getKey())); + new AxField(new AxReferenceKey(outEvent0.getKey(), "OE1PARA1"), schema1.getKey())); final AxEvent outEvent1 = new AxEvent(new AxArtifactKey("outEventA1", "0.0.1"), - "org.onap.policy.apex.model.policymodel.events", "Source", "Target"); + "org.onap.policy.apex.model.policymodel.events", "Source", "Target"); outEvent1.getParameterMap().put("OE1PARA0", - new AxField(new AxReferenceKey(outEvent1.getKey(), "OE1PARA0"), schema0.getKey())); + new AxField(new AxReferenceKey(outEvent1.getKey(), "OE1PARA0"), schema0.getKey())); outEvent1.getParameterMap().put("OE1PARA1", - new AxField(new AxReferenceKey(outEvent1.getKey(), "OE1PARA1"), schema1.getKey())); + new AxField(new AxReferenceKey(outEvent1.getKey(), "OE1PARA1"), schema1.getKey())); final AxEvents events = new AxEvents(new AxArtifactKey("eventsA", "0.0.1")); events.getEventMap().put(inEvent.getKey(), inEvent); @@ -262,37 +269,37 @@ public class TestApexPolicyModelCreator implements TestApexModelCreator<AxPolicy for (final AxField field : inEvent.getFields()) { final AxReferenceKey fieldkey = new AxReferenceKey(task.getKey().getName(), task.getKey().getVersion(), - "inputFieldsA", field.getKey().getLocalName()); + "inputFieldsA", field.getKey().getLocalName()); final AxInputField inputField = new AxInputField(fieldkey, field.getSchema()); task.getInputFields().put(inputField.getKey().getLocalName(), inputField); } for (final AxField field : outEvent0.getFields()) { final AxReferenceKey fieldkey = new AxReferenceKey(task.getKey().getName(), task.getKey().getVersion(), - "outputFieldsA", field.getKey().getLocalName()); + "outputFieldsA", field.getKey().getLocalName()); final AxOutputField outputField = new AxOutputField(fieldkey, field.getSchema()); task.getOutputFields().put(outputField.getKey().getLocalName(), outputField); } for (final AxField field : outEvent1.getFields()) { final AxReferenceKey fieldkey = new AxReferenceKey(task.getKey().getName(), task.getKey().getVersion(), - "outputFieldsA", field.getKey().getLocalName()); + "outputFieldsA", field.getKey().getLocalName()); final AxOutputField outputField = new AxOutputField(fieldkey, field.getSchema()); task.getOutputFields().put(outputField.getKey().getLocalName(), outputField); } - final AxTaskParameter taskPar0 = - new AxTaskParameter(new AxReferenceKey(task.getKey(), "taskParameterA0"), "Task parameter 0 value"); - final AxTaskParameter taskPar1 = - new AxTaskParameter(new AxReferenceKey(task.getKey(), "taskParameterA1"), "Task parameter 1 value"); + final AxTaskParameter taskPar0 = new AxTaskParameter(new AxReferenceKey(task.getKey(), "taskParameterA0"), + "Task parameter 0 value"); + final AxTaskParameter taskPar1 = new AxTaskParameter(new AxReferenceKey(task.getKey(), "taskParameterA1"), + "Task parameter 1 value"); task.getTaskParameters().put(taskPar0.getKey().getLocalName(), taskPar0); task.getTaskParameters().put(taskPar1.getKey().getLocalName(), taskPar1); task.getContextAlbumReferences().add(album0.getKey()); task.getContextAlbumReferences().add(album1.getKey()); - final AxTaskLogic taskLogic = - new AxTaskLogic(new AxReferenceKey(task.getKey(), "taskLogicA"), "MVEL", "Some task logic"); + final AxTaskLogic taskLogic = new AxTaskLogic(new AxReferenceKey(task.getKey(), "taskLogicA"), "MVEL", + "Some task logic"); task.setTaskLogic(taskLogic); final AxTasks tasks = new AxTasks(new AxArtifactKey("tasksA", "0.0.1")); @@ -303,7 +310,7 @@ public class TestApexPolicyModelCreator implements TestApexModelCreator<AxPolicy final AxState state = new AxState(new AxReferenceKey(policy.getKey(), "stateA")); final AxTaskSelectionLogic taskSelectionLogic = new AxTaskSelectionLogic( - new AxReferenceKey(state.getKey(), "taskSelectionLogicA"), "MVEL", "Some TS logic "); + new AxReferenceKey(state.getKey(), "taskSelectionLogicA"), "MVEL", "Some TS logic "); state.setTrigger(inEvent.getKey()); state.getContextAlbumReferences().add(album0.getKey()); @@ -312,12 +319,12 @@ public class TestApexPolicyModelCreator implements TestApexModelCreator<AxPolicy state.setDefaultTask(task.getKey()); final AxStateOutput stateOutput0 = new AxStateOutput(new AxReferenceKey(state.getKey(), "stateOutputA0"), - outEvent0.getKey(), AxReferenceKey.getNullKey()); + outEvent0.getKey(), AxReferenceKey.getNullKey()); state.getStateOutputs().put(stateOutput0.getKey().getLocalName(), stateOutput0); - final AxStateTaskReference stateTaskReference = - new AxStateTaskReference(new AxReferenceKey(state.getKey(), task.getKey().getName()), - AxStateTaskOutputType.DIRECT, stateOutput0.getKey()); + final AxStateTaskReference stateTaskReference = new AxStateTaskReference( + new AxReferenceKey(state.getKey(), task.getKey().getName()), AxStateTaskOutputType.DIRECT, + stateOutput0.getKey()); state.getTaskReferences().put(task.getKey(), stateTaskReference); @@ -362,12 +369,12 @@ public class TestApexPolicyModelCreator implements TestApexModelCreator<AxPolicy final AxState state = policyModel.getPolicies().get("policy").getStateMap().get("state"); final AxTask task = policyModel.getTasks().get("task"); - final AxStateFinalizerLogic stateFinalizerLogic = - new AxStateFinalizerLogic(new AxReferenceKey(state.getKey(), "SFL"), "MVEL", "Some SF logic "); + final AxStateFinalizerLogic stateFinalizerLogic = new AxStateFinalizerLogic( + new AxReferenceKey(state.getKey(), "SFL"), "MVEL", "Some SF logic "); state.getStateFinalizerLogicMap().put(stateFinalizerLogic.getKey().getLocalName(), stateFinalizerLogic); - final AxStateTaskReference stateTaskReference = - new AxStateTaskReference(new AxReferenceKey(state.getKey(), task.getKey().getName()), - AxStateTaskOutputType.LOGIC, stateFinalizerLogic.getKey()); + final AxStateTaskReference stateTaskReference = new AxStateTaskReference( + new AxReferenceKey(state.getKey(), task.getKey().getName()), AxStateTaskOutputType.LOGIC, + stateFinalizerLogic.getKey()); state.getTaskReferences().put(task.getKey(), stateTaskReference); @@ -378,8 +385,8 @@ public class TestApexPolicyModelCreator implements TestApexModelCreator<AxPolicy public AxPolicyModel getWarningModel() { final AxPolicyModel policyModel = getModel(); - final AxState anotherState = - new AxState(new AxReferenceKey(new AxArtifactKey("policy", "0.0.1"), "anotherState")); + final AxState anotherState = new AxState( + new AxReferenceKey(new AxArtifactKey("policy", "0.0.1"), "anotherState")); final AxEvent inEvent = policyModel.getEvents().getEventMap().get(new AxArtifactKey("inEvent", "0.0.1")); final AxEvent outEvent0 = policyModel.getEvents().getEventMap().get(new AxArtifactKey("outEvent0", "0.0.1")); @@ -388,44 +395,44 @@ public class TestApexPolicyModelCreator implements TestApexModelCreator<AxPolicy for (final AxField field : inEvent.getFields()) { final AxReferenceKey fieldkey = new AxReferenceKey(anotherTask.getKey().getName(), - anotherTask.getKey().getVersion(), "inputFields", field.getKey().getLocalName()); + anotherTask.getKey().getVersion(), "inputFields", field.getKey().getLocalName()); final AxInputField inputField = new AxInputField(fieldkey, field.getSchema()); anotherTask.getInputFields().put(inputField.getKey().getLocalName(), inputField); } for (final AxField field : outEvent0.getFields()) { final AxReferenceKey fieldkey = new AxReferenceKey(anotherTask.getKey().getName(), - anotherTask.getKey().getVersion(), "outputFields", field.getKey().getLocalName()); + anotherTask.getKey().getVersion(), "outputFields", field.getKey().getLocalName()); final AxOutputField outputField = new AxOutputField(fieldkey, field.getSchema()); anotherTask.getOutputFields().put(outputField.getKey().getLocalName(), outputField); } final AxTaskParameter taskPar0 = new AxTaskParameter(new AxReferenceKey(anotherTask.getKey(), "taskParameter0"), - "Task parameter 0 value"); + "Task parameter 0 value"); final AxTaskParameter taskPar1 = new AxTaskParameter(new AxReferenceKey(anotherTask.getKey(), "taskParameter1"), - "Task parameter 1 value"); + "Task parameter 1 value"); anotherTask.getTaskParameters().put(taskPar0.getKey().getLocalName(), taskPar0); anotherTask.getTaskParameters().put(taskPar1.getKey().getLocalName(), taskPar1); - final AxTaskLogic taskLogic = - new AxTaskLogic(new AxReferenceKey(anotherTask.getKey(), "taskLogic"), "MVEL", "Some task logic"); + final AxTaskLogic taskLogic = new AxTaskLogic(new AxReferenceKey(anotherTask.getKey(), "taskLogic"), "MVEL", + "Some task logic"); anotherTask.setTaskLogic(taskLogic); policyModel.getTasks().getTaskMap().put(anotherTask.getKey(), anotherTask); - final AxStateOutput anotherStateOutput0 = - new AxStateOutput(new AxReferenceKey(anotherState.getKey(), "stateOutput0"), outEvent0.getKey(), + final AxStateOutput anotherStateOutput0 = new AxStateOutput( + new AxReferenceKey(anotherState.getKey(), "stateOutput0"), outEvent0.getKey(), AxReferenceKey.getNullKey()); anotherState.setTrigger(inEvent.getKey()); anotherState.getStateOutputs().put(anotherStateOutput0.getKey().getLocalName(), anotherStateOutput0); anotherState.setDefaultTask(anotherTask.getKey()); - final AxStateTaskReference anotherStateTaskReference = - new AxStateTaskReference(new AxReferenceKey(anotherState.getKey(), anotherTask.getKey().getName()), + final AxStateTaskReference anotherStateTaskReference = new AxStateTaskReference( + new AxReferenceKey(anotherState.getKey(), anotherTask.getKey().getName()), AxStateTaskOutputType.DIRECT, anotherStateOutput0.getKey()); anotherState.getTaskReferences().put(anotherTask.getKey(), anotherStateTaskReference); policyModel.getPolicies().getPolicyMap().get(new AxArtifactKey("policy", "0.0.1")).getStateMap() - .put(anotherState.getKey().getLocalName(), anotherState); + .put(anotherState.getKey().getLocalName(), anotherState); policyModel.getKeyInformation().generateKeyInfo(policyModel); diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/TestPolicyLogicReader.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/TestPolicyLogicReader.java index 446cbeed8..bb16c90d1 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/TestPolicyLogicReader.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/TestPolicyLogicReader.java @@ -31,6 +31,8 @@ import org.onap.policy.apex.model.policymodel.concepts.AxLogic; import org.onap.policy.apex.model.policymodel.handling.PolicyLogicReader; /** + * Logic reader for policy tests. + * * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TestPolicyLogicReader { @@ -51,9 +53,8 @@ public class TestPolicyLogicReader { new AxLogic(logicKey, "FunkyLogic", plReader); fail("test should throw an exception here"); } catch (final Exception e) { - assertEquals( - "logic not found for logic \"somewhere/over/the/rainbow/funkylogic/FunkyDefaultLogic.funkylogic\"", - e.getMessage()); + assertEquals("logic not found for logic " + + "\"somewhere/over/the/rainbow/funkylogic/FunkyDefaultLogic.funkylogic\"", e.getMessage()); } plReader.setDefaultLogic(null); @@ -61,9 +62,9 @@ public class TestPolicyLogicReader { new AxLogic(logicKey, "FunkyLogic", plReader); fail("test should throw an exception here"); } catch (final Exception e) { - assertEquals( - "logic not found for logic \"somewhere/over/the/rainbow/funkylogic/LogicParent_LogicInstanceName.funkylogic\"", - e.getMessage()); + assertEquals("logic not found for logic " + + "\"somewhere/over/the/rainbow/funkylogic/LogicParent_LogicInstanceName.funkylogic\"", + e.getMessage()); } logicKey.setParentLocalName("LogicParentLocalName"); @@ -71,9 +72,8 @@ public class TestPolicyLogicReader { new AxLogic(logicKey, "FunkyLogic", plReader); fail("test should throw an exception here"); } catch (final Exception e) { - assertEquals( - "logic not found for logic \"somewhere/over/the/rainbow/funkylogic/LogicParent_LogicParentLocalName_LogicInstanceName.funkylogic\"", - e.getMessage()); + assertEquals("logic not found for logic " + "\"somewhere/over/the/rainbow/funkylogic/" + + "LogicParent_LogicParentLocalName_LogicInstanceName.funkylogic\"", e.getMessage()); } plReader.setLogicPackage("path.to.apex.logic"); @@ -98,7 +98,7 @@ public class TestPolicyLogicReader { try { final AxLogic logic = new AxLogic(logicKey, "JAVA", plReader); assertEquals("somewhere.over.the.rainbow.java.LogicParent_LogicParentLocalName_LogicInstanceName", - logic.getLogic()); + logic.getLogic()); } catch (final Exception e) { fail("test should not throw an exception"); } diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/TestPolicyModelMerger.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/TestPolicyModelMerger.java index 92d1dc32a..8f717a234 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/TestPolicyModelMerger.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/TestPolicyModelMerger.java @@ -31,6 +31,8 @@ import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; import org.onap.policy.apex.model.policymodel.handling.PolicyModelMerger; /** + * Test model merging. + * * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TestPolicyModelMerger { @@ -41,8 +43,8 @@ public class TestPolicyModelMerger { AxPolicyModel rightPolicyModel = new TestApexPolicyModelCreator().getModel(); try { - final AxPolicyModel mergedPolicyModel = - PolicyModelMerger.getMergedPolicyModel(leftPolicyModel, rightPolicyModel, false); + final AxPolicyModel mergedPolicyModel = PolicyModelMerger.getMergedPolicyModel(leftPolicyModel, + rightPolicyModel, false); assertEquals(leftPolicyModel, mergedPolicyModel); assertEquals(rightPolicyModel, mergedPolicyModel); } catch (final ApexModelException e) { @@ -66,8 +68,8 @@ public class TestPolicyModelMerger { leftPolicyModel.getKeyInformation().generateKeyInfo(leftPolicyModel); try { - final AxPolicyModel mergedPolicyModel = - PolicyModelMerger.getMergedPolicyModel(leftPolicyModel, rightPolicyModel, true); + final AxPolicyModel mergedPolicyModel = PolicyModelMerger.getMergedPolicyModel(leftPolicyModel, + rightPolicyModel, true); assertNotNull(mergedPolicyModel); } catch (final ApexModelException e) { fail("test should not throw an exception"); @@ -90,8 +92,8 @@ public class TestPolicyModelMerger { rightPolicyModel.getKeyInformation().generateKeyInfo(rightPolicyModel); try { - final AxPolicyModel mergedPolicyModel = - PolicyModelMerger.getMergedPolicyModel(leftPolicyModel, rightPolicyModel, false); + final AxPolicyModel mergedPolicyModel = PolicyModelMerger.getMergedPolicyModel(leftPolicyModel, + rightPolicyModel, false); assertNotNull(mergedPolicyModel); } catch (final ApexModelException e) { fail("test should not throw an exception"); @@ -99,8 +101,8 @@ public class TestPolicyModelMerger { rightPolicyModel = new TestApexPolicyModelCreator().getAnotherModel(); try { - final AxPolicyModel mergedPolicyModel = - PolicyModelMerger.getMergedPolicyModel(leftPolicyModel, rightPolicyModel, true); + final AxPolicyModel mergedPolicyModel = PolicyModelMerger.getMergedPolicyModel(leftPolicyModel, + rightPolicyModel, true); assertNotNull(mergedPolicyModel); } catch (final ApexModelException e) { fail("test should not throw an exception"); diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/utils/PolicyModelValidator.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/utils/PolicyModelValidator.java index 4610a827e..9cee85491 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/utils/PolicyModelValidator.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/utils/PolicyModelValidator.java @@ -28,11 +28,19 @@ import org.onap.policy.apex.model.basicmodel.handling.ApexModelException; import org.onap.policy.apex.model.basicmodel.handling.ApexModelReader; import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; +/** + * Main class to run the policy model validator. + */ public class PolicyModelValidator { + /** + * Main method. + * @param args the command line arguments + * @throws ApexModelException on errors on the apex model + * @throws FileNotFoundException on file find failures + */ public static void main(final String[] args) throws ApexModelException, FileNotFoundException { - final ApexModelReader<AxPolicyModel> policyModelReader = - new ApexModelReader<AxPolicyModel>(AxPolicyModel.class); - + final ApexModelReader<AxPolicyModel> policyModelReader = new ApexModelReader<AxPolicyModel>( + AxPolicyModel.class); final AxPolicyModel policyModel = policyModelReader.read(new FileInputStream(args[0])); final AxValidationResult result = policyModel.validate(new AxValidationResult()); diff --git a/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/Assertions.java b/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/Assertions.java index 80a71f8aa..a3ecccebe 100644 --- a/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/Assertions.java +++ b/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/Assertions.java @@ -41,18 +41,18 @@ public final class Assertions { * @param pattern The regular expression * @return null if the parameter is valid, the validation message otherwise */ - public static String getStringParameterValidationMessage(final String parameterName, final String parameterValue, final String pattern) { + public static String getStringParameterValidationMessage(final String parameterName, final String parameterValue, + final String pattern) { try { validateStringParameter(parameterName, parameterValue, pattern); - } - catch (IllegalArgumentException e) { + } catch (IllegalArgumentException e) { // This will cause a SONAR error but eliminates all SONAR messages in callers return e.getMessage(); } - + return null; } - + /** * Checks if a string parameter matches a regular expression. * @@ -61,7 +61,8 @@ public final class Assertions { * @param pattern The regular expression * @return the trimmed string */ - public static String validateStringParameter(final String parameterName, final String parameterValue, final String pattern) { + public static String validateStringParameter(final String parameterName, final String parameterValue, + final String pattern) { argumentNotNull(parameterName, "parameter name is null"); argumentNotNull(parameterValue, "parameter \"" + parameterName + "\" is null"); argumentNotNull(pattern, "parameter pattern is null"); @@ -69,10 +70,9 @@ public final class Assertions { final String trimmedValue = parameterValue.trim(); if (trimmedValue.matches(pattern)) { return trimmedValue; - } - else { - throw new IllegalArgumentException( - "parameter \"" + parameterName + "\": value \"" + parameterValue + "\", does not match regular expression \"" + pattern + "\""); + } else { + throw new IllegalArgumentException("parameter \"" + parameterName + "\": value \"" + parameterValue + + "\", does not match regular expression \"" + pattern + "\""); } } @@ -102,7 +102,8 @@ public final class Assertions { } /** - * Used as a shorthand to check that method arguments are not null, throws an exception of the specified type on error. + * Used as a shorthand to check that method arguments are not null, throws an exception of the specified type on + * error. * * @param <T> the generic type of the argument to check * @param <E> the exception to throw if incoming value is null @@ -111,20 +112,21 @@ public final class Assertions { * @param message the error message to issue * @throws E an instance of the passed Exception Class */ - public static <T, E extends Exception> void argumentNotNull(final T value, final Class<E> exceptionClass, final String message) throws E { + public static <T, E extends Exception> void argumentOfClassNotNull(final T value, final Class<E> exceptionClass, + final String message) throws E { if (value == null) { // Instantiate the exception and throw it try { throw exceptionClass.getConstructor(String.class).newInstance(message); - } - catch (final Exception errorException) { + } catch (final Exception errorException) { throw new IllegalArgumentException(message, errorException); } } } /** - * Used as a shorthand to check that method argument is not false, throws an exception of the specified type on error. + * Used as a shorthand to check that method argument is not false, throws an exception of the specified type on + * error. * * @param <E> the exception to throw if incoming value is false * @param value the value to check if false @@ -132,20 +134,21 @@ public final class Assertions { * @param message the error message to issue * @throws E an instance of the passed Exception Class */ - public static <E extends Exception> void argumentNotFalse(final boolean value, final Class<E> exceptionClass, final String message) throws E { + public static <E extends Exception> void argumentOfClassNotFalse(final boolean value, final Class<E> exceptionClass, + final String message) throws E { if (!value) { // Instantiate the exception and throw it try { throw exceptionClass.getConstructor(String.class).newInstance(message); - } - catch (final Exception errorException) { + } catch (final Exception errorException) { throw new IllegalArgumentException(message, errorException); } } } /** - * Used as a shorthand to check that an object is an instance of a given class, throws IllegalArgumentException on error. + * Used as a shorthand to check that an object is an instance of a given class, throws IllegalArgumentException on + * error. * * @param <T> the generic type of the argument to check * @param objectInstance the object instance for which to check the class @@ -154,12 +157,14 @@ public final class Assertions { */ public static <T> void instanceOf(final Object objectInstance, final Class<T> requiredClass) { if (!requiredClass.isAssignableFrom(objectInstance.getClass())) { - throw new IllegalArgumentException(objectInstance.getClass().getCanonicalName() + " is not an instance of " + requiredClass.getCanonicalName()); + throw new IllegalArgumentException(objectInstance.getClass().getCanonicalName() + " is not an instance of " + + requiredClass.getCanonicalName()); } } /** - * Used as a shorthand to check that an instance of a class can be an instance of a given class, throws IllegalArgumentException on error. + * Used as a shorthand to check that an instance of a class can be an instance of a given class, throws + * IllegalArgumentException on error. * * @param <T> the generic type of the argument to check * @param checkClass the class to check @@ -168,7 +173,8 @@ public final class Assertions { */ public static <T> void assignableFrom(final Class<?> checkClass, final Class<T> requiredClass) { if (!requiredClass.isAssignableFrom(checkClass)) { - throw new IllegalArgumentException(checkClass.getCanonicalName() + " is not an instance of " + requiredClass.getCanonicalName()); + throw new IllegalArgumentException(checkClass.getCanonicalName() + " is not an instance of " + + requiredClass.getCanonicalName()); } } } diff --git a/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/CollectionUtils.java b/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/CollectionUtils.java index 7ca50a613..0d90d8ceb 100644 --- a/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/CollectionUtils.java +++ b/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/CollectionUtils.java @@ -43,7 +43,8 @@ public abstract class CollectionUtils { * @param rightList The rightmost list * @return an integer indicating how different the lists are */ - public static <T> int compareLists(final List<? extends Comparable<T>> leftList, final List<? extends Comparable<T>> rightList) { + public static <T> int compareLists(final List<? extends Comparable<T>> leftList, + final List<? extends Comparable<T>> rightList) { // Check for nulls if (leftList == null && rightList == null) { return 0; @@ -59,7 +60,7 @@ public abstract class CollectionUtils { if (leftList.equals(rightList)) { return 0; } - + return compareListEntries(leftList, rightList); } @@ -71,8 +72,9 @@ public abstract class CollectionUtils { * @param rightList The rightmost list * @return an integer indicating how different the lists are */ - private static <T> int compareListEntries(final List<? extends Comparable<T>> leftList, final List<? extends Comparable<T>> rightList) { - + private static <T> int compareListEntries(final List<? extends Comparable<T>> leftList, + final List<? extends Comparable<T>> rightList) { + // Iterate down the lists till we find a difference final ListIterator<?> leftIterator = leftList.listIterator(); final ListIterator<?> rightIterator = rightList.listIterator(); @@ -104,5 +106,5 @@ public abstract class CollectionUtils { return comparisonResult; } } - } + } } diff --git a/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/DirectoryDeleteShutdownHook.java b/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/DirectoryDeleteShutdownHook.java new file mode 100644 index 000000000..5f9b8aaf8 --- /dev/null +++ b/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/DirectoryDeleteShutdownHook.java @@ -0,0 +1,56 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 Ericsson. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.apex.model.utilities; + +import java.io.File; + +/** + * The Class DirectoryShutdownHook removes the contents of a directory and the directory itself at shutdown. + * + * @author Liam Fallon (liam.fallon@ericsson.com) + */ +final class DirectoryDeleteShutdownHook extends Thread { + // The directory we are acting on + private final File tempDir; + + /** + * Constructor that defines the directory to act on at shutdown. + * + * @param tempDir The temporary directory to delete + */ + DirectoryDeleteShutdownHook(final File tempDir) { + this.tempDir = tempDir; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Runnable#run() + */ + @Override + public void run() { + if (tempDir.exists()) { + // Empty and delete the directory + DirectoryUtils.emptyDirectory(tempDir); + tempDir.delete(); + } + } +} diff --git a/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/DirectoryUtils.java b/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/DirectoryUtils.java index 00e5cb4cf..7cd5228cc 100644 --- a/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/DirectoryUtils.java +++ b/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/DirectoryUtils.java @@ -26,8 +26,8 @@ import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; /** - * This is common utility class with static methods for handling directories. It is an abstract class to prevent any direct instantiation and private - * constructor to prevent extending this class. + * This is common utility class with static methods for handling directories. It is an abstract class to prevent any + * direct instantiation and private constructor to prevent extending this class. * * @author Liam Fallon (liam.fallon@ericsson.com) */ @@ -42,9 +42,11 @@ public abstract class DirectoryUtils { } /** - * Method to get an empty temporary directory in the system temporary directory on the local machine that will be deleted on (normal) shutdown. + * Method to get an empty temporary directory in the system temporary directory on the local machine that will be + * deleted on (normal) shutdown. * - * @param nameprefix The prefix of the filename. System.nanoTime() will be appended to the pattern to create a unique file pattern + * @param nameprefix The prefix of the filename. System.nanoTime() will be appended to the pattern to create a + * unique file pattern * @return The temporary directory */ public static File getLocalTempDirectory(final String nameprefix) { @@ -66,8 +68,7 @@ public abstract class DirectoryUtils { LOGGER.trace("creating temp directory\"{}\" : ", tempDir.getAbsolutePath()); return tempDir; - } - catch (final Exception e) { + } catch (final Exception e) { LOGGER.debug("error creating temp directory\"{}\" : " + e.getMessage(), e); return null; } @@ -103,36 +104,3 @@ public abstract class DirectoryUtils { return true; } } - -/** - * The Class DirectoryShutdownHook removes the contents of a directory and the directory itself at shutdown. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ -final class DirectoryDeleteShutdownHook extends Thread { - // The directory we are acting on - private final File tempDir; - - /** - * Constructor that defines the directory to act on at shutdown. - * - * @param tempDir The temporary directory to delete - */ - DirectoryDeleteShutdownHook(final File tempDir) { - this.tempDir = tempDir; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Runnable#run() - */ - @Override - public void run() { - if (tempDir.exists()) { - // Empty and delete the directory - DirectoryUtils.emptyDirectory(tempDir); - tempDir.delete(); - } - } -} diff --git a/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/comparison/KeyComparer.java b/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/comparison/KeyComparer.java index 8903ea803..f4d628405 100644 --- a/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/comparison/KeyComparer.java +++ b/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/comparison/KeyComparer.java @@ -21,8 +21,8 @@ package org.onap.policy.apex.model.utilities.comparison; /** - * This class compares two keys and returns their differences. It is used in bulk comparisons in models where maps of keys are being compared. The - * {@link KeyComparer} that is returned does the actual comparison + * This class compares two keys and returns their differences. It is used in bulk comparisons in models where maps of + * keys are being compared. The {@link KeyComparer} that is returned does the actual comparison * * @author Liam Fallon (liam.fallon@ericsson.com) * @param <K> the type of key being compared diff --git a/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/comparison/KeyDifference.java b/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/comparison/KeyDifference.java index 43c44aefe..2eb6af894 100644 --- a/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/comparison/KeyDifference.java +++ b/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/comparison/KeyDifference.java @@ -21,7 +21,8 @@ package org.onap.policy.apex.model.utilities.comparison; /** - * This class is used to template key differences for bulk key comparisons in models. It performs a difference check between two keys. + * This class is used to template key differences for bulk key comparisons in models. It performs a difference check + * between two keys. * * @author Liam Fallon (liam.fallon@ericsson.com) * @param <K> the generic type @@ -86,8 +87,7 @@ public class KeyDifference<K> { builder.append(rightKey); builder.append('\n'); } - } - else { + } else { builder.append("left key "); builder.append(leftKey); builder.append(" and right key "); diff --git a/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/comparison/KeyedMapComparer.java b/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/comparison/KeyedMapComparer.java index b11f77a0f..24ff55263 100644 --- a/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/comparison/KeyedMapComparer.java +++ b/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/comparison/KeyedMapComparer.java @@ -27,9 +27,10 @@ import java.util.Set; import java.util.TreeSet; /** - * Compare two maps and returns their differences. The types of the keys and the values in the two maps being comapred must be the same. The class returns - * entries that are only in the left map, only in the right map, entries that have identical keys and different values and entries that have different keys and - * different values in a {@link KeyedMapDifference} instance. + * Compare two maps and returns their differences. The types of the keys and the values in the two maps being comapred + * must be the same. The class returns entries that are only in the left map, only in the right map, entries that have + * identical keys and different values and entries that have different keys and different values in a + * {@link KeyedMapDifference} instance. * * @author Liam Fallon (liam.fallon@ericsson.com) * @param <K> the type of the keys in the maps being compared @@ -79,8 +80,7 @@ public class KeyedMapComparer<K, V> { // Store as appropriate if (leftValue.equals(rightValue)) { result.getIdenticalValues().put(key, leftValue); - } - else { + } else { // Store the two values List<V> valueList = new ArrayList<>(); valueList.add(leftValue); diff --git a/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/comparison/KeyedMapDifference.java b/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/comparison/KeyedMapDifference.java index 0f9d6ca50..a7022d84d 100644 --- a/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/comparison/KeyedMapDifference.java +++ b/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/comparison/KeyedMapDifference.java @@ -26,181 +26,183 @@ import java.util.Map.Entry; import java.util.TreeMap; /** - * This class holds the result of a difference check between two keyed maps. Four results are returned in the class. The {@code leftOnly} result is the entries - * that appear only in the left map. the {@code rightOnly} result is the entries that appear only in the right map. The {@code differentValues} result are the - * entries that have the same key but different values in the maps being compared. The {@code identicalValues} result are the entries with identical keys and - * values in both maps being compared. + * This class holds the result of a difference check between two keyed maps. Four results are returned in the class. The + * {@code leftOnly} result is the entries that appear only in the left map. the {@code rightOnly} result is the entries + * that appear only in the right map. The {@code differentValues} result are the entries that have the same key but + * different values in the maps being compared. The {@code identicalValues} result are the entries with identical keys + * and values in both maps being compared. * * @author Liam Fallon (liam.fallon@ericsson.com) * @param <K> the generic type * @param <V> the generic type */ public class KeyedMapDifference<K, V> { - private static final String KEY = "key="; - private static final String VALUE = ",value="; - - // Three maps to hold the comparison result - private Map<K, V> leftOnly = new TreeMap<>(); - private Map<K, V> rightOnly = new TreeMap<>(); - private Map<K, V> identicalValues = new TreeMap<>(); - private Map<K, List<V>> differentValues = new TreeMap<>(); - - /** - * Gets the entries that were found only in the left map. - * - * @return the entries only in the left map - */ - public Map<K, V> getLeftOnly() { - return leftOnly; - } - - /** - * Gets the entries that were found only in the right map. - * - * @return the entries only in the right map - */ - public Map<K, V> getRightOnly() { - return rightOnly; - } - - /** - * Gets the entries that were identical (keys and values the same) in both maps. - * - * @return the identical entries - */ - public Map<K, V> getIdenticalValues() { - return identicalValues; - } - - /** - * Gets the entries that had the same key but different values in both maps. - * - * @return the entries that were different. There are two values in the list of values for each entry. The first value is the value that was in the left map - * and the second value is the value that was in the right map. - */ - public Map<K, List<V>> getDifferentValues() { - return differentValues; - } - - /** - * Return a string representation of the differences. - * - * @param diffsOnly if set, then a blank string is returned if the maps are equal - * @param keysOnly if set, then a terse string that prints only the keys is returned, otherwise both keys and values are printed - * @return the string - */ - public String asString(final boolean diffsOnly, final boolean keysOnly) { - StringBuilder builder = new StringBuilder(); - - if (leftOnly.isEmpty()) { - if (!diffsOnly) { - builder.append("*** all left keys in right\n"); - } - } - else { - builder.append(getInOneSideOnlyAsString(leftOnly, "left", keysOnly)); - } - - if (leftOnly.isEmpty()) { - if (!diffsOnly) { - builder.append("*** all right keys in left\n"); - } - } - else { - builder.append(getInOneSideOnlyAsString(rightOnly, "right", keysOnly)); - } - - if (differentValues.isEmpty()) { - if (!diffsOnly) { - builder.append("*** all values in left and right are identical\n"); - } - } - else { - builder.append(getDifferencesAsString(keysOnly)); - } - - if (!diffsOnly) { - builder.append(getIdenticalsAsString(keysOnly)); - } - - return builder.toString(); - } - - /** - * Output the entries in a map with entries that are in one side only as a string - * @param sideMap the map for the side being checked - * @param sideMapString the string that represents the map in output strings - * @param keysOnly if true, just add key information and not entries - * @return the entries as a string - */ - private Object getInOneSideOnlyAsString(final Map<K, V> sideMap, final String sideMapString, final boolean keysOnly) { - StringBuilder builder = new StringBuilder(); - - builder.append("*** list of keys on " + sideMapString + " only\n"); - for (Entry<K, V> leftEntry : sideMap.entrySet()) { - builder.append(KEY); - builder.append(leftEntry.getKey()); - if (!keysOnly) { - builder.append(VALUE); - builder.append(leftEntry.getValue()); - } - builder.append('\n'); - } - - return builder.toString(); - } - - /** - * Output the differences between two the maps as a string - * @param keysOnly if true, just add key information and not entries - * @return the differences as a string - */ - private String getDifferencesAsString(final boolean keysOnly) { - StringBuilder builder = new StringBuilder(); - - builder.append("*** list of differing entries between left and right\n"); - for (Entry<K, List<V>> differentEntry : differentValues.entrySet()) { - builder.append(KEY); - builder.append(differentEntry.getKey()); - if (!keysOnly) { - builder.append(",values={"); - boolean first = true; - for (V differentEntryValue : differentEntry.getValue()) { - builder.append(differentEntryValue); - if (first) { - first = false; - } - else { - builder.append(','); - } - } - builder.append("}"); - } - builder.append('\n'); - } - - return builder.toString(); - } - - /** - * Output the identical entries in the maps as a string - * @param keysOnly if true, just add key information and not entries - * @return the identical entries as a string - */ - private String getIdenticalsAsString(final boolean keysOnly) { - StringBuilder builder = new StringBuilder(); - - builder.append("*** list of identical entries in left and right\n"); - for (Entry<K, V> identicalEntry : identicalValues.entrySet()) { - builder.append(KEY); - builder.append(identicalEntry.getKey()); - if (!keysOnly) { - builder.append(VALUE); - builder.append(identicalEntry.getValue()); - } - builder.append('\n'); - } - - return builder.toString(); - } + private static final String KEY = "key="; + private static final String VALUE = ",value="; + + // Three maps to hold the comparison result + private Map<K, V> leftOnly = new TreeMap<>(); + private Map<K, V> rightOnly = new TreeMap<>(); + private Map<K, V> identicalValues = new TreeMap<>(); + private Map<K, List<V>> differentValues = new TreeMap<>(); + + /** + * Gets the entries that were found only in the left map. + * + * @return the entries only in the left map + */ + public Map<K, V> getLeftOnly() { + return leftOnly; + } + + /** + * Gets the entries that were found only in the right map. + * + * @return the entries only in the right map + */ + public Map<K, V> getRightOnly() { + return rightOnly; + } + + /** + * Gets the entries that were identical (keys and values the same) in both maps. + * + * @return the identical entries + */ + public Map<K, V> getIdenticalValues() { + return identicalValues; + } + + /** + * Gets the entries that had the same key but different values in both maps. + * + * @return the entries that were different. There are two values in the list of values for each entry. The first + * value is the value that was in the left map and the second value is the value that was in the right map. + */ + public Map<K, List<V>> getDifferentValues() { + return differentValues; + } + + /** + * Return a string representation of the differences. + * + * @param diffsOnly if set, then a blank string is returned if the maps are equal + * @param keysOnly if set, then a terse string that prints only the keys is returned, otherwise both keys and values + * are printed + * @return the string + */ + public String asString(final boolean diffsOnly, final boolean keysOnly) { + StringBuilder builder = new StringBuilder(); + + if (leftOnly.isEmpty()) { + if (!diffsOnly) { + builder.append("*** all left keys in right\n"); + } + } else { + builder.append(getInOneSideOnlyAsString(leftOnly, "left", keysOnly)); + } + + if (leftOnly.isEmpty()) { + if (!diffsOnly) { + builder.append("*** all right keys in left\n"); + } + } else { + builder.append(getInOneSideOnlyAsString(rightOnly, "right", keysOnly)); + } + + if (differentValues.isEmpty()) { + if (!diffsOnly) { + builder.append("*** all values in left and right are identical\n"); + } + } else { + builder.append(getDifferencesAsString(keysOnly)); + } + + if (!diffsOnly) { + builder.append(getIdenticalsAsString(keysOnly)); + } + + return builder.toString(); + } + + /** + * Output the entries in a map with entries that are in one side only as a string. + * + * @param sideMap the map for the side being checked + * @param sideMapString the string that represents the map in output strings + * @param keysOnly if true, just add key information and not entries + * @return the entries as a string + */ + private Object getInOneSideOnlyAsString(final Map<K, V> sideMap, final String sideMapString, + final boolean keysOnly) { + StringBuilder builder = new StringBuilder(); + + builder.append("*** list of keys on " + sideMapString + " only\n"); + for (Entry<K, V> leftEntry : sideMap.entrySet()) { + builder.append(KEY); + builder.append(leftEntry.getKey()); + if (!keysOnly) { + builder.append(VALUE); + builder.append(leftEntry.getValue()); + } + builder.append('\n'); + } + + return builder.toString(); + } + + /** + * Output the differences between two the maps as a string. + * + * @param keysOnly if true, just add key information and not entries + * @return the differences as a string + */ + private String getDifferencesAsString(final boolean keysOnly) { + StringBuilder builder = new StringBuilder(); + + builder.append("*** list of differing entries between left and right\n"); + for (Entry<K, List<V>> differentEntry : differentValues.entrySet()) { + builder.append(KEY); + builder.append(differentEntry.getKey()); + if (!keysOnly) { + builder.append(",values={"); + boolean first = true; + for (V differentEntryValue : differentEntry.getValue()) { + builder.append(differentEntryValue); + if (first) { + first = false; + } else { + builder.append(','); + } + } + builder.append("}"); + } + builder.append('\n'); + } + + return builder.toString(); + } + + /** + * Output the identical entries in the maps as a string. + * + * @param keysOnly if true, just add key information and not entries + * @return the identical entries as a string + */ + private String getIdenticalsAsString(final boolean keysOnly) { + StringBuilder builder = new StringBuilder(); + + builder.append("*** list of identical entries in left and right\n"); + for (Entry<K, V> identicalEntry : identicalValues.entrySet()) { + builder.append(KEY); + builder.append(identicalEntry.getKey()); + if (!keysOnly) { + builder.append(VALUE); + builder.append(identicalEntry.getValue()); + } + builder.append('\n'); + } + + return builder.toString(); + } } diff --git a/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/json/JSONHandler.java b/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/json/JsonHandler.java index eb42a4efa..9ec5f590e 100644 --- a/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/json/JSONHandler.java +++ b/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/json/JsonHandler.java @@ -20,20 +20,20 @@ package org.onap.policy.apex.model.utilities.json; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; - /** * This class reads objects of the given class from an input stream. * * @author Liam Fallon (liam.fallon@ericsson.com) - * @param <TYPE> the generic type + * @param <P> the generic type */ -public class JSONHandler<TYPE> { +public class JsonHandler<P> { /** * This method reads objects of a given class from an input stream. @@ -42,7 +42,7 @@ public class JSONHandler<TYPE> { * @param inputStream the input stream to read from * @return the object read */ - public TYPE read(final Class<TYPE> inputClass, final InputStream inputStream) { + public P read(final Class<P> inputClass, final InputStream inputStream) { // Register the adapters for our carrier technologies and event protocols with GSON final GsonBuilder gsonBuilder = new GsonBuilder(); diff --git a/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/typeutils/ClassBuilder.java b/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/typeutils/ClassBuilder.java index e806bd7a0..ffebc405f 100644 --- a/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/typeutils/ClassBuilder.java +++ b/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/typeutils/ClassBuilder.java @@ -29,9 +29,9 @@ import sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl; //CHECKSTYLE:ON: checkstyle:IllegalImport /** - * This class is a utility class that builds a class with a set of user defined fields. It is used to get the Type of fields in Java schemas<br> - * For more information see:<br> - * <a href="http://stackoverflow.com/questions/39401083/class-forname-equivalent-for-creating-parameterizedtypes-from-string"> + * This class is a utility class that builds a class with a set of user defined fields. It is used to get the Type of + * fields in Java schemas<br> For more information see:<br> <a + * href="http://stackoverflow.com/questions/39401083/class-forname-equivalent-for-creating-parameterizedtypes-from-string"> * http://stackoverflow.com/questions/39401083/class-forname-equivalent-for-creating-parameterizedtypes-from-string</a><br> * <a href="https://github.com/KetothXupack/stackoverflow-answers/tree/master/q39401083"> * https://github.com/KetothXupack/stackoverflow-answers/tree/master/q39401083</a><br> @@ -59,13 +59,12 @@ public class ClassBuilder { public static ClassBuilder parse(final String className) { try { return new ClassBuilder(Class.forName(className)); - } - catch (ClassNotFoundException e) { + } catch (ClassNotFoundException e) { try { return new ClassBuilder(Class.forName("java.lang." + className)); - } - catch (Exception ignore) { - throw new IllegalArgumentException("Class '" + className + "' not found. Also looked for a class called 'java.lang." + className + "'", e); + } catch (Exception ignore) { + throw new IllegalArgumentException("Class '" + className + + "' not found. Also looked for a class called 'java.lang." + className + "'", e); } } } @@ -89,11 +88,11 @@ public class ClassBuilder { if (parameters.isEmpty()) { return clazz; } - Type[] paramtypes = new Type[parameters.size()]; - int i = 0; + Type[] paramTypes = new Type[parameters.size()]; + int paramTypeIndex = 0; for (ClassBuilder classBuilder : parameters) { - paramtypes[i++] = classBuilder.build(); + paramTypes[paramTypeIndex++] = classBuilder.build(); } - return ParameterizedTypeImpl.make(clazz, paramtypes, null); + return ParameterizedTypeImpl.make(clazz, paramTypes, null); } } diff --git a/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/typeutils/TypeBuilder.java b/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/typeutils/TypeBuilder.java index 0e3851519..ecda86f59 100644 --- a/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/typeutils/TypeBuilder.java +++ b/model/utilities/src/main/java/org/onap/policy/apex/model/utilities/typeutils/TypeBuilder.java @@ -47,7 +47,8 @@ public final class TypeBuilder { */ public static Type build(final String type) { if (type == null || type.length() == 0) { - throw new IllegalArgumentException("Blank type string passed to " + TypeBuilder.class.getCanonicalName() + ".build(String type)"); + throw new IllegalArgumentException("Blank type string passed to " + TypeBuilder.class.getCanonicalName() + + ".build(String type)"); } try { @@ -59,8 +60,7 @@ public final class TypeBuilder { parser.setErrorHandler(new BailErrorStrategy()); parser.setBuildParseTree(true); return parser.type().value.build(); - } - catch (final Exception e) { + } catch (final Exception e) { throw new IllegalArgumentException("Failed to build type '" + type + "': " + e, e); } } @@ -84,16 +84,16 @@ public final class TypeBuilder { public static Class<?> getJavaTypeClass(final Type type) { if (type instanceof Class<?>) { return (Class<?>) type; - } - else if (type instanceof ParameterizedType) { + } else if (type instanceof ParameterizedType) { final Type raw = ((ParameterizedType) type).getRawType(); if (!(raw instanceof Class<?>)) { - throw new IllegalArgumentException( - "The Parameterised javatype " + type + " with base type " + raw + " is not a Java 'Class' that can be instantiated"); + throw new IllegalArgumentException("The Parameterised javatype " + type + " with base type " + raw + + " is not a Java 'Class' that can be instantiated"); } return (Class<?>) raw; } - throw new IllegalArgumentException("The Parameterised javatype " + type + " is not a Java 'Type' that has a 'Class'"); + throw new IllegalArgumentException( + "The Parameterised javatype " + type + " is not a Java 'Type' that has a 'Class'"); } /** @@ -105,10 +105,10 @@ public final class TypeBuilder { public static Type[] getJavaTypeParameters(final Type type) { if (type instanceof Class<?>) { return new Type[0]; - } - else if (type instanceof ParameterizedType) { + } else if (type instanceof ParameterizedType) { return ((ParameterizedType) type).getActualTypeArguments(); } - throw new IllegalArgumentException("\"The Parameterised javatype \" + type + \" is not a Java 'Type' that has parameter types"); + throw new IllegalArgumentException( + "\"The Parameterised javatype \" + type + \" is not a Java 'Type' that has parameter types"); } } diff --git a/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/AssertionsTest.java b/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/AssertionsTest.java index db25147c3..d1040b64b 100644 --- a/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/AssertionsTest.java +++ b/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/AssertionsTest.java @@ -34,66 +34,60 @@ public class AssertionsTest { @Test public void testAssertions() { Assertions.argumentNotFalse(true, "it is true"); - + try { Assertions.argumentNotFalse(false, "it is false"); - } - catch (IllegalArgumentException e) { + } catch (IllegalArgumentException e) { assertEquals("it is false", e.getMessage()); } - - Assertions.argumentNotFalse(true, ArithmeticException.class, "it is true"); - + + Assertions.argumentOfClassNotFalse(true, ArithmeticException.class, "it is true"); + try { - Assertions.argumentNotFalse(false, ArithmeticException.class, "it is false"); - } - catch (Exception e) { + Assertions.argumentOfClassNotFalse(false, ArithmeticException.class, "it is false"); + } catch (Exception e) { assertEquals("it is false", e.getMessage()); } - + Assertions.argumentNotNull("Hello", "it is OK"); - + try { Assertions.argumentNotNull(null, "it is null"); - } - catch (IllegalArgumentException e) { + } catch (IllegalArgumentException e) { assertEquals("it is null", e.getMessage()); } - Assertions.argumentNotNull(true, ArithmeticException.class, "it is OK"); - + Assertions.argumentOfClassNotNull(true, ArithmeticException.class, "it is OK"); + try { - Assertions.argumentNotNull(null, ArithmeticException.class, "it is null"); - } - catch (Exception e) { + Assertions.argumentOfClassNotNull(null, ArithmeticException.class, "it is null"); + } catch (Exception e) { assertEquals("it is null", e.getMessage()); } - + Assertions.assignableFrom(java.util.TreeMap.class, java.util.Map.class); - + try { Assertions.assignableFrom(java.util.Map.class, java.util.TreeMap.class); - } - catch (IllegalArgumentException e) { + } catch (IllegalArgumentException e) { assertEquals("java.util.Map is not an instance of java.util.TreeMap", e.getMessage()); } - + Assertions.instanceOf("Hello", String.class); - + try { Assertions.instanceOf(100, String.class); - } - catch (IllegalArgumentException e) { + } catch (IllegalArgumentException e) { assertEquals("java.lang.Integer is not an instance of java.lang.String", e.getMessage()); } - + Assertions.validateStringParameter("name", "MyName", "^M.*e$"); try { Assertions.validateStringParameter("name", "MyName", "^M.*f$"); - } - catch (IllegalArgumentException e) { - assertEquals("parameter \"name\": value \"MyName\", does not match regular expression \"^M.*f$\"", e.getMessage()); + } catch (IllegalArgumentException e) { + assertEquals("parameter \"name\": value \"MyName\", does not match regular expression \"^M.*f$\"", + e.getMessage()); } } } diff --git a/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/CollectionUtilitiesTest.java b/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/CollectionUtilitiesTest.java index e9ddc11bc..22c630bbf 100644 --- a/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/CollectionUtilitiesTest.java +++ b/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/CollectionUtilitiesTest.java @@ -20,7 +20,7 @@ package org.onap.policy.apex.model.utilities; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; import java.util.ArrayList; import java.util.List; @@ -33,17 +33,17 @@ public class CollectionUtilitiesTest { @Test public void testNullLists() { int result = 0; - + result = CollectionUtils.compareLists(null, null); assertEquals(0, result); - List<String> leftList = new ArrayList<String>(); + List<String> leftList = new ArrayList<String>(); result = CollectionUtils.compareLists(leftList, null); assertEquals(-1, result); List<String> rightList = new ArrayList<String>(); - + result = CollectionUtils.compareLists(null, rightList); assertEquals(1, result); @@ -70,7 +70,7 @@ public class CollectionUtilitiesTest { rightList.add("CCB"); result = CollectionUtils.compareLists(leftList, rightList); assertEquals(-1, result); - + leftList.remove(leftList.size() - 1); rightList.remove(rightList.size() - 1); result = CollectionUtils.compareLists(leftList, rightList); @@ -80,7 +80,7 @@ public class CollectionUtilitiesTest { rightList.add("CCA"); result = CollectionUtils.compareLists(leftList, rightList); assertEquals(1, result); - + leftList.remove(leftList.size() - 1); rightList.remove(rightList.size() - 1); result = CollectionUtils.compareLists(leftList, rightList); diff --git a/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/TextFileUtilsTest.java b/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/TextFileUtilsTest.java index c84ee8618..d03dc7135 100644 --- a/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/TextFileUtilsTest.java +++ b/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/TextFileUtilsTest.java @@ -29,6 +29,7 @@ import java.io.IOException; import org.junit.Test; /** + * Test text file utilities. * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TextFileUtilsTest { diff --git a/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/TreeMapUtilsTest.java b/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/TreeMapUtilsTest.java index 10a31e3b9..791a4dcf9 100644 --- a/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/TreeMapUtilsTest.java +++ b/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/TreeMapUtilsTest.java @@ -30,6 +30,7 @@ import org.junit.Test; import org.onap.policy.apex.model.utilities.TreeMapUtils; /** + * Test the tree map utilities. * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TreeMapUtilsTest { diff --git a/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/json/JsonHandlerTest.java b/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/json/JsonHandlerTest.java index c9db6c395..5242a4a04 100644 --- a/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/json/JsonHandlerTest.java +++ b/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/json/JsonHandlerTest.java @@ -43,7 +43,7 @@ public class JsonHandlerTest { final byte[] bytes = jsonString.getBytes(StandardCharsets.UTF_8); try (final InputStream inputStream = new ByteArrayInputStream(bytes);) { - final JSONHandler<OverTheMoonObject> objUnderTest = new JSONHandler<>(); + final JsonHandler<OverTheMoonObject> objUnderTest = new JsonHandler<>(); final OverTheMoonObject actualObject = objUnderTest.read(OverTheMoonObject.class, inputStream); assertEquals(VALUE, actualObject.name); diff --git a/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/typeutils/ParserTest.java b/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/typeutils/ParserTest.java index a979afddc..892f68ce1 100644 --- a/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/typeutils/ParserTest.java +++ b/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/typeutils/ParserTest.java @@ -32,14 +32,14 @@ import org.antlr.v4.runtime.CommonTokenStream; import org.antlr.v4.runtime.TokenStream; import org.junit.Test; - /** + * Test Java parsing. */ public class ParserTest { @Test public void testParser() { - final CharStream stream = CharStreams.fromString( - "java.util.Map<java.util.List<java.lang.Integer>,java.util.Set<java.lang.String>>"); + final CharStream stream = CharStreams + .fromString("java.util.Map<java.util.List<java.lang.Integer>,java.util.Set<java.lang.String>>"); final TokenStream tokenStream = new CommonTokenStream(new ParametrizedTypeLexer(stream)); final ParametrizedTypeParser parser = new ParametrizedTypeParser(tokenStream); @@ -47,23 +47,23 @@ public class ParserTest { parser.setErrorHandler(new BailErrorStrategy()); parser.setBuildParseTree(true); assertEquals("java.util.Map<java.util.List<java.lang.Integer>, java.util.Set<java.lang.String>>", - parser.type().value.build().getTypeName()); + parser.type().value.build().getTypeName()); } @Test public void testBuilder() throws IllegalArgumentException { - String t = "java.util.Map<java.util.List<java.lang.Integer>,java.util.Set<java.lang.String>>"; - Type ret = TypeBuilder.build(t); + String typeString = "java.util.Map<java.util.List<java.lang.Integer>,java.util.Set<java.lang.String>>"; + Type ret = TypeBuilder.build(typeString); assertEquals("java.util.Map<java.util.List<java.lang.Integer>, java.util.Set<java.lang.String>>", - ret.getTypeName()); + ret.getTypeName()); assertEquals(java.util.Map.class, TypeBuilder.getJavaTypeClass(ret)); final Type[] args = TypeBuilder.getJavaTypeParameters(ret); assertEquals("java.util.List<java.lang.Integer>", args[0].getTypeName()); assertEquals("java.util.Set<java.lang.String>", args[1].getTypeName()); - t = "java.lang.Integer"; - ret = TypeBuilder.build(t); + typeString = "java.lang.Integer"; + ret = TypeBuilder.build(typeString); assertEquals(java.lang.Integer.class, TypeBuilder.getJavaTypeClass(ret)); } @@ -74,17 +74,19 @@ public class ParserTest { TypeBuilder.build(null); fail("Test should throw exception"); } catch (final IllegalArgumentException e) { - assertEquals( - "Blank type string passed to org.onap.policy.apex.model.utilities.typeutils.TypeBuilder.build(String type)", - e.getMessage()); + assertEquals("Blank type string passed to " + + "org.onap.policy.apex.model.utilities.typeutils.TypeBuilder.build(String type)", + e.getMessage()); } try { TypeBuilder.build("org.zooby.Wooby"); fail("Test should throw exception"); } catch (final IllegalArgumentException e) { - assertEquals(e.getMessage(), "Failed to build type 'org.zooby.Wooby': java.lang.IllegalArgumentException: " - + "Class 'org.zooby.Wooby' not found. Also looked for a class called 'java.lang.org.zooby.Wooby'"); + assertEquals(e.getMessage(), + "Failed to build type 'org.zooby.Wooby': java.lang.IllegalArgumentException: " + + "Class 'org.zooby.Wooby' not found. " + + "Also looked for a class called 'java.lang.org.zooby.Wooby'"); } assertEquals(TypeBuilder.getJavaTypeClass("java.lang.String"), String.class); diff --git a/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/typeutils/TestKeyComparer.java b/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/typeutils/TestKeyComparer.java index c2e84c6fb..538028de0 100644 --- a/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/typeutils/TestKeyComparer.java +++ b/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/typeutils/TestKeyComparer.java @@ -28,6 +28,7 @@ import org.onap.policy.apex.model.utilities.comparison.KeyComparer; import org.onap.policy.apex.model.utilities.comparison.KeyDifference; /** + * Test key comparisons. * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TestKeyComparer { diff --git a/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/typeutils/TestKeyedMapComparer.java b/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/typeutils/TestKeyedMapComparer.java index 33b8101a1..de71ea164 100644 --- a/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/typeutils/TestKeyedMapComparer.java +++ b/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/typeutils/TestKeyedMapComparer.java @@ -31,6 +31,8 @@ import org.onap.policy.apex.model.utilities.comparison.KeyedMapComparer; import org.onap.policy.apex.model.utilities.comparison.KeyedMapDifference; /** + * Test key map comparisons. + * * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TestKeyedMapComparer { @@ -50,21 +52,23 @@ public class TestKeyedMapComparer { rightMap.put("E", "EEEEE"); rightMap.put("F", "FFFFF"); rightMap.put("G", "G"); - - KeyedMapDifference<String, String> kmComparedSame = new KeyedMapComparer<String, String>().compareMaps(leftMap, leftMap); - KeyedMapDifference<String, String> kmComparedDiff = new KeyedMapComparer<String, String>().compareMaps(leftMap, rightMap); - + + KeyedMapDifference<String, String> kmComparedSame = new KeyedMapComparer<String, String>().compareMaps(leftMap, + leftMap); + KeyedMapDifference<String, String> kmComparedDiff = new KeyedMapComparer<String, String>().compareMaps(leftMap, + rightMap); + assertTrue(kmComparedSame.getIdenticalValues().equals(leftMap)); assertEquals(1, kmComparedDiff.getLeftOnly().size()); assertEquals(3, kmComparedDiff.getRightOnly().size()); assertEquals(2, kmComparedDiff.getDifferentValues().size()); assertEquals(1, kmComparedDiff.getIdenticalValues().size()); - + assertNotNull(kmComparedSame.asString(true, true)); assertNotNull(kmComparedSame.asString(true, false)); assertNotNull(kmComparedSame.asString(false, false)); assertNotNull(kmComparedSame.asString(false, true)); - + assertNotNull(kmComparedDiff.asString(true, true)); assertNotNull(kmComparedDiff.asString(true, false)); assertNotNull(kmComparedDiff.asString(false, false)); diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/plugins/context/test/locking/TestConcurrentContext.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/plugins/context/test/locking/TestConcurrentContext.java index e5dab9706..dd6c4e6f1 100644 --- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/plugins/context/test/locking/TestConcurrentContext.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/plugins/context/test/locking/TestConcurrentContext.java @@ -36,8 +36,8 @@ import org.junit.BeforeClass; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; -import org.onap.policy.apex.context.impl.distribution.jvmlocal.JVMLocalDistributor; -import org.onap.policy.apex.context.impl.locking.jvmlocal.JVMLocalLockManager; +import org.onap.policy.apex.context.impl.distribution.jvmlocal.JvmLocalDistributor; +import org.onap.policy.apex.context.impl.locking.jvmlocal.JvmLocalLockManager; import org.onap.policy.apex.context.parameters.ContextParameters; import org.onap.policy.apex.context.parameters.DistributorParameters; import org.onap.policy.apex.context.test.concepts.TestContextLongItem; @@ -131,7 +131,7 @@ public class TestConcurrentContext { logger.debug("Running testConcurrentContextJVMLocalVarSet test . . ."); final ContextParameters contextParameters = new ContextParameters(); - contextParameters.getLockManagerParameters().setPluginClass(JVMLocalLockManager.class.getCanonicalName()); + contextParameters.getLockManagerParameters().setPluginClass(JvmLocalLockManager.class.getCanonicalName()); final ConfigrationProvider configrationProvider = getConfigrationProvider("JVMLocalVarSet", TEST_JVM_COUNT_SINGLE_JVM, TEST_THREAD_COUNT_SINGLE_JVM, TEST_THREAD_LOOPS); @@ -173,8 +173,8 @@ public class TestConcurrentContext { logger.debug("Running testConcurrentContextMultiJVMNoLock test . . ."); final ContextParameters contextParameters = new ContextParameters(); - contextParameters.getDistributorParameters().setPluginClass(JVMLocalDistributor.class.getCanonicalName()); - contextParameters.getLockManagerParameters().setPluginClass(JVMLocalLockManager.class.getCanonicalName()); + contextParameters.getDistributorParameters().setPluginClass(JvmLocalDistributor.class.getCanonicalName()); + contextParameters.getLockManagerParameters().setPluginClass(JvmLocalLockManager.class.getCanonicalName()); final ConfigrationProvider configrationProvider = getConfigrationProvider("testConcurrentContextMultiJVMNoLock", TEST_JVM_COUNT_MULTI_JVM, TEST_THREAD_COUNT_MULTI_JVM, TEST_THREAD_LOOPS); diff --git a/tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/model2cli/Model2Cli.java b/tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/model2cli/Model2Cli.java index 2712e5d33..cc9ed5cae 100644 --- a/tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/model2cli/Model2Cli.java +++ b/tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/model2cli/Model2Cli.java @@ -40,7 +40,7 @@ import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum; import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema; import org.onap.policy.apex.model.eventmodel.concepts.AxEvent; import org.onap.policy.apex.model.eventmodel.concepts.AxField; -import org.onap.policy.apex.model.modelapi.ApexAPIResult; +import org.onap.policy.apex.model.modelapi.ApexApiResult; import org.onap.policy.apex.model.modelapi.ApexModel; import org.onap.policy.apex.model.modelapi.ApexModelFactory; import org.onap.policy.apex.model.policymodel.concepts.AxPolicy; @@ -109,8 +109,8 @@ public class Model2Cli { final ApexModelFactory factory = new ApexModelFactory(); final ApexModel model = factory.createApexModel(new Properties(), true); - final ApexAPIResult result = model.loadFromFile(modelFile); - if (result.isNOK()) { + final ApexApiResult result = model.loadFromFile(modelFile); + if (result.isNok()) { System.err.println(appName + ": " + result.getMessage()); return -1; } diff --git a/tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/model2event/Model2JsonEventSchema.java b/tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/model2event/Model2JsonEventSchema.java index b662f577c..0bc9a27f8 100644 --- a/tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/model2event/Model2JsonEventSchema.java +++ b/tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/model2event/Model2JsonEventSchema.java @@ -31,7 +31,7 @@ import org.onap.policy.apex.context.parameters.SchemaParameters; import org.onap.policy.apex.model.basicmodel.concepts.ApexException; import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; import org.onap.policy.apex.model.eventmodel.concepts.AxEvent; -import org.onap.policy.apex.model.modelapi.ApexAPIResult; +import org.onap.policy.apex.model.modelapi.ApexApiResult; import org.onap.policy.apex.model.modelapi.ApexModel; import org.onap.policy.apex.model.modelapi.ApexModelFactory; import org.onap.policy.apex.model.policymodel.concepts.AxPolicies; @@ -148,8 +148,8 @@ public class Model2JsonEventSchema { final ApexModelFactory factory = new ApexModelFactory(); final ApexModel model = factory.createApexModel(new Properties(), true); - final ApexAPIResult result = model.loadFromFile(modelFile); - if (result.isNOK()) { + final ApexApiResult result = model.loadFromFile(modelFile); + if (result.isNok()) { System.err.println(appName + ": " + result.getMessage()); return -1; } |