aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmModelTest.java7
-rw-r--r--examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmUseCaseTest.java121
-rw-r--r--examples/examples-onap-vcpe/src/main/resources/logic/definitive/APPCRestartVNFRequestTask.js4
-rw-r--r--examples/examples-onap-vcpe/src/main/resources/policy/ONAPvCPEPolicyModel.apex6
-rw-r--r--examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/AppcResponseCreator.java10
-rw-r--r--model/pom.xml4
-rw-r--r--model/src/test/resources/models/RealPolicyModel.json6
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/pom.xml12
-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.java54
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorConsumerTest.java5
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/RestRequestorTest.java46
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/SupportRestRequestorEndpoint.java4
-rw-r--r--plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/pom.xml12
-rw-r--r--pom.xml28
-rw-r--r--services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexMain.java11
-rw-r--r--services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/carriertechnology/CarrierTechnologyParameters.java30
-rw-r--r--services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/carriertechnology/RestPluginCarrierTechnologyParameters.java12
-rw-r--r--services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/ApexStarterMain.java4
-rw-r--r--services/services-onappf/src/main/resources/config/OnapPfConfig.json12
-rw-r--r--services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/CommonTestData.java4
-rw-r--r--services/services-onappf/src/test/resources/ApexStarterConfigParameters.json24
-rw-r--r--services/services-onappf/src/test/resources/ApexStarterConfigParameters_sim.json8
-rw-r--r--services/services-onappf/src/test/resources/TestConfigParameters.json22
-rw-r--r--testsuites/integration/integration-uservice-test/pom.xml6
24 files changed, 195 insertions, 257 deletions
diff --git a/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmModelTest.java b/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmModelTest.java
index e35d9d278..04c5c7cd5 100644
--- a/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmModelTest.java
+++ b/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmModelTest.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019-2020,2022 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2020,2022,2024 Nordix Foundation.
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -37,11 +37,10 @@ public class AadmModelTest {
/**
* Sets up embedded Derby database and the AADM model for the tests.
- * @throws Exception exception to be thrown while setting up the database connection
*/
@Before
- public void setup() throws Exception {
- testApexModel = new TestApexModel<AxPolicyModel>(AxPolicyModel.class, new TestAadmModelCreator());
+ public void setup() {
+ testApexModel = new TestApexModel<>(AxPolicyModel.class, new TestAadmModelCreator());
}
@Test
diff --git a/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmUseCaseTest.java b/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmUseCaseTest.java
index 430074ea8..6412b7d30 100644
--- a/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmUseCaseTest.java
+++ b/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmUseCaseTest.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019-2020 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2020,2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,7 +26,6 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
-import java.io.IOException;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -112,11 +111,9 @@ public class AadmUseCaseTest {
* Test aadm case.
*
* @throws ApexException the apex exception
- * @throws InterruptedException the interrupted exception
- * @throws IOException Signals that an I/O exception has occurred.
*/
@Test
- public void testAadmCase() throws ApexException, InterruptedException, IOException {
+ public void testAadmCase() throws ApexException {
final AxPolicyModel apexPolicyModel = new AadmDomainModelFactory().getAadmPolicyModel();
assertNotNull(apexPolicyModel);
final AxArtifactKey key = new AxArtifactKey("AADMApexEngine", "0.0.1");
@@ -133,9 +130,9 @@ public class AadmUseCaseTest {
// getting number of connections send it to policy, expecting probe action
logger.info("Sending too many connections trigger ");
EnEvent event = apexEngine.createEvent(axEvent.getKey());
- event.put("IMSI", Long.valueOf(123456));
+ event.put("IMSI", 123456L);
event.put("IMSI_IP", "101.111.121.131");
- event.put("ENODEB_ID", Long.valueOf(123));
+ event.put("ENODEB_ID", 123L);
event.put("SERVICE_REQUEST_COUNT", 99);
event.put("AVG_SUBSCRIBER_SERVICE_REQUEST", 101.0);
event.put("UE_IP_ADDRESS", "101.111.121.131");
@@ -155,12 +152,7 @@ public class AadmUseCaseTest {
event.put("protocol_group", "");
apexEngine.handleEvent(event);
EnEvent result = listener.getResult();
- assertTrue(result.getName().startsWith("XSTREAM_AADM_ACT_EVENT"));
- assertEquals("ExecutionIDs are different", event.getExecutionId(), result.getExecutionId());
- // no DOS_IN_eNodeB set so return probe action
- assertEquals("probe", result.get("ACTTASK"));
- assertTrue((boolean) result.get("TCP_ON"));
- assertTrue((boolean) result.get("PROBE_ON"));
+ assertProbe(result, event);
logger.info("Receiving action event with {} action", result.get("ACTTASK"));
final ContextAlbum eNodeBStatusAlbum = apexEngine.getInternalContext().get("ENodeBStatusAlbum");
@@ -170,9 +162,9 @@ public class AadmUseCaseTest {
logger.info("Sending too many connections trigger ");
event = apexEngine.createEvent(axEvent.getKey());
- event.put("IMSI", Long.valueOf(123456));
+ event.put("IMSI", 123456L);
event.put("IMSI_IP", "101.111.121.131");
- event.put("ENODEB_ID", Long.valueOf(123));
+ event.put("ENODEB_ID", 123L);
event.put("SERVICE_REQUEST_COUNT", 101);
event.put("AVG_SUBSCRIBER_SERVICE_REQUEST", 99.0);
event.put("UE_IP_ADDRESS", "101.111.121.131");
@@ -193,24 +185,16 @@ public class AadmUseCaseTest {
apexEngine.handleEvent(event);
result = listener.getResult();
- assertTrue(result.getName().startsWith("XSTREAM_AADM_ACT_EVENT"));
- assertEquals("ExecutionIDs are different", event.getExecutionId(), result.getExecutionId());
- // DOS_IN_eNodeB set to be more than throughput so return act action
- assertEquals("act", result.get("ACTTASK"));
- // only one imsi was sent to process, so stop probe and tcp
- assertTrue(!(boolean) result.get("TCP_ON"));
- assertTrue(!(boolean) result.get("PROBE_ON"));
- assertEquals(100, ((ENodeBStatus) eNodeBStatusAlbum.get("123")).getDosCount());
- logger.info("Receiving action event with {} action", result.get("ACTTASK"));
+ assertProbeDone(result, event, 100, eNodeBStatusAlbum);
((ENodeBStatus) eNodeBStatusAlbum.get("123")).setDosCount(99);
// getting number of connections send it to policy, expecting probe action
logger.info("Sending too many connections trigger ");
event = apexEngine.createEvent(axEvent.getKey());
- event.put("IMSI", Long.valueOf(123456));
+ event.put("IMSI", 123456L);
event.put("IMSI_IP", "101.111.121.131");
- event.put("ENODEB_ID", Long.valueOf(123));
+ event.put("ENODEB_ID", 123L);
event.put("SERVICE_REQUEST_COUNT", 99);
event.put("AVG_SUBSCRIBER_SERVICE_REQUEST", 101.0);
event.put("UE_IP_ADDRESS", "101.111.121.131");
@@ -231,11 +215,7 @@ public class AadmUseCaseTest {
apexEngine.handleEvent(event);
result = listener.getResult();
- assertTrue(result.getName().startsWith("XSTREAM_AADM_ACT_EVENT"));
- assertEquals("ExecutionIDs are different", event.getExecutionId(), result.getExecutionId());
- assertEquals("probe", result.get("ACTTASK"));
- assertTrue((boolean) result.get("TCP_ON"));
- assertTrue((boolean) result.get("PROBE_ON"));
+ assertProbe(result, event);
assertEquals(99, ((ENodeBStatus) eNodeBStatusAlbum.get("123")).getDosCount());
((ENodeBStatus) eNodeBStatusAlbum.get("123")).setDosCount(99);
@@ -243,9 +223,9 @@ public class AadmUseCaseTest {
// tcp correlation return positive dos
logger.info("Receiving action event with {} action", result.get("ACTTASK"));
event = apexEngine.createEvent(axEvent.getKey());
- event.put("IMSI", Long.valueOf(123456));
+ event.put("IMSI", 123456L);
event.put("IMSI_IP", "101.111.121.131");
- event.put("ENODEB_ID", Long.valueOf(123));
+ event.put("ENODEB_ID", 123L);
event.put("TCP_UE_SIDE_AVG_THROUGHPUT", 101.0);
event.put("ACTTASK", "");
event.put("APPLICATION", "");
@@ -266,24 +246,17 @@ public class AadmUseCaseTest {
apexEngine.handleEvent(event);
result = listener.getResult();
- assertTrue(result.getName().startsWith("XSTREAM_AADM_ACT_EVENT"));
- assertEquals("ExecutionIDs are different", event.getExecutionId(), result.getExecutionId());
- assertEquals("act", result.get("ACTTASK"));
- assertTrue(!(boolean) result.get("TCP_ON"));
- assertTrue(!(boolean) result.get("PROBE_ON"));
- assertEquals(98, ((ENodeBStatus) eNodeBStatusAlbum.get("123")).getDosCount());
- logger.info("Receiving action event with {} action", result.get("ACTTASK"));
+ assertProbeDone(result, event, 98, eNodeBStatusAlbum);
((ENodeBStatus) eNodeBStatusAlbum.get("123")).setDosCount(101);
// user moving enodeB
logger.info("Sending too many connections trigger ");
event = apexEngine.createEvent(axEvent.getKey());
- event.put("IMSI", Long.valueOf(123456));
+ event.put("IMSI", 123456L);
event.put("IMSI_IP", "101.111.121.131");
- event.put("ENODEB_ID", Long.valueOf(123));
+ event.put("ENODEB_ID", 123L);
event.put("SERVICE_REQUEST_COUNT", 99);
- event.put("AVG_SUBSCRIBER_SERVICE_REQUEST", 101.0);
event.put("UE_IP_ADDRESS", "101.111.121.131");
event.put("NUM_SUBSCRIBERS", 101);
event.put("ACTTASK", "");
@@ -303,18 +276,13 @@ public class AadmUseCaseTest {
apexEngine.handleEvent(event);
result = listener.getResult();
- assertTrue(result.getName().startsWith("XSTREAM_AADM_ACT_EVENT"));
- assertEquals("ExecutionIDs are different", event.getExecutionId(), result.getExecutionId());
- assertEquals("act", result.get("ACTTASK"));
- assertTrue(!(boolean) result.get("TCP_ON"));
- assertTrue(!(boolean) result.get("PROBE_ON"));
- assertEquals(100, ((ENodeBStatus) eNodeBStatusAlbum.get("123")).getDosCount());
+ assertProbeDone(result, event, 100, eNodeBStatusAlbum);
logger.info("Receiving action event with {} action", result.get("ACTTASK"));
logger.info("Sending too many connections trigger ");
event = apexEngine.createEvent(axEvent.getKey());
- event.put("IMSI", Long.valueOf(123456));
- event.put("ENODEB_ID", Long.valueOf(124));
+ event.put("IMSI", 123456L);
+ event.put("ENODEB_ID", 124L);
event.put("SERVICE_REQUEST_COUNT", 99);
event.put("AVG_SUBSCRIBER_SERVICE_REQUEST", 101.0);
event.put("UE_IP_ADDRESS", "101.111.121.131");
@@ -336,11 +304,7 @@ public class AadmUseCaseTest {
apexEngine.handleEvent(event);
result = listener.getResult();
- assertTrue(result.getName().startsWith("XSTREAM_AADM_ACT_EVENT"));
- assertEquals("ExecutionIDs are different", event.getExecutionId(), result.getExecutionId());
- assertEquals("probe", result.get("ACTTASK"));
- assertTrue((boolean) result.get("TCP_ON"));
- assertTrue((boolean) result.get("PROBE_ON"));
+ assertProbe(result, event);
assertEquals(99, ((ENodeBStatus) eNodeBStatusAlbum.get("123")).getDosCount());
assertEquals(1, ((ENodeBStatus) eNodeBStatusAlbum.get("124")).getDosCount());
logger.info("Receiving action event with {} action", result.get("ACTTASK"));
@@ -351,9 +315,9 @@ public class AadmUseCaseTest {
// user becomes non anomalous
logger.info("Sending too many connections trigger ");
event = apexEngine.createEvent(axEvent.getKey());
- event.put("IMSI", Long.valueOf(123456));
+ event.put("IMSI", 123456L);
event.put("IMSI_IP", "101.111.121.131");
- event.put("ENODEB_ID", Long.valueOf(123));
+ event.put("ENODEB_ID", 123L);
event.put("SERVICE_REQUEST_COUNT", 99);
event.put("AVG_SUBSCRIBER_SERVICE_REQUEST", 101.0);
event.put("UE_IP_ADDRESS", "101.111.121.131");
@@ -374,18 +338,14 @@ public class AadmUseCaseTest {
apexEngine.handleEvent(event);
result = listener.getResult();
- assertTrue(result.getName().startsWith("XSTREAM_AADM_ACT_EVENT"));
- assertEquals("ExecutionIDs are different", event.getExecutionId(), result.getExecutionId());
- assertEquals("probe", result.get("ACTTASK"));
- assertTrue((boolean) result.get("TCP_ON"));
- assertTrue((boolean) result.get("PROBE_ON"));
+ assertProbe(result, event);
assertEquals(102, ((ENodeBStatus) eNodeBStatusAlbum.get("123")).getDosCount());
logger.info("Receiving action event with {} action", result.get("ACTTASK"));
logger.info("Sending too many connections trigger ");
event = apexEngine.createEvent(axEvent.getKey());
- event.put("IMSI", Long.valueOf(123456));
- event.put("ENODEB_ID", Long.valueOf(123));
+ event.put("IMSI", 123456L);
+ event.put("ENODEB_ID", 123L);
event.put("SERVICE_REQUEST_COUNT", 99);
event.put("UE_IP_ADDRESS", "101.111.121.131");
event.put("ACTTASK", "");
@@ -407,11 +367,7 @@ public class AadmUseCaseTest {
apexEngine.handleEvent(event);
result = listener.getResult();
- assertTrue(result.getName().startsWith("XSTREAM_AADM_ACT_EVENT"));
- assertEquals("ExecutionIDs are different", event.getExecutionId(), result.getExecutionId());
- assertEquals("probe", result.get("ACTTASK"));
- assertTrue((boolean) result.get("TCP_ON"));
- assertTrue((boolean) result.get("PROBE_ON"));
+ assertProbe(result, event);
assertEquals(102, ((ENodeBStatus) eNodeBStatusAlbum.get("123")).getDosCount());
logger.info("Receiving action event with {} action", result.get("ACTTASK"));
// End of user becomes non anomalous
@@ -438,12 +394,25 @@ public class AadmUseCaseTest {
apexEngine.stop();
}
- /**
- * Test vpn cleardown.
- */
- @After
- public void testAadmCleardown() {
- // Not used
+ private static void assertProbe(EnEvent result, EnEvent event) {
+ logger.info("Result name: {}", result.getName().startsWith("XSTREAM_AADM_ACT_EVENT"));
+ assertTrue(result.getName().startsWith("XSTREAM_AADM_ACT_EVENT"));
+ assertEquals("ExecutionIDs are different", event.getExecutionId(), result.getExecutionId());
+ assertEquals("probe", result.get("ACTTASK"));
+ assertTrue((boolean) result.get("TCP_ON"));
+ assertTrue((boolean) result.get("PROBE_ON"));
+ }
+
+ private static void assertProbeDone(EnEvent result, EnEvent event, int expected, ContextAlbum contextAlbum) {
+ assertTrue(result.getName().startsWith("XSTREAM_AADM_ACT_EVENT"));
+ assertEquals("ExecutionIDs are different", event.getExecutionId(), result.getExecutionId());
+ // DOS_IN_eNodeB set to be more than throughput so return act action
+ assertEquals("act", result.get("ACTTASK"));
+ // only one imsi was sent to process, so stop probe and tcp
+ assertFalse((boolean) result.get("TCP_ON"));
+ assertFalse((boolean) result.get("PROBE_ON"));
+ assertEquals(expected, ((ENodeBStatus) contextAlbum.get("123")).getDosCount());
+ logger.info("Receiving action event with {} action", result.get("ACTTASK"));
}
/**
diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/definitive/APPCRestartVNFRequestTask.js b/examples/examples-onap-vcpe/src/main/resources/logic/definitive/APPCRestartVNFRequestTask.js
index 9ee928fca..058b4fd19 100644
--- a/examples/examples-onap-vcpe/src/main/resources/logic/definitive/APPCRestartVNFRequestTask.js
+++ b/examples/examples-onap-vcpe/src/main/resources/logic/definitive/APPCRestartVNFRequestTask.js
@@ -1,7 +1,7 @@
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2020 Nordix Foundation.
+ * Modifications Copyright (C) 2020,2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,7 +22,7 @@
executor.logger.info(executor.subject.id);
executor.logger.info(executor.inFields);
-var appcRequest = new org.onap.policy.appclcm.AppcLcmDmaapWrapper;
+var appcRequest = new org.onap.policy.appclcm.AppcLcmMessageWrapper;
appcRequest.setBody(new org.onap.policy.appclcm.AppcLcmBody);
appcRequest.getBody().setInput(new org.onap.policy.appclcm.AppcLcmInput);
appcRequest.getBody().getInput().setCommonHeader(
diff --git a/examples/examples-onap-vcpe/src/main/resources/policy/ONAPvCPEPolicyModel.apex b/examples/examples-onap-vcpe/src/main/resources/policy/ONAPvCPEPolicyModel.apex
index 241435e67..b6c7958bd 100644
--- a/examples/examples-onap-vcpe/src/main/resources/policy/ONAPvCPEPolicyModel.apex
+++ b/examples/examples-onap-vcpe/src/main/resources/policy/ONAPvCPEPolicyModel.apex
@@ -1,7 +1,7 @@
#-------------------------------------------------------------------------------
# ============LICENSE_START=======================================================
# Copyright (C) 2016-2018 Ericsson. All rights reserved.
-# Modifications Copyright (C) 2019-2020 Nordix Foundation.
+# Modifications Copyright (C) 2019-2020,2024 Nordix Foundation.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -29,8 +29,8 @@ schema create name=UUIDType flavour=Java schema=java.util.UUID
schema create name=VirtualControlLoopEventType flavour=Java schema=org.onap.policy.controlloop.VirtualControlLoopEvent
schema create name=VirtualControlLoopNotificationType flavour=Java schema=org.onap.policy.controlloop.VirtualControlLoopNotification
-schema create name=APPCLCMRequestType flavour=Java schema=org.onap.policy.appclcm.AppcLcmDmaapWrapper
-schema create name=APPCLCMResponseType flavour=Java schema=org.onap.policy.appclcm.AppcLcmDmaapWrapper
+schema create name=APPCLCMRequestType flavour=Java schema=org.onap.policy.appclcm.AppcLcmMessageWrapper
+schema create name=APPCLCMResponseType flavour=Java schema=org.onap.policy.appclcm.AppcLcmMessageWrapper
schema create name=GuardDecisionAttributesType flavour=Avro schema=LS
#MACROFILE:"src/main/resources/schemas/definitive/GuardDecisionAttributesType.avsc"
diff --git a/examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/AppcResponseCreator.java b/examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/AppcResponseCreator.java
index e6d913b27..ea44a2645 100644
--- a/examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/AppcResponseCreator.java
+++ b/examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/AppcResponseCreator.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019-2020 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2020,2024 Nordix Foundation.
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -29,8 +29,8 @@ import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.BlockingQueue;
import org.onap.policy.appclcm.AppcLcmBody;
-import org.onap.policy.appclcm.AppcLcmDmaapWrapper;
import org.onap.policy.appclcm.AppcLcmInput;
+import org.onap.policy.appclcm.AppcLcmMessageWrapper;
import org.onap.policy.appclcm.AppcLcmOutput;
import org.onap.policy.common.gson.InstantAsMillisTypeAdapter;
@@ -75,8 +75,8 @@ public class AppcResponseCreator {
@Override
public void run() {
- AppcLcmDmaapWrapper requestWrapper = null;
- requestWrapper = gson.fromJson(jsonRequestString, AppcLcmDmaapWrapper.class);
+ AppcLcmMessageWrapper requestWrapper = null;
+ requestWrapper = gson.fromJson(jsonRequestString, AppcLcmMessageWrapper.class);
AppcLcmInput request = requestWrapper.getBody().getInput();
@@ -96,7 +96,7 @@ public class AppcResponseCreator {
response.setPayload("");
- AppcLcmDmaapWrapper responseWrapper = new AppcLcmDmaapWrapper();
+ AppcLcmMessageWrapper responseWrapper = new AppcLcmMessageWrapper();
responseWrapper.setBody(new AppcLcmBody());
responseWrapper.getBody().setOutput(response);
diff --git a/model/pom.xml b/model/pom.xml
index 7b157be00..eb4a88f5a 100644
--- a/model/pom.xml
+++ b/model/pom.xml
@@ -1,7 +1,7 @@
<!--
============LICENSE_START=======================================================
Copyright (C) 2018 Ericsson. All rights reserved.
- Modifications Copyright (C) 2023 Nordix Foundation.
+ Modifications Copyright (C) 2023-2024 Nordix Foundation.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -31,7 +31,7 @@
<artifactId>model</artifactId>
<name>${project.artifactId}</name>
- <description>The model for Apex, it comtains definitions of all Apex concepts and also has handling for Apex
+ <description>The model for Apex, it contains definitions of all Apex concepts and also has handling for Apex
models.
</description>
diff --git a/model/src/test/resources/models/RealPolicyModel.json b/model/src/test/resources/models/RealPolicyModel.json
index f084747f2..b1387174d 100644
--- a/model/src/test/resources/models/RealPolicyModel.json
+++ b/model/src/test/resources/models/RealPolicyModel.json
@@ -1743,7 +1743,7 @@
"taskLogic": {
"key": "TaskLogic",
"logicFlavour": "JAVASCRIPT",
- "logic": "/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2016-2018 Ericsson. All rights reserved.\n * Modifications Copyright (C) 2020 Nordix Foundation.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n\nexecutor.logger.info(executor.subject.id);\nexecutor.logger.info(executor.inFields);\n\nvar appcRequest = new org.onap.policy.appclcm.AppcLcmDmaapWrapper;\nappcRequest.setBody(new org.onap.policy.appclcm.AppcLcmBody);\nappcRequest.getBody().setInput(new org.onap.policy.appclcm.AppcLcmInput);\nappcRequest.getBody().getInput().setCommonHeader(\n new org.onap.policy.appclcm.AppcLcmCommonHeader);\n\nappcRequest.setVersion(\"2.0.0\");\nappcRequest.setRpcName(\"restart\");\nappcRequest.setCorrelationId(executor.inFields.get(\"requestID\"));\nappcRequest.setType(\"request\");\n\nvar vcpeClosedLoopStatus = executor\n .getContextAlbum(\"VCPEClosedLoopStatusAlbum\").get(\n executor.inFields.get(\"vnfID\").toString());\n\nappcRequest.getBody().getInput().getCommonHeader().setTimeStamp(java.time.Instant.now());\nappcRequest.getBody().getInput().getCommonHeader().setApiVer(\"2.00\");\nappcRequest.getBody().getInput().getCommonHeader().setOriginatorId(\n executor.inFields.get(\"requestID\").toString());\nappcRequest.getBody().getInput().getCommonHeader().setRequestId(\n executor.inFields.get(\"requestID\"));\nappcRequest.getBody().getInput().getCommonHeader().setSubRequestId(\"1\");\nappcRequest.getBody().getInput().getCommonHeader().getFlags().put(\"ttl\", \"10000\");\nappcRequest.getBody().getInput().getCommonHeader().getFlags().put(\"force\", \"TRUE\");\nappcRequest.getBody().getInput().getCommonHeader().getFlags().put(\"mode\", \"EXCLUSIVE\");\n\nappcRequest.getBody().getInput().setAction(\"Restart\");\nappcRequest.getBody().getInput().setActionIdentifiers(new java.util.HashMap());\nappcRequest.getBody().getInput().getActionIdentifiers().put(\"vnf-id\",\n executor.inFields.get(\"vnfID\").toString());\n\nexecutor.getContextAlbum(\"RequestIDVNFIDAlbum\").put(\n executor.inFields.get(\"requestID\").toString(),\n executor.inFields.get(\"vnfID\"));\n\nvcpeClosedLoopStatus.put(\"notification\", \"OPERATION\");\nvcpeClosedLoopStatus.put(\"notificationTime\", java.lang.System\n .currentTimeMillis());\n\nexecutor.outFields.put(\"APPCLCMRequestEvent\", appcRequest);\n\nexecutor.logger.info(executor.outFields);\n\ntrue;"
+ "logic": "/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2016-2018 Ericsson. All rights reserved.\n * Modifications Copyright (C) 2020 Nordix Foundation.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n\nexecutor.logger.info(executor.subject.id);\nexecutor.logger.info(executor.inFields);\n\nvar appcRequest = new org.onap.policy.appclcm.AppcLcmMessageWrapper;\nappcRequest.setBody(new org.onap.policy.appclcm.AppcLcmBody);\nappcRequest.getBody().setInput(new org.onap.policy.appclcm.AppcLcmInput);\nappcRequest.getBody().getInput().setCommonHeader(\n new org.onap.policy.appclcm.AppcLcmCommonHeader);\n\nappcRequest.setVersion(\"2.0.0\");\nappcRequest.setRpcName(\"restart\");\nappcRequest.setCorrelationId(executor.inFields.get(\"requestID\"));\nappcRequest.setType(\"request\");\n\nvar vcpeClosedLoopStatus = executor\n .getContextAlbum(\"VCPEClosedLoopStatusAlbum\").get(\n executor.inFields.get(\"vnfID\").toString());\n\nappcRequest.getBody().getInput().getCommonHeader().setTimeStamp(java.time.Instant.now());\nappcRequest.getBody().getInput().getCommonHeader().setApiVer(\"2.00\");\nappcRequest.getBody().getInput().getCommonHeader().setOriginatorId(\n executor.inFields.get(\"requestID\").toString());\nappcRequest.getBody().getInput().getCommonHeader().setRequestId(\n executor.inFields.get(\"requestID\"));\nappcRequest.getBody().getInput().getCommonHeader().setSubRequestId(\"1\");\nappcRequest.getBody().getInput().getCommonHeader().getFlags().put(\"ttl\", \"10000\");\nappcRequest.getBody().getInput().getCommonHeader().getFlags().put(\"force\", \"TRUE\");\nappcRequest.getBody().getInput().getCommonHeader().getFlags().put(\"mode\", \"EXCLUSIVE\");\n\nappcRequest.getBody().getInput().setAction(\"Restart\");\nappcRequest.getBody().getInput().setActionIdentifiers(new java.util.HashMap());\nappcRequest.getBody().getInput().getActionIdentifiers().put(\"vnf-id\",\n executor.inFields.get(\"vnfID\").toString());\n\nexecutor.getContextAlbum(\"RequestIDVNFIDAlbum\").put(\n executor.inFields.get(\"requestID\").toString(),\n executor.inFields.get(\"vnfID\"));\n\nvcpeClosedLoopStatus.put(\"notification\", \"OPERATION\");\nvcpeClosedLoopStatus.put(\"notificationTime\", java.lang.System\n .currentTimeMillis());\n\nexecutor.outFields.put(\"APPCLCMRequestEvent\", appcRequest);\n\nexecutor.logger.info(executor.outFields);\n\ntrue;"
}
}
},
@@ -2941,7 +2941,7 @@
"version": "0.0.1"
},
"schemaFlavour": "Java",
- "schemaDefinition": "org.onap.policy.appclcm.AppcLcmDmaapWrapper"
+ "schemaDefinition": "org.onap.policy.appclcm.AppcLcmMessageWrapper"
}
},
{
@@ -2955,7 +2955,7 @@
"version": "0.0.1"
},
"schemaFlavour": "Java",
- "schemaDefinition": "org.onap.policy.appclcm.AppcLcmDmaapWrapper"
+ "schemaDefinition": "org.onap.policy.appclcm.AppcLcmMessageWrapper"
}
},
{
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/pom.xml b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/pom.xml
index a2e65c995..d36dd4c5a 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/pom.xml
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/pom.xml
@@ -2,7 +2,7 @@
============LICENSE_START=======================================================
Copyright (C) 2018 Ericsson. All rights reserved.
Modifications Copyright (C) 2022 Bell Canada. All rights reserved.
- Modifications Copyright (C) 2023 Nordix Foundation.
+ Modifications Copyright (C) 2023-2024 Nordix Foundation.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -41,6 +41,16 @@
<artifactId>kafka-avro-serializer</artifactId>
<version>${version.kafka-avro-serializer}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.avro</groupId>
+ <artifactId>avro</artifactId>
+ <version>${version.avro}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-compress</artifactId>
+ <version>1.25.0</version>
+ </dependency>
</dependencies>
<repositories>
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 bcf76aa51..2aec19d4d 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
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019-2020, 2023 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2020, 2023-2024 Nordix Foundation.
* Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
@@ -90,7 +90,7 @@ public class ApexRestRequestorConsumer extends ApexPluginsEventConsumer {
private final Map<ApexRestRequest, RestRequestRunner> ongoingRestRequestMap = new ConcurrentHashMap<>();
// The number of events received to date
- private Object eventsReceivedLock = new Object();
+ private final Object eventsReceivedLock = new Object();
@Getter
private int eventsReceived = 0;
@@ -303,18 +303,20 @@ public class ApexRestRequestorConsumer extends ApexPluginsEventConsumer {
NetLoggerUtil.log(EventType.OUT, CommInfrastructure.REST, url, request.getEvent().toString());
}
// Execute the REST request
- final var response = sendEventAsRestRequest(url);
- // Get the event we received
- final var eventJsonString = response.readEntity(String.class);
- NetLoggerUtil.log(EventType.IN, CommInfrastructure.REST, url, eventJsonString);
- // Match the return code
- var isPass = httpCodeFilterPattern.matcher(String.valueOf(response.getStatus()));
-
- // Check that the request worked
- if (!isPass.matches()) {
- final String errorMessage = "reception of event from URL \"" + restConsumerProperties.getUrl()
- + "\" failed with status code " + response.getStatus();
- throw new ApexEventRuntimeException(errorMessage);
+ final String eventJsonString;
+ try (var response = sendEventAsRestRequest(url)) {
+ // Get the event we received
+ eventJsonString = response.readEntity(String.class);
+ NetLoggerUtil.log(EventType.IN, CommInfrastructure.REST, url, eventJsonString);
+ // Match the return code
+ var isPass = httpCodeFilterPattern.matcher(String.valueOf(response.getStatus()));
+
+ // Check that the request worked
+ if (!isPass.matches()) {
+ final String errorMessage = "reception of event from URL \"" + restConsumerProperties.getUrl()
+ + "\" failed with status code " + response.getStatus();
+ throw new ApexEventRuntimeException(errorMessage);
+ }
}
// Check there is content
@@ -354,24 +356,14 @@ public class ApexRestRequestorConsumer extends ApexPluginsEventConsumer {
public Response sendEventAsRestRequest(String url) {
Builder headers = client.target(url).request(APPLICATION_JSON)
.headers(restConsumerProperties.getHttpHeadersAsMultivaluedMap());
- switch (restConsumerProperties.getHttpMethod()) {
- case GET:
- return headers.get();
-
- case PUT:
- return headers.put(Entity.json(request.getEvent()));
-
- case POST:
- return headers.post(Entity.json(request.getEvent()));
-
- case DELETE:
- return headers.delete();
-
- default:
- break;
- }
+ LOGGER.info("event from request: {}", request.getEvent());
+ return switch (restConsumerProperties.getHttpMethod()) {
+ case GET -> headers.get();
+ case PUT -> headers.put(Entity.json(request.getEvent()));
+ case POST -> headers.post(Entity.json(request.getEvent()));
+ case DELETE -> headers.delete();
+ };
- return null;
}
}
}
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorConsumerTest.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorConsumerTest.java
index 66c5f57c6..e72fa9030 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorConsumerTest.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorConsumerTest.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019-2020 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2020,2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,6 +25,7 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.awaitility.Awaitility.await;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
import java.util.Properties;
import java.util.concurrent.TimeUnit;
@@ -90,7 +91,7 @@ public class ApexRestRequestorConsumerTest {
assertEquals(CONSUMER_NAME, consumer.getName());
assertEquals(0, consumer.getEventsReceived());
- assertEquals(null, consumer.getPeeredReference(EventHandlerPeeredMode.REQUESTOR));
+ assertNull(consumer.getPeeredReference(EventHandlerPeeredMode.REQUESTOR));
}
@Test
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/RestRequestorTest.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/RestRequestorTest.java
index 842999fcd..257e533c4 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/RestRequestorTest.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/RestRequestorTest.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019-2020,2023 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2020,2023-2024 Nordix Foundation.
* Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -31,7 +31,6 @@ import jakarta.ws.rs.client.Client;
import jakarta.ws.rs.client.ClientBuilder;
import jakarta.ws.rs.core.Response;
import java.io.ByteArrayOutputStream;
-import java.io.IOException;
import java.io.PrintStream;
import java.util.Map;
import java.util.concurrent.TimeUnit;
@@ -84,10 +83,9 @@ public class RestRequestorTest {
/**
* Tear down.
*
- * @throws Exception the exception
*/
@AfterClass
- public static void tearDown() throws Exception {
+ public static void tearDown() {
if (server != null) {
server.stop();
}
@@ -124,7 +122,7 @@ public class RestRequestorTest {
final String[] args = {"src/test/resources/prodcons/File2RESTRequest2FileGet.json"};
final ApexMain apexMain = new ApexMain(args);
- await().atMost(2, TimeUnit.SECONDS).until(() -> apexMain.isAlive());
+ await().atMost(2, TimeUnit.SECONDS).until(apexMain::isAlive);
await().pollInterval(300, TimeUnit.MILLISECONDS).atMost(10, TimeUnit.SECONDS)
.until(() -> getStatsFromServer(client, "GET") >= 50.0);
@@ -138,17 +136,15 @@ public class RestRequestorTest {
/**
* Test rest requestor get empty.
*
- * @throws MessagingException the messaging exception
* @throws ApexException the apex exception
- * @throws IOException Signals that an I/O exception has occurred.
*/
@Test
- public void testRestRequestorGetEmpty() throws MessagingException, ApexException, IOException {
+ public void testRestRequestorGetEmpty() throws ApexException {
final Client client = ClientBuilder.newClient();
final String[] args = {"src/test/resources/prodcons/File2RESTRequest2FileGetEmpty.json"};
final ApexMain apexMain = new ApexMain(args);
- await().atMost(2, TimeUnit.SECONDS).until(() -> apexMain.isAlive());
+ await().atMost(2, TimeUnit.SECONDS).until(apexMain::isAlive);
Response response = null;
@@ -184,17 +180,15 @@ public class RestRequestorTest {
/**
* Test REST requestor put.
*
- * @throws MessagingException the messaging exception
* @throws ApexException the apex exception
- * @throws IOException Signals that an I/O exception has occurred.
*/
@Test
- public void testRestRequestorPut() throws MessagingException, ApexException, IOException {
+ public void testRestRequestorPut() throws ApexException {
final Client client = ClientBuilder.newClient();
final String[] args = {"src/test/resources/prodcons/File2RESTRequest2FilePut.json"};
final ApexMain apexMain = new ApexMain(args);
- await().atMost(2, TimeUnit.SECONDS).until(() -> apexMain.isAlive());
+ await().atMost(2, TimeUnit.SECONDS).until(apexMain::isAlive);
await().pollInterval(300, TimeUnit.MILLISECONDS).atMost(10, TimeUnit.SECONDS)
.until(() -> getStatsFromServer(client, "PUT") >= 50.0);
@@ -208,17 +202,15 @@ public class RestRequestorTest {
/**
* Test REST requestor post.
*
- * @throws MessagingException the messaging exception
* @throws ApexException the apex exception
- * @throws IOException Signals that an I/O exception has occurred.
*/
@Test
- public void testRestRequestorPost() throws MessagingException, ApexException, IOException {
+ public void testRestRequestorPost() throws ApexException {
final Client client = ClientBuilder.newClient();
final String[] args = {"src/test/resources/prodcons/File2RESTRequest2FilePost.json"};
final ApexMain apexMain = new ApexMain(args);
- await().atMost(2, TimeUnit.SECONDS).until(() -> apexMain.isAlive());
+ await().atMost(2, TimeUnit.SECONDS).until(apexMain::isAlive);
await().pollInterval(300, TimeUnit.MILLISECONDS).atMost(10, TimeUnit.SECONDS)
.until(() -> getStatsFromServer(client, "POST") >= 50.0);
@@ -232,17 +224,15 @@ public class RestRequestorTest {
/**
* Test REST requestor delete.
*
- * @throws MessagingException the messaging exception
* @throws ApexException the apex exception
- * @throws IOException Signals that an I/O exception has occurred.
*/
@Test
- public void testRestRequestorDelete() throws MessagingException, ApexException, IOException {
+ public void testRestRequestorDelete() throws ApexException {
final Client client = ClientBuilder.newClient();
final String[] args = {"src/test/resources/prodcons/File2RESTRequest2FileDelete.json"};
final ApexMain apexMain = new ApexMain(args);
- await().atMost(2, TimeUnit.SECONDS).until(() -> apexMain.isAlive());
+ await().atMost(2, TimeUnit.SECONDS).until(apexMain::isAlive);
// Wait for the required amount of events to be received
await().pollInterval(300, TimeUnit.MILLISECONDS).atMost(10, TimeUnit.SECONDS)
@@ -257,17 +247,15 @@ public class RestRequestorTest {
/**
* Test REST requestor multi inputs.
*
- * @throws MessagingException the messaging exception
* @throws ApexException the apex exception
- * @throws IOException Signals that an I/O exception has occurred.
*/
@Test
- public void testRestRequestorMultiInputs() throws MessagingException, ApexException, IOException {
+ public void testRestRequestorMultiInputs() throws ApexException {
final Client client = ClientBuilder.newClient();
final String[] args = {"src/test/resources/prodcons/File2RESTRequest2FileGetMulti.json"};
final ApexMain apexMain = new ApexMain(args);
- await().atMost(10, TimeUnit.SECONDS).until(() -> apexMain.isAlive());
+ await().atMost(10, TimeUnit.SECONDS).until(apexMain::isAlive);
await().pollInterval(300, TimeUnit.MILLISECONDS).atMost(10, TimeUnit.SECONDS)
.until(() -> getStatsFromServer(client, "GET") >= 8.0);
@@ -281,12 +269,10 @@ public class RestRequestorTest {
/**
* Test REST requestor producer alone.
*
- * @throws MessagingException the messaging exception
* @throws ApexException the apex exception
- * @throws IOException Signals that an I/O exception has occurred.
*/
@Test
- public void testRestRequestorProducerAlone() throws MessagingException, ApexException, IOException {
+ public void testRestRequestorProducerAlone() throws ApexException {
final String[] args = {"src/test/resources/prodcons/File2RESTRequest2FileGetProducerAlone.json"};
@@ -302,12 +288,10 @@ public class RestRequestorTest {
/**
* Test REST requestor consumer alone.
*
- * @throws MessagingException the messaging exception
* @throws ApexException the apex exception
- * @throws IOException Signals that an I/O exception has occurred.
*/
@Test
- public void testRestRequestorConsumerAlone() throws MessagingException, ApexException, IOException {
+ public void testRestRequestorConsumerAlone() throws ApexException {
final String[] args = {"src/test/resources/prodcons/File2RESTRequest2FileGetConsumerAlone.json"};
ApexMain apexMain = new ApexMain(args);
apexMain.shutdown();
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/SupportRestRequestorEndpoint.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/SupportRestRequestorEndpoint.java
index 23aba09a4..b05c24333 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/SupportRestRequestorEndpoint.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/SupportRestRequestorEndpoint.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2020, 2023 Nordix Foundation.
+ * Modifications Copyright (C) 2020, 2023-2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,7 +39,7 @@ import java.util.Map;
@Path("/apex")
public class SupportRestRequestorEndpoint {
- private static Object counterLock = new Object();
+ private static final Object counterLock = new Object();
private static int postMessagesReceived = 0;
private static int putMessagesReceived = 0;
private static int statMessagesReceived = 0;
diff --git a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/pom.xml b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/pom.xml
index 5d0e5b57f..00fb123f9 100644
--- a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/pom.xml
+++ b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/pom.xml
@@ -1,7 +1,7 @@
<!--
============LICENSE_START=======================================================
Copyright (C) 2018 Ericsson. All rights reserved.
- Modifications Copyright (C) 2021,2023 Nordix Foundation.
+ Modifications Copyright (C) 2021,2023-2024 Nordix Foundation.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -21,6 +21,11 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
+ <artifactId>plugins-event-protocol-jms</artifactId>
+ <name>${project.artifactId}</name>
+ <description>[${project.parent.artifactId}] Plugins for handling events that are being transported as JMS messages
+ </description>
+
<dependencies>
<dependency>
<groupId>org.apache.activemq</groupId>
@@ -34,9 +39,4 @@
<artifactId>plugins-event-protocol</artifactId>
<version>3.1.1-SNAPSHOT</version>
</parent>
-
- <artifactId>plugins-event-protocol-jms</artifactId>
- <name>${project.artifactId}</name>
- <description>[${project.parent.artifactId}] Plugins for handling events that are being transported as JMS messages
- </description>
</project> \ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 240606c25..a93b856d0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,7 +1,7 @@
<!--
============LICENSE_START=======================================================
Copyright (C) 2018 Ericsson. All rights reserved.
- Modifications Copyright (C) 2019-2020, 2022-2023 Nordix Foundation.
+ Modifications Copyright (C) 2019-2020, 2022-2024 Nordix Foundation.
Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
Modifications Copyright (C) 2020-2021 Bell Canada.
================================================================================
@@ -50,16 +50,15 @@
<version.policy.models>3.1.1-SNAPSHOT</version.policy.models>
<!-- Apex-specific dependencies -->
- <version.activemq>5.18.2</version.activemq>
+ <version.activemq>5.18.3</version.activemq>
<version.antlr.st4>4.3.4</version.antlr.st4>
<version.antlr-runtime>4.13.0</version.antlr-runtime>
<version.artemis>2.30.0</version.artemis>
- <version.avro>1.11.2</version.avro>
+ <version.avro>1.11.3</version.avro>
<version.caffeine>3.1.8</version.caffeine>
<version.curator>5.5.0</version.curator>
<version.hazelcast>5.3.1</version.hazelcast>
<version.infinispan>14.0.13.Final</version.infinispan>
- <version.jackson-databind>2.13.5</version.jackson-databind>
<version.jgroups>5.2.18.Final</version.jgroups>
<version.jms>3.1.0</version.jms>
<version.jnr.jffi>1.3.11</version.jnr.jffi>
@@ -68,7 +67,6 @@
<version.jruby-joni>2.2.1</version.jruby-joni>
<version.jruby-extras-bytelist>1.0.15</version.jruby-extras-bytelist>
<version.jython-standalone>2.7.3</version.jython-standalone>
- <version.kafka>3.6.0</version.kafka>
<version.kafka-avro-serializer>7.5.1</version.kafka-avro-serializer>
<version.kafka-junit4>3.2.5</version.kafka-junit4>
<version.rhino>1.7.14</version.rhino>
@@ -133,6 +131,26 @@
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
+ <dependency>
+ <groupId>jakarta.xml.bind</groupId>
+ <artifactId>jakarta.xml.bind-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>jakarta.activation</groupId>
+ <artifactId>jakarta.activation-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.jaxb</groupId>
+ <artifactId>jaxb-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.jaxb</groupId>
+ <artifactId>jaxb-runtime</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ </dependency>
</dependencies>
<dependencyManagement>
diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexMain.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexMain.java
index 7adf52311..7b14dc627 100644
--- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexMain.java
+++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexMain.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019-2021 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2021,2024 Nordix Foundation.
* Modifications Copyright (C) 2020-2021 Bell Canada. All rights reserved.
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
@@ -27,7 +27,6 @@ import java.util.Arrays;
import java.util.Base64;
import java.util.List;
import java.util.Map.Entry;
-import java.util.stream.Collectors;
import lombok.Getter;
import lombok.Setter;
import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
@@ -70,7 +69,6 @@ public class ApexMain {
* Instantiates the Apex service.
*
* @param args the command line arguments
- * @throws ApexException the apex exception.
*/
public ApexMain(final String[] args) {
LOGGER.entry("Starting Apex service with parameters " + Arrays.toString(args) + " . . .");
@@ -152,9 +150,9 @@ public class ApexMain {
apexParameterHandler.registerParameters(aggregatedParameters);
}
List<String> duplicateInputParameters = aggregatedParameters.getEventInputParameters().keySet().stream()
- .filter(apexParameters.getEventInputParameters()::containsKey).collect(Collectors.toList());
+ .filter(apexParameters.getEventInputParameters()::containsKey).toList();
List<String> duplicateOutputParameters = aggregatedParameters.getEventOutputParameters().keySet().stream()
- .filter(apexParameters.getEventOutputParameters()::containsKey).collect(Collectors.toList());
+ .filter(apexParameters.getEventOutputParameters()::containsKey).toList();
if (!(duplicateInputParameters.isEmpty() && duplicateOutputParameters.isEmpty())) {
throw new ApexException(
"start of Apex service failed because this policy has the following duplicate I/O parameters: "
@@ -209,7 +207,7 @@ public class ApexMain {
activator.terminate();
setAlive(false);
} catch (final ApexException e) {
- LOGGER.warn("error occured during shut down of the Apex service", e);
+ LOGGER.warn("error occurred during shut down of the Apex service", e);
}
}
}
@@ -243,7 +241,6 @@ public class ApexMain {
* The main method.
*
* @param args the arguments
- * @throws ApexException the apex exception.
*/
public static void main(final String[] args) {
new ApexMain(args);
diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/carriertechnology/CarrierTechnologyParameters.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/carriertechnology/CarrierTechnologyParameters.java
index 7515de8a1..7d52fe1cf 100644
--- a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/carriertechnology/CarrierTechnologyParameters.java
+++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/carriertechnology/CarrierTechnologyParameters.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,6 +23,7 @@
package org.onap.policy.apex.service.parameters.carriertechnology;
import lombok.AccessLevel;
+import lombok.Getter;
import lombok.NoArgsConstructor;
import org.onap.policy.common.parameters.ParameterGroupImpl;
import org.onap.policy.common.parameters.ParameterRuntimeException;
@@ -40,6 +42,7 @@ import org.onap.policy.common.parameters.annotations.NotNull;
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
+@Getter
@NotNull
@NotBlank
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@@ -54,15 +57,6 @@ public abstract class CarrierTechnologyParameters extends ParameterGroupImpl {
private @ClassName String eventConsumerPluginClass = null;
/**
- * Gets the label of the carrier technology.
- *
- * @return the label of the carrier technology
- */
- public String getLabel() {
- return label;
- }
-
- /**
* Sets the label of the carrier technology.
*
* @param label the label of the carrier technology
@@ -76,15 +70,6 @@ public abstract class CarrierTechnologyParameters extends ParameterGroupImpl {
}
/**
- * Gets the event producer plugin class.
- *
- * @return the event producer plugin class
- */
- public String getEventProducerPluginClass() {
- return eventProducerPluginClass;
- }
-
- /**
* Sets the event producer plugin class.
*
* @param eventProducerPluginClass the new event producer plugin class
@@ -98,15 +83,6 @@ public abstract class CarrierTechnologyParameters extends ParameterGroupImpl {
}
/**
- * Gets the event consumer plugin class.
- *
- * @return the event consumer plugin class
- */
- public String getEventConsumerPluginClass() {
- return eventConsumerPluginClass;
- }
-
- /**
* Sets the event consumer plugin class.
*
* @param eventConsumerPluginClass the new event consumer plugin class
diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/carriertechnology/RestPluginCarrierTechnologyParameters.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/carriertechnology/RestPluginCarrierTechnologyParameters.java
index 35ae20def..1bcba9c2c 100644
--- a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/carriertechnology/RestPluginCarrierTechnologyParameters.java
+++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/carriertechnology/RestPluginCarrierTechnologyParameters.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019-2021, 2023 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2021, 2023-2024 Nordix Foundation.
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -95,6 +95,7 @@ public class RestPluginCarrierTechnologyParameters extends CarrierTechnologyPara
// variable
protected String url = null;
protected HttpMethod httpMethod = null;
+ @Setter
protected String[][] httpHeaders = null;
protected String httpCodeFilter = DEFAULT_HTTP_CODE_FILTER;
@@ -128,15 +129,6 @@ public class RestPluginCarrierTechnologyParameters extends CarrierTechnologyPara
}
/**
- * Sets the header for the REST request.
- *
- * @param httpHeaders the incoming HTTP headers
- */
- public void setHttpHeaders(final String[][] httpHeaders) {
- this.httpHeaders = httpHeaders;
- }
-
- /**
* Get the tag for the REST Producer Properties.
*
* @return set of the tags
diff --git a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/ApexStarterMain.java b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/ApexStarterMain.java
index 7912d377f..659f11714 100644
--- a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/ApexStarterMain.java
+++ b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/ApexStarterMain.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019-2021 Nordix Foundation.
+ * Copyright (C) 2019-2021,2024 Nordix Foundation.
* Modifications Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
* ================================================================================
@@ -128,7 +128,7 @@ public class ApexStarterMain {
activator.terminate();
}
} catch (final ApexStarterException e) {
- LOGGER.warn("error occured during shut down of the apex starter service", e);
+ LOGGER.warn("error occurred during shut down of the apex starter service", e);
}
}
}
diff --git a/services/services-onappf/src/main/resources/config/OnapPfConfig.json b/services/services-onappf/src/main/resources/config/OnapPfConfig.json
index c0a4a950f..2d4a4ec26 100644
--- a/services/services-onappf/src/main/resources/config/OnapPfConfig.json
+++ b/services/services-onappf/src/main/resources/config/OnapPfConfig.json
@@ -26,14 +26,14 @@
},
"topicParameterGroup": {
"topicSources" : [{
- "topic" : "POLICY-PDP-PAP",
- "servers" : [ "message-router" ],
- "topicCommInfrastructure" : "dmaap"
+ "topic" : "policy-pdp-pap",
+ "servers" : [ "localhost" ],
+ "topicCommInfrastructure" : "NOOP"
}],
"topicSinks" : [{
- "topic" : "POLICY-PDP-PAP",
- "servers" : [ "message-router" ],
- "topicCommInfrastructure" : "dmaap"
+ "topic" : "policy-pdp-pap",
+ "servers" : [ "localhost" ],
+ "topicCommInfrastructure" : "NOOP"
}]
}
}
diff --git a/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/CommonTestData.java b/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/CommonTestData.java
index b81295da1..f227acc6c 100644
--- a/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/CommonTestData.java
+++ b/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/CommonTestData.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019, 2023 Nordix Foundation.
+ * Copyright (C) 2019, 2023-2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -78,7 +78,7 @@ public class CommonTestData {
final TopicParameters topicParams = new TopicParameters();
topicParams.setTopic("policy-pdp-pap");
topicParams.setTopicCommInfrastructure("noop");
- topicParams.setServers(List.of("message-router"));
+ topicParams.setServers(List.of("localhost"));
return topicParams;
}
diff --git a/services/services-onappf/src/test/resources/ApexStarterConfigParameters.json b/services/services-onappf/src/test/resources/ApexStarterConfigParameters.json
index 033e75d0d..0939da3cd 100644
--- a/services/services-onappf/src/test/resources/ApexStarterConfigParameters.json
+++ b/services/services-onappf/src/test/resources/ApexStarterConfigParameters.json
@@ -29,26 +29,26 @@
"servers" : [ "my-server" ],
"topicCommInfrastructure" : "ueb"
},{
- "topic" : "POLICY-PDP-PAP1",
- "servers" : [ "message-router1, message-router2" ],
- "topicCommInfrastructure" : "dmaap"
+ "topic" : "policy-pdp-pap1",
+ "servers" : [ "kafka1, kafka2" ],
+ "topicCommInfrastructure" : "noop"
},{
- "topic" : "POLICY-PDP-PAP2",
- "servers" : [ "message-router2, message-router3" ],
- "topicCommInfrastructure" : "dmaap"
+ "topic" : "policy-pdp-pap2",
+ "servers" : [ "kafka2, kafka3" ],
+ "topicCommInfrastructure" : "noop"
}],
"topicSinks" : [ {
"topic" : "ueb-sink",
"servers" : [ "my-server" ],
"topicCommInfrastructure" : "ueb"
},{
- "topic" : "POLICY-PDP-PAP2",
- "servers" : [ "message-router1, message-router2" ],
- "topicCommInfrastructure" : "dmaap"
+ "topic" : "policy-pdp-pap2",
+ "servers" : [ "kafka1, kafka2" ],
+ "topicCommInfrastructure" : "noop"
},{
- "topic" : "POLICY-PDP-PAP3",
- "servers" : [ "message-router2, message-router3" ],
- "topicCommInfrastructure" : "dmaap"
+ "topic" : "policy-pdp-pap3",
+ "servers" : [ "kafka2, kafka3" ],
+ "topicCommInfrastructure" : "noop"
}]
}
} \ No newline at end of file
diff --git a/services/services-onappf/src/test/resources/ApexStarterConfigParameters_sim.json b/services/services-onappf/src/test/resources/ApexStarterConfigParameters_sim.json
index 9686f91a2..7aff1df6c 100644
--- a/services/services-onappf/src/test/resources/ApexStarterConfigParameters_sim.json
+++ b/services/services-onappf/src/test/resources/ApexStarterConfigParameters_sim.json
@@ -25,14 +25,14 @@
},
"topicParameterGroup": {
"topicSources" : [{
- "topic" : "POLICY-PDP-PAP",
+ "topic" : "policy-pdp-pap",
"servers" : [ "localhost:6845" ],
- "topicCommInfrastructure" : "dmaap"
+ "topicCommInfrastructure" : "noop"
}],
"topicSinks" : [{
- "topic" : "POLICY-PDP-PAP",
+ "topic" : "policy-pdp-pap",
"servers" : [ "localhost:6845" ],
- "topicCommInfrastructure" : "dmaap"
+ "topicCommInfrastructure" : "noop"
}]
}
} \ No newline at end of file
diff --git a/services/services-onappf/src/test/resources/TestConfigParameters.json b/services/services-onappf/src/test/resources/TestConfigParameters.json
index 033e75d0d..79161ad1f 100644
--- a/services/services-onappf/src/test/resources/TestConfigParameters.json
+++ b/services/services-onappf/src/test/resources/TestConfigParameters.json
@@ -30,25 +30,25 @@
"topicCommInfrastructure" : "ueb"
},{
"topic" : "POLICY-PDP-PAP1",
- "servers" : [ "message-router1, message-router2" ],
- "topicCommInfrastructure" : "dmaap"
+ "servers" : [ "kafka1, kafka2" ],
+ "topicCommInfrastructure" : "noop"
},{
- "topic" : "POLICY-PDP-PAP2",
- "servers" : [ "message-router2, message-router3" ],
- "topicCommInfrastructure" : "dmaap"
+ "topic" : "policy-pdp-pap2",
+ "servers" : [ "kafka2, kafka3" ],
+ "topicCommInfrastructure" : "noop"
}],
"topicSinks" : [ {
"topic" : "ueb-sink",
"servers" : [ "my-server" ],
"topicCommInfrastructure" : "ueb"
},{
- "topic" : "POLICY-PDP-PAP2",
- "servers" : [ "message-router1, message-router2" ],
- "topicCommInfrastructure" : "dmaap"
+ "topic" : "policy-pdp-pap2",
+ "servers" : [ "kafka1, kafka2" ],
+ "topicCommInfrastructure" : "noop"
},{
- "topic" : "POLICY-PDP-PAP3",
- "servers" : [ "message-router2, message-router3" ],
- "topicCommInfrastructure" : "dmaap"
+ "topic" : "policy-pdp-pap3",
+ "servers" : [ "kafka2, kafka3" ],
+ "topicCommInfrastructure" : "noop"
}]
}
} \ No newline at end of file
diff --git a/testsuites/integration/integration-uservice-test/pom.xml b/testsuites/integration/integration-uservice-test/pom.xml
index 69a8c5527..a510fb733 100644
--- a/testsuites/integration/integration-uservice-test/pom.xml
+++ b/testsuites/integration/integration-uservice-test/pom.xml
@@ -1,7 +1,7 @@
<!--
============LICENSE_START=======================================================
Copyright (C) 2018 Ericsson. All rights reserved.
- Modifications Copyright (C) 2019-2020,2022-2023 Nordix Foundation.
+ Modifications Copyright (C) 2019-2020,2022-2024 Nordix Foundation.
Modifications Copyright (C) 2020 Bell Canada.
Modifications Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
================================================================================
@@ -118,7 +118,7 @@
</dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
- <artifactId>kafka_2.12</artifactId>
+ <artifactId>kafka_2.13</artifactId>
<version>${version.kafka}</version>
<scope>test</scope>
</dependency>
@@ -173,7 +173,7 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
- <version>${version.jackson-databind}</version>
+ <version>2.13.5</version> <!-- version different from parent specifically for kafka_2.13 compatibility-->
</dependency>
</dependencies>