diff options
author | liamfallon <liam.fallon@est.tech> | 2019-06-26 15:40:41 +0000 |
---|---|---|
committer | liamfallon <liam.fallon@est.tech> | 2019-06-26 15:40:41 +0000 |
commit | ce9d82d2c0e863597d84cc8909955e398405f45a (patch) | |
tree | 8ebb853119bdf673cf6f9516d428d4cc00080aeb /plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor | |
parent | 5f029543f1e673655af2d2974113069df0b6def0 (diff) |
Add passthrough properties for APEX engine
APEX event receiver and sender plugins sometimes need to exchange
information with tasks, especially in the case of REST communication.
This change enables passthrough of Properties from the event carrier
technology plugins to APEX task, task selection, and state finalizer
logics.
Apologies for the size of the review but this change involves passinng
the properties through all the APEX components, hence the large number
of small changes.
Issue-ID: POLICY-1742
Change-Id: I219fd69550f06702ef64adbb165fe7baac422e96
Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor')
3 files changed, 10 insertions, 8 deletions
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 " |