summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
Diffstat (limited to 'services')
-rw-r--r--services/pom.xml2
-rw-r--r--services/services-engine/pom.xml2
-rw-r--r--services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexEventUnmarshaller.java74
-rw-r--r--services/services-onappf/pom.xml2
-rw-r--r--services/services-onappf/src/main/resources/config/OnapPfConfig.json4
-rw-r--r--services/services-onappf/src/test/resources/ApexStarterConfigParameters.json11
-rw-r--r--services/services-onappf/src/test/resources/ApexStarterConfigParametersNoop.json11
-rw-r--r--services/services-onappf/src/test/resources/ApexStarterConfigParameters_sim.json11
-rw-r--r--services/services-onappf/src/test/resources/TestConfigParameters.json11
-rw-r--r--services/services-onappf/src/test/resources/ssl/policy-keystorebin4431 -> 4431 bytes
10 files changed, 91 insertions, 37 deletions
diff --git a/services/pom.xml b/services/pom.xml
index af91ff54a..e9357a7a6 100644
--- a/services/pom.xml
+++ b/services/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.onap.policy.apex-pdp</groupId>
<artifactId>apex-pdp</artifactId>
- <version>2.4.2-SNAPSHOT</version>
+ <version>2.4.3-SNAPSHOT</version>
</parent>
<groupId>org.onap.policy.apex-pdp.services</groupId>
diff --git a/services/services-engine/pom.xml b/services/services-engine/pom.xml
index 9a9a25555..b692255ae 100644
--- a/services/services-engine/pom.xml
+++ b/services/services-engine/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.onap.policy.apex-pdp.services</groupId>
<artifactId>services</artifactId>
- <version>2.4.2-SNAPSHOT</version>
+ <version>2.4.3-SNAPSHOT</version>
</parent>
<artifactId>services-engine</artifactId>
diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexEventUnmarshaller.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexEventUnmarshaller.java
index 8c2aee1f6..dc9854158 100644
--- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexEventUnmarshaller.java
+++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexEventUnmarshaller.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019-2020 Nordix Foundation.
+ * Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,6 +22,9 @@
package org.onap.policy.apex.service.engine.main;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Iterator;
import java.util.List;
import java.util.Properties;
import java.util.concurrent.BlockingQueue;
@@ -214,40 +218,58 @@ public class ApexEventUnmarshaller implements ApexEventReceiver, Runnable {
}
// Convert the incoming events to Apex events
- try {
- final List<ApexEvent> apexEventList = converter.toApexEvent(consumerParameters.getEventName(), event);
+ List<ApexEvent> apexEventList = convertToApexEvents(event);
- for (final ApexEvent apexEvent : apexEventList) {
- isEventFilteredOut(apexEvent);
+ for (final ApexEvent apexEvent : apexEventList) {
+ // Check if this event is filtered out by the incoming filter
+ if (isEventFilteredOut(apexEvent)) {
+ // Ignore this event
+ continue;
+ }
- // Check if this event is filtered out by the incoming filter
- if (isEventFilteredOut(apexEvent)) {
- // Ignore this event
- continue;
- }
+ if (!generateExecutionId) {
+ apexEvent.setExecutionId(executionId);
+ }
- if (!generateExecutionId) {
- apexEvent.setExecutionId(executionId);
- }
+ apexEvent.setExecutionProperties(executionProperties);
- apexEvent.setExecutionProperties(executionProperties);
+ // Cache synchronized events that are sent
+ if (consumerParameters.isPeeredMode(EventHandlerPeeredMode.SYNCHRONOUS)) {
+ final SynchronousEventCache synchronousEventCache =
+ (SynchronousEventCache) consumer.getPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS);
+ synchronousEventCache.cacheSynchronizedEventToApex(apexEvent.getExecutionId(), apexEvent);
+ }
- // Cache synchronized events that are sent
- if (consumerParameters.isPeeredMode(EventHandlerPeeredMode.SYNCHRONOUS)) {
- final SynchronousEventCache synchronousEventCache =
- (SynchronousEventCache) consumer.getPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS);
- synchronousEventCache.cacheSynchronizedEventToApex(apexEvent.getExecutionId(), apexEvent);
- }
+ // Enqueue the event
+ queue.add(apexEvent);
+ }
+ }
- // Enqueue the event
- queue.add(apexEvent);
+ private List<ApexEvent> convertToApexEvents(final Object event) throws ApexEventException {
+ List<ApexEvent> apexEventList = null;
+ List<String> eventNamesList = null;
+ if (consumerParameters.getEventName() != null) {
+ eventNamesList = Arrays.asList(consumerParameters.getEventName().split("\\|"));
+ } else {
+ eventNamesList = Collections.singletonList(null);
+ }
+ Iterator<String> iterator = eventNamesList.iterator();
+ // Incoming events in an endpoint can have different structure , for e.g., success/failure response events
+ // Parse the incoming event into an APEX event defined with any one of the names specified in eventName field
+ while (iterator.hasNext()) {
+ try {
+ String eventName = iterator.next();
+ apexEventList = converter.toApexEvent(eventName, event);
+ break;
+ } catch (ApexException e) {
+ if (!iterator.hasNext()) {
+ final String errorMessage = "Error while converting event into an ApexEvent for " + name + ": "
+ + e.getMessage() + ", Event=" + event;
+ throw new ApexEventException(errorMessage, e);
+ }
}
- } catch (final ApexException e) {
- final String errorMessage = "Error while converting event into an ApexEvent for " + name + ": "
- + e.getMessage() + ", Event=" + event;
- LOGGER.warn(errorMessage, e);
- throw new ApexEventException(errorMessage, e);
}
+ return apexEventList;
}
/**
diff --git a/services/services-onappf/pom.xml b/services/services-onappf/pom.xml
index d2d0adf7e..003cff754 100644
--- a/services/services-onappf/pom.xml
+++ b/services/services-onappf/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.onap.policy.apex-pdp.services</groupId>
<artifactId>services</artifactId>
- <version>2.4.2-SNAPSHOT</version>
+ <version>2.4.3-SNAPSHOT</version>
</parent>
<artifactId>services-onappf</artifactId>
diff --git a/services/services-onappf/src/main/resources/config/OnapPfConfig.json b/services/services-onappf/src/main/resources/config/OnapPfConfig.json
index c08c44072..6c80e032b 100644
--- a/services/services-onappf/src/main/resources/config/OnapPfConfig.json
+++ b/services/services-onappf/src/main/resources/config/OnapPfConfig.json
@@ -14,10 +14,6 @@
"description":"Pdp Heartbeat",
"supportedPolicyTypes": [
{
- "name": "onap.policies.controlloop.operational.Apex",
- "version": "1.0.0"
- },
- {
"name": "onap.policies.controlloop.operational.common.Apex",
"version": "1.0.0"
},
diff --git a/services/services-onappf/src/test/resources/ApexStarterConfigParameters.json b/services/services-onappf/src/test/resources/ApexStarterConfigParameters.json
index 4e58200a4..033e75d0d 100644
--- a/services/services-onappf/src/test/resources/ApexStarterConfigParameters.json
+++ b/services/services-onappf/src/test/resources/ApexStarterConfigParameters.json
@@ -12,7 +12,16 @@
"timeIntervalMs": 120000,
"pdpType":"apex",
"description":"Pdp Heartbeat",
- "supportedPolicyTypes":[{"name":"onap.policies.controlloop.operational.Apex","version":"1.0.0"}]
+ "supportedPolicyTypes": [
+ {
+ "name": "onap.policies.controlloop.operational.common.Apex",
+ "version": "1.0.0"
+ },
+ {
+ "name": "onap.policies.native.Apex",
+ "version": "1.0.0"
+ }
+ ]
},
"topicParameterGroup": {
"topicSources" : [ {
diff --git a/services/services-onappf/src/test/resources/ApexStarterConfigParametersNoop.json b/services/services-onappf/src/test/resources/ApexStarterConfigParametersNoop.json
index 13d1dbfed..87d9fd4c3 100644
--- a/services/services-onappf/src/test/resources/ApexStarterConfigParametersNoop.json
+++ b/services/services-onappf/src/test/resources/ApexStarterConfigParametersNoop.json
@@ -12,7 +12,16 @@
"timeIntervalMs": 120000,
"pdpType":"apex",
"description":"Pdp Heartbeat",
- "supportedPolicyTypes":[{"name":"onap.policies.controlloop.operational.Apex","version":"1.0.0"}]
+ "supportedPolicyTypes": [
+ {
+ "name": "onap.policies.controlloop.operational.common.Apex",
+ "version": "1.0.0"
+ },
+ {
+ "name": "onap.policies.native.Apex",
+ "version": "1.0.0"
+ }
+ ]
},
"topicParameterGroup": {
"topicSources" : [ {
diff --git a/services/services-onappf/src/test/resources/ApexStarterConfigParameters_sim.json b/services/services-onappf/src/test/resources/ApexStarterConfigParameters_sim.json
index 67e5bcb36..9686f91a2 100644
--- a/services/services-onappf/src/test/resources/ApexStarterConfigParameters_sim.json
+++ b/services/services-onappf/src/test/resources/ApexStarterConfigParameters_sim.json
@@ -12,7 +12,16 @@
"timeIntervalMs": 120000,
"pdpType":"apex",
"description":"Pdp Heartbeat",
- "supportedPolicyTypes":[{"name":"onap.policies.controlloop.operational.Apex","version":"1.0.0"}]
+ "supportedPolicyTypes": [
+ {
+ "name": "onap.policies.controlloop.operational.common.Apex",
+ "version": "1.0.0"
+ },
+ {
+ "name": "onap.policies.native.Apex",
+ "version": "1.0.0"
+ }
+ ]
},
"topicParameterGroup": {
"topicSources" : [{
diff --git a/services/services-onappf/src/test/resources/TestConfigParameters.json b/services/services-onappf/src/test/resources/TestConfigParameters.json
index 4e58200a4..033e75d0d 100644
--- a/services/services-onappf/src/test/resources/TestConfigParameters.json
+++ b/services/services-onappf/src/test/resources/TestConfigParameters.json
@@ -12,7 +12,16 @@
"timeIntervalMs": 120000,
"pdpType":"apex",
"description":"Pdp Heartbeat",
- "supportedPolicyTypes":[{"name":"onap.policies.controlloop.operational.Apex","version":"1.0.0"}]
+ "supportedPolicyTypes": [
+ {
+ "name": "onap.policies.controlloop.operational.common.Apex",
+ "version": "1.0.0"
+ },
+ {
+ "name": "onap.policies.native.Apex",
+ "version": "1.0.0"
+ }
+ ]
},
"topicParameterGroup": {
"topicSources" : [ {
diff --git a/services/services-onappf/src/test/resources/ssl/policy-keystore b/services/services-onappf/src/test/resources/ssl/policy-keystore
index 389df5fe5..6ba25335d 100644
--- a/services/services-onappf/src/test/resources/ssl/policy-keystore
+++ b/services/services-onappf/src/test/resources/ssl/policy-keystore
Binary files differ