From b126aa0bc7c37eeaeeb22c054507aa98e7a5af20 Mon Sep 17 00:00:00 2001 From: "adheli.tavares" Date: Thu, 27 Jul 2023 10:12:59 +0100 Subject: Java 17 Upgrade Issue-ID: POLICY-4669 Change-Id: I2a57a8366d3956a172a94c81ab950af179d4767b Signed-off-by: adheli.tavares --- models-interactions/model-actors/actor.a1p/pom.xml | 12 +--- models-interactions/model-actors/actor.aai/pom.xml | 12 +--- .../actor/aai/AaiCustomQueryOperation.java | 11 +-- .../controlloop/actor/aai/AaiGetOperation.java | 5 +- .../controlloop/actor/aai/AaiGetPnfOperation.java | 5 +- .../actor/aai/AaiGetTenantOperation.java | 5 +- .../onap/policy/controlloop/actor/aai/AaiUtil.java | 3 +- .../actor/aai/AaiCustomQueryOperationTest.java | 2 +- .../controlloop/actor/aai/AaiGetOperationTest.java | 4 +- .../actor/aai/AaiGetPnfOperationTest.java | 2 +- .../actor/aai/AaiGetTenantOperationTest.java | 2 +- .../model-actors/actor.appc/pom.xml | 12 +--- .../model-actors/actor.appclcm/pom.xml | 12 +--- models-interactions/model-actors/actor.cds/pom.xml | 6 +- .../model-actors/actor.sdnc/pom.xml | 12 +--- .../controlloop/actor/sdnc/SdncOperation.java | 7 +- .../model-actors/actor.sdnr/pom.xml | 12 +--- models-interactions/model-actors/actor.so/pom.xml | 12 +--- .../policy/controlloop/actor/so/ModifyCll.java | 5 +- .../policy/controlloop/actor/so/ModifyNssi.java | 5 +- .../controlloop/actor/so/RestManagerResponse.java | 17 ++--- .../policy/controlloop/actor/so/SoOperation.java | 5 +- .../controlloop/actor/so/VfModuleCreate.java | 7 +- .../controlloop/actor/so/VfModuleDelete.java | 7 +- .../actor/so/RestManagerResponseTest.java | 3 +- .../controlloop/actor/so/VfModuleDeleteTest.java | 6 +- .../controlloop/actor/test/BasicHttpOperation.java | 14 ++-- .../actor/test/BasicHttpOperationTest.java | 4 +- models-interactions/model-actors/actor.vfc/pom.xml | 12 +--- .../onap/policy/controlloop/actor/vfc/Restart.java | 5 +- .../policy/controlloop/actor/vfc/VfcOperation.java | 5 +- .../model-actors/actor.xacml/pom.xml | 5 -- .../actor/xacml/ConfigureOperation.java | 3 +- .../controlloop/actor/xacml/DecisionOperation.java | 5 +- .../controlloop/actor/xacml/GuardOperation.java | 3 +- .../model-actors/actorServiceProvider/pom.xml | 7 +- .../actorserviceprovider/impl/HttpActor.java | 4 +- .../actorserviceprovider/impl/HttpOperation.java | 30 ++++---- .../impl/HttpOperationTest.java | 25 +++---- .../impl/HttpPollingOperationTest.java | 5 +- models-interactions/model-impl/aai/pom.xml | 12 +--- models-interactions/model-impl/appc/pom.xml | 43 +++++------- models-interactions/model-impl/appclcm/pom.xml | 46 ++++++------ models-interactions/model-impl/cds/pom.xml | 81 ++++++++++------------ models-interactions/model-impl/events/pom.xml | 38 +++++----- models-interactions/model-impl/guard/pom.xml | 19 ++--- .../org/onap/policy/guard/OperationsHistory.java | 20 +++--- models-interactions/model-impl/rest/pom.xml | 60 ++++++++-------- .../java/org/onap/policy/rest/RestManager.java | 18 ++--- .../test/java/org/onap/policy/rest/RestTest.java | 26 +++---- models-interactions/model-impl/sdnc/pom.xml | 63 ++++++++--------- models-interactions/model-impl/sdnr/pom.xml | 36 +++++----- models-interactions/model-impl/so/pom.xml | 65 +++++++++-------- models-interactions/model-impl/vfc/pom.xml | 57 +++++++-------- models-interactions/model-simulators/pom.xml | 7 +- .../onap/policy/simulators/AaiSimulatorJaxRs.java | 36 ++++------ .../onap/policy/simulators/SdncSimulatorJaxRs.java | 12 ++-- .../simulators/SimulatorRuntimeException.java | 4 ++ .../onap/policy/simulators/SoSimulatorJaxRs.java | 28 ++++---- .../main/java/org/onap/policy/simulators/Util.java | 36 +++------- .../onap/policy/simulators/VfcSimulatorJaxRs.java | 20 +++--- .../policy/simulators/XacmlSimulatorJaxRs.java | 12 ++-- .../onap/policy/simulators/CdsSimulatorTest.java | 7 +- .../onap/policy/simulators/DmaapSimulatorTest.java | 3 +- 64 files changed, 458 insertions(+), 609 deletions(-) (limited to 'models-interactions') diff --git a/models-interactions/model-actors/actor.a1p/pom.xml b/models-interactions/model-actors/actor.a1p/pom.xml index 7b891c3de..c43587637 100644 --- a/models-interactions/model-actors/actor.a1p/pom.xml +++ b/models-interactions/model-actors/actor.a1p/pom.xml @@ -2,7 +2,7 @@ - - 4.0.0 + + 4.0.0 - - org.onap.policy.models.policy-models-interactions.model-impl - model-impl - 3.0.0-SNAPSHOT - + + org.onap.policy.models.policy-models-interactions.model-impl + model-impl + 3.0.0-SNAPSHOT + - appc + appc - - - junit - junit - test - - - com.google.code.gson - gson - provided - - - + + + com.google.code.gson + gson + provided + + diff --git a/models-interactions/model-impl/appclcm/pom.xml b/models-interactions/model-impl/appclcm/pom.xml index c37b0ee39..647b50264 100644 --- a/models-interactions/model-impl/appclcm/pom.xml +++ b/models-interactions/model-impl/appclcm/pom.xml @@ -3,7 +3,7 @@ appclcm ================================================================================ Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved. - Modifications Copyright (C) 2019 Nordix Foundation. + Modifications Copyright (C) 2019, 2023 Nordix Foundation. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -20,28 +20,24 @@ --> - - 4.0.0 - - - org.onap.policy.models.policy-models-interactions.model-impl - model-impl - 3.0.0-SNAPSHOT - - - appclcm - - - - junit - junit - test - - - com.google.code.gson - gson - provided - - - + + 4.0.0 + + + org.onap.policy.models.policy-models-interactions.model-impl + model-impl + 3.0.0-SNAPSHOT + + + appclcm + + + + com.google.code.gson + gson + provided + + + diff --git a/models-interactions/model-impl/cds/pom.xml b/models-interactions/model-impl/cds/pom.xml index 26995516a..3d9213a89 100644 --- a/models-interactions/model-impl/cds/pom.xml +++ b/models-interactions/model-impl/cds/pom.xml @@ -3,6 +3,7 @@ ============LICENSE_START======================================================= Copyright (C) 2019-2021 Bell Canada. Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. + Modifications Copyright (C) 2023 Nordix Foundation. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -21,51 +22,45 @@ - 4.0.0 - - model-impl - org.onap.policy.models.policy-models-interactions.model-impl - 3.0.0-SNAPSHOT - + 4.0.0 + + model-impl + org.onap.policy.models.policy-models-interactions.model-impl + 3.0.0-SNAPSHOT + - cds - ${project.artifactId} - gRPC client implementation to send process message to CDS blueprint processor gRPC endpoint. + cds + ${project.artifactId} + gRPC client implementation to send process message to CDS blueprint processor gRPC endpoint. + - - 1.25.0 - + + 1.25.0 + - - - - org.onap.ccsdk.cds.blueprintsprocessor.modules - blueprint-proto - - - io.grpc - grpc-testing - ${grpc.version} - test - + + + + org.onap.ccsdk.cds.blueprintsprocessor.modules + blueprint-proto + + + io.grpc + grpc-testing + ${grpc.version} + test + - - - org.onap.policy.common - common-parameters - ${policy.common.version} - - - org.onap.policy.common - policy-endpoints - ${policy.common.version} - - - - - org.mockito - mockito-core - test - - + + + org.onap.policy.common + common-parameters + ${policy.common.version} + + + org.onap.policy.common + policy-endpoints + ${policy.common.version} + + diff --git a/models-interactions/model-impl/events/pom.xml b/models-interactions/model-impl/events/pom.xml index a7fce1ed0..fbc8ce670 100644 --- a/models-interactions/model-impl/events/pom.xml +++ b/models-interactions/model-impl/events/pom.xml @@ -3,7 +3,7 @@ events in model-impl ================================================================================ Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved. - Modifications Copyright (C) 2019 Nordix Foundation. + Modifications Copyright (C) 2019, 2023 Nordix Foundation. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -20,27 +20,23 @@ --> - - 4.0.0 + + 4.0.0 - - org.onap.policy.models.policy-models-interactions.model-impl - model-impl - 3.0.0-SNAPSHOT - + + org.onap.policy.models.policy-models-interactions.model-impl + model-impl + 3.0.0-SNAPSHOT + - events + events - - - com.google.code.gson - gson - provided - - - junit - junit - test - - + + + com.google.code.gson + gson + provided + + diff --git a/models-interactions/model-impl/guard/pom.xml b/models-interactions/model-impl/guard/pom.xml index 71cbf36b3..d7dc9b7f3 100644 --- a/models-interactions/model-impl/guard/pom.xml +++ b/models-interactions/model-impl/guard/pom.xml @@ -3,6 +3,7 @@ ONAP ================================================================================ Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. + Modifications Copyright (C) 2023 Nordix Foundation. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -18,16 +19,16 @@ ============LICENSE_END========================================================= --> + + 4.0.0 - - 4.0.0 + + org.onap.policy.models.policy-models-interactions.model-impl + model-impl + 3.0.0-SNAPSHOT + - - org.onap.policy.models.policy-models-interactions.model-impl - model-impl - 3.0.0-SNAPSHOT - - - guard + guard diff --git a/models-interactions/model-impl/guard/src/main/java/org/onap/policy/guard/OperationsHistory.java b/models-interactions/model-impl/guard/src/main/java/org/onap/policy/guard/OperationsHistory.java index aee57f142..fc36265d5 100644 --- a/models-interactions/model-impl/guard/src/main/java/org/onap/policy/guard/OperationsHistory.java +++ b/models-interactions/model-impl/guard/src/main/java/org/onap/policy/guard/OperationsHistory.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2021,2023 Nordix Foundation. + * Modifications Copyright (C) 2021, 2023 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,16 +23,17 @@ package org.onap.policy.guard; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.Index; +import jakarta.persistence.Table; +import jakarta.persistence.TableGenerator; +import java.io.Serial; import java.io.Serializable; import java.util.Date; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Index; -import javax.persistence.Table; -import javax.persistence.TableGenerator; import lombok.Data; @Entity @@ -43,6 +44,7 @@ import lombok.Data; @Data public class OperationsHistory implements Serializable { + @Serial private static final long serialVersionUID = -551420180714993577L; @Id diff --git a/models-interactions/model-impl/rest/pom.xml b/models-interactions/model-impl/rest/pom.xml index 7a9a28fcd..ec20ed17c 100644 --- a/models-interactions/model-impl/rest/pom.xml +++ b/models-interactions/model-impl/rest/pom.xml @@ -3,7 +3,7 @@ rest ================================================================================ Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved. - Modifications Copyright (C) 2019 Nordix Foundation. + Modifications Copyright (C) 2019, 2023 Nordix Foundation. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -20,38 +20,34 @@ --> - - 4.0.0 + + 4.0.0 - - org.onap.policy.models.policy-models-interactions.model-impl - model-impl - 3.0.0-SNAPSHOT - + + org.onap.policy.models.policy-models-interactions.model-impl + model-impl + 3.0.0-SNAPSHOT + - rest + rest - - - com.google.code.gson - gson - provided - - - org.apache.httpcomponents - httpclient - provided - - - junit - junit - test - - - org.onap.policy.common - policy-endpoints - ${policy.common.version} - test - - + + + com.google.code.gson + gson + provided + + + org.apache.httpcomponents + httpclient + provided + + + org.onap.policy.common + policy-endpoints + ${policy.common.version} + test + + diff --git a/models-interactions/model-impl/rest/src/main/java/org/onap/policy/rest/RestManager.java b/models-interactions/model-impl/rest/src/main/java/org/onap/policy/rest/RestManager.java index a91548fca..855dc92f6 100644 --- a/models-interactions/model-impl/rest/src/main/java/org/onap/policy/rest/RestManager.java +++ b/models-interactions/model-impl/rest/src/main/java/org/onap/policy/rest/RestManager.java @@ -3,7 +3,7 @@ * rest * ================================================================================ * Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019-2020 Nordix Foundation. + * Modifications Copyright (C) 2019-2020, 2023 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,10 +21,10 @@ package org.onap.policy.rest; +import jakarta.xml.bind.DatatypeConverter; import java.nio.charset.StandardCharsets; import java.util.Map; import java.util.Map.Entry; -import javax.xml.bind.DatatypeConverter; import org.apache.commons.lang3.tuple.Pair; import org.apache.http.HttpHeaders; import org.apache.http.HttpResponse; @@ -52,7 +52,7 @@ public class RestManager { * Perform REST PUT. * * @param url the url - * @param username the user name + * @param username the user * @param password the password * @param headers any headers * @param contentType what the content type is @@ -79,7 +79,7 @@ public class RestManager { * Perform REST Post. * * @param url the url - * @param username the user name + * @param username the user * @param password the password * @param headers any headers * @param contentType what the content type is @@ -106,7 +106,7 @@ public class RestManager { * Do a REST get. * * @param url URL - * @param username user name + * @param username user * @param password password * @param headers any headers to add * @return a Pair for the response status and the body @@ -122,7 +122,7 @@ public class RestManager { * Note: Many REST endpoints will return a 400 error for delete requests with a non-empty body * * @param url the url - * @param username the user name + * @param username the user * @param password the password * @param headers any headers * @param contentType what the content type is @@ -151,7 +151,7 @@ public class RestManager { * Perform REST Delete. * * @param url the url - * @param username the user name + * @param username the user * @param password the password * @param headers any headers * @return the response status code and the body @@ -166,7 +166,7 @@ public class RestManager { * Perform REST Patch. * * @param url the url - * @param username the user name + * @param username the user * @param password the password * @param headers any headers * @param body body to send @@ -224,7 +224,7 @@ public class RestManager { * Add header to the request. * * @param request http request to send - * @param username the user name + * @param username the user * @param password the password * @param headers any headers */ diff --git a/models-interactions/model-impl/rest/src/test/java/org/onap/policy/rest/RestTest.java b/models-interactions/model-impl/rest/src/test/java/org/onap/policy/rest/RestTest.java index e5a887429..e6c819153 100644 --- a/models-interactions/model-impl/rest/src/test/java/org/onap/policy/rest/RestTest.java +++ b/models-interactions/model-impl/rest/src/test/java/org/onap/policy/rest/RestTest.java @@ -3,7 +3,7 @@ * rest * ================================================================================ * Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019-2020 Nordix Foundation. + * Modifications Copyright (C) 2019-2020, 2023 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,23 +25,23 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.DELETE; +import jakarta.ws.rs.DefaultValue; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.HttpMethod; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.PUT; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.core.MediaType; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.HttpMethod; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; import org.apache.commons.lang3.tuple.Pair; import org.junit.AfterClass; import org.junit.BeforeClass; diff --git a/models-interactions/model-impl/sdnc/pom.xml b/models-interactions/model-impl/sdnc/pom.xml index 11467f394..15e6b435e 100644 --- a/models-interactions/model-impl/sdnc/pom.xml +++ b/models-interactions/model-impl/sdnc/pom.xml @@ -2,14 +2,14 @@ ============LICENSE_START======================================================= Copyright (C) 2018 Huawei. All rights reserved. Modifications Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved. - Modifications Copyright (C) 2019 Nordix Foundation. + Modifications Copyright (C) 2019, 2023 Nordix Foundation. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,43 +18,34 @@ ============LICENSE_END========================================================= --> - - 4.0.0 + + 4.0.0 - + org.onap.policy.models.policy-models-interactions.model-impl model-impl 3.0.0-SNAPSHOT - + - sdnc + sdnc - - - junit - junit - test - - - org.mockito - mockito-core - test - - - com.google.code.gson - gson - provided - - - org.onap.policy.models.policy-models-interactions.model-impl - rest - ${project.version} - - - org.onap.policy.common - policy-endpoints - ${policy.common.version} - provided - - + + + com.google.code.gson + gson + provided + + + org.onap.policy.models.policy-models-interactions.model-impl + rest + ${project.version} + + + org.onap.policy.common + policy-endpoints + ${policy.common.version} + provided + + diff --git a/models-interactions/model-impl/sdnr/pom.xml b/models-interactions/model-impl/sdnr/pom.xml index a02319041..dcc206274 100644 --- a/models-interactions/model-impl/sdnr/pom.xml +++ b/models-interactions/model-impl/sdnr/pom.xml @@ -4,14 +4,14 @@ ================================================================================ Copyright (C) 2018 Wipro Limited Intellectual Property. All rights reserved. Modifications Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved. - Modifications Copyright (C) 2019 Nordix Foundation. + Modifications Copyright (C) 2019, 2023 Nordix Foundation. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -21,27 +21,23 @@ --> - - 4.0.0 + + 4.0.0 - + org.onap.policy.models.policy-models-interactions.model-impl model-impl 3.0.0-SNAPSHOT - + - sdnr + sdnr - - - junit - junit - test - - - com.google.code.gson - gson - provided - - + + + com.google.code.gson + gson + provided + + diff --git a/models-interactions/model-impl/so/pom.xml b/models-interactions/model-impl/so/pom.xml index 49e0ca1b7..1d3e3221f 100644 --- a/models-interactions/model-impl/so/pom.xml +++ b/models-interactions/model-impl/so/pom.xml @@ -3,7 +3,7 @@ so ================================================================================ Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved. - Modifications Copyright (C) 2019 Nordix Foundation. + Modifications Copyright (C) 2019, 2023 Nordix Foundation. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -20,43 +20,40 @@ --> - - 4.0.0 + + 4.0.0 - + org.onap.policy.models.policy-models-interactions.model-impl model-impl 3.0.0-SNAPSHOT - + - so + so - - - junit - junit - test - - - com.google.code.gson - gson - provided - - - org.onap.policy.models.policy-models-interactions.model-impl - rest - ${project.version} - - - org.onap.policy.common - policy-endpoints - ${policy.common.version} - provided - - - org.glassfish.jersey.containers - jersey-container-grizzly2-http - test - - + + + com.google.code.gson + gson + provided + + + org.onap.policy.models.policy-models-interactions.model-impl + rest + ${project.version} + + + org.onap.policy.common + policy-endpoints + ${policy.common.version} + provided + + + org.glassfish.jersey.containers + jersey-container-grizzly2-http + 3.1.3 + test + + diff --git a/models-interactions/model-impl/vfc/pom.xml b/models-interactions/model-impl/vfc/pom.xml index c1bfecdfb..35aaa17e1 100644 --- a/models-interactions/model-impl/vfc/pom.xml +++ b/models-interactions/model-impl/vfc/pom.xml @@ -2,7 +2,7 @@ ============LICENSE_START======================================================= Copyright (C) 2017 Intel Corp. All rights reserved. Modifications Copyright (C) 2018-2021 AT&T Intellectual Property. All rights reserved. - Modifications Copyright (C) 2019 Nordix Foundation. + Modifications Copyright (C) 2019, 2023 Nordix Foundation. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -18,43 +18,34 @@ ============LICENSE_END========================================================= --> - - 4.0.0 + + 4.0.0 - + org.onap.policy.models.policy-models-interactions.model-impl model-impl 3.0.0-SNAPSHOT - vfc + vfc - - - junit - junit - test - - - org.mockito - mockito-core - test - - - com.google.code.gson - gson - provided - - - org.onap.policy.models.policy-models-interactions.model-impl - rest - ${project.version} - - - org.onap.policy.common - policy-endpoints - ${policy.common.version} - provided - - + + + com.google.code.gson + gson + provided + + + org.onap.policy.models.policy-models-interactions.model-impl + rest + ${project.version} + + + org.onap.policy.common + policy-endpoints + ${policy.common.version} + provided + + diff --git a/models-interactions/model-simulators/pom.xml b/models-interactions/model-simulators/pom.xml index cc25261cd..050d6feda 100644 --- a/models-interactions/model-simulators/pom.xml +++ b/models-interactions/model-simulators/pom.xml @@ -3,7 +3,7 @@ ONAP ================================================================================ Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved. - Modifications Copyright (C) 2019,2023 Nordix Foundation. + Modifications Copyright (C) 2019, 2023 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,11 +39,6 @@ policy-endpoints ${policy.common.version} - - junit - junit - test - org.onap.policy.models.policy-models-interactions.model-impl aai diff --git a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/AaiSimulatorJaxRs.java b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/AaiSimulatorJaxRs.java index ea50240ba..146dcec4a 100644 --- a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/AaiSimulatorJaxRs.java +++ b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/AaiSimulatorJaxRs.java @@ -3,7 +3,7 @@ * simulators * ================================================================================ * Copyright (C) 2017-2018, 2020-2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019, 2023 Nordix Foundation. * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,16 +22,15 @@ package org.onap.policy.simulators; -import java.io.IOException; -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.PUT; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; import org.onap.policy.common.utils.resources.ResourceUtils; import org.onap.policy.common.utils.services.Registry; @@ -71,13 +70,12 @@ public class AaiSimulatorJaxRs { * * @param req the request * @return the response - * @throws IOException if a response file cannot be read */ @PUT @Path("/{version:v16|v21}/query") @Consumes(MediaType.APPLICATION_JSON) @Produces("application/json") - public Response aaiPutQuery(final String req) throws IOException { + public Response aaiPutQuery(final String req) { return getResponse("AaiCqResponse", "invalid-cq"); } @@ -85,13 +83,12 @@ public class AaiSimulatorJaxRs { * A&AI get PNF query using pnfName. * * @return the result - * @throws IOException if a response file cannot be read */ @GET @Path("/{version:v16|v21}/network/pnfs/pnf/{pnfName}") @Consumes(MediaType.APPLICATION_JSON) @Produces("application/json") - public Response aaiGetPnfUsingPnfName(@PathParam("pnfName") final String pnfName) throws IOException { + public Response aaiGetPnfUsingPnfName(@PathParam("pnfName") final String pnfName) { return getResponse(pnfName, INVALID_PNF_FILE_NAME); } @@ -99,13 +96,12 @@ public class AaiSimulatorJaxRs { * A&AI get PNF query using pnf-id. * * @return the result - * @throws IOException if a response file cannot be read */ @GET @Path("/{version:v16|v21}/network/pnfs/pnf") @Consumes(MediaType.APPLICATION_JSON) @Produces("application/json") - public Response aaiGetPnfUsingPnfId(@QueryParam("pnf-id") final String pnfId) throws IOException { + public Response aaiGetPnfUsingPnfId(@QueryParam("pnf-id") final String pnfId) { return getResponse(pnfId, INVALID_PNF_FILE_NAME); } @@ -113,13 +109,12 @@ public class AaiSimulatorJaxRs { * A&AI get VNF query using vnf-id. * * @return the result - * @throws IOException if a response file cannot be read */ @GET @Path("/{version:v16|v21}/network/generic-vnfs/generic-vnf/{vnfId}") @Consumes(MediaType.APPLICATION_JSON) @Produces("application/json") - public Response aaiGetVnfUsingVnfId(@PathParam("vnfId") final String vnfId) throws IOException { + public Response aaiGetVnfUsingVnfId(@PathParam("vnfId") final String vnfId) { return getResponse(vnfId, INVALID_VNF_FILE_NAME); } @@ -127,13 +122,12 @@ public class AaiSimulatorJaxRs { * A&AI get VNF query using vnf-name. * * @return the result - * @throws IOException if a response file cannot be read */ @GET @Path("/{version:v16|v21}/network/generic-vnfs/generic-vnf") @Consumes(MediaType.APPLICATION_JSON) @Produces("application/json") - public Response aaiGetVnfUsingVnfName(@QueryParam("vnf-name") final String vnfName) throws IOException { + public Response aaiGetVnfUsingVnfName(@QueryParam("vnf-name") final String vnfName) { return getResponse(vnfName, INVALID_VNF_FILE_NAME); } diff --git a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SdncSimulatorJaxRs.java b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SdncSimulatorJaxRs.java index 7a28791ba..20e1811db 100644 --- a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SdncSimulatorJaxRs.java +++ b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SdncSimulatorJaxRs.java @@ -3,7 +3,7 @@ * simulators * ================================================================================ * Copyright (C) 2018 Huawei. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019, 2023 Nordix Foundation. * Modifications Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,12 +22,12 @@ package org.onap.policy.simulators; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.MediaType; import java.util.UUID; -import javax.ws.rs.Consumes; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; import org.onap.policy.sdnc.SdncResponse; import org.onap.policy.sdnc.SdncResponseOutput; import org.onap.policy.sdnc.util.Serialization; diff --git a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SimulatorRuntimeException.java b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SimulatorRuntimeException.java index b97e4d9f7..ed2b0fd69 100644 --- a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SimulatorRuntimeException.java +++ b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SimulatorRuntimeException.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2023 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +21,10 @@ package org.onap.policy.simulators; +import java.io.Serial; + public class SimulatorRuntimeException extends RuntimeException { + @Serial private static final long serialVersionUID = 1L; public SimulatorRuntimeException() { diff --git a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java index 957541993..a1456c15e 100644 --- a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java +++ b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java @@ -3,7 +3,7 @@ * simulators * ================================================================================ * Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019, 2023 Nordix Foundation. * Modifications Copyright (C) 2020 Wipro Limited. * Modifications Copyright (C) 2022 CTC, Inc. and others. * ================================================================================ @@ -23,20 +23,20 @@ package org.onap.policy.simulators; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.DELETE; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.PUT; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.MediaType; import java.util.List; import java.util.Map; import java.util.Set; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; import lombok.Setter; import org.onap.policy.common.utils.resources.ResourceUtils; import org.onap.policy.so.SoRequest; @@ -67,8 +67,8 @@ public class SoSimulatorJaxRs { /** * SO post query. * - * @param serviceInstanceId the service instance Id - * @param vnfInstanceId the VNF Id + * @param serviceInstanceId the service instance ID + * @param vnfInstanceId the VNF ID * @return the response */ @POST @@ -91,8 +91,8 @@ public class SoSimulatorJaxRs { /** * SO Delete. * - * @param serviceInstanceId the service instance Id - * @param vnfInstanceId the VNF Id + * @param serviceInstanceId the service instance ID + * @param vnfInstanceId the VNF ID * @return the response */ @DELETE diff --git a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/Util.java b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/Util.java index 155107bbd..bfbacc697 100644 --- a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/Util.java +++ b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/Util.java @@ -3,7 +3,7 @@ * simulators * ================================================================================ * Copyright (C) 2017-2019, 2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019, 2023 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -53,21 +53,19 @@ public final class Util { private static final String CANNOT_PROCESS_PARAMETERS = "cannot parse parameters "; private static final String CANNOT_CONNECT = "cannot connect to port "; - public static final String LOCALHOST = "localhost"; + public static final String LOCALHOST = "127.0.0.1"; /** * Build an A&AI simulator. * - * @return the simulator * @throws InterruptedException if a thread is interrupted */ - public static HttpServletServer buildAaiSim() throws InterruptedException { + public static void buildAaiSim() throws InterruptedException { final HttpServletServer testServer = HttpServletServerFactoryInstance.getServerFactory() .build(AAISIM_SERVER_NAME, LOCALHOST, AAISIM_SERVER_PORT, "/", false, true); testServer.addServletClass("/*", AaiSimulatorJaxRs.class.getName()); testServer.waitedStart(5000); waitForServerToListen(testServer.getPort()); - return testServer; } /** @@ -87,72 +85,54 @@ public final class Util { /** * Build an SDNC simulator. * - * @return the simulator * @throws InterruptedException if a thread is interrupted */ - public static HttpServletServer buildSdncSim() throws InterruptedException { + public static void buildSdncSim() throws InterruptedException { final HttpServletServer testServer = HttpServletServerFactoryInstance.getServerFactory() .build(SDNCSIM_SERVER_NAME, LOCALHOST, SDNCSIM_SERVER_PORT, "/", false, true); testServer.addServletClass("/*", SdncSimulatorJaxRs.class.getName()); testServer.waitedStart(5000); waitForServerToListen(testServer.getPort()); - return testServer; } /** * Build an SO simulator. * - * @return the simulator * @throws InterruptedException if a thread is interrupted */ - public static HttpServletServer buildSoSim() throws InterruptedException { + public static void buildSoSim() throws InterruptedException { final HttpServletServer testServer = HttpServletServerFactoryInstance.getServerFactory() .build(SOSIM_SERVER_NAME, LOCALHOST, SOSIM_SERVER_PORT, "/", false, true); testServer.addServletClass("/*", SoSimulatorJaxRs.class.getName()); testServer.waitedStart(5000); waitForServerToListen(testServer.getPort()); - return testServer; } /** * Build a VFC simulator. * - * @return the simulator * @throws InterruptedException if a thread is interrupted */ - public static HttpServletServer buildVfcSim() throws InterruptedException { + public static void buildVfcSim() throws InterruptedException { final HttpServletServer testServer = HttpServletServerFactoryInstance.getServerFactory() .build(VFCSIM_SERVER_NAME, LOCALHOST, VFCSIM_SERVER_PORT, "/", false, true); testServer.addServletClass("/*", VfcSimulatorJaxRs.class.getName()); testServer.waitedStart(5000); waitForServerToListen(testServer.getPort()); - return testServer; - } - - /** - * Build a guard simulator. - * - * @return the simulator - * @throws InterruptedException if a thread is interrupted - */ - public static HttpServletServer buildGuardSim() throws InterruptedException { - return buildXacmlSim(); } /** * Build a xacml simulator. * - * @return the simulator * @throws InterruptedException if a thread is interrupted */ - public static HttpServletServer buildXacmlSim() throws InterruptedException { + public static void buildXacmlSim() throws InterruptedException { HttpServletServer testServer = HttpServletServerFactoryInstance.getServerFactory().build(XACMLSIM_SERVER_NAME, LOCALHOST, XACMLSIM_SERVER_PORT, "/", false, true); testServer.addServletClass("/*", XacmlSimulatorJaxRs.class.getName()); testServer.waitedStart(5000); waitForServerToListen(testServer.getPort()); - return testServer; } /** @@ -174,7 +154,7 @@ public final class Util { */ public static HttpServletServer buildDmaapSim(String resourceName) throws InterruptedException { var json = ResourceUtils.getResourceAsString(resourceName); - DmaapSimParameterGroup params = null; + DmaapSimParameterGroup params; try { params = new StandardCoder().decode(json, DmaapSimParameterGroup.class); } catch (CoderException ce) { diff --git a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/VfcSimulatorJaxRs.java b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/VfcSimulatorJaxRs.java index 3702fdd6d..9b66bf9fa 100644 --- a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/VfcSimulatorJaxRs.java +++ b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/VfcSimulatorJaxRs.java @@ -3,7 +3,7 @@ * simulators * ================================================================================ * Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019, 2023 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,15 +21,15 @@ package org.onap.policy.simulators; -import javax.servlet.http.HttpServletResponse; -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.core.MediaType; import org.slf4j.LoggerFactory; @Path("/api/nslcm/v1") diff --git a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/XacmlSimulatorJaxRs.java b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/XacmlSimulatorJaxRs.java index 36964210b..c19f53807 100644 --- a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/XacmlSimulatorJaxRs.java +++ b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/XacmlSimulatorJaxRs.java @@ -3,7 +3,7 @@ * simulators * ================================================================================ * Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019, 2023 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,15 +21,15 @@ package org.onap.policy.simulators; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.MediaType; import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.function.Function; -import javax.ws.rs.Consumes; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; import org.onap.policy.common.utils.coder.Coder; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoder; diff --git a/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/CdsSimulatorTest.java b/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/CdsSimulatorTest.java index 6c71940af..57707693c 100644 --- a/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/CdsSimulatorTest.java +++ b/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/CdsSimulatorTest.java @@ -4,6 +4,7 @@ * ================================================================================ * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. * Modifications Copyright (C) 2020-2021 Bell Canada. All rights reserved. + * Modifications Copyright (C) 2023 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,6 +32,7 @@ import io.grpc.netty.NettyChannelBuilder; import io.grpc.stub.StreamObserver; import java.io.IOException; import java.nio.charset.StandardCharsets; +import java.util.Objects; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; @@ -71,7 +73,8 @@ public class CdsSimulatorTest { @Test public void test() throws Exception { - String reqstr = IOUtils.toString(getClass().getResource("cds/cds.request.json"), StandardCharsets.UTF_8); + String reqstr = IOUtils.toString(Objects.requireNonNull(getClass().getResource("cds/cds.request.json")), + StandardCharsets.UTF_8); Builder builder = ExecutionServiceInput.newBuilder(); JsonFormat.parser().ignoringUnknownFields().merge(reqstr, builder); ExecutionServiceInput request = builder.build(); @@ -83,7 +86,7 @@ public class CdsSimulatorTest { BluePrintProcessingServiceStub asyncStub = BluePrintProcessingServiceGrpc.newStub(channel); - StreamObserver responseObserver = new StreamObserver() { + StreamObserver responseObserver = new StreamObserver<>() { @Override public void onNext(ExecutionServiceOutput output) { future.complete(output); diff --git a/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/DmaapSimulatorTest.java b/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/DmaapSimulatorTest.java index 197c25f6c..97ecfc2ca 100644 --- a/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/DmaapSimulatorTest.java +++ b/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/DmaapSimulatorTest.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2019, 2022 AT&T Intellectual Property. All rights reserved. * Modifications Copyright (C) 2022 Bell Canada. All rights reserved. + * Modifications Copyright (C) 2023 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,7 +43,7 @@ import org.onap.policy.common.endpoints.parameters.TopicParameterGroup; import org.onap.policy.common.utils.coder.StandardCoder; public class DmaapSimulatorTest { - private static final int MAX_WAIT_SEC = 5; + private static final int MAX_WAIT_SEC = 10; private static final String TOPIC = "MY-TOPIC"; private static final String AUTH_TOPIC = "MY-AUTH-TOPIC"; private static final String AUTH_PORT = "3903"; -- cgit 1.2.3-korg