diff options
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 @@ <!-- ============LICENSE_START======================================================= - Copyright (C) 2019,2023 Nordix Foundation. + Copyright (C) 2019, 2023 Nordix Foundation. Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); @@ -19,12 +19,12 @@ ============LICENSE_END========================================================= --> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.onap.policy.models</groupId> <artifactId>policy-models</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.0.1-SNAPSHOT</version> </parent> <artifactId>policy-models-base</artifactId> @@ -46,10 +46,5 @@ <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-core</artifactId> - <scope>test</scope> - </dependency> </dependencies> </project> 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<PfConcept> { + @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 <C> 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<C extends PfConcept, A extends PfNameVersion> extends PfConcept - implements PfConceptGetter<C>, PfAuthorative<List<Map<String, A>>> { + implements PfConceptGetter<C>, PfAuthorative<List<Map<String, A>>> { + @Serial private static final long serialVersionUID = -324211738823208318L; private static final String VALUE_FIELD = "value"; @@ -115,9 +117,9 @@ public class PfConceptContainer<C extends PfConcept, A extends PfNameVersion> 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<PfConceptKey, C> conceptMap) { @@ -200,9 +202,9 @@ public class PfConceptContainer<C extends PfConcept, A extends PfNameVersion> 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<C extends PfConcept, A extends PfNameVersion> 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<C extends PfConcept, A extends PfNameVersion> 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<C extends PfConcept, A extends PfNameVersion> ex return getClass().getName().compareTo(otherConcept.getClass().getName()); } - @SuppressWarnings("unchecked") - final PfConceptContainer<C, A> other = (PfConceptContainer<C, A>) otherConcept; + @SuppressWarnings("unchecked") final PfConceptContainer<C, A> other = (PfConceptContainer<C, A>) otherConcept; int retVal = key.compareTo(other.key); if (retVal != 0) { return retVal; @@ -310,7 +308,7 @@ public class PfConceptContainer<C extends PfConcept, A extends PfNameVersion> 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<C extends PfConcept, A extends PfNameVersion> 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<PfNameVersion, String> fieldGetterFunction) { + final PfNameVersion concept, + final Function<PfNameVersion, String> fieldGetterFunction) { String conceptField = fieldGetterFunction.apply(concept); @@ -391,7 +390,7 @@ public class PfConceptContainer<C extends PfConcept, A extends PfNameVersion> 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. * * <p>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 <C> 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<PfConceptKey> artifactKeySet, final BeanValidationResult result) { + final Set<PfConceptKey> 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<PfReferenceKey> referenceKeySet, final BeanValidationResult result) { + final Set<PfReferenceKey> 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<PfKeyUse> usedKeySet, final Set<PfConceptKey> artifactKeySet, - final Set<PfReferenceKey> referenceKeySet, final BeanValidationResult result) { + final Set<PfReferenceKey> 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<String, PfConcept> modelMap = new ConcurrentHashMap<>(); + private static final Map<String, PfConcept> modelMap = new ConcurrentHashMap<>(); /** * Register a model with the model service. * - * @param <M> the generic type + * @param <M> 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 <M extends PfConcept> 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 <M> the generic type + * @param <M> 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 <T, R> List<R> mapList(List<T> source, Function<T, R> mapFunc, List<R> 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 <T, R> List<R> mapList(List<T> source, Function<T, R> 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 <K, T, R> Map<K, R> mapMap(Map<K, T> source, Function<T, R> mapFunc, - Map<K, R> defaultValue) { + public static <K, T, R> Map<K, R> mapMap(Map<K, T> source, Function<T, R> mapFunc, Map<K, R> 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 <K, T, R> Map<K, R> mapMap(Map<K, T> source, Function<T, R> mapFunc) { return mapMap(source, mapFunc, null); @@ -176,15 +175,14 @@ public final class PfUtils { } try { - @SuppressWarnings("unchecked") - Class<? extends T> clazz = (Class<? extends T>) source.getClass(); + @SuppressWarnings("unchecked") Class<? extends T> clazz = (Class<? extends T>) 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<PfConceptKey, DummyPfConcept>()); + 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<PfConceptKey, DummyPfConcept>())) + 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<DummyAuthorativeConcept> { + @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<PfKey> 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========================================================= --> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.onap.policy.models</groupId> <artifactId>policy-models</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.0.1-SNAPSHOT</version> </parent> <artifactId>policy-models-dao</artifactId> <name>${project.artifactId}</name> - <description>[${project.parent.artifactId}] module provides common DAO (Data Access Object) model handling for the ONAP Policy Framework</description> + <description>[${project.parent.artifactId}] module provides common DAO (Data Access Object) model handling for the + ONAP Policy Framework + </description> <dependencies> <dependency> 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<String, String> 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 <T extends PfConcept> int deleteByReferenceKey(final Class<T> someClass, - final Collection<PfReferenceKey> keys) { + final Collection<PfReferenceKey> 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 <T extends PfConcept> void deleteAll(final Class<T> 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 <T extends PfConcept> List<T> getFiltered(final Class<T> 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 <T extends PfConcept> List<T> getFiltered(final Class<T> 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<T> 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<T> 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 extends PfConcept> 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 <T extends PfConcept> String setQueryTable(final String queryString, final Class<T> 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 extends PfConcept> T getSingleResult(final Class<T> someClass, final String searchFilter, - List<T> resultList) { + List<T> 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 <T> 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 <T> 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 @@ --> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.onap.policy.models</groupId> <artifactId>policy-models</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.0.1-SNAPSHOT</version> </parent> <artifactId>policy-models-decisions</artifactId> 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 @@ <!-- ============LICENSE_START======================================================= - Copyright (C) 2019 Nordix Foundation. + Copyright (C) 2019, 2023 Nordix Foundation. Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); @@ -20,12 +20,12 @@ --> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.onap.policy.models</groupId> <artifactId>policy-models</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.0.1-SNAPSHOT</version> </parent> <artifactId>policy-models-errors</artifactId> @@ -38,10 +38,5 @@ <artifactId>gson</artifactId> <version>${policy.common.version}</version> </dependency> - <dependency> - <groupId>com.openpojo</groupId> - <artifactId>openpojo</artifactId> - <scope>test</scope> - </dependency> </dependencies> </project> 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<String> errorDetails; + private List<String> errorDetails; @SerializedName("warnings") - private List<String> warningDetails; + private List<String> 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========================================================= --> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.onap.policy.models</groupId> <artifactId>policy-models</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.0.1-SNAPSHOT</version> </parent> <artifactId>policy-models-examples</artifactId> @@ -33,7 +33,7 @@ <description>Various examples of policy type and policy models in various formats</description> <properties> - <!-- There is no code in this sub-module, only holds interfaces. So skip sonar. --> + <!-- There is no code in this submodule, only holds interfaces. So skip sonar. --> <sonar.skip>true</sonar.skip> </properties> </project> 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 @@ <!-- ============LICENSE_START======================================================= Copyright (C) 2018 Wipro Limited Intellectual Property. All rights reserved. - Modifications Copyright (C) 2019-2020,2023 Nordix Foundation. + Modifications Copyright (C) 2019-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"); @@ -19,14 +19,14 @@ ============LICENSE_END========================================================= --> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> <artifactId>model-actors</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.0.1-SNAPSHOT</version> </parent> <artifactId>actor.a1p</artifactId> @@ -62,11 +62,6 @@ <scope>test</scope> </dependency> <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> <groupId>org.onap.policy.models.policy-models-interactions</groupId> <artifactId>simulators</artifactId> <version>${project.version}</version> @@ -84,10 +79,5 @@ <version>${project.version}</version> <scope>test</scope> </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-core</artifactId> - <scope>test</scope> - </dependency> </dependencies> </project> 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 @@ <!-- ============LICENSE_START======================================================= Copyright (C) 2018 Huawei Intellectual Property. All rights reserved. - Modifications Copyright (C) 2019-2020,2023 Nordix Foundation. + Modifications Copyright (C) 2019-2020, 2023 Nordix Foundation. Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); @@ -20,14 +20,14 @@ --> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> <artifactId>model-actors</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.0.1-SNAPSHOT</version> </parent> <artifactId>actor.aai</artifactId> @@ -58,11 +58,6 @@ <scope>provided</scope> </dependency> <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> <artifactId>actor.test</artifactId> <version>${project.version}</version> @@ -74,10 +69,5 @@ <version>${project.version}</version> <scope>test</scope> </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-core</artifactId> - <scope>test</scope> - </dependency> </dependencies> </project> 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 @@ <!-- ============LICENSE_START======================================================= 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. @@ -19,14 +19,14 @@ --> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> <artifactId>model-actors</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.0.1-SNAPSHOT</version> </parent> <artifactId>actor.appc</artifactId> @@ -62,11 +62,6 @@ <scope>test</scope> </dependency> <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> <groupId>org.onap.policy.models.policy-models-interactions</groupId> <artifactId>simulators</artifactId> <version>${project.version}</version> @@ -84,10 +79,5 @@ <version>${project.version}</version> <scope>test</scope> </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-core</artifactId> - <scope>test</scope> - </dependency> </dependencies> </project> 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 @@ <!-- ============LICENSE_START======================================================= Copyright (C) 2017-2018, 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. @@ -18,13 +18,14 @@ ============LICENSE_END========================================================= --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> <artifactId>model-actors</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.0.1-SNAPSHOT</version> </parent> <artifactId>actor.appclcm</artifactId> @@ -87,15 +88,5 @@ <version>${project.version}</version> <scope>test</scope> </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-core</artifactId> - <scope>test</scope> - </dependency> </dependencies> </project> 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 @@ --> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> <artifactId>model-actors</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.0.1-SNAPSHOT</version> </parent> <artifactId>actor.cds</artifactId> <dependencies> @@ -75,10 +76,5 @@ <version>${project.version}</version> <scope>test</scope> </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-all</artifactId> - <scope>test</scope> - </dependency> </dependencies> </project> 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 @@ <!-- ============LICENSE_START======================================================= Copyright (C) 2018 Huawei Intellectual Property. All rights reserved. - Modifications Copyright (C) 2019-2020,2023 Nordix Foundation. + Modifications Copyright (C) 2019-2020, 2023 Nordix Foundation. Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); @@ -20,14 +20,14 @@ --> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> <artifactId>model-actors</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.0.1-SNAPSHOT</version> </parent> <artifactId>actor.sdnc</artifactId> @@ -64,11 +64,6 @@ <scope>provided</scope> </dependency> <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> <artifactId>actor.test</artifactId> <version>${project.version}</version> @@ -80,10 +75,5 @@ <version>${project.version}</version> <scope>test</scope> </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-core</artifactId> - <scope>test</scope> - </dependency> </dependencies> </project> 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 @@ <!-- ============LICENSE_START======================================================= Copyright (C) 2018 Wipro Limited Intellectual Property. All rights reserved. - Modifications Copyright (C) 2019-2020,2023 Nordix Foundation. + Modifications Copyright (C) 2019-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"); @@ -19,14 +19,14 @@ ============LICENSE_END========================================================= --> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> <artifactId>model-actors</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.0.1-SNAPSHOT</version> </parent> <artifactId>actor.sdnr</artifactId> @@ -56,11 +56,6 @@ <scope>test</scope> </dependency> <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> <groupId>org.onap.policy.models.policy-models-interactions</groupId> <artifactId>simulators</artifactId> <version>${project.version}</version> @@ -78,10 +73,5 @@ <version>${project.version}</version> <scope>test</scope> </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-core</artifactId> - <scope>test</scope> - </dependency> </dependencies> </project> 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 @@ <!-- ============LICENSE_START======================================================= 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. @@ -19,14 +19,14 @@ --> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> <artifactId>model-actors</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.0.1-SNAPSHOT</version> </parent> <artifactId>actor.so</artifactId> @@ -68,11 +68,6 @@ <scope>provided</scope> </dependency> <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> <artifactId>actor.test</artifactId> <version>${project.version}</version> @@ -84,10 +79,5 @@ <version>${project.version}</version> <scope>test</scope> </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-core</artifactId> - <scope>test</scope> - </dependency> </dependencies> </project> 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 @@ --> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> <artifactId>model-actors</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.0.1-SNAPSHOT</version> </parent> <artifactId>actor.test</artifactId> 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 @@ <!-- ============LICENSE_START======================================================= 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. @@ -19,14 +19,14 @@ --> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> <artifactId>model-actors</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.0.1-SNAPSHOT</version> </parent> <artifactId>actor.vfc</artifactId> @@ -74,11 +74,6 @@ <scope>provided</scope> </dependency> <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> <artifactId>actor.test</artifactId> <version>${project.version}</version> @@ -95,10 +90,5 @@ <artifactId>mockito-core</artifactId> <scope>compile</scope> </dependency> - <dependency> - <groupId>org.assertj</groupId> - <artifactId>assertj-core</artifactId> - <scope>test</scope> - </dependency> </dependencies> </project> 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<VfcResponse> { /** * 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 @@ --> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> <artifactId>model-actors</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.0.1-SNAPSHOT</version> </parent> <artifactId>actor.xacml</artifactId> @@ -59,11 +59,6 @@ <scope>provided</scope> </dependency> <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> <artifactId>actor.test</artifactId> <version>${project.version}</version> 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 @@ <!-- ============LICENSE_START======================================================= 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. @@ -19,14 +19,14 @@ --> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> <artifactId>model-actors</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.0.1-SNAPSHOT</version> </parent> <artifactId>actorServiceProvider</artifactId> @@ -55,10 +55,5 @@ <artifactId>mockito-core</artifactId> <scope>compile</scope> </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> </dependencies> </project> 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 <P> 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<T> 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========================================================= --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <packaging>pom</packaging> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <packaging>pom</packaging> - <parent> - <groupId>org.onap.policy.models</groupId> - <artifactId>policy-models-interactions</artifactId> - <version>3.0.0-SNAPSHOT</version> - </parent> + <parent> + <groupId>org.onap.policy.models</groupId> + <artifactId>policy-models-interactions</artifactId> + <version>3.0.1-SNAPSHOT</version> + </parent> - <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> - <artifactId>model-actors</artifactId> + <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> + <artifactId>model-actors</artifactId> - <properties> - <jacoco.dataFile>${project.basedir}/../../../target/code-coverage/jacoco-ut.exec</jacoco.dataFile> - </properties> + <properties> + <jacoco.dataFile>${project.basedir}/../../../target/code-coverage/jacoco-ut.exec</jacoco.dataFile> + </properties> - <modules> - <module>actorServiceProvider</module> - <module>actor.test</module> - <module>actor.aai</module> - <module>actor.cds</module> - <module>actor.appc</module> - <module>actor.appclcm</module> - <module>actor.sdnc</module> - <module>actor.sdnr</module> - <module>actor.a1p</module> - <module>actor.so</module> - <module>actor.vfc</module> - <module>actor.xacml</module> - </modules> - <dependencies> - <dependency> - <groupId>com.google.guava</groupId> - <artifactId>guava</artifactId> - </dependency> - </dependencies> + <modules> + <module>actorServiceProvider</module> + <module>actor.test</module> + <module>actor.aai</module> + <module>actor.cds</module> + <module>actor.appc</module> + <module>actor.appclcm</module> + <module>actor.sdnc</module> + <module>actor.sdnr</module> + <module>actor.a1p</module> + <module>actor.so</module> + <module>actor.vfc</module> + <module>actor.xacml</module> + </modules> + <dependencies> + <dependency> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + </dependency> + </dependencies> </project> 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 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> <artifactId>model-impl</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.0.1-SNAPSHOT</version> </parent> <artifactId>aai</artifactId> @@ -44,16 +44,6 @@ <version>${project.version}</version> </dependency> <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-core</artifactId> - <scope>test</scope> - </dependency> - <dependency> <groupId>org.onap.policy.common</groupId> <artifactId>policy-endpoints</artifactId> <version>${policy.common.version}</version> 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 @@ --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> - <artifactId>model-impl</artifactId> - <version>3.0.0-SNAPSHOT</version> - </parent> + <parent> + <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> + <artifactId>model-impl</artifactId> + <version>3.0.1-SNAPSHOT</version> + </parent> - <artifactId>appc</artifactId> + <artifactId>appc</artifactId> - <dependencies> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>com.google.code.gson</groupId> - <artifactId>gson</artifactId> - <scope>provided</scope> - </dependency> - </dependencies> - + <dependencies> + <dependency> + <groupId>com.google.code.gson</groupId> + <artifactId>gson</artifactId> + <scope>provided</scope> + </dependency> + </dependencies> </project> 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 @@ --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> - <artifactId>model-impl</artifactId> - <version>3.0.0-SNAPSHOT</version> - </parent> - - <artifactId>appclcm</artifactId> - - <dependencies> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>com.google.code.gson</groupId> - <artifactId>gson</artifactId> - <scope>provided</scope> - </dependency> - </dependencies> - +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> + <artifactId>model-impl</artifactId> + <version>3.0.1-SNAPSHOT</version> + </parent> + + <artifactId>appclcm</artifactId> + + <dependencies> + <dependency> + <groupId>com.google.code.gson</groupId> + <artifactId>gson</artifactId> + <scope>provided</scope> + </dependency> + </dependencies> + </project> 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 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <artifactId>model-impl</artifactId> - <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> - <version>3.0.0-SNAPSHOT</version> - </parent> + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>model-impl</artifactId> + <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> + <version>3.0.1-SNAPSHOT</version> + </parent> - <artifactId>cds</artifactId> - <name>${project.artifactId}</name> - <description>gRPC client implementation to send process message to CDS blueprint processor gRPC endpoint.</description> + <artifactId>cds</artifactId> + <name>${project.artifactId}</name> + <description>gRPC client implementation to send process message to CDS blueprint processor gRPC endpoint. + </description> - <properties> - <grpc.version>1.25.0</grpc.version> - </properties> + <properties> + <grpc.version>1.25.0</grpc.version> + </properties> - <dependencies> - <!-- CDS dependencies --> - <dependency> - <groupId>org.onap.ccsdk.cds.blueprintsprocessor.modules</groupId> - <artifactId>blueprint-proto</artifactId> - </dependency> - <dependency> - <groupId>io.grpc</groupId> - <artifactId>grpc-testing</artifactId> - <version>${grpc.version}</version> - <scope>test</scope> - </dependency> + <dependencies> + <!-- CDS dependencies --> + <dependency> + <groupId>org.onap.ccsdk.cds.blueprintsprocessor.modules</groupId> + <artifactId>blueprint-proto</artifactId> + </dependency> + <dependency> + <groupId>io.grpc</groupId> + <artifactId>grpc-testing</artifactId> + <version>${grpc.version}</version> + <scope>test</scope> + </dependency> - <!-- Policy dependencies --> - <dependency> - <groupId>org.onap.policy.common</groupId> - <artifactId>common-parameters</artifactId> - <version>${policy.common.version}</version> - </dependency> - <dependency> - <groupId>org.onap.policy.common</groupId> - <artifactId>policy-endpoints</artifactId> - <version>${policy.common.version}</version> - </dependency> - - <!-- junit dependencies --> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-core</artifactId> - <scope>test</scope> - </dependency> - </dependencies> + <!-- Policy dependencies --> + <dependency> + <groupId>org.onap.policy.common</groupId> + <artifactId>common-parameters</artifactId> + <version>${policy.common.version}</version> + </dependency> + <dependency> + <groupId>org.onap.policy.common</groupId> + <artifactId>policy-endpoints</artifactId> + <version>${policy.common.version}</version> + </dependency> + </dependencies> </project> 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 @@ --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> - <artifactId>model-impl</artifactId> - <version>3.0.0-SNAPSHOT</version> - </parent> + <parent> + <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> + <artifactId>model-impl</artifactId> + <version>3.0.1-SNAPSHOT</version> + </parent> - <artifactId>events</artifactId> + <artifactId>events</artifactId> - <dependencies> - <dependency> - <groupId>com.google.code.gson</groupId> - <artifactId>gson</artifactId> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - </dependencies> + <dependencies> + <dependency> + <groupId>com.google.code.gson</groupId> + <artifactId>gson</artifactId> + <scope>provided</scope> + </dependency> + </dependencies> </project> 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========================================================= --> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> + <artifactId>model-impl</artifactId> + <version>3.0.1-SNAPSHOT</version> + </parent> - <parent> - <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> - <artifactId>model-impl</artifactId> - <version>3.0.0-SNAPSHOT</version> - </parent> - - <artifactId>guard</artifactId> + <artifactId>guard</artifactId> </project> 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 @@ <parent> <groupId>org.onap.policy.models</groupId> <artifactId>policy-models-interactions</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.0.1-SNAPSHOT</version> </parent> <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> 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 @@ --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> - <artifactId>model-impl</artifactId> - <version>3.0.0-SNAPSHOT</version> - </parent> + <parent> + <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> + <artifactId>model-impl</artifactId> + <version>3.0.1-SNAPSHOT</version> + </parent> - <artifactId>rest</artifactId> + <artifactId>rest</artifactId> - <dependencies> - <dependency> - <groupId>com.google.code.gson</groupId> - <artifactId>gson</artifactId> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>org.apache.httpcomponents</groupId> - <artifactId>httpclient</artifactId> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.onap.policy.common</groupId> - <artifactId>policy-endpoints</artifactId> - <version>${policy.common.version}</version> - <scope>test</scope> - </dependency> - </dependencies> + <dependencies> + <dependency> + <groupId>com.google.code.gson</groupId> + <artifactId>gson</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.httpcomponents.client5</groupId> + <artifactId>httpclient5</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.onap.policy.common</groupId> + <artifactId>policy-endpoints</artifactId> + <version>${policy.common.version}</version> + <scope>test</scope> + </dependency> + </dependencies> </project> 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 { * <i>Note: Many REST endpoints will return a 400 error for delete requests with a non-empty body</i> * * @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========================================================= --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> - <parent> + <parent> <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> <artifactId>model-impl</artifactId> - <version>3.0.0-SNAPSHOT</version> - </parent> + <version>3.0.1-SNAPSHOT</version> + </parent> - <artifactId>sdnc</artifactId> + <artifactId>sdnc</artifactId> - <dependencies> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-core</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>com.google.code.gson</groupId> - <artifactId>gson</artifactId> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> - <artifactId>rest</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.onap.policy.common</groupId> - <artifactId>policy-endpoints</artifactId> - <version>${policy.common.version}</version> - <scope>provided</scope> - </dependency> - </dependencies> + <dependencies> + <dependency> + <groupId>com.google.code.gson</groupId> + <artifactId>gson</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> + <artifactId>rest</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.policy.common</groupId> + <artifactId>policy-endpoints</artifactId> + <version>${policy.common.version}</version> + <scope>provided</scope> + </dependency> + </dependencies> </project> 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 @@ --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> - <parent> + <parent> <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> <artifactId>model-impl</artifactId> - <version>3.0.0-SNAPSHOT</version> - </parent> + <version>3.0.1-SNAPSHOT</version> + </parent> - <artifactId>sdnr</artifactId> + <artifactId>sdnr</artifactId> - <dependencies> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>com.google.code.gson</groupId> - <artifactId>gson</artifactId> - <scope>provided</scope> - </dependency> - </dependencies> + <dependencies> + <dependency> + <groupId>com.google.code.gson</groupId> + <artifactId>gson</artifactId> + <scope>provided</scope> + </dependency> + </dependencies> </project> 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 @@ --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> - <parent> + <parent> <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> <artifactId>model-impl</artifactId> - <version>3.0.0-SNAPSHOT</version> - </parent> + <version>3.0.1-SNAPSHOT</version> + </parent> - <artifactId>so</artifactId> + <artifactId>so</artifactId> - <dependencies> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>com.google.code.gson</groupId> - <artifactId>gson</artifactId> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> - <artifactId>rest</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.onap.policy.common</groupId> - <artifactId>policy-endpoints</artifactId> - <version>${policy.common.version}</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>org.glassfish.jersey.containers</groupId> - <artifactId>jersey-container-grizzly2-http</artifactId> - <scope>test</scope> - </dependency> - </dependencies> + <dependencies> + <dependency> + <groupId>com.google.code.gson</groupId> + <artifactId>gson</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> + <artifactId>rest</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.policy.common</groupId> + <artifactId>policy-endpoints</artifactId> + <version>${policy.common.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.glassfish.jersey.containers</groupId> + <artifactId>jersey-container-grizzly2-http</artifactId> + <version>3.1.3</version> + <scope>test</scope> + </dependency> + </dependencies> </project> 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========================================================= --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> - <parent> + <parent> <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> <artifactId>model-impl</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.0.1-SNAPSHOT</version> </parent> - <artifactId>vfc</artifactId> + <artifactId>vfc</artifactId> - <dependencies> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-core</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>com.google.code.gson</groupId> - <artifactId>gson</artifactId> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> - <artifactId>rest</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.onap.policy.common</groupId> - <artifactId>policy-endpoints</artifactId> - <version>${policy.common.version}</version> - <scope>provided</scope> - </dependency> - </dependencies> + <dependencies> + <dependency> + <groupId>com.google.code.gson</groupId> + <artifactId>gson</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> + <artifactId>rest</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.policy.common</groupId> + <artifactId>policy-endpoints</artifactId> + <version>${policy.common.version}</version> + <scope>provided</scope> + </dependency> + </dependencies> </project> 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 @@ --> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.onap.policy.models</groupId> <artifactId>policy-models-interactions</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.0.1-SNAPSHOT</version> </parent> <groupId>org.onap.policy.models.policy-models-interactions</groupId> @@ -40,11 +40,6 @@ <version>${policy.common.version}</version> </dependency> <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> <artifactId>aai</artifactId> <version>${project.version}</version> 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<ExecutionServiceOutput> responseObserver = new StreamObserver<ExecutionServiceOutput>() { + StreamObserver<ExecutionServiceOutput> 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<Integer, String> httpDetails = new RestManager().post("http://localhost:6668/api/nslcm/v1/ns/1234567890/heal", "username", "password", - new HashMap<String, String>(), "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<Integer, String> httpDetails = new RestManager().get("http://localhost:6668/api/nslcm/v1/jobs/1234", - "username", "password", new HashMap<String, String>()); + "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========================================================= --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.onap.policy.models</groupId> - <artifactId>policy-models</artifactId> - <version>3.0.0-SNAPSHOT</version> - </parent> - <artifactId>policy-models-interactions</artifactId> - <packaging>pom</packaging> - <name>${project.artifactId}</name> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.onap.policy.models</groupId> + <artifactId>policy-models</artifactId> + <version>3.0.1-SNAPSHOT</version> + </parent> + <artifactId>policy-models-interactions</artifactId> + <packaging>pom</packaging> + <name>${project.artifactId}</name> - <properties> - <jacoco.dataFile>${project.basedir}/../../target/code-coverage/jacoco-ut.exec</jacoco.dataFile> - </properties> + <properties> + <jacoco.dataFile>${project.basedir}/../../target/code-coverage/jacoco-ut.exec</jacoco.dataFile> + </properties> - <modules> - <module>model-simulators</module> - <module>model-impl</module> - <module>model-actors</module> - </modules> + <modules> + <module>model-simulators</module> + <module>model-impl</module> + <module>model-actors</module> + </modules> </project> 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 @@ <!-- ============LICENSE_START======================================================= - Copyright (C) 2019-2021 Nordix Foundation. + Copyright (C) 2019-2021, 2023 Nordix Foundation. Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); @@ -20,12 +20,12 @@ --> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.onap.policy.models</groupId> <artifactId>policy-models</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.0.1-SNAPSHOT</version> </parent> <artifactId>policy-models-pap</artifactId> @@ -43,15 +43,10 @@ <artifactId>policy-models-base</artifactId> <version>${project.version}</version> </dependency> - <dependency> - <groupId>org.onap.policy.models</groupId> - <artifactId>policy-models-dao</artifactId> - <version>${project.version}</version> - </dependency> <dependency> - <groupId>org.assertj</groupId> - <artifactId>assertj-core</artifactId> - <scope>test</scope> + <groupId>org.onap.policy.models</groupId> + <artifactId>policy-models-dao</artifactId> + <version>${project.version}</version> </dependency> <dependency> <groupId>com.h2database</groupId> 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<PolicyAudit> { + @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 @@ <parent> <groupId>org.onap.policy.models</groupId> <artifactId>policy-models</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.0.1-SNAPSHOT</version> </parent> <artifactId>policy-models-pdp</artifactId> 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<Pdp>, 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<PdpGroup> { + @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<PdpPolicyStatus> { + @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<PdpSubGroup> { + @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<PdpGroup> getPdpGroups(@NonNull final PfDao dao, final String name) throws PfModelException { + public List<PdpGroup> 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<PdpGroup> 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<PdpGroup> createPdpGroups(@NonNull final PfDao dao, @NonNull final List<PdpGroup> pdpGroups) - throws PfModelException { + public List<PdpGroup> createPdpGroups(@NonNull final PfDao dao, @NonNull final List<PdpGroup> 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<PdpGroup> updatePdpGroups(@NonNull final PfDao dao, @NonNull final List<PdpGroup> pdpGroups) - throws PfModelException { + public List<PdpGroup> updatePdpGroups(@NonNull final PfDao dao, @NonNull final List<PdpGroup> 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<PdpPolicyStatus> getAllPolicyStatus(@NonNull final PfDao dao) - throws PfModelException { - + public List<PdpPolicyStatus> 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<PdpPolicyStatus> 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<PdpPolicyStatus> getGroupPolicyStatus(@NonNull final PfDao dao, @NonNull final String groupName) - throws PfModelException { - + public List<PdpPolicyStatus> 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 @@ <!-- ============LICENSE_START======================================================= Copyright (C) 2019-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 @@ ============LICENSE_END========================================================= --> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.onap.policy.models</groupId> <artifactId>policy-models</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.0.1-SNAPSHOT</version> </parent> <artifactId>policy-models-provider</artifactId> @@ -67,25 +68,11 @@ <artifactId>policy-models-pap</artifactId> <version>${project.version}</version> </dependency> - <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> <scope>test</scope> </dependency> - - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-all</artifactId> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.assertj</groupId> - <artifactId>assertj-core</artifactId> - <scope>test</scope> - </dependency> - <dependency> <groupId>org.awaitility</groupId> <artifactId>awaitility</artifactId> 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<ToscaServiceTemplate> getFilteredServiceTemplateList( - @NonNull ToscaEntityFilter<ToscaServiceTemplate> filter) throws PfModelException { + @NonNull ToscaEntityFilter<ToscaServiceTemplate> 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<Map<ToscaEntityKey, Map<String, Object>>> getNodeTemplateMetadataSets(@NonNull String name, - @NonNull String version) - throws PfModelException { + @NonNull String version) { return null; } @Override - public List<ToscaNodeTemplate> getToscaNodeTemplate(final String name, final String version) - throws PfModelException { + public List<ToscaNodeTemplate> getToscaNodeTemplate(final String name, final String version) { return null; } @Override - public List<PdpGroup> getPdpGroups(String name) throws PfModelException { + public List<PdpGroup> getPdpGroups(String name) { return Collections.emptyList(); } @Override - public List<PdpGroup> createPdpGroups(@NonNull List<PdpGroup> pdpGroups) throws PfModelException { + public List<PdpGroup> createPdpGroups(@NonNull List<PdpGroup> pdpGroups) { return Collections.emptyList(); } @Override - public List<PdpGroup> updatePdpGroups(@NonNull List<PdpGroup> pdpGroups) throws PfModelException { + public List<PdpGroup> updatePdpGroups(@NonNull List<PdpGroup> 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<ToscaPolicyType> getPolicyTypeList(String name, String version) throws PfModelException { + public List<ToscaPolicyType> getPolicyTypeList(String name, String version) { return Collections.emptyList(); } @Override - public ToscaServiceTemplate getFilteredPolicyTypes(@NonNull ToscaEntityFilter<ToscaPolicyType> filter) - throws PfModelException { + public ToscaServiceTemplate getFilteredPolicyTypes(@NonNull ToscaEntityFilter<ToscaPolicyType> filter) { return null; } @Override - public List<ToscaPolicyType> getFilteredPolicyTypeList(@NonNull ToscaEntityFilter<ToscaPolicyType> filter) - throws PfModelException { + public List<ToscaPolicyType> getFilteredPolicyTypeList(@NonNull ToscaEntityFilter<ToscaPolicyType> filter) { return Collections.emptyList(); } @Override - public List<ToscaPolicy> getPolicyList(String name, String version) throws PfModelException { + public List<ToscaPolicy> getPolicyList(String name, String version) { return Collections.emptyList(); } @Override - public ToscaServiceTemplate getFilteredPolicies(@NonNull ToscaTypedEntityFilter<ToscaPolicy> filter) - throws PfModelException { + public ToscaServiceTemplate getFilteredPolicies(@NonNull ToscaTypedEntityFilter<ToscaPolicy> filter) { return null; } @Override - public List<ToscaPolicy> getFilteredPolicyList(@NonNull ToscaTypedEntityFilter<ToscaPolicy> filter) - throws PfModelException { + public List<ToscaPolicy> getFilteredPolicyList(@NonNull ToscaTypedEntityFilter<ToscaPolicy> filter) { return Collections.emptyList(); } @Override - public List<PdpGroup> getFilteredPdpGroups(@NonNull PdpGroupFilter filter) throws PfModelException { + public List<PdpGroup> 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<PdpPolicyStatus> getAllPolicyStatus() throws PfModelException { + public List<PdpPolicyStatus> getAllPolicyStatus() { // Not implemented return null; } @Override - public List<PdpPolicyStatus> getAllPolicyStatus(@NonNull ToscaConceptIdentifierOptVersion policy) - throws PfModelException { + public List<PdpPolicyStatus> getAllPolicyStatus(@NonNull ToscaConceptIdentifierOptVersion policy) { // Not implemented return null; } @Override - public List<PdpPolicyStatus> getGroupPolicyStatus(@NonNull String groupName) throws PfModelException { + public List<PdpPolicyStatus> getGroupPolicyStatus(@NonNull String groupName) { // Not implemented return null; } @@ -259,7 +243,7 @@ public class DummyBadProviderImpl implements PolicyModelsProvider { } @Override - public List<ToscaServiceTemplate> getServiceTemplateList(String name, String version) throws PfModelException { + public List<ToscaServiceTemplate> 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<ToscaServiceTemplate> getServiceTemplateList(String name, String version) throws PfModelException { + public List<ToscaServiceTemplate> getServiceTemplateList(String name, String version) { return new ArrayList<>(); } @Override public List<ToscaServiceTemplate> getFilteredServiceTemplateList( - @NonNull ToscaEntityFilter<ToscaServiceTemplate> filter) throws PfModelException { + @NonNull ToscaEntityFilter<ToscaServiceTemplate> 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<ToscaPolicyType> getPolicyTypeList(final String name, final String version) throws PfModelException { + public List<ToscaPolicyType> getPolicyTypeList(final String name, final String version) { return new ArrayList<>(); } @Override - public ToscaServiceTemplate getFilteredPolicyTypes(ToscaEntityFilter<ToscaPolicyType> filter) - throws PfModelException { + public ToscaServiceTemplate getFilteredPolicyTypes(ToscaEntityFilter<ToscaPolicyType> 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<ToscaPolicy> getPolicyList(final String name, final String version) throws PfModelException { + public List<ToscaPolicy> getPolicyList(final String name, final String version) { return new ArrayList<>(); } @Override - public ToscaServiceTemplate getFilteredPolicies(ToscaTypedEntityFilter<ToscaPolicy> filter) - throws PfModelException { + public ToscaServiceTemplate getFilteredPolicies(ToscaTypedEntityFilter<ToscaPolicy> filter) { return getDummyResponse("dummyimpl/DummyToscaPolicyGetResponse.json"); } @Override - public List<ToscaPolicy> getFilteredPolicyList(ToscaTypedEntityFilter<ToscaPolicy> filter) throws PfModelException { + public List<ToscaPolicy> getFilteredPolicyList(ToscaTypedEntityFilter<ToscaPolicy> 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<Map<ToscaEntityKey, Map<String, Object>>> getNodeTemplateMetadataSets(@NonNull String name, - @NonNull String version) - throws PfModelException { + @NonNull String version) { return new ArrayList<>(); } @Override - public List<ToscaNodeTemplate> getToscaNodeTemplate(final String name, final String version) - throws PfModelException { + public List<ToscaNodeTemplate> getToscaNodeTemplate(final String name, final String version) { return new ArrayList<>(); } @Override - public List<PdpGroup> getPdpGroups(final String name) throws PfModelException { + public List<PdpGroup> getPdpGroups(final String name) { return new ArrayList<>(); } @Override - public List<PdpGroup> getFilteredPdpGroups(PdpGroupFilter filter) throws PfModelException { + public List<PdpGroup> getFilteredPdpGroups(PdpGroupFilter filter) { return new ArrayList<>(); } @Override - public List<PdpGroup> createPdpGroups(final List<PdpGroup> pdpGroups) throws PfModelException { + public List<PdpGroup> createPdpGroups(final List<PdpGroup> pdpGroups) { return new ArrayList<>(); } @Override - public List<PdpGroup> updatePdpGroups(final List<PdpGroup> pdpGroups) throws PfModelException { + public List<PdpGroup> updatePdpGroups(final List<PdpGroup> 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<PdpPolicyStatus> getAllPolicyStatus() throws PfModelException { + public List<PdpPolicyStatus> getAllPolicyStatus() { // Not implemented return new ArrayList<>(); } @Override - public List<PdpPolicyStatus> getAllPolicyStatus(@NonNull ToscaConceptIdentifierOptVersion policy) - throws PfModelException { + public List<PdpPolicyStatus> getAllPolicyStatus(@NonNull ToscaConceptIdentifierOptVersion policy) { // Not implemented return new ArrayList<>(); } @Override - public List<PdpPolicyStatus> getGroupPolicyStatus(String groupName) throws PfModelException { + public List<PdpPolicyStatus> 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 @@ <!-- ============LICENSE_START======================================================= - Copyright (C) 2019,2023 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"); @@ -25,7 +25,7 @@ <parent> <groupId>org.onap.policy.models.sim</groupId> <artifactId>policy-models-sim</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.0.1-SNAPSHOT</version> </parent> <artifactId>policy-models-sim-dmaap</artifactId> @@ -35,10 +35,6 @@ <dependencies> <dependency> - <groupId>commons-cli</groupId> - <artifactId>commons-cli</artifactId> - </dependency> - <dependency> <groupId>org.onap.policy.common</groupId> <artifactId>common-parameters</artifactId> <version>${policy.common.version}</version> @@ -46,6 +42,7 @@ <dependency> <groupId>org.onap.policy.common</groupId> <artifactId>utils</artifactId> + <version>${policy.common.version}</version> </dependency> <dependency> <groupId>org.onap.policy.common</groupId> @@ -64,9 +61,8 @@ <scope>test</scope> </dependency> <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-core</artifactId> - <scope>test</scope> + <groupId>commons-cli</groupId> + <artifactId>commons-cli</artifactId> </dependency> <dependency> <groupId>org.springframework</groupId> diff --git a/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/provider/DmaapSimProvider.java b/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/provider/DmaapSimProvider.java index 2119a6521..afbe10f51 100644 --- a/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/provider/DmaapSimProvider.java +++ b/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/provider/DmaapSimProvider.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. * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. * ================================================================================ @@ -22,6 +22,8 @@ package org.onap.policy.models.sim.dmaap.provider; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.Status; import java.util.Collections; import java.util.LinkedHashMap; import java.util.List; @@ -30,8 +32,6 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.Response.Status; import lombok.Getter; import lombok.Setter; import org.onap.policy.common.utils.services.ServiceManagerContainer; diff --git a/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/rest/BaseRestControllerV1.java b/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/rest/BaseRestControllerV1.java index 472a898c9..84b610a8f 100644 --- a/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/rest/BaseRestControllerV1.java +++ b/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/rest/BaseRestControllerV1.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,11 +20,11 @@ package org.onap.policy.models.sim.dmaap.rest; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.Response.ResponseBuilder; import java.net.HttpURLConnection; import java.util.UUID; -import javax.ws.rs.Consumes; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Response.ResponseBuilder; /** * Version v1 common superclass to provide DMaaP endpoints for the DMaaP simulator component. diff --git a/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/rest/CambriaMessageBodyHandler.java b/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/rest/CambriaMessageBodyHandler.java index 64ea29dca..0efab160b 100644 --- a/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/rest/CambriaMessageBodyHandler.java +++ b/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/rest/CambriaMessageBodyHandler.java @@ -3,6 +3,7 @@ * ONAP Policy Models * ================================================================================ * Copyright (C) 2019, 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,11 @@ package org.onap.policy.models.sim.dmaap.rest; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.MultivaluedMap; +import jakarta.ws.rs.ext.MessageBodyReader; +import jakarta.ws.rs.ext.Provider; import java.io.BufferedReader; import java.io.EOFException; import java.io.IOException; @@ -31,11 +37,6 @@ import java.lang.reflect.Type; import java.nio.charset.StandardCharsets; import java.util.LinkedList; import java.util.List; -import javax.ws.rs.Consumes; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.ext.MessageBodyReader; -import javax.ws.rs.ext.Provider; import org.apache.commons.io.IOUtils; /** @@ -146,7 +147,7 @@ public class CambriaMessageBodyHandler implements MessageBodyReader<Object> { if (chr == '.') { String text = bldr.toString().trim(); - return (text.isEmpty() ? 0 : Integer.valueOf(text)); + return (text.isEmpty() ? 0 : Integer.parseInt(text)); } if (!Character.isDigit(chr)) { diff --git a/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/rest/DmaapSimRestControllerV1.java b/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/rest/DmaapSimRestControllerV1.java index 17b7529f6..5ed04f1a3 100644 --- a/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/rest/DmaapSimRestControllerV1.java +++ b/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/rest/DmaapSimRestControllerV1.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. * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. * ================================================================================ @@ -22,15 +22,15 @@ package org.onap.policy.models.sim.dmaap.rest; -import javax.ws.rs.Consumes; -import javax.ws.rs.DefaultValue; -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.QueryParam; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.DefaultValue; +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.QueryParam; +import jakarta.ws.rs.core.Response; import org.onap.policy.models.sim.dmaap.provider.DmaapSimProvider; /** diff --git a/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/rest/TextMessageBodyHandler.java b/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/rest/TextMessageBodyHandler.java index c72b7482a..6d3bd730e 100644 --- a/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/rest/TextMessageBodyHandler.java +++ b/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/rest/TextMessageBodyHandler.java @@ -3,6 +3,7 @@ * ONAP Policy Models * ================================================================================ * Copyright (C) 2019, 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,11 @@ package org.onap.policy.models.sim.dmaap.rest; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.MultivaluedMap; +import jakarta.ws.rs.ext.MessageBodyReader; +import jakarta.ws.rs.ext.Provider; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; @@ -29,11 +35,6 @@ import java.lang.reflect.Type; import java.nio.charset.StandardCharsets; import java.util.LinkedList; import java.util.List; -import javax.ws.rs.Consumes; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.ext.MessageBodyReader; -import javax.ws.rs.ext.Provider; /** * Provider that decodes "text/plain" messages. diff --git a/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/models/sim/dmaap/provider/DmaapSimProviderTest.java b/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/models/sim/dmaap/provider/DmaapSimProviderTest.java index 3d72f2e4c..f82ef03f2 100644 --- a/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/models/sim/dmaap/provider/DmaapSimProviderTest.java +++ b/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/models/sim/dmaap/provider/DmaapSimProviderTest.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019-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,8 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.Status; import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -39,8 +42,6 @@ import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.Response.Status; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -104,7 +105,7 @@ public class DmaapSimProviderTest { } /** - * Verifies that the constructor adds all of the expected actions to the service + * Verifies that the constructor adds all the expected actions to the service * manager container. */ @Test @@ -202,7 +203,7 @@ public class DmaapSimProviderTest { public void testProcessDmaapMessageGet_Ex() throws InterruptedException { BlockingQueue<Response> respQueue = new LinkedBlockingQueue<>(); - // put in a background thread so it doesn't interrupt the tester thread + // put in a background thread, so it doesn't interrupt the tester thread new Thread(() -> { try { when(data1.read(any(), anyInt(), anyLong())).thenThrow(new InterruptedException(EXPECTED_EXCEPTION)); @@ -240,15 +241,15 @@ public class DmaapSimProviderTest { @Test public void testMakeTimerPool() { - // use a real provider so we can test the real makeTimer() method + // use a real provider, so we can test the real makeTimer() method DmaapSimProvider prov2 = new DmaapSimProvider(params); prov2.start(); - assertThatCode(() -> prov2.stop()).doesNotThrowAnyException(); + assertThatCode(prov2::stop).doesNotThrowAnyException(); } @Test public void testMakeTopicData() { - // use a real provider so we can test the real makeTopicData() method + // use a real provider, so we can test the real makeTopicData() method DmaapSimProvider prov2 = new DmaapSimProvider(params); assertThatCode(() -> prov2.processDmaapMessageGet(TOPIC1, CONSUMER1, CONSUMER_ID1, 0, 0)) .doesNotThrowAnyException(); @@ -277,14 +278,11 @@ public class DmaapSimProviderTest { @Override protected TopicData makeTopicData(String topicName) { - switch (topicName) { - case TOPIC1: - return data1; - case TOPIC2: - return data2; - default: - throw new IllegalArgumentException("unknown topic name: " + topicName); - } + return switch (topicName) { + case TOPIC1 -> data1; + case TOPIC2 -> data2; + default -> throw new IllegalArgumentException("unknown topic name: " + topicName); + }; } } } diff --git a/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/models/sim/dmaap/rest/BaseRestControllerV1Test.java b/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/models/sim/dmaap/rest/BaseRestControllerV1Test.java index 5cba78355..0d24436f7 100644 --- a/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/models/sim/dmaap/rest/BaseRestControllerV1Test.java +++ b/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/models/sim/dmaap/rest/BaseRestControllerV1Test.java @@ -3,6 +3,7 @@ * ONAP PAP * ================================================================================ * 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,9 +24,9 @@ package org.onap.policy.models.sim.dmaap.rest; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.ResponseBuilder; import java.util.UUID; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.Response.ResponseBuilder; import org.junit.Before; import org.junit.Test; diff --git a/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/models/sim/dmaap/rest/CambriaMessageBodyHandlerTest.java b/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/models/sim/dmaap/rest/CambriaMessageBodyHandlerTest.java index 5d9186c75..ea2a4a530 100644 --- a/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/models/sim/dmaap/rest/CambriaMessageBodyHandlerTest.java +++ b/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/models/sim/dmaap/rest/CambriaMessageBodyHandlerTest.java @@ -3,6 +3,7 @@ * ONAP Policy 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. @@ -25,13 +26,13 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import jakarta.ws.rs.core.MediaType; import java.io.ByteArrayInputStream; import java.io.EOFException; import java.io.IOException; import java.io.InputStream; import java.nio.charset.StandardCharsets; import java.util.List; -import javax.ws.rs.core.MediaType; import org.junit.Before; import org.junit.Test; diff --git a/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/models/sim/dmaap/rest/DmaapSimRestControllerV1Test.java b/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/models/sim/dmaap/rest/DmaapSimRestControllerV1Test.java index dd938d310..fd9397e34 100644 --- a/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/models/sim/dmaap/rest/DmaapSimRestControllerV1Test.java +++ b/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/models/sim/dmaap/rest/DmaapSimRestControllerV1Test.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. * Modifications Copyright (C) 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. @@ -22,10 +23,10 @@ package org.onap.policy.models.sim.dmaap.rest; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.assertEquals; +import jakarta.ws.rs.core.Response; import java.io.File; import java.util.Arrays; import java.util.Map; -import javax.ws.rs.core.Response; import org.junit.Before; import org.junit.Test; import org.onap.policy.common.utils.coder.Coder; @@ -43,7 +44,7 @@ public class DmaapSimRestControllerV1Test { private static final String CONSUMER = "my-consumer"; private static final String CONSUMER_ID = "my-id"; - private static Coder coder = new StandardCoder(); + private static final Coder coder = new StandardCoder(); private DmaapSimRestControllerV1 rest; diff --git a/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/models/sim/dmaap/rest/TextMessageBodyHandlerTest.java b/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/models/sim/dmaap/rest/TextMessageBodyHandlerTest.java index 2dfbae980..50db94e5c 100644 --- a/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/models/sim/dmaap/rest/TextMessageBodyHandlerTest.java +++ b/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/models/sim/dmaap/rest/TextMessageBodyHandlerTest.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * 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. @@ -22,12 +23,12 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import jakarta.ws.rs.core.MediaType; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.nio.charset.StandardCharsets; import java.util.List; -import javax.ws.rs.core.MediaType; import org.junit.Before; import org.junit.Test; diff --git a/models-sim/packages/models-simulator-docker/pom.xml b/models-sim/packages/models-simulator-docker/pom.xml index 773158ecc..4a7ba73d8 100644 --- a/models-sim/packages/models-simulator-docker/pom.xml +++ b/models-sim/packages/models-simulator-docker/pom.xml @@ -21,12 +21,12 @@ --> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.onap.policy.models.sim</groupId> <artifactId>models-sim-packages</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.0.1-SNAPSHOT</version> </parent> <artifactId>models-simulator-docker</artifactId> @@ -46,7 +46,7 @@ <docker.push.registry>nexus3.onap.org:10003</docker.push.registry> <docker.contextDir>${project.basedir}/src/main/docker</docker.contextDir> <maven.build.timestamp.format>yyyyMMdd'T'HHmm</maven.build.timestamp.format> - <!-- There is no code in this sub-module, only holds interfaces. So skip sonar. --> + <!-- There is no code in this submodule, only holds interfaces. So skip sonar. --> <sonar.skip>true</sonar.skip> </properties> @@ -101,7 +101,8 @@ <dependencySets> <dependencySet> <includes> - <include>org.onap.policy.models.sim:models-simulator-tarball</include> + <include>org.onap.policy.models.sim:models-simulator-tarball + </include> </includes> <outputDirectory>/lib</outputDirectory> <outputFileNameMapping>models-simulator.tar.gz</outputFileNameMapping> 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 @@ --> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.onap.policy.models.sim</groupId> - <artifactId>models-sim-packages</artifactId> - <version>3.0.0-SNAPSHOT</version> - </parent> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.onap.policy.models.sim</groupId> + <artifactId>models-sim-packages</artifactId> + <version>3.0.1-SNAPSHOT</version> + </parent> - <artifactId>models-simulator-tarball</artifactId> + <artifactId>models-simulator-tarball</artifactId> - <name>${project.artifactId}</name> - <description>A module that runs all "simulators", including DMaaP.</description> + <name>${project.artifactId}</name> + <description>A module that runs all "simulators", including DMaaP.</description> - <properties> - <!-- There is no code in this sub-module, only holds interfaces. So skip sonar. --> - <sonar.skip>true</sonar.skip> - </properties> + <properties> + <!-- There is no code in this submodule, only holds interfaces. So skip sonar. --> + <sonar.skip>true</sonar.skip> + </properties> - <dependencies> - <dependency> - <groupId>org.onap.policy.models.sim</groupId> - <artifactId>policy-models-simulators</artifactId> - <version>${project.version}</version> - </dependency> - </dependencies> + <dependencies> + <dependency> + <groupId>org.onap.policy.models.sim</groupId> + <artifactId>policy-models-simulators</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> - <build> - <resources> - <!-- Output the version of the service --> - <resource> - <directory>src/main/resources</directory> - <filtering>true</filtering> - <includes> - <include>**/version.txt</include> - </includes> - </resource> - <resource> - <directory>src/main/resources</directory> - <filtering>false</filtering> - <excludes> - <exclude>**/version.txt</exclude> - </excludes> - </resource> - </resources> + <build> + <resources> + <!-- Output the version of the service --> + <resource> + <directory>src/main/resources</directory> + <filtering>true</filtering> + <includes> + <include>**/version.txt</include> + </includes> + </resource> + <resource> + <directory>src/main/resources</directory> + <filtering>false</filtering> + <excludes> + <exclude>**/version.txt</exclude> + </excludes> + </resource> + </resources> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-assembly-plugin</artifactId> - <executions> - <execution> - <id>generate-complete-tar</id> - <phase>package</phase> - <goals> - <goal>single</goal> - </goals> - <configuration> - <descriptors> - <descriptor>src/main/assembly.xml</descriptor> - </descriptors> - <finalName>${project.artifactId}-${project.version}</finalName> - </configuration> - </execution> - </executions> - </plugin> - </plugins> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-assembly-plugin</artifactId> + <executions> + <execution> + <id>generate-complete-tar</id> + <phase>package</phase> + <goals> + <goal>single</goal> + </goals> + <configuration> + <descriptors> + <descriptor>src/main/assembly.xml</descriptor> + </descriptors> + <finalName>${project.artifactId}-${project.version}</finalName> + </configuration> + </execution> + </executions> + </plugin> + </plugins> - </build> + </build> </project> 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 @@ --> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.onap.policy.models.sim</groupId> <artifactId>policy-models-sim</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.0.1-SNAPSHOT</version> </parent> <artifactId>models-sim-packages</artifactId> @@ -35,7 +35,7 @@ <description>The module for packaging the policy-models-simulator component.</description> <properties> - <!-- There is no code in this sub-module, only holds interfaces. So skip sonar. --> + <!-- There is no code in this submodule, only holds interfaces. So skip sonar. --> <sonar.skip>true</sonar.skip> </properties> 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 @@ -<?xml version="1.0"?> -<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.onap.policy.models.sim</groupId> - <artifactId>policy-models-sim</artifactId> - <version>3.0.0-SNAPSHOT</version> - </parent> - <artifactId>policy-models-sim-pdp</artifactId> - <name>policy-models-sim-pdp</name> +<!-- + ============LICENSE_START======================================================= + Copyright (C) 2019 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. + You may obtain a copy of the License at -<description>A module that implements a simulator for PDP.</description> - <dependencies> + 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. + See the License for the specific language governing permissions and + limitations under the License. + + SPDX-License-Identifier: Apache-2.0 + ============LICENSE_END========================================================= +--> + +<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" + xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.onap.policy.models.sim</groupId> + <artifactId>policy-models-sim</artifactId> + <version>3.0.1-SNAPSHOT</version> + </parent> + <artifactId>policy-models-sim-pdp</artifactId> + <name>policy-models-sim-pdp</name> + + <description>A module that implements a simulator for PDP.</description> + <dependencies> <dependency> <groupId>org.onap.policy.models</groupId> <artifactId>policy-models-pdp</artifactId> @@ -37,23 +58,6 @@ <artifactId>common-parameters</artifactId> <version>${policy.common.version}</version> </dependency> - - <!--test dependencies --> - <dependency> - <groupId>org.assertj</groupId> - <artifactId>assertj-core</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-core</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> </dependencies> <build> <resources> 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<TopicSink> topicSinks; // topics to which pdp sends pdp status - private List<TopicSource> topicSources; // topics to which pdp listens to for messages from pap. + private final List<TopicSink> topicSinks; // topics to which pdp sends pdp status + private final List<TopicSource> 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<ToscaPolicy> 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 @@ --> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.onap.policy.models.sim</groupId> <artifactId>policy-models-sim</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.0.1-SNAPSHOT</version> </parent> <artifactId>policy-models-simulators</artifactId> @@ -42,15 +42,5 @@ <artifactId>simulators</artifactId> <version>${project.version}</version> </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-core</artifactId> - <scope>test</scope> - </dependency> </dependencies> </project> 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========================================================= --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.onap.policy.models</groupId> - <artifactId>policy-models</artifactId> - <version>3.0.0-SNAPSHOT</version> - </parent> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.onap.policy.models</groupId> + <artifactId>policy-models</artifactId> + <version>3.0.1-SNAPSHOT</version> + </parent> - <groupId>org.onap.policy.models.sim</groupId> - <artifactId>policy-models-sim</artifactId> - <packaging>pom</packaging> - <name>${project.artifactId}</name> + <groupId>org.onap.policy.models.sim</groupId> + <artifactId>policy-models-sim</artifactId> + <packaging>pom</packaging> + <name>${project.artifactId}</name> - <properties> - <jacoco.dataFile>${project.basedir}/../../target/code-coverage/jacoco-ut.exec</jacoco.dataFile> - </properties> + <properties> + <jacoco.dataFile>${project.basedir}/../../target/code-coverage/jacoco-ut.exec</jacoco.dataFile> + </properties> - <modules> - <module>models-sim-dmaap</module> - <module>policy-models-sim-pdp</module> - <module>policy-models-simulators</module> - <module>packages</module> - </modules> + <modules> + <module>models-sim-dmaap</module> + <module>policy-models-sim-pdp</module> + <module>policy-models-simulators</module> + <module>packages</module> + </modules> </project> 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========================================================= --> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.onap.policy.models</groupId> <artifactId>policy-models</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.0.1-SNAPSHOT</version> </parent> <artifactId>policy-models-tosca</artifactId> 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 <T> List<T> asConceptList(final List<Map<String, T>> listOfMaps) { List<T> returnList = new ArrayList<>(); for (Map<String, T> 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<ToscaCapabilityAssignment> { + @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<List<Map<String, ToscaCapabilityAssignment>>> { 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<ToscaCapabilityType> { + @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<JpaToscaCapabilityType, ToscaCapabilityType> { 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<JpaToscaCapabili } /** - * 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/JpaToscaConstraintInRange.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintInRange.java index 14e9db522..ea4810f3c 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintInRange.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintInRange.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,9 +20,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; @@ -36,6 +37,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConstraint; @EqualsAndHashCode(callSuper = false) @ToString public class JpaToscaConstraintInRange extends JpaToscaConstraint { + @Serial private static final long serialVersionUID = -5060193250508635456L; @ElementCollection @@ -81,10 +83,7 @@ public class JpaToscaConstraintInRange 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/JpaToscaConstraintLogical.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintLogical.java index e8d16a705..5d4577d0b 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintLogical.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintLogical.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,7 +21,8 @@ package org.onap.policy.models.tosca.simple.concepts; -import javax.persistence.Column; +import jakarta.persistence.Column; +import java.io.Serial; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NonNull; @@ -35,6 +36,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConstraint; @EqualsAndHashCode(callSuper = false) @ToString public class JpaToscaConstraintLogical extends JpaToscaConstraint { + @Serial private static final long serialVersionUID = -2730203215911880756L; @Column @@ -78,28 +80,14 @@ public class JpaToscaConstraintLogical extends JpaToscaConstraint { } switch (operation) { - case EQ: - toscaConstraint.setEqual(compareTo); - break; - - case GT: - toscaConstraint.setGreaterThan(compareTo); - break; - - case GE: - toscaConstraint.setGreaterOrEqual(compareTo); - break; - - case LT: - toscaConstraint.setLessThan(compareTo); - break; - - case LE: - toscaConstraint.setLessOrEqual(compareTo); - break; - - default: - // Can't happen + case EQ -> 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<ToscaDataType> { + @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<JpaToscaDataType, ToscaDataType> { + @Serial private static final long serialVersionUID = 2941102271022190348L; public static final String DEFAULT_NAME = "ToscaDataTypesSimple"; @@ -73,7 +76,7 @@ public class JpaToscaDataTypes extends PfConceptContainer<JpaToscaDataType, Tosc } /** - * 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 @@ -102,7 +105,7 @@ public class JpaToscaDataTypes extends PfConceptContainer<JpaToscaDataType, Tosc } @Override - public BeanValidationResult validate(String fieldName) { + public BeanValidationResult validate(@NonNull String fieldName) { BeanValidationResult result = super.validate(fieldName); for (JpaToscaDataType dataType : this.getConceptMap().values()) { diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEntityType.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEntityType.java index b9acde26c..e23ac42c2 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEntityType.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEntityType.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019-2020,2022-2023 Nordix Foundation. + * Copyright (C) 2019-2020, 2022-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,18 +21,18 @@ package org.onap.policy.models.tosca.simple.concepts; +import jakarta.persistence.AttributeOverride; +import jakarta.persistence.Column; +import jakarta.persistence.ElementCollection; +import jakarta.persistence.EmbeddedId; +import jakarta.persistence.Lob; +import jakarta.persistence.MappedSuperclass; +import jakarta.ws.rs.core.Response; +import java.io.Serial; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.TreeMap; -import javax.persistence.AttributeOverride; -import javax.persistence.AttributeOverrides; -import javax.persistence.Column; -import javax.persistence.ElementCollection; -import javax.persistence.EmbeddedId; -import javax.persistence.Lob; -import javax.persistence.MappedSuperclass; -import javax.ws.rs.core.Response; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NonNull; @@ -57,6 +57,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaEntity; @Data @EqualsAndHashCode(callSuper = false) public class JpaToscaEntityType<T extends ToscaEntity> extends PfConcept implements PfAuthorative<T> { + @Serial private static final long serialVersionUID = -1330661834220739393L; private static final StandardCoder STANDARD_CODER = new StandardCoder(); @@ -68,10 +69,8 @@ public class JpaToscaEntityType<T extends ToscaEntity> 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. * * <p>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<ToscaNodeTemplate> { + @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<JpaToscaNodeTemplate, ToscaNodeTemplate> { 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<JpaToscaNodeTempla } /** - * 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 @@ -99,7 +102,7 @@ public class JpaToscaNodeTemplates extends PfConceptContainer<JpaToscaNodeTempla } @Override - public BeanValidationResult validate(String fieldName) { + public BeanValidationResult validate(@NonNull String fieldName) { BeanValidationResult result = super.validate(fieldName); // Check that all ancestors of this node template exist diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeType.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeType.java index f295accab..a7342d2f8 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeType.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeType.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2020,2023 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,16 +21,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.OneToOne; +import jakarta.persistence.Table; +import java.io.Serial; 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.NoArgsConstructor; @@ -54,15 +54,14 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeType; @EqualsAndHashCode(callSuper = true) @NoArgsConstructor public class JpaToscaNodeType extends JpaToscaWithToscaProperties<ToscaNodeType> { + @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<JpaToscaNodeType, ToscaNodeType> { 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<JpaToscaNodeType, Tosc } /** - * 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 @@ -99,7 +102,7 @@ public class JpaToscaNodeTypes extends PfConceptContainer<JpaToscaNodeType, Tosc } @Override - public BeanValidationResult validate(String fieldName) { + public BeanValidationResult validate(@NonNull String fieldName) { BeanValidationResult result = super.validate(fieldName); // Check that all ancestors of this policy type exist diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaParameter.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaParameter.java index 552d9c15c..dfa8240ee 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaParameter.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaParameter.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. * Modifications Copyright (C) 2022 Bell Canada. All rights reserved. * ================================================================================ @@ -22,9 +22,9 @@ package org.onap.policy.models.tosca.simple.concepts; +import jakarta.persistence.Column; +import jakarta.persistence.EmbeddedId; 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/JpaToscaPolicies.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicies.java index 7c1022c84..caf999590 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicies.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicies.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.PfAuthorative; @@ -51,6 +53,7 @@ import org.onap.policy.models.tosca.utils.ToscaUtils; @EqualsAndHashCode(callSuper = true) public class JpaToscaPolicies extends PfConceptContainer<JpaToscaPolicy, ToscaPolicy> implements PfAuthorative<List<Map<String, ToscaPolicy>>> { + @Serial private static final long serialVersionUID = -7526648702327776101L; public static final String DEFAULT_NAME = "ToscaPoliciesSimple"; @@ -104,7 +107,7 @@ public class JpaToscaPolicies extends PfConceptContainer<JpaToscaPolicy, ToscaPo } @Override - public BeanValidationResult validate(String fieldName) { + public BeanValidationResult validate(@NonNull String fieldName) { BeanValidationResult result = super.validate(fieldName); for (JpaToscaPolicy policy : this.getConceptMap().values()) { diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicy.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicy.java index 92e0faea6..eb573ca51 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicy.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicy.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,16 +24,17 @@ package org.onap.policy.models.tosca.simple.concepts; +import jakarta.persistence.CollectionTable; +import jakarta.persistence.ElementCollection; +import jakarta.persistence.Entity; +import jakarta.persistence.Inheritance; +import jakarta.persistence.InheritanceType; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.Table; +import jakarta.ws.rs.core.Response; +import java.io.Serial; import java.util.LinkedHashMap; import java.util.List; -import javax.persistence.CollectionTable; -import javax.persistence.ElementCollection; -import javax.persistence.Entity; -import javax.persistence.Inheritance; -import javax.persistence.InheritanceType; -import javax.persistence.JoinColumn; -import javax.persistence.Table; -import javax.ws.rs.core.Response; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NonNull; @@ -61,6 +62,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy; @Data @EqualsAndHashCode(callSuper = true) public class JpaToscaPolicy extends JpaToscaWithTypeAndStringProperties<ToscaPolicy> { + @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<ToscaPol } @Override - public BeanValidationResult validate(String fieldName) { + public BeanValidationResult validate(@NonNull String fieldName) { BeanValidationResult result = super.validate(fieldName); validateKeyVersionNotNull(result, "key", getKey()); diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyType.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyType.java index dfdf7ed9b..14502c64c 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyType.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyType.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. * Modifications Copyright (C) 2022 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -24,15 +24,16 @@ package org.onap.policy.models.tosca.simple.concepts; +import jakarta.persistence.CollectionTable; +import jakarta.persistence.ElementCollection; +import jakarta.persistence.Entity; +import jakarta.persistence.Inheritance; +import jakarta.persistence.InheritanceType; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.Lob; +import jakarta.persistence.Table; +import java.io.Serial; import java.util.List; -import javax.persistence.CollectionTable; -import javax.persistence.ElementCollection; -import javax.persistence.Entity; -import javax.persistence.Inheritance; -import javax.persistence.InheritanceType; -import javax.persistence.JoinColumn; -import javax.persistence.Lob; -import javax.persistence.Table; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; @@ -60,6 +61,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyType; @EqualsAndHashCode(callSuper = true) @NoArgsConstructor public class JpaToscaPolicyType extends JpaToscaWithToscaProperties<ToscaPolicyType> { + @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<JpaToscaPolicyType, ToscaPolicyType> { + @Serial private static final long serialVersionUID = -4157979965271220098L; public static final String DEFAULT_NAME = "ToscaPolicyTypesSimple"; @@ -73,7 +76,7 @@ public class JpaToscaPolicyTypes extends PfConceptContainer<JpaToscaPolicyType, } /** - * 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 @@ -102,7 +105,7 @@ public class JpaToscaPolicyTypes extends PfConceptContainer<JpaToscaPolicyType, } @Override - public BeanValidationResult validate(String fieldName) { + public BeanValidationResult validate(@NonNull String fieldName) { BeanValidationResult result = super.validate(fieldName); // Check that all ancestors of this policy type exist diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaProperty.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaProperty.java index 73b9faba8..0ef8ffbaa 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaProperty.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaProperty.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,13 +24,14 @@ package org.onap.policy.models.tosca.simple.concepts; +import jakarta.persistence.Column; +import jakarta.persistence.ElementCollection; +import jakarta.persistence.EmbeddedId; +import java.io.Serial; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import javax.persistence.Column; -import javax.persistence.ElementCollection; -import javax.persistence.EmbeddedId; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NonNull; @@ -58,6 +59,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaProperty.Status; @Data @EqualsAndHashCode(callSuper = false) public class JpaToscaProperty extends PfConcept implements PfAuthorative<ToscaProperty> { + @Serial private static final long serialVersionUID = 1675770231921107988L; @EmbeddedId @@ -243,10 +245,7 @@ public class JpaToscaProperty extends PfConcept implements PfAuthorative<ToscaPr } @Override - public int compareTo(final PfConcept otherConcept) { - if (otherConcept == null) { - return -1; - } + public int compareTo(@NonNull final PfConcept otherConcept) { if (this == otherConcept) { return 0; } diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaRelationshipType.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaRelationshipType.java index 118211153..f542192b9 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaRelationshipType.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaRelationshipType.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.ToscaRelationshipType; @EqualsAndHashCode(callSuper = true) @NoArgsConstructor public class JpaToscaRelationshipType extends JpaToscaWithToscaProperties<ToscaRelationshipType> { + @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<JpaToscaRelationshipType, ToscaRelationshipType> { 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<JpaToscaRelati } /** - * 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 @@ -100,7 +103,7 @@ public class JpaToscaRelationshipTypes extends PfConceptContainer<JpaToscaRelati } @Override - public BeanValidationResult validate(String fieldName) { + public BeanValidationResult validate(@NonNull String fieldName) { BeanValidationResult result = super.validate(fieldName); // Check that all ancestors of this policy type exist diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaRequirement.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaRequirement.java index f2cf14cb7..18d9d0067 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaRequirement.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaRequirement.java @@ -3,7 +3,7 @@ * ONAP Requirement 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,14 +23,15 @@ package org.onap.policy.models.tosca.simple.concepts; +import jakarta.persistence.Column; +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.Column; -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.NonNull; @@ -55,6 +56,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaRequirement; @EqualsAndHashCode(callSuper = true) public class JpaToscaRequirement extends JpaToscaWithTypeAndStringProperties<ToscaRequirement> { + @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<JpaToscaRequirement, ToscaRequirement> implements PfAuthorative<List<Map<String, ToscaRequirement>>> { + @Serial private static final long serialVersionUID = -7526648702327776101L; public static final String DEFAULT_NAME = "ToscaRequirementsSimple"; @@ -75,7 +78,7 @@ public class JpaToscaRequirements extends PfConceptContainer<JpaToscaRequirement } /** - * 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 @@ -104,7 +107,7 @@ public class JpaToscaRequirements extends PfConceptContainer<JpaToscaRequirement } @Override - public BeanValidationResult validate(String fieldName) { + public BeanValidationResult validate(@NonNull String fieldName) { BeanValidationResult result = super.validate(fieldName); for (JpaToscaRequirement requirement : this.getConceptMap().values()) { diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaSchemaDefinition.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaSchemaDefinition.java index 75941b28f..b41716579 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaSchemaDefinition.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaSchemaDefinition.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,11 +23,12 @@ package org.onap.policy.models.tosca.simple.concepts; +import jakarta.persistence.Column; +import jakarta.persistence.ElementCollection; +import java.io.Serial; import java.io.Serializable; import java.util.ArrayList; import java.util.List; -import javax.persistence.Column; -import javax.persistence.ElementCollection; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; @@ -58,6 +59,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaSchemaDefinition; public class JpaToscaSchemaDefinition extends Validated implements PfAuthorative<ToscaSchemaDefinition>, Serializable, Comparable<JpaToscaSchemaDefinition> { + @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<JpaToscaConstraint> newConstraints = new ArrayList<>(); - for (final JpaToscaConstraint constraint : constraints) { - newConstraints.add(constraint); // Constraints are immutable - } + // Constraints are immutable + final List<JpaToscaConstraint> 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<ToscaServiceTemplate> - implements PfAuthorative<ToscaServiceTemplate> { + implements PfAuthorative<ToscaServiceTemplate> { + @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<ToscaServiceTemp private String toscaDefinitionsVersion; @OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true) - @JoinColumns({ - @JoinColumn(name = "dataTypesName", referencedColumnName = "name"), - @JoinColumn(name = "dataTypesVersion", referencedColumnName = "version") - }) + @JoinColumn(name = "dataTypesName", referencedColumnName = "name") + @JoinColumn(name = "dataTypesVersion", referencedColumnName = "version") @SerializedName("data_types") @Valid private JpaToscaDataTypes dataTypes; @OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true) - @JoinColumns({ - @JoinColumn(name = "capabilityTypesName", referencedColumnName = "name"), - @JoinColumn(name = "capabilityTypesVersion", referencedColumnName = "version") - }) + @JoinColumn(name = "capabilityTypesName", referencedColumnName = "name") + @JoinColumn(name = "capabilityTypesVersion", referencedColumnName = "version") @SerializedName("capability_types") @Valid private JpaToscaCapabilityTypes capabilityTypes; @OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true) - @JoinColumns({ - @JoinColumn(name = "relationshipTypesName", referencedColumnName = "name"), - @JoinColumn(name = "relationshipTypesVersion", referencedColumnName = "version") - }) + @JoinColumn(name = "relationshipTypesName", referencedColumnName = "name") + @JoinColumn(name = "relationshipTypesVersion", referencedColumnName = "version") @SerializedName("relationship_types") @Valid private JpaToscaRelationshipTypes relationshipTypes; @OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true) - @JoinColumns({ - @JoinColumn(name = "nodeTypesName", referencedColumnName = "name"), - @JoinColumn(name = "nodeTypesVersion", referencedColumnName = "version") - }) + @JoinColumn(name = "nodeTypesName", referencedColumnName = "name") + @JoinColumn(name = "nodeTypesVersion", referencedColumnName = "version") @SerializedName("node_types") @Valid private JpaToscaNodeTypes nodeTypes; @OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true) - @JoinColumns({ - @JoinColumn(name = "policyTypesName", referencedColumnName = "name"), - @JoinColumn(name = "policyTypesVersion", referencedColumnName = "version") - }) + @JoinColumn(name = "policyTypesName", referencedColumnName = "name") + @JoinColumn(name = "policyTypesVersion", referencedColumnName = "version") @SerializedName("policy_types") @Valid private JpaToscaPolicyTypes policyTypes; @OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true) - @JoinColumns({ - @JoinColumn(name = "topologyTemplateParentKeyName", referencedColumnName = "parentKeyName"), - @JoinColumn(name = "topologyTemplateParentKeyVersion", referencedColumnName = "parentKeyVersion"), - @JoinColumn(name = "topologyTemplateParentLocalName", referencedColumnName = "parentLocalName"), - @JoinColumn(name = "topologyTemplateLocalName", referencedColumnName = "localName") - }) + @JoinColumn(name = "topologyTemplateParentKeyName", referencedColumnName = "parentKeyName") + @JoinColumn(name = "topologyTemplateParentKeyVersion", referencedColumnName = "parentKeyVersion") + @JoinColumn(name = "topologyTemplateParentLocalName", referencedColumnName = "parentLocalName") + @JoinColumn(name = "topologyTemplateLocalName", referencedColumnName = "localName") @SerializedName("topology_template") @Valid private JpaToscaTopologyTemplate topologyTemplate; @@ -148,13 +137,13 @@ public class JpaToscaServiceTemplate extends JpaToscaEntityType<ToscaServiceTemp * @param key the key */ public JpaToscaServiceTemplate(@NonNull final PfConceptKey key) { - this(key, DEFAULT_TOSCA_DEFINTIONS_VERISON); + this(key, DEFAULT_TOSCA_DEFINITIONS_VERSION); } /** * The full constructor creates a {@link JpaToscaServiceTemplate} object with all mandatory parameters. * - * @param key the key + * @param key the key * @param toscaDefinitionsVersion the TOSCA version string */ public JpaToscaServiceTemplate(@NonNull final PfConceptKey key, @NonNull final String toscaDefinitionsVersion) { @@ -172,15 +161,15 @@ public class JpaToscaServiceTemplate extends JpaToscaEntityType<ToscaServiceTemp this.toscaDefinitionsVersion = copyConcept.toscaDefinitionsVersion; this.dataTypes = (copyConcept.dataTypes != null ? new JpaToscaDataTypes(copyConcept.dataTypes) : null); this.capabilityTypes = - (copyConcept.capabilityTypes != null ? new JpaToscaCapabilityTypes(copyConcept.capabilityTypes) : null); + (copyConcept.capabilityTypes != null ? new JpaToscaCapabilityTypes(copyConcept.capabilityTypes) : null); this.relationshipTypes = - (copyConcept.relationshipTypes != null ? new JpaToscaRelationshipTypes(copyConcept.relationshipTypes) - : null); + (copyConcept.relationshipTypes != null ? new JpaToscaRelationshipTypes(copyConcept.relationshipTypes) + : null); this.nodeTypes = (copyConcept.nodeTypes != null ? new JpaToscaNodeTypes(copyConcept.nodeTypes) : null); this.policyTypes = (copyConcept.policyTypes != null ? new JpaToscaPolicyTypes(copyConcept.policyTypes) : null); this.topologyTemplate = - (copyConcept.topologyTemplate != null ? new JpaToscaTopologyTemplate(copyConcept.topologyTemplate) - : null); + (copyConcept.topologyTemplate != null ? new JpaToscaTopologyTemplate(copyConcept.topologyTemplate) + : null); } /** @@ -231,8 +220,8 @@ public class JpaToscaServiceTemplate extends JpaToscaEntityType<ToscaServiceTemp /** * Takes a list of maps and flattens it into a single map. * - * @param list list to be be flattened - * @return a map containing all of the elements from the list of maps + * @param list list to be flattened + * @return a map containing all the elements from the list of maps */ private <V> Map<String, V> flattenMap(List<Map<String, V>> list) { Map<String, V> result = new LinkedHashMap<>(); @@ -353,7 +342,7 @@ public class JpaToscaServiceTemplate extends JpaToscaEntityType<ToscaServiceTemp public BeanValidationResult validate(String fieldName) { BeanValidationResult result = super.validate(fieldName); - // No point in validating cross references if the structure of the individual parts are not valid + // No point in validating cross-references if the structure of the individual parts are not valid if (!result.isValid()) { return result; } @@ -452,10 +441,10 @@ public class JpaToscaServiceTemplate extends JpaToscaEntityType<ToscaServiceTemp * Validate that the referenced data types exist for a collection of data type keys. * * @param dataTypeKeyCollection the data type key collection - * @param result where the results are added + * @param result where the results are added */ private void validateReferencedDataTypesExists(final Collection<PfConceptKey> 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<ToscaServiceTemp */ private void validatePolicyTypesInPolicies(BeanValidationResult result) { if (topologyTemplate == null || topologyTemplate.getPolicies() == null - || topologyTemplate.getPolicies().getConceptMap().isEmpty()) { + || topologyTemplate.getPolicies().getConceptMap().isEmpty()) { return; } if (policyTypes == null || policyTypes.getConceptMap().isEmpty()) { addResult(result, "policyTypes", policyTypes, - "no policy types are defined on the service template for the policies in the topology template"); + "no policy types are defined on the service template for the policies in the topology template"); return; } diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplates.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplates.java index 4f9fa43f8..318ca1d8e 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplates.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplates.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,13 +21,13 @@ 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.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 org.onap.policy.models.base.PfConceptContainer; diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTimeInterval.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTimeInterval.java index 819b7d812..e54f11900 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTimeInterval.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTimeInterval.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. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,14 +24,15 @@ package org.onap.policy.models.tosca.simple.concepts; import com.google.gson.annotations.SerializedName; +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.sql.Timestamp; import java.time.Instant; import java.util.List; -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; @@ -56,6 +57,7 @@ import org.onap.policy.models.base.validation.annotations.VerifyKey; @Data @EqualsAndHashCode(callSuper = false) public class JpaToscaTimeInterval extends PfConcept { + @Serial private static final long serialVersionUID = 9151467029611969980L; @EmbeddedId diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTopologyTemplate.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTopologyTemplate.java index 629e14a84..30152df10 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTopologyTemplate.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTopologyTemplate.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-2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,23 +22,24 @@ 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.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.JoinColumns; +import jakarta.persistence.Lob; +import jakarta.persistence.OneToOne; +import jakarta.persistence.Table; +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.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.JoinColumns; -import javax.persistence.Lob; -import javax.persistence.OneToOne; -import javax.persistence.Table; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NonNull; @@ -68,6 +69,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaTopologyTemplate; @Data @EqualsAndHashCode(callSuper = false) public class JpaToscaTopologyTemplate extends PfConcept implements PfAuthorative<ToscaTopologyTemplate> { + @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<T extends ToscaWithToscaProperties> extends JpaToscaEntityType<T> implements PfAuthorative<T> { + @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<T extends ToscaWithTypeAndObjectProperties> extends JpaToscaEntityType<T> implements PfAuthorative<T> { + @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"); - } } @@ -2,7 +2,7 @@ <!-- ============LICENSE_START======================================================= Copyright (C) 2018 Ericsson. All rights reserved. - Copyright (C) 2019-2020,2022-2023 Nordix Foundation. + Copyright (C) 2019-2020, 2022-2023 Nordix Foundation. Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved. Modifications Copyright (C) 2020 Bell Canada. ================================================================================ @@ -22,25 +22,25 @@ ============LICENSE_END========================================================= --> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.onap.policy.parent</groupId> <artifactId>integration</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>4.0.1-SNAPSHOT</version> <relativePath /> </parent> <groupId>org.onap.policy.models</groupId> <artifactId>policy-models</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.0.1-SNAPSHOT</version> <packaging>pom</packaging> <name>policy-models</name> <description>This repo holds model code agnostic to PDP engines</description> <properties> - <policy.common.version>2.0.0-SNAPSHOT</policy.common.version> + <policy.common.version>2.0.1-SNAPSHOT</policy.common.version> </properties> <modules> @@ -68,13 +68,19 @@ <dependency> <groupId>org.onap.policy.common</groupId> <artifactId>utils</artifactId> + <version>${policy.common.version}</version> + </dependency> + <dependency> + <groupId>org.onap.policy.common</groupId> + <artifactId>utils-test</artifactId> + <version>${policy.common.version}</version> + <scope>test</scope> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> </dependency> - <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-core</artifactId> @@ -101,11 +107,6 @@ </dependency> <dependency> - <groupId>javax.ws.rs</groupId> - <artifactId>javax.ws.rs-api</artifactId> - </dependency> - - <dependency> <groupId>org.mariadb.jdbc</groupId> <artifactId>mariadb-java-client</artifactId> </dependency> @@ -116,42 +117,14 @@ </dependency> <dependency> - <groupId>org.hibernate.javax.persistence</groupId> - <artifactId>hibernate-jpa-2.1-api</artifactId> - </dependency> - - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate-entitymanager</artifactId> - </dependency> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.assertj</groupId> - <artifactId>assertj-core</artifactId> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.onap.policy.common</groupId> - <artifactId>utils-test</artifactId> - <version>${policy.common.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>com.openpojo</groupId> - <artifactId>openpojo</artifactId> - <scope>test</scope> + <groupId>jakarta.ws.rs</groupId> + <artifactId>jakarta.ws.rs-api</artifactId> </dependency> <dependency> <groupId>org.glassfish.jersey.inject</groupId> <artifactId>jersey-hk2</artifactId> + <version>${version.jersey}</version> </dependency> <dependency> <groupId>org.eclipse.jetty</groupId> @@ -164,6 +137,7 @@ <dependency> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-servlet</artifactId> + <version>${version.jetty}</version> </dependency> <dependency> <groupId>org.glassfish.jersey.containers</groupId> @@ -171,8 +145,28 @@ <version>${version.jersey}</version> </dependency> <dependency> - <groupId>org.apache.httpcomponents</groupId> - <artifactId>httpclient</artifactId> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-core</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.assertj</groupId> + <artifactId>assertj-core</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.openpojo</groupId> + <artifactId>openpojo</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.httpcomponents.client5</groupId> + <artifactId>httpclient5</artifactId> </dependency> <dependency> <groupId>org.apache.commons</groupId> 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} |