diff options
Diffstat (limited to 'services/services-engine')
43 files changed, 350 insertions, 306 deletions
diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/engdep/EngDepMessageListener.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/engdep/EngDepMessageListener.java index 5c757c6d9..1bc88a409 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/engdep/EngDepMessageListener.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/engdep/EngDepMessageListener.java @@ -57,8 +57,8 @@ import com.google.common.eventbus.Subscribe; * processing a engDepMessage event implements this interface, and the object created with that * class is registered with a component using the component's <code>addEngDepMessageListener</code> * method. When the engDepMessage event occurs, that object's appropriate method is invoked. - * - * This class uses a queue to buffer incoming messages. When the listener is called, it places the + * + * <p>This class uses a queue to buffer incoming messages. When the listener is called, it places the * incoming message on the queue. A thread runs which removes the messages from the queue and * forwards them to the Apex engine. * diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/ApexEvent.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/ApexEvent.java index 99728c02e..38762ea97 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/ApexEvent.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/ApexEvent.java @@ -30,8 +30,9 @@ import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; /** - * The Class ApexEvent is an event class that external systems use to send events to and receive events from Apex engines. The event itself is a hash map of - * string keys and object values, used to pass data. + * The Class ApexEvent is an event class that external systems use to send events to and receive + * events from Apex engines. The event itself is a hash map of string keys and object values, used + * to pass data. * * @author Liam Fallon (liam.fallon@ericsson.com) */ @@ -43,35 +44,44 @@ public class ApexEvent extends HashMap<String, Object> implements Serializable { // Holds the next identifier for event execution. private static AtomicLong nextExecutionID = new AtomicLong(0L); - /** The name of the Apex event, a mandatory field. All Apex events must have a name so that the event can be looked up in the Apex policy model. */ + /** + * The name of the Apex event, a mandatory field. All Apex events must have a name so that the + * event can be looked up in the Apex policy model. + */ public static final String NAME_HEADER_FIELD = "name"; /** - * The version of the Apex event, an optional field. If a version is specified on an Apex event, the definition of that version of the event is taken from - * the Apex policy model. If no version is specified, the latest version of the event is used. + * The version of the Apex event, an optional field. If a version is specified on an Apex event, + * the definition of that version of the event is taken from the Apex policy model. If no + * version is specified, the latest version of the event is used. */ public static final String VERSION_HEADER_FIELD = "version"; /** - * The name space of the Apex event, an optional field. If a name space is specified on an Apex event it must match the name space on the event definition - * taken from the Apex policy model. If no name space is specified, the name space from the event definition in the Apex policy model is used. + * The name space of the Apex event, an optional field. If a name space is specified on an Apex + * event it must match the name space on the event definition taken from the Apex policy model. + * If no name space is specified, the name space from the event definition in the Apex policy + * model is used. */ public static final String NAMESPACE_HEADER_FIELD = "nameSpace"; /** - * The source of the Apex event, an optional field. It specifies where the Apex event has come from and its use is reserved for now. If no source is - * specified, the source from the event definition in the Apex policy model is used. + * The source of the Apex event, an optional field. It specifies where the Apex event has come + * from and its use is reserved for now. If no source is specified, the source from the event + * definition in the Apex policy model is used. */ public static final String SOURCE_HEADER_FIELD = "source"; /** - * The target of the Apex event, an optional field. It specifies where the Apex event is going to and its use is reserved for now. If no target is - * specified, the target from the event definition in the Apex policy model is used. + * The target of the Apex event, an optional field. It specifies where the Apex event is going + * to and its use is reserved for now. If no target is specified, the target from the event + * definition in the Apex policy model is used. */ public static final String TARGET_HEADER_FIELD = "target"; /** - * The exception message field of an Apex event is an exception message indicating that an event failed. + * The exception message field of an Apex event is an exception message indicating that an event + * failed. */ public static final String EXCEPTION_MESSAGE_HEADER_FIELD = "exceptionMessage"; @@ -99,14 +109,16 @@ public class ApexEvent extends HashMap<String, Object> implements Serializable { private final String target; // @formatter:on - // An identifier for the current event execution. The default value here will always be unique in a single JVM + // An identifier for the current event execution. The default value here will always be unique + // in a single JVM private long executionID = ApexEvent.getNextExecutionID(); // A string holding a message that indicates why processing of this event threw an exception private String exceptionMessage; /** - * Private utility to get the next candidate value for a Execution ID. This value will always be unique in a single JVM + * Private utility to get the next candidate value for a Execution ID. This value will always be + * unique in a single JVM * * @return the next candidate value for a Execution ID */ @@ -124,7 +136,8 @@ public class ApexEvent extends HashMap<String, Object> implements Serializable { * @param target the target of the event * @throws ApexEventException thrown on validation errors on event names and versions */ - public ApexEvent(final String name, final String version, final String nameSpace, final String source, final String target) throws ApexEventException { + public ApexEvent(final String name, final String version, final String nameSpace, final String source, + final String target) throws ApexEventException { // @formatter:off this.name = validateField("name", name, NAME_REGEXP); this.version = validateField("version", version, VERSION_REGEXP); @@ -143,13 +156,15 @@ public class ApexEvent extends HashMap<String, Object> implements Serializable { * @return the validated field value * @throws ApexEventException thrown if the field is invalid */ - private String validateField(final String fieldName, final String fieldValue, final String fieldRegexp) throws ApexEventException { + private String validateField(final String fieldName, final String fieldValue, final String fieldRegexp) + throws ApexEventException { if (fieldValue.matches(fieldRegexp)) { return fieldValue; - } - else { - LOGGER.warn("event \"" + name + ": field \"" + fieldName + "=" + fieldValue + "\" is illegal. It doesn't match regex '" + fieldRegexp + "'"); - throw new ApexEventException("event \"" + name + ": field \"" + fieldName + "=" + fieldValue + "\" is illegal"); + } else { + LOGGER.warn("event \"" + name + ": field \"" + fieldName + "=" + fieldValue + + "\" is illegal. It doesn't match regex '" + fieldRegexp + "'"); + throw new ApexEventException( + "event \"" + name + ": field \"" + fieldName + "=" + fieldValue + "\" is illegal"); } } @@ -163,8 +178,7 @@ public class ApexEvent extends HashMap<String, Object> implements Serializable { private String validKey(final String key) throws ApexEventException { if (key.matches(AxReferenceKey.LOCAL_NAME_REGEXP)) { return key; - } - else { + } else { LOGGER.warn("event \"" + name + ": key \"" + key + "\" is illegal"); throw new ApexEventException("event \"" + name + ": key \"" + key + "\" is illegal"); } @@ -225,8 +239,9 @@ public class ApexEvent extends HashMap<String, Object> implements Serializable { } /** - * Sets the pass-thru executionID for this event. The default value for executionID will be be unique in the current JVM. For some applications/deployments - * this executionID may need to globally unique + * Sets the pass-thru executionID for this event. The default value for executionID will be be + * unique in the current JVM. For some applications/deployments this executionID may need to + * globally unique * * @param executionID the executionID */ @@ -266,8 +281,7 @@ public class ApexEvent extends HashMap<String, Object> implements Serializable { // Check if the key is valid try { return super.put(validKey(key), value); - } - catch (final ApexEventException e) { + } catch (final ApexEventException e) { return null; } } @@ -284,8 +298,7 @@ public class ApexEvent extends HashMap<String, Object> implements Serializable { for (final String key : incomingMap.keySet()) { validKey(key); } - } - catch (final ApexEventException e) { + } catch (final ApexEventException e) { // One of the keys is invalid return; } @@ -327,8 +340,7 @@ public class ApexEvent extends HashMap<String, Object> implements Serializable { for (final Map.Entry<String, Object> dataEntry : this.entrySet()) { if (firstData) { firstData = false; - } - else { + } else { builder.append(','); } diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/ApexEventException.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/ApexEventException.java index 24f57d741..35e1508cc 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/ApexEventException.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/ApexEventException.java @@ -43,9 +43,9 @@ public class ApexEventException extends ApexException { * Instantiates a new apex event exception. * * @param message the message - * @param e the e + * @param ex the exception that caused this exception to be thrown */ - public ApexEventException(final String message, final Exception e) { - super(message, e); + public ApexEventException(final String message, final Exception ex) { + super(message, ex); } } diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/ApexEventRuntimeException.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/ApexEventRuntimeException.java index 1a624face..758a5fbf5 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/ApexEventRuntimeException.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/ApexEventRuntimeException.java @@ -43,9 +43,9 @@ public class ApexEventRuntimeException extends ApexRuntimeException { * Instantiates a new apex runtime event exception with a message and a caused by exception. * * @param message the message - * @param e the exception that caused this exception to be thrown + * @param ex the exception that caused this exception to be thrown */ - public ApexEventRuntimeException(final String message, final Exception e) { - super(message, e); + public ApexEventRuntimeException(final String message, final Exception ex) { + super(message, ex); } } diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/PeeredReference.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/PeeredReference.java index 9560a834c..14ca3f0fa 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/PeeredReference.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/PeeredReference.java @@ -35,13 +35,14 @@ public class PeeredReference { private final ApexEventProducer peeredProducer; /** - * Create a peered consumer/producer reference + * Create a peered consumer/producer reference. * * @param peeredMode the peered mode for which to return the reference * @param consumer the consumer that is receiving event * @param producer the producer that is sending events */ - public PeeredReference(final EventHandlerPeeredMode peeredMode, final ApexEventConsumer consumer, final ApexEventProducer producer) { + public PeeredReference(final EventHandlerPeeredMode peeredMode, final ApexEventConsumer consumer, + final ApexEventProducer producer) { this.peeredConsumer = consumer; this.peeredProducer = producer; diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/SynchronousEventCache.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/SynchronousEventCache.java index 25f92d843..1830fc0e5 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/SynchronousEventCache.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/SynchronousEventCache.java @@ -33,8 +33,9 @@ import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; /** - * This class holds a cache of the synchronous events sent into Apex and that have not yet been replied to. It runs a thread to time out events that have not - * been replied to in the specified timeout. + * This class holds a cache of the synchronous events sent into Apex and that have not yet been + * replied to. It runs a thread to time out events that have not been replied to in the specified + * timeout. * * @author Liam Fallon (liam.fallon@ericsson.com) */ @@ -45,7 +46,8 @@ public class SynchronousEventCache extends PeeredReference implements Runnable { // The default amount of time to wait for a synchronous event to be replied to is 1 second private static final long DEFAULT_SYNCHRONOUS_EVENT_TIMEOUT = 1000; - // The timeout to wait between event polls in milliseconds and the time to wait for the thread to stop + // The timeout to wait between event polls in milliseconds and the time to wait for the thread + // to stop private static final long OUTSTANDING_EVENT_POLL_TIMEOUT = 50; private static final long CACHE_STOP_WAIT_INTERVAL = 10; @@ -56,7 +58,8 @@ public class SynchronousEventCache extends PeeredReference implements Runnable { private final Map<Long, SimpleEntry<Long, Object>> toApexEventMap = new HashMap<Long, SimpleEntry<Long, Object>>(); // Map holding reply events - private final Map<Long, SimpleEntry<Long, Object>> fromApexEventMap = new HashMap<Long, SimpleEntry<Long, Object>>(); + private final Map<Long, SimpleEntry<Long, Object>> fromApexEventMap = + new HashMap<Long, SimpleEntry<Long, Object>>(); // The message listener thread and stopping flag private final Thread synchronousEventCacheThread; @@ -68,15 +71,16 @@ public class SynchronousEventCache extends PeeredReference implements Runnable { * @param peeredMode the peered mode for which to return the reference * @param consumer the consumer that is populating the cache * @param producer the producer that is emptying the cache - * @param synchronousEventTimeout the time in milliseconds to wait for the reply to a sent synchronous event + * @param synchronousEventTimeout the time in milliseconds to wait for the reply to a sent + * synchronous event */ - public SynchronousEventCache(final EventHandlerPeeredMode peeredMode, final ApexEventConsumer consumer, final ApexEventProducer producer, final long synchronousEventTimeout) { - super(peeredMode, consumer, producer); + public SynchronousEventCache(final EventHandlerPeeredMode peeredMode, final ApexEventConsumer consumer, + final ApexEventProducer producer, final long synchronousEventTimeout) { + super(peeredMode, consumer, producer); if (synchronousEventTimeout != 0) { this.synchronousEventTimeout = synchronousEventTimeout; - } - else { + } else { this.synchronousEventTimeout = DEFAULT_SYNCHRONOUS_EVENT_TIMEOUT; } @@ -216,18 +220,21 @@ public class SynchronousEventCache extends PeeredReference implements Runnable { /** * Cache a synchronized event sent in an event cache. + * * @param eventCacheMap the map to cache the event on * @param executionId the execution ID of the event * @param event the event to cache */ - private void cacheSynchronizedEvent(final Map<Long, SimpleEntry<Long, Object>> eventCacheMap, final long executionId, final Object event) { + private void cacheSynchronizedEvent(final Map<Long, SimpleEntry<Long, Object>> eventCacheMap, + final long executionId, final Object event) { LOGGER.entry("Adding event with execution ID: " + executionId); // Check if the event is already in the cache if (eventCacheMap.containsKey(executionId)) { - // If there was no sent event then the event timed out or some unexpected event was received + // If there was no sent event then the event timed out or some unexpected event was + // received final String errorMessage = "an event with ID " + executionId - + " already exists in the synchronous event cache, execution IDs must be unique in the system"; + + " already exists in the synchronous event cache, execution IDs must be unique in the system"; LOGGER.warn(errorMessage); throw new ApexEventRuntimeException(errorMessage); } @@ -249,7 +256,8 @@ public class SynchronousEventCache extends PeeredReference implements Runnable { * @param executionId the execution ID of the event * @return The removed event */ - private Object removeCachedEventIfExists(final Map<Long, SimpleEntry<Long, Object>> eventCacheMap, final long executionId) { + private Object removeCachedEventIfExists(final Map<Long, SimpleEntry<Long, Object>> eventCacheMap, + final long executionId) { LOGGER.entry("Removing: " + executionId); final SimpleEntry<Long, Object> removedEventEntry = eventCacheMap.remove(executionId); @@ -257,15 +265,17 @@ public class SynchronousEventCache extends PeeredReference implements Runnable { if (removedEventEntry != null) { LOGGER.exit("Removed: " + executionId); return removedEventEntry.getValue(); - } - else { - // The event may not be one of the events in our cache, so we just ignore removal failures + } else { + // The event may not be one of the events in our cache, so we just ignore removal + // failures return null; } } /** - * Time out events on an event cache map. Events that have a timeout longer than the configured timeout are timed out. + * Time out events on an event cache map. Events that have a timeout longer than the configured + * timeout are timed out. + * * @param eventCacheMap the event cache to operate on */ private void timeoutEventsOnCache(final Map<Long, SimpleEntry<Long, Object>> eventCacheMap) { @@ -287,8 +297,8 @@ public class SynchronousEventCache extends PeeredReference implements Runnable { // Remove the map entry and issue a warning final SimpleEntry<Long, Object> timedOutEventEntry = eventCacheMap.remove(timedoutEventExecutionID); - LOGGER.warn("synchronous event timed out, reply not received in " + synchronousEventTimeout + " milliseconds on event " - + timedOutEventEntry.getValue()); + LOGGER.warn("synchronous event timed out, reply not received in " + synchronousEventTimeout + + " milliseconds on event " + timedOutEventEntry.getValue()); } } } diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/eventrequestor/EventRequestorConsumer.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/eventrequestor/EventRequestorConsumer.java index b472cc9c7..8c135f19a 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/eventrequestor/EventRequestorConsumer.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/eventrequestor/EventRequestorConsumer.java @@ -98,7 +98,7 @@ public class EventRequestorConsumer implements ApexEventConsumer, Runnable { } /** - * Receive an incoming event send request from the peered event Requestor producer and queue it + * Receive an incoming event send request from the peered event Requestor producer and queue it. * * @param eventObject the incoming event to process * @throws ApexEventRuntimeException on queueing errors @@ -140,7 +140,7 @@ public class EventRequestorConsumer implements ApexEventConsumer, Runnable { } /** - * Get the number of events received to date + * Get the number of events received to date. * * @return the number of events received */ diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/eventrequestor/EventRequestorProducer.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/eventrequestor/EventRequestorProducer.java index 4a972f2ce..fda48e7ca 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/eventrequestor/EventRequestorProducer.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/eventrequestor/EventRequestorProducer.java @@ -94,7 +94,7 @@ public class EventRequestorProducer implements ApexEventProducer { } /** - * Get the number of events sent to date + * Get the number of events sent to date. * * @return the number of events received */ diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/filecarrierplugin/FILECarrierTechnologyParameters.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/filecarrierplugin/FILECarrierTechnologyParameters.java index 0081312fe..76f9b4bb3 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/filecarrierplugin/FILECarrierTechnologyParameters.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/filecarrierplugin/FILECarrierTechnologyParameters.java @@ -29,8 +29,7 @@ import org.onap.policy.common.utils.resources.ResourceUtils; * This class holds the parameters that allows transport of events into and out of Apex using files * and standard input and output. * - * <p> - * The following parameters are defined: + * <p>The following parameters are defined: * <ol> * <li>fileName: The full path to the file from which to read events or to which to write events. * <li>standardIO: If this flag is set to true, then standard input is used to read events in or @@ -149,7 +148,7 @@ public class FILECarrierTechnologyParameters extends CarrierTechnologyParameters } /** - * Gets the delay in milliseconds before the plugin starts processing + * Gets the delay in milliseconds before the plugin starts processing. * * @return the delay */ @@ -158,7 +157,7 @@ public class FILECarrierTechnologyParameters extends CarrierTechnologyParameters } /** - * Sets the delay in milliseconds before the plugin starts processing + * Sets the delay in milliseconds before the plugin starts processing. * * @param startDelay the delay */ diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/jsonprotocolplugin/Apex2JSONEventConverter.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/jsonprotocolplugin/Apex2JSONEventConverter.java index edaf5d5bb..21e4cd122 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/jsonprotocolplugin/Apex2JSONEventConverter.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/jsonprotocolplugin/Apex2JSONEventConverter.java @@ -276,11 +276,16 @@ public class Apex2JSONEventConverter implements ApexEventProtocolConverter { throws ApexEventException { // Get the event header fields // @formatter:off - String name = getJSONStringField(jsonObject, ApexEvent.NAME_HEADER_FIELD, jsonPars.getNameAlias(), ApexEvent.NAME_REGEXP, false); - String version = getJSONStringField(jsonObject, ApexEvent.VERSION_HEADER_FIELD, jsonPars.getVersionAlias(), ApexEvent.VERSION_REGEXP, false); - String namespace = getJSONStringField(jsonObject, ApexEvent.NAMESPACE_HEADER_FIELD, jsonPars.getNameSpaceAlias(), ApexEvent.NAMESPACE_REGEXP, false); - String source = getJSONStringField(jsonObject, ApexEvent.SOURCE_HEADER_FIELD, jsonPars.getSourceAlias(), ApexEvent.SOURCE_REGEXP, false); - String target = getJSONStringField(jsonObject, ApexEvent.TARGET_HEADER_FIELD, jsonPars.getTargetAlias(), ApexEvent.TARGET_REGEXP, false); + String name = getJSONStringField(jsonObject, ApexEvent.NAME_HEADER_FIELD, + jsonPars.getNameAlias(), ApexEvent.NAME_REGEXP, false); + String version = getJSONStringField(jsonObject, ApexEvent.VERSION_HEADER_FIELD, + jsonPars.getVersionAlias(), ApexEvent.VERSION_REGEXP, false); + String namespace = getJSONStringField(jsonObject, ApexEvent.NAMESPACE_HEADER_FIELD, + jsonPars.getNameSpaceAlias(), ApexEvent.NAMESPACE_REGEXP, false); + String source = getJSONStringField(jsonObject, ApexEvent.SOURCE_HEADER_FIELD, + jsonPars.getSourceAlias(), ApexEvent.SOURCE_REGEXP, false); + String target = getJSONStringField(jsonObject, ApexEvent.TARGET_HEADER_FIELD, + jsonPars.getTargetAlias(), ApexEvent.TARGET_REGEXP, false); // @formatter:on // Check that an event name has been specified @@ -292,9 +297,8 @@ public class Apex2JSONEventConverter implements ApexEventProtocolConverter { // Check if an event name was specified on the event parameters if (eventName != null) { if (name != null && !eventName.equals(name)) { - LOGGER.warn( - "The incoming event name \"{}\" does not match the configured event name \"{}\", using configured event name", - name, eventName); + LOGGER.warn("The incoming event name \"{}\" does not match the configured event name \"{}\"," + + " using configured event name", name, eventName); } name = eventName; } diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/jsonprotocolplugin/JSONEventProtocolParameters.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/jsonprotocolplugin/JSONEventProtocolParameters.java index 5f2b74204..56eaa4a1e 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/jsonprotocolplugin/JSONEventProtocolParameters.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/jsonprotocolplugin/JSONEventProtocolParameters.java @@ -25,7 +25,7 @@ import org.onap.policy.apex.service.parameters.eventprotocol.EventProtocolTextCh /** * Event protocol parameters for JSON as an event protocol. * - * The parameters for this plugin are: + * <p>The parameters for this plugin are: * <ol> * <li>nameAlias: The field in a JSON event to use as an alias for the event name. This parameter is * optional. diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexActivatorException.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexActivatorException.java index 371a3a882..d3387427e 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexActivatorException.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexActivatorException.java @@ -43,9 +43,9 @@ public class ApexActivatorException extends ApexException { * Instantiates a new apex activator exception with a message and a caused by exception. * * @param message the message - * @param e the exception that caused this exception to be thrown + * @param ex the exception that caused this exception to be thrown */ - public ApexActivatorException(final String message, final Exception e) { - super(message, e); + public ApexActivatorException(final String message, final Exception ex) { + super(message, ex); } } diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexActivatorRuntimeException.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexActivatorRuntimeException.java index cf1842dbe..083536ffc 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexActivatorRuntimeException.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexActivatorRuntimeException.java @@ -44,9 +44,9 @@ public class ApexActivatorRuntimeException extends ApexRuntimeException { * Instantiates a new apex activator exception with a message and a caused by exception. * * @param message the message - * @param e the exception that caused this exception to be thrown + * @param ex the exception that caused this exception to be thrown */ - public ApexActivatorRuntimeException(final String message, final Exception e) { - super(message, e); + public ApexActivatorRuntimeException(final String message, final Exception ex) { + super(message, ex); } } diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexCommandLineArguments.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexCommandLineArguments.java index 374b38482..d6d278ebf 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexCommandLineArguments.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexCommandLineArguments.java @@ -71,14 +71,16 @@ public class ApexCommandLineArguments { .build()); options.addOption(Option.builder("c") .longOpt("config-file") - .desc("the full path to the configuration file to use, the configuration file must be a Json file containing the Apex configuration parameters") + .desc("the full path to the configuration file to use, the configuration file must be a Json file " + + "containing the Apex configuration parameters") .hasArg() .argName("CONFIG_FILE") .required(false) .type(String.class) .build()); options.addOption(Option.builder("m").longOpt("model-file") - .desc("the full path to the model file to use, if set it overrides the model file set in the configuration file").hasArg().argName("MODEL_FILE") + .desc("the full path to the model file to use, if set it overrides the model file set in the " + + "configuration file").hasArg().argName("MODEL_FILE") .required(false) .type(String.class).build()); //@formatter:on diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/EngineService.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/EngineService.java index e6fc332f2..d64313527 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/EngineService.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/EngineService.java @@ -139,8 +139,8 @@ public interface EngineService { /** * This method checks if all Apex engines in the engine service are started. - * <p> - * Note: an engine can be both not stopped and not started, for example, when it is starting or + * + * <p>Note: an engine can be both not stopped and not started, for example, when it is starting or * stopping * * @return true if all Apex engines in the engine service are started. @@ -149,8 +149,8 @@ public interface EngineService { /** * This method checks if an Apex engine in the engine service is started. - * <p> - * Note: an engine can be both not stopped and not started, for example, when it is starting or + * + * <p>Note: an engine can be both not stopped and not started, for example, when it is starting or * stopping * * @param engineKey The key of the Apex engine to check @@ -160,8 +160,8 @@ public interface EngineService { /** * This method checks if all Apex engines in the engine service are stopped. - * <p> - * Note: an engine can be both not stopped and not started, for example, when it is starting or + * + * <p>Note: an engine can be both not stopped and not started, for example, when it is starting or * stopping * * @return true if all Apex engines in the engine service are stopped. @@ -170,8 +170,8 @@ public interface EngineService { /** * This method checks if an Apex engine in the engine service is stopped. - * <p> - * Note: an engine can be both not stopped and not started, for example, when it is starting or + * + * <p>Note: an engine can be both not stopped and not started, for example, when it is starting or * stopping * * @param engineKey The key of the Apex engine to check diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/impl/EngineServiceImpl.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/impl/EngineServiceImpl.java index 24d8263f4..2124b3118 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/impl/EngineServiceImpl.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/impl/EngineServiceImpl.java @@ -79,7 +79,7 @@ public final class EngineServiceImpl implements EngineService, EngineServiceEven private final BlockingQueue<ApexEvent> queue = new LinkedBlockingQueue<>(); // Thread factory for thread management - private final ApplicationThreadFactory tFactory = new ApplicationThreadFactory("apex-engine-service", 512); + private final ApplicationThreadFactory atFactory = new ApplicationThreadFactory("apex-engine-service", 512); // Periodic event generator and its period in milliseconds private ApexPeriodicEventGenerator periodicEventGenerator = null; @@ -111,7 +111,7 @@ public final class EngineServiceImpl implements EngineService, EngineServiceEven for (int engineCounter = 0; engineCounter < threadCount; engineCounter++) { final AxArtifactKey engineWorkerKey = new AxArtifactKey(engineServiceKey.getName() + '-' + engineCounter, engineServiceKey.getVersion()); - engineWorkerMap.put(engineWorkerKey, new EngineWorker(engineWorkerKey, queue, tFactory)); + engineWorkerMap.put(engineWorkerKey, new EngineWorker(engineWorkerKey, queue, atFactory)); LOGGER.info("Created apex engine {} .", engineWorkerKey.getID()); } diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/impl/EngineWorker.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/impl/EngineWorker.java index cd657d8fb..f82aae69b 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/impl/EngineWorker.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/impl/EngineWorker.java @@ -66,7 +66,7 @@ import com.google.gson.JsonParser; * is triggered by an Apex event, and when the policy is triggered it runs through to completion in * the ApexEngine. * - * This class acts as a container for an {@link ApexEngine}, running it in a thread, sending it + * <p>This class acts as a container for an {@link ApexEngine}, running it in a thread, sending it * events, and receiving events from it. * * @author Liam Fallon (liam.fallon@ericsson.com) diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/ApexParameterException.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/ApexParameterException.java index 229250bcf..2bc064593 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/ApexParameterException.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/ApexParameterException.java @@ -44,9 +44,9 @@ public class ApexParameterException extends ApexException { * exception. * * @param message the message - * @param e the exception that caused this exception to be thrown + * @param ex the exception that caused this exception to be thrown */ - public ApexParameterException(final String message, final Exception e) { - super(message, e); + public ApexParameterException(final String message, final Exception ex) { + super(message, ex); } } diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/ApexParameterHandler.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/ApexParameterHandler.java index 79f10bdea..31209bf08 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/ApexParameterHandler.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/ApexParameterHandler.java @@ -58,9 +58,12 @@ public class ApexParameterHandler { // Register the adapters for our carrier technologies and event protocols with GSON // @formatter:off final Gson gson = new GsonBuilder() - .registerTypeAdapter(EngineParameters .class, new EngineServiceParametersJSONAdapter()) - .registerTypeAdapter(CarrierTechnologyParameters.class, new CarrierTechnologyParametersJSONAdapter()) - .registerTypeAdapter(EventProtocolParameters .class, new EventProtocolParametersJSONAdapter()) + .registerTypeAdapter(EngineParameters .class, + new EngineServiceParametersJSONAdapter()) + .registerTypeAdapter(CarrierTechnologyParameters.class, + new CarrierTechnologyParametersJSONAdapter()) + .registerTypeAdapter(EventProtocolParameters .class, + new EventProtocolParametersJSONAdapter()) .create(); // @formatter:on parameters = gson.fromJson(new FileReader(arguments.getFullConfigurationFilePath()), ApexParameters.class); diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/ApexParameterRuntimeException.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/ApexParameterRuntimeException.java index 2334a7e60..a4917f1b6 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/ApexParameterRuntimeException.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/ApexParameterRuntimeException.java @@ -44,9 +44,9 @@ public class ApexParameterRuntimeException extends ApexRuntimeException { * exception. * * @param message the message - * @param e the exception that caused this exception to be thrown + * @param ex the exception that caused this exception to be thrown */ - public ApexParameterRuntimeException(final String message, final Exception e) { - super(message, e); + public ApexParameterRuntimeException(final String message, final Exception ex) { + super(message, ex); } } diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/ApexParameters.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/ApexParameters.java index 52c6f4960..9c65c0b32 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/ApexParameters.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/ApexParameters.java @@ -36,8 +36,8 @@ import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerPeeredMo /** * The main container parameter class for an Apex service. - * <p> - * The following parameters are defined: + * + * <p>The following parameters are defined: * <ol> * <li>engineServiceParameters: The parameters for the Apex engine service itself, such as the * number of engine threads to run and the deployment port number to use. @@ -215,7 +215,7 @@ public class ApexParameters extends AbstractParameters implements ApexParameterV } /** - * Validate parameter values for event handlers in a peered mode + * Validate parameter values for event handlers in a peered mode. * * @param eventHandlerType The event handler type we are checking * @param errorMessageBuilder The builder to which to append any error messages @@ -251,7 +251,7 @@ public class ApexParameters extends AbstractParameters implements ApexParameterV } /** - * This method validates that the settings are valid for the given peered mode + * This method validates that the settings are valid for the given peered mode. * * @param errorMessageBuilder The builder to which to append any error messages * @param peeredMode The peered mode to check @@ -281,7 +281,7 @@ public class ApexParameters extends AbstractParameters implements ApexParameterV } /** - * This method validates that the settings are valid for the event handlers on one + * This method validates that the settings are valid for the event handlers on one. * * @param messagePreamble the preamble for messages indicating the peered mode side * @param errorMessageBuilder The builder to which to append any error messages diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/carriertechnology/CarrierTechnologyParameters.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/carriertechnology/CarrierTechnologyParameters.java index ba0327de1..025183328 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/carriertechnology/CarrierTechnologyParameters.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/carriertechnology/CarrierTechnologyParameters.java @@ -26,8 +26,8 @@ import org.onap.policy.apex.service.parameters.ApexParameterValidator; /** * The default carrier technology parameter class that may be specialized by carrier technology * plugins that require plugin specific parameters. - * <p> - * The following parameters are defined: + * + * <p>The following parameters are defined: * <ol> * <li>label: The label of the carrier technology. * <li>eventProducerPluginClass: The name of the plugin class that will be used by Apex to produce diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/carriertechnology/CarrierTechnologyParametersJSONAdapter.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/carriertechnology/CarrierTechnologyParametersJSONAdapter.java index e72a283cd..38abd3c6c 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/carriertechnology/CarrierTechnologyParametersJSONAdapter.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/carriertechnology/CarrierTechnologyParametersJSONAdapter.java @@ -55,6 +55,7 @@ public class CarrierTechnologyParametersJSONAdapter // Built in technology parameters private static final Map<String, String> BUILT_IN_CARRIER_TECHNOLOGY_PARMETER_CLASS_MAP = new HashMap<>(); + static { BUILT_IN_CARRIER_TECHNOLOGY_PARMETER_CLASS_MAP.put("FILE", FILECarrierTechnologyParameters.class.getCanonicalName()); diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/engineservice/EngineServiceParameters.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/engineservice/EngineServiceParameters.java index 1db7aeb2d..3a53b59cb 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/engineservice/EngineServiceParameters.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/engineservice/EngineServiceParameters.java @@ -35,8 +35,7 @@ import org.onap.policy.apex.core.engine.EngineParameters; * This class holds the parameters for an Apex Engine Service with multiple engine threads running * multiple engines. * - * <p> - * The following parameters are defined: + * <p>The following parameters are defined: * <ol> * <li>name: The name of the Apex engine service, which can be set to any value that matches the * regular expression {@link org.onap.policy.apex.model.basicmodel.concepts.AxKey#NAME_REGEXP}. diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventhandler/EventHandlerParameters.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventhandler/EventHandlerParameters.java index 34589f31b..164544b4e 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventhandler/EventHandlerParameters.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventhandler/EventHandlerParameters.java @@ -30,12 +30,12 @@ import org.onap.policy.apex.service.parameters.eventprotocol.EventProtocolParame /** * The parameters for a single event producer, event consumer or synchronous event handler. - * <p> - * Event producers, consumers, and synchronous event handlers all use a carrier technology and an + * + * <p>Event producers, consumers, and synchronous event handlers all use a carrier technology and an * event protocol so the actual parameters for each one are the same. Therefore, we use the same * class for the parameters of each one. - * <p> - * The following parameters are defined: + * + * <p>The following parameters are defined: * <ol> * <li>carrierTechnologyParameters: The carrier technology is the type of messaging infrastructure * used to carry events. Examples are File, Kafka or REST. diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventhandler/EventHandlerPeeredMode.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventhandler/EventHandlerPeeredMode.java index b7ee667f3..39732f53d 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventhandler/EventHandlerPeeredMode.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventhandler/EventHandlerPeeredMode.java @@ -23,8 +23,7 @@ package org.onap.policy.apex.service.parameters.eventhandler; /** * This enum specifies the peered mode that an event handler may be in. * - * <p> - * The following values are defined: + * <p>The following values are defined: * <ol> * <li>SYNCHRONOUS: The event handler is tied to another event handler for event handling in APEX, * used for request-response calls where APEX is the receiver. diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolParameters.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolParameters.java index 6e66a18e9..66b5c0aae 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolParameters.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolParameters.java @@ -27,8 +27,7 @@ import org.onap.policy.apex.service.parameters.ApexParameterValidator; * A default event protocol parameter class that may be specialized by event protocol plugins that * require plugin specific parameters. * - * <p> - * The following parameters are defined: + * <p>The following parameters are defined: * <ol> * <li>label: The label of the event protocol technology. * <li>eventProducerPluginClass: The name of the plugin class that will be used by Apex to produce diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolParametersJSONAdapter.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolParametersJSONAdapter.java index 1f33db6b8..9d087bf31 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolParametersJSONAdapter.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolParametersJSONAdapter.java @@ -56,6 +56,7 @@ public class EventProtocolParametersJSONAdapter // Built in event protocol parameters private static final Map<String, String> BUILT_IN_EVENT_RPOTOCOL_PARMETER_CLASS_MAP = new HashMap<>(); + static { BUILT_IN_EVENT_RPOTOCOL_PARMETER_CLASS_MAP.put("JSON", JSONEventProtocolParameters.class.getCanonicalName()); BUILT_IN_EVENT_RPOTOCOL_PARMETER_CLASS_MAP.put("APEX", ApexEventProtocolParameters.class.getCanonicalName()); diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolTextCharDelimitedParameters.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolTextCharDelimitedParameters.java index f8873ada4..7094a3d3f 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolTextCharDelimitedParameters.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolTextCharDelimitedParameters.java @@ -26,8 +26,7 @@ import org.onap.policy.apex.service.parameters.ApexParameterValidator; * An event protocol parameter class for character delimited textual event protocols that may be * specialized by event protocol plugins that require plugin specific parameters. * - * <p> - * The following parameters are defined: + * <p>The following parameters are defined: * <ol> * <li>startChar: starting character delimiter for text blocks containing an event. * <li>endChar: ending character delimiter for text blocks containing an event. diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolTextTokenDelimitedParameters.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolTextTokenDelimitedParameters.java index 91a6403df..f71ebc6d8 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolTextTokenDelimitedParameters.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolTextTokenDelimitedParameters.java @@ -26,8 +26,7 @@ import org.onap.policy.apex.service.parameters.ApexParameterValidator; * An event protocol parameter class for token delimited textual event protocols that may be specialized by event * protocol plugins that require plugin specific parameters. * - * <p> - * The following parameters are defined: + * <p>The following parameters are defined: * <ol> * <li>startDelimiterToken: the token string that delimits the start of text blocks that contain events. * <li>endDelimiterToken: the token string that delimits the end of text blocks that contain events, this parameter is @@ -95,7 +94,7 @@ public abstract class EventProtocolTextTokenDelimitedParameters extends EventPro } /** - * Does there have to be a delimiter at the start of the first text block? + * Check if there must be a delimiter at the start of the first text block. * * @return true if there must be a delimiter at the start of the text block */ @@ -104,7 +103,7 @@ public abstract class EventProtocolTextTokenDelimitedParameters extends EventPro } /** - * Sets if there has to be a delimiter at the start of the first text block? + * Sets if there has to be a delimiter at the start of the first text block. * * @param delimiterAtStart * true if there must be a delimiter at the start of the text block diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/JSONEventGenerator.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/JSONEventGenerator.java index 4da8c4201..94210e473 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/JSONEventGenerator.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/JSONEventGenerator.java @@ -23,6 +23,8 @@ package org.onap.policy.apex.service.engine.event; import java.util.Random; /** + * This class generates JSON event used for the test cases. + * * @author Liam Fallon (liam.fallon@ericsson.com) */ public class JSONEventGenerator { diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/TestJSONEventHandler.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/TestJSONEventHandler.java index be61b165e..decec767f 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/TestJSONEventHandler.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/TestJSONEventHandler.java @@ -50,6 +50,7 @@ import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; /** + * Test JSON Event Handler. * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TestJSONEventHandler { @@ -159,7 +160,8 @@ public class TestJSONEventHandler { fail("Test should throw an exception here"); } catch (final ApexEventException e) { assertTrue(e.getMessage().startsWith( - "Failed to unmarshal JSON event: an event definition for an event named \"Event0000\" with version \"1.2.3\" not found in Apex model")); + "Failed to unmarshal JSON event: an event definition for an event named " + + "\"Event0000\" with version \"1.2.3\" not found in Apex model")); } apexEventJSONStringIn = JSONEventGenerator.jsonEventNoNamespace(); @@ -181,8 +183,8 @@ public class TestJSONEventHandler { fail("Test should throw an exception here"); } catch (final ApexEventException e) { assertTrue(e.getMessage().startsWith( - "Failed to unmarshal JSON event: namespace \"pie.in.the.sky\" on event \"Event0000\" " - + "does not match namespace \"org.onap.policy.apex.sample.events\" for that event in the Apex model")); + "Failed to unmarshal JSON event: namespace \"pie.in.the.sky\" on event \"Event0000\" does not" + + " match namespace \"org.onap.policy.apex.sample.events\" for that event in the Apex model")); } apexEventJSONStringIn = JSONEventGenerator.jsonEventNoSource(); diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/TestJSONTaggedEventConsumer.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/TestJSONTaggedEventConsumer.java index b19cceec9..49e6f3bdf 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/TestJSONTaggedEventConsumer.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/TestJSONTaggedEventConsumer.java @@ -34,6 +34,7 @@ import org.onap.policy.apex.service.engine.event.impl.filecarrierplugin.consumer import org.onap.policy.apex.service.engine.event.impl.filecarrierplugin.consumer.TextBlock; /** + * Test JSON Tagged Event Consumer. * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TestJSONTaggedEventConsumer { diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/TestPluginFactories.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/TestPluginFactories.java index 5d77bfd2a..8ecf9b745 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/TestPluginFactories.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/TestPluginFactories.java @@ -35,6 +35,7 @@ import org.onap.policy.apex.service.parameters.ApexParameters; import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters; /** + * Test Plugin Factories. * @author Liam Fallon (liam.fallon@ericsson.com) * @author John Keeney (john.keeney@ericsson.com) */ diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/main/TestApexCommandLineArguments.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/main/TestApexCommandLineArguments.java index 247f9b935..2b8bd6771 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/main/TestApexCommandLineArguments.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/main/TestApexCommandLineArguments.java @@ -28,6 +28,7 @@ import org.junit.Test; import org.onap.policy.apex.model.basicmodel.concepts.ApexException; /** + * Test Apex Command Line Arguments. * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TestApexCommandLineArguments { @@ -165,7 +166,7 @@ public class TestApexCommandLineArguments { } final String[] args06 = {"-c", "src/test/resources/parameters/goodParams.json", "-m", - "src/test/resources/main/DummyModelFile.json"}; + "src/test/resources/main/DummyModelFile.json"}; try { apexArguments.parse(args06); apexArguments.validate(); diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ContextParameterTests.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ContextParameterTests.java index 33bcd0d5f..d22d528c8 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ContextParameterTests.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ContextParameterTests.java @@ -31,7 +31,7 @@ import org.onap.policy.apex.service.parameters.ApexParameterHandler; import org.onap.policy.apex.service.parameters.ApexParameters; /** - * Test for an empty parameter file + * Test for an empty parameter file. * * @author Liam Fallon (liam.fallon@ericsson.com) */ @@ -46,10 +46,9 @@ public class ContextParameterTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "error reading parameters from \"src/test/resources/parameters/serviceContextNoParams.json\"\n" - + "(ApexParameterRuntimeException):could not find field \"parameterClassName\" in \"contextParameters\" entry", - e.getMessage()); + assertEquals("error reading parameters from \"src/test/resources/parameters/serviceContextNoParams.json\"\n" + + "(ApexParameterRuntimeException):could not find field \"parameterClassName\" in " + + "\"contextParameters\" entry", e.getMessage()); } } @@ -62,10 +61,9 @@ public class ContextParameterTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "error reading parameters from \"src/test/resources/parameters/serviceContextBadParams.json\"\n" - + "(ApexParameterRuntimeException):failed to deserialize the parameters for \"contextParameters\" to parameter class \"hello\"\n" - + "java.lang.ClassNotFoundException: hello", + assertEquals("error reading parameters from \"src/test/resources/parameters/serviceContextBadParams.json\"" + + "\n(ApexParameterRuntimeException):failed to deserialize the parameters for " + + "\"contextParameters\" to parameter class \"hello\"\njava.lang.ClassNotFoundException: hello", e.getMessage()); } } @@ -79,10 +77,10 @@ public class ContextParameterTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "error reading parameters from \"src/test/resources/parameters/serviceContextBadPluginNameParams.json\"\n" - + "(ApexParameterRuntimeException):could not find field \"parameterClassName\" in \"contextParameters\" entry", - e.getMessage()); + assertEquals("error reading parameters from " + + "\"src/test/resources/parameters/serviceContextBadPluginNameParams.json\"\n" + + "(ApexParameterRuntimeException):could not find field \"parameterClassName\" in " + + "\"contextParameters\" entry", e.getMessage()); } } @@ -96,9 +94,10 @@ public class ContextParameterTests { fail("This test should throw an exception"); } catch (final ApexParameterException e) { assertEquals( - "error reading parameters from \"src/test/resources/parameters/serviceContextBadClassParams.json\"\n" - + "(ApexParameterRuntimeException):failed to deserialize the parameters for \"contextParameters\" to parameter class \"java.lang.Integer\"\n" - + "com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected NUMBER but was BEGIN_OBJECT at path $", + "error reading parameters from \"src/test/resources/parameters/serviceContextBadClassParams.json\"" + + "\n(ApexParameterRuntimeException):failed to deserialize the parameters for \"contextParameters\"" + + " to parameter class \"java.lang.Integer\"\ncom.google.gson.JsonSyntaxException: " + + "java.lang.IllegalStateException: Expected NUMBER but was BEGIN_OBJECT at path $", e.getMessage()); } } @@ -112,10 +111,11 @@ public class ContextParameterTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "error reading parameters from \"src/test/resources/parameters/serviceContextBadPluginClassParams.json\"\n" - + "(ClassCastException):org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters cannot be cast to org.onap.policy.apex.context.parameters.ContextParameters", - e.getMessage()); + assertEquals("error reading parameters from " + + "\"src/test/resources/parameters/serviceContextBadPluginClassParams.json\"" + + "\n(ClassCastException):org.onap.policy.apex.service.engine.parameters.dummyclasses." + + "SuperDooperExecutorParameters" + + " cannot be cast to org.onap.policy.apex.context.parameters.ContextParameters", e.getMessage()); } } @@ -235,10 +235,10 @@ public class ContextParameterTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "error reading parameters from \"src/test/resources/parameters/serviceContextBadClassDistParams.json\"\n" - + "(ClassCastException):org.onap.policy.apex.context.parameters.ContextParameters cannot be cast to org.onap.policy.apex.context.parameters.DistributorParameters", - e.getMessage()); + assertEquals("error reading parameters from " + + "\"src/test/resources/parameters/serviceContextBadClassDistParams.json\"\n" + + "(ClassCastException):org.onap.policy.apex.context.parameters.ContextParameters cannot be cast to" + + " org.onap.policy.apex.context.parameters.DistributorParameters", e.getMessage()); } } @@ -251,10 +251,10 @@ public class ContextParameterTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "error reading parameters from \"src/test/resources/parameters/serviceContextBadClassLockParams.json\"\n" - + "(ClassCastException):org.onap.policy.apex.context.parameters.ContextParameters cannot be cast to org.onap.policy.apex.context.parameters.LockManagerParameters", - e.getMessage()); + assertEquals("error reading parameters from " + + "\"src/test/resources/parameters/serviceContextBadClassLockParams.json\"\n" + + "(ClassCastException):org.onap.policy.apex.context.parameters.ContextParameters cannot be cast to" + + " org.onap.policy.apex.context.parameters.LockManagerParameters", e.getMessage()); } } @@ -267,10 +267,10 @@ public class ContextParameterTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "error reading parameters from \"src/test/resources/parameters/serviceContextBadClassPersistParams.json\"\n" - + "(ClassCastException):org.onap.policy.apex.context.parameters.ContextParameters cannot be cast to org.onap.policy.apex.context.parameters.PersistorParameters", - e.getMessage()); + assertEquals("error reading parameters from " + + "\"src/test/resources/parameters/serviceContextBadClassPersistParams.json\"\n" + + "(ClassCastException):org.onap.policy.apex.context.parameters.ContextParameters cannot be cast to" + + " org.onap.policy.apex.context.parameters.PersistorParameters", e.getMessage()); } } } diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ExecutorParameterTests.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ExecutorParameterTests.java index b14cc22be..aa106a695 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ExecutorParameterTests.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ExecutorParameterTests.java @@ -30,7 +30,7 @@ import org.onap.policy.apex.service.parameters.ApexParameterHandler; import org.onap.policy.apex.service.parameters.ApexParameters; /** - * Test for an empty parameter file + * Test for an empty parameter file. * * @author Liam Fallon (liam.fallon@ericsson.com) */ @@ -61,7 +61,8 @@ public class ExecutorParameterTests { } catch (final ApexParameterException e) { assertEquals( "error reading parameters from \"src/test/resources/parameters/serviceExecutorBadParams.json\"\n" - + "(ApexParameterRuntimeException):value of \"executorParameters:ZOOBY\" entry is not a parameter JSON object", + + "(ApexParameterRuntimeException):value of \"executorParameters:ZOOBY\" entry is not " + + "a parameter JSON object", e.getMessage()); } } @@ -75,10 +76,10 @@ public class ExecutorParameterTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "error reading parameters from \"src/test/resources/parameters/serviceExecutorNoExecutorParams.json\"\n" - + "(ApexParameterRuntimeException):no \"executorParameters\" entry found in parameters, at least one executor parameter entry must be specified", - e.getMessage()); + assertEquals("error reading parameters from " + + "\"src/test/resources/parameters/serviceExecutorNoExecutorParams.json\"\n" + + "(ApexParameterRuntimeException):no \"executorParameters\" entry found in parameters," + + " at least one executor parameter entry must be specified", e.getMessage()); } } @@ -91,10 +92,10 @@ public class ExecutorParameterTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "error reading parameters from \"src/test/resources/parameters/serviceExecutorEmptyParams.json\"\n" - + "(ApexParameterRuntimeException):could not find field \"parameterClassName\" in \"executorParameters:ZOOBY\" entry", - e.getMessage()); + assertEquals("error reading parameters from " + + "\"src/test/resources/parameters/serviceExecutorEmptyParams.json\"\n" + + "(ApexParameterRuntimeException):could not find field \"parameterClassName\" " + + "in \"executorParameters:ZOOBY\" entry", e.getMessage()); } } @@ -107,10 +108,10 @@ public class ExecutorParameterTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "error reading parameters from \"src/test/resources/parameters/serviceExecutorBadPluginNameParams.json\"\n" - + "(ApexParameterRuntimeException):could not find field \"parameterClassName\" in \"executorParameters:ZOOBY\" entry", - e.getMessage()); + assertEquals("error reading parameters from " + + "\"src/test/resources/parameters/serviceExecutorBadPluginNameParams.json\"\n" + + "(ApexParameterRuntimeException):could not find field \"parameterClassName\" " + + "in \"executorParameters:ZOOBY\" entry", e.getMessage()); } } @@ -123,10 +124,10 @@ public class ExecutorParameterTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "error reading parameters from \"src/test/resources/parameters/serviceExecutorBadPluginValueObjectParams.json\"\n" - + "(ApexParameterRuntimeException):value for field \"parameterClassName\" in \"executorParameters:LOOBY\" entry is not a plain string", - e.getMessage()); + assertEquals("error reading parameters from " + + "\"src/test/resources/parameters/serviceExecutorBadPluginValueObjectParams.json\"\n" + + "(ApexParameterRuntimeException):value for field \"parameterClassName\" " + + "in \"executorParameters:LOOBY\" entry is not a plain string", e.getMessage()); } } @@ -139,10 +140,10 @@ public class ExecutorParameterTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "error reading parameters from \"src/test/resources/parameters/serviceExecutorBadPluginValueBlankParams.json\"\n" - + "(ApexParameterRuntimeException):value for field \"parameterClassName\" in \"executorParameters:LOOBY\" entry is not specified or is blank", - e.getMessage()); + assertEquals("error reading parameters from " + + "\"src/test/resources/parameters/serviceExecutorBadPluginValueBlankParams.json\"\n" + + "(ApexParameterRuntimeException):value for field \"parameterClassName\" " + + "in \"executorParameters:LOOBY\" entry is not specified or is blank", e.getMessage()); } } @@ -156,11 +157,11 @@ public class ExecutorParameterTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "error reading parameters from \"src/test/resources/parameters/serviceExecutorBadPluginValueParams.json\"\n" - + "(ApexParameterRuntimeException):failed to deserialize the parameters for \"executorParameters:LOOBY\" to parameter class \"helloworld\"\n" - + "java.lang.ClassNotFoundException: helloworld", - e.getMessage()); + assertEquals("error reading parameters from" + + " \"src/test/resources/parameters/serviceExecutorBadPluginValueParams.json\"\n" + + "(ApexParameterRuntimeException):failed to deserialize the parameters " + + "for \"executorParameters:LOOBY\" to parameter class \"helloworld\"\n" + + "java.lang.ClassNotFoundException: helloworld", e.getMessage()); } } diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ParameterTests.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ParameterTests.java index 6ea8d5924..6d3d7ee20 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ParameterTests.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ParameterTests.java @@ -41,7 +41,7 @@ import org.onap.policy.apex.service.parameters.carriertechnology.CarrierTechnolo import org.onap.policy.apex.service.parameters.eventprotocol.EventProtocolParameters; /** - * Test for an empty parameter file + * Test for an empty parameter file. * * @author Liam Fallon (liam.fallon@ericsson.com) */ @@ -115,19 +115,19 @@ public class ParameterTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "validation error(s) on parameters from \"src/test/resources/parameters/badParams.json\"\n" - + "Apex parameters invalid\n" + " engine service parameters invalid\n" - + " name [hello there] and/or version [PA1] invalid\n" - + " parameter \"name\": value \"hello there\", does not match regular expression \"[A-Za-z0-9\\-_\\.]+\"\n" - + " id not specified or specified value [-45] invalid, must be specified as id >= 0\n" - + " instanceCount [-345] invalid, must be specified as instanceCount >= 1\n" - + " deploymentPort [65536] invalid, must be specified as 1024 <= port <= 65535\n" - + " policyModelFileName [/some/file/name.xml] not found or is not a plain file\n" - + " event input (TheFileConsumer1) parameters invalid\n" - + " fileName not specified or is blank or null, it must be specified as a valid file location\n" - + " event output (FirstProducer) parameters invalid\n" - + " fileName not specified or is blank or null, it must be specified as a valid file location", + assertEquals("validation error(s) on parameters from \"src/test/resources/parameters/badParams.json\"\n" + + "Apex parameters invalid\n" + " engine service parameters invalid\n" + + " name [hello there] and/or version [PA1] invalid\n" + + " parameter \"name\": value \"hello there\"," + + " does not match regular expression \"[A-Za-z0-9\\-_\\.]+\"\n" + + " id not specified or specified value [-45] invalid, must be specified as id >= 0\n" + + " instanceCount [-345] invalid, must be specified as instanceCount >= 1\n" + + " deploymentPort [65536] invalid, must be specified as 1024 <= port <= 65535\n" + + " policyModelFileName [/some/file/name.xml] not found or is not a plain file\n" + + " event input (TheFileConsumer1) parameters invalid\n" + + " fileName not specified or is blank or null, it must be specified as a valid file location\n" + + " event output (FirstProducer) parameters invalid\n" + + " fileName not specified or is blank or null, it must be specified as a valid file location", e.getMessage()); } } diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ProducerConsumerTests.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ProducerConsumerTests.java index dad989913..a476b84ca 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ProducerConsumerTests.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ProducerConsumerTests.java @@ -31,7 +31,7 @@ import org.onap.policy.apex.service.parameters.ApexParameterHandler; import org.onap.policy.apex.service.parameters.ApexParameters; /** - * Test for an empty parameter file + * Test for an empty parameter file. * * @author Liam Fallon (liam.fallon@ericsson.com) */ @@ -111,11 +111,11 @@ public class ProducerConsumerTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "error reading parameters from \"src/test/resources/parameters/prodConsNoCTParClass.json\"\n" - + "(ApexParameterRuntimeException):carrier technology \"SUPER_DOOPER\" does not match plugin \"FILE\" in " - + "\"com.ericsson.apex.service.engine.event.impl.filecarrierplugin.FILECarrierTechnologyParameters\", " - + "specify correct carrier technology parameter plugin in parameter \"parameterClassName\"", + assertEquals("error reading parameters from \"src/test/resources/parameters/prodConsNoCTParClass.json\"\n" + + "(ApexParameterRuntimeException):carrier technology \"SUPER_DOOPER\" " + + "does not match plugin \"FILE\" in " + + "\"com.ericsson.apex.service.engine.event.impl.filecarrierplugin.FILECarrierTechnologyParameters" + + "\", specify correct carrier technology parameter plugin in parameter \"parameterClassName\"", e.getMessage()); } } @@ -129,11 +129,12 @@ public class ProducerConsumerTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "error reading parameters from \"src/test/resources/parameters/prodConsMismatchCTParClass.json\"\n" - + "(ApexParameterRuntimeException):carrier technology \"SUPER_LOOPER\" does not match plugin \"SUPER_DOOPER\" in " - + "\"com.ericsson.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters\", " - + "specify correct carrier technology parameter plugin in parameter \"parameterClassName\"", + assertEquals("error reading parameters from " + + "\"src/test/resources/parameters/prodConsMismatchCTParClass.json\"\n" + + "(ApexParameterRuntimeException):carrier technology \"SUPER_LOOPER\" " + + "does not match plugin \"SUPER_DOOPER\" in \"" + + "com.ericsson.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" + + "\", specify correct carrier technology parameter plugin in parameter \"parameterClassName\"", e.getMessage()); } } @@ -147,11 +148,12 @@ public class ProducerConsumerTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "error reading parameters from \"src/test/resources/parameters/prodConsWrongTypeCTParClass.json\"\n" - + "(ApexParameterRuntimeException):could not create default parameters for carrier technology \"SUPER_DOOPER\"\n" - + "com.ericsson.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters " - + "cannot be cast to com.ericsson.apex.service.parameters.carriertechnology.CarrierTechnologyParameters", + assertEquals("error reading parameters from " + + "\"src/test/resources/parameters/prodConsWrongTypeCTParClass.json\"\n" + + "(ApexParameterRuntimeException):could not create default parameters for carrier technology " + + "\"SUPER_DOOPER\"\ncom.ericsson.apex.service.engine.parameters.dummyclasses." + + "SuperTokenDelimitedEventProtocolParameters cannot be cast to " + + "com.ericsson.apex.service.parameters.carriertechnology.CarrierTechnologyParameters", e.getMessage()); } } @@ -184,9 +186,9 @@ public class ProducerConsumerTests { fail("This test should throw an exception"); } catch (final ApexParameterException e) { assertEquals( - "validation error(s) on parameters from \"src/test/resources/parameters/prodConsBadFileName.json\"\n" - + "Apex parameters invalid\n" + " event output (aProducer) parameters invalid\n" - + " fileName not specified or is blank or null, it must be specified as a valid file location", + "validation error(s) on parameters from \"src/test/resources/parameters/prodConsBadFileName.json\"" + + "\nApex parameters invalid\n" + " event output (aProducer) parameters invalid" + + "\n fileName not specified or is blank or null, it must be specified as a valid file location", e.getMessage()); } } @@ -201,11 +203,10 @@ public class ProducerConsumerTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "error reading parameters from \"src/test/resources/parameters/prodConsBadEPParClass.json\"\n" - + "(ApexParameterRuntimeException):event protocol \"SUPER_TOK_DEL\" does not match plugin \"JSON\" in " - + "\"com.ericsson.apex.service.engine.event.impl.jsonprotocolplugin.JSONEventProtocolParameters\", " - + "specify correct event protocol parameter plugin in parameter \"parameterClassName\"", + assertEquals("error reading parameters from \"src/test/resources/parameters/prodConsBadEPParClass.json\"\n" + + "(ApexParameterRuntimeException):event protocol \"SUPER_TOK_DEL\" does not match plugin \"JSON\" " + + "in \"com.ericsson.apex.service.engine.event.impl.jsonprotocolplugin.JSONEventProtocolParameters" + + "\", specify correct event protocol parameter plugin in parameter \"parameterClassName\"", e.getMessage()); } } @@ -219,11 +220,10 @@ public class ProducerConsumerTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "error reading parameters from \"src/test/resources/parameters/prodConsNoEPParClass.json\"\n" - + "(ApexParameterRuntimeException):event protocol \"SUPER_TOK_DEL\" does not match plugin \"JSON\" in " - + "\"com.ericsson.apex.service.engine.event.impl.jsonprotocolplugin.JSONEventProtocolParameters\", " - + "specify correct event protocol parameter plugin in parameter \"parameterClassName\"", + assertEquals("error reading parameters from \"src/test/resources/parameters/prodConsNoEPParClass.json\"\n" + + "(ApexParameterRuntimeException):event protocol \"SUPER_TOK_DEL\" does not match plugin \"JSON\" " + + "in \"com.ericsson.apex.service.engine.event.impl.jsonprotocolplugin.JSONEventProtocolParameters" + + "\", specify correct event protocol parameter plugin in parameter \"parameterClassName\"", e.getMessage()); } } @@ -239,8 +239,10 @@ public class ProducerConsumerTests { } catch (final ApexParameterException e) { assertEquals( "error reading parameters from \"src/test/resources/parameters/prodConsMismatchEPParClass.json\"\n" - + "(ApexParameterRuntimeException):event protocol \"SUPER_TOK_BEL\" does not match plugin \"SUPER_TOK_DEL\" in " - + "\"com.ericsson.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters\", " + + "(ApexParameterRuntimeException):event protocol \"SUPER_TOK_BEL\" " + + "does not match plugin \"SUPER_TOK_DEL\" in " + + "\"com.ericsson.apex.service.engine.parameters.dummyclasses." + + "SuperTokenDelimitedEventProtocolParameters\", " + "specify correct event protocol parameter plugin in parameter \"parameterClassName\"", e.getMessage()); } @@ -255,11 +257,12 @@ public class ProducerConsumerTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "error reading parameters from \"src/test/resources/parameters/prodConsWrongTypeEPParClass.json\"\n" - + "(ApexParameterRuntimeException):could not create default parameters for event protocol \"SUPER_TOK_DEL\"\n" - + "com.ericsson.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters " - + "cannot be cast to com.ericsson.apex.service.parameters.eventprotocol.EventProtocolParameters", + assertEquals("error reading parameters from " + + "\"src/test/resources/parameters/prodConsWrongTypeEPParClass.json\"\n" + + "(ApexParameterRuntimeException):could not create default parameters for event protocol " + + "\"SUPER_TOK_DEL\"\n" + + "com.ericsson.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters " + + "cannot be cast to com.ericsson.apex.service.parameters.eventprotocol.EventProtocolParameters", e.getMessage()); } } diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/SyncParameterTests.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/SyncParameterTests.java index 62e27eac9..cc1d6d3dc 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/SyncParameterTests.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/SyncParameterTests.java @@ -38,7 +38,7 @@ import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerPeeredMo import org.onap.policy.apex.service.parameters.eventprotocol.EventProtocolParameters; /** - * Test for an empty parameter file + * Test for an empty parameter file. * * @author Liam Fallon (liam.fallon@ericsson.com) */ @@ -52,11 +52,11 @@ public class SyncParameterTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "validation error(s) on parameters from \"src/test/resources/parameters/syncBadParamsNoSyncWithPeer.json\"\n" - + "Apex parameters invalid\n" - + " parameter \\\"synchronousPeer\\\" is illegal on non synchronous event output \"SyncProducer0\"", - e.getMessage()); + assertEquals("validation error(s) on parameters from " + + "\"src/test/resources/parameters/syncBadParamsNoSyncWithPeer.json\"\n" + + "Apex parameters invalid\n" + + " parameter \\\"synchronousPeer\\\" is illegal on non synchronous event output " + + "\"SyncProducer0\"", e.getMessage()); } } @@ -69,10 +69,10 @@ public class SyncParameterTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "validation error(s) on parameters from \"src/test/resources/parameters/syncBadParamsNotSyncWithPeer.json\"\n" - + "Apex parameters invalid\n" - + " parameter \\\"synchronousPeer\\\" is illegal on non synchronous event output \"SyncProducer0\"", + assertEquals("validation error(s) on parameters from " + + "\"src/test/resources/parameters/syncBadParamsNotSyncWithPeer.json\"\n" + + "Apex parameters invalid\n" + + " parameter \\\"synchronousPeer\\\" is illegal on non synchronous event output \"SyncProducer0\"", e.getMessage()); } } @@ -86,14 +86,16 @@ public class SyncParameterTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "validation error(s) on parameters from \"src/test/resources/parameters/syncBadParamsBadPeers.json\"\n" - + "Apex parameters invalid\n" - + " specified \"synchronousPeer\" parameter value \"SyncConsumer1\" on event input \"SyncConsumer0\" does not exist or is an invalid peer for this event handler\n" - + " specified \"synchronousPeer\" parameter value \"SyncConsumer0\" on event input \"SyncConsumer1\" does not exist or is an invalid peer for this event handler\n" - + " specified \"synchronousPeer\" parameter value \"SyncProducer1\" on event output \"SyncProducer0\" does not exist or is an invalid peer for this event handler\n" - + " specified \"synchronousPeer\" parameter value \"SyncProducer0\" on event output \"SyncProducer1\" does not exist or is an invalid peer for this event handler", - e.getMessage()); + assertEquals("validation error(s) on parameters from " + + "\"src/test/resources/parameters/syncBadParamsBadPeers.json\"" + "\nApex parameters invalid\n" + + " specified \"synchronousPeer\" parameter value \"SyncConsumer1\" on event input " + + "\"SyncConsumer0\" does not exist or is an invalid peer for this event handler\n" + + " specified \"synchronousPeer\" parameter value \"SyncConsumer0\" on event input " + + "\"SyncConsumer1\" does not exist or is an invalid peer for this event handler\n" + + " specified \"synchronousPeer\" parameter value \"SyncProducer1\" on event output " + + "\"SyncProducer0\" does not exist or is an invalid peer for this event handler\n" + + " specified \"synchronousPeer\" parameter value \"SyncProducer0\" on event output " + + "\"SyncProducer1\" does not exist or is an invalid peer for this event handler", e.getMessage()); } } @@ -106,16 +108,21 @@ public class SyncParameterTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "validation error(s) on parameters from \"src/test/resources/parameters/syncBadParamsInvalidTimeout.json\"\n" - + "Apex parameters invalid\n" - + " parameter \\\"synchronousTimeout\\\" value \"-1\" is illegal on synchronous event input \"SyncConsumer0\", specify a non-negative timeout value in milliseconds\n" - + " parameter \\\"synchronousTimeout\\\" value \"-99999999\" is illegal on synchronous event input \"SyncConsumer1\", specify a non-negative timeout value in milliseconds\n" - + " parameter \\\"synchronousTimeout\\\" value \"-10\" is illegal on synchronous event output \"SyncProducer0\", specify a non-negative timeout value in milliseconds\n" - + " parameter \\\"synchronousTimeout\\\" value \"-3\" is illegal on synchronous event output \"SyncProducer1\", specify a non-negative timeout value in milliseconds\n" - + " synchronous timeout of event input \"SyncConsumer0\" and event output \"SyncProducer0\" [-1/-10] do not match\n" - + " synchronous timeout of event input \"SyncConsumer1\" and event output \"SyncProducer1\" [-99999999/-3] do not match", - e.getMessage()); + assertEquals("validation error(s) on parameters from " + + "\"src/test/resources/parameters/syncBadParamsInvalidTimeout.json\"\n" + + "Apex parameters invalid\n" + + " parameter \\\"synchronousTimeout\\\" value \"-1\" is illegal on synchronous event input " + + "\"SyncConsumer0\", specify a non-negative timeout value in milliseconds\n" + + " parameter \\\"synchronousTimeout\\\" value \"-99999999\" is illegal on synchronous event input " + + "\"SyncConsumer1\", specify a non-negative timeout value in milliseconds\n" + + " parameter \\\"synchronousTimeout\\\" value \"-10\" is illegal on synchronous event output " + + "\"SyncProducer0\", specify a non-negative timeout value in milliseconds\n" + + " parameter \\\"synchronousTimeout\\\" value \"-3\" is illegal on synchronous event output " + + "\"SyncProducer1\", specify a non-negative timeout value in milliseconds\n" + + " synchronous timeout of event input \"SyncConsumer0\" and event output \"SyncProducer0\" " + + "[-1/-10] do not match\n" + + " synchronous timeout of event input \"SyncConsumer1\" and event output " + + "\"SyncProducer1\" [-99999999/-3] do not match", e.getMessage()); } } @@ -128,11 +135,10 @@ public class SyncParameterTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "validation error(s) on parameters from \"src/test/resources/parameters/syncBadParamsBadTimeout.json\"\n" - + "Apex parameters invalid\n" - + " parameter \\\"synchronousTimeout\\\" is illegal on non synchronous event output \"MyOtherProducer\"", - e.getMessage()); + assertEquals("validation error(s) on parameters from " + + "\"src/test/resources/parameters/syncBadParamsBadTimeout.json\"\n" + "Apex parameters invalid\n" + + " parameter \\\"synchronousTimeout\\\" is illegal on non synchronous event output " + + "\"MyOtherProducer\"", e.getMessage()); } } @@ -145,12 +151,13 @@ public class SyncParameterTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "validation error(s) on parameters from \"src/test/resources/parameters/syncBadParamsUnpairedTimeout.json\"\n" - + "Apex parameters invalid\n" - + " synchronous timeout of event input \"SyncConsumer0\" and event output \"SyncProducer0\" [1/10] do not match\n" - + " synchronous timeout of event input \"SyncConsumer1\" and event output \"SyncProducer1\" [99999999/3] do not match", - e.getMessage()); + assertEquals("validation error(s) on parameters from " + + "\"src/test/resources/parameters/syncBadParamsUnpairedTimeout.json\"\n" + + "Apex parameters invalid\n" + + " synchronous timeout of event input \"SyncConsumer0\" and event output " + + "\"SyncProducer0\" [1/10] do not match\n" + + " synchronous timeout of event input \"SyncConsumer1\" and event output " + + "\"SyncProducer1\" [99999999/3] do not match", e.getMessage()); } } @@ -223,13 +230,12 @@ public class SyncParameterTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "validation error(s) on parameters from \"src/test/resources/parameters/syncUnusedConsumerPeers.json\"\n" - + "Apex parameters invalid\n" - + " value of parameter \"synchronousPeer\" on event output \"SyncProducer1\" must be unique, it s used on another event output\n" - + "" - + " synchronous peers of event input \"SyncConsumer1\" and event output \"SyncProducer1/SyncConsumer0\" do not match", - e.getMessage()); + assertEquals("validation error(s) on parameters from " + + "\"src/test/resources/parameters/syncUnusedConsumerPeers.json\"\n" + "Apex parameters invalid\n" + + " value of parameter \"synchronousPeer\" on event output \"SyncProducer1\" must be unique, " + + "it s used on another event output\n" + + " synchronous peers of event input \"SyncConsumer1\" and event output " + + "\"SyncProducer1/SyncConsumer0\" do not match", e.getMessage()); } } @@ -242,12 +248,12 @@ public class SyncParameterTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "validation error(s) on parameters from \"src/test/resources/parameters/syncMismatchedPeers.json\"\n" - + "Apex parameters invalid\n" - + " synchronous peers of event input \"SyncConsumer0\" and event output \"SyncProducer0/SyncConsumer1\" do not match\n" - + " synchronous peers of event input \"SyncConsumer1\" and event output \"SyncProducer1/SyncConsumer0\" do not match", - e.getMessage()); + assertEquals("validation error(s) on parameters from " + + "\"src/test/resources/parameters/syncMismatchedPeers.json\"\nApex parameters invalid\n" + + " synchronous peers of event input \"SyncConsumer0\" and event output " + + "\"SyncProducer0/SyncConsumer1\" do not match\n" + + " synchronous peers of event input \"SyncConsumer1\" and event output " + + "\"SyncProducer1/SyncConsumer0\" do not match", e.getMessage()); } } @@ -260,12 +266,11 @@ public class SyncParameterTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "validation error(s) on parameters from \"src/test/resources/parameters/syncUnusedProducerPeers.json\"\n" - + "Apex parameters invalid\n" - + " value of parameter \"synchronousPeer\" on event input \"SyncConsumer1\" must be unique, it s used on another event input\n" - + " synchronous peers of event input \"SyncConsumer0\" and event output \"SyncProducer1/SyncConsumer1\" do not match", - e.getMessage()); + assertEquals("validation error(s) on parameters from " + + "\"src/test/resources/parameters/syncUnusedProducerPeers.json\"\nApex parameters invalid\n" + + " value of parameter \"synchronousPeer\" on event input \"SyncConsumer1\" must be unique, " + + "it is used on another event input\nsynchronous peers of event input \"SyncConsumer0\" and event" + + " output \"SyncProducer1/SyncConsumer1\" do not match", e.getMessage()); } } @@ -278,12 +283,12 @@ public class SyncParameterTests { new ApexParameterHandler().getParameters(arguments); fail("This test should throw an exception"); } catch (final ApexParameterException e) { - assertEquals( - "validation error(s) on parameters from \"src/test/resources/parameters/syncUnusedProducerPeers.json\"\n" - + "Apex parameters invalid\n" - + " value of parameter \"synchronousPeer\" on event input \"SyncConsumer1\" must be unique, it s used on another event input\n" - + " synchronous peers of event input \"SyncConsumer0\" and event output \"SyncProducer1/SyncConsumer1\" do not match", - e.getMessage()); + assertEquals("validation error(s) on parameters from " + + "\"src/test/resources/parameters/syncUnusedProducerPeers.json\"\n" + "Apex parameters invalid\n" + + " value of parameter \"synchronousPeer\" on event input \"SyncConsumer1\" " + + "must be unique, it s used on another event input\n" + + " synchronous peers of event input \"SyncConsumer0\" and event output " + + "\"SyncProducer1/SyncConsumer1\" do not match", e.getMessage()); } } diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperDistributorParameters.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperDistributorParameters.java index 6d7c6ff7e..8d7d65977 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperDistributorParameters.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperDistributorParameters.java @@ -24,7 +24,7 @@ import org.onap.policy.apex.context.parameters.DistributorParameters; import org.onap.policy.apex.model.basicmodel.service.ParameterService; /** - * Distributor parameters for the Super Dooper Distributor + * Distributor parameters for the Super Dooper Distributor. * * @author Liam Fallon (liam.fallon@ericsson.com) * @version diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperExecutorParameters.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperExecutorParameters.java index 3af772985..a7bf4d5c8 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperExecutorParameters.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperExecutorParameters.java @@ -23,7 +23,7 @@ package org.onap.policy.apex.service.engine.parameters.dummyclasses; import org.onap.policy.apex.core.engine.ExecutorParameters; /** - * Default Executor parameters for MVEL + * Default Executor parameters for MVEL. * * @author Liam Fallon (liam.fallon@ericsson.com) * @version diff --git a/services/services-engine/src/test/resources/logback-test.xml b/services/services-engine/src/test/resources/logback-test.xml index bb9d0c788..f86ce6a42 100644 --- a/services/services-engine/src/test/resources/logback-test.xml +++ b/services/services-engine/src/test/resources/logback-test.xml @@ -25,7 +25,7 @@ <statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener" /> <property name="LOG_DIR" value="${java.io.tmpdir}/apex_logging/" /> - <!-- USE FOR STD OUT ONLY --> + <!-- USE FOR STD OUT ONLY --> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <encoder> <Pattern>%d %contextName [%t] %level %logger{36} - %msg%n</Pattern> |