<outputFile>${project.build.directory}/version</outputFile>
</configuration>
</plugin>
-
</plugins>
</build>
-</project>
+ <profiles>
+ <profile>
+ <id>apexSite</id>
+ <activation>
+ <property>
+ <name>apexSite</name>
+ </property>
+ </activation>
+ <distributionManagement>
+ <site>
+ <id>${project.artifactId}-site</id>
+ <url>${apex.adsite.prefix}/modules/${project.artifactId}/</url>
+ </site>
+ </distributionManagement>
+ </profile>
+ </profiles>
+</project>
\ No newline at end of file
</pluginManagement>
</build>
</profile>
+
+ <profile>
+ <id>apexSite</id>
+ <activation>
+ <property>
+ <name>apexSite</name>
+ </property>
+ </activation>
+ <distributionManagement>
+ <site>
+ <id>${project.artifactId}-site</id>
+ <url>${apex.adsite.prefix}/modules/${project.parent.artifactId}/${project.artifactId}/</url>
+ </site>
+ </distributionManagement>
+ </profile>
</profiles>
</project>
<module>apex-pdp-package-full</module>
<module>apex-pdp-docker</module>
</modules>
+
+ <profiles>
+ <profile>
+ <id>apexSite</id>
+ <activation>
+ <property>
+ <name>apexSite</name>
+ </property>
+ </activation>
+ <distributionManagement>
+ <site>
+ <id>${project.artifactId}-site</id>
+ <url>${apex.adsite.prefix}/modules/${project.artifactId}/</url>
+ </site>
+ </distributionManagement>
+ </profile>
+ </profiles>
</project>
* 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.
*
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)
*/
// 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";
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
*/
* @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);
* @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");
}
}
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");
}
}
/**
- * 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
*/
// Check if the key is valid
try {
return super.put(validKey(key), value);
- }
- catch (final ApexEventException e) {
+ } catch (final ApexEventException e) {
return null;
}
}
for (final String key : incomingMap.keySet()) {
validKey(key);
}
- }
- catch (final ApexEventException e) {
+ } catch (final ApexEventException e) {
// One of the keys is invalid
return;
}
for (final Map.Entry<String, Object> dataEntry : this.entrySet()) {
if (firstData) {
firstData = false;
- }
- else {
+ } else {
builder.append(',');
}
* 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);
}
}
* 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);
}
}
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;
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)
*/
// 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;
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;
* @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;
}
/**
* 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);
}
* @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);
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) {
// 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());
}
}
}
}
/**
- * 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
}
/**
- * Get the number of events received to date
+ * Get the number of events received to date.
*
* @return the number of events received
*/
}
/**
- * Get the number of events sent to date
+ * Get the number of events sent to date.
*
* @return the number of events received
*/
* 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
}
/**
- * Gets the delay in milliseconds before the plugin starts processing
+ * Gets the delay in milliseconds before the plugin starts processing.
*
* @return the delay
*/
}
/**
- * Sets the delay in milliseconds before the plugin starts processing
+ * Sets the delay in milliseconds before the plugin starts processing.
*
* @param startDelay the delay
*/
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
// 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;
}
/**
* 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.
* 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);
}
}
* 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);
}
}
.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
/**
* 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.
/**
* 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
/**
* 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.
/**
* 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
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;
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());
}
* 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)
* 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);
}
}
// 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);
* 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);
}
}
/**
* 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.
}
/**
- * 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
}
/**
- * 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
}
/**
- * 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
/**
* 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
// 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());
* 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}.
/**
* 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.
/**
* 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.
* 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
// 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());
* 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.
* 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
}
/**
- * 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
*/
}
/**
- * 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
import java.util.Random;
/**
+ * This class generates JSON event used for the test cases.
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
public class JSONEventGenerator {
import org.slf4j.ext.XLoggerFactory;
/**
+ * Test JSON Event Handler.
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
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();
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();
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 {
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)
*/
import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
/**
+ * Test Apex Command Line Arguments.
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
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();
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)
*/
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());
}
}
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());
}
}
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());
}
}
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());
}
}
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());
}
}
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());
}
}
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());
}
}
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());
}
}
}
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)
*/
} 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());
}
}
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());
}
}
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());
}
}
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());
}
}
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());
}
}
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());
}
}
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());
}
}
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)
*/
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());
}
}
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)
*/
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());
}
}
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());
}
}
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());
}
}
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());
}
}
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());
}
}
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());
}
}
} 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());
}
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());
}
}
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)
*/
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());
}
}
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());
}
}
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());
}
}
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());
}
}
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());
}
}
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());
}
}
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());
}
}
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());
}
}
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());
}
}
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());
}
}
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
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
<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>