From 938005505883cf7a636a8840e20e3dc8a0ad9176 Mon Sep 17 00:00:00 2001 From: "adheli.tavares" Date: Thu, 27 Jul 2023 10:12:59 +0100 Subject: [PATCH] Java 17 Upgrade Issue-ID: POLICY-4669 Change-Id: I0157ae0ea7151658308c7e6d429098f16824c190 Signed-off-by: adheli.tavares --- models-base/pom.xml | 11 +- .../org/onap/policy/models/base/PfConcept.java | 6 +- .../policy/models/base/PfConceptContainer.java | 53 ++++---- .../org/onap/policy/models/base/PfConceptKey.java | 12 +- .../java/org/onap/policy/models/base/PfKey.java | 4 +- .../org/onap/policy/models/base/PfKeyImpl.java | 16 +-- .../java/org/onap/policy/models/base/PfKeyUse.java | 6 +- .../java/org/onap/policy/models/base/PfModel.java | 49 ++++---- .../onap/policy/models/base/PfModelException.java | 26 ++-- .../models/base/PfModelRuntimeException.java | 26 ++-- .../onap/policy/models/base/PfModelService.java | 12 +- .../onap/policy/models/base/PfReferenceKey.java | 103 +++++++--------- .../models/base/PfReferenceTimestampKey.java | 17 +-- .../onap/policy/models/base/PfSearchableKey.java | 10 +- .../onap/policy/models/base/PfTimestampKey.java | 18 +-- .../java/org/onap/policy/models/base/PfUtils.java | 52 ++++---- .../org/onap/policy/models/base/PfValidator.java | 11 +- .../onap/policy/models/base/ExceptionsTest.java | 12 +- .../policy/models/base/PfConceptContainerTest.java | 14 +-- .../models/base/PfModelExceptionInfoTest.java | 4 +- .../onap/policy/models/base/PfValidatorTest.java | 19 +-- .../models/base/testconcepts/DummyPfConcept.java | 6 +- .../base/testconcepts/DummyPfConceptKeySub.java | 4 +- .../base/testconcepts/DummyPfConceptSub.java | 6 +- .../models/base/testconcepts/DummyPfKey.java | 13 +- models-dao/pom.xml | 10 +- .../org/onap/policy/models/dao/PfDaoFactory.java | 6 +- .../java/org/onap/policy/models/dao/PfFilter.java | 4 +- .../models/dao/converters/CDataConditioner.java | 10 +- .../policy/models/dao/converters/Uuid2String.java | 8 +- .../onap/policy/models/dao/impl/DefaultPfDao.java | 137 ++++++--------------- .../org/onap/policy/models/dao/impl/ProxyDao.java | 10 +- .../onap/policy/models/dao/DummyConceptEntity.java | 12 +- .../policy/models/dao/DummyReferenceEntity.java | 12 +- .../models/dao/DummyReferenceTimestampEntity.java | 12 +- .../policy/models/dao/DummyTimestampEntity.java | 12 +- models-decisions/pom.xml | 4 +- .../decisions/concepts/DecisionException.java | 5 +- models-errors/pom.xml | 11 +- .../models/errors/concepts/ErrorResponse.java | 14 ++- .../models/errors/concepts/ErrorResponseTest.java | 9 +- models-examples/pom.xml | 8 +- models-interactions/model-actors/actor.a1p/pom.xml | 18 +-- models-interactions/model-actors/actor.aai/pom.xml | 18 +-- .../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 | 18 +-- .../model-actors/actor.appclcm/pom.xml | 17 +-- models-interactions/model-actors/actor.cds/pom.xml | 10 +- .../model-actors/actor.sdnc/pom.xml | 18 +-- .../controlloop/actor/sdnc/SdncOperation.java | 7 +- .../controlloop/actor/sdnc/BasicSdncOperation.java | 3 +- .../model-actors/actor.sdnr/pom.xml | 18 +-- models-interactions/model-actors/actor.so/pom.xml | 18 +-- .../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 +- .../model-actors/actor.test/pom.xml | 6 +- .../controlloop/actor/test/BasicHttpOperation.java | 14 +-- .../actor/test/BasicHttpOperationTest.java | 4 +- models-interactions/model-actors/actor.vfc/pom.xml | 18 +-- .../onap/policy/controlloop/actor/vfc/Restart.java | 5 +- .../policy/controlloop/actor/vfc/VfcOperation.java | 5 +- .../model-actors/actor.xacml/pom.xml | 11 +- .../actor/xacml/ConfigureOperation.java | 3 +- .../controlloop/actor/xacml/DecisionOperation.java | 5 +- .../controlloop/actor/xacml/GuardOperation.java | 3 +- .../model-actors/actorServiceProvider/pom.xml | 13 +- .../actorserviceprovider/impl/HttpActor.java | 4 +- .../actorserviceprovider/impl/HttpOperation.java | 30 +++-- .../impl/HttpOperationTest.java | 25 ++-- .../impl/HttpPollingOperationTest.java | 5 +- models-interactions/model-actors/pom.xml | 67 +++++----- models-interactions/model-impl/aai/pom.xml | 16 +-- 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/pom.xml | 2 +- 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 | 65 +++++----- models-interactions/model-impl/sdnr/pom.xml | 38 +++--- models-interactions/model-impl/so/pom.xml | 67 +++++----- models-interactions/model-impl/vfc/pom.xml | 59 ++++----- models-interactions/model-simulators/pom.xml | 13 +- .../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 | 6 +- .../onap/policy/simulators/VfcSimulatorJaxRs.java | 26 ++-- .../policy/simulators/XacmlSimulatorJaxRs.java | 12 +- .../onap/policy/simulators/AaiSimulatorTest.java | 3 +- .../onap/policy/simulators/CdsSimulatorTest.java | 7 +- .../onap/policy/simulators/DmaapSimulatorTest.java | 3 +- .../onap/policy/simulators/SoSimulatorTest.java | 3 +- .../onap/policy/simulators/VfcSimulatorTest.java | 7 +- .../onap/policy/simulators/XacmlSimulatorTest.java | 3 +- models-interactions/pom.xml | 37 +++--- models-pap/pom.xml | 17 +-- .../pap/persistence/concepts/JpaPolicyAudit.java | 30 ++--- models-pdp/pom.xml | 2 +- .../pdp/concepts/PdpEngineWorkerStatistics.java | 6 +- .../models/pdp/persistence/concepts/JpaPdp.java | 20 +-- .../pdp/persistence/concepts/JpaPdpGroup.java | 28 +++-- .../persistence/concepts/JpaPdpPolicyStatus.java | 17 +-- .../pdp/persistence/concepts/JpaPdpSubGroup.java | 28 +++-- .../pdp/persistence/provider/PdpProvider.java | 35 ++---- models-provider/pom.xml | 19 +-- .../provider/PolicyModelsProviderFactory.java | 4 +- .../provider/impl/AbstractModelsProvider.java | 4 +- .../impl/AbstractPolicyModelsProvider.java | 4 +- .../impl/DatabasePolicyModelsProviderImpl.java | 4 +- .../models/provider/impl/ModelsProvider.java | 12 +- .../models/provider/impl/DummyBadProviderImpl.java | 92 ++++++-------- .../impl/DummyPolicyModelsProviderImpl.java | 73 +++++------ models-sim/models-sim-dmaap/pom.xml | 14 +-- .../sim/dmaap/provider/DmaapSimProvider.java | 6 +- .../sim/dmaap/rest/BaseRestControllerV1.java | 8 +- .../sim/dmaap/rest/CambriaMessageBodyHandler.java | 13 +- .../sim/dmaap/rest/DmaapSimRestControllerV1.java | 20 +-- .../sim/dmaap/rest/TextMessageBodyHandler.java | 11 +- .../sim/dmaap/provider/DmaapSimProviderTest.java | 28 ++--- .../sim/dmaap/rest/BaseRestControllerV1Test.java | 5 +- .../dmaap/rest/CambriaMessageBodyHandlerTest.java | 3 +- .../dmaap/rest/DmaapSimRestControllerV1Test.java | 5 +- .../sim/dmaap/rest/TextMessageBodyHandlerTest.java | 3 +- .../packages/models-simulator-docker/pom.xml | 9 +- .../src/main/docker/Dockerfile | 2 +- .../packages/models-simulator-tarball/pom.xml | 124 +++++++++---------- models-sim/packages/pom.xml | 6 +- models-sim/policy-models-sim-pdp/pom.xml | 64 +++++----- .../models/sim/pdp/PdpSimulatorActivator.java | 6 +- .../policy/models/sim/pdp/PdpSimulatorMain.java | 4 +- .../models/sim/pdp/comm/PdpStatusPublisher.java | 8 +- .../models/sim/pdp/handler/PdpMessageHandler.java | 6 +- .../pdp/handler/PdpStateChangeMessageHandler.java | 10 +- .../sim/pdp/handler/PdpUpdateMessageHandler.java | 6 +- .../src/main/package/docker/Dockerfile | 2 +- models-sim/policy-models-simulators/pom.xml | 16 +-- .../onap/policy/models/simulators/MainTest.java | 3 +- models-sim/pom.xml | 41 +++--- models-tosca/pom.xml | 6 +- .../tosca/authorative/concepts/ToscaEntity.java | 4 +- .../provider/AuthorativeToscaProvider.java | 10 +- .../concepts/JpaToscaCapabilityAssignment.java | 16 +-- .../concepts/JpaToscaCapabilityAssignments.java | 14 ++- .../simple/concepts/JpaToscaCapabilityType.java | 12 +- .../simple/concepts/JpaToscaCapabilityTypes.java | 14 ++- .../simple/concepts/JpaToscaConstraintInRange.java | 11 +- .../simple/concepts/JpaToscaConstraintLogical.java | 41 ++---- .../concepts/JpaToscaConstraintValidValues.java | 11 +- .../tosca/simple/concepts/JpaToscaDataType.java | 14 ++- .../tosca/simple/concepts/JpaToscaDataTypes.java | 17 +-- .../tosca/simple/concepts/JpaToscaEntityType.java | 25 ++-- .../tosca/simple/concepts/JpaToscaEventFilter.java | 16 +-- .../tosca/simple/concepts/JpaToscaModel.java | 28 ++--- .../simple/concepts/JpaToscaNodeTemplate.java | 35 +++--- .../simple/concepts/JpaToscaNodeTemplates.java | 17 +-- .../tosca/simple/concepts/JpaToscaNodeType.java | 27 ++-- .../tosca/simple/concepts/JpaToscaNodeTypes.java | 17 +-- .../tosca/simple/concepts/JpaToscaParameter.java | 6 +- .../tosca/simple/concepts/JpaToscaPolicies.java | 15 ++- .../tosca/simple/concepts/JpaToscaPolicy.java | 22 ++-- .../tosca/simple/concepts/JpaToscaPolicyType.java | 20 +-- .../tosca/simple/concepts/JpaToscaPolicyTypes.java | 17 +-- .../tosca/simple/concepts/JpaToscaProperty.java | 15 ++- .../simple/concepts/JpaToscaRelationshipType.java | 12 +- .../simple/concepts/JpaToscaRelationshipTypes.java | 17 +-- .../tosca/simple/concepts/JpaToscaRequirement.java | 16 +-- .../simple/concepts/JpaToscaRequirements.java | 17 +-- .../simple/concepts/JpaToscaSchemaDefinition.java | 14 +-- .../simple/concepts/JpaToscaServiceTemplate.java | 95 +++++++------- .../simple/concepts/JpaToscaServiceTemplates.java | 10 +- .../simple/concepts/JpaToscaTimeInterval.java | 14 ++- .../simple/concepts/JpaToscaTopologyTemplate.java | 49 ++++---- .../tosca/simple/concepts/JpaToscaTrigger.java | 6 +- .../concepts/JpaToscaWithToscaProperties.java | 9 +- .../JpaToscaWithTypeAndStringProperties.java | 23 ++-- .../tosca/simple/provider/SimpleToscaProvider.java | 6 +- .../SimpleToscaServiceTemplateProvider.java | 4 +- .../tosca/utils/ToscaServiceTemplateUtils.java | 4 +- .../onap/policy/models/tosca/utils/ToscaUtils.java | 4 +- .../concepts/JpaToscaConstraintLogicalTest.java | 5 +- .../simple/concepts/JpaToscaConstraintTest.java | 6 +- .../simple/concepts/JpaToscaPropertyTest.java | 4 +- .../concepts/JpaToscaServiceTemplateTest.java | 96 +++++++++------ pom.xml | 82 ++++++------ version.properties | 2 +- 205 files changed, 1793 insertions(+), 1999 deletions(-) diff --git a/models-base/pom.xml b/models-base/pom.xml index 5f84d9280..ad90d2026 100644 --- a/models-base/pom.xml +++ b/models-base/pom.xml @@ -1,6 +1,6 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.onap.policy.models policy-models - 3.0.0-SNAPSHOT + 3.0.1-SNAPSHOT policy-models-base @@ -46,10 +46,5 @@ org.apache.commons commons-lang3 - - org.mockito - mockito-core - test - diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfConcept.java b/models-base/src/main/java/org/onap/policy/models/base/PfConcept.java index 8afcaa159..c8be88d22 100644 --- a/models-base/src/main/java/org/onap/policy/models/base/PfConcept.java +++ b/models-base/src/main/java/org/onap/policy/models/base/PfConcept.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * 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"); @@ -21,6 +21,7 @@ package org.onap.policy.models.base; +import java.io.Serial; import java.io.Serializable; import java.util.List; import lombok.AccessLevel; @@ -29,11 +30,12 @@ import lombok.NonNull; /** * This class is the base class for all Policy Framework concept classes. It enforces implementation of abstract methods - * and interfaces on all concepts that are sub-classes of this class. + * and interfaces on all concepts that are subclasses of this class. */ @NoArgsConstructor(access = AccessLevel.PROTECTED) public abstract class PfConcept extends Validated implements Serializable, Comparable { + @Serial private static final long serialVersionUID = -7434939557282697490L; /** diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfConceptContainer.java b/models-base/src/main/java/org/onap/policy/models/base/PfConceptContainer.java index 5f38a395a..395a42ce9 100644 --- a/models-base/src/main/java/org/onap/policy/models/base/PfConceptContainer.java +++ b/models-base/src/main/java/org/onap/policy/models/base/PfConceptContainer.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019-2020 Nordix Foundation. + * Copyright (C) 2019-2020, 2023 Nordix Foundation. * Modifications Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved. * Modifications Copyright (C) 2022 Bell Canada. All rights reserved. * ================================================================================ @@ -23,6 +23,15 @@ package org.onap.policy.models.base; import com.google.re2j.Pattern; +import jakarta.persistence.CascadeType; +import jakarta.persistence.EmbeddedId; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.JoinTable; +import jakarta.persistence.ManyToMany; +import jakarta.persistence.MappedSuperclass; +import jakarta.persistence.Table; +import jakarta.ws.rs.core.Response; +import java.io.Serial; import java.lang.reflect.ParameterizedType; import java.util.ArrayList; import java.util.LinkedHashMap; @@ -34,14 +43,6 @@ import java.util.Set; import java.util.TreeMap; import java.util.TreeSet; import java.util.function.Function; -import javax.persistence.CascadeType; -import javax.persistence.EmbeddedId; -import javax.persistence.JoinColumn; -import javax.persistence.JoinTable; -import javax.persistence.ManyToMany; -import javax.persistence.MappedSuperclass; -import javax.persistence.Table; -import javax.ws.rs.core.Response; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NonNull; @@ -61,7 +62,7 @@ import org.onap.policy.models.base.validation.annotations.VerifyKey; * Each concept entry is checked to ensure that its key and value are not null and that the key matches the key in the * map value. Each concept entry is then validated individually. * - * @param C the concept being contained + * @param the concept being contained */ //@formatter:on @MappedSuperclass @@ -70,7 +71,8 @@ import org.onap.policy.models.base.validation.annotations.VerifyKey; @EqualsAndHashCode(callSuper = false) public class PfConceptContainer extends PfConcept - implements PfConceptGetter, PfAuthorative>> { + implements PfConceptGetter, PfAuthorative>> { + @Serial private static final long serialVersionUID = -324211738823208318L; private static final String VALUE_FIELD = "value"; @@ -115,9 +117,9 @@ public class PfConceptContainer ex } /** - * This Constructor creates an concept container with all of its fields defined. + * This Constructor creates a concept container with all of its fields defined. * - * @param key the concept container key + * @param key the concept container key * @param conceptMap the concepts to be stored in the concept container */ public PfConceptContainer(@NonNull final PfConceptKey key, @NonNull final Map conceptMap) { @@ -200,9 +202,9 @@ public class PfConceptContainer ex } incomingConceptEntry.getValue().setName(findConceptField(conceptKey, conceptKey.getName(), - incomingConceptEntry.getValue(), PfNameVersion::getDefinedName)); + incomingConceptEntry.getValue(), PfNameVersion::getDefinedName)); incomingConceptEntry.getValue().setVersion(findConceptField(conceptKey, conceptKey.getVersion(), - incomingConceptEntry.getValue(), PfNameVersion::getDefinedVersion)); + incomingConceptEntry.getValue(), PfNameVersion::getDefinedVersion)); var jpaConcept = getConceptNewInstance(); // This cast allows us to call the fromAuthorative method @@ -219,7 +221,7 @@ public class PfConceptContainer ex if (conceptMap.isEmpty()) { throw new PfModelRuntimeException(Response.Status.BAD_REQUEST, - "An incoming list of concepts must have at least one entry"); + "An incoming list of concepts must have at least one entry"); } } @@ -286,10 +288,7 @@ public class PfConceptContainer ex } @Override - public int compareTo(final PfConcept otherConcept) { - if (otherConcept == null) { - return -1; - } + public int compareTo(@NonNull final PfConcept otherConcept) { if (this == otherConcept) { return 0; } @@ -297,8 +296,7 @@ public class PfConceptContainer ex return getClass().getName().compareTo(otherConcept.getClass().getName()); } - @SuppressWarnings("unchecked") - final PfConceptContainer other = (PfConceptContainer) otherConcept; + @SuppressWarnings("unchecked") final PfConceptContainer other = (PfConceptContainer) otherConcept; int retVal = key.compareTo(other.key); if (retVal != 0) { return retVal; @@ -310,7 +308,7 @@ public class PfConceptContainer ex /** * Get all the concepts that match the given name and version. * - * @param conceptKeyName the name of the concept, if null, return all names + * @param conceptKeyName the name of the concept, if null, return all names * @param conceptKeyVersion the version of the concept, if null, return all versions * @return conceptKeyVersion */ @@ -374,16 +372,17 @@ public class PfConceptContainer ex private C getConceptNewInstance() { try { String conceptClassName = - ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0].getTypeName(); + ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0].getTypeName(); return (C) Class.forName(conceptClassName).getDeclaredConstructor().newInstance(); } catch (Exception ex) { throw new PfModelRuntimeException(Response.Status.INTERNAL_SERVER_ERROR, - "failed to instantiate instance of container concept class", ex); + "failed to instantiate instance of container concept class", ex); } } private String findConceptField(final PfConceptKey conceptKey, final String keyFieldValue, - final PfNameVersion concept, final Function fieldGetterFunction) { + final PfNameVersion concept, + final Function fieldGetterFunction) { String conceptField = fieldGetterFunction.apply(concept); @@ -391,7 +390,7 @@ public class PfConceptContainer ex return keyFieldValue; } else { throw new PfModelRuntimeException(Response.Status.BAD_REQUEST, "Key " + conceptKey.getId() + " field " - + keyFieldValue + " does not match the value " + conceptField + " in the concept field"); + + keyFieldValue + " does not match the value " + conceptField + " in the concept field"); } } } \ No newline at end of file diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfConceptKey.java b/models-base/src/main/java/org/onap/policy/models/base/PfConceptKey.java index 98b67819e..cda2bbf42 100644 --- a/models-base/src/main/java/org/onap/policy/models/base/PfConceptKey.java +++ b/models-base/src/main/java/org/onap/policy/models/base/PfConceptKey.java @@ -21,8 +21,9 @@ package org.onap.policy.models.base; -import javax.persistence.Column; -import javax.persistence.Embeddable; +import jakarta.persistence.Column; +import jakarta.persistence.Embeddable; +import java.io.Serial; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NonNull; @@ -31,7 +32,7 @@ import org.onap.policy.common.parameters.annotations.Pattern; import org.onap.policy.common.utils.validation.Assertions; /** - * An concept key uniquely identifies every first order entity in the system. Every first order concept in the system + * A concept key uniquely identifies every first order entity in the system. Every first order concept in the system * must have an {@link PfConceptKey} to identify it. Concepts that are wholly contained in another concept are * identified using a {@link PfReferenceKey} key. * @@ -43,6 +44,7 @@ import org.onap.policy.common.utils.validation.Assertions; @EqualsAndHashCode(callSuper = false) @ToString public class PfConceptKey extends PfKeyImpl { + @Serial private static final long serialVersionUID = 8932717618579392561L; @Column(name = NAME_TOKEN, length = 120) @@ -72,7 +74,7 @@ public class PfConceptKey extends PfKeyImpl { /** * Constructor to create a key with the specified name and version. * - * @param name the key name + * @param name the key name * @param version the key version */ public PfConceptKey(final String name, final String version) { @@ -101,7 +103,7 @@ public class PfConceptKey extends PfKeyImpl { * * @return a null concept key */ - public static final PfConceptKey getNullKey() { + public static PfConceptKey getNullKey() { return new PfConceptKey(PfKey.NULL_KEY_NAME, PfKey.NULL_KEY_VERSION); } } diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfKey.java b/models-base/src/main/java/org/onap/policy/models/base/PfKey.java index 949598828..8ff171ee3 100644 --- a/models-base/src/main/java/org/onap/policy/models/base/PfKey.java +++ b/models-base/src/main/java/org/onap/policy/models/base/PfKey.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019, 2023 Nordix Foundation. * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,6 +21,7 @@ package org.onap.policy.models.base; +import java.io.Serial; import lombok.AccessLevel; import lombok.NoArgsConstructor; import lombok.NonNull; @@ -31,6 +32,7 @@ import lombok.NonNull; */ @NoArgsConstructor(access = AccessLevel.PROTECTED) public abstract class PfKey extends PfConcept { + @Serial private static final long serialVersionUID = 6281159885962014041L; /** Regular expression to specify the structure of key names. */ diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfKeyImpl.java b/models-base/src/main/java/org/onap/policy/models/base/PfKeyImpl.java index 3309fe9da..105e6f7f8 100644 --- a/models-base/src/main/java/org/onap/policy/models/base/PfKeyImpl.java +++ b/models-base/src/main/java/org/onap/policy/models/base/PfKeyImpl.java @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2019-2020 Nordix Foundation. + * Copyright (C) 2019-2020, 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"); @@ -21,6 +21,7 @@ package org.onap.policy.models.base; +import java.io.Serial; import java.util.ArrayList; import java.util.List; import lombok.Getter; @@ -34,6 +35,7 @@ import org.onap.policy.common.utils.validation.Assertions; @Getter @ToString public abstract class PfKeyImpl extends PfKey { + @Serial private static final long serialVersionUID = 8932717618579392561L; public static final String NAME_TOKEN = "name"; @@ -134,10 +136,9 @@ public abstract class PfKeyImpl extends PfKey { @Override public PfKey.Compatibility getCompatibility(@NonNull final PfKey otherKey) { - if (!(otherKey instanceof PfKeyImpl)) { + if (!(otherKey instanceof PfKeyImpl otherConceptKey)) { return Compatibility.DIFFERENT; } - final PfKeyImpl otherConceptKey = (PfKeyImpl) otherKey; if (this.equals(otherConceptKey)) { return Compatibility.IDENTICAL; @@ -164,10 +165,9 @@ public abstract class PfKeyImpl extends PfKey { @Override public boolean isCompatible(@NonNull final PfKey otherKey) { - if (!(otherKey instanceof PfKeyImpl)) { + if (!(otherKey instanceof PfKeyImpl otherConceptKey)) { return false; } - final PfKeyImpl otherConceptKey = (PfKeyImpl) otherKey; final var compatibility = this.getCompatibility(otherConceptKey); @@ -193,17 +193,17 @@ public abstract class PfKeyImpl extends PfKey { // There must always be at least one element in each version if (!thisVersionArray[0].equals(otherVersionArray[0])) { - return Integer.valueOf(thisVersionArray[0]) > Integer.valueOf(otherVersionArray[0]); + return Integer.parseInt(thisVersionArray[0]) > Integer.parseInt(otherVersionArray[0]); } if (thisVersionArray.length >= 2 && otherVersionArray.length >= 2 && !thisVersionArray[1].equals(otherVersionArray[1])) { - return Integer.valueOf(thisVersionArray[1]) > Integer.valueOf(otherVersionArray[1]); + return Integer.parseInt(thisVersionArray[1]) > Integer.parseInt(otherVersionArray[1]); } if (thisVersionArray.length >= 3 && otherVersionArray.length >= 3 && !thisVersionArray[2].equals(otherVersionArray[2])) { - return Integer.valueOf(thisVersionArray[2]) > Integer.valueOf(otherVersionArray[2]); + return Integer.parseInt(thisVersionArray[2]) > Integer.parseInt(otherVersionArray[2]); } return false; diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfKeyUse.java b/models-base/src/main/java/org/onap/policy/models/base/PfKeyUse.java index b753bb14a..f9141cc27 100644 --- a/models-base/src/main/java/org/onap/policy/models/base/PfKeyUse.java +++ b/models-base/src/main/java/org/onap/policy/models/base/PfKeyUse.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019, 2023 Nordix Foundation. * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,6 +21,7 @@ package org.onap.policy.models.base; +import java.io.Serial; import java.util.List; import lombok.EqualsAndHashCode; import lombok.Getter; @@ -41,6 +42,7 @@ import org.onap.policy.models.base.validation.annotations.VerifyKey; @EqualsAndHashCode(callSuper = false) @ToString public class PfKeyUse extends PfKey { + @Serial private static final long serialVersionUID = 2007147220109881705L; @VerifyKey @@ -139,7 +141,7 @@ public class PfKeyUse extends PfKey { } @Override - public int compareTo(final PfConcept otherObj) { + public int compareTo(@NonNull final PfConcept otherObj) { Assertions.argumentNotNull(otherObj, "comparison object may not be null"); if (this == otherObj) { diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfModel.java b/models-base/src/main/java/org/onap/policy/models/base/PfModel.java index e7b79cadf..1caa6329e 100644 --- a/models-base/src/main/java/org/onap/policy/models/base/PfModel.java +++ b/models-base/src/main/java/org/onap/policy/models/base/PfModel.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019, 2023 Nordix Foundation. * Modifications Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved. * Modifications Copyright (C) 2022 Bell Canada. All rights reserved. * ================================================================================ @@ -22,11 +22,12 @@ package org.onap.policy.models.base; +import jakarta.persistence.EmbeddedId; +import jakarta.persistence.MappedSuperclass; +import java.io.Serial; import java.util.List; import java.util.Set; import java.util.TreeSet; -import javax.persistence.EmbeddedId; -import javax.persistence.MappedSuperclass; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NonNull; @@ -41,12 +42,12 @@ import org.onap.policy.models.base.validation.annotations.VerifyKey; * from this model so all models must have a key and have key information. * *

Validation checks that the model key is valid. It goes on to check for null keys and checks - * each key for uniqueness in the model. A check is carried out to ensure that an {@link PfKeyInfo} + * each key for uniqueness in the model. A check is carried out to ensure that an {@link PfKey} * instance exists for every {@link PfConceptKey} key. For each {@link PfReferenceKey} instance, a - * check is made that its parent and local name are nut null and that a {@link PfKeyInfo} entry + * check is made that its parent and local name are not null and that a {@link PfKey} entry * exists for its parent. Then a check is made that each used {@link PfConceptKey} and * {@link PfReferenceKey} usage references a key that exists. Finally, a check is made to ensure - * that an {@link PfConceptKey} instance exists for every {@link PfKeyInfo} instance. + * that an {@link PfConceptKey} instance exists for every {@link PfKey} instance. * * @param the type of concept on which the interface is applied. */ @@ -57,6 +58,7 @@ import org.onap.policy.models.base.validation.annotations.VerifyKey; public abstract class PfModel extends PfConcept { private static final String KEYS_TOKEN = "keys"; + @Serial private static final long serialVersionUID = -771659065637205430L; @EmbeddedId @@ -146,13 +148,13 @@ public abstract class PfModel extends PfConcept { /** * Check for consistent usage of an artifact key in the model. * - * @param artifactKey The artifact key to check + * @param artifactKey The artifact key to check * @param artifactKeySet The set of artifact keys encountered so far, this key is appended to - * the set - * @param result where to add the results + * the set + * @param result where to add the results */ private void validateArtifactKeyInModel(final PfConceptKey artifactKey, - final Set artifactKeySet, final BeanValidationResult result) { + final Set artifactKeySet, final BeanValidationResult result) { validateKeyNotNull(result, KEYS_TOKEN, artifactKey); @@ -161,7 +163,7 @@ public abstract class PfModel extends PfConcept { // Null key name start check if (artifactKey.getName().toUpperCase().startsWith(PfKey.NULL_KEY_NAME)) { addResult(result2, "name of " + artifactKey.getId(), artifactKey.getName(), - "starts with keyword " + PfKey.NULL_KEY_NAME); + "starts with keyword " + PfKey.NULL_KEY_NAME); } // Unique key check @@ -175,13 +177,14 @@ public abstract class PfModel extends PfConcept { /** * Check for consistent usage of a reference key in the model. * - * @param referenceKey The reference key to check + * @param referenceKey The reference key to check * @param referenceKeySet The set of reference keys encountered so far, this key is appended to - * the set - * @param result where to add the results + * the set + * @param result where to add the results */ private void validateReferenceKeyInModel(final PfReferenceKey referenceKey, - final Set referenceKeySet, final BeanValidationResult result) { + final Set referenceKeySet, + final BeanValidationResult result) { // Null key check if (referenceKey.isNullKey()) { addResult(result, KEYS_TOKEN, referenceKey, IS_A_NULL_KEY); @@ -192,7 +195,7 @@ public abstract class PfModel extends PfConcept { // Null parent key check if (referenceKey.getParentConceptKey().isNullKey()) { addResult(result2, "parent key of " + referenceKey.getId(), referenceKey.getParentConceptKey().getId(), - IS_A_NULL_KEY); + IS_A_NULL_KEY); } // Null local name check @@ -203,7 +206,7 @@ public abstract class PfModel extends PfConcept { // Null key name start check if (referenceKey.getParentConceptKey().getName().toUpperCase().startsWith(PfKey.NULL_KEY_NAME)) { addResult(result2, "parent name of " + referenceKey.getId(), referenceKey.getParentConceptKey().getName(), - "starts with keyword " + PfKey.NULL_KEY_NAME); + "starts with keyword " + PfKey.NULL_KEY_NAME); } // Unique key check @@ -217,15 +220,15 @@ public abstract class PfModel extends PfConcept { /** * Check for consistent usage of cross-key references in the model. * - * @param usedKeySet The set of all keys used in the model - * @param artifactKeySet The set of artifact keys encountered so far, this key is appended to - * the set + * @param usedKeySet The set of all keys used in the model + * @param artifactKeySet The set of artifact keys encountered so far, this key is appended to + * the set * @param referenceKeySet The set of reference keys encountered so far, this key is appended to - * the set - * @param result where to add the results + * the set + * @param result where to add the results */ private void validateKeyUses(final Set usedKeySet, final Set artifactKeySet, - final Set referenceKeySet, final BeanValidationResult result) { + final Set referenceKeySet, final BeanValidationResult result) { // Check all key uses for (final PfKeyUse usedKey : usedKeySet) { if (usedKey.getKey() instanceof PfConceptKey) { diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfModelException.java b/models-base/src/main/java/org/onap/policy/models/base/PfModelException.java index c25fd17ec..9ffac0864 100644 --- a/models-base/src/main/java/org/onap/policy/models/base/PfModelException.java +++ b/models-base/src/main/java/org/onap/policy/models/base/PfModelException.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * 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,7 +20,8 @@ package org.onap.policy.models.base; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.core.Response; +import java.io.Serial; import lombok.Getter; import lombok.ToString; import org.onap.policy.models.errors.concepts.ErrorResponse; @@ -28,11 +29,12 @@ import org.onap.policy.models.errors.concepts.ErrorResponseInfo; import org.onap.policy.models.errors.concepts.ErrorResponseUtils; /** - * This class is a base exception from which all model exceptions are sub classes. + * This class is a base exception from which all model exceptions are subclasses. */ @Getter @ToString public class PfModelException extends Exception implements ErrorResponseInfo { + @Serial private static final long serialVersionUID = -8507246953751956974L; // The error response of the exception @@ -45,7 +47,7 @@ public class PfModelException extends Exception implements ErrorResponseInfo { * Instantiates a new model exception. * * @param statusCode the return code for the exception - * @param message the message on the exception + * @param message the message on the exception */ public PfModelException(final Response.Status statusCode, final String message) { this(statusCode, message, null); @@ -55,8 +57,8 @@ public class PfModelException extends Exception implements ErrorResponseInfo { * Instantiates a new model exception. * * @param statusCode the return code for the exception - * @param message the message on the exception - * @param object the object that the exception was thrown on + * @param message the message on the exception + * @param object the object that the exception was thrown on */ public PfModelException(final Response.Status statusCode, final String message, final Object object) { super(message); @@ -69,8 +71,8 @@ public class PfModelException extends Exception implements ErrorResponseInfo { * Instantiates a new model exception. * * @param statusCode the return code for the exception - * @param message the message on the exception - * @param exception the exception that caused this exception + * @param message the message on the exception + * @param exception the exception that caused this exception */ public PfModelException(final Response.Status statusCode, final String message, final Exception exception) { this(statusCode, message, exception, null); @@ -80,12 +82,12 @@ public class PfModelException extends Exception implements ErrorResponseInfo { * Instantiates a new exception. * * @param statusCode the return code for the exception - * @param message the message on the exception - * @param exception the exception that caused this exception - * @param object the object that the exception was thrown on + * @param message the message on the exception + * @param exception the exception that caused this exception + * @param object the object that the exception was thrown on */ public PfModelException(final Response.Status statusCode, final String message, final Exception exception, - final Object object) { + final Object object) { super(message, exception); errorResponse.setResponseCode(statusCode); ErrorResponseUtils.getExceptionMessages(errorResponse, this); diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfModelRuntimeException.java b/models-base/src/main/java/org/onap/policy/models/base/PfModelRuntimeException.java index cd0562f90..44e9db950 100644 --- a/models-base/src/main/java/org/onap/policy/models/base/PfModelRuntimeException.java +++ b/models-base/src/main/java/org/onap/policy/models/base/PfModelRuntimeException.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019, 2021 Nordix Foundation. + * Copyright (C) 2019, 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. @@ -20,7 +20,8 @@ package org.onap.policy.models.base; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.core.Response; +import java.io.Serial; import lombok.Getter; import lombok.ToString; import org.onap.policy.models.errors.concepts.ErrorResponse; @@ -28,11 +29,12 @@ import org.onap.policy.models.errors.concepts.ErrorResponseInfo; import org.onap.policy.models.errors.concepts.ErrorResponseUtils; /** - * This class is a base model run time exception from which all model run time exceptions are sub classes. + * This class is a base model run time exception from which all model run time exceptions are subclasses. */ @Getter @ToString public class PfModelRuntimeException extends RuntimeException implements ErrorResponseInfo { + @Serial private static final long serialVersionUID = -8507246953751956974L; // The error response of the exception @@ -45,7 +47,7 @@ public class PfModelRuntimeException extends RuntimeException implements ErrorRe * Instantiates a new model runtime exception. * * @param statusCode the return code for the exception - * @param message the message on the exception + * @param message the message on the exception */ public PfModelRuntimeException(final Response.Status statusCode, final String message) { this(statusCode, message, null); @@ -55,8 +57,8 @@ public class PfModelRuntimeException extends RuntimeException implements ErrorRe * Instantiates a new model runtime exception. * * @param statusCode the return code for the exception - * @param message the message on the exception - * @param object the object that the exception was thrown on + * @param message the message on the exception + * @param object the object that the exception was thrown on */ public PfModelRuntimeException(final Response.Status statusCode, final String message, final Object object) { super(message); @@ -69,8 +71,8 @@ public class PfModelRuntimeException extends RuntimeException implements ErrorRe * Instantiates a new model runtime exception. * * @param statusCode the return code for the exception - * @param message the message on the exception - * @param exception the exception that caused this model exception + * @param message the message on the exception + * @param exception the exception that caused this model exception */ public PfModelRuntimeException(final Response.Status statusCode, final String message, final Exception exception) { this(statusCode, message, exception, null); @@ -92,12 +94,12 @@ public class PfModelRuntimeException extends RuntimeException implements ErrorRe * Instantiates a new model runtime exception. * * @param statusCode the return code for the exception - * @param message the message on the exception - * @param exception the exception that caused this model exception - * @param object the object that the exception was thrown on + * @param message the message on the exception + * @param exception the exception that caused this model exception + * @param object the object that the exception was thrown on */ public PfModelRuntimeException(final Response.Status statusCode, final String message, final Exception exception, - final Object object) { + final Object object) { super(message, exception); this.object = object; errorResponse.setResponseCode(statusCode); diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfModelService.java b/models-base/src/main/java/org/onap/policy/models/base/PfModelService.java index 860288b8e..94a7c0eac 100644 --- a/models-base/src/main/java/org/onap/policy/models/base/PfModelService.java +++ b/models-base/src/main/java/org/onap/policy/models/base/PfModelService.java @@ -21,9 +21,9 @@ package org.onap.policy.models.base; +import jakarta.ws.rs.core.Response; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; -import javax.ws.rs.core.Response; import lombok.AccessLevel; import lombok.NoArgsConstructor; import lombok.NonNull; @@ -42,14 +42,14 @@ import lombok.NonNull; @NoArgsConstructor(access = AccessLevel.PRIVATE) public final class PfModelService { // The map holding the models - private static Map modelMap = new ConcurrentHashMap<>(); + private static final Map modelMap = new ConcurrentHashMap<>(); /** * Register a model with the model service. * - * @param the generic type + * @param the generic type * @param modelKey the key of the model, used to index the model - * @param model The model + * @param model The model */ public static void registerModel(@NonNull final String modelKey, @NonNull final M model) { modelMap.put(modelKey, model); @@ -67,7 +67,7 @@ public final class PfModelService { /** * Get a model from the model service. * - * @param the generic type + * @param the generic type * @param modelKey the key of the model, used to index the model * @return The model */ @@ -77,7 +77,7 @@ public final class PfModelService { if (model == null) { throw new PfModelRuntimeException(Response.Status.INTERNAL_SERVER_ERROR, - "Model for name " + modelKey + " not found in model service"); + "Model for name " + modelKey + " not found in model service"); } return model; diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfReferenceKey.java b/models-base/src/main/java/org/onap/policy/models/base/PfReferenceKey.java index acbebf959..246f8f069 100644 --- a/models-base/src/main/java/org/onap/policy/models/base/PfReferenceKey.java +++ b/models-base/src/main/java/org/onap/policy/models/base/PfReferenceKey.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019,2021 Nordix Foundation. + * Copyright (C) 2019, 2021, 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"); @@ -21,10 +21,11 @@ package org.onap.policy.models.base; +import jakarta.persistence.Column; +import jakarta.persistence.Embeddable; +import java.io.Serial; import java.util.ArrayList; import java.util.List; -import javax.persistence.Column; -import javax.persistence.Embeddable; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NonNull; @@ -58,14 +59,19 @@ public class PfReferenceKey extends PfKey { private static final String PARENT_LOCAL_NAME = "parentLocalName"; private static final String LOCAL_NAME = "localName"; + @Serial private static final long serialVersionUID = 8932717618579392561L; - /** Regular expression to specify the structure of local names in reference keys. */ + /** + * Regular expression to specify the structure of local names in reference keys. + */ public static final String LOCAL_NAME_REGEXP = "[A-Za-z0-9\\-_\\.]+|^$"; - /** Regular expression to specify the structure of IDs in reference keys. */ + /** + * Regular expression to specify the structure of IDs in reference keys. + */ public static final String REFERENCE_KEY_ID_REGEXP = - "[A-Za-z0-9\\-_]+:[0-9].[0-9].[0-9]:[A-Za-z0-9\\-_]+:[A-Za-z0-9\\-_]+"; + "[A-Za-z0-9\\-_]+:[0-9].[0-9].[0-9]:[A-Za-z0-9\\-_]+:[A-Za-z0-9\\-_]+"; private static final int PARENT_NAME_FIELD = 0; private static final int PARENT_VERSION_FIELD = 1; @@ -102,19 +108,17 @@ public class PfReferenceKey extends PfKey { /** * The Copy Constructor creates a key by copying another key. * - * @param referenceKey - * the reference key to copy from + * @param referenceKey the reference key to copy from */ public PfReferenceKey(final PfReferenceKey referenceKey) { this(referenceKey.getParentKeyName(), referenceKey.getParentKeyVersion(), referenceKey.getParentLocalName(), - referenceKey.getLocalName()); + referenceKey.getLocalName()); } /** * Constructor to create a null reference key for the specified parent concept key. * - * @param pfConceptKey - * the parent concept key of this reference key + * @param pfConceptKey the parent concept key of this reference key */ public PfReferenceKey(final PfConceptKey pfConceptKey) { this(pfConceptKey.getName(), pfConceptKey.getVersion(), NULL_KEY_NAME, NULL_KEY_NAME); @@ -123,10 +127,8 @@ public class PfReferenceKey extends PfKey { /** * Constructor to create a reference key for the given parent concept key with the given local name. * - * @param pfConceptKey - * the parent concept key of this reference key - * @param localName - * the local name of this reference key + * @param pfConceptKey the parent concept key of this reference key + * @param localName the local name of this reference key */ public PfReferenceKey(final PfConceptKey pfConceptKey, final String localName) { this(pfConceptKey, NULL_KEY_NAME, localName); @@ -135,10 +137,8 @@ public class PfReferenceKey extends PfKey { /** * Constructor to create a reference key for the given parent reference key with the given local name. * - * @param parentReferenceKey - * the parent reference key of this reference key - * @param localName - * the local name of this reference key + * @param parentReferenceKey the parent reference key of this reference key + * @param localName the local name of this reference key */ public PfReferenceKey(final PfReferenceKey parentReferenceKey, final String localName) { this(parentReferenceKey.getParentConceptKey(), parentReferenceKey.getLocalName(), localName); @@ -148,12 +148,9 @@ public class PfReferenceKey extends PfKey { * Constructor to create a reference key for the given parent reference key (specified by the parent reference key's * concept key and local name) with the given local name. * - * @param pfConceptKey - * the concept key of the parent reference key of this reference key - * @param parentLocalName - * the local name of the parent reference key of this reference key - * @param localName - * the local name of this reference key + * @param pfConceptKey the concept key of the parent reference key of this reference key + * @param parentLocalName the local name of the parent reference key of this reference key + * @param localName the local name of this reference key */ public PfReferenceKey(final PfConceptKey pfConceptKey, final String parentLocalName, final String localName) { this(pfConceptKey.getName(), pfConceptKey.getVersion(), parentLocalName, localName); @@ -163,12 +160,9 @@ public class PfReferenceKey extends PfKey { * Constructor to create a reference key for the given parent concept key (specified by the parent concept key's * name and version) with the given local name. * - * @param parentKeyName - * the name of the parent concept key of this reference key - * @param parentKeyVersion - * the version of the parent concept key of this reference key - * @param localName - * the local name of this reference key + * @param parentKeyName the name of the parent concept key of this reference key + * @param parentKeyVersion the version of the parent concept key of this reference key + * @param localName the local name of this reference key */ public PfReferenceKey(final String parentKeyName, final String parentKeyVersion, final String localName) { this(parentKeyName, parentKeyVersion, NULL_KEY_NAME, localName); @@ -178,31 +172,26 @@ public class PfReferenceKey extends PfKey { * Constructor to create a reference key for the given parent key (specified by the parent key's name, version nad * local name) with the given local name. * - * @param parentKeyName - * the parent key name of this reference key - * @param parentKeyVersion - * the parent key version of this reference key - * @param parentLocalName - * the parent local name of this reference key - * @param localName - * the local name of this reference key + * @param parentKeyName the parent key name of this reference key + * @param parentKeyVersion the parent key version of this reference key + * @param parentLocalName the parent local name of this reference key + * @param localName the local name of this reference key */ public PfReferenceKey(final String parentKeyName, final String parentKeyVersion, final String parentLocalName, - final String localName) { + final String localName) { super(); this.parentKeyName = Assertions.validateStringParameter(PARENT_KEY_NAME, parentKeyName, NAME_REGEXP); this.parentKeyVersion = Assertions.validateStringParameter(PARENT_KEY_VERSION, parentKeyVersion, - VERSION_REGEXP); + VERSION_REGEXP); this.parentLocalName = Assertions.validateStringParameter(PARENT_LOCAL_NAME, parentLocalName, - LOCAL_NAME_REGEXP); + LOCAL_NAME_REGEXP); this.localName = Assertions.validateStringParameter(LOCAL_NAME, localName, LOCAL_NAME_REGEXP); } /** * Constructor to create a key from the specified key ID. * - * @param id - * the key ID in a format that respects the KEY_ID_REGEXP + * @param id the key ID in a format that respects the KEY_ID_REGEXP */ public PfReferenceKey(final String id) { final var conditionedId = Assertions.validateStringParameter("id", id, REFERENCE_KEY_ID_REGEXP); @@ -215,13 +204,13 @@ public class PfReferenceKey extends PfKey { // Initiate the new key parentKeyName = Assertions.validateStringParameter(PARENT_KEY_NAME, nameVersionNameArray[PARENT_NAME_FIELD], - NAME_REGEXP); + NAME_REGEXP); parentKeyVersion = Assertions.validateStringParameter(PARENT_KEY_VERSION, - nameVersionNameArray[PARENT_VERSION_FIELD], VERSION_REGEXP); + nameVersionNameArray[PARENT_VERSION_FIELD], VERSION_REGEXP); parentLocalName = Assertions.validateStringParameter(PARENT_LOCAL_NAME, - nameVersionNameArray[PARENT_LOCAL_NAME_FIELD], LOCAL_NAME_REGEXP); + nameVersionNameArray[PARENT_LOCAL_NAME_FIELD], LOCAL_NAME_REGEXP); localName = Assertions.validateStringParameter(LOCAL_NAME, nameVersionNameArray[LOCAL_NAME_FIELD], - LOCAL_NAME_REGEXP); + LOCAL_NAME_REGEXP); } /** @@ -231,7 +220,7 @@ public class PfReferenceKey extends PfKey { */ public static PfReferenceKey getNullKey() { return new PfReferenceKey(PfKey.NULL_KEY_NAME, PfKey.NULL_KEY_VERSION, PfKey.NULL_KEY_NAME, - PfKey.NULL_KEY_NAME); + PfKey.NULL_KEY_NAME); } @Override @@ -279,8 +268,7 @@ public class PfReferenceKey extends PfKey { /** * Sets the parent concept key of this reference key. * - * @param parentKey - * the parent concept key of this reference key + * @param parentKey the parent concept key of this reference key */ public void setParentConceptKey(final PfConceptKey parentKey) { Assertions.argumentNotNull(parentKey, "parentKey may not be null"); @@ -293,8 +281,7 @@ public class PfReferenceKey extends PfKey { /** * Sets the parent reference key of this reference key. * - * @param parentKey - * the parent reference key of this reference key + * @param parentKey the parent reference key of this reference key */ public void setParentReferenceKey(final PfReferenceKey parentKey) { Assertions.argumentNotNull(parentKey, "parentKey may not be null"); @@ -305,21 +292,19 @@ public class PfReferenceKey extends PfKey { } @Override - public PfKey.Compatibility getCompatibility(final PfKey otherKey) { - if (!(otherKey instanceof PfReferenceKey)) { + public PfKey.Compatibility getCompatibility(@NonNull final PfKey otherKey) { + if (!(otherKey instanceof PfReferenceKey otherReferenceKey)) { return Compatibility.DIFFERENT; } - final PfReferenceKey otherReferenceKey = (PfReferenceKey) otherKey; return this.getParentConceptKey().getCompatibility(otherReferenceKey.getParentConceptKey()); } @Override public boolean isCompatible(@NonNull final PfKey otherKey) { - if (!(otherKey instanceof PfReferenceKey)) { + if (!(otherKey instanceof PfReferenceKey otherReferenceKey)) { return false; } - final PfReferenceKey otherReferenceKey = (PfReferenceKey) otherKey; return this.getParentConceptKey().isCompatible(otherReferenceKey.getParentConceptKey()); } @@ -358,7 +343,7 @@ public class PfReferenceKey extends PfKey { } @Override - public int compareTo(final PfConcept otherObj) { + public int compareTo(@NonNull final PfConcept otherObj) { Assertions.argumentNotNull(otherObj, "comparison object may not be null"); if (this == otherObj) { diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfReferenceTimestampKey.java b/models-base/src/main/java/org/onap/policy/models/base/PfReferenceTimestampKey.java index 8be1126af..c7838d8e3 100644 --- a/models-base/src/main/java/org/onap/policy/models/base/PfReferenceTimestampKey.java +++ b/models-base/src/main/java/org/onap/policy/models/base/PfReferenceTimestampKey.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2021 Nordix Foundation. + * Copyright (C) 2021, 2023 Nordix Foundation. * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,15 +21,16 @@ package org.onap.policy.models.base; +import jakarta.persistence.Column; +import jakarta.persistence.Embeddable; +import jakarta.persistence.Embedded; +import jakarta.persistence.Temporal; +import jakarta.persistence.TemporalType; +import java.io.Serial; import java.time.Instant; import java.util.Collections; import java.util.Date; import java.util.List; -import javax.persistence.Column; -import javax.persistence.Embeddable; -import javax.persistence.Embedded; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NonNull; @@ -46,6 +47,7 @@ import org.onap.policy.common.utils.validation.Assertions; @Data @EqualsAndHashCode(callSuper = false) public class PfReferenceTimestampKey extends PfKey { + @Serial private static final long serialVersionUID = 1130918285832617215L; private static final String TIMESTAMP_TOKEN = "timeStamp"; @@ -298,10 +300,9 @@ public class PfReferenceTimestampKey extends PfKey { @Override public boolean isCompatible(@NonNull PfKey otherKey) { - if (!(otherKey instanceof PfReferenceTimestampKey)) { + if (!(otherKey instanceof PfReferenceTimestampKey otherReferenceKey)) { return false; } - final PfReferenceTimestampKey otherReferenceKey = (PfReferenceTimestampKey) otherKey; return this.getReferenceKey().getParentConceptKey().isCompatible(otherReferenceKey.getReferenceKey() .getParentConceptKey()); diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfSearchableKey.java b/models-base/src/main/java/org/onap/policy/models/base/PfSearchableKey.java index 902d19869..2296953dc 100644 --- a/models-base/src/main/java/org/onap/policy/models/base/PfSearchableKey.java +++ b/models-base/src/main/java/org/onap/policy/models/base/PfSearchableKey.java @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019, 2023 Nordix Foundation. * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,8 +21,9 @@ package org.onap.policy.models.base; -import javax.persistence.Column; -import javax.persistence.Embeddable; +import jakarta.persistence.Column; +import jakarta.persistence.Embeddable; +import java.io.Serial; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NonNull; @@ -37,6 +38,7 @@ import org.onap.policy.common.utils.validation.Assertions; @Getter @EqualsAndHashCode(callSuper = false) public class PfSearchableKey extends PfKeyImpl { + @Serial private static final long serialVersionUID = 8932717618579392561L; /** Regular expression to specify the structure of key names. */ @@ -98,7 +100,7 @@ public class PfSearchableKey extends PfKeyImpl { * * @return a null key */ - public static final PfSearchableKey getNullKey() { + public static PfSearchableKey getNullKey() { return new PfSearchableKey(PfKey.NULL_KEY_NAME, PfKey.NULL_KEY_VERSION); } diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfTimestampKey.java b/models-base/src/main/java/org/onap/policy/models/base/PfTimestampKey.java index 1f5dc654a..ea12889e4 100644 --- a/models-base/src/main/java/org/onap/policy/models/base/PfTimestampKey.java +++ b/models-base/src/main/java/org/onap/policy/models/base/PfTimestampKey.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP Policy Model * ================================================================================ - * Copyright (C) 2019-2021 Nordix Foundation. + * Copyright (C) 2019-2021, 2023 Nordix Foundation. * Modifications Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,12 +23,13 @@ package org.onap.policy.models.base; +import jakarta.persistence.Column; +import jakarta.persistence.Embeddable; +import jakarta.persistence.Temporal; +import jakarta.persistence.TemporalType; +import java.io.Serial; import java.time.Instant; import java.util.Date; -import javax.persistence.Column; -import javax.persistence.Embeddable; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NonNull; @@ -39,6 +40,7 @@ import org.onap.policy.common.utils.validation.Assertions; @Data @EqualsAndHashCode(callSuper = false) public class PfTimestampKey extends PfKeyImpl { + @Serial private static final long serialVersionUID = -8410208962541783805L; private static final String TIMESTAMP_TOKEN = "timeStamp"; @@ -77,12 +79,12 @@ public class PfTimestampKey extends PfKeyImpl { /** * Constructor to create a key with the specified name and version. * - * @param name the key name + * @param name the key name * @param version the key version * @param instant the time stamp of key */ public PfTimestampKey(@NonNull final String name, @NonNull final String version, - @NonNull final Instant instant) { + @NonNull final Instant instant) { super(name, version); this.timeStamp = Date.from(instant); } @@ -107,7 +109,7 @@ public class PfTimestampKey extends PfKeyImpl { * * @return a null key */ - public static final PfTimestampKey getNullKey() { + public static PfTimestampKey getNullKey() { return new PfTimestampKey(PfKey.NULL_KEY_NAME, PfKey.NULL_KEY_VERSION, Instant.EPOCH); } diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfUtils.java b/models-base/src/main/java/org/onap/policy/models/base/PfUtils.java index 6f93010bb..51054ee77 100644 --- a/models-base/src/main/java/org/onap/policy/models/base/PfUtils.java +++ b/models-base/src/main/java/org/onap/policy/models/base/PfUtils.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019-2021 Nordix Foundation. + * Copyright (C) 2019-2021, 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"); @@ -21,6 +21,7 @@ package org.onap.policy.models.base; +import jakarta.ws.rs.core.Response; import java.lang.reflect.InvocationTargetException; import java.util.Collection; import java.util.LinkedHashMap; @@ -29,7 +30,6 @@ import java.util.Map; import java.util.Map.Entry; import java.util.function.Function; import java.util.stream.Collectors; -import javax.ws.rs.core.Response; import lombok.AccessLevel; import lombok.NoArgsConstructor; import org.apache.commons.collections4.CollectionUtils; @@ -46,7 +46,7 @@ public final class PfUtils { /** * Compare two objects using their equals methods, nulls are allowed. * - * @param leftObject the first object + * @param leftObject the first object * @param rightObject the second object * @return a measure of the comparison */ @@ -73,7 +73,7 @@ public final class PfUtils { /** * Compare two collections of the same type, nulls are allowed. * - * @param leftCollection the first collection + * @param leftCollection the first collection * @param rightCollection the second collection * @return a measure of the comparison */ @@ -89,7 +89,7 @@ public final class PfUtils { /** * Compare two maps of the same type, nulls are allowed. * - * @param leftMap the first map + * @param leftMap the first map * @param rightMap the second map * @return a measure of the comparison */ @@ -102,12 +102,12 @@ public final class PfUtils { } /** - * Convenience method to apply a mapping function to all of the elements of a list, generating a new list. + * Convenience method to apply a mapping function to all the elements of a list, generating a new list. * - * @param source list whose elements are to be mapped, or {@code null} - * @param mapFunc mapping function + * @param source list whose elements are to be mapped, or {@code null} + * @param mapFunc mapping function * @param defaultValue value to be returned if source is {@code null} - * @return a new list, containing mappings of all of the items in the original list + * @return a new list, containing mappings of all the items in the original list */ public static List mapList(List source, Function mapFunc, List defaultValue) { if (source == null) { @@ -118,27 +118,26 @@ public final class PfUtils { } /** - * Convenience method to apply a mapping function to all of the elements of a list, generating a new list. + * Convenience method to apply a mapping function to all the elements of a list, generating a new list. * - * @param source list whose elements are to be mapped, or {@code null} + * @param source list whose elements are to be mapped, or {@code null} * @param mapFunc mapping function - * @return a new list, containing mappings of all of the items in the original list, or {@code null} if the source - * is {@code null} + * @return a new list, containing mappings of all the items in the original list, or {@code null} if the source + * is {@code null} */ public static List mapList(List source, Function mapFunc) { return mapList(source, mapFunc, null); } /** - * Convenience method to apply a mapping function to all of the values of a map, generating a new map. + * Convenience method to apply a mapping function to all the values of a map, generating a new map. * - * @param source map whose values are to be mapped, or {@code null} - * @param mapFunc mapping function + * @param source map whose values are to be mapped, or {@code null} + * @param mapFunc mapping function * @param defaultValue value to be returned if source is {@code null} - * @return a new map, containing mappings of all of the items in the original map + * @return a new map, containing mappings of all the items in the original map */ - public static Map mapMap(Map source, Function mapFunc, - Map defaultValue) { + public static Map mapMap(Map source, Function mapFunc, Map defaultValue) { if (source == null) { return defaultValue; } @@ -152,12 +151,12 @@ public final class PfUtils { } /** - * Convenience method to apply a mapping function to all of the values of a map, generating a new map. + * Convenience method to apply a mapping function to all the values of a map, generating a new map. * - * @param source map whose values are to be mapped, or {@code null} + * @param source map whose values are to be mapped, or {@code null} * @param mapFunc mapping function - * @return a new map, containing mappings of all of the items in the original map, or {@code null} if the source is - * {@code null} + * @return a new map, containing mappings of all the items in the original map, or {@code null} if the source is + * {@code null} */ public static Map mapMap(Map source, Function mapFunc) { return mapMap(source, mapFunc, null); @@ -176,15 +175,14 @@ public final class PfUtils { } try { - @SuppressWarnings("unchecked") - Class clazz = (Class) source.getClass(); + @SuppressWarnings("unchecked") Class clazz = (Class) source.getClass(); return clazz.getConstructor(clazz).newInstance(source); } catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException - | RuntimeException e) { + | RuntimeException e) { throw new PfModelRuntimeException(Response.Status.INTERNAL_SERVER_ERROR, - "error copying concept key class: " + source.getClass().getName(), e); + "error copying concept key class: " + source.getClass().getName(), e); } } } diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfValidator.java b/models-base/src/main/java/org/onap/policy/models/base/PfValidator.java index db7b9d63e..c2eb2b649 100644 --- a/models-base/src/main/java/org/onap/policy/models/base/PfValidator.java +++ b/models-base/src/main/java/org/onap/policy/models/base/PfValidator.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2020-2021 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. @@ -48,11 +49,10 @@ public class PfValidator extends BeanValidator { * @return {@code true} if the next check should be performed, {@code false} otherwise */ public boolean verPfMin(BeanValidationResult result, String fieldName, PfMin annot, Object value) { - if (!(value instanceof Number)) { + if (!(value instanceof Number num)) { return true; } - Number num = (Number) value; if (num.longValue() == annot.allowed()) { // this value is always allowed return true; @@ -93,11 +93,10 @@ public class PfValidator extends BeanValidator { * @return {@code true} if the next check should be performed, {@code false} otherwise */ public boolean verKey(BeanValidationResult result, String fieldName, VerifyKey annot, Object value) { - if (!(value instanceof PfKey)) { + if (!(value instanceof PfKey pfkey)) { return true; } - var pfkey = (PfKey) value; if (annot.keyNotNull() && pfkey.isNullKey()) { result.addResult(fieldName, xlate(pfkey), ValidationStatus.INVALID, Validated.IS_A_NULL_KEY); return false; @@ -107,14 +106,12 @@ public class PfValidator extends BeanValidator { verCascade(result, fieldName, value); } - if (!(pfkey instanceof PfKeyImpl)) { + if (!(pfkey instanceof PfKeyImpl keyimpl)) { return true; } var result2 = new BeanValidationResult(fieldName, value); - PfKeyImpl keyimpl = (PfKeyImpl) pfkey; - if (annot.nameNotNull() && keyimpl.isNullName()) { result2.addResult("name", pfkey.getName(), ValidationStatus.INVALID, Validated.IS_NULL); } diff --git a/models-base/src/test/java/org/onap/policy/models/base/ExceptionsTest.java b/models-base/src/test/java/org/onap/policy/models/base/ExceptionsTest.java index 52d17e74f..b92aed487 100644 --- a/models-base/src/test/java/org/onap/policy/models/base/ExceptionsTest.java +++ b/models-base/src/test/java/org/onap/policy/models/base/ExceptionsTest.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019, 2021 Nordix Foundation. + * Copyright (C) 2019, 2021, 2023 Nordix Foundation. * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -24,9 +24,9 @@ package org.onap.policy.models.base; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.Status; import java.io.IOException; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.Response.Status; import org.junit.Test; import org.onap.policy.models.errors.concepts.ErrorResponse; @@ -44,7 +44,7 @@ public class ExceptionsTest { String key = "A String"; PfModelException ae = - new PfModelException(Response.Status.OK, MESSAGE, new IOException("IO exception message"), key); + new PfModelException(Response.Status.OK, MESSAGE, new IOException("IO exception message"), key); ErrorResponse errorResponse = ae.getErrorResponse(); assertEquals("Message\nIO exception message", String.join("\n", errorResponse.getErrorDetails())); assertEquals(key, ae.getObject()); @@ -56,10 +56,10 @@ public class ExceptionsTest { String rkey = "A String"; PfModelRuntimeException re = new PfModelRuntimeException(Response.Status.OK, "Runtime Message", - new IOException("IO runtime exception message"), rkey); + new IOException("IO runtime exception message"), rkey); errorResponse = re.getErrorResponse(); assertEquals("Runtime Message\nIO runtime exception message", - String.join("\n", errorResponse.getErrorDetails())); + String.join("\n", errorResponse.getErrorDetails())); assertEquals(key, re.getObject()); PfModelRuntimeException pfre = new PfModelRuntimeException(ae); diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfConceptContainerTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfConceptContainerTest.java index f5c6e3a9b..c526b231a 100644 --- a/models-base/src/test/java/org/onap/policy/models/base/PfConceptContainerTest.java +++ b/models-base/src/test/java/org/onap/policy/models/base/PfConceptContainerTest.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019-2021 Nordix Foundation. + * Copyright (C) 2019-2021, 2023 Nordix Foundation. * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -65,18 +65,18 @@ public class PfConceptContainerTest { container = new DummyPfConceptContainer(new PfConceptKey()); assertNotNull(container); - container = new DummyPfConceptContainer(new PfConceptKey(), new TreeMap()); + container = new DummyPfConceptContainer(new PfConceptKey(), new TreeMap<>()); assertNotNull(container); - assertThatThrownBy(() -> new PfConceptContainer((PfConceptKey) null, null)).hasMessageMatching(KEY_IS_NULL); + assertThatThrownBy(() -> new PfConceptContainer(null, null)).hasMessageMatching(KEY_IS_NULL); - assertThatThrownBy(() -> new DummyPfConceptContainer((PfConceptKey) null, null)) + assertThatThrownBy(() -> new DummyPfConceptContainer(null, null)) .hasMessageMatching(KEY_IS_NULL); assertThatThrownBy(() -> new DummyPfConceptContainer(new PfConceptKey(), null)) .hasMessageMatching("^conceptMap is marked .*on.*ull but is null$"); - assertThatThrownBy(() -> new DummyPfConceptContainer(null, new TreeMap())) + assertThatThrownBy(() -> new DummyPfConceptContainer(null, new TreeMap<>())) .hasMessageMatching(KEY_IS_NULL); } @@ -117,8 +117,8 @@ public class PfConceptContainerTest { assertThatThrownBy(() -> new DummyPfConceptContainer((DummyPfConceptContainer) null)) .isInstanceOf(NullPointerException.class); + assertThatThrownBy(() -> container.compareTo(null)).isInstanceOf(NullPointerException.class); - assertNotEquals(0, container.compareTo(null)); assertEquals(0, container.compareTo(container)); assertNotEquals(0, container.compareTo(conceptKey)); @@ -271,7 +271,7 @@ public class PfConceptContainerTest { } @Test(expected = NullPointerException.class) - public void testnullKey() { + public void testNullKey() { PfConceptKey nullKey = null; new DummyPfConceptContainer(nullKey); } diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfModelExceptionInfoTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfModelExceptionInfoTest.java index 5cebf1e91..8b6202042 100644 --- a/models-base/src/test/java/org/onap/policy/models/base/PfModelExceptionInfoTest.java +++ b/models-base/src/test/java/org/onap/policy/models/base/PfModelExceptionInfoTest.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019-2020 Nordix Foundation. + * 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. @@ -24,7 +24,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.core.Response; import org.junit.Test; import org.onap.policy.models.errors.concepts.ErrorResponseInfo; diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfValidatorTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfValidatorTest.java index 812916e3c..ed8c138be 100644 --- a/models-base/src/test/java/org/onap/policy/models/base/PfValidatorTest.java +++ b/models-base/src/test/java/org/onap/policy/models/base/PfValidatorTest.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2021 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. @@ -24,8 +25,9 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; +import jakarta.validation.Valid; +import java.io.Serial; import java.util.concurrent.atomic.AtomicBoolean; -import javax.validation.Valid; import lombok.Getter; import lombok.NonNull; import org.junit.Before; @@ -123,13 +125,13 @@ public class PfValidatorTest { // null key data.key = new PfConceptKey(); assertThat(validator.validateTop("", data).getResult()) - .contains(KEY_FIELD, "NULL:0.0.0", Validated.IS_A_NULL_KEY).doesNotContain("name", "version"); + .contains(KEY_FIELD, "NULL:0.0.0", Validated.IS_A_NULL_KEY).doesNotContain("name", "version"); // invalid version - should invoke verCascade() which will invoke key.validate() data.key = new StandardCoder().decode("{'name':'abc', 'version':'xyzzy'}".replace('\'', '"'), - PfConceptKey.class); + PfConceptKey.class); assertThat(validator.validateTop("", data).getResult()) - .contains(KEY_FIELD, "version", "xyzzy", "regular expression").doesNotContain("name"); + .contains(KEY_FIELD, "version", "xyzzy", "regular expression").doesNotContain("name"); // not a PfKeyImpl - should not check individual fields PfKey pfkey = mock(PfKey.class); @@ -142,18 +144,18 @@ public class PfValidatorTest { // null name data.key = new PfConceptKey(PfKey.NULL_KEY_NAME, "2.3.4"); assertThat(validator.validateTop("", data).getResult()).contains(KEY_FIELD, "name", "null") - .doesNotContain("version", "2.3.4"); + .doesNotContain("version", "2.3.4"); // null version data.key = new PfConceptKey(STRING_VALUE, PfKey.NULL_KEY_VERSION); assertThat(validator.validateTop("", data).getResult()).contains(KEY_FIELD, "version", "null") - .doesNotContain("name", STRING_VALUE); + .doesNotContain("name", STRING_VALUE); // null name, invalid version - should get two messages data.key = new StandardCoder().decode("{'name':'NULL', 'version':'xyzzy'}".replace('\'', '"'), - PfConceptKey.class); + PfConceptKey.class); assertThat(validator.validateTop("", data).getResult()).contains(KEY_FIELD, "name", "null", "version", "xyzzy", - "regular expression"); + "regular expression"); /* * Tests with all flags set to "false" (i.e., no validations). @@ -165,6 +167,7 @@ public class PfValidatorTest { AtomicBoolean called = new AtomicBoolean(); data2.key = new PfConceptKey() { + @Serial private static final long serialVersionUID = 1L; @Override diff --git a/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfConcept.java b/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfConcept.java index 548c26252..25a6cb7ba 100644 --- a/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfConcept.java +++ b/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfConcept.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019, 2023 Nordix Foundation. * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,8 +21,9 @@ package org.onap.policy.models.base.testconcepts; +import jakarta.persistence.EmbeddedId; +import java.io.Serial; import java.util.List; -import javax.persistence.EmbeddedId; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NonNull; @@ -38,6 +39,7 @@ import org.onap.policy.models.base.validation.annotations.VerifyKey; @Data @EqualsAndHashCode(callSuper = false) public class DummyPfConcept extends PfConcept implements PfAuthorative { + @Serial private static final long serialVersionUID = 1L; @EmbeddedId diff --git a/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfConceptKeySub.java b/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfConceptKeySub.java index 8352697e6..b204895c6 100644 --- a/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfConceptKeySub.java +++ b/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfConceptKeySub.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019, 2023 Nordix Foundation. * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,7 +21,7 @@ package org.onap.policy.models.base.testconcepts; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.core.Response; import lombok.NonNull; import org.onap.policy.models.base.PfConceptKey; import org.onap.policy.models.base.PfModelRuntimeException; diff --git a/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfConceptSub.java b/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfConceptSub.java index 2c3fd189e..089773d5f 100644 --- a/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfConceptSub.java +++ b/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfConceptSub.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * 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,12 +20,14 @@ package org.onap.policy.models.base.testconcepts; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.core.Response; +import java.io.Serial; import lombok.NonNull; import org.onap.policy.models.base.PfConceptKey; import org.onap.policy.models.base.PfModelRuntimeException; public class DummyPfConceptSub extends DummyPfConcept { + @Serial private static final long serialVersionUID = 1L; /** diff --git a/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfKey.java b/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfKey.java index 015d1a950..594528be8 100644 --- a/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfKey.java +++ b/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfKey.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019, 2023 Nordix Foundation. * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,7 +21,7 @@ package org.onap.policy.models.base.testconcepts; -import java.util.Arrays; +import java.io.Serial; import java.util.List; import lombok.NonNull; import org.onap.policy.common.parameters.BeanValidationResult; @@ -29,6 +29,7 @@ import org.onap.policy.models.base.PfConcept; import org.onap.policy.models.base.PfKey; public class DummyPfKey extends PfKey { + @Serial private static final long serialVersionUID = 1L; public DummyPfKey() { @@ -40,7 +41,7 @@ public class DummyPfKey extends PfKey { } @Override - public int compareTo(PfConcept arg0) { + public int compareTo(@NonNull PfConcept arg0) { return 0; } @@ -55,12 +56,12 @@ public class DummyPfKey extends PfKey { } @Override - public Compatibility getCompatibility(PfKey otherKey) { + public Compatibility getCompatibility(@NonNull PfKey otherKey) { return null; } @Override - public boolean isCompatible(PfKey otherKey) { + public boolean isCompatible(@NonNull PfKey otherKey) { return false; } @@ -71,7 +72,7 @@ public class DummyPfKey extends PfKey { @Override public List getKeys() { - return Arrays.asList(getKey()); + return List.of(getKey()); } @Override diff --git a/models-dao/pom.xml b/models-dao/pom.xml index e301eaf5b..8529540f4 100644 --- a/models-dao/pom.xml +++ b/models-dao/pom.xml @@ -19,18 +19,20 @@ ============LICENSE_END========================================================= --> + 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"> 4.0.0 org.onap.policy.models policy-models - 3.0.0-SNAPSHOT + 3.0.1-SNAPSHOT policy-models-dao ${project.artifactId} - [${project.parent.artifactId}] module provides common DAO (Data Access Object) model handling for the ONAP Policy Framework + [${project.parent.artifactId}] module provides common DAO (Data Access Object) model handling for the + ONAP Policy Framework + diff --git a/models-dao/src/main/java/org/onap/policy/models/dao/PfDaoFactory.java b/models-dao/src/main/java/org/onap/policy/models/dao/PfDaoFactory.java index 177a7f320..a4f098582 100644 --- a/models-dao/src/main/java/org/onap/policy/models/dao/PfDaoFactory.java +++ b/models-dao/src/main/java/org/onap/policy/models/dao/PfDaoFactory.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019, 2023 Nordix Foundation. * Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,8 +21,8 @@ package org.onap.policy.models.dao; +import jakarta.ws.rs.core.Response; import java.lang.reflect.InvocationTargetException; -import javax.ws.rs.core.Response; import org.onap.policy.common.utils.validation.Assertions; import org.onap.policy.models.base.PfModelException; import org.slf4j.Logger; @@ -50,7 +50,7 @@ public class PfDaoFactory { "Parameter \"daoParameters\" may not be null"); // Get the class for the DAO using reflection - Object pfDaoObject = null; + Object pfDaoObject; try { pfDaoObject = Class.forName(daoParameters.getPluginClass()).getDeclaredConstructor().newInstance(); } catch (InstantiationException | IllegalAccessException | ClassNotFoundException | IllegalArgumentException diff --git a/models-dao/src/main/java/org/onap/policy/models/dao/PfFilter.java b/models-dao/src/main/java/org/onap/policy/models/dao/PfFilter.java index 7afe243a7..bba494d24 100644 --- a/models-dao/src/main/java/org/onap/policy/models/dao/PfFilter.java +++ b/models-dao/src/main/java/org/onap/policy/models/dao/PfFilter.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2021 Nordix Foundation. + * Copyright (C) 2021, 2023 Nordix Foundation. * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,9 +21,9 @@ package org.onap.policy.models.dao; +import jakarta.persistence.TypedQuery; import java.sql.Timestamp; import java.util.Map; -import javax.persistence.TypedQuery; import lombok.Data; import org.onap.policy.models.base.PfConcept; diff --git a/models-dao/src/main/java/org/onap/policy/models/dao/converters/CDataConditioner.java b/models-dao/src/main/java/org/onap/policy/models/dao/converters/CDataConditioner.java index 4a3a4da66..f36ef586d 100644 --- a/models-dao/src/main/java/org/onap/policy/models/dao/converters/CDataConditioner.java +++ b/models-dao/src/main/java/org/onap/policy/models/dao/converters/CDataConditioner.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019, 2023 Nordix Foundation. * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,9 +22,9 @@ package org.onap.policy.models.dao.converters; import com.google.re2j.Pattern; -import javax.persistence.AttributeConverter; -import javax.persistence.Converter; -import javax.xml.bind.annotation.adapters.XmlAdapter; +import jakarta.persistence.AttributeConverter; +import jakarta.persistence.Converter; +import jakarta.xml.bind.annotation.adapters.XmlAdapter; /** * The Class CDataConditioner converts a CDATA String to and from database format by removing spaces @@ -62,7 +62,7 @@ public class CDataConditioner extends XmlAdapter implements Attr * @param in the in * @return the string */ - public static final String clean(final String in) { + public static String clean(final String in) { if (in == null) { return null; } else { diff --git a/models-dao/src/main/java/org/onap/policy/models/dao/converters/Uuid2String.java b/models-dao/src/main/java/org/onap/policy/models/dao/converters/Uuid2String.java index 965a71c7a..9f589de3e 100644 --- a/models-dao/src/main/java/org/onap/policy/models/dao/converters/Uuid2String.java +++ b/models-dao/src/main/java/org/onap/policy/models/dao/converters/Uuid2String.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * 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,10 +20,10 @@ package org.onap.policy.models.dao.converters; +import jakarta.persistence.AttributeConverter; +import jakarta.persistence.Converter; +import jakarta.xml.bind.annotation.adapters.XmlAdapter; import java.util.UUID; -import javax.persistence.AttributeConverter; -import javax.persistence.Converter; -import javax.xml.bind.annotation.adapters.XmlAdapter; /** * The Class UuidConverter converts a UUID to and from database format. diff --git a/models-dao/src/main/java/org/onap/policy/models/dao/impl/DefaultPfDao.java b/models-dao/src/main/java/org/onap/policy/models/dao/impl/DefaultPfDao.java index 13a4eea5a..c4b259882 100644 --- a/models-dao/src/main/java/org/onap/policy/models/dao/impl/DefaultPfDao.java +++ b/models-dao/src/main/java/org/onap/policy/models/dao/impl/DefaultPfDao.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019-2021,2023 Nordix Foundation. + * Copyright (C) 2019-2021, 2023 Nordix Foundation. * Modifications Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved. * Modifications Copyright (C) 2022 Bell Canada. All rights reserved. * ================================================================================ @@ -22,14 +22,14 @@ package org.onap.policy.models.dao.impl; +import jakarta.persistence.EntityManager; +import jakarta.persistence.EntityManagerFactory; +import jakarta.persistence.Persistence; +import jakarta.persistence.TypedQuery; +import jakarta.ws.rs.core.Response; import java.util.Collection; import java.util.Collections; import java.util.List; -import javax.persistence.EntityManager; -import javax.persistence.EntityManagerFactory; -import javax.persistence.Persistence; -import javax.persistence.TypedQuery; -import javax.ws.rs.core.Response; import org.apache.commons.lang3.StringUtils; import org.onap.policy.models.base.PfConcept; import org.onap.policy.models.base.PfConceptKey; @@ -49,7 +49,7 @@ import org.slf4j.LoggerFactory; /** * The Class DefaultPfDao is an JPA implementation of the {@link PfDao} class for Policy Framework concepts - * ({@link PfConcept}). It uses the default JPA implementation in the javax {@link Persistence} class. + * ({@link PfConcept}). It uses the default JPA implementation in the jakarta {@link Persistence} class. */ public class DefaultPfDao implements PfDao { private static final Logger LOGGER = LoggerFactory.getLogger(DefaultPfDao.class); @@ -156,13 +156,10 @@ public class DefaultPfDao implements PfDao { if (obj == null) { return; } - final var mg = getEntityManager(); - try { + try (var mg = getEntityManager()) { mg.getTransaction().begin(); mg.merge(obj); mg.getTransaction().commit(); - } finally { - mg.close(); } } @@ -171,13 +168,10 @@ public class DefaultPfDao implements PfDao { if (obj == null) { return; } - final var mg = getEntityManager(); - try { + try (var mg = getEntityManager()) { mg.getTransaction().begin(); mg.remove(mg.contains(obj) ? obj : mg.merge(obj)); mg.getTransaction().commit(); - } finally { - mg.close(); } } @@ -186,8 +180,7 @@ public class DefaultPfDao implements PfDao { if (key == null) { return; } - final var mg = getEntityManager(); - try { + try (var mg = getEntityManager()) { // @formatter:off mg.getTransaction().begin(); mg.createQuery(setQueryTable(DELETE_BY_CONCEPT_KEY, someClass)) @@ -196,8 +189,6 @@ public class DefaultPfDao implements PfDao { .executeUpdate(); mg.getTransaction().commit(); // @formatter:on - } finally { - mg.close(); } } @@ -206,8 +197,7 @@ public class DefaultPfDao implements PfDao { if (key == null) { return; } - final var mg = getEntityManager(); - try { + try (var mg = getEntityManager()) { // @formatter:off mg.getTransaction().begin(); mg.createQuery(setQueryTable(DELETE_BY_REFERENCE_KEY, someClass)) @@ -217,8 +207,6 @@ public class DefaultPfDao implements PfDao { .executeUpdate(); mg.getTransaction().commit(); // @formatter:on - } finally { - mg.close(); } } @@ -227,8 +215,7 @@ public class DefaultPfDao implements PfDao { if (key == null) { return; } - final var mg = getEntityManager(); - try { + try (var mg = getEntityManager()) { // @formatter:off mg.getTransaction().begin(); mg.createQuery(setQueryTable(DELETE_BY_TIMESTAMP_KEY, someClass)) @@ -238,8 +225,6 @@ public class DefaultPfDao implements PfDao { .executeUpdate(); mg.getTransaction().commit(); // @formatter:on - } finally { - mg.close(); } } @@ -248,15 +233,12 @@ public class DefaultPfDao implements PfDao { if (objs == null || objs.isEmpty()) { return; } - final var mg = getEntityManager(); - try { + try (var mg = getEntityManager()) { mg.getTransaction().begin(); for (final T t : objs) { mg.merge(t); } mg.getTransaction().commit(); - } finally { - mg.close(); } } @@ -265,15 +247,12 @@ public class DefaultPfDao implements PfDao { if (objs == null || objs.isEmpty()) { return; } - final var mg = getEntityManager(); - try { + try (var mg = getEntityManager()) { mg.getTransaction().begin(); for (final T t : objs) { mg.remove(mg.contains(t) ? t : mg.merge(t)); } mg.getTransaction().commit(); - } finally { - mg.close(); } } @@ -283,8 +262,7 @@ public class DefaultPfDao implements PfDao { return 0; } var deletedCount = 0; - final var mg = getEntityManager(); - try { + try (var mg = getEntityManager()) { // @formatter:off mg.getTransaction().begin(); for (final PfConceptKey key : keys) { @@ -295,21 +273,18 @@ public class DefaultPfDao implements PfDao { } mg.getTransaction().commit(); // @formatter:on - } finally { - mg.close(); } return deletedCount; } @Override public int deleteByReferenceKey(final Class someClass, - final Collection keys) { + final Collection keys) { if (keys == null || keys.isEmpty()) { return 0; } var deletedCount = 0; - final var mg = getEntityManager(); - try { + try (var mg = getEntityManager()) { // @formatter:off mg.getTransaction().begin(); for (final PfReferenceKey key : keys) { @@ -321,27 +296,22 @@ public class DefaultPfDao implements PfDao { } mg.getTransaction().commit(); // @formatter:on - } finally { - mg.close(); } return deletedCount; } @Override public void deleteAll(final Class someClass) { - final var mg = getEntityManager(); - try { + try (var mg = getEntityManager()) { mg.getTransaction().begin(); mg.createQuery(setQueryTable(DELETE_FROM_TABLE, someClass)).executeUpdate(); mg.getTransaction().commit(); - } finally { - mg.close(); } } @Override public List getFiltered(final Class someClass, final String name, - final String version) { + final String version) { if (name == null) { return getAll(someClass); } @@ -357,9 +327,8 @@ public class DefaultPfDao implements PfDao { @Override public List getFiltered(final Class someClass, PfFilterParametersIntfc filterParams) { - final var mg = getEntityManager(); - try { + try (var mg = getEntityManager()) { PfFilter filter = new PfFilterFactory().createFilter(someClass); var filterQueryString = SELECT_FROM_TABLE + filter.genWhereClause(filterParams) @@ -370,8 +339,6 @@ public class DefaultPfDao implements PfDao { LOGGER.debug("filterQueryString is \"{}\"", filterQueryString); return query.getResultList(); - } finally { - mg.close(); } } @@ -399,15 +366,12 @@ public class DefaultPfDao implements PfDao { if (someClass == null) { return null; } - final var mg = getEntityManager(); - try { + try (var mg = getEntityManager()) { final var t = mg.find(someClass, key); if (t != null) { mg.refresh(t); } return checkAndReturn(someClass, t); - } finally { - mg.close(); } } @@ -416,11 +380,8 @@ public class DefaultPfDao implements PfDao { if (someClass == null) { return Collections.emptyList(); } - final var mg = getEntityManager(); - try { + try (var mg = getEntityManager()) { return mg.createQuery(setQueryTable(SELECT_FROM_TABLE, someClass), someClass).getResultList(); - } finally { - mg.close(); } } @@ -429,16 +390,13 @@ public class DefaultPfDao implements PfDao { if (someClass == null) { return Collections.emptyList(); } - final var mg = getEntityManager(); - try { + try (var mg = getEntityManager()) { // @formatter:off return mg.createQuery(setQueryTable(SELECT_ALL_FOR_PARENT, someClass), someClass) .setParameter(PARENT_NAME, parentKey.getName()) .setParameter(PARENT_VERSION, parentKey.getVersion()) .getResultList(); // @formatter:on - } finally { - mg.close(); } } @@ -448,8 +406,7 @@ public class DefaultPfDao implements PfDao { if (someClass == null) { return Collections.emptyList(); } - final var mg = getEntityManager(); - try { + try (var mg = getEntityManager()) { String query = setQueryTable(SELECT_FROM_TABLE, someClass); if (StringUtils.isNotBlank(orderBy)) { @@ -458,8 +415,6 @@ public class DefaultPfDao implements PfDao { return mg.createQuery(query, someClass).setMaxResults(numRecords) .getResultList(); - } finally { - mg.close(); } } @@ -468,15 +423,12 @@ public class DefaultPfDao implements PfDao { if (someClass == null || parentKeyName == null) { return Collections.emptyList(); } - final var mg = getEntityManager(); - try { + try (var mg = getEntityManager()) { // @formatter:off return mg.createQuery(setQueryTable(SELECT_ALL_VERSIONS_FOR_PARENT, someClass), someClass) .setParameter(PARENT_NAME, parentKeyName) .getResultList(); // @formatter:on - } finally { - mg.close(); } } @@ -485,15 +437,12 @@ public class DefaultPfDao implements PfDao { if (someClass == null || conceptName == null) { return Collections.emptyList(); } - final var mg = getEntityManager(); - try { + try (var mg = getEntityManager()) { // @formatter:off return mg.createQuery(setQueryTable(SELECT_ALL_VERSIONS, someClass), someClass) .setParameter(NAME, conceptName) .getResultList(); // @formatter:on - } finally { - mg.close(); } } @@ -502,17 +451,14 @@ public class DefaultPfDao implements PfDao { if (someClass == null || key == null) { return null; } - final var mg = getEntityManager(); List ret; - try { + try (var mg = getEntityManager()) { // @formatter:off ret = mg.createQuery(setQueryTable(SELECT_BY_CONCEPT_KEY, someClass), someClass) .setParameter(NAME, key.getName()) .setParameter(VERSION, key.getVersion()) .getResultList(); // @formatter:on - } finally { - mg.close(); } return getSingleResult(someClass, key.getId(), ret); @@ -523,9 +469,8 @@ public class DefaultPfDao implements PfDao { if (someClass == null || key == null) { return null; } - final var mg = getEntityManager(); List ret; - try { + try (var mg = getEntityManager()) { // @formatter:off ret = mg.createQuery(setQueryTable(SELECT_BY_REFERENCE_KEY, someClass), someClass) .setParameter(PARENT_NAME, key.getParentKeyName()) @@ -533,8 +478,6 @@ public class DefaultPfDao implements PfDao { .setParameter(LOCAL_NAME, key.getLocalName()) .getResultList(); // @formatter:on - } finally { - mg.close(); } return getSingleResult(someClass, key.getId(), ret); @@ -542,15 +485,12 @@ public class DefaultPfDao implements PfDao { @Override public T update(final T obj) { - final var mg = getEntityManager(); T ret; - try { + try (var mg = getEntityManager()) { mg.getTransaction().begin(); ret = mg.merge(obj); mg.flush(); mg.getTransaction().commit(); - } finally { - mg.close(); } return ret; } @@ -560,17 +500,14 @@ public class DefaultPfDao implements PfDao { if (someClass == null) { return 0; } - final var mg = getEntityManager(); - long size = 0; - try { + long size; + try (var mg = getEntityManager()) { /* * The invoking code only passes well-known classes into this method, thus * disabling the sonar about SQL injection. */ size = mg.createQuery("SELECT COUNT(c) FROM " + someClass.getSimpleName() + " c", Long.class) // NOSONAR .getSingleResult(); - } finally { - mg.close(); } return size; } @@ -579,7 +516,7 @@ public class DefaultPfDao implements PfDao { * Add the table to a query string. * * @param queryString the query string - * @param tableClass the class name of the table + * @param tableClass the class name of the table * @return the updated query string */ private String setQueryTable(final String queryString, final Class tableClass) { @@ -589,13 +526,13 @@ public class DefaultPfDao implements PfDao { /** * Check that a query returned one and only one entry and return that entry. * - * @param someClass the class being searched for + * @param someClass the class being searched for * @param searchFilter the search filter - * @param resultList the result list returned by the query + * @param resultList the result list returned by the query * @return the single unique result */ private T getSingleResult(final Class someClass, final String searchFilter, - List resultList) { + List resultList) { if (resultList == null || resultList.isEmpty()) { return null; } @@ -609,8 +546,8 @@ public class DefaultPfDao implements PfDao { /** * check the result get from database and return the object. * - * @param the type of the object to get, a subclass of {@link PfConcept} - * @param someClass the class of the object to get, a subclass of {@link PfConcept} + * @param the type of the object to get, a subclass of {@link PfConcept} + * @param someClass the class of the object to get, a subclass of {@link PfConcept} * @param objToCheck the object that was retrieved from the database * @return the checked object or null */ diff --git a/models-dao/src/main/java/org/onap/policy/models/dao/impl/ProxyDao.java b/models-dao/src/main/java/org/onap/policy/models/dao/impl/ProxyDao.java index d0681e1e4..cdf2a9857 100644 --- a/models-dao/src/main/java/org/onap/policy/models/dao/impl/ProxyDao.java +++ b/models-dao/src/main/java/org/onap/policy/models/dao/impl/ProxyDao.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2021 Nordix Foundation. + * Copyright (C) 2021, 2023 Nordix Foundation. * Modifications Copyright (C) 2022 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,12 +21,12 @@ package org.onap.policy.models.dao.impl; +import jakarta.persistence.EntityManager; +import jakarta.persistence.Persistence; +import jakarta.persistence.TypedQuery; import java.util.Collection; import java.util.Collections; import java.util.List; -import javax.persistence.EntityManager; -import javax.persistence.Persistence; -import javax.persistence.TypedQuery; import lombok.RequiredArgsConstructor; import org.apache.commons.lang3.StringUtils; import org.onap.policy.models.base.PfConcept; @@ -46,7 +46,7 @@ import org.slf4j.LoggerFactory; /** * The Class ProxyDao is an JPA implementation of the {@link ProxyDao} class for Policy Framework concepts - * ({@link PfConcept}). It uses the default JPA implementation in the javax {@link Persistence} class. + * ({@link PfConcept}). It uses the default JPA implementation in the jakarta {@link Persistence} class. */ @RequiredArgsConstructor public class ProxyDao implements PfDao { diff --git a/models-dao/src/test/java/org/onap/policy/models/dao/DummyConceptEntity.java b/models-dao/src/test/java/org/onap/policy/models/dao/DummyConceptEntity.java index 4ef3eb94d..cae8cff0f 100644 --- a/models-dao/src/test/java/org/onap/policy/models/dao/DummyConceptEntity.java +++ b/models-dao/src/test/java/org/onap/policy/models/dao/DummyConceptEntity.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019, 2023 Nordix Foundation. * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,13 +21,14 @@ package org.onap.policy.models.dao; +import jakarta.persistence.Column; +import jakarta.persistence.EmbeddedId; +import jakarta.persistence.Entity; +import jakarta.persistence.Table; +import java.io.Serial; import java.util.ArrayList; import java.util.List; import java.util.UUID; -import javax.persistence.Column; -import javax.persistence.EmbeddedId; -import javax.persistence.Entity; -import javax.persistence.Table; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NonNull; @@ -42,6 +43,7 @@ import org.onap.policy.models.base.PfKey; @Data @EqualsAndHashCode(callSuper = false) public class DummyConceptEntity extends PfConcept { + @Serial private static final long serialVersionUID = -2962570563281067894L; @EmbeddedId() diff --git a/models-dao/src/test/java/org/onap/policy/models/dao/DummyReferenceEntity.java b/models-dao/src/test/java/org/onap/policy/models/dao/DummyReferenceEntity.java index abd9e53ca..ae2252747 100644 --- a/models-dao/src/test/java/org/onap/policy/models/dao/DummyReferenceEntity.java +++ b/models-dao/src/test/java/org/onap/policy/models/dao/DummyReferenceEntity.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019, 2023 Nordix Foundation. * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,12 +21,13 @@ package org.onap.policy.models.dao; +import jakarta.persistence.Column; +import jakarta.persistence.EmbeddedId; +import jakarta.persistence.Entity; +import jakarta.persistence.Table; +import java.io.Serial; import java.util.ArrayList; import java.util.List; -import javax.persistence.Column; -import javax.persistence.EmbeddedId; -import javax.persistence.Entity; -import javax.persistence.Table; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NonNull; @@ -41,6 +42,7 @@ import org.onap.policy.models.base.PfReferenceKey; @Data @EqualsAndHashCode(callSuper = false) public class DummyReferenceEntity extends PfConcept { + @Serial private static final long serialVersionUID = -2962570563281067894L; @EmbeddedId() diff --git a/models-dao/src/test/java/org/onap/policy/models/dao/DummyReferenceTimestampEntity.java b/models-dao/src/test/java/org/onap/policy/models/dao/DummyReferenceTimestampEntity.java index b4983449b..8b01875f9 100644 --- a/models-dao/src/test/java/org/onap/policy/models/dao/DummyReferenceTimestampEntity.java +++ b/models-dao/src/test/java/org/onap/policy/models/dao/DummyReferenceTimestampEntity.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2021 Nordix Foundation. + * 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. @@ -20,12 +20,13 @@ package org.onap.policy.models.dao; +import jakarta.persistence.Column; +import jakarta.persistence.EmbeddedId; +import jakarta.persistence.Entity; +import jakarta.persistence.Table; +import java.io.Serial; import java.util.ArrayList; import java.util.List; -import javax.persistence.Column; -import javax.persistence.EmbeddedId; -import javax.persistence.Entity; -import javax.persistence.Table; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NonNull; @@ -39,6 +40,7 @@ import org.onap.policy.models.base.PfReferenceTimestampKey; @Data @EqualsAndHashCode(callSuper = false) public class DummyReferenceTimestampEntity extends PfConcept { + @Serial private static final long serialVersionUID = -2962570563281067895L; @EmbeddedId() diff --git a/models-dao/src/test/java/org/onap/policy/models/dao/DummyTimestampEntity.java b/models-dao/src/test/java/org/onap/policy/models/dao/DummyTimestampEntity.java index 37b18c113..76ac7f744 100644 --- a/models-dao/src/test/java/org/onap/policy/models/dao/DummyTimestampEntity.java +++ b/models-dao/src/test/java/org/onap/policy/models/dao/DummyTimestampEntity.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2020 Nordix Foundation. + * Copyright (C) 2020, 2023 Nordix Foundation. * Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,12 +21,13 @@ package org.onap.policy.models.dao; +import jakarta.persistence.Column; +import jakarta.persistence.EmbeddedId; +import jakarta.persistence.Entity; +import jakarta.persistence.Table; +import java.io.Serial; import java.util.ArrayList; import java.util.List; -import javax.persistence.Column; -import javax.persistence.EmbeddedId; -import javax.persistence.Entity; -import javax.persistence.Table; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NonNull; @@ -40,6 +41,7 @@ import org.onap.policy.models.base.PfTimestampKey; @Data @EqualsAndHashCode(callSuper = false) public class DummyTimestampEntity extends PfConcept { + @Serial private static final long serialVersionUID = -2962570563281067895L; @EmbeddedId() diff --git a/models-decisions/pom.xml b/models-decisions/pom.xml index 7eec5fbfd..62a3f396b 100644 --- a/models-decisions/pom.xml +++ b/models-decisions/pom.xml @@ -20,12 +20,12 @@ --> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.onap.policy.models policy-models - 3.0.0-SNAPSHOT + 3.0.1-SNAPSHOT policy-models-decisions diff --git a/models-decisions/src/main/java/org/onap/policy/models/decisions/concepts/DecisionException.java b/models-decisions/src/main/java/org/onap/policy/models/decisions/concepts/DecisionException.java index f5be10b13..f324fa583 100644 --- a/models-decisions/src/main/java/org/onap/policy/models/decisions/concepts/DecisionException.java +++ b/models-decisions/src/main/java/org/onap/policy/models/decisions/concepts/DecisionException.java @@ -3,6 +3,7 @@ * ONAP Policy Decision Models * ================================================================================ * Copyright (C) 2019 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,8 @@ package org.onap.policy.models.decisions.concepts; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.core.Response; +import java.io.Serial; import lombok.Getter; import lombok.ToString; import org.onap.policy.models.errors.concepts.ErrorResponse; @@ -30,6 +32,7 @@ import org.onap.policy.models.errors.concepts.ErrorResponseUtils; @Getter @ToString public class DecisionException extends RuntimeException implements ErrorResponseInfo { + @Serial private static final long serialVersionUID = -1255351537691201052L; private final ErrorResponse errorResponse = new ErrorResponse(); diff --git a/models-errors/pom.xml b/models-errors/pom.xml index 3d951c0bb..cff4e0c47 100644 --- a/models-errors/pom.xml +++ b/models-errors/pom.xml @@ -1,6 +1,6 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.onap.policy.models policy-models - 3.0.0-SNAPSHOT + 3.0.1-SNAPSHOT policy-models-errors @@ -38,10 +38,5 @@ gson ${policy.common.version} - - com.openpojo - openpojo - test - diff --git a/models-errors/src/main/java/org/onap/policy/models/errors/concepts/ErrorResponse.java b/models-errors/src/main/java/org/onap/policy/models/errors/concepts/ErrorResponse.java index 1f1fc0e5d..b06037e9b 100644 --- a/models-errors/src/main/java/org/onap/policy/models/errors/concepts/ErrorResponse.java +++ b/models-errors/src/main/java/org/onap/policy/models/errors/concepts/ErrorResponse.java @@ -3,6 +3,7 @@ * ONAP Policy Decision Models * ================================================================================ * Copyright (C) 2019 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,9 +22,10 @@ package org.onap.policy.models.errors.concepts; import com.google.gson.annotations.SerializedName; +import jakarta.ws.rs.core.Response; +import java.io.Serial; import java.io.Serializable; import java.util.List; -import javax.ws.rs.core.Response; import lombok.Data; /** @@ -31,19 +33,19 @@ import lombok.Data; * response from API calls in the Policy Framework. * * @author pameladragosh - * */ @Data public class ErrorResponse implements Serializable { + @Serial private static final long serialVersionUID = 6760066094588944729L; @SerializedName("code") - private Response.Status responseCode; + private Response.Status responseCode; @SerializedName("error") - private String errorMessage; + private String errorMessage; @SerializedName("details") - private List errorDetails; + private List errorDetails; @SerializedName("warnings") - private List warningDetails; + private List warningDetails; } diff --git a/models-errors/src/test/java/org/onap/policy/models/errors/concepts/ErrorResponseTest.java b/models-errors/src/test/java/org/onap/policy/models/errors/concepts/ErrorResponseTest.java index 1373cce47..0be37f489 100644 --- a/models-errors/src/test/java/org/onap/policy/models/errors/concepts/ErrorResponseTest.java +++ b/models-errors/src/test/java/org/onap/policy/models/errors/concepts/ErrorResponseTest.java @@ -3,6 +3,7 @@ * ONAP Policy Decision Models * ================================================================================ * Copyright (C) 2019 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. @@ -23,8 +24,8 @@ package org.onap.policy.models.errors.concepts; import static org.assertj.core.api.Assertions.assertThatCode; import static org.junit.Assert.assertEquals; -import java.util.Arrays; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.core.Response; +import java.util.List; import org.junit.Test; import org.onap.policy.common.utils.coder.StandardCoder; import org.slf4j.Logger; @@ -42,9 +43,9 @@ public class ErrorResponseTest { error.setResponseCode(Response.Status.NOT_ACCEPTABLE); error.setErrorMessage("Missing metadata section"); - error.setErrorDetails(Arrays.asList("You must have a metadata section with policy-id value")); + error.setErrorDetails(List.of("You must have a metadata section with policy-id value")); - error.setWarningDetails(Arrays.asList("Please make sure topology template field is included.")); + error.setWarningDetails(List.of("Please make sure topology template field is included.")); StandardCoder coder = new StandardCoder(); String jsonOutput = coder.encode(error); diff --git a/models-examples/pom.xml b/models-examples/pom.xml index 668530d66..ce400b9c5 100644 --- a/models-examples/pom.xml +++ b/models-examples/pom.xml @@ -18,13 +18,13 @@ ============LICENSE_END========================================================= --> + 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"> 4.0.0 org.onap.policy.models policy-models - 3.0.0-SNAPSHOT + 3.0.1-SNAPSHOT policy-models-examples @@ -33,7 +33,7 @@ Various examples of policy type and policy models in various formats - + true diff --git a/models-interactions/model-actors/actor.a1p/pom.xml b/models-interactions/model-actors/actor.a1p/pom.xml index 7b891c3de..60eb3e349 100644 --- a/models-interactions/model-actors/actor.a1p/pom.xml +++ b/models-interactions/model-actors/actor.a1p/pom.xml @@ -2,7 +2,7 @@ + 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"> 4.0.0 org.onap.policy.models.policy-models-interactions.model-actors model-actors - 3.0.0-SNAPSHOT + 3.0.1-SNAPSHOT actor.a1p @@ -61,11 +61,6 @@ gson test - - junit - junit - test - org.onap.policy.models.policy-models-interactions simulators @@ -84,10 +79,5 @@ ${project.version} test - - org.mockito - mockito-core - test - diff --git a/models-interactions/model-actors/actor.aai/pom.xml b/models-interactions/model-actors/actor.aai/pom.xml index f2f9ba8fa..3d395f7c1 100644 --- a/models-interactions/model-actors/actor.aai/pom.xml +++ b/models-interactions/model-actors/actor.aai/pom.xml @@ -2,7 +2,7 @@ + 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"> 4.0.0 org.onap.policy.models.policy-models-interactions.model-actors model-actors - 3.0.0-SNAPSHOT + 3.0.1-SNAPSHOT actor.aai @@ -57,11 +57,6 @@ ${policy.common.version} provided - - junit - junit - test - org.onap.policy.models.policy-models-interactions.model-actors actor.test @@ -74,10 +69,5 @@ ${project.version} test - - org.mockito - mockito-core - test - diff --git a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperation.java b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperation.java index ca3a55ced..0f9e2a1c4 100644 --- a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperation.java +++ b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperation.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2020-2021 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,15 +21,15 @@ package org.onap.policy.controlloop.actor.aai; +import jakarta.ws.rs.client.Entity; +import jakarta.ws.rs.client.Invocation.Builder; +import jakarta.ws.rs.client.WebTarget; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.concurrent.CompletableFuture; -import javax.ws.rs.client.Entity; -import javax.ws.rs.client.Invocation.Builder; -import javax.ws.rs.client.WebTarget; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; import org.onap.policy.aai.AaiCqResponse; import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType; diff --git a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetOperation.java b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetOperation.java index a07722383..275f71683 100644 --- a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetOperation.java +++ b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetOperation.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,11 +21,11 @@ package org.onap.policy.controlloop.actor.aai; +import jakarta.ws.rs.client.Invocation.Builder; +import jakarta.ws.rs.client.WebTarget; import java.util.List; import java.util.Map; import java.util.Map.Entry; -import javax.ws.rs.client.Invocation.Builder; -import javax.ws.rs.client.WebTarget; import org.onap.policy.common.utils.coder.StandardCoderObject; import org.onap.policy.controlloop.actorserviceprovider.OperationProperties; import org.onap.policy.controlloop.actorserviceprovider.impl.HttpOperation; diff --git a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperation.java b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperation.java index 839fe139c..519b1428f 100644 --- a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperation.java +++ b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperation.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2020-2021 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,12 +21,12 @@ package org.onap.policy.controlloop.actor.aai; +import jakarta.ws.rs.client.Invocation.Builder; +import jakarta.ws.rs.client.WebTarget; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; import java.util.Map; import java.util.concurrent.CompletableFuture; -import javax.ws.rs.client.Invocation.Builder; -import javax.ws.rs.client.WebTarget; import org.onap.policy.aai.AaiConstants; import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType; diff --git a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperation.java b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperation.java index 4f09dcb51..b51004f50 100644 --- a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperation.java +++ b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperation.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2020-2021 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,10 +21,10 @@ package org.onap.policy.controlloop.actor.aai; +import jakarta.ws.rs.client.Invocation.Builder; +import jakarta.ws.rs.client.WebTarget; import java.util.Map; import java.util.concurrent.CompletableFuture; -import javax.ws.rs.client.Invocation.Builder; -import javax.ws.rs.client.WebTarget; import org.onap.policy.aai.AaiConstants; import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType; diff --git a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiUtil.java b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiUtil.java index 1d0ccc366..3dbad9a24 100644 --- a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiUtil.java +++ b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiUtil.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2020-2021 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,9 +21,9 @@ package org.onap.policy.controlloop.actor.aai; +import jakarta.ws.rs.core.MediaType; import java.util.HashMap; import java.util.Map; -import javax.ws.rs.core.MediaType; import lombok.AccessLevel; import lombok.NoArgsConstructor; import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams; diff --git a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperationTest.java b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperationTest.java index dd6d0ec18..45db6b356 100644 --- a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperationTest.java +++ b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperationTest.java @@ -31,6 +31,7 @@ import static org.mockito.Mockito.lenient; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import jakarta.ws.rs.client.InvocationCallback; import java.util.Arrays; import java.util.List; import java.util.Map; @@ -38,7 +39,6 @@ import java.util.TreeMap; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; -import javax.ws.rs.client.InvocationCallback; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; diff --git a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetOperationTest.java b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetOperationTest.java index 9b283fea0..e76dfbdd4 100644 --- a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetOperationTest.java +++ b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetOperationTest.java @@ -29,9 +29,9 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import jakarta.ws.rs.client.Invocation.Builder; +import jakarta.ws.rs.client.WebTarget; import java.util.Map; -import javax.ws.rs.client.Invocation.Builder; -import javax.ws.rs.client.WebTarget; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; diff --git a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperationTest.java b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperationTest.java index ad5bd5e4a..c306e0031 100644 --- a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperationTest.java +++ b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperationTest.java @@ -29,10 +29,10 @@ import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; +import jakarta.ws.rs.client.InvocationCallback; import java.util.List; import java.util.Map; import java.util.concurrent.CompletableFuture; -import javax.ws.rs.client.InvocationCallback; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; diff --git a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperationTest.java b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperationTest.java index 765ed492a..13b8e0536 100644 --- a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperationTest.java +++ b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperationTest.java @@ -29,10 +29,10 @@ import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; +import jakarta.ws.rs.client.InvocationCallback; import java.util.List; import java.util.Map; import java.util.concurrent.CompletableFuture; -import javax.ws.rs.client.InvocationCallback; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; diff --git a/models-interactions/model-actors/actor.appc/pom.xml b/models-interactions/model-actors/actor.appc/pom.xml index cfefc61de..252a7d940 100644 --- a/models-interactions/model-actors/actor.appc/pom.xml +++ b/models-interactions/model-actors/actor.appc/pom.xml @@ -2,7 +2,7 @@ + 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"> 4.0.0 org.onap.policy.models.policy-models-interactions.model-actors model-actors - 3.0.0-SNAPSHOT + 3.0.1-SNAPSHOT actor.appc @@ -61,11 +61,6 @@ gson test - - junit - junit - test - org.onap.policy.models.policy-models-interactions simulators @@ -84,10 +79,5 @@ ${project.version} test - - org.mockito - mockito-core - test - diff --git a/models-interactions/model-actors/actor.appclcm/pom.xml b/models-interactions/model-actors/actor.appclcm/pom.xml index c55107956..bc6435704 100644 --- a/models-interactions/model-actors/actor.appclcm/pom.xml +++ b/models-interactions/model-actors/actor.appclcm/pom.xml @@ -2,7 +2,7 @@ - + 4.0.0 org.onap.policy.models.policy-models-interactions.model-actors model-actors - 3.0.0-SNAPSHOT + 3.0.1-SNAPSHOT actor.appclcm @@ -87,15 +88,5 @@ ${project.version} test - - junit - junit - test - - - org.mockito - mockito-core - test - diff --git a/models-interactions/model-actors/actor.cds/pom.xml b/models-interactions/model-actors/actor.cds/pom.xml index 11219c13a..70decae6f 100644 --- a/models-interactions/model-actors/actor.cds/pom.xml +++ b/models-interactions/model-actors/actor.cds/pom.xml @@ -2,6 +2,7 @@ ============LICENSE_START======================================================= Copyright (C) 2019 Bell Canada. All rights reserved. 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,12 +19,12 @@ --> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.onap.policy.models.policy-models-interactions.model-actors model-actors - 3.0.0-SNAPSHOT + 3.0.1-SNAPSHOT actor.cds @@ -75,10 +76,5 @@ ${project.version} test - - org.mockito - mockito-all - test - diff --git a/models-interactions/model-actors/actor.sdnc/pom.xml b/models-interactions/model-actors/actor.sdnc/pom.xml index 3f4ad21dd..d1698d410 100644 --- a/models-interactions/model-actors/actor.sdnc/pom.xml +++ b/models-interactions/model-actors/actor.sdnc/pom.xml @@ -2,7 +2,7 @@ + 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"> 4.0.0 org.onap.policy.models.policy-models-interactions.model-actors model-actors - 3.0.0-SNAPSHOT + 3.0.1-SNAPSHOT actor.sdnc @@ -63,11 +63,6 @@ ${policy.common.version} provided - - junit - junit - test - org.onap.policy.models.policy-models-interactions.model-actors actor.test @@ -80,10 +75,5 @@ ${project.version} test - - org.mockito - mockito-core - test - diff --git a/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/SdncOperation.java b/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/SdncOperation.java index f3d6f1daf..20e8cd160 100644 --- a/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/SdncOperation.java +++ b/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/SdncOperation.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2020-2021 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,12 +21,12 @@ package org.onap.policy.controlloop.actor.sdnc; +import jakarta.ws.rs.client.Entity; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; import java.util.List; import java.util.Map; import java.util.concurrent.CompletableFuture; -import javax.ws.rs.client.Entity; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; diff --git a/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BasicSdncOperation.java b/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BasicSdncOperation.java index f4b6141f8..a88bb0231 100644 --- a/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BasicSdncOperation.java +++ b/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BasicSdncOperation.java @@ -76,7 +76,8 @@ public abstract class BasicSdncOperation extends BasicHttpOperation { * Starts the simulator. */ protected static void initBeforeClass() throws Exception { - Util.buildSdncSim(); + var testServer = Util.buildSdncSim(); + assertNotNull(testServer); BusTopicParams clientParams = BusTopicParams.builder().clientName(MY_CLIENT).basePath("restconf/operations/") .hostname("localhost").managed(true).port(Util.SDNCSIM_SERVER_PORT).build(); diff --git a/models-interactions/model-actors/actor.sdnr/pom.xml b/models-interactions/model-actors/actor.sdnr/pom.xml index 3501a8732..7af7c2aaa 100644 --- a/models-interactions/model-actors/actor.sdnr/pom.xml +++ b/models-interactions/model-actors/actor.sdnr/pom.xml @@ -2,7 +2,7 @@ + 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"> 4.0.0 org.onap.policy.models.policy-models-interactions.model-actors model-actors - 3.0.0-SNAPSHOT + 3.0.1-SNAPSHOT actor.sdnr @@ -55,11 +55,6 @@ gson test - - junit - junit - test - org.onap.policy.models.policy-models-interactions simulators @@ -78,10 +73,5 @@ ${project.version} test - - org.mockito - mockito-core - test - diff --git a/models-interactions/model-actors/actor.so/pom.xml b/models-interactions/model-actors/actor.so/pom.xml index 41ae20c27..b6a954948 100644 --- a/models-interactions/model-actors/actor.so/pom.xml +++ b/models-interactions/model-actors/actor.so/pom.xml @@ -2,7 +2,7 @@ + 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"> 4.0.0 org.onap.policy.models.policy-models-interactions.model-actors model-actors - 3.0.0-SNAPSHOT + 3.0.1-SNAPSHOT actor.so @@ -67,11 +67,6 @@ ${policy.common.version} provided - - junit - junit - test - org.onap.policy.models.policy-models-interactions.model-actors actor.test @@ -84,10 +79,5 @@ ${project.version} test - - org.mockito - mockito-core - test - diff --git a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/ModifyCll.java b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/ModifyCll.java index 48e20e309..8b56dee73 100644 --- a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/ModifyCll.java +++ b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/ModifyCll.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2022 CTC, Inc. and others. 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,11 +21,11 @@ package org.onap.policy.controlloop.actor.so; +import jakarta.ws.rs.client.Entity; +import jakarta.ws.rs.core.MediaType; import java.util.List; import java.util.Map; import java.util.concurrent.CompletableFuture; -import javax.ws.rs.client.Entity; -import javax.ws.rs.core.MediaType; import org.onap.policy.common.endpoints.event.comm.Topic; import org.onap.policy.common.endpoints.utils.NetLoggerUtil; import org.onap.policy.common.utils.coder.CoderException; diff --git a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/ModifyNssi.java b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/ModifyNssi.java index 5386d96dd..ff315a9a4 100644 --- a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/ModifyNssi.java +++ b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/ModifyNssi.java @@ -4,6 +4,7 @@ * ================================================================================ * Copyright (C) 2020 Wipro Limited. * Modifications Copyright (C) 2021 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,11 +22,11 @@ package org.onap.policy.controlloop.actor.so; +import jakarta.ws.rs.client.Entity; +import jakarta.ws.rs.core.MediaType; import java.util.List; import java.util.Map; import java.util.concurrent.CompletableFuture; -import javax.ws.rs.client.Entity; -import javax.ws.rs.core.MediaType; import org.onap.policy.common.endpoints.event.comm.Topic; import org.onap.policy.common.endpoints.utils.NetLoggerUtil; import org.onap.policy.common.utils.coder.CoderException; diff --git a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/RestManagerResponse.java b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/RestManagerResponse.java index 12f526fbe..129305d99 100644 --- a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/RestManagerResponse.java +++ b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/RestManagerResponse.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2020-2021 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,20 +21,20 @@ package org.onap.policy.controlloop.actor.so; +import jakarta.ws.rs.core.EntityTag; +import jakarta.ws.rs.core.GenericType; +import jakarta.ws.rs.core.Link; +import jakarta.ws.rs.core.Link.Builder; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.MultivaluedMap; +import jakarta.ws.rs.core.NewCookie; +import jakarta.ws.rs.core.Response; import java.lang.annotation.Annotation; import java.net.URI; import java.util.Date; import java.util.Locale; import java.util.Map; import java.util.Set; -import javax.ws.rs.core.EntityTag; -import javax.ws.rs.core.GenericType; -import javax.ws.rs.core.Link; -import javax.ws.rs.core.Link.Builder; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.NewCookie; -import javax.ws.rs.core.Response; import lombok.AllArgsConstructor; import lombok.Getter; import org.onap.policy.common.utils.coder.Coder; diff --git a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoOperation.java b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoOperation.java index 824c4340e..d8404572a 100644 --- a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoOperation.java +++ b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoOperation.java @@ -4,6 +4,7 @@ * ================================================================================ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. * Modifications Copyright (C) 2020 Wipro Limited. + * 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. @@ -23,14 +24,14 @@ package org.onap.policy.controlloop.actor.so; import com.google.gson.Gson; import com.google.gson.GsonBuilder; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; import org.onap.aai.domain.yang.CloudRegion; import org.onap.aai.domain.yang.GenericVnf; import org.onap.aai.domain.yang.ModelVer; diff --git a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleCreate.java b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleCreate.java index 10c673705..a51be00ad 100644 --- a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleCreate.java +++ b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleCreate.java @@ -4,6 +4,7 @@ * ================================================================================ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. * Modifications Copyright (C) 2020 Wipro Limited. + * 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,12 +22,12 @@ package org.onap.policy.controlloop.actor.so; +import jakarta.ws.rs.client.Entity; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; import java.util.List; import java.util.Map; import java.util.concurrent.CompletableFuture; -import javax.ws.rs.client.Entity; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; import org.apache.commons.lang3.tuple.Pair; import org.onap.aai.domain.yang.ModelVer; import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; diff --git a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleDelete.java b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleDelete.java index 09584b487..8076fbcb9 100644 --- a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleDelete.java +++ b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleDelete.java @@ -4,6 +4,7 @@ * ================================================================================ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. * Modifications Copyright (C) 2020 Wipro Limited. + * 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,6 +22,9 @@ package org.onap.policy.controlloop.actor.so; +import jakarta.ws.rs.client.InvocationCallback; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; import java.net.URI; import java.net.http.HttpRequest; import java.net.http.HttpRequest.BodyPublishers; @@ -33,9 +37,6 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.concurrent.CompletableFuture; -import javax.ws.rs.client.InvocationCallback; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.Pair; import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; diff --git a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/RestManagerResponseTest.java b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/RestManagerResponseTest.java index a544a6234..2055adbc8 100644 --- a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/RestManagerResponseTest.java +++ b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/RestManagerResponseTest.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. @@ -26,7 +27,7 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; -import javax.ws.rs.core.GenericType; +import jakarta.ws.rs.core.GenericType; import org.junit.Before; import org.junit.Test; import org.onap.policy.common.utils.coder.Coder; diff --git a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleDeleteTest.java b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleDeleteTest.java index 8c35e236f..10f3f2bed 100644 --- a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleDeleteTest.java +++ b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleDeleteTest.java @@ -34,6 +34,9 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; +import jakarta.ws.rs.client.InvocationCallback; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; import java.net.http.HttpHeaders; import java.net.http.HttpRequest; import java.net.http.HttpRequest.Builder; @@ -46,9 +49,6 @@ import java.util.Map; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ForkJoinPool; import java.util.concurrent.TimeUnit; -import javax.ws.rs.client.InvocationCallback; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; import org.apache.commons.lang3.tuple.Pair; import org.junit.AfterClass; import org.junit.Before; diff --git a/models-interactions/model-actors/actor.test/pom.xml b/models-interactions/model-actors/actor.test/pom.xml index 168b6dcfa..ab0a168f0 100644 --- a/models-interactions/model-actors/actor.test/pom.xml +++ b/models-interactions/model-actors/actor.test/pom.xml @@ -19,14 +19,14 @@ --> + 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"> 4.0.0 org.onap.policy.models.policy-models-interactions.model-actors model-actors - 3.0.0-SNAPSHOT + 3.0.1-SNAPSHOT actor.test diff --git a/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicHttpOperation.java b/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicHttpOperation.java index 4bb75dc74..54b6d4f32 100644 --- a/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicHttpOperation.java +++ b/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicHttpOperation.java @@ -24,15 +24,15 @@ package org.onap.policy.controlloop.actor.test; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.lenient; +import jakarta.ws.rs.client.AsyncInvoker; +import jakarta.ws.rs.client.Entity; +import jakarta.ws.rs.client.Invocation.Builder; +import jakarta.ws.rs.client.InvocationCallback; +import jakarta.ws.rs.client.WebTarget; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; import java.util.Map; import java.util.concurrent.CompletableFuture; -import javax.ws.rs.client.AsyncInvoker; -import javax.ws.rs.client.Entity; -import javax.ws.rs.client.Invocation.Builder; -import javax.ws.rs.client.InvocationCallback; -import javax.ws.rs.client.WebTarget; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; import org.mockito.ArgumentCaptor; import org.mockito.Captor; import org.mockito.Mock; diff --git a/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicHttpOperationTest.java b/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicHttpOperationTest.java index c0351d12c..2f16c4226 100644 --- a/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicHttpOperationTest.java +++ b/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicHttpOperationTest.java @@ -27,8 +27,8 @@ import static org.junit.Assert.assertSame; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; -import javax.ws.rs.client.InvocationCallback; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.client.InvocationCallback; +import jakarta.ws.rs.core.Response; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/models-interactions/model-actors/actor.vfc/pom.xml b/models-interactions/model-actors/actor.vfc/pom.xml index fa7e62a85..7a8ffe9b4 100644 --- a/models-interactions/model-actors/actor.vfc/pom.xml +++ b/models-interactions/model-actors/actor.vfc/pom.xml @@ -2,7 +2,7 @@ + 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"> 4.0.0 org.onap.policy.models.policy-models-interactions.model-actors model-actors - 3.0.0-SNAPSHOT + 3.0.1-SNAPSHOT actor.vfc @@ -73,11 +73,6 @@ ${policy.common.version} provided - - junit - junit - test - org.onap.policy.models.policy-models-interactions.model-actors actor.test @@ -95,10 +90,5 @@ mockito-core compile - - org.assertj - assertj-core - test - diff --git a/models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/Restart.java b/models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/Restart.java index 784054886..76dd1dbf2 100644 --- a/models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/Restart.java +++ b/models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/Restart.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2020-2021 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,10 +21,10 @@ package org.onap.policy.controlloop.actor.vfc; +import jakarta.ws.rs.client.Entity; +import jakarta.ws.rs.core.MediaType; import java.util.Map; import java.util.concurrent.CompletableFuture; -import javax.ws.rs.client.Entity; -import javax.ws.rs.core.MediaType; import org.apache.commons.lang3.tuple.Pair; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams; diff --git a/models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcOperation.java b/models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcOperation.java index 3e64506bf..a1d496028 100644 --- a/models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcOperation.java +++ b/models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcOperation.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2020-2021 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,8 +21,8 @@ package org.onap.policy.controlloop.actor.vfc; +import jakarta.ws.rs.core.Response; import java.util.List; -import javax.ws.rs.core.Response; import org.apache.commons.lang3.StringUtils; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; import org.onap.policy.controlloop.actorserviceprovider.OperationProperties; @@ -131,7 +132,7 @@ public abstract class VfcOperation extends HttpOperation { /** * Treats everything as a success, so we always go into - * {@link #postProcessResponse(OperationOutcome, String, Response, SoResponse)}. + * {@link #postProcessResponse (OperationOutcome, String, Response, SoResponse)}. */ @Override protected boolean isSuccess(Response rawResponse, VfcResponse response) { diff --git a/models-interactions/model-actors/actor.xacml/pom.xml b/models-interactions/model-actors/actor.xacml/pom.xml index 2a8c24ae0..4d0f0a582 100644 --- a/models-interactions/model-actors/actor.xacml/pom.xml +++ b/models-interactions/model-actors/actor.xacml/pom.xml @@ -21,14 +21,14 @@ --> + 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"> 4.0.0 org.onap.policy.models.policy-models-interactions.model-actors model-actors - 3.0.0-SNAPSHOT + 3.0.1-SNAPSHOT actor.xacml @@ -58,11 +58,6 @@ ${policy.common.version} provided - - junit - junit - test - org.onap.policy.models.policy-models-interactions.model-actors actor.test diff --git a/models-interactions/model-actors/actor.xacml/src/main/java/org/onap/policy/controlloop/actor/xacml/ConfigureOperation.java b/models-interactions/model-actors/actor.xacml/src/main/java/org/onap/policy/controlloop/actor/xacml/ConfigureOperation.java index ed8e6778b..2d7bace1f 100644 --- a/models-interactions/model-actors/actor.xacml/src/main/java/org/onap/policy/controlloop/actor/xacml/ConfigureOperation.java +++ b/models-interactions/model-actors/actor.xacml/src/main/java/org/onap/policy/controlloop/actor/xacml/ConfigureOperation.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2021 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,10 +21,10 @@ package org.onap.policy.controlloop.actor.xacml; +import jakarta.ws.rs.core.Response; import java.util.Collections; import java.util.Map; import java.util.concurrent.CompletableFuture; -import javax.ws.rs.core.Response; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; import org.onap.policy.controlloop.actorserviceprovider.OperationResult; import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams; diff --git a/models-interactions/model-actors/actor.xacml/src/main/java/org/onap/policy/controlloop/actor/xacml/DecisionOperation.java b/models-interactions/model-actors/actor.xacml/src/main/java/org/onap/policy/controlloop/actor/xacml/DecisionOperation.java index 0792dc6ea..a490def86 100644 --- a/models-interactions/model-actors/actor.xacml/src/main/java/org/onap/policy/controlloop/actor/xacml/DecisionOperation.java +++ b/models-interactions/model-actors/actor.xacml/src/main/java/org/onap/policy/controlloop/actor/xacml/DecisionOperation.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2020-2021 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,11 +21,11 @@ package org.onap.policy.controlloop.actor.xacml; +import jakarta.ws.rs.client.Entity; +import jakarta.ws.rs.core.MediaType; import java.util.List; import java.util.Map; import java.util.concurrent.CompletableFuture; -import javax.ws.rs.client.Entity; -import javax.ws.rs.core.MediaType; import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType; import org.onap.policy.controlloop.actorserviceprovider.CallbackManager; diff --git a/models-interactions/model-actors/actor.xacml/src/main/java/org/onap/policy/controlloop/actor/xacml/GuardOperation.java b/models-interactions/model-actors/actor.xacml/src/main/java/org/onap/policy/controlloop/actor/xacml/GuardOperation.java index eddbd186c..4136c202c 100644 --- a/models-interactions/model-actors/actor.xacml/src/main/java/org/onap/policy/controlloop/actor/xacml/GuardOperation.java +++ b/models-interactions/model-actors/actor.xacml/src/main/java/org/onap/policy/controlloop/actor/xacml/GuardOperation.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2020-2021 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,10 +21,10 @@ package org.onap.policy.controlloop.actor.xacml; +import jakarta.ws.rs.core.Response; import java.util.Collections; import java.util.Map; import java.util.concurrent.CompletableFuture; -import javax.ws.rs.core.Response; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; import org.onap.policy.controlloop.actorserviceprovider.OperationResult; import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams; diff --git a/models-interactions/model-actors/actorServiceProvider/pom.xml b/models-interactions/model-actors/actorServiceProvider/pom.xml index 5caa14254..5cd286657 100644 --- a/models-interactions/model-actors/actorServiceProvider/pom.xml +++ b/models-interactions/model-actors/actorServiceProvider/pom.xml @@ -2,7 +2,7 @@ + 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"> 4.0.0 org.onap.policy.models.policy-models-interactions.model-actors model-actors - 3.0.0-SNAPSHOT + 3.0.1-SNAPSHOT actorServiceProvider @@ -55,10 +55,5 @@ mockito-core compile - - junit - junit - test - diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpActor.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpActor.java index 5a6081611..282125618 100644 --- a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpActor.java +++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpActor.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. @@ -27,7 +28,8 @@ import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpActorPara /** * Actor that uses HTTP, where the only additional property that an operator needs is a - * URL. The actor's operator parameters are expected to be an {@link HttpParams}. + * URL. The actor's operator parameters are expected to be an + * {@link org.onap.policy.controlloop.actorserviceprovider.parameters.HttpParams}. * * @param

type of parameters */ diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperation.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperation.java index 047e3d1c8..1e11bce4c 100644 --- a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperation.java +++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperation.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2020-2021 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,6 +21,8 @@ package org.onap.policy.controlloop.actorserviceprovider.impl; +import jakarta.ws.rs.client.InvocationCallback; +import jakarta.ws.rs.core.Response; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -27,8 +30,6 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.function.Function; -import javax.ws.rs.client.InvocationCallback; -import javax.ws.rs.core.Response; import lombok.Getter; import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; import org.onap.policy.common.endpoints.http.client.HttpClient; @@ -288,30 +289,27 @@ public abstract class HttpOperation extends OperationPartial { HttpPollingConfig cfg = (HttpPollingConfig) config; switch (detmStatus(rawResponse, response)) { - case SUCCESS: + case SUCCESS -> { logger.info("{}.{} request succeeded for {}", params.getActor(), params.getOperation(), - params.getRequestId()); + params.getRequestId()); return CompletableFuture - .completedFuture(setOutcome(outcome, OperationResult.SUCCESS, rawResponse, response)); - - case FAILURE: + .completedFuture(setOutcome(outcome, OperationResult.SUCCESS, rawResponse, response)); + } + case FAILURE -> { logger.info("{}.{} request failed for {}", params.getActor(), params.getOperation(), - params.getRequestId()); + params.getRequestId()); return CompletableFuture - .completedFuture(setOutcome(outcome, OperationResult.FAILURE, rawResponse, response)); - - case STILL_WAITING: - default: - logger.info("{}.{} request incomplete for {}", params.getActor(), params.getOperation(), - params.getRequestId()); - break; + .completedFuture(setOutcome(outcome, OperationResult.FAILURE, rawResponse, response)); + } + default -> logger.info("{}.{} request incomplete for {}", params.getActor(), params.getOperation(), + params.getRequestId()); } // still incomplete // see if the limit for the number of polls has been reached if (pollCount++ >= cfg.getMaxPolls()) { - logger.warn("{}: execeeded 'poll' limit {} for {}", getFullName(), cfg.getMaxPolls(), + logger.warn("{}: exceeded 'poll' limit {} for {}", getFullName(), cfg.getMaxPolls(), params.getRequestId()); setOutcome(outcome, OperationResult.FAILURE_TIMEOUT); return CompletableFuture.completedFuture(outcome); diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperationTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperationTest.java index 553fd1726..7a99a54ba 100644 --- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperationTest.java +++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperationTest.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2020-2021 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. @@ -32,6 +33,18 @@ import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; +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.Produces; +import jakarta.ws.rs.client.Entity; +import jakarta.ws.rs.client.InvocationCallback; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.Status; import java.util.Collections; import java.util.Map; import java.util.Properties; @@ -44,18 +57,6 @@ import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicReference; -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.Produces; -import javax.ws.rs.client.Entity; -import javax.ws.rs.client.InvocationCallback; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.Response.Status; import lombok.Getter; import lombok.Setter; import org.junit.AfterClass; diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpPollingOperationTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpPollingOperationTest.java index bd44663fd..2f7976ce5 100644 --- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpPollingOperationTest.java +++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpPollingOperationTest.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2020-2021 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. @@ -31,12 +32,12 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; +import jakarta.ws.rs.client.InvocationCallback; +import jakarta.ws.rs.core.Response; import java.util.Collections; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ForkJoinPool; import java.util.concurrent.TimeUnit; -import javax.ws.rs.client.InvocationCallback; -import javax.ws.rs.core.Response; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/models-interactions/model-actors/pom.xml b/models-interactions/model-actors/pom.xml index 3f26f79f5..84accb41b 100644 --- a/models-interactions/model-actors/pom.xml +++ b/models-interactions/model-actors/pom.xml @@ -17,41 +17,42 @@ ============LICENSE_END========================================================= --> - - 4.0.0 - pom + + 4.0.0 + pom - - org.onap.policy.models - policy-models-interactions - 3.0.0-SNAPSHOT - + + org.onap.policy.models + policy-models-interactions + 3.0.1-SNAPSHOT + - org.onap.policy.models.policy-models-interactions.model-actors - model-actors + org.onap.policy.models.policy-models-interactions.model-actors + model-actors - - ${project.basedir}/../../../target/code-coverage/jacoco-ut.exec - + + ${project.basedir}/../../../target/code-coverage/jacoco-ut.exec + - - actorServiceProvider - actor.test - actor.aai - actor.cds - actor.appc - actor.appclcm - actor.sdnc - actor.sdnr - actor.a1p - actor.so - actor.vfc - actor.xacml - - - - com.google.guava - guava - - + + actorServiceProvider + actor.test + actor.aai + actor.cds + actor.appc + actor.appclcm + actor.sdnc + actor.sdnr + actor.a1p + actor.so + actor.vfc + actor.xacml + + + + com.google.guava + guava + + diff --git a/models-interactions/model-impl/aai/pom.xml b/models-interactions/model-impl/aai/pom.xml index 63b019bd6..cc9619a69 100644 --- a/models-interactions/model-impl/aai/pom.xml +++ b/models-interactions/model-impl/aai/pom.xml @@ -3,7 +3,7 @@ aai ================================================================================ Copyright (C) 2017-2020 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. @@ -21,13 +21,13 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.onap.policy.models.policy-models-interactions.model-impl model-impl - 3.0.0-SNAPSHOT + 3.0.1-SNAPSHOT aai @@ -43,16 +43,6 @@ rest ${project.version} - - junit - junit - test - - - org.mockito - mockito-core - test - org.onap.policy.common policy-endpoints diff --git a/models-interactions/model-impl/appc/pom.xml b/models-interactions/model-impl/appc/pom.xml index aa6a64f09..3d3a171c4 100644 --- a/models-interactions/model-impl/appc/pom.xml +++ b/models-interactions/model-impl/appc/pom.xml @@ -3,14 +3,14 @@ appc ================================================================================ 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. 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. @@ -20,28 +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.1-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..81d3aad53 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.1-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..d70265426 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.1-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..b33f4d970 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.1-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..018cdf54c 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.1-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/pom.xml b/models-interactions/model-impl/pom.xml index e592682a6..bf5ca5e53 100644 --- a/models-interactions/model-impl/pom.xml +++ b/models-interactions/model-impl/pom.xml @@ -27,7 +27,7 @@ org.onap.policy.models policy-models-interactions - 3.0.0-SNAPSHOT + 3.0.1-SNAPSHOT org.onap.policy.models.policy-models-interactions.model-impl diff --git a/models-interactions/model-impl/rest/pom.xml b/models-interactions/model-impl/rest/pom.xml index 7a9a28fcd..e11cc5107 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.1-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.client5 + httpclient5 + 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..6759cffea 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 - + 3.0.1-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..5f2c78396 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 - + 3.0.1-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..5830219ee 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 - + 3.0.1-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..c0beea56e 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 + 3.0.1-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..768776088 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. @@ -20,14 +20,14 @@ --> + 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"> 4.0.0 org.onap.policy.models policy-models-interactions - 3.0.0-SNAPSHOT + 3.0.1-SNAPSHOT org.onap.policy.models.policy-models-interactions @@ -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..bbe1a3604 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. @@ -101,7 +101,7 @@ public final class Util { /** - * Build an SO simulator. + * Build a SO simulator. * * @return the simulator * @throws InterruptedException if a thread is interrupted @@ -174,7 +174,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..7f1b6ddea 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") @@ -63,7 +63,7 @@ public class VfcSimulatorJaxRs { /** * VFC get query. * - * @param jobId tthe job id + * @param jobId the job id * @return the response */ @GET @@ -74,9 +74,9 @@ public class VfcSimulatorJaxRs { return "{\"jobId\" : " + jobId + ",\"responseDescriptor\" : {\"progress\" : \"40\",\"status\" : \"finished\",\"statusDescription" + "\" : \"OMC VMs are decommissioned in VIM\",\"errorCode\" : null,\"responseId\": 101 ,\"" - + "responseHistoryList\": [{\"progress\" : \"40\",\"status\" : \"proccessing\",\"statusDescription" + + "responseHistoryList\": [{\"progress\" : \"40\",\"status\" : \"processing\",\"statusDescription" + "\" : \"OMC VMs are decommissioned in VIM\",\"errorCode\" : null,\"responseId\" : \"1\"}, {\"" - + "progress\" : \"41\",\"status\" : \"proccessing\",\"statusDescription\" : \"OMC VMs are " + + "progress\" : \"41\",\"status\" : \"processing\",\"statusDescription\" : \"OMC VMs are " + "decommissioned in VIM\",\"errorCode\" : null,\"responseId\" : \"2\"}]}}"; } 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/AaiSimulatorTest.java b/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/AaiSimulatorTest.java index d5d93e07f..a730d977d 100644 --- a/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/AaiSimulatorTest.java +++ b/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/AaiSimulatorTest.java @@ -42,7 +42,8 @@ public class AaiSimulatorTest { @BeforeClass public static void setUpSimulator() { try { - Util.buildAaiSim(); + var testServer = Util.buildAaiSim(); + assertNotNull(testServer); } catch (final Exception e) { fail(e.getMessage()); } 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"; diff --git a/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/SoSimulatorTest.java b/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/SoSimulatorTest.java index 31b76270c..129f2841b 100644 --- a/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/SoSimulatorTest.java +++ b/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/SoSimulatorTest.java @@ -57,7 +57,8 @@ public class SoSimulatorTest { @BeforeClass public static void setUpSimulator() { try { - Util.buildSoSim(); + var testServer = Util.buildSoSim(); + assertNotNull(testServer); } catch (final Exception e) { fail(e.getMessage()); } diff --git a/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/VfcSimulatorTest.java b/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/VfcSimulatorTest.java index dc48e75a1..a290f56f3 100644 --- a/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/VfcSimulatorTest.java +++ b/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/VfcSimulatorTest.java @@ -43,7 +43,8 @@ public class VfcSimulatorTest { @BeforeClass public static void setUpSimulator() { try { - Util.buildVfcSim(); + var testServer = Util.buildVfcSim(); + assertNotNull(testServer); } catch (final Exception e) { fail(e.getMessage()); } @@ -58,7 +59,7 @@ public class VfcSimulatorTest { public void testPost() { final Pair httpDetails = new RestManager().post("http://localhost:6668/api/nslcm/v1/ns/1234567890/heal", "username", "password", - new HashMap(), "application/json", "Some Request Here"); + new HashMap<>(), "application/json", "Some Request Here"); assertNotNull(httpDetails); assertEquals(202, httpDetails.getLeft().intValue()); final VfcResponse response = Serialization.gsonPretty.fromJson(httpDetails.getRight(), VfcResponse.class); @@ -68,7 +69,7 @@ public class VfcSimulatorTest { @Test public void testGet() { final Pair httpDetails = new RestManager().get("http://localhost:6668/api/nslcm/v1/jobs/1234", - "username", "password", new HashMap()); + "username", "password", new HashMap<>()); assertNotNull(httpDetails); final VfcResponse response = Serialization.gsonPretty.fromJson(httpDetails.getRight(), VfcResponse.class); assertNotNull(response); diff --git a/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/XacmlSimulatorTest.java b/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/XacmlSimulatorTest.java index e188edc77..417dcc9b3 100644 --- a/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/XacmlSimulatorTest.java +++ b/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/XacmlSimulatorTest.java @@ -48,7 +48,8 @@ public class XacmlSimulatorTest { @BeforeClass public static void setupSimulator() { try { - org.onap.policy.simulators.Util.buildXacmlSim(); + var testServer = Util.buildXacmlSim(); + assertNotNull(testServer); } catch (Exception e) { fail(e.getMessage()); } diff --git a/models-interactions/pom.xml b/models-interactions/pom.xml index a62eceb96..21fc14067 100644 --- a/models-interactions/pom.xml +++ b/models-interactions/pom.xml @@ -19,24 +19,25 @@ ============LICENSE_END========================================================= --> - - 4.0.0 - - org.onap.policy.models - policy-models - 3.0.0-SNAPSHOT - - policy-models-interactions - pom - ${project.artifactId} + + 4.0.0 + + org.onap.policy.models + policy-models + 3.0.1-SNAPSHOT + + policy-models-interactions + pom + ${project.artifactId} - - ${project.basedir}/../../target/code-coverage/jacoco-ut.exec - + + ${project.basedir}/../../target/code-coverage/jacoco-ut.exec + - - model-simulators - model-impl - model-actors - + + model-simulators + model-impl + model-actors + diff --git a/models-pap/pom.xml b/models-pap/pom.xml index eb3058585..8138377f9 100644 --- a/models-pap/pom.xml +++ b/models-pap/pom.xml @@ -1,6 +1,6 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.onap.policy.models policy-models - 3.0.0-SNAPSHOT + 3.0.1-SNAPSHOT policy-models-pap @@ -42,16 +42,11 @@ org.onap.policy.models policy-models-base ${project.version} - - - org.onap.policy.models - policy-models-dao - ${project.version} - org.assertj - assertj-core - test + org.onap.policy.models + policy-models-dao + ${project.version} com.h2database diff --git a/models-pap/src/main/java/org/onap/policy/models/pap/persistence/concepts/JpaPolicyAudit.java b/models-pap/src/main/java/org/onap/policy/models/pap/persistence/concepts/JpaPolicyAudit.java index 4b7fde43b..20af874cf 100644 --- a/models-pap/src/main/java/org/onap/policy/models/pap/persistence/concepts/JpaPolicyAudit.java +++ b/models-pap/src/main/java/org/onap/policy/models/pap/persistence/concepts/JpaPolicyAudit.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2021,2023 Nordix Foundation. + * Copyright (C) 2021, 2023 Nordix Foundation. * Modifications Copyright (C) 2021-2022 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,23 +21,24 @@ package org.onap.policy.models.pap.persistence.concepts; +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.Inheritance; +import jakarta.persistence.InheritanceType; +import jakarta.persistence.Table; +import jakarta.persistence.TableGenerator; +import jakarta.persistence.Temporal; +import jakarta.persistence.TemporalType; +import jakarta.validation.constraints.NotNull; +import java.io.Serial; import java.time.Instant; import java.util.ArrayList; import java.util.Date; import java.util.List; -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.Inheritance; -import javax.persistence.InheritanceType; -import javax.persistence.Table; -import javax.persistence.TableGenerator; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; -import javax.validation.constraints.NotNull; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NonNull; @@ -70,6 +71,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; @Data @EqualsAndHashCode(callSuper = false) public class JpaPolicyAudit extends PfConcept implements PfAuthorative { + @Serial private static final long serialVersionUID = -2935734300607322191L; @Id diff --git a/models-pdp/pom.xml b/models-pdp/pom.xml index 92b07be1f..cacbbc992 100644 --- a/models-pdp/pom.xml +++ b/models-pdp/pom.xml @@ -25,7 +25,7 @@ org.onap.policy.models policy-models - 3.0.0-SNAPSHOT + 3.0.1-SNAPSHOT policy-models-pdp diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpEngineWorkerStatistics.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpEngineWorkerStatistics.java index 06f603069..402ef15aa 100644 --- a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpEngineWorkerStatistics.java +++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpEngineWorkerStatistics.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019-2020 Nordix Foundation. + * 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. @@ -20,8 +20,9 @@ package org.onap.policy.models.pdp.concepts; +import jakarta.persistence.Embeddable; +import java.io.Serial; import java.io.Serializable; -import javax.persistence.Embeddable; import lombok.Data; import lombok.NoArgsConstructor; import lombok.NonNull; @@ -31,6 +32,7 @@ import org.onap.policy.models.pdp.enums.PdpEngineWorkerState; @Data @NoArgsConstructor public class PdpEngineWorkerStatistics implements Serializable { + @Serial private static final long serialVersionUID = 8262176849743624013L; private String engineId; diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdp.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdp.java index 7c584f3e6..fd594a99f 100644 --- a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdp.java +++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdp.java @@ -3,7 +3,7 @@ * ONAP Policy Model * ================================================================================ * Copyright (C) 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. @@ -23,17 +23,18 @@ package org.onap.policy.models.pdp.persistence.concepts; +import jakarta.persistence.Column; +import jakarta.persistence.EmbeddedId; +import jakarta.persistence.Entity; +import jakarta.persistence.Inheritance; +import jakarta.persistence.InheritanceType; +import jakarta.persistence.Table; +import jakarta.persistence.Temporal; +import jakarta.persistence.TemporalType; +import java.io.Serial; import java.io.Serializable; import java.util.Date; import java.util.List; -import javax.persistence.Column; -import javax.persistence.EmbeddedId; -import javax.persistence.Entity; -import javax.persistence.Inheritance; -import javax.persistence.InheritanceType; -import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NonNull; @@ -61,6 +62,7 @@ import org.onap.policy.models.pdp.enums.PdpState; @Data @EqualsAndHashCode(callSuper = false) public class JpaPdp extends PfConcept implements PfAuthorative, Serializable { + @Serial private static final long serialVersionUID = -357224425637789775L; @EmbeddedId diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroup.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroup.java index 07f9261bb..52f145659 100644 --- a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroup.java +++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroup.java @@ -3,7 +3,7 @@ * ONAP Policy Model * ================================================================================ * Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019,2021 Nordix Foundation. + * Modifications Copyright (C) 2019, 2021, 2023 Nordix Foundation. * Modifications Copyright (C) 2022 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -24,23 +24,24 @@ package org.onap.policy.models.pdp.persistence.concepts; +import jakarta.persistence.CascadeType; +import jakarta.persistence.CollectionTable; +import jakarta.persistence.Column; +import jakarta.persistence.ElementCollection; +import jakarta.persistence.EmbeddedId; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.Inheritance; +import jakarta.persistence.InheritanceType; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.OneToMany; +import jakarta.persistence.Table; +import java.io.Serial; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; -import javax.persistence.CascadeType; -import javax.persistence.CollectionTable; -import javax.persistence.Column; -import javax.persistence.ElementCollection; -import javax.persistence.EmbeddedId; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.Inheritance; -import javax.persistence.InheritanceType; -import javax.persistence.JoinColumn; -import javax.persistence.OneToMany; -import javax.persistence.Table; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NonNull; @@ -70,6 +71,7 @@ import org.onap.policy.models.pdp.enums.PdpState; @Data @EqualsAndHashCode(callSuper = false) public class JpaPdpGroup extends PfConcept implements PfAuthorative { + @Serial private static final long serialVersionUID = -357224425637789775L; @EmbeddedId diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpPolicyStatus.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpPolicyStatus.java index 88fb14a90..857e38a12 100644 --- a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpPolicyStatus.java +++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpPolicyStatus.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2021 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,14 +21,15 @@ package org.onap.policy.models.pdp.persistence.concepts; +import jakarta.persistence.Column; +import jakarta.persistence.EmbeddedId; +import jakarta.persistence.Entity; +import jakarta.persistence.Index; +import jakarta.persistence.Inheritance; +import jakarta.persistence.InheritanceType; +import jakarta.persistence.Table; +import java.io.Serial; import java.util.List; -import javax.persistence.Column; -import javax.persistence.EmbeddedId; -import javax.persistence.Entity; -import javax.persistence.Index; -import javax.persistence.Inheritance; -import javax.persistence.InheritanceType; -import javax.persistence.Table; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NonNull; @@ -57,6 +59,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; @Data @EqualsAndHashCode(callSuper = false) public class JpaPdpPolicyStatus extends PfConcept implements PfAuthorative { + @Serial private static final long serialVersionUID = -357224425637789775L; /** diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroup.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroup.java index 1d49a9b8b..0d963c853 100644 --- a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroup.java +++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroup.java @@ -3,7 +3,7 @@ * ONAP Policy Model * ================================================================================ * Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019-2021 Nordix Foundation. + * Modifications Copyright (C) 2019-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,23 +23,24 @@ package org.onap.policy.models.pdp.persistence.concepts; +import jakarta.persistence.CascadeType; +import jakarta.persistence.Column; +import jakarta.persistence.ElementCollection; +import jakarta.persistence.EmbeddedId; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.Inheritance; +import jakarta.persistence.InheritanceType; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.JoinTable; +import jakarta.persistence.OneToMany; +import jakarta.persistence.Table; +import java.io.Serial; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; -import javax.persistence.CascadeType; -import javax.persistence.Column; -import javax.persistence.ElementCollection; -import javax.persistence.EmbeddedId; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.Inheritance; -import javax.persistence.InheritanceType; -import javax.persistence.JoinColumn; -import javax.persistence.JoinTable; -import javax.persistence.OneToMany; -import javax.persistence.Table; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NonNull; @@ -72,6 +73,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; @Data @EqualsAndHashCode(callSuper = false) public class JpaPdpSubGroup extends PfConcept implements PfAuthorative { + @Serial private static final long serialVersionUID = -357224425637789775L; @EmbeddedId diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/provider/PdpProvider.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/provider/PdpProvider.java index 0cc0eb267..fe4632893 100644 --- a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/provider/PdpProvider.java +++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/provider/PdpProvider.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019, 2023 Nordix Foundation. * Modifications Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved. * Modifications Copyright (C) 2023 Bell Canada. All rights reserved. * ================================================================================ @@ -22,13 +22,13 @@ package org.onap.policy.models.pdp.persistence.provider; +import jakarta.ws.rs.core.Response; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.stream.Collectors; -import javax.ws.rs.core.Response; import lombok.NonNull; import org.onap.policy.common.parameters.BeanValidationResult; import org.onap.policy.models.base.PfConceptKey; @@ -63,9 +63,8 @@ public class PdpProvider { * @param dao the DAO to use to access the database * @param name the name of the PDP group to get, null to get all PDP groups * @return the PDP groups found - * @throws PfModelException on errors getting PDP groups */ - public List getPdpGroups(@NonNull final PfDao dao, final String name) throws PfModelException { + public List getPdpGroups(@NonNull final PfDao dao, final String name) { return asPdpGroupList(dao.getFiltered(JpaPdpGroup.class, name, PfKey.NULL_KEY_VERSION)); } @@ -76,7 +75,6 @@ public class PdpProvider { * @param dao the DAO to use to access the database * @param filter the filter for the PDP groups to get * @return the PDP groups found - * @throws PfModelException on errors getting policies */ public List getFilteredPdpGroups(@NonNull final PfDao dao, @NonNull final PdpGroupFilter filter) { @@ -90,10 +88,8 @@ public class PdpProvider { * @param dao the DAO to use to access the database * @param pdpGroups a specification of the PDP groups to create * @return the PDP groups created - * @throws PfModelException on errors creating PDP groups */ - public List createPdpGroups(@NonNull final PfDao dao, @NonNull final List pdpGroups) - throws PfModelException { + public List createPdpGroups(@NonNull final PfDao dao, @NonNull final List pdpGroups) { for (PdpGroup pdpGroup : pdpGroups) { var jpaPdpGroup = new JpaPdpGroup(); @@ -124,10 +120,8 @@ public class PdpProvider { * @param dao the DAO to use to access the database * @param pdpGroups a specification of the PDP groups to update * @return the PDP groups updated - * @throws PfModelException on errors updating PDP groups */ - public List updatePdpGroups(@NonNull final PfDao dao, @NonNull final List pdpGroups) - throws PfModelException { + public List updatePdpGroups(@NonNull final PfDao dao, @NonNull final List pdpGroups) { for (PdpGroup pdpGroup : pdpGroups) { var jpaPdpGroup = new JpaPdpGroup(); @@ -159,10 +153,9 @@ public class PdpProvider { * @param dao the DAO to use to access the database * @param pdpGroupName the name of the PDP group of the PDP subgroup * @param pdpSubGroup the PDP subgroup to be updated - * @throws PfModelException on errors updating PDP subgroups */ public void updatePdpSubGroup(@NonNull final PfDao dao, @NonNull final String pdpGroupName, - @NonNull final PdpSubGroup pdpSubGroup) throws PfModelException { + @NonNull final PdpSubGroup pdpSubGroup) { final var subGroupKey = new PfReferenceKey(pdpGroupName, PfKey.NULL_KEY_VERSION, pdpSubGroup.getPdpType()); @@ -184,7 +177,6 @@ public class PdpProvider { * @param pdpGroupName the name of the PDP group of the PDP subgroup * @param pdpSubGroup the PDP subgroup to be updated * @param pdp the PDP to be updated - * @throws PfModelException on errors updating PDP subgroups */ public void updatePdp(@NonNull final PfDao dao, @NonNull final String pdpGroupName, @NonNull final String pdpSubGroup, @NonNull final Pdp pdp) { @@ -208,7 +200,6 @@ public class PdpProvider { * @param dao the DAO to use to access the database * @param name the name of the policy to get, null to get all PDP groups * @return the PDP group deleted - * @throws PfModelException on errors deleting PDP groups */ public PdpGroup deletePdpGroup(@NonNull final PfDao dao, @NonNull final String name) { @@ -232,11 +223,8 @@ public class PdpProvider { * * @param dao the DAO to use to access the database * @return the deployments found - * @throws PfModelException on errors getting PDP groups */ - public List getAllPolicyStatus(@NonNull final PfDao dao) - throws PfModelException { - + public List getAllPolicyStatus(@NonNull final PfDao dao) { return dao.getAll(JpaPdpPolicyStatus.class).stream().map(JpaPdpPolicyStatus::toAuthorative) .collect(Collectors.toList()); } @@ -246,11 +234,9 @@ public class PdpProvider { * * @param dao the DAO to use to access the database * @return the deployments found - * @throws PfModelException on errors getting PDP groups */ public List getAllPolicyStatus(@NonNull final PfDao dao, - @NonNull ToscaConceptIdentifierOptVersion policy) throws PfModelException { - + @NonNull ToscaConceptIdentifierOptVersion policy) { if (policy.getVersion() != null) { return dao.getAll(JpaPdpPolicyStatus.class, new PfConceptKey(policy.getName(), policy.getVersion())) .stream().map(JpaPdpPolicyStatus::toAuthorative).collect(Collectors.toList()); @@ -268,11 +254,8 @@ public class PdpProvider { * @param groupName the name of the PDP group of interest, null to get results for all * PDP groups * @return the deployments found - * @throws PfModelException on errors getting PDP groups */ - public List getGroupPolicyStatus(@NonNull final PfDao dao, @NonNull final String groupName) - throws PfModelException { - + public List getGroupPolicyStatus(@NonNull final PfDao dao, @NonNull final String groupName) { PfFilterParameters params = PfFilterParameters.builder().filterMap(Map.of("pdpGroup", groupName)).build(); return dao.getFiltered(JpaPdpPolicyStatus.class, params) diff --git a/models-provider/pom.xml b/models-provider/pom.xml index bf62330b7..24d9e722e 100644 --- a/models-provider/pom.xml +++ b/models-provider/pom.xml @@ -1,6 +1,7 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.onap.policy.models policy-models - 3.0.0-SNAPSHOT + 3.0.1-SNAPSHOT policy-models-provider @@ -67,25 +68,11 @@ policy-models-pap ${project.version} - com.h2database h2 test - - - org.mockito - mockito-all - test - - - - org.assertj - assertj-core - test - - org.awaitility awaitility diff --git a/models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProviderFactory.java b/models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProviderFactory.java index 7cd36a526..f3ec6e566 100644 --- a/models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProviderFactory.java +++ b/models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProviderFactory.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019, 2023 Nordix Foundation. * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,7 +21,7 @@ package org.onap.policy.models.provider; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.core.Response; import lombok.NonNull; import org.onap.policy.models.base.PfModelException; import org.onap.policy.models.dao.impl.ProxyDao; diff --git a/models-provider/src/main/java/org/onap/policy/models/provider/impl/AbstractModelsProvider.java b/models-provider/src/main/java/org/onap/policy/models/provider/impl/AbstractModelsProvider.java index 7f6c4e5f8..19261853d 100644 --- a/models-provider/src/main/java/org/onap/policy/models/provider/impl/AbstractModelsProvider.java +++ b/models-provider/src/main/java/org/onap/policy/models/provider/impl/AbstractModelsProvider.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2021 Nordix Foundation. + * Copyright (C) 2021, 2023 Nordix Foundation. * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,8 +21,8 @@ package org.onap.policy.models.provider.impl; +import jakarta.ws.rs.core.Response; import java.io.Closeable; -import javax.ws.rs.core.Response; import lombok.Getter; import lombok.NonNull; import org.onap.policy.models.base.PfModelException; diff --git a/models-provider/src/main/java/org/onap/policy/models/provider/impl/AbstractPolicyModelsProvider.java b/models-provider/src/main/java/org/onap/policy/models/provider/impl/AbstractPolicyModelsProvider.java index 03c22363f..c7225b0fd 100644 --- a/models-provider/src/main/java/org/onap/policy/models/provider/impl/AbstractPolicyModelsProvider.java +++ b/models-provider/src/main/java/org/onap/policy/models/provider/impl/AbstractPolicyModelsProvider.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2021-2022 Nordix Foundation. + * Copyright (C) 2021-2023 Nordix Foundation. * Modifications Copyright (C) 2022 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,10 +21,10 @@ package org.onap.policy.models.provider.impl; +import jakarta.ws.rs.core.Response; import java.util.Collection; import java.util.List; import java.util.Map; -import javax.ws.rs.core.Response; import lombok.NonNull; import org.onap.policy.models.base.PfModelException; import org.onap.policy.models.base.PfModelRuntimeException; diff --git a/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java b/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java index ed47ae0a0..8f4cdbcb3 100644 --- a/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java +++ b/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019-2021 Nordix Foundation. + * Copyright (C) 2019-2021, 2023 Nordix Foundation. * Modifications Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved. * Modifications Copyright (C) 2020, 2022 Bell Canada. All rights reserved. * ================================================================================ @@ -22,7 +22,7 @@ package org.onap.policy.models.provider.impl; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.core.Response; import lombok.Getter; import lombok.NonNull; import org.onap.policy.models.base.PfModelException; diff --git a/models-provider/src/main/java/org/onap/policy/models/provider/impl/ModelsProvider.java b/models-provider/src/main/java/org/onap/policy/models/provider/impl/ModelsProvider.java index d90847f56..527f0ddee 100644 --- a/models-provider/src/main/java/org/onap/policy/models/provider/impl/ModelsProvider.java +++ b/models-provider/src/main/java/org/onap/policy/models/provider/impl/ModelsProvider.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2021,2023 Nordix Foundation. + * 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. @@ -20,8 +20,8 @@ package org.onap.policy.models.provider.impl; +import jakarta.ws.rs.core.Response; import java.util.Properties; -import javax.ws.rs.core.Response; import lombok.AccessLevel; import lombok.NoArgsConstructor; import org.onap.policy.models.base.PfModelException; @@ -47,10 +47,10 @@ public final class ModelsProvider { // @formatter:off var jdbcProperties = new Properties(); - jdbcProperties.setProperty("javax.persistence.jdbc.driver", parameters.getDatabaseDriver()); - jdbcProperties.setProperty("javax.persistence.jdbc.url", parameters.getDatabaseUrl()); - jdbcProperties.setProperty("javax.persistence.jdbc.user", parameters.getDatabaseUser()); - jdbcProperties.setProperty("javax.persistence.jdbc.password", parameters.getDatabasePassword()); + jdbcProperties.setProperty("jakarta.persistence.jdbc.driver", parameters.getDatabaseDriver()); + jdbcProperties.setProperty("jakarta.persistence.jdbc.url", parameters.getDatabaseUrl()); + jdbcProperties.setProperty("jakarta.persistence.jdbc.user", parameters.getDatabaseUser()); + jdbcProperties.setProperty("jakarta.persistence.jdbc.password", parameters.getDatabasePassword()); jdbcProperties.setProperty("hibernate.dialect", (parameters.getDatabaseType() == null ? "org.hibernate.dialect.MariaDBDialect" diff --git a/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyBadProviderImpl.java b/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyBadProviderImpl.java index 33deed725..a1339e4fd 100644 --- a/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyBadProviderImpl.java +++ b/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyBadProviderImpl.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019-2022 Nordix Foundation. + * Copyright (C) 2019-2023 Nordix Foundation. * Modifications Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved. * Modifications Copyright (C) 2020, 2022 Bell Canada. All rights reserved. * ================================================================================ @@ -22,11 +22,11 @@ package org.onap.policy.models.provider.impl; +import jakarta.ws.rs.core.Response; import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Map; -import javax.ws.rs.core.Response; import lombok.NonNull; import org.onap.policy.models.base.PfModelException; import org.onap.policy.models.base.PfModelRuntimeException; @@ -56,198 +56,182 @@ public class DummyBadProviderImpl implements PolicyModelsProvider { } @Override - public void close() throws PfModelException { + public void close() { // do nothing } @Override - public void init() throws PfModelException { + public void init() { // do nothing } @Override public List getFilteredServiceTemplateList( - @NonNull ToscaEntityFilter filter) throws PfModelException { + @NonNull ToscaEntityFilter filter) { return null; } @Override - public ToscaServiceTemplate createServiceTemplate(@NonNull ToscaServiceTemplate serviceTemplate) - throws PfModelException { + public ToscaServiceTemplate createServiceTemplate(@NonNull ToscaServiceTemplate serviceTemplate) { return null; } @Override - public ToscaServiceTemplate updateServiceTemplate(@NonNull ToscaServiceTemplate serviceTemplate) - throws PfModelException { + public ToscaServiceTemplate updateServiceTemplate(@NonNull ToscaServiceTemplate serviceTemplate) { return null; } @Override - public ToscaServiceTemplate deleteServiceTemplate(@NonNull String name, @NonNull String version) - throws PfModelException { + public ToscaServiceTemplate deleteServiceTemplate(@NonNull String name, @NonNull String version) { return null; } @Override - public ToscaServiceTemplate getPolicyTypes(final String name, final String version) throws PfModelException { + public ToscaServiceTemplate getPolicyTypes(final String name, final String version) { return null; } @Override - public ToscaServiceTemplate createPolicyTypes(@NonNull ToscaServiceTemplate serviceTemplate) - throws PfModelException { + public ToscaServiceTemplate createPolicyTypes(@NonNull ToscaServiceTemplate serviceTemplate) { return null; } @Override - public ToscaServiceTemplate updatePolicyTypes(@NonNull ToscaServiceTemplate serviceTemplate) - throws PfModelException { + public ToscaServiceTemplate updatePolicyTypes(@NonNull ToscaServiceTemplate serviceTemplate) { return null; } @Override - public ToscaServiceTemplate deletePolicyType(final String name, final String version) throws PfModelException { + public ToscaServiceTemplate deletePolicyType(final String name, final String version) { return null; } @Override - public ToscaServiceTemplate getPolicies(final String name, final String version) throws PfModelException { + public ToscaServiceTemplate getPolicies(final String name, final String version) { return null; } @Override - public ToscaServiceTemplate createPolicies(@NonNull ToscaServiceTemplate serviceTemplate) throws PfModelException { + public ToscaServiceTemplate createPolicies(@NonNull ToscaServiceTemplate serviceTemplate) { return null; } @Override - public ToscaServiceTemplate updatePolicies(@NonNull ToscaServiceTemplate serviceTemplate) throws PfModelException { + public ToscaServiceTemplate updatePolicies(@NonNull ToscaServiceTemplate serviceTemplate) { return null; } @Override - public ToscaServiceTemplate deletePolicy(final String name, final String version) throws PfModelException { + public ToscaServiceTemplate deletePolicy(final String name, final String version) { return null; } @Override - public ToscaServiceTemplate createToscaNodeTemplates(@NonNull ToscaServiceTemplate serviceTemplate) - throws PfModelException { + public ToscaServiceTemplate createToscaNodeTemplates(@NonNull ToscaServiceTemplate serviceTemplate) { return null; } @Override public ToscaServiceTemplate updateToscaNodeTemplates(@NonNull ToscaServiceTemplate serviceTemplate) - throws PfModelRuntimeException, PfModelException { + throws PfModelRuntimeException { return null; } @Override - public ToscaServiceTemplate deleteToscaNodeTemplate(@NonNull String name, @NonNull String version) - throws PfModelException { + public ToscaServiceTemplate deleteToscaNodeTemplate(@NonNull String name, @NonNull String version) { return null; } @Override public List>> getNodeTemplateMetadataSets(@NonNull String name, - @NonNull String version) - throws PfModelException { + @NonNull String version) { return null; } @Override - public List getToscaNodeTemplate(final String name, final String version) - throws PfModelException { + public List getToscaNodeTemplate(final String name, final String version) { return null; } @Override - public List getPdpGroups(String name) throws PfModelException { + public List getPdpGroups(String name) { return Collections.emptyList(); } @Override - public List createPdpGroups(@NonNull List pdpGroups) throws PfModelException { + public List createPdpGroups(@NonNull List pdpGroups) { return Collections.emptyList(); } @Override - public List updatePdpGroups(@NonNull List pdpGroups) throws PfModelException { + public List updatePdpGroups(@NonNull List pdpGroups) { return Collections.emptyList(); } @Override - public void updatePdp(@NonNull String pdpGroupName, @NonNull String pdpSubGroup, @NonNull Pdp pdp) - throws PfModelException { + public void updatePdp(@NonNull String pdpGroupName, @NonNull String pdpSubGroup, @NonNull Pdp pdp) { // do nothing } @Override - public PdpGroup deletePdpGroup(@NonNull String name) throws PfModelException { + public PdpGroup deletePdpGroup(@NonNull String name) { return null; } @Override - public List getPolicyTypeList(String name, String version) throws PfModelException { + public List getPolicyTypeList(String name, String version) { return Collections.emptyList(); } @Override - public ToscaServiceTemplate getFilteredPolicyTypes(@NonNull ToscaEntityFilter filter) - throws PfModelException { + public ToscaServiceTemplate getFilteredPolicyTypes(@NonNull ToscaEntityFilter filter) { return null; } @Override - public List getFilteredPolicyTypeList(@NonNull ToscaEntityFilter filter) - throws PfModelException { + public List getFilteredPolicyTypeList(@NonNull ToscaEntityFilter filter) { return Collections.emptyList(); } @Override - public List getPolicyList(String name, String version) throws PfModelException { + public List getPolicyList(String name, String version) { return Collections.emptyList(); } @Override - public ToscaServiceTemplate getFilteredPolicies(@NonNull ToscaTypedEntityFilter filter) - throws PfModelException { + public ToscaServiceTemplate getFilteredPolicies(@NonNull ToscaTypedEntityFilter filter) { return null; } @Override - public List getFilteredPolicyList(@NonNull ToscaTypedEntityFilter filter) - throws PfModelException { + public List getFilteredPolicyList(@NonNull ToscaTypedEntityFilter filter) { return Collections.emptyList(); } @Override - public List getFilteredPdpGroups(@NonNull PdpGroupFilter filter) throws PfModelException { + public List getFilteredPdpGroups(@NonNull PdpGroupFilter filter) { return Collections.emptyList(); } @Override - public void updatePdpSubGroup(@NonNull String pdpGroupName, @NonNull PdpSubGroup pdpSubGroup) - throws PfModelException { + public void updatePdpSubGroup(@NonNull String pdpGroupName, @NonNull PdpSubGroup pdpSubGroup) { // do nothing } @Override - public List getAllPolicyStatus() throws PfModelException { + public List getAllPolicyStatus() { // Not implemented return null; } @Override - public List getAllPolicyStatus(@NonNull ToscaConceptIdentifierOptVersion policy) - throws PfModelException { + public List getAllPolicyStatus(@NonNull ToscaConceptIdentifierOptVersion policy) { // Not implemented return null; } @Override - public List getGroupPolicyStatus(@NonNull String groupName) throws PfModelException { + public List getGroupPolicyStatus(@NonNull String groupName) { // Not implemented return null; } @@ -259,7 +243,7 @@ public class DummyBadProviderImpl implements PolicyModelsProvider { } @Override - public List getServiceTemplateList(String name, String version) throws PfModelException { + public List getServiceTemplateList(String name, String version) { // Not implemented return null; } diff --git a/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java b/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java index 9a3d4f590..0808a40b7 100644 --- a/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java +++ b/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019-2022 Nordix Foundation. + * Copyright (C) 2019-2023 Nordix Foundation. * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved. * Modifications Copyright (C) 2020, 2022 Bell Canada. All rights reserved. * ================================================================================ @@ -22,11 +22,11 @@ package org.onap.policy.models.provider.impl; +import jakarta.ws.rs.core.Response; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map; -import javax.ws.rs.core.Response; import lombok.NonNull; import org.onap.policy.common.utils.coder.StandardCoder; import org.onap.policy.common.utils.resources.ResourceUtils; @@ -65,7 +65,7 @@ public class DummyPolicyModelsProviderImpl implements PolicyModelsProvider { } @Override - public void init() throws PfModelException { + public void init() { // Not required on the dummy provider } @@ -76,13 +76,13 @@ public class DummyPolicyModelsProviderImpl implements PolicyModelsProvider { @Override - public List getServiceTemplateList(String name, String version) throws PfModelException { + public List getServiceTemplateList(String name, String version) { return new ArrayList<>(); } @Override public List getFilteredServiceTemplateList( - @NonNull ToscaEntityFilter filter) throws PfModelException { + @NonNull ToscaEntityFilter filter) { return new ArrayList<>(); } @@ -105,18 +105,17 @@ public class DummyPolicyModelsProviderImpl implements PolicyModelsProvider { } @Override - public ToscaServiceTemplate getPolicyTypes(final String name, final String version) throws PfModelException { + public ToscaServiceTemplate getPolicyTypes(final String name, final String version) { return getDummyResponse("dummyimpl/DummyToscaPolicyTypeGetResponse.json"); } @Override - public List getPolicyTypeList(final String name, final String version) throws PfModelException { + public List getPolicyTypeList(final String name, final String version) { return new ArrayList<>(); } @Override - public ToscaServiceTemplate getFilteredPolicyTypes(ToscaEntityFilter filter) - throws PfModelException { + public ToscaServiceTemplate getFilteredPolicyTypes(ToscaEntityFilter filter) { return getDummyResponse("dummyimpl/DummyToscaPolicyTypeGetResponse.json"); } @@ -126,137 +125,131 @@ public class DummyPolicyModelsProviderImpl implements PolicyModelsProvider { } @Override - public ToscaServiceTemplate createPolicyTypes(final ToscaServiceTemplate serviceTemplate) throws PfModelException { + public ToscaServiceTemplate createPolicyTypes(final ToscaServiceTemplate serviceTemplate) { return serviceTemplate; } @Override - public ToscaServiceTemplate updatePolicyTypes(final ToscaServiceTemplate serviceTemplate) throws PfModelException { + public ToscaServiceTemplate updatePolicyTypes(final ToscaServiceTemplate serviceTemplate) { return serviceTemplate; } @Override - public ToscaServiceTemplate deletePolicyType(final String name, final String version) throws PfModelException { + public ToscaServiceTemplate deletePolicyType(final String name, final String version) { return getDummyResponse("dummyimpl/DummyToscaPolicyTypeDeleteResponse.json"); } @Override - public ToscaServiceTemplate getPolicies(final String name, final String version) throws PfModelException { + public ToscaServiceTemplate getPolicies(final String name, final String version) { return getDummyResponse("dummyimpl/DummyToscaPolicyGetResponse.json"); } @Override - public List getPolicyList(final String name, final String version) throws PfModelException { + public List getPolicyList(final String name, final String version) { return new ArrayList<>(); } @Override - public ToscaServiceTemplate getFilteredPolicies(ToscaTypedEntityFilter filter) - throws PfModelException { + public ToscaServiceTemplate getFilteredPolicies(ToscaTypedEntityFilter filter) { return getDummyResponse("dummyimpl/DummyToscaPolicyGetResponse.json"); } @Override - public List getFilteredPolicyList(ToscaTypedEntityFilter filter) throws PfModelException { + public List getFilteredPolicyList(ToscaTypedEntityFilter filter) { return new ArrayList<>(); } @Override - public ToscaServiceTemplate createPolicies(final ToscaServiceTemplate serviceTemplate) throws PfModelException { + public ToscaServiceTemplate createPolicies(final ToscaServiceTemplate serviceTemplate) { return serviceTemplate; } @Override - public ToscaServiceTemplate updatePolicies(final ToscaServiceTemplate serviceTemplate) throws PfModelException { + public ToscaServiceTemplate updatePolicies(final ToscaServiceTemplate serviceTemplate) { return serviceTemplate; } @Override - public ToscaServiceTemplate deletePolicy(final String name, final String version) throws PfModelException { + public ToscaServiceTemplate deletePolicy(final String name, final String version) { return getDummyResponse("dummyimpl/DummyToscaPolicyDeleteResponse.json"); } @Override - public ToscaServiceTemplate createToscaNodeTemplates(@NonNull ToscaServiceTemplate serviceTemplate) - throws PfModelException { + public ToscaServiceTemplate createToscaNodeTemplates(@NonNull ToscaServiceTemplate serviceTemplate) { return getDummyNodeTemplateResponse("dummyimpl/DummyToscaNodeTemplateResponse.json"); } @Override public ToscaServiceTemplate updateToscaNodeTemplates(@NonNull ToscaServiceTemplate serviceTemplate) - throws PfModelRuntimeException, PfModelException { + throws PfModelRuntimeException { return getDummyNodeTemplateResponse("dummyimpl/DummyToscaNodeTemplateResponse.json"); } @Override - public ToscaServiceTemplate deleteToscaNodeTemplate(@NonNull String name, @NonNull String version) - throws PfModelException { + public ToscaServiceTemplate deleteToscaNodeTemplate(@NonNull String name, @NonNull String version) { return getDummyNodeTemplateResponse("dummyimpl/DummyToscaNodeTemplateResponse.json"); } @Override public List>> getNodeTemplateMetadataSets(@NonNull String name, - @NonNull String version) - throws PfModelException { + @NonNull String version) { return new ArrayList<>(); } @Override - public List getToscaNodeTemplate(final String name, final String version) - throws PfModelException { + public List getToscaNodeTemplate(final String name, final String version) { return new ArrayList<>(); } @Override - public List getPdpGroups(final String name) throws PfModelException { + public List getPdpGroups(final String name) { return new ArrayList<>(); } @Override - public List getFilteredPdpGroups(PdpGroupFilter filter) throws PfModelException { + public List getFilteredPdpGroups(PdpGroupFilter filter) { return new ArrayList<>(); } @Override - public List createPdpGroups(final List pdpGroups) throws PfModelException { + public List createPdpGroups(final List pdpGroups) { return new ArrayList<>(); } @Override - public List updatePdpGroups(final List pdpGroups) throws PfModelException { + public List updatePdpGroups(final List pdpGroups) { return new ArrayList<>(); } @Override - public void updatePdpSubGroup(final String pdpGroupName, final PdpSubGroup pdpSubGroup) throws PfModelException { + public void updatePdpSubGroup(final String pdpGroupName, final PdpSubGroup pdpSubGroup) { // Not implemented } @Override - public void updatePdp(String pdpGroupName, String pdpSubGroup, Pdp pdp) throws PfModelException { + public void updatePdp(String pdpGroupName, String pdpSubGroup, Pdp pdp) { // Not implemented } @Override - public PdpGroup deletePdpGroup(final String name) throws PfModelException { + public PdpGroup deletePdpGroup(final String name) { return null; } @Override - public List getAllPolicyStatus() throws PfModelException { + public List getAllPolicyStatus() { // Not implemented return new ArrayList<>(); } @Override - public List getAllPolicyStatus(@NonNull ToscaConceptIdentifierOptVersion policy) - throws PfModelException { + public List getAllPolicyStatus(@NonNull ToscaConceptIdentifierOptVersion policy) { // Not implemented return new ArrayList<>(); } @Override - public List getGroupPolicyStatus(String groupName) throws PfModelException { + public List getGroupPolicyStatus(String groupName) { // Not implemented return new ArrayList<>(); } diff --git a/models-sim/models-sim-dmaap/pom.xml b/models-sim/models-sim-dmaap/pom.xml index 3ee3b32d0..2cfeadd3d 100644 --- a/models-sim/models-sim-dmaap/pom.xml +++ b/models-sim/models-sim-dmaap/pom.xml @@ -1,6 +1,6 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.onap.policy.models.sim models-sim-packages - 3.0.0-SNAPSHOT + 3.0.1-SNAPSHOT models-simulator-docker @@ -46,7 +46,7 @@ nexus3.onap.org:10003 ${project.basedir}/src/main/docker yyyyMMdd'T'HHmm - + true @@ -101,7 +101,8 @@ - org.onap.policy.models.sim:models-simulator-tarball + org.onap.policy.models.sim:models-simulator-tarball + /lib models-simulator.tar.gz diff --git a/models-sim/packages/models-simulator-docker/src/main/docker/Dockerfile b/models-sim/packages/models-simulator-docker/src/main/docker/Dockerfile index 724bfb346..b4d159f84 100644 --- a/models-sim/packages/models-simulator-docker/src/main/docker/Dockerfile +++ b/models-sim/packages/models-simulator-docker/src/main/docker/Dockerfile @@ -26,7 +26,7 @@ RUN mkdir /packages /extracted COPY /maven/lib/models-simulator.tar.gz /packages/ RUN tar xvzf /packages/models-simulator.tar.gz --directory /extracted/ -FROM onap/policy-jre-alpine:3.0.0-SNAPSHOT +FROM onap/policy-jre-alpine:3.0.1-SNAPSHOT LABEL maintainer="Policy Team" LABEL org.opencontainers.image.title="Policy Models Simulator" diff --git a/models-sim/packages/models-simulator-tarball/pom.xml b/models-sim/packages/models-simulator-tarball/pom.xml index c38978ec1..d2a73ed62 100644 --- a/models-sim/packages/models-simulator-tarball/pom.xml +++ b/models-sim/packages/models-simulator-tarball/pom.xml @@ -22,73 +22,73 @@ --> - 4.0.0 - - org.onap.policy.models.sim - models-sim-packages - 3.0.0-SNAPSHOT - + 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"> + 4.0.0 + + org.onap.policy.models.sim + models-sim-packages + 3.0.1-SNAPSHOT + - models-simulator-tarball + models-simulator-tarball - ${project.artifactId} - A module that runs all "simulators", including DMaaP. + ${project.artifactId} + A module that runs all "simulators", including DMaaP. - - - true - + + + true + - - - org.onap.policy.models.sim - policy-models-simulators - ${project.version} - - + + + org.onap.policy.models.sim + policy-models-simulators + ${project.version} + + - - - - - src/main/resources - true - - **/version.txt - - - - src/main/resources - false - - **/version.txt - - - + + + + + src/main/resources + true + + **/version.txt + + + + src/main/resources + false + + **/version.txt + + + - - - org.apache.maven.plugins - maven-assembly-plugin - - - generate-complete-tar - package - - single - - - - src/main/assembly.xml - - ${project.artifactId}-${project.version} - - - - - + + + org.apache.maven.plugins + maven-assembly-plugin + + + generate-complete-tar + package + + single + + + + src/main/assembly.xml + + ${project.artifactId}-${project.version} + + + + + - + diff --git a/models-sim/packages/pom.xml b/models-sim/packages/pom.xml index c0ffeada6..9b3e5c36f 100644 --- a/models-sim/packages/pom.xml +++ b/models-sim/packages/pom.xml @@ -20,12 +20,12 @@ --> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.onap.policy.models.sim policy-models-sim - 3.0.0-SNAPSHOT + 3.0.1-SNAPSHOT models-sim-packages @@ -35,7 +35,7 @@ The module for packaging the policy-models-simulator component. - + true diff --git a/models-sim/policy-models-sim-pdp/pom.xml b/models-sim/policy-models-sim-pdp/pom.xml index cf89b12eb..326a76a30 100644 --- a/models-sim/policy-models-sim-pdp/pom.xml +++ b/models-sim/policy-models-sim-pdp/pom.xml @@ -1,17 +1,38 @@ - - - 4.0.0 - - org.onap.policy.models.sim - policy-models-sim - 3.0.0-SNAPSHOT - - policy-models-sim-pdp - policy-models-sim-pdp + + + + 4.0.0 + + org.onap.policy.models.sim + policy-models-sim + 3.0.1-SNAPSHOT + + policy-models-sim-pdp + policy-models-sim-pdp + + A module that implements a simulator for PDP. + org.onap.policy.models policy-models-pdp @@ -37,23 +58,6 @@ common-parameters ${policy.common.version} - - - - org.assertj - assertj-core - test - - - org.mockito - mockito-core - test - - - junit - junit - test - diff --git a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/PdpSimulatorActivator.java b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/PdpSimulatorActivator.java index 1bc2ff72d..31d5b4120 100644 --- a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/PdpSimulatorActivator.java +++ b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/PdpSimulatorActivator.java @@ -52,8 +52,8 @@ public class PdpSimulatorActivator { private static final Logger LOGGER = LoggerFactory.getLogger(PdpSimulatorActivator.class); private final PdpSimulatorParameterGroup pdpSimulatorParameterGroup; - private List topicSinks; // topics to which pdp sends pdp status - private List topicSources; // topics to which pdp listens to for messages from pap. + private final List topicSinks; // topics to which pdp sends pdp status + private final List topicSources; // topics to which pdp listens to for messages from pap. private static final String[] MSG_TYPE_NAMES = { "messageName" }; /* @@ -70,7 +70,7 @@ public class PdpSimulatorActivator { /** * Used to manage the services. */ - private ServiceManager manager; + private final ServiceManager manager; @Getter diff --git a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/PdpSimulatorMain.java b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/PdpSimulatorMain.java index 1441ba37f..88d1b2686 100644 --- a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/PdpSimulatorMain.java +++ b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/PdpSimulatorMain.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019-2021 Nordix Foundation. + * Copyright (C) 2019-2021, 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"); @@ -132,7 +132,7 @@ public class PdpSimulatorMain { activator.terminate(); } } catch (final PdpSimulatorException e) { - LOGGER.warn("error occured during shut down of the pdp simulator service", e); + LOGGER.warn("error occurred during shut down of the pdp simulator service", e); } } } diff --git a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/comm/PdpStatusPublisher.java b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/comm/PdpStatusPublisher.java index 6be59b100..69b25dddd 100644 --- a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/comm/PdpStatusPublisher.java +++ b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/comm/PdpStatusPublisher.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019, 2023 Nordix Foundation. * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -41,10 +41,10 @@ public class PdpStatusPublisher extends TimerTask { private static final Logger LOGGER = LoggerFactory.getLogger(PdpStatusPublisher.class); - private TopicSinkClient topicSinkClient; - private Timer timer; + private final TopicSinkClient topicSinkClient; + private final Timer timer; @Getter - private long interval; + private final long interval; /** * Constructor for instantiating PdpStatusPublisher. diff --git a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/handler/PdpMessageHandler.java b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/handler/PdpMessageHandler.java index ae028dd32..ad1a32d7b 100644 --- a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/handler/PdpMessageHandler.java +++ b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/handler/PdpMessageHandler.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019-2021 Nordix Foundation. + * Copyright (C) 2019-2021, 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"); @@ -101,8 +101,8 @@ public class PdpMessageHandler { * * @return PdpResponseDetails */ - public PdpResponseDetails createPdpResonseDetails(final String requestId, final PdpResponseStatus status, - final String responseMessage) { + public PdpResponseDetails createPdpResponseDetails(final String requestId, final PdpResponseStatus status, + final String responseMessage) { final var pdpResponseDetails = new PdpResponseDetails(); pdpResponseDetails.setResponseTo(requestId); pdpResponseDetails.setResponseStatus(status); diff --git a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/handler/PdpStateChangeMessageHandler.java b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/handler/PdpStateChangeMessageHandler.java index 4f9804f7e..23df912e2 100644 --- a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/handler/PdpStateChangeMessageHandler.java +++ b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/handler/PdpStateChangeMessageHandler.java @@ -81,16 +81,16 @@ public class PdpStateChangeMessageHandler { final PdpStatus pdpStatusContext, final PdpMessageHandler pdpMessageHandler) { PdpResponseDetails pdpResponseDetails = null; if (pdpStatusContext.getState().equals(PdpState.ACTIVE)) { - pdpResponseDetails = pdpMessageHandler.createPdpResonseDetails(pdpStateChangeMsg.getRequestId(), + pdpResponseDetails = pdpMessageHandler.createPdpResponseDetails(pdpStateChangeMsg.getRequestId(), PdpResponseStatus.SUCCESS, "Pdp already in active state"); } else { final List policies = Registry.get(PdpSimulatorConstants.REG_PDP_TOSCA_POLICY_LIST); if (policies.isEmpty()) { pdpStatusContext.setState(PdpState.ACTIVE); - pdpResponseDetails = pdpMessageHandler.createPdpResonseDetails(pdpStateChangeMsg.getRequestId(), + pdpResponseDetails = pdpMessageHandler.createPdpResponseDetails(pdpStateChangeMsg.getRequestId(), PdpResponseStatus.SUCCESS, "State changed to active. No policies found."); } else { - pdpResponseDetails = pdpMessageHandler.createPdpResonseDetails(pdpStateChangeMsg.getRequestId(), + pdpResponseDetails = pdpMessageHandler.createPdpResponseDetails(pdpStateChangeMsg.getRequestId(), PdpResponseStatus.SUCCESS, "Pdp started. State changed to active."); pdpStatusContext.setState(PdpState.ACTIVE); } @@ -110,10 +110,10 @@ public class PdpStateChangeMessageHandler { final PdpStatus pdpStatusContext, final PdpMessageHandler pdpMessageHandler) { PdpResponseDetails pdpResponseDetails = null; if (pdpStatusContext.getState().equals(PdpState.PASSIVE)) { - pdpResponseDetails = pdpMessageHandler.createPdpResonseDetails(pdpStateChangeMsg.getRequestId(), + pdpResponseDetails = pdpMessageHandler.createPdpResponseDetails(pdpStateChangeMsg.getRequestId(), PdpResponseStatus.SUCCESS, "Pdp already in passive state"); } else { - pdpResponseDetails = pdpMessageHandler.createPdpResonseDetails(pdpStateChangeMsg.getRequestId(), + pdpResponseDetails = pdpMessageHandler.createPdpResponseDetails(pdpStateChangeMsg.getRequestId(), PdpResponseStatus.SUCCESS, "Pdp state changed from Active to Passive."); pdpStatusContext.setState(PdpState.PASSIVE); } diff --git a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/handler/PdpUpdateMessageHandler.java b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/handler/PdpUpdateMessageHandler.java index a90f74fba..60f7c1461 100644 --- a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/handler/PdpUpdateMessageHandler.java +++ b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/handler/PdpUpdateMessageHandler.java @@ -56,7 +56,7 @@ public class PdpUpdateMessageHandler { final var pdpStatusPublisher = Registry.get(PdpSimulatorConstants.REG_PDP_STATUS_PUBLISHER, PdpStatusPublisher.class); if (checkIfAlreadyHandled(pdpUpdateMsg, pdpStatusContext)) { - pdpResponseDetails = pdpMessageHandler.createPdpResonseDetails(pdpUpdateMsg.getRequestId(), + pdpResponseDetails = pdpMessageHandler.createPdpResponseDetails(pdpUpdateMsg.getRequestId(), PdpResponseStatus.SUCCESS, "Pdp already updated"); } else { if (null != pdpUpdateMsg.getPdpHeartbeatIntervalMs() && pdpUpdateMsg.getPdpHeartbeatIntervalMs() > 0 @@ -74,12 +74,12 @@ public class PdpUpdateMessageHandler { .collect(Collectors.toList())); if (pdpStatusContext.getState().equals(PdpState.ACTIVE) && !pdpUpdateMsg.getPoliciesToBeDeployed().isEmpty()) { - pdpResponseDetails = pdpMessageHandler.createPdpResonseDetails(pdpUpdateMsg.getRequestId(), + pdpResponseDetails = pdpMessageHandler.createPdpResponseDetails(pdpUpdateMsg.getRequestId(), PdpResponseStatus.SUCCESS, "Pdp engine started and policies are running."); } Registry.registerOrReplace(PdpSimulatorConstants.REG_PDP_TOSCA_POLICY_LIST, policies); if (null == pdpResponseDetails) { - pdpResponseDetails = pdpMessageHandler.createPdpResonseDetails(pdpUpdateMsg.getRequestId(), + pdpResponseDetails = pdpMessageHandler.createPdpResponseDetails(pdpUpdateMsg.getRequestId(), PdpResponseStatus.SUCCESS, "Pdp update successful."); } } diff --git a/models-sim/policy-models-sim-pdp/src/main/package/docker/Dockerfile b/models-sim/policy-models-sim-pdp/src/main/package/docker/Dockerfile index d1a68ae30..d13fe8e35 100644 --- a/models-sim/policy-models-sim-pdp/src/main/package/docker/Dockerfile +++ b/models-sim/policy-models-sim-pdp/src/main/package/docker/Dockerfile @@ -23,7 +23,7 @@ # Docker file to build an image that runs the PDP simulator on Java 8 in alpine # -FROM onap/policy-jre-alpine:3.0.0-SNAPSHOT +FROM onap/policy-jre-alpine:3.0.1-SNAPSHOT LABEL maintainer="Policy Team" diff --git a/models-sim/policy-models-simulators/pom.xml b/models-sim/policy-models-simulators/pom.xml index a3895eeb0..d8b873979 100644 --- a/models-sim/policy-models-simulators/pom.xml +++ b/models-sim/policy-models-simulators/pom.xml @@ -22,13 +22,13 @@ --> + 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"> 4.0.0 org.onap.policy.models.sim policy-models-sim - 3.0.0-SNAPSHOT + 3.0.1-SNAPSHOT policy-models-simulators @@ -42,15 +42,5 @@ simulators ${project.version} - - junit - junit - test - - - org.mockito - mockito-core - test - diff --git a/models-sim/policy-models-simulators/src/test/java/org/onap/policy/models/simulators/MainTest.java b/models-sim/policy-models-simulators/src/test/java/org/onap/policy/models/simulators/MainTest.java index e1517f3a8..6326b704b 100644 --- a/models-sim/policy-models-simulators/src/test/java/org/onap/policy/models/simulators/MainTest.java +++ b/models-sim/policy-models-simulators/src/test/java/org/onap/policy/models/simulators/MainTest.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2020-2021 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. @@ -30,6 +31,7 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; +import jakarta.ws.rs.core.Response; import java.io.FileNotFoundException; import java.io.IOException; import java.util.HashMap; @@ -39,7 +41,6 @@ import java.util.Map.Entry; import java.util.Properties; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; -import javax.ws.rs.core.Response; import org.junit.After; import org.junit.AfterClass; import org.junit.BeforeClass; diff --git a/models-sim/pom.xml b/models-sim/pom.xml index b5da2b10b..98a6a3765 100644 --- a/models-sim/pom.xml +++ b/models-sim/pom.xml @@ -20,27 +20,28 @@ ============LICENSE_END========================================================= --> - - 4.0.0 - - org.onap.policy.models - policy-models - 3.0.0-SNAPSHOT - + + 4.0.0 + + org.onap.policy.models + policy-models + 3.0.1-SNAPSHOT + - org.onap.policy.models.sim - policy-models-sim - pom - ${project.artifactId} + org.onap.policy.models.sim + policy-models-sim + pom + ${project.artifactId} - - ${project.basedir}/../../target/code-coverage/jacoco-ut.exec - + + ${project.basedir}/../../target/code-coverage/jacoco-ut.exec + - - models-sim-dmaap - policy-models-sim-pdp - policy-models-simulators - packages - + + models-sim-dmaap + policy-models-sim-pdp + policy-models-simulators + packages + diff --git a/models-tosca/pom.xml b/models-tosca/pom.xml index 07406fcd6..cc3711514 100644 --- a/models-tosca/pom.xml +++ b/models-tosca/pom.xml @@ -19,13 +19,13 @@ ============LICENSE_END========================================================= --> + 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"> 4.0.0 org.onap.policy.models policy-models - 3.0.0-SNAPSHOT + 3.0.1-SNAPSHOT policy-models-tosca diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaEntity.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaEntity.java index 24c74cbaa..d5c098a2e 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaEntity.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaEntity.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP Policy Model * ================================================================================ - * Copyright (C) 2019-2022 Nordix Foundation. + * 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. @@ -23,11 +23,11 @@ package org.onap.policy.models.tosca.authorative.concepts; import com.google.gson.annotations.SerializedName; +import jakarta.ws.rs.core.Response; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; -import javax.ws.rs.core.Response; import lombok.Data; import lombok.NoArgsConstructor; import lombok.NonNull; diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProvider.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProvider.java index b3284d987..35971563f 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProvider.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProvider.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019-2022 Nordix Foundation. + * 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"); @@ -21,12 +21,12 @@ package org.onap.policy.models.tosca.authorative.provider; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.Status; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.Response.Status; import lombok.NonNull; import org.apache.commons.collections4.CollectionUtils; import org.onap.policy.models.base.PfConceptKey; @@ -678,9 +678,7 @@ public class AuthorativeToscaProvider { private List asConceptList(final List> listOfMaps) { List returnList = new ArrayList<>(); for (Map conceptMap : listOfMaps) { - for (T concept : conceptMap.values()) { - returnList.add(concept); - } + returnList.addAll(conceptMap.values()); } return returnList; diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaCapabilityAssignment.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaCapabilityAssignment.java index 3e0ec281b..7fb741d27 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaCapabilityAssignment.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaCapabilityAssignment.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2020-2021 Nordix Foundation. + * Copyright (C) 2020-2021, 2023 Nordix Foundation. * Modifications Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,16 +21,17 @@ package org.onap.policy.models.tosca.simple.concepts; +import jakarta.persistence.ElementCollection; +import jakarta.persistence.Entity; +import jakarta.persistence.Inheritance; +import jakarta.persistence.InheritanceType; +import jakarta.persistence.Lob; +import jakarta.persistence.Table; +import java.io.Serial; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import javax.persistence.ElementCollection; -import javax.persistence.Entity; -import javax.persistence.Inheritance; -import javax.persistence.InheritanceType; -import javax.persistence.Lob; -import javax.persistence.Table; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NonNull; @@ -52,6 +53,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaCapabilityAssignme @EqualsAndHashCode(callSuper = false) public class JpaToscaCapabilityAssignment extends JpaToscaWithTypeAndStringProperties { + @Serial private static final long serialVersionUID = 1675770231921107988L; private static final String AUTHORATIVE_UNBOUNDED_LITERAL = "UNBOUNDED"; diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaCapabilityAssignments.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaCapabilityAssignments.java index 18e77bbf1..bc531017a 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaCapabilityAssignments.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaCapabilityAssignments.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2020 Nordix Foundation. + * Copyright (C) 2020, 2023 Nordix Foundation. * Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,13 +21,14 @@ package org.onap.policy.models.tosca.simple.concepts; +import jakarta.persistence.Entity; +import jakarta.persistence.Inheritance; +import jakarta.persistence.InheritanceType; +import jakarta.persistence.Table; +import java.io.Serial; import java.util.List; import java.util.Map; import java.util.TreeMap; -import javax.persistence.Entity; -import javax.persistence.Inheritance; -import javax.persistence.InheritanceType; -import javax.persistence.Table; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NonNull; @@ -55,6 +56,7 @@ public class JpaToscaCapabilityAssignments implements PfAuthorative>> { public static final String DEFAULT_NAME = "ToscaCapabilityAssignmentsSimple"; public static final String DEFAULT_VERSION = "1.0.0"; + @Serial private static final long serialVersionUID = -7526648702327776101L; /** @@ -76,7 +78,7 @@ public class JpaToscaCapabilityAssignments } /** - * This Constructor creates an concept container with all of its fields defined. + * This Constructor creates a concept container with all of its fields defined. * * @param key the concept container key * @param conceptMap the concepts to be stored in the concept container diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaCapabilityType.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaCapabilityType.java index 4118c4db3..96d176f7a 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaCapabilityType.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaCapabilityType.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2020 Nordix Foundation. + * Copyright (C) 2020, 2023 Nordix Foundation. * Modifications Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,10 +21,11 @@ package org.onap.policy.models.tosca.simple.concepts; -import javax.persistence.Entity; -import javax.persistence.Inheritance; -import javax.persistence.InheritanceType; -import javax.persistence.Table; +import jakarta.persistence.Entity; +import jakarta.persistence.Inheritance; +import jakarta.persistence.InheritanceType; +import jakarta.persistence.Table; +import java.io.Serial; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; @@ -44,6 +45,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaCapabilityType; @EqualsAndHashCode(callSuper = true) @NoArgsConstructor public class JpaToscaCapabilityType extends JpaToscaWithToscaProperties { + @Serial private static final long serialVersionUID = -563659852901842616L; /** diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaCapabilityTypes.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaCapabilityTypes.java index e1feaed95..e23d45afc 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaCapabilityTypes.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaCapabilityTypes.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2020 Nordix Foundation. + * Copyright (C) 2020, 2023 Nordix Foundation. * Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,13 +21,14 @@ package org.onap.policy.models.tosca.simple.concepts; +import jakarta.persistence.Entity; +import jakarta.persistence.Inheritance; +import jakarta.persistence.InheritanceType; +import jakarta.persistence.Table; +import java.io.Serial; import java.util.List; import java.util.Map; import java.util.TreeMap; -import javax.persistence.Entity; -import javax.persistence.Inheritance; -import javax.persistence.InheritanceType; -import javax.persistence.Table; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NonNull; @@ -50,6 +51,7 @@ import org.onap.policy.models.tosca.utils.ToscaUtils; public class JpaToscaCapabilityTypes extends PfConceptContainer { public static final String DEFAULT_NAME = "ToscaCapabilityTypesSimple"; public static final String DEFAULT_VERSION = "1.0.0"; + @Serial private static final long serialVersionUID = -4157979965271220098L; /** @@ -71,7 +73,7 @@ public class JpaToscaCapabilityTypes extends PfConceptContainer toscaConstraint.setEqual(compareTo); + case GT -> toscaConstraint.setGreaterThan(compareTo); + case GE -> toscaConstraint.setGreaterOrEqual(compareTo); + case LT -> toscaConstraint.setLessThan(compareTo); + case LE -> toscaConstraint.setLessOrEqual(compareTo); + default -> { + return null; + } } return toscaConstraint; @@ -128,10 +116,7 @@ public class JpaToscaConstraintLogical extends JpaToscaConstraint { } @Override - public int compareTo(JpaToscaConstraint otherConstraint) { - if (otherConstraint == null) { - return -1; - } + public int compareTo(@NonNull JpaToscaConstraint otherConstraint) { if (this == otherConstraint) { return 0; } diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintValidValues.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintValidValues.java index b5c2d10e5..1f4785fe4 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintValidValues.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintValidValues.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019, 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,9 +21,10 @@ package org.onap.policy.models.tosca.simple.concepts; +import jakarta.persistence.ElementCollection; +import java.io.Serial; import java.util.ArrayList; import java.util.List; -import javax.persistence.ElementCollection; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NonNull; @@ -39,6 +40,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConstraint; @EqualsAndHashCode(callSuper = false) @ToString public class JpaToscaConstraintValidValues extends JpaToscaConstraint { + @Serial private static final long serialVersionUID = -5060193250508635456L; @ElementCollection @@ -84,10 +86,7 @@ public class JpaToscaConstraintValidValues extends JpaToscaConstraint { } @Override - public int compareTo(JpaToscaConstraint otherConstraint) { - if (otherConstraint == null) { - return -1; - } + public int compareTo(@NonNull JpaToscaConstraint otherConstraint) { if (this == otherConstraint) { return 0; } diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataType.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataType.java index c086c535a..107fb3abc 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataType.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataType.java @@ -3,7 +3,7 @@ * ONAP Policy Model * ================================================================================ * Copyright (C) 2019-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. @@ -23,13 +23,14 @@ package org.onap.policy.models.tosca.simple.concepts; +import jakarta.persistence.ElementCollection; +import jakarta.persistence.Entity; +import jakarta.persistence.Inheritance; +import jakarta.persistence.InheritanceType; +import jakarta.persistence.Table; +import java.io.Serial; import java.util.ArrayList; import java.util.List; -import javax.persistence.ElementCollection; -import javax.persistence.Entity; -import javax.persistence.Inheritance; -import javax.persistence.InheritanceType; -import javax.persistence.Table; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; @@ -54,6 +55,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaDataType; @EqualsAndHashCode(callSuper = true) @NoArgsConstructor public class JpaToscaDataType extends JpaToscaWithToscaProperties { + @Serial private static final long serialVersionUID = -3922690413436539164L; @ElementCollection diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataTypes.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataTypes.java index faa1ce186..2142f1641 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataTypes.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataTypes.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019-2020 Nordix Foundation. + * Copyright (C) 2019-2020, 2023 Nordix Foundation. * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,15 +21,17 @@ package org.onap.policy.models.tosca.simple.concepts; +import jakarta.persistence.Entity; +import jakarta.persistence.Inheritance; +import jakarta.persistence.InheritanceType; +import jakarta.persistence.Table; +import java.io.Serial; import java.util.List; import java.util.Map; import java.util.TreeMap; -import javax.persistence.Entity; -import javax.persistence.Inheritance; -import javax.persistence.InheritanceType; -import javax.persistence.Table; import lombok.Data; import lombok.EqualsAndHashCode; +import lombok.NonNull; import lombok.ToString; import org.onap.policy.common.parameters.BeanValidationResult; import org.onap.policy.models.base.PfConceptContainer; @@ -49,6 +51,7 @@ import org.onap.policy.models.tosca.utils.ToscaUtils; @ToString(callSuper = true) @EqualsAndHashCode(callSuper = true) public class JpaToscaDataTypes extends PfConceptContainer { + @Serial private static final long serialVersionUID = 2941102271022190348L; public static final String DEFAULT_NAME = "ToscaDataTypesSimple"; @@ -73,7 +76,7 @@ public class JpaToscaDataTypes extends PfConceptContainer extends PfConcept implements PfAuthorative { + @Serial private static final long serialVersionUID = -1330661834220739393L; private static final StandardCoder STANDARD_CODER = new StandardCoder(); @@ -68,10 +69,8 @@ public class JpaToscaEntityType extends PfConcept impleme // @formatter:off @Column - @AttributeOverrides({ - @AttributeOverride(name = "name", column = @Column(name = "derived_from_name")), - @AttributeOverride(name = "version", column = @Column(name = "derived_from_version")) - }) + @AttributeOverride(name = "name", column = @Column(name = "derived_from_name")) + @AttributeOverride(name = "version", column = @Column(name = "derived_from_version")) @VerifyKey private PfConceptKey derivedFrom; diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEventFilter.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEventFilter.java index e879a1305..f81790437 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEventFilter.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEventFilter.java @@ -3,7 +3,7 @@ * ONAP Policy Model * ================================================================================ * Copyright (C) 2019-2020 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. @@ -23,13 +23,14 @@ package org.onap.policy.models.tosca.simple.concepts; +import jakarta.persistence.Column; +import jakarta.persistence.EmbeddedId; +import jakarta.persistence.Entity; +import jakarta.persistence.Inheritance; +import jakarta.persistence.InheritanceType; +import jakarta.persistence.Table; +import java.io.Serial; import java.util.List; -import javax.persistence.Column; -import javax.persistence.EmbeddedId; -import javax.persistence.Entity; -import javax.persistence.Inheritance; -import javax.persistence.InheritanceType; -import javax.persistence.Table; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NonNull; @@ -54,6 +55,7 @@ import org.onap.policy.models.base.validation.annotations.VerifyKey; @Data @EqualsAndHashCode(callSuper = false) public class JpaToscaEventFilter extends PfConcept { + @Serial private static final long serialVersionUID = 8769020537228210247L; @EmbeddedId diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaModel.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaModel.java index 5f72e2ba8..76434f51d 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaModel.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaModel.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019-2020,2023 Nordix Foundation. + * Copyright (C) 2019-2020, 2023 Nordix Foundation. * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. * Modifications Copyright (C) 2022 Bell Canada. All rights reserved. * ================================================================================ @@ -22,16 +22,16 @@ package org.onap.policy.models.tosca.simple.concepts; +import jakarta.persistence.CascadeType; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.Inheritance; +import jakarta.persistence.InheritanceType; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.JoinColumns; +import jakarta.persistence.OneToOne; +import jakarta.persistence.Table; import java.util.List; -import javax.persistence.CascadeType; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.Inheritance; -import javax.persistence.InheritanceType; -import javax.persistence.JoinColumn; -import javax.persistence.JoinColumns; -import javax.persistence.OneToOne; -import javax.persistence.Table; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NonNull; @@ -44,7 +44,7 @@ import org.onap.policy.models.base.PfModelService; /** * A container class for a TOSCA model with multiple service templates. This class is a container class that allows a - * model with many service templates to be constructed that contains a well formed overall TOSCA model. + * model with many service templates to be constructed that contains a well-formed overall TOSCA model. * *

Validation runs {@link JpaToscaModel} validation on the model and all its sub concepts. */ @@ -58,10 +58,8 @@ public class JpaToscaModel extends PfModel { private static final long serialVersionUID = 8800599637708309945L; @OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true) - @JoinColumns({ - @JoinColumn(name = "serviceTemplatesName", referencedColumnName = "name"), - @JoinColumn(name = "serviceTemplatesVersion", referencedColumnName = "version") - }) + @JoinColumn(name = "serviceTemplatesName", referencedColumnName = "name") + @JoinColumn(name = "serviceTemplatesVersion", referencedColumnName = "version") @Valid private JpaToscaServiceTemplates serviceTemplates; diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeTemplate.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeTemplate.java index 0a5f0c688..0148fedf4 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeTemplate.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeTemplate.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2020-2021,2023 Nordix Foundation. + * Copyright (C) 2020-2021, 2023 Nordix Foundation. * Modifications Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,20 +21,20 @@ package org.onap.policy.models.tosca.simple.concepts; +import jakarta.persistence.CascadeType; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.Inheritance; +import jakarta.persistence.InheritanceType; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.OneToOne; +import jakarta.persistence.Table; +import jakarta.ws.rs.core.Response; +import java.io.Serial; import java.util.Collections; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import javax.persistence.CascadeType; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.Inheritance; -import javax.persistence.InheritanceType; -import javax.persistence.JoinColumn; -import javax.persistence.JoinColumns; -import javax.persistence.OneToOne; -import javax.persistence.Table; -import javax.ws.rs.core.Response; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NonNull; @@ -58,24 +58,21 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate; @Data @EqualsAndHashCode(callSuper = false) public class JpaToscaNodeTemplate extends JpaToscaWithTypeAndStringProperties { + @Serial private static final long serialVersionUID = 1675770231921107988L; private static final StandardCoder STANDARD_CODER = new StandardCoder(); // formatter:off @OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true) - @JoinColumns({ - @JoinColumn(name = "requirementsName", referencedColumnName = "name"), - @JoinColumn(name = "requirementsVersion", referencedColumnName = "version") - }) + @JoinColumn(name = "requirementsName", referencedColumnName = "name") + @JoinColumn(name = "requirementsVersion", referencedColumnName = "version") @Valid private JpaToscaRequirements requirements; @OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true) - @JoinColumns({ - @JoinColumn(name = "capabilitiesName", referencedColumnName = "name"), - @JoinColumn(name = "capabilitiesVersion", referencedColumnName = "version") - }) + @JoinColumn(name = "capabilitiesName", referencedColumnName = "name") + @JoinColumn(name = "capabilitiesVersion", referencedColumnName = "version") @Valid private JpaToscaCapabilityAssignments capabilities; // @formatter:on diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeTemplates.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeTemplates.java index 6cc7a1f4e..0a14e435d 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeTemplates.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeTemplates.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2020 Nordix Foundation. + * Copyright (C) 2020, 2023 Nordix Foundation. * Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,15 +21,17 @@ package org.onap.policy.models.tosca.simple.concepts; +import jakarta.persistence.Entity; +import jakarta.persistence.Inheritance; +import jakarta.persistence.InheritanceType; +import jakarta.persistence.Table; +import java.io.Serial; import java.util.List; import java.util.Map; import java.util.TreeMap; -import javax.persistence.Entity; -import javax.persistence.Inheritance; -import javax.persistence.InheritanceType; -import javax.persistence.Table; import lombok.Data; import lombok.EqualsAndHashCode; +import lombok.NonNull; import lombok.ToString; import org.onap.policy.common.parameters.BeanValidationResult; import org.onap.policy.models.base.PfConceptContainer; @@ -49,6 +51,7 @@ import org.onap.policy.models.tosca.utils.ToscaUtils; public class JpaToscaNodeTemplates extends PfConceptContainer { public static final String DEFAULT_NAME = "ToscaNodeTemplatesSimple"; public static final String DEFAULT_VERSION = "1.0.0"; + @Serial private static final long serialVersionUID = -4157979965271220098L; /** @@ -70,7 +73,7 @@ public class JpaToscaNodeTemplates extends PfConceptContainer { + @Serial private static final long serialVersionUID = -563659852901842616L; // formatter:off @OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true) - @JoinColumns({ - @JoinColumn(name = "requirementsName", referencedColumnName = "name"), - @JoinColumn(name = "requirementsVersion", referencedColumnName = "version") - }) + @JoinColumn(name = "requirementsName", referencedColumnName = "name") + @JoinColumn(name = "requirementsVersion", referencedColumnName = "version") // @formatter:on @Valid private JpaToscaRequirements requirements; diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeTypes.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeTypes.java index b1fe40b78..2a4b22efa 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeTypes.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeTypes.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2020 Nordix Foundation. + * Copyright (C) 2020, 2023 Nordix Foundation. * Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,15 +21,17 @@ package org.onap.policy.models.tosca.simple.concepts; +import jakarta.persistence.Entity; +import jakarta.persistence.Inheritance; +import jakarta.persistence.InheritanceType; +import jakarta.persistence.Table; +import java.io.Serial; import java.util.List; import java.util.Map; import java.util.TreeMap; -import javax.persistence.Entity; -import javax.persistence.Inheritance; -import javax.persistence.InheritanceType; -import javax.persistence.Table; import lombok.Data; import lombok.EqualsAndHashCode; +import lombok.NonNull; import lombok.ToString; import org.onap.policy.common.parameters.BeanValidationResult; import org.onap.policy.models.base.PfConceptContainer; @@ -49,6 +51,7 @@ import org.onap.policy.models.tosca.utils.ToscaUtils; public class JpaToscaNodeTypes extends PfConceptContainer { public static final String DEFAULT_NAME = "ToscaNodeTypesSimple"; public static final String DEFAULT_VERSION = "1.0.0"; + @Serial private static final long serialVersionUID = -4157979965271220098L; /** @@ -70,7 +73,7 @@ public class JpaToscaNodeTypes extends PfConceptContainer implements PfAuthorative>> { + @Serial private static final long serialVersionUID = -7526648702327776101L; public static final String DEFAULT_NAME = "ToscaPoliciesSimple"; @@ -104,7 +107,7 @@ public class JpaToscaPolicies extends PfConceptContainer { + @Serial private static final long serialVersionUID = 3265174757061982805L; private static final String METADATA_METADATA_SET_NAME_TAG = "metadataSetName"; private static final String METADATA_METADATA_SET_VERSION_TAG = "metadataSetVersion"; @@ -200,7 +202,7 @@ public class JpaToscaPolicy extends JpaToscaWithTypeAndStringProperties { + @Serial private static final long serialVersionUID = -563659852901842616L; @ElementCollection diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyTypes.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyTypes.java index c20cada8f..f053a5baa 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyTypes.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyTypes.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019-2020 Nordix Foundation. + * Copyright (C) 2019-2020, 2023 Nordix Foundation. * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,15 +21,17 @@ package org.onap.policy.models.tosca.simple.concepts; +import jakarta.persistence.Entity; +import jakarta.persistence.Inheritance; +import jakarta.persistence.InheritanceType; +import jakarta.persistence.Table; +import java.io.Serial; import java.util.List; import java.util.Map; import java.util.TreeMap; -import javax.persistence.Entity; -import javax.persistence.Inheritance; -import javax.persistence.InheritanceType; -import javax.persistence.Table; import lombok.Data; import lombok.EqualsAndHashCode; +import lombok.NonNull; import lombok.ToString; import org.onap.policy.common.parameters.BeanValidationResult; import org.onap.policy.models.base.PfConceptContainer; @@ -49,6 +51,7 @@ import org.onap.policy.models.tosca.utils.ToscaUtils; @ToString(callSuper = true) @EqualsAndHashCode(callSuper = true) public class JpaToscaPolicyTypes extends PfConceptContainer { + @Serial private static final long serialVersionUID = -4157979965271220098L; public static final String DEFAULT_NAME = "ToscaPolicyTypesSimple"; @@ -73,7 +76,7 @@ public class JpaToscaPolicyTypes extends PfConceptContainer { + @Serial private static final long serialVersionUID = 1675770231921107988L; @EmbeddedId @@ -243,10 +245,7 @@ public class JpaToscaProperty extends PfConcept implements PfAuthorative { + @Serial private static final long serialVersionUID = -563659852901842616L; /** diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaRelationshipTypes.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaRelationshipTypes.java index eed351df5..ab37c4e00 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaRelationshipTypes.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaRelationshipTypes.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2020 Nordix Foundation. + * Copyright (C) 2020, 2023 Nordix Foundation. * Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,15 +21,17 @@ package org.onap.policy.models.tosca.simple.concepts; +import jakarta.persistence.Entity; +import jakarta.persistence.Inheritance; +import jakarta.persistence.InheritanceType; +import jakarta.persistence.Table; +import java.io.Serial; import java.util.List; import java.util.Map; import java.util.TreeMap; -import javax.persistence.Entity; -import javax.persistence.Inheritance; -import javax.persistence.InheritanceType; -import javax.persistence.Table; import lombok.Data; import lombok.EqualsAndHashCode; +import lombok.NonNull; import lombok.ToString; import org.onap.policy.common.parameters.BeanValidationResult; import org.onap.policy.models.base.PfConceptContainer; @@ -49,6 +51,7 @@ import org.onap.policy.models.tosca.utils.ToscaUtils; public class JpaToscaRelationshipTypes extends PfConceptContainer { public static final String DEFAULT_NAME = "ToscaRelationshipTypesSimple"; public static final String DEFAULT_VERSION = "1.0.0"; + @Serial private static final long serialVersionUID = -4157979965271220098L; /** @@ -70,7 +73,7 @@ public class JpaToscaRelationshipTypes extends PfConceptContainer { + @Serial private static final long serialVersionUID = 2785481541573683089L; private static final String AUTHORATIVE_UNBOUNDED_LITERAL = "UNBOUNDED"; private static final Integer JPA_UNBOUNDED_VALUE = -1; diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaRequirements.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaRequirements.java index 283c161d0..52087b29f 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaRequirements.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaRequirements.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2020 Nordix Foundation. + * Copyright (C) 2020, 2023 Nordix Foundation. * Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,15 +21,17 @@ package org.onap.policy.models.tosca.simple.concepts; +import jakarta.persistence.Entity; +import jakarta.persistence.Inheritance; +import jakarta.persistence.InheritanceType; +import jakarta.persistence.Table; +import java.io.Serial; import java.util.List; import java.util.Map; import java.util.TreeMap; -import javax.persistence.Entity; -import javax.persistence.Inheritance; -import javax.persistence.InheritanceType; -import javax.persistence.Table; import lombok.Data; import lombok.EqualsAndHashCode; +import lombok.NonNull; import lombok.ToString; import org.onap.policy.common.parameters.BeanValidationResult; import org.onap.policy.models.base.PfAuthorative; @@ -51,6 +53,7 @@ import org.onap.policy.models.tosca.utils.ToscaUtils; @EqualsAndHashCode(callSuper = true) public class JpaToscaRequirements extends PfConceptContainer implements PfAuthorative>> { + @Serial private static final long serialVersionUID = -7526648702327776101L; public static final String DEFAULT_NAME = "ToscaRequirementsSimple"; @@ -75,7 +78,7 @@ public class JpaToscaRequirements extends PfConceptContainer, Serializable, Comparable { + @Serial private static final long serialVersionUID = 3645882081163287058L; @Column @@ -180,10 +182,8 @@ public class JpaToscaSchemaDefinition extends Validated copy.setDescription(description); if (constraints != null) { - final List newConstraints = new ArrayList<>(); - for (final JpaToscaConstraint constraint : constraints) { - newConstraints.add(constraint); // Constraints are immutable - } + // Constraints are immutable + final List newConstraints = new ArrayList<>(constraints); copy.setConstraints(newConstraints); } diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplate.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplate.java index 109f1f0a8..8f878c86e 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplate.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplate.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019-2021,2023 Nordix Foundation. + * Copyright (C) 2019-2021, 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,21 +22,21 @@ package org.onap.policy.models.tosca.simple.concepts; import com.google.gson.annotations.SerializedName; +import jakarta.persistence.CascadeType; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.Inheritance; +import jakarta.persistence.InheritanceType; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.OneToOne; +import jakarta.persistence.Table; +import java.io.Serial; import java.util.Collection; import java.util.Collections; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import javax.persistence.CascadeType; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.Inheritance; -import javax.persistence.InheritanceType; -import javax.persistence.JoinColumn; -import javax.persistence.JoinColumns; -import javax.persistence.OneToOne; -import javax.persistence.Table; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NonNull; @@ -64,10 +64,11 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; @Data @EqualsAndHashCode(callSuper = true) public class JpaToscaServiceTemplate extends JpaToscaEntityType - implements PfAuthorative { + implements PfAuthorative { + @Serial private static final long serialVersionUID = 8084846046148349401L; - public static final String DEFAULT_TOSCA_DEFINTIONS_VERISON = "tosca_simple_yaml_1_1_0"; + public static final String DEFAULT_TOSCA_DEFINITIONS_VERSION = "tosca_simple_yaml_1_1_0"; public static final String DEFAULT_NAME = "ToscaServiceTemplateSimple"; public static final String DEFAULT_VERSION = "1.0.0"; @@ -79,57 +80,45 @@ public class JpaToscaServiceTemplate extends JpaToscaEntityType Map flattenMap(List> list) { Map result = new LinkedHashMap<>(); @@ -353,7 +342,7 @@ public class JpaToscaServiceTemplate extends JpaToscaEntityType dataTypeKeyCollection, - final BeanValidationResult result) { + final BeanValidationResult result) { for (PfConceptKey dataTypeKey : dataTypeKeyCollection) { if (dataTypes == null || dataTypes.get(dataTypeKey) == null) { addResult(result, "data type", dataTypeKey.getId(), NOT_FOUND); @@ -470,13 +459,13 @@ public class JpaToscaServiceTemplate extends JpaToscaEntityType { + @Serial private static final long serialVersionUID = 8969698734673232603L; public static final String DEFAULT_LOCAL_NAME = "ToscaTopologyTemplateSimple"; @@ -81,27 +83,20 @@ public class JpaToscaTopologyTemplate extends PfConcept implements PfAuthorative @NotBlank private String description; - // @formatter:off @ElementCollection @Lob private Map<@NotNull String, @NotNull @Valid JpaToscaParameter> inputs; @OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true) - @JoinColumns({ - @JoinColumn(name = "nodeTemplatesName", referencedColumnName = "name"), - @JoinColumn(name = "nodeTemplatessVersion", referencedColumnName = "version") - }) + @JoinColumn(name = "nodeTemplatesName", referencedColumnName = "name") + @JoinColumn(name = "nodeTemplatessVersion", referencedColumnName = "version") @SerializedName("data_types") @Valid private JpaToscaNodeTemplates nodeTemplates; @OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true) - @JoinColumns({ - @JoinColumn(name = "policyName", referencedColumnName = "name"), - @JoinColumn(name = "policyVersion", referencedColumnName = "version") - - }) - // @formatter:on + @JoinColumn(name = "policyName", referencedColumnName = "name") + @JoinColumn(name = "policyVersion", referencedColumnName = "version") @Valid private JpaToscaPolicies policies; @@ -110,7 +105,7 @@ public class JpaToscaTopologyTemplate extends PfConcept implements PfAuthorative */ public JpaToscaTopologyTemplate() { this(new PfReferenceKey(JpaToscaServiceTemplate.DEFAULT_NAME, JpaToscaServiceTemplate.DEFAULT_VERSION, - DEFAULT_LOCAL_NAME)); + DEFAULT_LOCAL_NAME)); } /** @@ -133,7 +128,7 @@ public class JpaToscaTopologyTemplate extends PfConcept implements PfAuthorative this.description = copyConcept.description; this.inputs = PfUtils.mapMap(copyConcept.inputs, JpaToscaParameter::new); this.nodeTemplates = - (copyConcept.nodeTemplates != null ? new JpaToscaNodeTemplates(copyConcept.nodeTemplates) : null); + (copyConcept.nodeTemplates != null ? new JpaToscaNodeTemplates(copyConcept.nodeTemplates) : null); this.policies = (copyConcept.policies != null ? new JpaToscaPolicies(copyConcept.policies) : null); } diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTrigger.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTrigger.java index 1e13b225c..2b017ee74 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTrigger.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTrigger.java @@ -3,7 +3,7 @@ * ONAP Policy Model * ================================================================================ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019-2021 Nordix Foundation. + * Modifications Copyright (C) 2019-2021, 2023 Nordix Foundation. * Modifications Copyright (C) 2022 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -25,10 +25,10 @@ package org.onap.policy.models.tosca.simple.concepts; import com.google.gson.annotations.SerializedName; +import jakarta.persistence.Column; +import jakarta.persistence.EmbeddedId; import java.time.Duration; import java.util.List; -import javax.persistence.Column; -import javax.persistence.EmbeddedId; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NonNull; diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaWithToscaProperties.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaWithToscaProperties.java index 510287581..34119437d 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaWithToscaProperties.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaWithToscaProperties.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2021 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,6 +21,10 @@ package org.onap.policy.models.tosca.simple.concepts; +import jakarta.persistence.ElementCollection; +import jakarta.persistence.Lob; +import jakarta.persistence.MappedSuperclass; +import java.io.Serial; import java.util.Collection; import java.util.LinkedHashMap; import java.util.LinkedHashSet; @@ -27,9 +32,6 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Set; -import javax.persistence.ElementCollection; -import javax.persistence.Lob; -import javax.persistence.MappedSuperclass; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NonNull; @@ -56,6 +58,7 @@ import org.onap.policy.models.tosca.utils.ToscaUtils; @EqualsAndHashCode(callSuper = true) public abstract class JpaToscaWithToscaProperties extends JpaToscaEntityType implements PfAuthorative { + @Serial private static final long serialVersionUID = -563659852901842616L; @ElementCollection diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaWithTypeAndStringProperties.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaWithTypeAndStringProperties.java index cb0ff4e5d..d2dd0e834 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaWithTypeAndStringProperties.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaWithTypeAndStringProperties.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 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. @@ -21,16 +21,16 @@ package org.onap.policy.models.tosca.simple.concepts; +import jakarta.persistence.AttributeOverride; +import jakarta.persistence.Column; +import jakarta.persistence.ElementCollection; +import jakarta.persistence.Lob; +import jakarta.persistence.MappedSuperclass; +import jakarta.ws.rs.core.Response; +import java.io.Serial; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import javax.persistence.AttributeOverride; -import javax.persistence.AttributeOverrides; -import javax.persistence.Column; -import javax.persistence.ElementCollection; -import javax.persistence.Lob; -import javax.persistence.MappedSuperclass; -import javax.ws.rs.core.Response; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NonNull; @@ -54,13 +54,12 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaWithTypeAndObjectP public abstract class JpaToscaWithTypeAndStringProperties extends JpaToscaEntityType implements PfAuthorative { + @Serial private static final long serialVersionUID = 2785481541573683089L; @Column - @AttributeOverrides ({ - @AttributeOverride(name = "name", column = @Column(name = "type_name")), - @AttributeOverride(name = "version", column = @Column(name = "type_version")) - }) + @AttributeOverride(name = "name", column = @Column(name = "type_name")) + @AttributeOverride(name = "version", column = @Column(name = "type_version")) @VerifyKey @NotNull private PfConceptKey type; diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaProvider.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaProvider.java index e2f61c464..486dc9f19 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaProvider.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaProvider.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019-2020,2022 Nordix Foundation. + * Copyright (C) 2019-2020, 2022-2023 Nordix Foundation. * Modifications Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,12 +21,12 @@ package org.onap.policy.models.tosca.simple.provider; +import jakarta.ws.rs.core.Response; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map; import java.util.Optional; -import javax.ws.rs.core.Response; import lombok.NonNull; import org.apache.commons.collections4.CollectionUtils; import org.onap.policy.common.parameters.BeanValidationResult; @@ -492,7 +492,7 @@ public class SimpleToscaProvider { deletedServiceTemplate.setPolicyTypes(new JpaToscaPolicyTypes()); deletedServiceTemplate.getPolicyTypes().getConceptMap().put(policyTypeKey, policyType4Deletion); - LOGGER.debug("<-deletePolicyType: key={}, serviceTempalate={}", policyTypeKey, deletedServiceTemplate); + LOGGER.debug("<-deletePolicyType: key={}, serviceTemplate={}", policyTypeKey, deletedServiceTemplate); return deletedServiceTemplate; } diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaServiceTemplateProvider.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaServiceTemplateProvider.java index b0b78638d..40f09e3a0 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaServiceTemplateProvider.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaServiceTemplateProvider.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2020 Nordix Foundation. + * Copyright (C) 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. @@ -20,7 +20,7 @@ package org.onap.policy.models.tosca.simple.provider; -import javax.ws.rs.core.Response.Status; +import jakarta.ws.rs.core.Response.Status; import lombok.NonNull; import org.onap.policy.models.base.PfConceptKey; import org.onap.policy.models.base.PfModelException; diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaServiceTemplateUtils.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaServiceTemplateUtils.java index 6f4b2993f..1f6056f35 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaServiceTemplateUtils.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaServiceTemplateUtils.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2020,2022 Nordix Foundation. + * Copyright (C) 2020, 2022-2023 Nordix Foundation. * Modifications Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,8 +21,8 @@ package org.onap.policy.models.tosca.utils; +import jakarta.ws.rs.core.Response; import java.util.Map.Entry; -import javax.ws.rs.core.Response; import lombok.AccessLevel; import lombok.NoArgsConstructor; import lombok.NonNull; diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaUtils.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaUtils.java index be0d41d9b..f4c22fc5f 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaUtils.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaUtils.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019-2022 Nordix Foundation. + * Copyright (C) 2019-2023 Nordix Foundation. * Modifications Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,11 +21,11 @@ package org.onap.policy.models.tosca.utils; +import jakarta.ws.rs.core.Response; import java.util.Collection; import java.util.HashSet; import java.util.Set; import java.util.function.Function; -import javax.ws.rs.core.Response; import lombok.AccessLevel; import lombok.NoArgsConstructor; import lombok.NonNull; diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintLogicalTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintLogicalTest.java index 53b42caa7..2fdd29c5a 100644 --- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintLogicalTest.java +++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintLogicalTest.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019, 2023 Nordix Foundation. * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,6 +21,7 @@ package org.onap.policy.models.tosca.simple.concepts; +import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNull; @@ -69,7 +70,7 @@ public class JpaToscaConstraintLogicalTest { JpaToscaConstraintLogical jc5 = new JpaToscaConstraintLogical(c5); assertNull(jc5.toAuthorative()); - assertEquals(-1, jc0.compareTo(null)); + assertThatThrownBy(() -> jc0.compareTo(null)).isInstanceOf(NullPointerException.class); assertEquals(0, jc0.compareTo(jc0)); assertNotEquals(0, jc0.compareTo(new JpaToscaConstraintValidValues(new ArrayList<>()))); assertEquals(-2, jc0.compareTo(jc1)); diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintTest.java index 6c39737f1..02e3fdae3 100644 --- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintTest.java +++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintTest.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019-2021 Nordix Foundation. + * Copyright (C) 2019-2021, 2023 Nordix Foundation. * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -68,7 +68,7 @@ public class JpaToscaConstraintTest { validValues.add("hello"); validValues.add("goodbye"); JpaToscaConstraintValidValues cvv0 = new JpaToscaConstraintValidValues(validValues); - assertEquals(-1, cvv0.compareTo(null)); + assertThatThrownBy(() -> cvv0.compareTo(null)).isInstanceOf(NullPointerException.class); assertEquals(0, cvv0.compareTo(cvv0)); assertNotEquals(0, cvv0.compareTo(new JpaToscaConstraintLogical(JpaToscaConstraintOperation.EQ, CONSTRAINT))); JpaToscaConstraintValidValues cvv1 = new JpaToscaConstraintValidValues(validValues); @@ -81,7 +81,7 @@ public class JpaToscaConstraintTest { rangeValues.add("hello"); rangeValues.add("goodbye"); JpaToscaConstraintInRange cir0 = new JpaToscaConstraintInRange(rangeValues); - assertEquals(-1, cir0.compareTo(null)); + assertThatThrownBy(() -> cir0.compareTo(null)).isInstanceOf(NullPointerException.class); assertEquals(0, cir0.compareTo(cir0)); assertNotEquals(0, cir0.compareTo(new JpaToscaConstraintLogical(JpaToscaConstraintOperation.EQ, CONSTRAINT))); JpaToscaConstraintInRange cir1 = new JpaToscaConstraintInRange(rangeValues); diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPropertyTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPropertyTest.java index 685266a9f..ffa21244c 100644 --- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPropertyTest.java +++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPropertyTest.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019-2021 Nordix Foundation. + * Copyright (C) 2019-2021, 2023 Nordix Foundation. * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -113,7 +113,7 @@ public class JpaToscaPropertyTest { assertEquals(tp, tdtClone1); assertEquals(0, tp.compareTo(tdtClone1)); - assertEquals(-1, tp.compareTo(null)); + assertThatThrownBy(() -> tp.compareTo(null)).isInstanceOf(NullPointerException.class); assertEquals(0, tp.compareTo(tp)); assertNotEquals(0, tp.compareTo(tp.getKey())); } diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplateTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplateTest.java index 9a91a9558..6296788ee 100644 --- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplateTest.java +++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplateTest.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019-2021 Nordix Foundation. + * Copyright (C) 2019-2021, 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"); @@ -96,39 +96,7 @@ public class JpaToscaServiceTemplateTest { tst.setTopologyTemplate(ttt); assertEquals(ttt, tst.getTopologyTemplate()); - JpaToscaServiceTemplate tttClone0 = new JpaToscaServiceTemplate(tst); - assertEquals(tst, tttClone0); - assertEquals(0, tst.compareTo(tttClone0)); - - JpaToscaServiceTemplate tttClone1 = new JpaToscaServiceTemplate(tst); - assertEquals(tst, tttClone1); - assertEquals(0, tst.compareTo(tttClone1)); - - assertEquals(-1, tst.compareTo(null)); - assertEquals(0, tst.compareTo(tst)); - assertNotEquals(0, tst.compareTo(tst.getKey())); - - PfConceptKey otherDtKey = new PfConceptKey("otherDt", VERSION_001); - JpaToscaServiceTemplate otherDt = new JpaToscaServiceTemplate(otherDtKey); - - assertNotEquals(0, tst.compareTo(otherDt)); - otherDt.setKey(tstKey); - assertNotEquals(0, tst.compareTo(otherDt)); - otherDt.setToscaDefinitionsVersion("Tosca Version"); - assertNotEquals(0, tst.compareTo(otherDt)); - otherDt.setDataTypes(dataTypes); - assertNotEquals(0, tst.compareTo(otherDt)); - otherDt.setPolicyTypes(policyTypes); - assertNotEquals(0, tst.compareTo(otherDt)); - otherDt.setTopologyTemplate(ttt); - assertEquals(0, tst.compareTo(otherDt)); - - assertEquals(6, tst.getKeys().size()); - assertEquals(1, new JpaToscaServiceTemplate().getKeys().size()); - - new JpaToscaServiceTemplate().clean(); - tst.clean(); - assertEquals(tttClone0, tst); + assertCloneAndCopies(tstKey, tst, dataTypes, policyTypes, ttt); assertTrue(new JpaToscaServiceTemplate().validate("").isValid()); assertTrue(tst.validate("").isValid()); @@ -146,7 +114,7 @@ public class JpaToscaServiceTemplateTest { BeanValidationResult result = tst.validate(""); assertThat(result.getResult()).contains("tosca_definitions_version").contains(Validated.IS_NULL); - tst.setToscaDefinitionsVersion(JpaToscaServiceTemplate.DEFAULT_TOSCA_DEFINTIONS_VERISON); + tst.setToscaDefinitionsVersion(JpaToscaServiceTemplate.DEFAULT_TOSCA_DEFINITIONS_VERSION); tst.setDataTypes(null); result = tst.validate(""); assertTrue(result.isValid()); @@ -160,6 +128,19 @@ public class JpaToscaServiceTemplateTest { JpaToscaProperty prop0 = new JpaToscaProperty(new PfReferenceKey(pt0.getKey(), "prop0")); prop0.setType(dt0.getKey()); + assertDataTypesAndToscaTopology(tst, pt0, dt0, prop0); + + tst.setPolicyTypes(null); + result = tst.validate(""); + assertTrue(result.isValid()); + + assertNoPolicyType(tst, policyTypes, pt0, dt0); + + } + + private static void assertDataTypesAndToscaTopology(JpaToscaServiceTemplate tst, JpaToscaPolicyType pt0, + JpaToscaDataType dt0, JpaToscaProperty prop0) { + BeanValidationResult result; pt0.setProperties(new LinkedHashMap<>()); pt0.getProperties().put(prop0.getKey().getLocalName(), prop0); result = tst.validate(""); @@ -191,11 +172,49 @@ public class JpaToscaServiceTemplateTest { tst.getTopologyTemplate().setPolicies(new JpaToscaPolicies()); result = tst.validate(""); assertTrue(result.isValid()); + } - tst.setPolicyTypes(null); - result = tst.validate(""); - assertTrue(result.isValid()); + private static void assertCloneAndCopies(PfConceptKey tstKey, JpaToscaServiceTemplate tst, + JpaToscaDataTypes dataTypes, JpaToscaPolicyTypes policyTypes, + JpaToscaTopologyTemplate ttt) { + JpaToscaServiceTemplate tttClone0 = new JpaToscaServiceTemplate(tst); + assertEquals(tst, tttClone0); + assertEquals(0, tst.compareTo(tttClone0)); + + JpaToscaServiceTemplate tttClone1 = new JpaToscaServiceTemplate(tst); + assertEquals(tst, tttClone1); + assertEquals(0, tst.compareTo(tttClone1)); + + assertEquals(-1, tst.compareTo(null)); + assertEquals(0, tst.compareTo(tst)); + assertNotEquals(0, tst.compareTo(tst.getKey())); + + PfConceptKey otherDtKey = new PfConceptKey("otherDt", VERSION_001); + JpaToscaServiceTemplate otherDt = new JpaToscaServiceTemplate(otherDtKey); + + assertNotEquals(0, tst.compareTo(otherDt)); + otherDt.setKey(tstKey); + assertNotEquals(0, tst.compareTo(otherDt)); + otherDt.setToscaDefinitionsVersion("Tosca Version"); + assertNotEquals(0, tst.compareTo(otherDt)); + otherDt.setDataTypes(dataTypes); + assertNotEquals(0, tst.compareTo(otherDt)); + otherDt.setPolicyTypes(policyTypes); + assertNotEquals(0, tst.compareTo(otherDt)); + otherDt.setTopologyTemplate(ttt); + assertEquals(0, tst.compareTo(otherDt)); + + assertEquals(6, tst.getKeys().size()); + assertEquals(1, new JpaToscaServiceTemplate().getKeys().size()); + + new JpaToscaServiceTemplate().clean(); + tst.clean(); + assertEquals(tttClone0, tst); + } + private static void assertNoPolicyType(JpaToscaServiceTemplate tst, JpaToscaPolicyTypes policyTypes, + JpaToscaPolicyType pt0, JpaToscaDataType dt0) { + BeanValidationResult result; JpaToscaPolicy pol0 = new JpaToscaPolicy(new PfConceptKey("pol0:0.0.1")); tst.getTopologyTemplate().getPolicies().getConceptMap().put(pol0.getKey(), pol0); result = tst.validate(""); @@ -239,6 +258,5 @@ public class JpaToscaServiceTemplateTest { assertFalse(result.isValid()); assertThat(result.getResult()).contains( "no policy types are defined on the service template for the policies in the topology template"); - } } diff --git a/pom.xml b/pom.xml index 38d4bd480..d163e52bf 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.onap.policy.parent integration - 4.0.0-SNAPSHOT + 4.0.1-SNAPSHOT org.onap.policy.models policy-models - 3.0.0-SNAPSHOT + 3.0.1-SNAPSHOT pom policy-models This repo holds model code agnostic to PDP engines - 2.0.0-SNAPSHOT + 2.0.1-SNAPSHOT @@ -68,13 +68,19 @@ org.onap.policy.common utils + ${policy.common.version} + + + org.onap.policy.common + utils-test + ${policy.common.version} + test org.slf4j slf4j-api - ch.qos.logback logback-core @@ -100,11 +106,6 @@ snakeyaml - - javax.ws.rs - javax.ws.rs-api - - org.mariadb.jdbc mariadb-java-client @@ -116,42 +117,14 @@ - org.hibernate.javax.persistence - hibernate-jpa-2.1-api - - - - org.hibernate - hibernate-entitymanager - - - - junit - junit - test - - - - org.assertj - assertj-core - test - - - - org.onap.policy.common - utils-test - ${policy.common.version} - test - - - com.openpojo - openpojo - test + jakarta.ws.rs + jakarta.ws.rs-api org.glassfish.jersey.inject jersey-hk2 + ${version.jersey} org.eclipse.jetty @@ -164,6 +137,7 @@ org.eclipse.jetty jetty-servlet + ${version.jetty} org.glassfish.jersey.containers @@ -171,8 +145,28 @@ ${version.jersey} - org.apache.httpcomponents - httpclient + junit + junit + test + + + org.mockito + mockito-core + test + + + org.assertj + assertj-core + test + + + com.openpojo + openpojo + test + + + org.apache.httpcomponents.client5 + httpclient5 org.apache.commons diff --git a/version.properties b/version.properties index 4ba0a9a80..3288dcdc3 100644 --- a/version.properties +++ b/version.properties @@ -4,7 +4,7 @@ minor=3 minor=0 -patch=0 +patch=1 base_version=${major}.${minor}.${patch} -- 2.16.6