diff options
Diffstat (limited to 'client/client-editor/src')
4 files changed, 834 insertions, 834 deletions
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()); } } |