import org.slf4j.ext.XLoggerFactory;
/**
- * This class is used to launch the services. It creates a Grizzly embedded web server and runs the services.
+ * This class is used to launch the services. It creates a Grizzly embedded web server and runs the
+ * services.
*/
public class ApexDeploymentRest {
// Logger for this class
private HttpServer server;
/**
- * Starts the HTTP server for the Apex services client on the default base URI and with the default REST packages
+ * Starts the HTTP server for the Apex services client on the default base URI and with the
+ * default REST packages.
*/
public ApexDeploymentRest() {
this(new ApexDeploymentRestParameters());
}
/**
- * Starts the HTTP server for the Apex services client
+ * Starts the HTTP server for the Apex services client.
*
- * @param parameters: The Apex parameters to use to start the server
+ * @param parameters The Apex parameters to use to start the server
*/
public ApexDeploymentRest(final ApexDeploymentRestParameters parameters) {
Assertions.argumentNotNull(parameters, "parameters may not be null");
}
/**
- * Shut down the web server
+ * Shut down the web server.
*/
public void shutdown() {
logger.debug("Apex services RESTful client shutting down . . .");
import java.io.PrintStream;
/**
- * User: ewatkmi Date: 31 Jul 2017
+ * The main class for ApexDeploymentRest.
+ *
+ * @author Michael Watkins (michael.watkins@ericsson.com)
*/
public class ApexDeploymentRestMain {
// Services state
public enum ServicesState {
STOPPED, READY, INITIALIZING, RUNNING
- };
+ }
private ServicesState state = ServicesState.STOPPED;
private ApexDeploymentRest apexDeploymentRest = null;
/**
- * Main method, main entry point for command
+ * Main method, main entry point for command.
*
* @param args The command line arguments for the client
*/
}
/**
- * Constructor, kicks off the rest service
+ * Constructor, kicks off the rest service.
*
* @param args The command line arguments for the RESTful service
* @param outStream The stream for output messages
}
/**
- * Initialize the rest service
+ * Initialize the rest service.
*/
public void init() {
outStream.println("Apex Services REST endpoint (" + this.toString() + ") starting at "
}
/**
- * Explicitly shut down the services
+ * Explicitly shut down the services.
*/
public void shutdown() {
if (apexDeploymentRest != null) {
}
/**
- * This class is a shutdown hook for the Apex services command
+ * This class is a shutdown hook for the Apex services command.
*/
private class ApexServicesShutdownHook implements Runnable {
/*
/**
* A run time exception used to report parsing and parameter input errors.
*
- * User: ewatkmi Date: 31 Jul 2017
+ * @author Michael Watkins (michael.watkins@ericsson.com)
*/
public class ApexDeploymentRestParameterException extends IllegalArgumentException {
private static final long serialVersionUID = 6520231162404452427L;
/**
- * Create an ApexServicesRestParameterException with a message
+ * Create an ApexServicesRestParameterException with a message.
*
* @param message the message
*/
import org.apache.commons.cli.ParseException;
/**
- * This class reads and handles command line parameters to the Apex RESTful services
+ * This class reads and handles command line parameters to the Apex RESTful services.
*
- * User: ewatkmi Date: 31 Jul 2017
+ * @author Michael Watkins (michael.watkins@ericsson.com)
*/
public class ApexDeploymentRestParameterParser {
// Apache Commons CLI options
Options options;
/**
- * Construct the options for the CLI RESTful services
+ * Construct the options for the CLI RESTful services.
*/
public ApexDeploymentRestParameterParser() {
options = new Options();
}
/**
- * Parse the command line options
+ * Parse the command line options.
*
* @param args the arguments
* @return the parsed arguments
}
/**
- * Get help information
+ * Get help information.
*
* @param mainClassName the main class name for the help output
* @return help string
import java.net.URI;
/**
- * This class reads and handles command line parameters to the Apex RESTful services
+ * This class reads and handles command line parameters to the Apex RESTful services.
*
- * User: ewatkmi Date: 31 Jul 2017
+ * @author Michael Watkins (michael.watkins@ericsson.com)
*/
public class ApexDeploymentRestParameters {
public static final int DEFAULT_REST_PORT = 18989;
/**
* The class represents the root resource exposed at the base URL<br>
- * The url to access this resource would be in the form {@code <baseURL>/rest/....} <br>
+ *
+ * <p>The url to access this resource would be in the form {@code <baseURL>/rest/....} <br>
* For example: a GET request to the following URL
* {@code http://localhost:18989/apexservices/rest/?hostName=localhost&port=12345}
*
- * <b>Note:</b> An allocated {@code hostName} and {@code port} query parameter must be included in all requests.
+ * <p><b>Note:</b> An allocated {@code hostName} and {@code port} query parameter must be included in all requests.
* Datasets for different {@code hostName} are completely isolated from one another.
*
*/
public ApexDeploymentRestResource() {}
/**
- * Query the engine service for data
+ * Query the engine service for data.
*
* @param hostName the host name of the engine service to connect to.
* @param port the port number of the engine service to connect to.
private ParameterCheck() {}
/**
- * The Enum StartStop is used to hold .
+ * The Enum StartStop is used to hold.
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
START,
/** Stop of an Apex engine has been ordered. */
STOP
- };
+ }
private static final XLogger LOGGER = XLoggerFactory.getXLogger(ParameterCheck.class);
* 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);
}
}
INITIALIZING,
/** The editor is running. */
RUNNING
- };
+ }
private static final int EDITOR_RNNING_CHECK_TIMEOUT = 1000;
* 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);
}
}
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 =
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;
}
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())) {
+ 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(),
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;
}
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())) {
+ 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(),
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;
}
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;
}
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(),
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;
}
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;
}
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,
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;
}
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,
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;
}
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,
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;
}
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()) {
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,
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,
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;
}
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;
}
/**
- * 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
}
/**
- * 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
}
// 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.
*/
@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;
return "ContextAlbum [name=" + name + ", version=" + version + ", scope=" + scope + ", uuid=" + uuid
+ ", description=" + description + ", itemSchema=" + itemSchema + ", writeable=" + writeable + "]";
}
-
}
*/
@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.
*/
@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;
/**
/**
* 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;
}
*/
@XmlType
public class BeanKeyRef extends BeanBase {
-
- private String name = null, version = null;
+ private String name = null;
+ private String version = null;
/**
* Gets the name.
*/
@XmlType
public class BeanLogic extends BeanBase {
-
- private String logic = null, logicFlavour = null;
+ private String logic = null;
+ private String logicFlavour = null;
/**
* Gets the logic flavour.
public String toString() {
return "Logic [logicFlavour=" + logicFlavour + ", logic=" + logic + "]";
}
-
}
@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.
*/
@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;
/**
*/
@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.
*/
@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;
@XmlType
public class BeanTaskParameter extends BeanBase {
- private String parameterName = null, defaultValue = null;
+ private String parameterName = null;
+ private String defaultValue = null;
/**
* Gets the parameter name.
/**
* 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)
*/
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 {
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
+ " \"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\" : {"
+ " \"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\"},"
+ " \"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\"},"
+ " \"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\" : {"
+ " \"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\"},"
+ " \"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);
+ " \"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\"},"
+ " \"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\"},"
import org.onap.policy.apex.client.editor.rest.ApexEditorMain.EditorState;
/**
- * The Class TestApexEditorStartup.
+ * Test Apex Editor Startup.
*/
public class TestApexEditorStartup {
// CHECKSTYLE:OFF: MagicNumber
+ "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 "));
}
/**
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]"));
}
}
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]"));
}
}
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"));
}
}
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"));
}
}
+ "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 "));
}
/**
+ "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 "));
}
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\""));
}
}
+ "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 "));
}
/**
+ "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 "));
}
/**
+ "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 "));
}
+ "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 "));
}
/**
import org.junit.Test;
/**
+ * Test Apex Editor Exceptions.
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
public class TestExceptions {
*/
@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;
import org.junit.Test;
/**
+ * Test the beans.
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
public class TestBeans {
import org.slf4j.ext.XLoggerFactory;
/**
- * This class is used to launch the services. It creates a Grizzly embedded web server and runs the services.
+ * This class is used to launch the services. It creates a Grizzly embedded web server and runs the
+ * services.
*/
public class ApexServicesRest {
// Logger for this class
private HttpServer server;
/**
- * Starts the HTTP server for the Apex services client on the default base URI and with the default REST packages
+ * Starts the HTTP server for the Apex services client on the default base URI and with the
+ * default REST packages.
*/
public ApexServicesRest() {
this(new ApexServicesRestParameters());
}
/**
- * Starts the HTTP server for the Apex services client
+ * Starts the HTTP server for the Apex services client.
*
- * @param parameters: The Apex parameters to use to start the server
+ * @param parameters The Apex parameters to use to start the server
*/
public ApexServicesRest(final ApexServicesRestParameters parameters) {
Assertions.argumentNotNull(parameters, "parameters may not be null");
}
/**
- * Shut down the web server
+ * Shut down the web server.
*/
public void shutdown() {
logger.debug("Apex services RESTful client shutting down . . .");
INITIALIZING,
/** The editor is running. */
RUNNING
- };
+ }
private static final int EDITOR_RNNING_CHECK_TIMEOUT = 1000;
/**
* A run time exception used to report parsing and parameter input errors.
*
- * User: ewatkmi Date: 31 Jul 2017
+ * @author Michael Watkins (michael.watkins@ericsson.com)
*/
public class ApexServicesRestParameterException extends IllegalArgumentException {
private static final long serialVersionUID = 6520231162404452427L;
/**
- * Create an ApexServicesRestParameterException with a message
+ * Create an ApexServicesRestParameterException with a message.
*
* @param message the message
*/
import org.apache.commons.cli.ParseException;
/**
- * This class reads and handles command line parameters to the Apex RESTful services
+ * This class reads and handles command line parameters to the Apex RESTful services.
*
- * User: ewatkmi Date: 31 Jul 2017
+ * @author Michael Watkins (michael.watkins@ericsson.com)
*/
public class ApexServicesRestParameterParser {
// Apache Commons CLI options
Options options;
/**
- * Construct the options for the CLI RESTful services
+ * Construct the options for the CLI RESTful services.
*/
public ApexServicesRestParameterParser() {
options = new Options();
import java.net.URI;
/**
- * This class reads and handles command line parameters to the Apex RESTful services
+ * This class reads and handles command line parameters to the Apex RESTful services.
*
- * User: ewatkmi Date: 31 Jul 2017
+ * @author Michael Watkins (michael.watkins@ericsson.com)
*/
public class ApexServicesRestParameters {
public static final int DEFAULT_REST_PORT = 18989;
private ParameterCheck() {}
/**
- * The Enum StartStop is used to hold .
+ * The Enum StartStop is used to hold.
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
START,
/** Stop of an Apex engine has been ordered. */
STOP
- };
+ }
private static final XLogger LOGGER = XLoggerFactory.getXLogger(ParameterCheck.class);
private HttpServer server;
/**
- * Starts the HTTP server for the Apex services client on the default base URI and with the default REST packages
+ * Starts the HTTP server for the Apex services client on the default base URI and with the default REST packages.
*/
public ApexMonitoringRest() {
this(new ApexMonitoringRestParameters());
}
/**
- * Starts the HTTP server for the Apex services client
+ * Starts the HTTP server for the Apex services client.
*
- * @param parameters: The Apex parameters to use to start the server
+ * @param parameters The Apex parameters to use to start the server.
*/
public ApexMonitoringRest(final ApexMonitoringRestParameters parameters) {
Assertions.argumentNotNull(parameters, "parameters may not be null");
}
/**
- * Shut down the web server
+ * Shut down the web server.
*/
public void shutdown() {
logger.debug("Apex services RESTful client shutting down . . .");
import java.io.PrintStream;
/**
- * User: ewatkmi Date: 31 Jul 2017
+ * The main class for Apex Restful Monitoring.
+ *
+ * @author Michael Watkins (michael.watkins@ericsson.com)
*/
public class ApexMonitoringRestMain {
// Services state
public enum ServicesState {
STOPPED, READY, INITIALIZING, RUNNING
- };
+ }
private ServicesState state = ServicesState.STOPPED;
private ApexMonitoringRest apexMonitoringRest = null;
/**
- * Main method, main entry point for command
+ * Main method, main entry point for command.
*
* @param args The command line arguments for the client
*/
}
/**
- * Constructor, kicks off the rest service
+ * Constructor, kicks off the rest service.
*
* @param args The command line arguments for the RESTful service
* @param outStream The stream for output messages
}
/**
- * Initialize the rest service
+ * Initialize the rest service.
*/
public void init() {
outStream.println("Apex Services REST endpoint (" + this.toString() + ") starting at "
}
/**
- * Explicitly shut down the services
+ * Explicitly shut down the services.
*/
public void shutdown() {
if (apexMonitoringRest != null) {
}
/**
- * This class is a shutdown hook for the Apex services command
+ * This class is a shutdown hook for the Apex services command.
*/
private class ApexServicesShutdownHook implements Runnable {
/*
package org.onap.policy.apex.client.monitoring.rest;
/**
- * A run time exception used to report parsing and parameter input errors
+ * A run time exception used to report parsing and parameter input errors.
*
- * User: ewatkmi Date: 31 Jul 2017
+ * @author Michael Watkins (michael.watkins@ericsson.com)
*/
public class ApexMonitoringRestParameterException extends IllegalArgumentException {
private static final long serialVersionUID = 6520231162404452427L;
import org.apache.commons.cli.ParseException;
/**
- * This class reads and handles command line parameters to the Apex RESTful services
+ * This class reads and handles command line parameters to the Apex RESTful services.
*
- * User: ewatkmi Date: 31 Jul 2017
+ * @author Michael Watkins (michael.watkins@ericsson.com)
*/
public class ApexMonitoringRestParameterParser {
// Apache Commons CLI options
Options options;
/**
- * Construct the options for the CLI RESTful services
+ * Construct the options for the CLI RESTful services.
*/
public ApexMonitoringRestParameterParser() {
options = new Options();
import java.net.URI;
/**
- * This class reads and handles command line parameters to the Apex RESTful services
+ * This class reads and handles command line parameters to the Apex RESTful services.
*
- * User: ewatkmi Date: 31 Jul 2017
+ * @author Michael Watkins (michael.watkins@ericsson.com)
*/
public class ApexMonitoringRestParameters {
public static final int DEFAULT_REST_PORT = 18989;
public ApexMonitoringRestResource() {}
/**
- * Query the engine service for data
+ * Query the engine service for data.
*
* @param hostName the host name of the engine service to connect to.
* @param port the port number of the engine service to connect to.
}
/**
- * Start/Stop and Apex engine
+ * Start/Stop and Apex engine.
*
* @param hostName the host name of the engine service to connect to.
* @param port the port number of the engine service to connect to.
}
/**
- * Start/Stop and Apex engine
+ * Start/Stop and Apex engine.
*
* @param hostName the host name of the engine service to connect to.
* @param port the port number of the engine service to connect to.
}
/**
- * Check if periodic events are running
+ * Check if periodic events are running.
*
* @param host the engine's host url
* @return a boolean stating if periodic events are running for a given host
}
/**
- * Sets the state of periodic events for a host
+ * Sets the state of periodic events for a host.
*
* @param host the engine's host url
* @param boolean that states if periodic events have been started or stopped
/**
* This method takes in the latest data entry for an engine, adds it to an existing data set and returns the full
- * map for that host and engine
+ * map for that host and engine.
*
* @param host the engine's host url
* @param id the engines id
}
@Override
- public boolean add(final V e) {
+ public boolean add(final V elm) {
if (this.size() > (maxEntries - 1)) {
this.removeFirst();
}
- return super.add(e);
- };
+ return super.add(elm);
+ }
}
START,
/** Stop of an Apex engine has been ordered. */
STOP
- };
+ }
private static final XLogger LOGGER = XLoggerFactory.getXLogger(ParameterCheck.class);