summaryrefslogtreecommitdiffstats
path: root/plugins/plugins-event
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/plugins-event')
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsConsumer.java33
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsProducer.java47
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/test/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsProducerTest.java4
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/main/java/org/onap/policy/apex/plugins/event/carrier/kafka/ApexKafkaConsumer.java2
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/main/java/org/onap/policy/apex/plugins/event/carrier/kafka/ApexKafkaProducer.java7
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/main/java/org/onap/policy/apex/plugins/event/carrier/kafka/KafkaCarrierTechnologyParameters.java1
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConsumer.java4
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducer.java37
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducerTest.java16
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/SupportApexEventReceiver.java23
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorConsumer.java4
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorProducer.java4
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorProducerTest.java10
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/main/java/org/onap/policy/apex/plugins/event/carrier/restserver/ApexRestServerConsumer.java4
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/main/java/org/onap/policy/apex/plugins/event/carrier/restserver/ApexRestServerProducer.java6
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/java/org/onap/policy/apex/plugins/event/carrier/restserver/SupportApexEventReceiver.java23
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/main/java/org/onap/policy/apex/plugins/event/carrier/websocket/ApexWebSocketConsumer.java4
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/main/java/org/onap/policy/apex/plugins/event/carrier/websocket/ApexWebSocketProducer.java20
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/test/java/org/onap/policy/apex/plugins/event/carrier/websocket/ApexWebSocketProducerTest.java2
19 files changed, 132 insertions, 119 deletions
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsConsumer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsConsumer.java
index 303165558..3fd39eedf 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsConsumer.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsConsumer.java
@@ -142,10 +142,8 @@ public class ApexJmsConsumer implements MessageListener, ApexEventConsumer, Runn
}
}
- /*
- * (non-Javadoc)
- *
- * @see org.onap.policy.apex.service.engine.event.ApexEventConsumer#start()
+ /**
+ * {@inheritDoc}
*/
@Override
public void start() {
@@ -156,21 +154,16 @@ public class ApexJmsConsumer implements MessageListener, ApexEventConsumer, Runn
consumerThread.start();
}
- /*
- * (non-Javadoc)
- *
- * @see org.onap.policy.apex.service.engine.event.ApexEventConsumer#getName()
+ /**
+ * {@inheritDoc}
*/
@Override
public String getName() {
return name;
}
- /*
- * (non-Javadoc)
- *
- * @see org.onap.policy.apex.service.engine.event.ApexEventConsumer#getPeeredReference(org.onap.policy.apex.service.
- * parameters. eventhandler.EventHandlerPeeredMode)
+ /**
+ * {@inheritDoc}
*/
@Override
public PeeredReference getPeeredReference(final EventHandlerPeeredMode peeredMode) {
@@ -231,10 +224,8 @@ public class ApexJmsConsumer implements MessageListener, ApexEventConsumer, Runn
}
}
- /*
- * (non-Javadoc)
- *
- * @see javax.jms.MessageListener#onMessage(javax.jms.Message)
+ /**
+ * {@inheritDoc}
*/
@Override
public void onMessage(final Message jmsMessage) {
@@ -245,7 +236,7 @@ public class ApexJmsConsumer implements MessageListener, ApexEventConsumer, Runn
jmsMessage.getJMSType());
}
- eventReceiver.receiveEvent(jmsMessage);
+ eventReceiver.receiveEvent(null, jmsMessage);
} catch (final Exception e) {
final String errorMessage = "failed to receive message from JMS";
LOGGER.warn(errorMessage, e);
@@ -253,10 +244,8 @@ public class ApexJmsConsumer implements MessageListener, ApexEventConsumer, Runn
}
}
- /*
- * (non-Javadoc)
- *
- * @see org.onap.policy.apex.apps.uservice.producer.ApexEventProducer#stop()
+ /**
+ * {@inheritDoc}
*/
@Override
public void stop() {
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsProducer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsProducer.java
index 4dcbf80c8..e98ee8ff8 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsProducer.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsProducer.java
@@ -23,6 +23,7 @@ package org.onap.policy.apex.plugins.event.carrier.jms;
import java.io.Serializable;
import java.util.EnumMap;
import java.util.Map;
+import java.util.Properties;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
@@ -82,13 +83,13 @@ public class ApexJmsProducer implements ApexEventProducer {
*/
@Override
public void init(final String producerName, final EventHandlerParameters producerParameters)
- throws ApexEventException {
+ throws ApexEventException {
this.name = producerName;
// Check and get the JMS Properties
if (!(producerParameters.getCarrierTechnologyParameters() instanceof JmsCarrierTechnologyParameters)) {
- final String errorMessage = "specified producer properties are not applicable to a JMS producer ("
- + this.name + ")";
+ final String errorMessage =
+ "specified producer properties are not applicable to a JMS producer (" + this.name + ")";
LOGGER.warn(errorMessage);
throw new ApexEventException(errorMessage);
}
@@ -104,13 +105,13 @@ public class ApexJmsProducer implements ApexEventProducer {
// Check if we actually got a connection factory
if (connectionFactory == null) {
throw new IllegalArgumentException(
- "JMS context lookup of \"" + jmsProducerProperties.getConnectionFactory()
- + "\" returned null for producer (" + this.name + ")");
+ "JMS context lookup of \"" + jmsProducerProperties.getConnectionFactory()
+ + "\" returned null for producer (" + this.name + ")");
}
} catch (final Exception e) {
final String errorMessage = "lookup of JMS connection factory \""
- + jmsProducerProperties.getConnectionFactory() + "\" failed for JMS producer properties \""
- + jmsProducerProperties.getJmsConsumerProperties() + FOR_PRODUCER_TAG + this.name + ")";
+ + jmsProducerProperties.getConnectionFactory() + "\" failed for JMS producer properties \""
+ + jmsProducerProperties.getJmsConsumerProperties() + FOR_PRODUCER_TAG + this.name + ")";
LOGGER.warn(errorMessage, e);
throw new ApexEventException(errorMessage, e);
}
@@ -123,12 +124,12 @@ public class ApexJmsProducer implements ApexEventProducer {
// Check if we actually got a topic
if (jmsOutgoingTopic == null) {
throw new IllegalArgumentException("JMS context lookup of \"" + jmsProducerProperties.getProducerTopic()
- + "\" returned null for producer (" + this.name + ")");
+ + "\" returned null for producer (" + this.name + ")");
}
} catch (final Exception e) {
final String errorMessage = "lookup of JMS topic \"" + jmsProducerProperties.getProducerTopic()
- + "\" failed for JMS producer properties \""
- + jmsProducerProperties.getJmsProducerProperties() + FOR_PRODUCER_TAG + this.name + ")";
+ + "\" failed for JMS producer properties \"" + jmsProducerProperties.getJmsProducerProperties()
+ + FOR_PRODUCER_TAG + this.name + ")";
LOGGER.warn(errorMessage, e);
throw new ApexEventException(errorMessage, e);
}
@@ -136,11 +137,11 @@ public class ApexJmsProducer implements ApexEventProducer {
// Create and start a connection to the JMS server
try {
connection = connectionFactory.createConnection(jmsProducerProperties.getSecurityPrincipal(),
- jmsProducerProperties.getSecurityCredentials());
+ jmsProducerProperties.getSecurityCredentials());
connection.start();
} catch (final Exception e) {
final String errorMessage = "connection to JMS server failed for JMS properties \""
- + jmsProducerProperties.getJmsConsumerProperties() + FOR_PRODUCER_TAG + this.name + ")";
+ + jmsProducerProperties.getJmsConsumerProperties() + FOR_PRODUCER_TAG + this.name + ")";
LOGGER.warn(errorMessage, e);
throw new ApexEventException(errorMessage, e);
}
@@ -150,7 +151,7 @@ public class ApexJmsProducer implements ApexEventProducer {
jmsSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
} catch (final Exception e) {
final String errorMessage = "creation of session to JMS server failed for JMS properties \""
- + jmsProducerProperties.getJmsConsumerProperties() + FOR_PRODUCER_TAG + this.name + ")";
+ + jmsProducerProperties.getJmsConsumerProperties() + FOR_PRODUCER_TAG + this.name + ")";
LOGGER.warn(errorMessage, e);
throw new ApexEventException(errorMessage, e);
}
@@ -159,8 +160,8 @@ public class ApexJmsProducer implements ApexEventProducer {
try {
messageProducer = jmsSession.createProducer(jmsOutgoingTopic);
} catch (final Exception e) {
- final String errorMessage = "creation of producer for sending events "
- + "to JMS server failed for JMS properties \""
+ final String errorMessage =
+ "creation of producer for sending events " + "to JMS server failed for JMS properties \""
+ jmsProducerProperties.getJmsConsumerProperties() + "\"";
LOGGER.warn(errorMessage, e);
throw new ApexEventException(errorMessage, e);
@@ -206,10 +207,11 @@ public class ApexJmsProducer implements ApexEventProducer {
* java.lang.Object)
*/
@Override
- public void sendEvent(final long executionId, final String eventname, final Object eventObject) {
+ public void sendEvent(final long executionId, final Properties executionProperties, final String eventname,
+ final Object eventObject) {
// Check if this is a synchronized event, if so we have received a reply
- final SynchronousEventCache synchronousEventCache = (SynchronousEventCache) peerReferenceMap
- .get(EventHandlerPeeredMode.SYNCHRONOUS);
+ final SynchronousEventCache synchronousEventCache =
+ (SynchronousEventCache) peerReferenceMap.get(EventHandlerPeeredMode.SYNCHRONOUS);
if (synchronousEventCache != null) {
synchronousEventCache.removeCachedEventToApexIfExists(executionId);
}
@@ -217,8 +219,7 @@ public class ApexJmsProducer implements ApexEventProducer {
// Check if the object to be sent is serializable
if (!Serializable.class.isAssignableFrom(eventObject.getClass())) {
final String errorMessage = COULD_NOT_SEND_PREFIX + eventname + JMS_MESSAGE_PRODUCER_TAG + this.name
- + ", object of type \"" + eventObject.getClass().getCanonicalName()
- + "\" is not serializable";
+ + ", object of type \"" + eventObject.getClass().getCanonicalName() + "\" is not serializable";
LOGGER.warn(errorMessage);
throw new ApexEventRuntimeException(errorMessage);
}
@@ -233,7 +234,7 @@ public class ApexJmsProducer implements ApexEventProducer {
jmsMessage = jmsSession.createObjectMessage((Serializable) eventObject);
} catch (final Exception e) {
final String errorMessage = COULD_NOT_SEND_PREFIX + eventname + JMS_MESSAGE_PRODUCER_TAG + this.name
- + ", could not create JMS Object Message for object \"" + eventObject;
+ + ", could not create JMS Object Message for object \"" + eventObject;
LOGGER.warn(errorMessage, e);
throw new ApexEventRuntimeException(errorMessage);
}
@@ -243,7 +244,7 @@ public class ApexJmsProducer implements ApexEventProducer {
jmsMessage = jmsSession.createTextMessage(eventObject.toString());
} catch (final Exception e) {
final String errorMessage = COULD_NOT_SEND_PREFIX + eventname + JMS_MESSAGE_PRODUCER_TAG + this.name
- + ", could not create JMS Text Message for object \"" + eventObject;
+ + ", could not create JMS Text Message for object \"" + eventObject;
LOGGER.warn(errorMessage, e);
throw new ApexEventRuntimeException(errorMessage);
}
@@ -253,7 +254,7 @@ public class ApexJmsProducer implements ApexEventProducer {
messageProducer.send(jmsMessage);
} catch (final Exception e) {
final String errorMessage = COULD_NOT_SEND_PREFIX + eventname + JMS_MESSAGE_PRODUCER_TAG + this.name
- + ", send failed for object \"" + eventObject;
+ + ", send failed for object \"" + eventObject;
LOGGER.warn(errorMessage, e);
throw new ApexEventRuntimeException(errorMessage);
}
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/test/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsProducerTest.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/test/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsProducerTest.java
index e981f4158..34ffc4c75 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/test/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsProducerTest.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/test/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsProducerTest.java
@@ -101,7 +101,7 @@ public class ApexJmsProducerTest {
synchronousEventCache);
ApexEvent apexEvent = new ApexEvent("testEvent", "testVersion", "testNameSpace",
"testSource", "testTarget");
- apexJmsProducer.sendEvent(1000L, "TestApexJmsProducer", apexEvent);
+ apexJmsProducer.sendEvent(1000L, null, "TestApexJmsProducer", apexEvent);
}
@Test(expected = ApexEventRuntimeException.class)
@@ -111,7 +111,7 @@ public class ApexJmsProducerTest {
apexJmsConsumer, apexJmsProducer, DEFAULT_SYNCHRONOUS_EVENT_TIMEOUT);
apexJmsProducer.setPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS,
synchronousEventCache);
- apexJmsProducer.sendEvent(-1L, "TestApexJmsProducer", new ApexJmsProducerTest());
+ apexJmsProducer.sendEvent(-1L, null, "TestApexJmsProducer", new ApexJmsProducerTest());
}
@Test
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/main/java/org/onap/policy/apex/plugins/event/carrier/kafka/ApexKafkaConsumer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/main/java/org/onap/policy/apex/plugins/event/carrier/kafka/ApexKafkaConsumer.java
index 6860bca22..3ddc97a86 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/main/java/org/onap/policy/apex/plugins/event/carrier/kafka/ApexKafkaConsumer.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/main/java/org/onap/policy/apex/plugins/event/carrier/kafka/ApexKafkaConsumer.java
@@ -167,7 +167,7 @@ public class ApexKafkaConsumer implements ApexEventConsumer, Runnable {
kafkaConsumer.poll(kafkaConsumerProperties.getConsumerPollDuration().toMillis());
for (final ConsumerRecord<String, String> record : records) {
traceIfTraceEnabled(record);
- eventReceiver.receiveEvent(record.value());
+ eventReceiver.receiveEvent(null, record.value());
}
} catch (final Exception e) {
LOGGER.warn("error receiving events on thread {}", consumerThread.getName(), e);
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/main/java/org/onap/policy/apex/plugins/event/carrier/kafka/ApexKafkaProducer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/main/java/org/onap/policy/apex/plugins/event/carrier/kafka/ApexKafkaProducer.java
index c83c0ae1e..706568ae7 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/main/java/org/onap/policy/apex/plugins/event/carrier/kafka/ApexKafkaProducer.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/main/java/org/onap/policy/apex/plugins/event/carrier/kafka/ApexKafkaProducer.java
@@ -22,6 +22,7 @@ package org.onap.policy.apex.plugins.event.carrier.kafka;
import java.util.EnumMap;
import java.util.Map;
+import java.util.Properties;
import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.clients.producer.Producer;
@@ -66,8 +67,7 @@ public class ApexKafkaProducer implements ApexEventProducer {
if (!(producerParameters.getCarrierTechnologyParameters() instanceof KafkaCarrierTechnologyParameters)) {
String message = "specified producer properties are not applicable to a Kafka producer (" + this.name + ")";
LOGGER.warn(message);
- throw new ApexEventException(
- message);
+ throw new ApexEventException(message);
}
kafkaProducerProperties =
(KafkaCarrierTechnologyParameters) producerParameters.getCarrierTechnologyParameters();
@@ -112,7 +112,8 @@ public class ApexKafkaProducer implements ApexEventProducer {
* java.lang.Object)
*/
@Override
- public void sendEvent(final long executionId, final String eventName, final Object event) {
+ public void sendEvent(final long executionId, final Properties executionProperties, final String eventName,
+ final Object event) {
// Check if this is a synchronized event, if so we have received a reply
final SynchronousEventCache synchronousEventCache =
(SynchronousEventCache) peerReferenceMap.get(EventHandlerPeeredMode.SYNCHRONOUS);
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/main/java/org/onap/policy/apex/plugins/event/carrier/kafka/KafkaCarrierTechnologyParameters.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/main/java/org/onap/policy/apex/plugins/event/carrier/kafka/KafkaCarrierTechnologyParameters.java
index f66dbfe9e..620b1fb02 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/main/java/org/onap/policy/apex/plugins/event/carrier/kafka/KafkaCarrierTechnologyParameters.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/main/java/org/onap/policy/apex/plugins/event/carrier/kafka/KafkaCarrierTechnologyParameters.java
@@ -55,7 +55,6 @@ public class KafkaCarrierTechnologyParameters extends CarrierTechnologyParameter
public static final String KAFKA_EVENT_CONSUMER_PLUGIN_CLASS = ApexKafkaConsumer.class.getName();
// Repeated strings in messages
- private static final String SPECIFY_AS_STRING_MESSAGE = "not specified, must be specified as a string";
private static final String ENTRY = "entry ";
private static final String KAFKA_PROPERTIES = "kafkaProperties";
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConsumer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConsumer.java
index ddd000dd9..39389c297 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConsumer.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConsumer.java
@@ -223,7 +223,7 @@ public class ApexRestClientConsumer implements ApexEventConsumer, Runnable {
}
// Send the event into Apex
- eventReceiver.receiveEvent(eventJsonString);
+ eventReceiver.receiveEvent(null, eventJsonString);
} catch (final Exception e) {
LOGGER.warn("error receiving events on thread {}", consumerThread.getName(), e);
}
@@ -232,7 +232,7 @@ public class ApexRestClientConsumer implements ApexEventConsumer, Runnable {
/**
* Hook for unit test mocking of HTTP client.
- *
+ *
* @param client the mocked client
*/
protected void setClient(final Client client) {
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducer.java
index 4113cea4b..275f5a8c2 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducer.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducer.java
@@ -22,6 +22,7 @@ package org.onap.policy.apex.plugins.event.carrier.restclient;
import java.util.EnumMap;
import java.util.Map;
+import java.util.Properties;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
@@ -67,18 +68,18 @@ public class ApexRestClientProducer implements ApexEventProducer {
*/
@Override
public void init(final String producerName, final EventHandlerParameters producerParameters)
- throws ApexEventException {
+ throws ApexEventException {
this.name = producerName;
// Check and get the REST Properties
if (!(producerParameters.getCarrierTechnologyParameters() instanceof RestClientCarrierTechnologyParameters)) {
- final String errorMessage = "specified producer properties are not applicable to REST client producer ("
- + this.name + ")";
+ final String errorMessage =
+ "specified producer properties are not applicable to REST client producer (" + this.name + ")";
LOGGER.warn(errorMessage);
throw new ApexEventException(errorMessage);
}
- restProducerProperties = (RestClientCarrierTechnologyParameters) producerParameters
- .getCarrierTechnologyParameters();
+ restProducerProperties =
+ (RestClientCarrierTechnologyParameters) producerParameters.getCarrierTechnologyParameters();
// Check if the HTTP method has been set
if (restProducerProperties.getHttpMethod() == null) {
@@ -86,10 +87,11 @@ public class ApexRestClientProducer implements ApexEventProducer {
}
if (!RestClientCarrierTechnologyParameters.HttpMethod.POST.equals(restProducerProperties.getHttpMethod())
- && !RestClientCarrierTechnologyParameters.HttpMethod.PUT.equals(restProducerProperties.getHttpMethod())) {
+ && !RestClientCarrierTechnologyParameters.HttpMethod.PUT
+ .equals(restProducerProperties.getHttpMethod())) {
final String errorMessage = "specified HTTP method of \"" + restProducerProperties.getHttpMethod()
- + "\" is invalid, only HTTP methods \"POST\" and \"PUT\" are supproted "
- + "for event sending on REST client producer (" + this.name + ")";
+ + "\" is invalid, only HTTP methods \"POST\" and \"PUT\" are supproted "
+ + "for event sending on REST client producer (" + this.name + ")";
LOGGER.warn(errorMessage);
throw new ApexEventException(errorMessage);
}
@@ -137,10 +139,11 @@ public class ApexRestClientProducer implements ApexEventProducer {
* java.lang.Object)
*/
@Override
- public void sendEvent(final long executionId, final String eventName, final Object event) {
+ public void sendEvent(final long executionId, final Properties executionProperties, final String eventName,
+ final Object event) {
// Check if this is a synchronized event, if so we have received a reply
- final SynchronousEventCache synchronousEventCache = (SynchronousEventCache) peerReferenceMap
- .get(EventHandlerPeeredMode.SYNCHRONOUS);
+ final SynchronousEventCache synchronousEventCache =
+ (SynchronousEventCache) peerReferenceMap.get(EventHandlerPeeredMode.SYNCHRONOUS);
if (synchronousEventCache != null) {
synchronousEventCache.removeCachedEventToApexIfExists(executionId);
}
@@ -151,15 +154,15 @@ public class ApexRestClientProducer implements ApexEventProducer {
// Check that the request worked
if (response.getStatus() != Response.Status.OK.getStatusCode()) {
final String errorMessage = "send of event to URL \"" + restProducerProperties.getUrl() + "\" using HTTP \""
- + restProducerProperties.getHttpMethod() + "\" failed with status code " + response.getStatus()
- + " and message \"" + response.readEntity(String.class) + "\", event:\n" + event;
+ + restProducerProperties.getHttpMethod() + "\" failed with status code " + response.getStatus()
+ + " and message \"" + response.readEntity(String.class) + "\", event:\n" + event;
LOGGER.warn(errorMessage);
throw new ApexEventRuntimeException(errorMessage);
}
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("event sent from engine using {} to URL {} with HTTP {} : {} and response {} ", this.name,
- restProducerProperties.getUrl(), restProducerProperties.getHttpMethod(), event, response);
+ restProducerProperties.getUrl(), restProducerProperties.getHttpMethod(), event, response);
}
}
@@ -184,16 +187,16 @@ public class ApexRestClientProducer implements ApexEventProducer {
// We have already checked that it is a PUT or POST request
if (RestClientCarrierTechnologyParameters.HttpMethod.POST.equals(restProducerProperties.getHttpMethod())) {
return client.target(restProducerProperties.getUrl()).request("application/json")
- .headers(restProducerProperties.getHttpHeadersAsMultivaluedMap()).post(Entity.json(event));
+ .headers(restProducerProperties.getHttpHeadersAsMultivaluedMap()).post(Entity.json(event));
} else {
return client.target(restProducerProperties.getUrl()).request("application/json")
- .headers(restProducerProperties.getHttpHeadersAsMultivaluedMap()).put(Entity.json(event));
+ .headers(restProducerProperties.getHttpHeadersAsMultivaluedMap()).put(Entity.json(event));
}
}
/**
* Hook for unit test mocking of HTTP client.
- *
+ *
* @param client the mocked client
*/
protected void setClient(final Client client) {
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducerTest.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducerTest.java
index 8f0e0940b..8ef0ec95c 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducerTest.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducerTest.java
@@ -5,15 +5,15 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
@@ -166,7 +166,7 @@ public class ApexRestClientProducerTest {
arcp.setClient(httpClientMock);
try {
- arcp.sendEvent(123, "EventName", "This is an Event");
+ arcp.sendEvent(123, null, "EventName", "This is an Event");
arcp.stop();
} catch (Exception ex) {
fail("test should not throw an exception");
@@ -203,7 +203,7 @@ public class ApexRestClientProducerTest {
arcp.setClient(httpClientMock);
try {
- arcp.sendEvent(123, "EventName", "This is an Event");
+ arcp.sendEvent(123, null, "EventName", "This is an Event");
arcp.stop();
} catch (Exception e) {
fail("test should not throw an exception");
@@ -246,7 +246,7 @@ public class ApexRestClientProducerTest {
arcp.setClient(httpClientMock);
try {
- arcp.sendEvent(123, "EventName", "This is an Event");
+ arcp.sendEvent(123, null, "EventName", "This is an Event");
arcp.stop();
} catch (Exception e) {
fail("test should not throw an exception");
@@ -292,7 +292,7 @@ public class ApexRestClientProducerTest {
arcp.setClient(httpClientMock);
try {
- arcp.sendEvent(123, "EventName", "This is an Event");
+ arcp.sendEvent(123, null, "EventName", "This is an Event");
arcp.stop();
} catch (Exception e) {
fail("test should not throw an exception");
@@ -329,7 +329,7 @@ public class ApexRestClientProducerTest {
arcp.setClient(httpClientMock);
try {
- arcp.sendEvent(123, "EventName", "This is an Event");
+ arcp.sendEvent(123, null, "EventName", "This is an Event");
fail("test should throw an exception here");
} catch (Exception e) {
assertEquals(
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/SupportApexEventReceiver.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/SupportApexEventReceiver.java
index d3f8b9e82..5459310fa 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/SupportApexEventReceiver.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/SupportApexEventReceiver.java
@@ -5,21 +5,23 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
package org.onap.policy.apex.plugins.event.carrier.restclient;
+import java.util.Properties;
+
import org.onap.policy.apex.service.engine.event.ApexEventException;
import org.onap.policy.apex.service.engine.event.ApexEventReceiver;
@@ -32,21 +34,26 @@ public class SupportApexEventReceiver implements ApexEventReceiver {
private Object lastEvent;
private int eventCount;
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.onap.policy.apex.service.engine.event.ApexEventReceiver#receiveEvent(long, java.lang.Object)
*/
@Override
- public void receiveEvent(long executionId, Object event) throws ApexEventException {
+ public void receiveEvent(final long executionId, final Properties executionProperties, final Object event)
+ throws ApexEventException {
this.lastExecutionId = executionId;
this.lastEvent = event;
this.eventCount++;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.onap.policy.apex.service.engine.event.ApexEventReceiver#receiveEvent(java.lang.Object)
*/
@Override
- public void receiveEvent(Object event) throws ApexEventException {
+ public void receiveEvent(final Properties executionProperties, final Object event) throws ApexEventException {
this.lastEvent = event;
this.eventCount++;
}
@@ -61,7 +68,7 @@ public class SupportApexEventReceiver implements ApexEventReceiver {
/**
* Get the number of events received.
- *
+ *
* @return the number of events received
*/
public int getEventCount() {
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorConsumer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorConsumer.java
index 57c14b946..1ba00ec0a 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorConsumer.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorConsumer.java
@@ -370,7 +370,7 @@ public class ApexRestRequestorConsumer implements ApexEventConsumer, Runnable {
}
// Send the event into Apex
- eventReceiver.receiveEvent(request.getExecutionId(), eventJsonString);
+ eventReceiver.receiveEvent(request.getExecutionId(), null, eventJsonString);
synchronized (eventsReceivedLock) {
eventsReceived++;
@@ -393,7 +393,7 @@ public class ApexRestRequestorConsumer implements ApexEventConsumer, Runnable {
/**
* Execute the REST request.
*
- *
+ *
* @return the response to the REST request
*/
public Response sendEventAsRestRequest() {
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorProducer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorProducer.java
index 4985fe16f..cf5294253 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorProducer.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorProducer.java
@@ -22,6 +22,7 @@ package org.onap.policy.apex.plugins.event.carrier.restrequestor;
import java.util.EnumMap;
import java.util.Map;
+import java.util.Properties;
import org.onap.policy.apex.service.engine.event.ApexEventConsumer;
import org.onap.policy.apex.service.engine.event.ApexEventException;
@@ -149,7 +150,8 @@ public class ApexRestRequestorProducer implements ApexEventProducer {
* java.lang.Object)
*/
@Override
- public void sendEvent(final long executionId, final String eventName, final Object event) {
+ public void sendEvent(final long executionId, final Properties executionProperties, final String eventName,
+ final Object event) {
// Check if this is a synchronized event, if so we have received a reply
final SynchronousEventCache synchronousEventCache =
(SynchronousEventCache) peerReferenceMap.get(EventHandlerPeeredMode.SYNCHRONOUS);
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorProducerTest.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorProducerTest.java
index 136c189db..5222f5bdb 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorProducerTest.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorProducerTest.java
@@ -5,15 +5,15 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
@@ -119,7 +119,7 @@ public class ApexRestRequestorProducerTest {
String event = "This is the event";
try {
- producer.sendEvent(12345, eventName, event);
+ producer.sendEvent(12345, null, eventName, event);
fail("test should throw an exception here");
} catch (Exception aee) {
assertEquals("send of event to URL \"null\" failed, REST response consumer is not defined\n"
@@ -134,7 +134,7 @@ public class ApexRestRequestorProducerTest {
PeeredReference peeredReference = new PeeredReference(EventHandlerPeeredMode.REQUESTOR, consumer, producer);
producer.setPeeredReference(EventHandlerPeeredMode.REQUESTOR, peeredReference);
try {
- producer.sendEvent(12345, eventName, event);
+ producer.sendEvent(12345, null, eventName, event);
fail("test should throw an exception here");
} catch (Exception aee) {
assertEquals("send of event to URL \"null\" failed, REST response consumer "
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/main/java/org/onap/policy/apex/plugins/event/carrier/restserver/ApexRestServerConsumer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/main/java/org/onap/policy/apex/plugins/event/carrier/restserver/ApexRestServerConsumer.java
index 35490926a..b18c658af 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/main/java/org/onap/policy/apex/plugins/event/carrier/restserver/ApexRestServerConsumer.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/main/java/org/onap/policy/apex/plugins/event/carrier/restserver/ApexRestServerConsumer.java
@@ -105,7 +105,7 @@ public class ApexRestServerConsumer implements ApexEventConsumer, Runnable {
LOGGER.warn(errorMessage);
throw new ApexEventException(errorMessage);
}
-
+
// The REST parameters read from the parameter service
RestServerCarrierTechnologyParameters restConsumerProperties =
(RestServerCarrierTechnologyParameters) consumerParameters.getCarrierTechnologyParameters();
@@ -209,7 +209,7 @@ public class ApexRestServerConsumer implements ApexEventConsumer, Runnable {
try {
// Send the event into Apex
- eventReceiver.receiveEvent(executionId, event);
+ eventReceiver.receiveEvent(executionId, null, event);
} catch (final Exception e) {
final String errorMessage = "error receiving events on event consumer " + name + ", " + e.getMessage();
LOGGER.warn(errorMessage, e);
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/main/java/org/onap/policy/apex/plugins/event/carrier/restserver/ApexRestServerProducer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/main/java/org/onap/policy/apex/plugins/event/carrier/restserver/ApexRestServerProducer.java
index cacdb3408..b228ccbf0 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/main/java/org/onap/policy/apex/plugins/event/carrier/restserver/ApexRestServerProducer.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/main/java/org/onap/policy/apex/plugins/event/carrier/restserver/ApexRestServerProducer.java
@@ -22,6 +22,7 @@ package org.onap.policy.apex.plugins.event.carrier.restserver;
import java.util.EnumMap;
import java.util.Map;
+import java.util.Properties;
import org.onap.policy.apex.service.engine.event.ApexEventException;
import org.onap.policy.apex.service.engine.event.ApexEventProducer;
@@ -65,7 +66,7 @@ public class ApexRestServerProducer implements ApexEventProducer {
LOGGER.warn(errorMessage);
throw new ApexEventException(errorMessage);
}
-
+
// The REST carrier properties
RestServerCarrierTechnologyParameters restProducerProperties =
(RestServerCarrierTechnologyParameters) producerParameters.getCarrierTechnologyParameters();
@@ -128,7 +129,8 @@ public class ApexRestServerProducer implements ApexEventProducer {
* java.lang.Object)
*/
@Override
- public void sendEvent(final long executionId, final String eventName, final Object event) {
+ public void sendEvent(final long executionId, final Properties executionProperties, final String eventName,
+ final Object event) {
if (LOGGER.isDebugEnabled()) {
String message = name + ": event " + executionId + ':' + eventName + " recevied from Apex, event=" + event;
LOGGER.debug(message);
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/java/org/onap/policy/apex/plugins/event/carrier/restserver/SupportApexEventReceiver.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/java/org/onap/policy/apex/plugins/event/carrier/restserver/SupportApexEventReceiver.java
index aaba4c262..8f6e72b14 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/java/org/onap/policy/apex/plugins/event/carrier/restserver/SupportApexEventReceiver.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/java/org/onap/policy/apex/plugins/event/carrier/restserver/SupportApexEventReceiver.java
@@ -5,21 +5,23 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
package org.onap.policy.apex.plugins.event.carrier.restserver;
+import java.util.Properties;
+
import org.onap.policy.apex.service.engine.event.ApexEventException;
import org.onap.policy.apex.service.engine.event.ApexEventReceiver;
@@ -32,21 +34,26 @@ public class SupportApexEventReceiver implements ApexEventReceiver {
private Object lastEvent;
private int eventCount;
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.onap.policy.apex.service.engine.event.ApexEventReceiver#receiveEvent(long, java.lang.Object)
*/
@Override
- public void receiveEvent(long executionId, Object event) throws ApexEventException {
+ public void receiveEvent(final long executionId, final Properties executionProperties, final Object event)
+ throws ApexEventException {
this.lastExecutionId = executionId;
this.lastEvent = event;
this.eventCount++;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.onap.policy.apex.service.engine.event.ApexEventReceiver#receiveEvent(java.lang.Object)
*/
@Override
- public void receiveEvent(Object event) throws ApexEventException {
+ public void receiveEvent(final Properties executionProperties, final Object event) throws ApexEventException {
this.lastEvent = event;
this.eventCount++;
}
@@ -61,7 +68,7 @@ public class SupportApexEventReceiver implements ApexEventReceiver {
/**
* Get the number of events received.
- *
+ *
* @return the number of events received
*/
public int getEventCount() {
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/main/java/org/onap/policy/apex/plugins/event/carrier/websocket/ApexWebSocketConsumer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/main/java/org/onap/policy/apex/plugins/event/carrier/websocket/ApexWebSocketConsumer.java
index 17955c3be..f6ed6895d 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/main/java/org/onap/policy/apex/plugins/event/carrier/websocket/ApexWebSocketConsumer.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/main/java/org/onap/policy/apex/plugins/event/carrier/websocket/ApexWebSocketConsumer.java
@@ -80,7 +80,7 @@ public class ApexWebSocketConsumer implements ApexEventConsumer, WsStringMessage
LOGGER.warn("specified consumer properties are not applicable to a web socket consumer");
throw new ApexEventException("specified consumer properties are not applicable to a web socket consumer");
}
-
+
// The Web Socket properties
WebSocketCarrierTechnologyParameters webSocketConsumerProperties =
(WebSocketCarrierTechnologyParameters) consumerParameters.getCarrierTechnologyParameters();
@@ -183,7 +183,7 @@ public class ApexWebSocketConsumer implements ApexEventConsumer, WsStringMessage
@Override
public void receiveString(final String eventString) {
try {
- eventReceiver.receiveEvent(eventString);
+ eventReceiver.receiveEvent(null, eventString);
eventsRead++;
} catch (final Exception e) {
final String errorMessage = "Error sending event " + name + '_' + eventsRead + ", " + e.getMessage()
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/main/java/org/onap/policy/apex/plugins/event/carrier/websocket/ApexWebSocketProducer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/main/java/org/onap/policy/apex/plugins/event/carrier/websocket/ApexWebSocketProducer.java
index 6f04024b4..07b6d42e6 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/main/java/org/onap/policy/apex/plugins/event/carrier/websocket/ApexWebSocketProducer.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/main/java/org/onap/policy/apex/plugins/event/carrier/websocket/ApexWebSocketProducer.java
@@ -22,6 +22,7 @@ package org.onap.policy.apex.plugins.event.carrier.websocket;
import java.util.EnumMap;
import java.util.Map;
+import java.util.Properties;
import org.onap.policy.apex.core.infrastructure.messaging.MessagingException;
import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WsStringMessageClient;
@@ -57,25 +58,25 @@ public class ApexWebSocketProducer implements ApexEventProducer, WsStringMessage
@Override
public void init(final String producerName, final EventHandlerParameters producerParameters)
- throws ApexEventException {
+ throws ApexEventException {
this.name = producerName;
// Check and get the web socket Properties
if (!(producerParameters.getCarrierTechnologyParameters() instanceof WebSocketCarrierTechnologyParameters)) {
- String message = "specified producer properties for " + this.name
- + "are not applicable to a web socket producer";
+ String message =
+ "specified producer properties for " + this.name + "are not applicable to a web socket producer";
LOGGER.warn(message);
throw new ApexEventException("specified producer properties are not applicable to a web socket producer");
}
// The Web Socket properties
WebSocketCarrierTechnologyParameters webSocketProducerProperties =
- (WebSocketCarrierTechnologyParameters) producerParameters.getCarrierTechnologyParameters();
+ (WebSocketCarrierTechnologyParameters) producerParameters.getCarrierTechnologyParameters();
// Check if this is a server or a client Web Socket
if (webSocketProducerProperties.isWsClient()) {
// Create a WS client
wsStringMessager = new WsStringMessageClient(webSocketProducerProperties.getHost(),
- webSocketProducerProperties.getPort());
+ webSocketProducerProperties.getPort());
} else {
wsStringMessager = new WsStringMessageServer(webSocketProducerProperties.getPort());
}
@@ -128,10 +129,11 @@ public class ApexWebSocketProducer implements ApexEventProducer, WsStringMessage
* java.lang.Object)
*/
@Override
- public void sendEvent(final long executionId, final String eventName, final Object event) {
+ public void sendEvent(final long executionId, final Properties executionProperties, final String eventName,
+ final Object event) {
// Check if this is a synchronized event, if so we have received a reply
- final SynchronousEventCache synchronousEventCache = (SynchronousEventCache) peerReferenceMap
- .get(EventHandlerPeeredMode.SYNCHRONOUS);
+ final SynchronousEventCache synchronousEventCache =
+ (SynchronousEventCache) peerReferenceMap.get(EventHandlerPeeredMode.SYNCHRONOUS);
if (synchronousEventCache != null) {
synchronousEventCache.removeCachedEventToApexIfExists(executionId);
}
@@ -161,7 +163,7 @@ public class ApexWebSocketProducer implements ApexEventProducer, WsStringMessage
@Override
public void receiveString(final String messageString) {
String message = "received message \"" + messageString + "\" on web socket producer (" + this.name
- + ") , no messages should be received on a web socket producer";
+ + ") , no messages should be received on a web socket producer";
LOGGER.warn(message);
}
}
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/test/java/org/onap/policy/apex/plugins/event/carrier/websocket/ApexWebSocketProducerTest.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/test/java/org/onap/policy/apex/plugins/event/carrier/websocket/ApexWebSocketProducerTest.java
index b97f42ffb..d4b3114d5 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/test/java/org/onap/policy/apex/plugins/event/carrier/websocket/ApexWebSocketProducerTest.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/test/java/org/onap/policy/apex/plugins/event/carrier/websocket/ApexWebSocketProducerTest.java
@@ -107,7 +107,7 @@ public class ApexWebSocketProducerTest {
apexWebSocketConsumer, apexWebSocketProducer, DEFAULT_SYNCHRONOUS_EVENT_TIMEOUT);
apexWebSocketProducer.setPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS,
synchronousEventCache);
- apexWebSocketProducer.sendEvent(1000L, "TestApexWebSocketProducer", "apexEvent");
+ apexWebSocketProducer.sendEvent(1000L, null, "TestApexWebSocketProducer", "apexEvent");
}
@Test