Fix Sonar Issues 96/141496/2
authoradheli.tavares <adheli.tavares@est.tech>
Tue, 8 Jul 2025 16:05:52 +0000 (17:05 +0100)
committeradheli.tavares <adheli.tavares@est.tech>
Tue, 8 Jul 2025 16:34:00 +0000 (17:34 +0100)
Issue-ID: POLICY-5411
Change-Id: I43580df6ecd5e9e54e1335bc42fc040e81b963e3
Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
29 files changed:
models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationComposition.java
models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaParticipant.java
models/src/main/java/org/onap/policy/clamp/models/acm/utils/AcmUtils.java
packages/policy-clamp-docker/src/main/docker/a1pms-participant.sh
packages/policy-clamp-docker/src/main/docker/acm-runtime.sh
packages/policy-clamp-docker/src/main/docker/element-participant.sh
packages/policy-clamp-docker/src/main/docker/http-participant.sh
packages/policy-clamp-docker/src/main/docker/kserve-participant.sh
packages/policy-clamp-docker/src/main/docker/kubernetes-participant.sh
packages/policy-clamp-docker/src/main/docker/policy-participant.sh
packages/policy-clamp-docker/src/main/docker/sim-participant.sh
packages/policy-clamp-tarball/src/main/resources/etc/ssl/policy-truststore [deleted file]
runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/SecurityConfig.java
runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/stub/ParticipantControllerStub.java
runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/stub/StubUtils.java
runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionStateChangeAckListener.java
runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionUpdateAckListener.java
runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantDeregisterListener.java
runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantPrimeAckListener.java
runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantRegisterListener.java
runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantStatusListener.java
runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/commissioning/rest/CommissioningControllerTest.java
runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/contract/InstantiationControllerStubTest.java
runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/contract/ParticipantControllerStubTest.java
runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProviderTest.java
runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/main/rest/stub/StubUtilsTest.java [new file with mode: 0644]
runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/participant/ParticipantControllerTest.java
runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionAspectTest.java
runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/util/rest/CommonRestController.java

index cb05eda..df8bf03 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- * Copyright (C) 2021-2025 Nordix Foundation.
+ * Copyright (C) 2021-2025 OpenInfra Foundation Europe. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -55,7 +55,7 @@ import org.onap.policy.models.base.PfUtils;
 import org.onap.policy.models.base.Validated;
 
 /**
- * Class to represent a automation composition in the database.
+ * Class to represent an automation composition in the database.
  *
  * @author Liam Fallon (liam.fallon@est.tech)
  */
index 58c95b7..5952bfa 100644 (file)
@@ -41,8 +41,6 @@ import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.NonNull;
 import org.apache.commons.lang3.ObjectUtils;
-import org.hibernate.annotations.LazyCollection;
-import org.hibernate.annotations.LazyCollectionOption;
 import org.onap.policy.clamp.models.acm.concepts.Participant;
 import org.onap.policy.common.parameters.annotations.NotNull;
 import org.onap.policy.common.parameters.annotations.Valid;
@@ -81,7 +79,6 @@ public class JpaParticipant extends Validated
 
     @NotNull
     @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
-    @LazyCollection(LazyCollectionOption.FALSE)
     @JoinColumn(name = "participantId", referencedColumnName = "participantId",
             foreignKey = @ForeignKey(name = "participant_replica_fk"))
     @SuppressWarnings("squid:S1948")
