diff options
author | Dinh Danh Le <dinh.danh.le@ericsson.com> | 2018-08-13 11:20:21 +0100 |
---|---|---|
committer | Dinh Danh Le <dinh.danh.le@ericsson.com> | 2018-08-14 12:27:52 +0100 |
commit | 933af17963b47650fe9864d03e63a06aa08e31a9 (patch) | |
tree | 96525e225a4637b1a97fe4931811ba8f6c5d0bd8 /client/client-editor | |
parent | 15dcabb76fd31f54452a94498e84516485dd838a (diff) |
Fix checkstyle warnings in the client module
Change-Id: I3263a833cc9dd6d86afdf2ae53de0e53c92850c9
Signed-off-by: Dinh Danh Le <dinh.danh.le@ericsson.com>
Issue-ID: POLICY-1034
Diffstat (limited to 'client/client-editor')
21 files changed, 204 insertions, 129 deletions
diff --git a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/ApexEditorException.java b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/ApexEditorException.java index b674e6021..18dcc9f99 100644 --- a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/ApexEditorException.java +++ b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/ApexEditorException.java @@ -53,21 +53,21 @@ public class ApexEditorException extends ApexException { * Instantiates a new apex editor exception. * * @param message the message on the exception - * @param e the exception that caused this Apex exception + * @param ex the exception that caused this Apex exception */ - public ApexEditorException(final String message, final Exception e) { - super(message, e); + public ApexEditorException(final String message, final Exception ex) { + super(message, ex); } /** * Instantiates a new apex editor exception. * * @param message the message on the exception - * @param e the exception that caused this Apex exception + * @param ex the exception that caused this Apex exception * @param object the object that the exception was thrown on */ - public ApexEditorException(final String message, final Exception e, final Object object) { - super(message, e, object); + public ApexEditorException(final String message, final Exception ex, final Object object) { + super(message, ex, object); } } diff --git a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/ApexEditorMain.java b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/ApexEditorMain.java index ee7199fda..0fa8011c5 100644 --- a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/ApexEditorMain.java +++ b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/ApexEditorMain.java @@ -40,7 +40,7 @@ public class ApexEditorMain { INITIALIZING, /** The editor is running. */ RUNNING - }; + } private static final int EDITOR_RNNING_CHECK_TIMEOUT = 1000; diff --git a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/ApexEditorParameterException.java b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/ApexEditorParameterException.java index 921b4c068..0ba12dec6 100644 --- a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/ApexEditorParameterException.java +++ b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/ApexEditorParameterException.java @@ -41,9 +41,9 @@ public class ApexEditorParameterException extends IllegalArgumentException { * Create an ApexEditorParameterException with a message and an exception. * * @param message the message - * @param t the t + * @param th the Throwable instance */ - public ApexEditorParameterException(final String message, final Throwable t) { - super(message, t); + public ApexEditorParameterException(final String message, final Throwable th) { + super(message, th); } } 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 09b34ebe4..83ca529f6 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 @@ -1000,7 +1000,8 @@ public class ApexEditorRestResource { if (p.getValue() == null) { 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."); + + ". 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 = @@ -1009,7 +1010,8 @@ public class ApexEditorRestResource { 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. The event has only been partially defined."); + + ". The event was created, but there was an error adding the event parameters." + + " The event has only been partially defined."); ret = rettmp; return ret; } @@ -1240,7 +1242,8 @@ public class ApexEditorRestResource { if (fin.getValue() == null) { 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."); + + ". 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())) { @@ -1248,7 +1251,8 @@ public class ApexEditorRestResource { + fin.getKey() + "\" in task " + jsonbean.getName() + ":" + jsonbean.getVersion() + ". The localName of the field (\"" + fin.getValue().getLocalName() + "\") is not the same as the field name. " - + "The task was created, but there was an error adding the input fields. The task has only been partially defined."); + + "The task was created, but there was an error adding the input fields." + + " The task has only been partially defined."); return ret; } tempres = sessionApexModel.createTaskInputField(jsonbean.getName(), jsonbean.getVersion(), @@ -1257,7 +1261,8 @@ public class ApexEditorRestResource { 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. The task has only been partially defined."); + + ". The task was created, but there was an error adding the input fields." + + " The task has only been partially defined."); ret = tempres; return ret; } @@ -1268,7 +1273,8 @@ public class ApexEditorRestResource { if (fout.getValue() == null) { 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."); + + ". 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())) { @@ -1276,7 +1282,8 @@ public class ApexEditorRestResource { + fout.getKey() + "\" in task " + jsonbean.getName() + ":" + jsonbean.getVersion() + ". The localName of the field (\"" + fout.getValue().getLocalName() + "\") is not the same as the field name. " - + "The task was created, but there was an error adding the output fields. The task has only been partially defined."); + + "The task was created, but there was an error adding the output fields." + + " The task has only been partially defined."); return ret; } tempres = sessionApexModel.createTaskOutputField(jsonbean.getName(), jsonbean.getVersion(), @@ -1285,7 +1292,8 @@ public class ApexEditorRestResource { 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. The task has only been partially defined."); + + ". The task was created, but there was an error adding the output fields." + + " The task has only been partially defined."); ret = tempres; return ret; } @@ -1298,7 +1306,8 @@ public class ApexEditorRestResource { 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. The task has only been partially defined."); + + ". The task was created, but there was an error adding the logic." + + " The task has only been partially defined."); ret = tempres; return ret; } @@ -1310,7 +1319,8 @@ public class ApexEditorRestResource { 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. The task has only been partially defined."); + + ". The task was created, but there was an error adding the parameters." + + " The task has only been partially defined."); return ret; } tempres = sessionApexModel.createTaskParameter(jsonbean.getName(), jsonbean.getVersion(), @@ -1318,7 +1328,8 @@ public class ApexEditorRestResource { 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. The task has only been partially defined."); + + ". The task was created, but there was an error adding the parameters." + + " The task has only been partially defined."); ret = tempres; return ret; } @@ -1577,7 +1588,8 @@ public class ApexEditorRestResource { if (jsonbean.getStates() == null || jsonbean.getStates().isEmpty()) { 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."); + + "\". The policy was created, but there was an error adding states." + + " The policy has only been partially defined."); return ret; } @@ -1589,19 +1601,22 @@ public class ApexEditorRestResource { if (state == null) { 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."); + + "\". 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 + "\" for policy \"" + policyname + ":" + policyversion - + "\". The policy was created, but there was an error adding the state. The policy has only been partially defined."); + + "\". 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 + "\" for policy \"" + policyname + ":" + policyversion - + "\". The policy was created, but there was an error adding the state. The policy has only been partially defined."); + + "\". The policy was created, but there was an error adding the state." + + " The policy has only been partially defined."); return ret; } tempres = sessionApexModel.createPolicyState(policyname, policyversion, statename, @@ -1624,8 +1639,8 @@ public class ApexEditorRestResource { 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 for " - + "the state. The policy has only been partially defined."); + + "\". The policy was created, but there was an error adding the task selection logic " + + "for the state. The policy has only been partially defined."); ret = tempres; return ret; } @@ -1638,8 +1653,8 @@ public class ApexEditorRestResource { 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 reference for the state." - + " The policy has only been partially defined."); + + "\". The policy was created, but there was an error adding the context " + + "reference for the state. The policy has only been partially defined."); return ret; } tempres = sessionApexModel.createPolicyStateContextRef(policyname, policyversion, statename, @@ -1647,8 +1662,8 @@ public class ApexEditorRestResource { 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 for the state." - + " The policy has only been partially defined."); + + "\". The policy was created, but there was an error adding the context reference " + + "for the state. The policy has only been partially defined."); ret = tempres; return ret; } @@ -1663,10 +1678,10 @@ public class ApexEditorRestResource { if (finalizername == null || finalizer == null) { ret = new ApexAPIResult(RESULT.FAILED, "Null or invalid finalizer information for finalizer " + "named \"" + finalizername - + "\" in state \"" + statename + "\" for policy \"" + policyname + ":" + + "\" in state \"" + statename + "\" for policy \"" + policyname + ":" + policyversion - + "\". The policy and state were created, but there was an error adding the finalizer." - + " The policy has only been partially defined."); + + "\". The policy and state were created, but there was an error adding the" + + " finalizer. The policy has only been partially defined."); return ret; } tempres = sessionApexModel.createPolicyStateFinalizerLogic(policyname, policyversion, statename, @@ -1675,8 +1690,8 @@ public class ApexEditorRestResource { tempres.addMessage("Failed to add finalizer information for finalizer named \"" + finalizername + "\" in" + " state \"" + statename + "\" for policy \"" + policyname + ":" + policyversion - + "\". The policy and state were created, but there was an error adding the finalizer." - + " The policy has only been partially defined."); + + "\". The policy and state were created, but there was an error adding the" + + " finalizer. The policy has only been partially defined."); ret = tempres; return ret; } @@ -1687,8 +1702,8 @@ public class ApexEditorRestResource { 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 outputs." - + " The policy has only been partially defined."); + + "\". The policy and state were created, but there was an error adding state" + + " outputs. The policy has only been partially defined."); return ret; } for (final Map.Entry<String, BeanStateOutput> o : outputs.entrySet()) { @@ -1698,8 +1713,8 @@ public class ApexEditorRestResource { 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 output." - + " The policy has only been partially defined."); + + "\". The policy and state were created, but there was an error adding the" + + " output. The policy has only been partially defined."); return ret; } tempres = sessionApexModel.createPolicyStateOutput(policyname, policyversion, statename, outputname, @@ -1730,8 +1745,8 @@ public class ApexEditorRestResource { 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 task. " - + "The policy has only been partially defined."); + + "\". The policy and state were created, but there was an error adding the " + + "task. The policy has only been partially defined."); return ret; } tempres = sessionApexModel.createPolicyStateTaskRef(policyname, policyversion, statename, @@ -1740,8 +1755,8 @@ public class ApexEditorRestResource { 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 the state." - + " The policy has only been partially defined."); + + "\". The policy was created, but there was an error adding the task reference for" + + " the state. The policy has only been partially defined."); ret = tempres; return ret; } @@ -1799,7 +1814,11 @@ public class ApexEditorRestResource { 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\",\"description\":\"Generated description for concept referred to by key 'PeriodicEvent:0.0.1'\",\"source\":\"System\",\"target\":\"Apex\",\"nameSpace\":\"org.onap.policy.apex.domains.aadm.events\",\"parameters\":{}}"; + "{\"name\":\"PeriodicEvent\",\"version\":\"0.0.1\"," + + "\"uuid\":\"44236da1-3d47-4988-8033-b6fee9d6a0f4\"," + + "\"description\":\"Generated description for concept referred to by key " + + "'PeriodicEvent:0.0.1'\",\"source\":\"System\",\"target\":\"Apex\"," + + "\"nameSpace\":\"org.onap.policy.apex.domains.aadm.events\",\"parameters\":{}}"; ret = createEvent(periodicEventString); if (ret.isNOK()) { return ret; diff --git a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/RestUtils.java b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/RestUtils.java index 2c5b6e89a..02779a4d7 100644 --- a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/RestUtils.java +++ b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/RestUtils.java @@ -97,7 +97,8 @@ public abstract class RestUtils { } /** - * Apex HTTP PUT requests send simple single level JSON strings, this method reads those strings into a map. + * Apex HTTP PUT requests send simple single level JSON strings, this method reads those strings + * into a map. * * @param jsonString the incoming JSON string * @return a map of the JSON strings @@ -116,7 +117,8 @@ public abstract class RestUtils { } /** - * Apex HTTP PUT requests send simple single level JSON strings, this method reads those strings into a map. + * Apex HTTP PUT requests send simple single level JSON strings, this method reads those strings + * into a map. * * @param <CLZ> the generic type * @param jsonString the incoming JSON string @@ -137,13 +139,11 @@ public abstract class RestUtils { } // Regular expressions for checking input types - private static final String XML_INPUT_TYPE_REGEXP = "^\\s*<\\?xml.*>\\s*"; // (starts with <?xml...> - private static final String JSON_INPUT_TYPE_REGEXP = "^\\s*[\\(\\{\\[][\\s+\\S]*[\\)\\}\\]]"; // starts with some - // kind of bracket [ - // or ( or {, then has - // something, then has - // and has a close - // bracket + private static final String XML_INPUT_TYPE_REGEXP = "^\\s*<\\?xml.*>\\s*"; //starts with <?xml...> + /** + * starts with some kind of bracket [ or ( or {, then has something, then has bracket. + */ + private static final String JSON_INPUT_TYPE_REGEXP = "^\\s*[\\(\\{\\[][\\s+\\S]*[\\)\\}\\]]"; /** * Gets the concept from JSON. diff --git a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/bean/BeanContextAlbum.java b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/bean/BeanContextAlbum.java index 848665a0f..1cc6c7c35 100644 --- a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/bean/BeanContextAlbum.java +++ b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/bean/BeanContextAlbum.java @@ -27,8 +27,11 @@ import javax.xml.bind.annotation.XmlType; */ @XmlType public class BeanContextAlbum extends BeanBase { - - private String name = null, version = null, scope = null, uuid = null, description = null; + private String name = null; + private String version = null; + private String scope = null; + private String uuid = null; + private String description = null; private BeanKeyRef itemSchema = null; private boolean writeable; @@ -105,5 +108,4 @@ public class BeanContextAlbum extends BeanBase { return "ContextAlbum [name=" + name + ", version=" + version + ", scope=" + scope + ", uuid=" + uuid + ", description=" + description + ", itemSchema=" + itemSchema + ", writeable=" + writeable + "]"; } - } diff --git a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/bean/BeanContextSchema.java b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/bean/BeanContextSchema.java index 0d86c2791..95b296fef 100644 --- a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/bean/BeanContextSchema.java +++ b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/bean/BeanContextSchema.java @@ -27,9 +27,12 @@ import javax.xml.bind.annotation.XmlType; */ @XmlType public class BeanContextSchema extends BeanBase { - - private String name = null, version = null, schemaFlavour = null, schemaDefinition = null, uuid = null, - description = null; + private String name = null; + private String version = null; + private String schemaFlavour = null; + private String schemaDefinition = null; + private String uuid = null; + private String description = null; /** * Gets the name. diff --git a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/bean/BeanEvent.java b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/bean/BeanEvent.java index 8b7c6bce2..c867beab1 100644 --- a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/bean/BeanEvent.java +++ b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/bean/BeanEvent.java @@ -29,9 +29,13 @@ import javax.xml.bind.annotation.XmlType; */ @XmlType public class BeanEvent extends BeanBase { - - private String name = null, version = null, nameSpace = null, source = null, target = null, uuid = null, - description = null; + private String name = null; + private String version = null; + private String nameSpace = null; + private String source = null; + private String target = null; + private String uuid = null; + private String description = null; private Map<String, BeanField> parameters = null; /** @@ -109,12 +113,12 @@ public class BeanEvent extends BeanBase { /** * Gets the parameter. * - * @param p the p + * @param ps the parameter string * @return the parameter */ - public BeanField getParameter(final String p) { + public BeanField getParameter(final String ps) { if (parameters != null) { - return parameters.get(p); + return parameters.get(ps); } return null; } diff --git a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/bean/BeanKeyRef.java b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/bean/BeanKeyRef.java index a498b9467..dfe8ac6d2 100644 --- a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/bean/BeanKeyRef.java +++ b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/bean/BeanKeyRef.java @@ -27,8 +27,8 @@ import javax.xml.bind.annotation.XmlType; */ @XmlType public class BeanKeyRef extends BeanBase { - - private String name = null, version = null; + private String name = null; + private String version = null; /** * Gets the name. diff --git a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/bean/BeanLogic.java b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/bean/BeanLogic.java index 48fba16a8..ef8e3c726 100644 --- a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/bean/BeanLogic.java +++ b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/bean/BeanLogic.java @@ -27,8 +27,8 @@ import javax.xml.bind.annotation.XmlType; */ @XmlType public class BeanLogic extends BeanBase { - - private String logic = null, logicFlavour = null; + private String logic = null; + private String logicFlavour = null; /** * Gets the logic flavour. @@ -57,5 +57,4 @@ public class BeanLogic extends BeanBase { public String toString() { return "Logic [logicFlavour=" + logicFlavour + ", logic=" + logic + "]"; } - } diff --git a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/bean/BeanModel.java b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/bean/BeanModel.java index 3170ea303..0d69be971 100644 --- a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/bean/BeanModel.java +++ b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/bean/BeanModel.java @@ -28,7 +28,10 @@ import javax.xml.bind.annotation.XmlType; @XmlType public class BeanModel extends BeanBase { - private String name = null, version = null, uuid = null, description = null; + private String name = null; + private String version = null; + private String uuid = null; + private String description = null; /** * Gets the name. diff --git a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/bean/BeanPolicy.java b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/bean/BeanPolicy.java index bdbfb6dea..fad64f6ac 100644 --- a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/bean/BeanPolicy.java +++ b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/bean/BeanPolicy.java @@ -29,8 +29,12 @@ import javax.xml.bind.annotation.XmlType; */ @XmlType public class BeanPolicy extends BeanBase { - - private String name = null, version = null, uuid = null, description = null, firstState = null, template = null; + private String name = null; + private String version = null; + private String uuid = null; + private String description = null; + private String firstState = null; + private String template = null; private Map<String, BeanState> states = null; /** diff --git a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/bean/BeanStateTaskRef.java b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/bean/BeanStateTaskRef.java index 9d446e7c7..c3525b0c8 100644 --- a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/bean/BeanStateTaskRef.java +++ b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/bean/BeanStateTaskRef.java @@ -27,9 +27,9 @@ import javax.xml.bind.annotation.XmlType; */ @XmlType public class BeanStateTaskRef extends BeanBase { - private BeanKeyRef task = null; - private String outputType = null, outputName = null; + private String outputType = null; + private String outputName = null; /** * Gets the task. diff --git a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/bean/BeanTask.java b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/bean/BeanTask.java index 0df810caf..bf148386d 100644 --- a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/bean/BeanTask.java +++ b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/bean/BeanTask.java @@ -30,8 +30,10 @@ import javax.xml.bind.annotation.XmlType; */ @XmlType public class BeanTask extends BeanBase { - - private String name = null, version = null, uuid = null, description = null; + private String name = null; + private String version = null; + private String uuid = null; + private String description = null; private BeanLogic taskLogic = null; private Map<String, BeanField> inputFields = null; private Map<String, BeanField> outputFields = null; diff --git a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/bean/BeanTaskParameter.java b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/bean/BeanTaskParameter.java index 2de1c7a28..ef4f39af3 100644 --- a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/bean/BeanTaskParameter.java +++ b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/bean/BeanTaskParameter.java @@ -28,7 +28,8 @@ import javax.xml.bind.annotation.XmlType; @XmlType public class BeanTaskParameter extends BeanBase { - private String parameterName = null, defaultValue = null; + private String parameterName = null; + private String defaultValue = null; /** * Gets the parameter name. 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 e9bf636cf..7e61cc9e6 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,8 +20,8 @@ /** * 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 REST. It also - * provides a web-based client written in Javascript. + * {@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/TestApexEditorRestResource.java b/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/TestApexEditorRestResource.java index ee156e02b..1fb3a0a00 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 @@ -37,6 +37,7 @@ import org.onap.policy.apex.model.modelapi.ApexAPIResult.RESULT; import org.onap.policy.apex.model.utilities.TextFileUtils; /** + * Test Apex Editor Rest Resource. * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TestApexEditorRestResource extends JerseyTest { @@ -537,7 +538,8 @@ public class TestApexEditorRestResource extends JerseyTest { entityString = "{" + "\"name\" : \"HowsItGoing\"," + "\"version\" : \"0.0.2\"," + "\"namespace\" : \"somewhere.over.the.rainbow\"," + "\"source\" : \"beginning\"," + "\"target\" : \"end\"," - + "\"parameters\" : {\"Par0\" : {\"name\" : \"StringType\", \"version\" : \"0.0.1\", \"localName\" : \"Par0\", \"optional\" : false}}," + + "\"parameters\" : {\"Par0\" : {\"name\" : \"StringType\", \"version\" : \"0.0.1\", " + + "\"localName\" : \"Par0\", \"optional\" : false}}," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); @@ -556,7 +558,8 @@ public class TestApexEditorRestResource extends JerseyTest { entityString = "{" + "\"name\" : \"GoodDay\"," + "\"version\" : \"0.0.2\"," + "\"namespace\" : \"somewhere.over.the.rainbow\"," + "\"source\" : \"beginning\"," + "\"target\" : \"end\"," - + "\"parameters\" : {\"Par0\" : {\"name\" : \"NonExistantType\", \"version\" : \"0.0.1\", \"localName\" : \"Par0\", \"optional\" : false}}," + + "\"parameters\" : {\"Par0\" : {\"name\" : \"NonExistantType\", \"version\" : \"0.0.1\", " + + "\"localName\" : \"Par0\", \"optional\" : false}}," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); @@ -725,7 +728,8 @@ public class TestApexEditorRestResource extends JerseyTest { assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); entityString = "{" + "\"name\" : \"HowsItGoing\"," + "\"version\" : \"0.0.2\"," - + "\"inputFields\" : {\"IField0\" : {\"name\" : \"StringType\", \"version\" : \"0.0.1\", \"localName\" : \"IField0\", \"optional\" : false}}," + + "\"inputFields\" : {\"IField0\" : {\"name\" : \"StringType\", \"version\" : \"0.0.1\", " + + "\"localName\" : \"IField0\", \"optional\" : false}}," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); @@ -741,7 +745,8 @@ public class TestApexEditorRestResource extends JerseyTest { assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); entityString = "{" + "\"name\" : \"GoodDay\"," + "\"version\" : \"0.0.2\"," - + "\"inputFields\" : {\"IField0\" : {\"name\" : \"NonExistantType\", \"version\" : \"0.0.1\", \"localName\" : \"IField0\", \"optional\" : false}}," + + "\"inputFields\" : {\"IField0\" : {\"name\" : \"NonExistantType\", \"version\" : \"0.0.1\", " + + "\"localName\" : \"IField0\", \"optional\" : false}}," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); @@ -749,7 +754,8 @@ public class TestApexEditorRestResource extends JerseyTest { assertEquals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, result.getResult()); entityString = "{" + "\"name\" : \"Howdy\"," + "\"version\" : \"0.0.2\"," - + "\"inputFields\" : {\"IField0\" : {\"name\" : \"NonExistantType\", \"version\" : \"0.0.1\", \"localName\" : \"NotIField0\", \"optional\" : false}}," + + "\"inputFields\" : {\"IField0\" : {\"name\" : \"NonExistantType\", \"version\" : \"0.0.1\", " + + "\"localName\" : \"NotIField0\", \"optional\" : false}}," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); @@ -757,7 +763,8 @@ public class TestApexEditorRestResource extends JerseyTest { assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); entityString = "{" + "\"name\" : \"HowsItGoing2\"," + "\"version\" : \"0.0.2\"," - + "\"outputFields\" : {\"OField0\" : {\"name\" : \"StringType\", \"version\" : \"0.0.1\", \"localName\" : \"OField0\", \"optional\" : false}}," + + "\"outputFields\" : {\"OField0\" : {\"name\" : \"StringType\", \"version\" : \"0.0.1\", " + + "\"localName\" : \"OField0\", \"optional\" : false}}," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); @@ -773,7 +780,8 @@ public class TestApexEditorRestResource extends JerseyTest { assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); entityString = "{" + "\"name\" : \"GoodDay2\"," + "\"version\" : \"0.0.2\"," - + "\"outputFields\" : {\"OField0\" : {\"name\" : \"NonExistantType\", \"version\" : \"0.0.1\", \"localName\" : \"OField0\", \"optional\" : false}}," + + "\"outputFields\" : {\"OField0\" : {\"name\" : \"NonExistantType\", \"version\" : \"0.0.1\"," + + " \"localName\" : \"OField0\", \"optional\" : false}}," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); @@ -781,7 +789,8 @@ public class TestApexEditorRestResource extends JerseyTest { assertEquals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, result.getResult()); entityString = "{" + "\"name\" : \"Howdy2\"," + "\"version\" : \"0.0.2\"," - + "\"outputFields\" : {\"OField0\" : {\"name\" : \"NonExistantType\", \"version\" : \"0.0.1\", \"localName\" : \"NotOField0\", \"optional\" : false}}," + + "\"outputFields\" : {\"OField0\" : {\"name\" : \"NonExistantType\", \"version\" : \"0.0.1\", " + + "\"localName\" : \"NotOField0\", \"optional\" : false}}," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); @@ -789,8 +798,8 @@ public class TestApexEditorRestResource extends JerseyTest { 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\"," + + "\"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); @@ -806,8 +815,8 @@ public class TestApexEditorRestResource extends JerseyTest { entityString = "{" + "\"name\" : \"GoodDay3\"," + "\"version\" : \"0.0.2\"," + "\"namespace\" : \"somewhere.over.the.rainbow\"," + "\"source\" : \"beginning\"," + "\"target\" : \"end\"," - + "\"taskLogic\" : {\"logicFlavour\" : \"UNDEFINED\", \"logic\" : \"lots of lemons, lots of lime\"}," - + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\"," + + "\"taskLogic\" : {\"logicFlavour\" : \"UNDEFINED\", \"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); @@ -822,7 +831,8 @@ public class TestApexEditorRestResource extends JerseyTest { assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); entityString = "{" + "\"name\" : \"HowsItGoing4\"," + "\"version\" : \"0.0.2\"," - + "\"parameters\" : {\"Par0\" : {\"parameterName\" : \"Par0\", \"defaultValue\" : \"Parameter Defaultvalue\"}}," + + "\"parameters\" : {\"Par0\" : {\"parameterName\" : \"Par0\", " + + "\"defaultValue\" : \"Parameter Defaultvalue\"}}," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); @@ -838,7 +848,8 @@ public class TestApexEditorRestResource extends JerseyTest { assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); entityString = "{" + "\"name\" : \"GoodDay4\"," + "\"version\" : \"0.0.2\"," - + "\"parameters\" : {\"Par0\" : {\"parameterName\" : \"NotPar0\", \"defaultValue\" : \"Parameter Defaultvalue\"}}," + + "\"parameters\" : {\"Par0\" : {\"parameterName\" : \"NotPar0\", \"defaultValue\" : " + + "\"Parameter Defaultvalue\"}}," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); @@ -1223,8 +1234,8 @@ public class TestApexEditorRestResource extends JerseyTest { + " \"name\" : \"state\"," + " \"trigger\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," + " \"defaultTask\" : {\"name\" : \"task\", \"version\" : \"0.0.1\"}," - + " \"taskSelectionLogic\" : {\"logicFlavour\" : \"LemonAndLime\", \"logic\" : \"lots of lemons, lots of lime\"}," - + " \"stateOutputs\" : {" + " \"so0\" : {" + + " \"taskSelectionLogic\" : {\"logicFlavour\" : \"LemonAndLime\", \"logic\" : \"lots of lemons, " + + "lots of lime\"}," + " \"stateOutputs\" : {" + " \"so0\" : {" + " \"event\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," + " \"nextState\" : null" + " }" + " }," + " \"tasks\" : {" + " \"tr0\" : {" @@ -1261,7 +1272,8 @@ public class TestApexEditorRestResource extends JerseyTest { + " \"name\" : \"state\"," + " \"trigger\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," + " \"defaultTask\" : {\"name\" : \"task\", \"version\" : \"0.0.1\"}," - + " \"taskSelectionLogic\" : {\"logicFlavour\" : \"LemonAndLime\", \"logic\" : \"lots of lemons, lots of lime\"}," + + " \"taskSelectionLogic\" : {\"logicFlavour\" : \"LemonAndLime\", \"logic\" : \"lots of lemons, " + + "lots of lime\"}," + " \"contexts\" : [{\"name\" : \"contextAlbum0\", \"version\" : \"0.0.1\"}]," + " \"stateOutputs\" : {" + " \"so0\" : {" + " \"event\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," @@ -1281,7 +1293,8 @@ public class TestApexEditorRestResource extends JerseyTest { + " \"name\" : \"state\"," + " \"trigger\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," + " \"defaultTask\" : {\"name\" : \"task\", \"version\" : \"0.0.1\"}," - + " \"taskSelectionLogic\" : {\"logicFlavour\" : \"LemonAndLime\", \"logic\" : \"lots of lemons, lots of lime\"}," + + " \"taskSelectionLogic\" : {\"logicFlavour\" : \"LemonAndLime\", \"logic\" : \"lots of lemons, " + + "lots of lime\"}," + " \"contexts\" : [{\"name\" : \"IDontExist\", \"version\" : \"0.0.1\"}]," + " \"stateOutputs\" : {" + " \"so0\" : {" + " \"event\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," @@ -1301,7 +1314,8 @@ public class TestApexEditorRestResource extends JerseyTest { + " \"name\" : \"state\"," + " \"trigger\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," + " \"defaultTask\" : {\"name\" : \"task\", \"version\" : \"0.0.1\"}," - + " \"taskSelectionLogic\" : {\"logicFlavour\" : \"LemonAndLime\", \"logic\" : \"lots of lemons, lots of lime\"}," + + " \"taskSelectionLogic\" : {\"logicFlavour\" : \"LemonAndLime\", \"logic\" : \"lots of lemons, " + + "lots of lime\"}," + " \"contexts\" : [null]," + " \"stateOutputs\" : {" + " \"so0\" : {" + " \"event\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," + " \"nextState\" : null" + " }" + " }," + " \"tasks\" : {" @@ -1320,7 +1334,8 @@ public class TestApexEditorRestResource extends JerseyTest { + " \"name\" : \"state\"," + " \"trigger\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," + " \"defaultTask\" : {\"name\" : \"task\", \"version\" : \"0.0.1\"}," - + " \"taskSelectionLogic\" : {\"logicFlavour\" : \"LemonAndLime\", \"logic\" : \"lots of lemons, lots of lime\"}," + + " \"taskSelectionLogic\" : {\"logicFlavour\" : \"LemonAndLime\", \"logic\" : \"lots of lemons, " + + "lots of lime\"}," + " \"contexts\" : [{\"name\" : \"contextAlbum0\", \"version\" : \"0.0.1\"}]," + " \"stateOutputs\" : {" + " \"so0\" : {" + " \"event\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," @@ -1329,7 +1344,8 @@ public class TestApexEditorRestResource extends JerseyTest { + " \"task\" : {\"name\" : \"task\", \"version\" : \"0.0.1\"}," + " \"outputType\" : \"DIRECT\"," + " \"outputName\" : \"so0\"" + " }" + " }," + " \"finalizers\" : {" - + " \"sf0\" : {\"logicFlavour\" : \"LemonAndLime\", \"logic\" : \"lots of lemons, lots of lime\"}" + + " \"sf0\" : {\"logicFlavour\" : \"LemonAndLime\", \"logic\" : \"lots of lemons, " + + "lots of lime\"}" + " }" + " }" + "}," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\"," + "\"description\" : \"A description of hello\"" + "}"; entity = Entity.entity(entityString, MediaType.APPLICATION_JSON); @@ -1342,7 +1358,8 @@ public class TestApexEditorRestResource extends JerseyTest { + " \"name\" : \"state\"," + " \"trigger\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," + " \"defaultTask\" : {\"name\" : \"task\", \"version\" : \"0.0.1\"}," - + " \"taskSelectionLogic\" : {\"logicFlavour\" : \"LemonAndLime\", \"logic\" : \"lots of lemons, lots of lime\"}," + + " \"taskSelectionLogic\" : {\"logicFlavour\" : \"LemonAndLime\", \"logic\" : \"lots of lemons, " + + "lots of lime\"}," + " \"contexts\" : [{\"name\" : \"contextAlbum0\", \"version\" : \"0.0.1\"}]," + " \"stateOutputs\" : {" + " \"so0\" : {" + " \"event\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," @@ -1363,7 +1380,8 @@ public class TestApexEditorRestResource extends JerseyTest { + " \"name\" : \"state\"," + " \"trigger\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," + " \"defaultTask\" : {\"name\" : \"task\", \"version\" : \"0.0.1\"}," - + " \"taskSelectionLogic\" : {\"logicFlavour\" : \"LemonAndLime\", \"logic\" : \"lots of lemons, lots of lime\"}," + + " \"taskSelectionLogic\" : {\"logicFlavour\" : \"LemonAndLime\", \"logic\" : \"lots of lemons, " + + "lots of lime\"}," + " \"contexts\" : [{\"name\" : \"contextAlbum0\", \"version\" : \"0.0.1\"}]," + " \"stateOutputs\" : {" + " \"so0\" : {" + " \"event\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," diff --git a/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/TestApexEditorStartup.java b/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/TestApexEditorStartup.java index d61d43b01..699505aa8 100644 --- a/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/TestApexEditorStartup.java +++ b/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/TestApexEditorStartup.java @@ -31,7 +31,7 @@ import org.junit.Test; import org.onap.policy.apex.client.editor.rest.ApexEditorMain.EditorState; /** - * The Class TestApexEditorStartup. + * Test Apex Editor Startup. */ public class TestApexEditorStartup { // CHECKSTYLE:OFF: MagicNumber @@ -54,7 +54,8 @@ public class TestApexEditorStartup { + "Config=[ApexEditorParameters: URI=http://localhost:18989/apexservices/, TTL=-1sec], " + "State=RUNNING) started at http://localhost:18989/apexservices/")); assertTrue(outString.replaceAll("[\\r?\\n]+", " ").endsWith("Apex Editor REST endpoint (ApexEditorMain: " - + "Config=[ApexEditorParameters: URI=http://localhost:18989/apexservices/, TTL=-1sec], State=STOPPED) shut down ")); + + "Config=[ApexEditorParameters: URI=http://localhost:18989/apexservices/, TTL=-1sec]," + + " State=STOPPED) shut down ")); } /** @@ -71,8 +72,9 @@ public class TestApexEditorStartup { runEditor(args); fail("test should throw an exception here"); } catch (final Exception e) { - assertTrue(e.getLocalizedMessage().startsWith("Apex Editor REST endpoint (ApexEditorMain: " - + "Config=[null], State=STOPPED) parameter error, too many command line arguments specified : [12321]")); + assertTrue(e.getLocalizedMessage().startsWith( + "Apex Editor REST endpoint (ApexEditorMain: Config=[null], State=STOPPED) parameter error," + + " too many command line arguments specified : [12321]")); } } @@ -90,8 +92,9 @@ public class TestApexEditorStartup { runEditor(args); fail("test should throw an exception here"); } catch (final Exception e) { - assertTrue(e.getLocalizedMessage().startsWith("Apex Editor REST endpoint (ApexEditorMain: " - + "Config=[null], State=STOPPED) parameter error, too many command line arguments specified : [12321 12322 12323]")); + assertTrue(e.getLocalizedMessage().startsWith( + "Apex Editor REST endpoint (ApexEditorMain: Config=[null], State=STOPPED) parameter error," + + " too many command line arguments specified : [12321 12322 12323]")); } } @@ -109,8 +112,9 @@ public class TestApexEditorStartup { runEditor(args); fail("test should throw an exception here"); } catch (final Exception e) { - assertTrue(e.getLocalizedMessage().startsWith("Apex Editor REST endpoint (ApexEditorMain: " - + "Config=[null], State=STOPPED) parameter error, invalid command line arguments specified : Unrecognized option: -z")); + assertTrue(e.getLocalizedMessage().startsWith( + "Apex Editor REST endpoint (ApexEditorMain: Config=[null], State=STOPPED) parameter error," + + " invalid command line arguments specified : Unrecognized option: -z")); } } @@ -128,8 +132,9 @@ public class TestApexEditorStartup { runEditor(args); fail("test should throw an exception here"); } catch (final Exception e) { - assertTrue(e.getLocalizedMessage().startsWith("Apex Editor REST endpoint (ApexEditorMain: " - + "Config=[null], State=STOPPED) parameter error, invalid command line arguments specified : Unrecognized option: --hello")); + assertTrue(e.getLocalizedMessage().startsWith( + "Apex Editor REST endpoint (ApexEditorMain: Config=[null], State=STOPPED) parameter error," + + " invalid command line arguments specified : Unrecognized option: --hello")); } } @@ -213,7 +218,8 @@ public class TestApexEditorStartup { + "Config=[ApexEditorParameters: URI=http://localhost:12321/apexservices/, TTL=-1sec], " + "State=RUNNING) started at http://localhost:12321/apexservices/")); assertTrue(outString.replaceAll("[\\r?\\n]+", " ").endsWith("Apex Editor REST endpoint (ApexEditorMain: " - + "Config=[ApexEditorParameters: URI=http://localhost:12321/apexservices/, TTL=-1sec], State=STOPPED) shut down ")); + + "Config=[ApexEditorParameters: URI=http://localhost:12321/apexservices/, TTL=-1sec]," + + " State=STOPPED) shut down ")); } /** @@ -235,7 +241,8 @@ public class TestApexEditorStartup { + "Config=[ApexEditorParameters: URI=http://localhost:12321/apexservices/, TTL=-1sec], " + "State=RUNNING) started at http://localhost:12321/apexservices/")); assertTrue(outString.replaceAll("[\\r?\\n]+", " ").endsWith("(ApexEditorMain: " - + "Config=[ApexEditorParameters: URI=http://localhost:12321/apexservices/, TTL=-1sec], State=STOPPED) shut down ")); + + "Config=[ApexEditorParameters: URI=http://localhost:12321/apexservices/, TTL=-1sec]," + + " State=STOPPED) shut down ")); } @@ -253,8 +260,9 @@ public class TestApexEditorStartup { runEditor(args); fail("test should throw an exception here"); } catch (final Exception e) { - assertTrue(e.getMessage().startsWith("Apex Editor REST endpoint (ApexEditorMain: " - + "Config=[null], State=STOPPED) parameter error, error parsing argument \"port\" :For input string: \" 12321\"")); + assertTrue(e.getMessage().startsWith( + "Apex Editor REST endpoint (ApexEditorMain: Config=[null], State=STOPPED) parameter error," + + " error parsing argument \"port\" :For input string: \" 12321\"")); } } @@ -337,9 +345,11 @@ public class TestApexEditorStartup { + "Config=[ApexEditorParameters: URI=http://localhost:18989/apexservices/, TTL=10sec], " + "State=READY) starting at http://localhost:18989/apexservices/")); assertTrue(outString.replaceAll("[\\r?\\n]+", " ").contains("Apex Editor REST endpoint (ApexEditorMain: " - + "Config=[ApexEditorParameters: URI=http://localhost:18989/apexservices/, TTL=10sec], State=RUNNING) started")); + + "Config=[ApexEditorParameters: URI=http://localhost:18989/apexservices/, TTL=10sec], State=RUNNING)" + + " started")); assertTrue(outString.replaceAll("[\\r?\\n]+", " ").endsWith("Apex Editor REST endpoint (ApexEditorMain: " - + "Config=[ApexEditorParameters: URI=http://localhost:18989/apexservices/, TTL=10sec], State=STOPPED) shut down ")); + + "Config=[ApexEditorParameters: URI=http://localhost:18989/apexservices/, TTL=10sec], State=STOPPED)" + + " shut down ")); } /** @@ -358,9 +368,11 @@ public class TestApexEditorStartup { + "Config=[ApexEditorParameters: URI=http://localhost:18989/apexservices/, TTL=10sec], " + "State=READY) starting at http://localhost:18989/apexservices/")); assertTrue(outString.replaceAll("[\\r?\\n]+", " ").contains("Apex Editor REST endpoint (ApexEditorMain: " - + "Config=[ApexEditorParameters: URI=http://localhost:18989/apexservices/, TTL=10sec], State=RUNNING) started")); + + "Config=[ApexEditorParameters: URI=http://localhost:18989/apexservices/, TTL=10sec], State=RUNNING)" + + " started")); assertTrue(outString.replaceAll("[\\r?\\n]+", " ").endsWith("Apex Editor REST endpoint (ApexEditorMain: " - + "Config=[ApexEditorParameters: URI=http://localhost:18989/apexservices/, TTL=10sec], State=STOPPED) shut down ")); + + "Config=[ApexEditorParameters: URI=http://localhost:18989/apexservices/, TTL=10sec], State=STOPPED)" + + " shut down ")); } /** @@ -379,9 +391,11 @@ public class TestApexEditorStartup { + "Config=[ApexEditorParameters: URI=http://localhost:12321/apexservices/, TTL=10sec], " + "State=READY) starting at http://localhost:12321/apexservices/")); assertTrue(outString.replaceAll("[\\r?\\n]+", " ").contains("Apex Editor REST endpoint (ApexEditorMain: " - + "Config=[ApexEditorParameters: URI=http://localhost:12321/apexservices/, TTL=10sec], State=RUNNING) started")); + + "Config=[ApexEditorParameters: URI=http://localhost:12321/apexservices/, TTL=10sec], State=RUNNING)" + + " started")); assertTrue(outString.replaceAll("[\\r?\\n]+", " ").endsWith("Apex Editor REST endpoint (ApexEditorMain: " - + "Config=[ApexEditorParameters: URI=http://localhost:12321/apexservices/, TTL=10sec], State=STOPPED) shut down ")); + + "Config=[ApexEditorParameters: URI=http://localhost:12321/apexservices/, TTL=10sec], State=STOPPED)" + + " shut down ")); } @@ -401,9 +415,11 @@ public class TestApexEditorStartup { + "Config=[ApexEditorParameters: URI=http://127.0.0.1:12321/apexservices/, TTL=10sec], " + "State=READY) starting at http://127.0.0.1:12321/apexservices/")); assertTrue(outString.replaceAll("[\\r?\\n]+", " ").contains("Apex Editor REST endpoint (ApexEditorMain: " - + "Config=[ApexEditorParameters: URI=http://127.0.0.1:12321/apexservices/, TTL=10sec], State=RUNNING) started")); + + "Config=[ApexEditorParameters: URI=http://127.0.0.1:12321/apexservices/, TTL=10sec], State=RUNNING)" + + " started")); assertTrue(outString.replaceAll("[\\r?\\n]+", " ").endsWith("Apex Editor REST endpoint (ApexEditorMain: " - + "Config=[ApexEditorParameters: URI=http://127.0.0.1:12321/apexservices/, TTL=10sec], State=STOPPED) shut down ")); + + "Config=[ApexEditorParameters: URI=http://127.0.0.1:12321/apexservices/, TTL=10sec], State=STOPPED)" + + " shut down ")); } /** diff --git a/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/TestExceptions.java b/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/TestExceptions.java index c60fb8f4c..e63fb9e45 100644 --- a/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/TestExceptions.java +++ b/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/TestExceptions.java @@ -27,6 +27,7 @@ import java.io.IOException; import org.junit.Test; /** + * Test Apex Editor Exceptions. * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TestExceptions { diff --git a/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/bean/BeanFake.java b/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/bean/BeanFake.java index 5648e306f..c166dc267 100644 --- a/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/bean/BeanFake.java +++ b/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/bean/BeanFake.java @@ -27,9 +27,11 @@ import javax.xml.bind.annotation.XmlType; */ @XmlType public class BeanFake extends BeanBase { - - private String name = null, version = null, field1 = null; - private int field2 = 0, field3 = 0; + private String name = null; + private String version = null; + private String field1 = null; + private int field2 = 0; + private int field3 = 0; public String getName() { field1 = name; diff --git a/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/bean/TestBeans.java b/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/bean/TestBeans.java index 50d330bf8..df08dbaf2 100644 --- a/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/bean/TestBeans.java +++ b/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/bean/TestBeans.java @@ -27,6 +27,7 @@ import static org.junit.Assert.fail; import org.junit.Test; /** + * Test the beans. * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TestBeans { |