Remove Dmaap from apex-pdp 99/137199/1
authorrameshiyer27 <ramesh.murugan.iyer@est.tech>
Wed, 31 Jan 2024 15:02:48 +0000 (15:02 +0000)
committerrameshiyer27 <ramesh.murugan.iyer@est.tech>
Fri, 9 Feb 2024 11:30:08 +0000 (11:30 +0000)
Issue-ID: POLICY-4402
Signed-off-by: rameshiyer27 <ramesh.murugan.iyer@est.tech>
Change-Id: I76c284b6ff7ec0ce77189f3f2bc93d5b91d4eb24

24 files changed:
examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmModelTest.java
examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmUseCaseTest.java
examples/examples-onap-vcpe/src/main/resources/logic/definitive/APPCRestartVNFRequestTask.js
examples/examples-onap-vcpe/src/main/resources/policy/ONAPvCPEPolicyModel.apex
examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/AppcResponseCreator.java
model/pom.xml
model/src/test/resources/models/RealPolicyModel.json
plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/pom.xml
plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorConsumer.java
plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorConsumerTest.java
plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/RestRequestorTest.java
plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/SupportRestRequestorEndpoint.java
plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/pom.xml
pom.xml
services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexMain.java
services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/carriertechnology/CarrierTechnologyParameters.java
services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/carriertechnology/RestPluginCarrierTechnologyParameters.java
services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/ApexStarterMain.java
services/services-onappf/src/main/resources/config/OnapPfConfig.json
services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/CommonTestData.java
services/services-onappf/src/test/resources/ApexStarterConfigParameters.json
services/services-onappf/src/test/resources/ApexStarterConfigParameters_sim.json
services/services-onappf/src/test/resources/TestConfigParameters.json
testsuites/integration/integration-uservice-test/pom.xml

index e35d9d2..04c5c7c 100644 (file)
@@ -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
index 430074e..6412b7d 100644 (file)
@@ -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"));
     }
 
     /**
index 9ee928f..058b4fd 100644 (file)
@@ -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(
index 241435e..b6c7958 100644 (file)
@@ -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"
index e6d913b..ea44a26 100644 (file)
@@ -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);
 
index 7b157be..eb4a88f 100644 (file)
@@ -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>
 
index f084747..b138717 100644 (file)
             "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;"
             }
           }
         },
               "version": "0.0.1"
             },
             "schemaFlavour": "Java",
-            "schemaDefinition": "org.onap.policy.appclcm.AppcLcmDmaapWrapper"
+            "schemaDefinition": "org.onap.policy.appclcm.AppcLcmMessageWrapper"
           }
         },
         {
               "version": "0.0.1"
             },
             "schemaFlavour": "Java",
-            "schemaDefinition": "org.onap.policy.appclcm.AppcLcmDmaapWrapper"
+            "schemaDefinition": "org.onap.policy.appclcm.AppcLcmMessageWrapper"
           }
         },
         {
index a2e65c9..d36dd4c 100644 (file)
@@ -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.
             <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>
index bcf76aa..2aec19d 100644 (file)
@@ -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;
         }
     }
 }
index 66c5f57..e72fa90 100644 (file)
@@ -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
index 842999f..257e533 100644 (file)
@@ -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();
index 23aba09..b05c243 100644 (file)
@@ -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;
index 5d0e5b5..00fb123 100644 (file)
@@ -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.
 <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 240606c..a93b856 100644 (file)
--- 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.
   ================================================================================
         <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>
             <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>
index 7adf523..7b14dc6 100644 (file)
@@ -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);
index 7515de8..7d52fe1 100644 (file)
@@ -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)
@@ -53,15 +56,6 @@ public abstract class CarrierTechnologyParameters extends ParameterGroupImpl {
     private @ClassName String eventProducerPluginClass = null;
     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.
      *
@@ -75,15 +69,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.
      *
@@ -97,15 +82,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.
      *
index 35ae20d..1bcba9c 100644 (file)
@@ -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;
 
@@ -127,15 +128,6 @@ public class RestPluginCarrierTechnologyParameters extends CarrierTechnologyPara
         return httpHeaderMap;
     }
 
-    /**
-     * 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.
      *
index 7912d37..659f117 100644 (file)
@@ -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);
             }
         }
     }
index c0a4a95..2d4a4ec 100644 (file)
     },
     "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"
         }]
     }
 }
index b81295d..f227acc 100644 (file)
@@ -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;
     }
 
index 033e75d..0939da3 100644 (file)
             "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
index 9686f91..7aff1df 100644 (file)
     },
     "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
index 033e75d..79161ad 100644 (file)
             "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
index 69a8c55..a510fb7 100644 (file)
@@ -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.
   ================================================================================
         </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>
         <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>