index 6b5c4f9..f1b7973 100644 (file)
@@ -543,6 +543,7 @@ public final class AcmUtils {
      * @param map1 Map where to merge
      * @param map2 Map
      */
+    @SuppressWarnings({"unchecked", "rawtypes"})
     public static void recursiveMerge(Map<String, Object> map1, Map<String, Object> map2) {
         Deque<Pair<Map<String, Object>, Map<String, Object>>> stack = new ArrayDeque<>();
         stack.push(Pair.of(map1, map2));
@@ -565,6 +566,7 @@ public final class AcmUtils {
         }
     }
 
+    @SuppressWarnings({"unchecked", "rawtypes"})
     private static void recursiveMerge(List<Object> list1, List<Object> list2) {
         for (var i = 0; i < list1.size(); i++) {
             var valueLeft = list1.get(i);
index 72aae5e..4df2fa4 100644 (file)
@@ -1,7 +1,7 @@
 #!/usr/bin/env sh
 #
 # ============LICENSE_START=======================================================
-#  Copyright (C) 2021-2022 Nordix Foundation.
+#  Copyright (C) 2021-2022, 2025 OpenInfra Foundation Europe. All rights reserved.
 # ================================================================================
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # ============LICENSE_END=========================================================
 #
 
-KEYSTORE="${KEYSTORE:-$POLICY_HOME/etc/ssl/policy-keystore}"
-TRUSTSTORE="${TRUSTSTORE:-$POLICY_HOME/etc/ssl/policy-truststore}"
-KEYSTORE_PASSWD="${KEYSTORE_PASSWD:-Pol1cy_0nap}"
-TRUSTSTORE_PASSWD="${TRUSTSTORE_PASSWD:-Pol1cy_0nap}"
-
 if [ "$#" -eq 1 ]; then
     CONFIG_FILE=$1
 fi
@@ -34,22 +29,12 @@ fi
 
 echo "Policy clamp A1 Pms participant config file: $CONFIG_FILE"
 
-if [ -f "${POLICY_HOME}/etc/mounted/policy-truststore" ]; then
-    echo "overriding policy-truststore"
-    cp -f "${POLICY_HOME}"/etc/mounted/policy-truststore "${TRUSTSTORE}"
-fi
-
-if [ -f "${POLICY_HOME}/etc/mounted/policy-keystore" ]; then
-    echo "overriding policy-keystore"
-    cp -f "${POLICY_HOME}"/etc/mounted/policy-keystore "${KEYSTORE}"
-fi
-
 if [ -f "${POLICY_HOME}/etc/mounted/logback.xml" ]; then
     echo "overriding logback xml file"
     cp -f "${POLICY_HOME}"/etc/mounted/logback.xml "${POLICY_HOME}"/etc/
 fi
 
-$JAVA_HOME/bin/java \
+"$JAVA_HOME"/bin/java \
     -Dlogging.config="${POLICY_HOME}/etc/logback.xml" \
     -Dserver.ssl.keyStore="${KEYSTORE}" \
     -Dserver.ssl.keyStorePassword="${KEYSTORE_PASSWD}" \
index 2254886..97cf6ab 100644 (file)
@@ -1,7 +1,7 @@
 #!/usr/bin/env sh
 #
 # ============LICENSE_START=======================================================
-#  Copyright (C) 2021-2022 Nordix Foundation.
+#  Copyright (C) 2021-2022, 2025 OpenInfra Foundation Europe. All rights reserved.
 # ================================================================================
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # ============LICENSE_END=========================================================
 #
 
-KEYSTORE="${KEYSTORE:-$POLICY_HOME/etc/ssl/policy-keystore}"
-TRUSTSTORE="${TRUSTSTORE:-$POLICY_HOME/etc/ssl/policy-truststore}"
-KEYSTORE_PASSWD="${KEYSTORE_PASSWD:-Pol1cy_0nap}"
-TRUSTSTORE_PASSWD="${TRUSTSTORE_PASSWD:-Pol1cy_0nap}"
-
 if [ "$#" -eq 1 ]; then
     CONFIG_FILE=$1
 fi
@@ -34,27 +29,13 @@ fi
 
 echo "Policy clamp runtime acm config file: $CONFIG_FILE"
 
-if [ -f "${POLICY_HOME}/etc/mounted/policy-truststore" ]; then
-    echo "overriding policy-truststore"
-    cp -f "${POLICY_HOME}"/etc/mounted/policy-truststore "${TRUSTSTORE}"
-fi
-
-if [ -f "${POLICY_HOME}/etc/mounted/policy-keystore" ]; then
-    echo "overriding policy-keystore"
-    cp -f "${POLICY_HOME}"/etc/mounted/policy-keystore "${KEYSTORE}"
-fi
-
 if [ -f "${POLICY_HOME}/etc/mounted/logback.xml" ]; then
     echo "overriding logback xml file"
     cp -f "${POLICY_HOME}"/etc/mounted/logback.xml "${POLICY_HOME}"/etc/
 fi
 
-$JAVA_HOME/bin/java \
+"$JAVA_HOME"/bin/java \
     -Dlogging.config="${POLICY_HOME}/etc/logback.xml" \
-    -Dserver.ssl.keyStore="${KEYSTORE}" \
-    -Dserver.ssl.keyStorePassword="${KEYSTORE_PASSWD}" \
-    -Djavax.net.ssl.trustStore="${TRUSTSTORE}" \
-    -Djavax.net.ssl.trustStorePassword="${TRUSTSTORE_PASSWD}" \
     -Dcom.sun.management.jmxremote.rmi.port=9090 \
     -Dcom.sun.management.jmxremote=true \
     -Dcom.sun.management.jmxremote.port=9090 \
index 54836f6..32c4bc2 100644 (file)
@@ -1,7 +1,7 @@
 #!/usr/bin/env sh
 #
 # ============LICENSE_START=======================================================
-#  Copyright (C) 2022 Nordix Foundation.
+#  Copyright (C) 2022, 2025 OpenInfra Foundation Europe. All rights reserved.
 # ================================================================================
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # ============LICENSE_END=========================================================
 #
 
-KEYSTORE="${KEYSTORE:-$POLICY_HOME/etc/ssl/policy-keystore}"
-TRUSTSTORE="${TRUSTSTORE:-$POLICY_HOME/etc/ssl/policy-truststore}"
-KEYSTORE_PASSWD="${KEYSTORE_PASSWD:-Pol1cy_0nap}"
-TRUSTSTORE_PASSWD="${TRUSTSTORE_PASSWD:-Pol1cy_0nap}"
-
 if [ "$#" -eq 1 ]; then
     CONFIG_FILE=$1
 fi
@@ -34,26 +29,12 @@ fi
 
 echo "Policy clamp Element participant config file: $CONFIG_FILE"
 
-if [ -f "${POLICY_HOME}/etc/mounted/policy-truststore" ]; then
-    echo "overriding policy-truststore"
-    cp -f "${POLICY_HOME}"/etc/mounted/policy-truststore "${TRUSTSTORE}"
-fi
-
-if [ -f "${POLICY_HOME}/etc/mounted/policy-keystore" ]; then
-    echo "overriding policy-keystore"
-    cp -f "${POLICY_HOME}"/etc/mounted/policy-keystore "${KEYSTORE}"
-fi
-
 if [ -f "${POLICY_HOME}/etc/mounted/logback.xml" ]; then
     echo "overriding logback xml file"
     cp -f "${POLICY_HOME}"/etc/mounted/logback.xml "${POLICY_HOME}"/etc/
 fi
 
-$JAVA_HOME/bin/java \
+"$JAVA_HOME"/bin/java \
     -Dlogging.config="${POLICY_HOME}/etc/logback.xml" \
-    -Dserver.ssl.keyStore="${KEYSTORE}" \
-    -Dserver.ssl.keyStorePassword="${KEYSTORE_PASSWD}" \
-    -Djavax.net.ssl.trustStore="${TRUSTSTORE}" \
-    -Djavax.net.ssl.trustStorePassword="${TRUSTSTORE_PASSWD}" \
     -jar /app/app.jar \
     --spring.config.location="${CONFIG_FILE}"
index 78f5c1a..06ee43b 100644 (file)
@@ -1,7 +1,7 @@
 #!/usr/bin/env sh
 #
 # ============LICENSE_START=======================================================
-#  Copyright (C) 2021-2022 Nordix Foundation.
+#  Copyright (C) 2021-2022, 2025 OpenInfra Foundation Europe. All rights reserved.
 # ================================================================================
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # ============LICENSE_END=========================================================
 #
 
-KEYSTORE="${KEYSTORE:-$POLICY_HOME/etc/ssl/policy-keystore}"
-TRUSTSTORE="${TRUSTSTORE:-$POLICY_HOME/etc/ssl/policy-truststore}"
-KEYSTORE_PASSWD="${KEYSTORE_PASSWD:-Pol1cy_0nap}"
-TRUSTSTORE_PASSWD="${TRUSTSTORE_PASSWD:-Pol1cy_0nap}"
-
 if [ "$#" -eq 1 ]; then
     CONFIG_FILE=$1
 fi
@@ -34,26 +29,12 @@ fi
 
 echo "Policy clamp HTTP participant config file: $CONFIG_FILE"
 
-if [ -f "${POLICY_HOME}/etc/mounted/policy-truststore" ]; then
-    echo "overriding policy-truststore"
-    cp -f "${POLICY_HOME}"/etc/mounted/policy-truststore "${TRUSTSTORE}"
-fi
-
-if [ -f "${POLICY_HOME}/etc/mounted/policy-keystore" ]; then
-    echo "overriding policy-keystore"
-    cp -f "${POLICY_HOME}"/etc/mounted/policy-keystore "${KEYSTORE}"
-fi
-
 if [ -f "${POLICY_HOME}/etc/mounted/logback.xml" ]; then
     echo "overriding logback xml file"
     cp -f "${POLICY_HOME}"/etc/mounted/logback.xml "${POLICY_HOME}"/etc/
 fi
 
-$JAVA_HOME/bin/java \
+"$JAVA_HOME"/bin/java \
     -Dlogging.config="${POLICY_HOME}/etc/logback.xml" \
-    -Dserver.ssl.keyStore="${KEYSTORE}" \
-    -Dserver.ssl.keyStorePassword="${KEYSTORE_PASSWD}" \
-    -Djavax.net.ssl.trustStore="${TRUSTSTORE}" \
-    -Djavax.net.ssl.trustStorePassword="${TRUSTSTORE_PASSWD}" \
     -jar /app/app.jar \
     --spring.config.location="${CONFIG_FILE}"
index cb88db4..db085c5 100644 (file)
@@ -1,7 +1,7 @@
 #!/usr/bin/env sh
 #
 # ============LICENSE_START=======================================================
-#  Copyright (C) 2023 Nordix Foundation.
+#  Copyright (C) 2023, 2025 OpenInfra Foundation Europe. All rights reserved.
 # ================================================================================
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # ============LICENSE_END=========================================================
 #
 
-KEYSTORE="${KEYSTORE:-$POLICY_HOME/etc/ssl/policy-keystore}"
-TRUSTSTORE="${TRUSTSTORE:-$POLICY_HOME/etc/ssl/policy-truststore}"
-KEYSTORE_PASSWD="${KEYSTORE_PASSWD:-Pol1cy_0nap}"
-TRUSTSTORE_PASSWD="${TRUSTSTORE_PASSWD:-Pol1cy_0nap}"
-
 if [ "$#" -eq 1 ]; then
     CONFIG_FILE=$1
 fi
@@ -34,26 +29,12 @@ fi
 
 echo "Policy clamp Kserve participant config file: $CONFIG_FILE"
 
-if [ -f "${POLICY_HOME}/etc/mounted/policy-truststore" ]; then
-    echo "overriding policy-truststore"
-    cp -f "${POLICY_HOME}"/etc/mounted/policy-truststore "${TRUSTSTORE}"
-fi
-
-if [ -f "${POLICY_HOME}/etc/mounted/policy-keystore" ]; then
-    echo "overriding policy-keystore"
-    cp -f "${POLICY_HOME}"/etc/mounted/policy-keystore "${KEYSTORE}"
-fi
-
 if [ -f "${POLICY_HOME}/etc/mounted/logback.xml" ]; then
     echo "overriding logback xml file"
     cp -f "${POLICY_HOME}"/etc/mounted/logback.xml "${POLICY_HOME}"/etc/
 fi
 
-$JAVA_HOME/bin/java \
+"$JAVA_HOME"/bin/java \
     -Dlogging.config="${POLICY_HOME}/etc/logback.xml" \
-    -Dserver.ssl.keyStore="${KEYSTORE}" \
-    -Dserver.ssl.keyStorePassword="${KEYSTORE_PASSWD}" \
-    -Djavax.net.ssl.trustStore="${TRUSTSTORE}" \
-    -Djavax.net.ssl.trustStorePassword="${TRUSTSTORE_PASSWD}" \
     -jar /app/app.jar \
     --spring.config.location="${CONFIG_FILE}"
index 9440b4b..972eed3 100644 (file)
@@ -1,7 +1,7 @@
 #!/usr/bin/env sh
 #
 # ============LICENSE_START=======================================================
-#  Copyright (C) 2021-2022 Nordix Foundation.
+#  Copyright (C) 2021-2022, 2025 OpenInfra Foundation Europe. All rights reserved.
 # ================================================================================
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # ============LICENSE_END=========================================================
 #
 
-KEYSTORE="${KEYSTORE:-$POLICY_HOME/etc/ssl/policy-keystore}"
-TRUSTSTORE="${TRUSTSTORE:-$POLICY_HOME/etc/ssl/policy-truststore}"
-KEYSTORE_PASSWD="${KEYSTORE_PASSWD:-Pol1cy_0nap}"
-TRUSTSTORE_PASSWD="${TRUSTSTORE_PASSWD:-Pol1cy_0nap}"
-
 if [ "$#" -eq 1 ]; then
     CONFIG_FILE=$1
 fi
@@ -34,26 +29,12 @@ fi
 
 echo "Policy clamp Kubernetes participant config file: $CONFIG_FILE"
 
-if [ -f "${POLICY_HOME}/etc/mounted/policy-truststore" ]; then
-    echo "overriding policy-truststore"
-    cp -f "${POLICY_HOME}"/etc/mounted/policy-truststore "${TRUSTSTORE}"
-fi
-
-if [ -f "${POLICY_HOME}/etc/mounted/policy-keystore" ]; then
-    echo "overriding policy-keystore"
-    cp -f "${POLICY_HOME}"/etc/mounted/policy-keystore "${KEYSTORE}"
-fi
-
 if [ -f "${POLICY_HOME}/etc/mounted/logback.xml" ]; then
     echo "overriding logback xml file"
     cp -f "${POLICY_HOME}"/etc/mounted/logback.xml "${POLICY_HOME}"/etc/
 fi
 
-$JAVA_HOME/bin/java \
+"$JAVA_HOME"/bin/java \
     -Dlogging.config="${POLICY_HOME}/etc/logback.xml" \
-    -Dserver.ssl.keyStore="${KEYSTORE}" \
-    -Dserver.ssl.keyStorePassword="${KEYSTORE_PASSWD}" \
-    -Djavax.net.ssl.trustStore="${TRUSTSTORE}" \
-    -Djavax.net.ssl.trustStorePassword="${TRUSTSTORE_PASSWD}" \
     -jar /app/app.jar \
     --spring.config.location="${CONFIG_FILE}"
index 1e10ae0..7543a38 100644 (file)
@@ -1,7 +1,7 @@
 #!/usr/bin/env sh
 #
 # ============LICENSE_START=======================================================
-#  Copyright (C) 2021-2022 Nordix Foundation.
+#  Copyright (C) 2021-2022, 2025 OpenInfra Foundation Europe. All rights reserved.
 # ================================================================================
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # ============LICENSE_END=========================================================
 #
 
-KEYSTORE="${KEYSTORE:-$POLICY_HOME/etc/ssl/policy-keystore}"
-TRUSTSTORE="${TRUSTSTORE:-$POLICY_HOME/etc/ssl/policy-truststore}"
-KEYSTORE_PASSWD="${KEYSTORE_PASSWD:-Pol1cy_0nap}"
-TRUSTSTORE_PASSWD="${TRUSTSTORE_PASSWD:-Pol1cy_0nap}"
-
 if [ "$#" -eq 1 ]; then
     CONFIG_FILE=$1
 fi
@@ -34,26 +29,12 @@ fi
 
 echo "Policy clamp policy participant config file: $CONFIG_FILE"
 
-if [ -f "${POLICY_HOME}/etc/mounted/policy-truststore" ]; then
-    echo "overriding policy-truststore"
-    cp -f "${POLICY_HOME}"/etc/mounted/policy-truststore "${TRUSTSTORE}"
-fi
-
-if [ -f "${POLICY_HOME}/etc/mounted/policy-keystore" ]; then
-    echo "overriding policy-keystore"
-    cp -f "${POLICY_HOME}"/etc/mounted/policy-keystore "${KEYSTORE}"
-fi
-
 if [ -f "${POLICY_HOME}/etc/mounted/logback.xml" ]; then
     echo "overriding logback xml file"
     cp -f "${POLICY_HOME}"/etc/mounted/logback.xml "${POLICY_HOME}"/etc/
 fi
 
-$JAVA_HOME/bin/java \
+"$JAVA_HOME"/bin/java \
     -Dlogging.config="${POLICY_HOME}/etc/logback.xml" \
-    -Dserver.ssl.keyStore="${KEYSTORE}" \
-    -Dserver.ssl.keyStorePassword="${KEYSTORE_PASSWD}" \
-    -Djavax.net.ssl.trustStore="${TRUSTSTORE}" \
-    -Djavax.net.ssl.trustStorePassword="${TRUSTSTORE_PASSWD}" \
     -jar /app/app.jar \
     --spring.config.location="${CONFIG_FILE}"
index 60f45b7..ed44bcd 100644 (file)
@@ -1,7 +1,7 @@
 #!/usr/bin/env sh
 #
 # ============LICENSE_START=======================================================
-#  Copyright (C) 2023 Nordix Foundation.
+#  Copyright (C) 2023, 2025 OpenInfra Foundation Europe. All rights reserved.
 # ================================================================================
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # ============LICENSE_END=========================================================
 #
 
-KEYSTORE="${KEYSTORE:-$POLICY_HOME/etc/ssl/policy-keystore}"
-TRUSTSTORE="${TRUSTSTORE:-$POLICY_HOME/etc/ssl/policy-truststore}"
-KEYSTORE_PASSWD="${KEYSTORE_PASSWD:-Pol1cy_0nap}"
-TRUSTSTORE_PASSWD="${TRUSTSTORE_PASSWD:-Pol1cy_0nap}"
-
 if [ "$#" -eq 1 ]; then
     CONFIG_FILE=$1
 fi
@@ -34,26 +29,12 @@ fi
 
 echo "Policy clamp Simulator participant config file: $CONFIG_FILE"
 
-if [ -f "${POLICY_HOME}/etc/mounted/policy-truststore" ]; then
-    echo "overriding policy-truststore"
-    cp -f "${POLICY_HOME}"/etc/mounted/policy-truststore "${TRUSTSTORE}"
-fi
-
-if [ -f "${POLICY_HOME}/etc/mounted/policy-keystore" ]; then
-    echo "overriding policy-keystore"
-    cp -f "${POLICY_HOME}"/etc/mounted/policy-keystore "${KEYSTORE}"
-fi
-
 if [ -f "${POLICY_HOME}/etc/mounted/logback.xml" ]; then
     echo "overriding logback xml file"
     cp -f "${POLICY_HOME}"/etc/mounted/logback.xml "${POLICY_HOME}"/etc/
 fi
 
-$JAVA_HOME/bin/java \
+"$JAVA_HOME"/bin/java \
     -Dlogging.config="${POLICY_HOME}/etc/logback.xml" \
-    -Dserver.ssl.keyStore="${KEYSTORE}" \
-    -Dserver.ssl.keyStorePassword="${KEYSTORE_PASSWD}" \
-    -Djavax.net.ssl.trustStore="${TRUSTSTORE}" \
-    -Djavax.net.ssl.trustStorePassword="${TRUSTSTORE_PASSWD}" \
     -jar /app/app.jar \
     --spring.config.location="${CONFIG_FILE}"
diff --git a/packages/policy-clamp-tarball/src/main/resources/etc/ssl/policy-truststore b/packages/policy-clamp-tarball/src/main/resources/etc/ssl/policy-truststore
deleted file mode 100644 (file)
index 8834ac2..0000000
Binary files a/packages/policy-clamp-tarball/src/main/resources/etc/ssl/policy-truststore and /dev/null differ
index 9d50fc7..9f84be7 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2021,2023-2024 Nordix Foundation.
+ *  Copyright (C) 2021,2023-2025 OpenInfra Foundation Europe. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -47,11 +47,10 @@ public class SecurityConfig {
     public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
         if (useBasicAuth) {
             http
-                    .httpBasic(Customizer.withDefaults())
-                    .authorizeHttpRequests(authorize -> authorize.anyRequest().authenticated());
+                .httpBasic(Customizer.withDefaults())
+                .authorizeHttpRequests(authorize -> authorize.anyRequest().authenticated());
         } else {
-            http
-                    .authorizeHttpRequests(authorize -> authorize.anyRequest().permitAll());
+            http.authorizeHttpRequests(authorize -> authorize.anyRequest().permitAll());
         }
 
         http.csrf(AbstractHttpConfigurer::disable);
index 583f043..4b75389 100644 (file)
@@ -20,7 +20,6 @@
 
 package org.onap.policy.clamp.acm.runtime.main.rest.stub;
 
-import java.util.ArrayList;
 import java.util.List;
 import java.util.UUID;
 import lombok.RequiredArgsConstructor;
@@ -64,8 +63,6 @@ public class ParticipantControllerStub extends AbstractRestController implements
     @Override
     public ResponseEntity<List<ParticipantInformation>> queryParticipants(String name, String version,
         Integer page, Integer size, UUID xonaprequestid) {
-        List<ParticipantInformation> participantInformationList = new ArrayList<>();
-        return (ResponseEntity<List<ParticipantInformation>>) stubUtils
-            .getResponse(pathToParticipantList, participantInformationList.getClass());
+        return stubUtils.getResponseList(pathToParticipantList);
     }
 }
index 7bc22ac..814f8ac 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2022 Nordix Foundation.
+ *  Copyright (C) 2022, 2025 OpenInfra Foundation Europe. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -24,6 +24,8 @@ import com.google.gson.Gson;
 import jakarta.servlet.http.HttpServletRequest;
 import java.io.IOException;
 import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.List;
 import lombok.RequiredArgsConstructor;
 import org.onap.policy.common.utils.coder.CoderException;
 import org.onap.policy.common.utils.coder.StandardYamlCoder;
@@ -65,4 +67,17 @@ public class StubUtils {
             return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build();
         }
     }
+
+    @SuppressWarnings({"unchecked", "rawtypes"})
+    <T> ResponseEntity<List<T>> getResponseList(String path) {
+        final var resource = new ClassPathResource(path);
+        try (var inputStream = resource.getInputStream()) {
+            final var string = new String(inputStream.readAllBytes(), StandardCharsets.UTF_8);
+            var targetObject = JSON_TRANSLATOR.fromJson(string, ArrayList.class);
+            return new ResponseEntity<>(targetObject, HttpStatus.OK);
+        } catch (IOException exception) {
+            log.error("Error reading the file.", exception);
+            return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build();
+        }
+    }
 }
index 3d6ed75..50abff1 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- * Copyright (C) 2021,2023-2025 Nordix Foundation.
+ * Copyright (C) 2021,2023-2025 OpenInfra Foundation Europe. All rights reserved.
  * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -29,8 +29,6 @@ import org.onap.policy.clamp.models.acm.messages.kafka.participant.ParticipantMe
 import org.onap.policy.common.endpoints.listeners.ScoListener;
 import org.onap.policy.common.message.bus.event.Topic.CommInfrastructure;
 import org.onap.policy.common.utils.coder.StandardCoderObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Component;
 
 /**
@@ -39,7 +37,6 @@ import org.springframework.stereotype.Component;
 @Component
 public class AutomationCompositionStateChangeAckListener extends ScoListener<AutomationCompositionDeployAck>
     implements Listener<AutomationCompositionDeployAck> {
-    private static final Logger LOGGER = LoggerFactory.getLogger(AutomationCompositionStateChangeAckListener.class);
 
     private final SupervisionAcHandler supervisionHandler;
 
index edae442..20c1e5b 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- * Copyright (C) 2021,2023-2025 Nordix Foundation.
+ * Copyright (C) 2021,2023-2025 OpenInfra Foundation Europe. All rights reserved.
  * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -29,8 +29,6 @@ import org.onap.policy.clamp.models.acm.messages.kafka.participant.ParticipantMe
 import org.onap.policy.common.endpoints.listeners.ScoListener;
 import org.onap.policy.common.message.bus.event.Topic.CommInfrastructure;
 import org.onap.policy.common.utils.coder.StandardCoderObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Component;
 
 /**
@@ -39,7 +37,6 @@ import org.springframework.stereotype.Component;
 @Component
 public class AutomationCompositionUpdateAckListener extends ScoListener<AutomationCompositionDeployAck>
     implements Listener<AutomationCompositionDeployAck> {
-    private static final Logger LOGGER = LoggerFactory.getLogger(AutomationCompositionUpdateAckListener.class);
 
     private final SupervisionAcHandler supervisionHandler;
 
index ee756ec..740f489 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- * Copyright (C) 2021-2025 Nordix Foundation.
+ * Copyright (C) 2021-2025 OpenInfra Foundation Europe. All rights reserved.
  * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -29,8 +29,6 @@ import org.onap.policy.clamp.models.acm.messages.kafka.participant.ParticipantMe
 import org.onap.policy.common.endpoints.listeners.ScoListener;
 import org.onap.policy.common.message.bus.event.Topic.CommInfrastructure;
 import org.onap.policy.common.utils.coder.StandardCoderObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Component;
 
 /**
@@ -39,7 +37,6 @@ import org.springframework.stereotype.Component;
 @Component
 public class ParticipantDeregisterListener extends ScoListener<ParticipantDeregister>
                 implements Listener<ParticipantDeregister> {
-    private static final Logger LOGGER = LoggerFactory.getLogger(ParticipantDeregisterListener.class);
 
     private final SupervisionParticipantHandler supervisionHandler;
 
index c3b044a..c40aac2 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- * Copyright (C) 2021-2025 Nordix Foundation.
+ * Copyright (C) 2021-2025 OpenInfra Foundation Europe. All rights reserved.
  * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -29,8 +29,6 @@ import org.onap.policy.clamp.models.acm.messages.kafka.participant.ParticipantPr
 import org.onap.policy.common.endpoints.listeners.ScoListener;
 import org.onap.policy.common.message.bus.event.Topic.CommInfrastructure;
 import org.onap.policy.common.utils.coder.StandardCoderObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Component;
 
 /**
@@ -39,7 +37,6 @@ import org.springframework.stereotype.Component;
 @Component
 public class ParticipantPrimeAckListener extends ScoListener<ParticipantPrimeAck>
                 implements Listener<ParticipantPrimeAck> {
-    private static final Logger LOGGER = LoggerFactory.getLogger(ParticipantPrimeAckListener.class);
 
     private final SupervisionHandler supervisionHandler;
 
index 0be7392..40a88d3 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- * Copyright (C) 2021-2025 Nordix Foundation.
+ * Copyright (C) 2021-2025 OpenInfra Foundation Europe. All rights reserved.
  * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -29,8 +29,6 @@ import org.onap.policy.clamp.models.acm.messages.kafka.participant.ParticipantRe
 import org.onap.policy.common.endpoints.listeners.ScoListener;
 import org.onap.policy.common.message.bus.event.Topic.CommInfrastructure;
 import org.onap.policy.common.utils.coder.StandardCoderObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Component;
 
 /**
@@ -39,7 +37,6 @@ import org.springframework.stereotype.Component;
 @Component
 public class ParticipantRegisterListener extends ScoListener<ParticipantRegister>
                 implements Listener<ParticipantRegister> {
-    private static final Logger LOGGER = LoggerFactory.getLogger(ParticipantRegisterListener.class);
 
     private final SupervisionParticipantHandler supervisionHandler;
 
index 575b2fa..b3429fc 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- * Copyright (C) 2021-2025 Nordix Foundation.
+ * Copyright (C) 2021-2025 OpenInfra Foundation Europe. All rights reserved.
  * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -29,8 +29,6 @@ import org.onap.policy.clamp.models.acm.messages.kafka.participant.ParticipantSt
 import org.onap.policy.common.endpoints.listeners.ScoListener;
 import org.onap.policy.common.message.bus.event.Topic.CommInfrastructure;
 import org.onap.policy.common.utils.coder.StandardCoderObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Component;
 
 /**
@@ -38,7 +36,6 @@ import org.springframework.stereotype.Component;
  */
 @Component
 public class ParticipantStatusListener extends ScoListener<ParticipantStatus> implements Listener<ParticipantStatus> {
-    private static final Logger LOGGER = LoggerFactory.getLogger(ParticipantStatusListener.class);
 
     private final SupervisionParticipantHandler supervisionHandler;
 
index 34ce3f7..08d637d 100644 (file)
@@ -43,7 +43,6 @@ import org.onap.policy.clamp.acm.runtime.instantiation.InstantiationUtils;
 import org.onap.policy.clamp.acm.runtime.util.CommonTestData;
 import org.onap.policy.clamp.acm.runtime.util.rest.CommonRestController;
 import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionDefinition;
-import org.onap.policy.clamp.models.acm.concepts.Participant;
 import org.onap.policy.clamp.models.acm.concepts.ParticipantSupportedElementType;
 import org.onap.policy.clamp.models.acm.messages.rest.commissioning.AcTypeStateUpdate;
 import org.onap.policy.clamp.models.acm.messages.rest.commissioning.CommissioningResponse;
index f64cbba..d270d6c 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2022-2023 Nordix Foundation.
+ *  Copyright (C) 2022-2023, 2025 OpenInfra Foundation Europe. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -51,7 +51,7 @@ class InstantiationControllerStubTest extends CommonRestController {
     private int randomServerPort;
 
     @BeforeEach
-    public void setUpPort() {
+    void setUpPort() {
         super.setHttpPrefix(randomServerPort);
     }
 
index 5af3ca2..b15a5bd 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2023 Nordix Foundation.
+ *  Copyright (C) 2023, 2025 OpenInfra Foundation Europe. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -45,7 +45,7 @@ class ParticipantControllerStubTest extends CommonRestController {
     private int randomServerPort;
 
     @BeforeEach
-    public void setUpPort() {
+    void setUpPort() {
         super.setHttpPrefix(randomServerPort);
     }
 
@@ -67,17 +67,19 @@ class ParticipantControllerStubTest extends CommonRestController {
     void testOrderReport() {
         var invocationBuilder = super.sendRequest(PARTICIPANT_ENDPOINT + "/" + PARTICIPANT_ID);
 
-        var respPost = invocationBuilder.header("Content-Length", 0).put(Entity.entity(""
-            "", MediaType.APPLICATION_JSON));
+        var respPost = invocationBuilder.header("Content-Length", 0)
+            .put(Entity.entity("", MediaType.APPLICATION_JSON));
         assertThat(Response.Status.ACCEPTED.getStatusCode()).isEqualTo(respPost.getStatus());
+        respPost.close();
     }
 
     @Test
     void testOrderAllReport() {
         var invocationBuilder = super.sendRequest(PARTICIPANT_ENDPOINT);
 
-        var respPost = invocationBuilder.header("Content-Length", 0).put(Entity.entity(""
-            "", MediaType.APPLICATION_JSON));
+        var respPost = invocationBuilder.header("Content-Length", 0)
+            .put(Entity.entity("", MediaType.APPLICATION_JSON));
         assertThat(Response.Status.ACCEPTED.getStatusCode()).isEqualTo(respPost.getStatus());
+        respPost.close();
     }
 }
index c28c787..8ecf450 100644 (file)
@@ -101,7 +101,7 @@ class AutomationCompositionInstantiationProviderTest {
     private static ToscaServiceTemplate serviceTemplateMigration = new ToscaServiceTemplate();
 
     @BeforeAll
-    public static void setUpBeforeClass() {
+    static void setUpBeforeClass() {
         var st = InstantiationUtils.getToscaServiceTemplate(TOSCA_SERVICE_TEMPLATE_YAML);
         var jpa = ProviderUtils.getJpaAndValidate(st, JpaToscaServiceTemplate::new, "toscaServiceTemplate");
         serviceTemplate = jpa.toAuthorative();
diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/main/rest/stub/StubUtilsTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/main/rest/stub/StubUtilsTest.java
new file mode 100644 (file)
index 0000000..3417148
--- /dev/null
@@ -0,0 +1,58 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2025 OpenInfra Foundation Europe. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.acm.runtime.main.rest.stub;
+
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import jakarta.servlet.http.HttpServletRequest;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.mockito.Mockito;
+import org.springframework.http.HttpStatus;
+
+class StubUtilsTest {
+
+    HttpServletRequest mockRequest;
+
+    StubUtils stubUtil;
+
+    @BeforeEach
+    void setUp() {
+        mockRequest = Mockito.mock(HttpServletRequest.class);
+        Mockito.when(mockRequest.getHeader("Accept")).thenReturn("application/yaml");
+        stubUtil = new StubUtils(mockRequest);
+    }
+
+    @Test
+    void getResponse() {
+        assertDoesNotThrow(() -> stubUtil.getResponse("does/not/exist/path", Object.class));
+        var response = stubUtil.getResponse("does/not/exist/path", Object.class);
+        assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, response.getStatusCode());
+    }
+
+    @Test
+    void getResponseList() {
+        assertDoesNotThrow(() -> stubUtil.getResponseList("does/not/exist/path"));
+        var response = stubUtil.getResponseList("does/not/exist/path");
+        assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, response.getStatusCode());
+    }
+}
\ No newline at end of file
index 08f1ab8..81dce9a 100644 (file)
@@ -98,7 +98,7 @@ class ParticipantControllerTest extends CommonRestController {
      * Adds participants to the db from json file.
      */
     @BeforeAll
-    public static void setUpBeforeClass() throws CoderException {
+    static void setUpBeforeClass() throws CoderException {
         inputParticipants.add(CODER.decode(ORIGINAL_JSON, Participant.class));
         inputParticipants.add(CODER.decode(ORIGINAL_JSON2, Participant.class));
         serviceTemplate = InstantiationUtils.getToscaServiceTemplate(TOSCA_SERVICE_TEMPLATE_YAML);
@@ -107,7 +107,7 @@ class ParticipantControllerTest extends CommonRestController {
     }
 
     @BeforeEach
-    public void setUpPort() {
+    void setUpPort() {
         super.setHttpPrefix(randomServerPort);
     }
 
index 7a72e0e..1d4370b 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2021-2024 Nordix Foundation.
+ *  Copyright (C) 2021-2025 OpenInfra Foundation Europe. All rights reserved.
  *  Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -30,7 +30,7 @@ import org.junit.jupiter.api.Test;
 class SupervisionAspectTest {
 
     @Test
-    void testSchedule() throws Exception {
+    void testSchedule() {
         var supervisionScanner = mock(SupervisionScanner.class);
         var participantScanner = mock(SupervisionParticipantScanner.class);
         try (var supervisionAspect = new SupervisionAspect(supervisionScanner, participantScanner)) {
@@ -41,7 +41,7 @@ class SupervisionAspectTest {
     }
 
     @Test
-    void testDoCheck() throws Exception {
+    void testDoCheck() {
         var supervisionScanner = mock(SupervisionScanner.class);
         var participantScanner = mock(SupervisionParticipantScanner.class);
         try (var supervisionAspect = new SupervisionAspect(supervisionScanner, participantScanner)) {
index 9c765e1..b742c93 100644 (file)
@@ -162,7 +162,7 @@ public class CommonRestController {
      *
      * @param port the port
      */
-    protected void setHttpPrefix(int port) {
+    public void setHttpPrefix(int port) {
         httpPrefix = "http://" + SELF + ":" + port + "/";
     }