From 5e484ea73840e0b329be09730e009ae22c9962dc Mon Sep 17 00:00:00 2001 From: rameshiyer27 Date: Wed, 31 Jan 2024 15:02:48 +0000 Subject: Remove Dmaap from apex-pdp Issue-ID: POLICY-4402 Signed-off-by: rameshiyer27 Change-Id: I76c284b6ff7ec0ce77189f3f2bc93d5b91d4eb24 --- .../policy/apex/examples/aadm/AadmModelTest.java | 7 +- .../policy/apex/examples/aadm/AadmUseCaseTest.java | 121 ++++++++------------- .../logic/definitive/APPCRestartVNFRequestTask.js | 4 +- .../main/resources/policy/ONAPvCPEPolicyModel.apex | 6 +- .../domains/onap/vcpe/AppcResponseCreator.java | 10 +- model/pom.xml | 4 +- .../src/test/resources/models/RealPolicyModel.json | 6 +- .../plugins-event-carrier-kafka/pom.xml | 12 +- .../restrequestor/ApexRestRequestorConsumer.java | 54 ++++----- .../ApexRestRequestorConsumerTest.java | 5 +- .../carrier/restrequestor/RestRequestorTest.java | 46 +++----- .../SupportRestRequestorEndpoint.java | 4 +- .../plugins-event-protocol-jms/pom.xml | 12 +- pom.xml | 28 ++++- .../policy/apex/service/engine/main/ApexMain.java | 11 +- .../CarrierTechnologyParameters.java | 30 +---- .../RestPluginCarrierTechnologyParameters.java | 12 +- .../apex/services/onappf/ApexStarterMain.java | 4 +- .../src/main/resources/config/OnapPfConfig.json | 12 +- .../services/onappf/parameters/CommonTestData.java | 4 +- .../resources/ApexStarterConfigParameters.json | 24 ++-- .../resources/ApexStarterConfigParameters_sim.json | 8 +- .../src/test/resources/TestConfigParameters.json | 22 ++-- .../integration/integration-uservice-test/pom.xml | 6 +- 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.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 @@ - 5.18.2 + 5.18.3 4.3.4 4.13.0 2.30.0 - 1.11.2 + 1.11.3 3.1.8 5.5.0 5.3.1 14.0.13.Final - 2.13.5 5.2.18.Final 3.1.0 1.3.11 @@ -68,7 +67,6 @@ 2.2.1 1.0.15 2.7.3 - 3.6.0 7.5.1 3.2.5 1.7.14 @@ -133,6 +131,26 @@ org.projectlombok lombok + + jakarta.xml.bind + jakarta.xml.bind-api + + + jakarta.activation + jakarta.activation-api + + + org.glassfish.jaxb + jaxb-core + + + org.glassfish.jaxb + jaxb-runtime + + + com.sun.xml.bind + jaxb-impl + 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 duplicateInputParameters = aggregatedParameters.getEventInputParameters().keySet().stream() - .filter(apexParameters.getEventInputParameters()::containsKey).collect(Collectors.toList()); + .filter(apexParameters.getEventInputParameters()::containsKey).toList(); List 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) @@ -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. * 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; @@ -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. * 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 @@ -- cgit 1.2.3-korg