From 90369b37a019ac46a1673e9864b5757edee36545 Mon Sep 17 00:00:00 2001 From: "adheli.tavares" Date: Thu, 11 Dec 2025 11:37:27 +0000 Subject: [PATCH] Decoupling clamp from policy-parent - added the settings.xml for maven to know the nexus configuration when generating new artifacts - moving the two classes using spring from policy-common to runtime-acm module where they are used - removed the suse images as they are not needed - fixed a Kafka test that was taking too long to run. Issue-ID: POLICY-5521 Change-Id: I232b3569b13da93b61fcf90b65d1f20e820c3fcb Signed-off-by: adheli.tavares --- models/pom.xml | 4 - .../main/docker/A1pmsParticipant-Suse.Dockerfile | 64 -------- .../src/main/docker/AcmRuntime-Suse.Dockerfile | 64 -------- .../main/docker/ElementParticipant-Suse.Dockerfile | 64 -------- .../main/docker/HttpParticipant-Suse.Dockerfile | 64 -------- .../main/docker/KserveParticipant-Suse.Dockerfile | 66 -------- .../docker/KubernetesParticipant-Suse.Dockerfile | 74 --------- .../main/docker/PolicyParticipant-Suse.Dockerfile | 64 -------- .../src/main/docker/SimParticipant-Suse.Dockerfile | 64 -------- .../main/resources/etc/AcRuntimeParameters.yaml | 3 +- policy-common/pom.xml | 12 -- .../bus/event/kafka/KafkaPublisherWrapper.java | 18 ++- .../spring/utils/CustomImplicitNamingStrategy.java | 39 ----- .../bus/event/kafka/KafkaPublisherWrapperTest.java | 10 +- .../utils/CustomImplicitNamingStrategyTest.java | 74 --------- .../{ => converter}/ConverterConfiguration.java | 32 ++-- .../converter}/YamlHttpMessageConverter.java | 46 +++--- runtime-acm/src/main/resources/application.yaml | 3 +- .../converter}/YamlHttpMessageConverterTest.java | 48 ++++-- settings.xml | 174 +++++++++++++++++++++ 20 files changed, 266 insertions(+), 721 deletions(-) delete mode 100644 packages/policy-clamp-docker/src/main/docker/A1pmsParticipant-Suse.Dockerfile delete mode 100644 packages/policy-clamp-docker/src/main/docker/AcmRuntime-Suse.Dockerfile delete mode 100644 packages/policy-clamp-docker/src/main/docker/ElementParticipant-Suse.Dockerfile delete mode 100644 packages/policy-clamp-docker/src/main/docker/HttpParticipant-Suse.Dockerfile delete mode 100644 packages/policy-clamp-docker/src/main/docker/KserveParticipant-Suse.Dockerfile delete mode 100644 packages/policy-clamp-docker/src/main/docker/KubernetesParticipant-Suse.Dockerfile delete mode 100644 packages/policy-clamp-docker/src/main/docker/PolicyParticipant-Suse.Dockerfile delete mode 100644 packages/policy-clamp-docker/src/main/docker/SimParticipant-Suse.Dockerfile delete mode 100644 policy-common/src/main/java/org/onap/policy/common/spring/utils/CustomImplicitNamingStrategy.java delete mode 100644 policy-common/src/test/java/org/onap/policy/common/spring/utils/CustomImplicitNamingStrategyTest.java rename runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/{ => converter}/ConverterConfiguration.java (51%) rename {policy-common/src/main/java/org/onap/policy/common/spring/utils => runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/converter}/YamlHttpMessageConverter.java (69%) rename {policy-common/src/test/java/org/onap/policy/common/spring/utils => runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/config/converter}/YamlHttpMessageConverterTest.java (70%) create mode 100644 settings.xml diff --git a/models/pom.xml b/models/pom.xml index 7a8f6915b..caf150a4d 100644 --- a/models/pom.xml +++ b/models/pom.xml @@ -88,10 +88,6 @@ org.springframework.data spring-data-commons - - org.springframework - spring-core - org.springframework spring-tx diff --git a/packages/policy-clamp-docker/src/main/docker/A1pmsParticipant-Suse.Dockerfile b/packages/policy-clamp-docker/src/main/docker/A1pmsParticipant-Suse.Dockerfile deleted file mode 100644 index a03f26286..000000000 --- a/packages/policy-clamp-docker/src/main/docker/A1pmsParticipant-Suse.Dockerfile +++ /dev/null @@ -1,64 +0,0 @@ -#------------------------------------------------------------------------------- -# ============LICENSE_START======================================================= -# Copyright (C) 2022 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. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# SPDX-License-Identifier: Apache-2.0 -# ============LICENSE_END========================================================= -#------------------------------------------------------------------------------- - -FROM busybox AS tarball -RUN mkdir /packages /extracted -COPY /maven/lib/a1pms-participant.tar.gz /packages/ -RUN tar xvzf /packages/a1pms-participant.tar.gz --directory /extracted/ - -FROM opensuse/leap:15.4 - -LABEL maintainer="Policy Team" -LABEL org.opencontainers.image.title="Policy CLAMP ACM A1 PMS Participant" -LABEL org.opencontainers.image.description="Policy CLAMP ACM A1 PMS Participant image based on OpenSuse" -LABEL org.opencontainers.image.url="https://github.com/onap/policy-clamp" -LABEL org.opencontainers.image.vendor="ONAP Policy Team" -LABEL org.opencontainers.image.licenses="Apache-2.0" -LABEL org.opencontainers.image.created="${git.build.time}" -LABEL org.opencontainers.image.version="${git.build.version}" -LABEL org.opencontainers.image.revision="${git.commit.id.abbrev}" - -ARG POLICY_LOGS=/var/log/onap/policy/a1pms-participant - -ENV POLICY_LOGS=$POLICY_LOGS -ENV POLICY_HOME=/opt/app/policy/clamp -ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 -ENV JAVA_HOME=/usr/lib64/jvm/java-11-openjdk-11 - -RUN zypper -n -q install --no-recommends java-11-openjdk-headless netcat-openbsd && \ - zypper -n -q update && zypper -n -q clean --all && \ - groupadd --system policy && \ - useradd --system --shell /bin/sh -G policy policy && \ - mkdir -p $POLICY_HOME $POLICY_LOGS && \ - chown -R policy:policy $POLICY_HOME $POLICY_LOGS - -COPY --chown=policy:policy --from=tarball /extracted $POLICY_HOME - -WORKDIR $POLICY_HOME -COPY --chown=policy:policy a1pms-participant.sh bin/ -COPY --chown=policy:policy /maven/policy-clamp-participant-impl-a1pms.jar /app/app.jar - -RUN chmod 755 bin/*.sh - -EXPOSE 8086 - -USER policy -WORKDIR $POLICY_HOME/bin -ENTRYPOINT [ "./a1pms-participant.sh" ] diff --git a/packages/policy-clamp-docker/src/main/docker/AcmRuntime-Suse.Dockerfile b/packages/policy-clamp-docker/src/main/docker/AcmRuntime-Suse.Dockerfile deleted file mode 100644 index 992735855..000000000 --- a/packages/policy-clamp-docker/src/main/docker/AcmRuntime-Suse.Dockerfile +++ /dev/null @@ -1,64 +0,0 @@ -#------------------------------------------------------------------------------- -# ============LICENSE_START======================================================= -# Copyright (C) 2022 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. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# SPDX-License-Identifier: Apache-2.0 -# ============LICENSE_END========================================================= -#------------------------------------------------------------------------------- - -FROM busybox AS tarball -RUN mkdir /packages /extracted -COPY /maven/lib/policy-clamp-runtime-acm.tar.gz /packages/ -RUN tar xvzf /packages/policy-clamp-runtime-acm.tar.gz --directory /extracted/ - -FROM opensuse/leap:15.4 - -LABEL maintainer="Policy Team" -LABEL org.opencontainers.image.title="Policy CLAMP ACM runtime" -LABEL org.opencontainers.image.description="Policy CLAMP ACM runtime image based on OpenSuse" -LABEL org.opencontainers.image.url="https://github.com/onap/policy-clamp" -LABEL org.opencontainers.image.vendor="ONAP Policy Team" -LABEL org.opencontainers.image.licenses="Apache-2.0" -LABEL org.opencontainers.image.created="${git.build.time}" -LABEL org.opencontainers.image.version="${git.build.version}" -LABEL org.opencontainers.image.revision="${git.commit.id.abbrev}" - -ARG POLICY_LOGS=/var/log/onap/policy/policy-clamp-runtime-acm - -ENV POLICY_LOGS=$POLICY_LOGS -ENV POLICY_HOME=/opt/app/policy/clamp -ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 -ENV JAVA_HOME=/usr/lib64/jvm/java-11-openjdk-11 - -RUN zypper -n -q install --no-recommends java-11-openjdk-headless netcat-openbsd && \ - zypper -n -q update && zypper -n -q clean --all && \ - groupadd --system policy && \ - useradd --system --shell /bin/sh -G policy policy && \ - mkdir -p $POLICY_HOME $POLICY_LOGS && \ - chown -R policy:policy $POLICY_HOME $POLICY_LOGS - -COPY --chown=policy:policy --from=tarball /extracted $POLICY_HOME - -WORKDIR $POLICY_HOME -COPY --chown=policy:policy acm-runtime.sh bin/ -COPY --chown=policy:policy /maven/policy-clamp-runtime-acm.jar /app/app.jar - -RUN chmod 755 bin/*.sh - -EXPOSE 6969 - -USER policy -WORKDIR $POLICY_HOME/bin -ENTRYPOINT [ "./acm-runtime.sh" ] diff --git a/packages/policy-clamp-docker/src/main/docker/ElementParticipant-Suse.Dockerfile b/packages/policy-clamp-docker/src/main/docker/ElementParticipant-Suse.Dockerfile deleted file mode 100644 index ed809620a..000000000 --- a/packages/policy-clamp-docker/src/main/docker/ElementParticipant-Suse.Dockerfile +++ /dev/null @@ -1,64 +0,0 @@ -#------------------------------------------------------------------------------- -# ============LICENSE_START======================================================= -# Copyright (C) 2022 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. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# SPDX-License-Identifier: Apache-2.0 -# ============LICENSE_END========================================================= -#------------------------------------------------------------------------------- - -FROM busybox AS tarball -RUN mkdir /packages /extracted -COPY /maven/lib/element-participant.tar.gz /packages -RUN tar xvfz /packages/element-participant.tar.gz --directory /extracted/ - -FROM opensuse/leap:15.4 - -LABEL maintainer="Policy Team" -LABEL org.opencontainers.image.title="Policy CLAMP ACM Element Participant" -LABEL org.opencontainers.image.description="Policy CLAMP ACM Element Participant image based on OpenSuse" -LABEL org.opencontainers.image.url="https://github.com/onap/policy-clamp" -LABEL org.opencontainers.image.vendor="ONAP Policy Team" -LABEL org.opencontainers.image.licenses="Apache-2.0" -LABEL org.opencontainers.image.created="${git.build.time}" -LABEL org.opencontainers.image.version="${git.build.version}" -LABEL org.opencontainers.image.revision="${git.commit.id.abbrev}" - -ARG POLICY_LOGS=/var/log/onap/policy/element-participant - -ENV POLICY_LOGS=$POLICY_LOGS -ENV POLICY_HOME=/opt/app/policy/clamp -ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 -ENV JAVA_HOME=/usr/lib64/jvm/java-11-openjdk-11 - -RUN zypper -n -q install --no-recommends java-11-openjdk-headless netcat-openbsd && \ - zypper -n -q update && zypper -n -q clean --all && \ - groupadd --system policy && \ - useradd --system --shell /bin/sh -G policy policy && \ - mkdir -p $POLICY_HOME $POLICY_LOGS && \ - chown -R policy:policy $POLICY_HOME $POLICY_LOGS - -COPY --chown=policy:policy --from=tarball /extracted $POLICY_HOME - -WORKDIR $POLICY_HOME -COPY --chown=policy:policy element-participant.sh bin/ -COPY --chown=policy:policy /maven/policy-clamp-acm-element-impl.jar /app/app.jar - -RUN chmod 755 bin/*.sh - -EXPOSE 8084 - -USER policy -WORKDIR $POLICY_HOME/bin -ENTRYPOINT [ "./element-participant.sh" ] diff --git a/packages/policy-clamp-docker/src/main/docker/HttpParticipant-Suse.Dockerfile b/packages/policy-clamp-docker/src/main/docker/HttpParticipant-Suse.Dockerfile deleted file mode 100644 index 9e8333a0e..000000000 --- a/packages/policy-clamp-docker/src/main/docker/HttpParticipant-Suse.Dockerfile +++ /dev/null @@ -1,64 +0,0 @@ -#------------------------------------------------------------------------------- -# ============LICENSE_START======================================================= -# Copyright (C) 2022 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. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# SPDX-License-Identifier: Apache-2.0 -# ============LICENSE_END========================================================= -#------------------------------------------------------------------------------- - -FROM busybox AS tarball -RUN mkdir /packages /extracted -COPY /maven/lib/http-participant.tar.gz /packages/ -RUN tar xvzf /packages/http-participant.tar.gz --directory /extracted/ - -FROM opensuse/leap:15.4 - -LABEL maintainer="Policy Team" -LABEL org.opencontainers.image.title="Policy CLAMP ACM HTTP Participant" -LABEL org.opencontainers.image.description="Policy CLAMP ACM HTTP Participant image based on OpenSuse" -LABEL org.opencontainers.image.url="https://github.com/onap/policy-clamp" -LABEL org.opencontainers.image.vendor="ONAP Policy Team" -LABEL org.opencontainers.image.licenses="Apache-2.0" -LABEL org.opencontainers.image.created="${git.build.time}" -LABEL org.opencontainers.image.version="${git.build.version}" -LABEL org.opencontainers.image.revision="${git.commit.id.abbrev}" - -ARG POLICY_LOGS=/var/log/onap/policy/http-participant - -ENV POLICY_LOGS=$POLICY_LOGS -ENV POLICY_HOME=/opt/app/policy/clamp -ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 -ENV JAVA_HOME=/usr/lib64/jvm/java-11-openjdk-11 - -RUN zypper -n -q install --no-recommends java-11-openjdk-headless netcat-openbsd && \ - zypper -n -q update && zypper -n -q clean --all && \ - groupadd --system policy && \ - useradd --system --shell /bin/sh -G policy policy && \ - mkdir -p $POLICY_HOME $POLICY_LOGS && \ - chown -R policy:policy $POLICY_HOME $POLICY_LOGS - -COPY --chown=policy:policy --from=tarball /extracted $POLICY_HOME - -WORKDIR $POLICY_HOME -COPY --chown=policy:policy http-participant.sh bin/ -COPY --chown=policy:policy /maven/policy-clamp-participant-impl-http.jar /app/app.jar - -RUN chmod 755 bin/*.sh - -EXPOSE 8084 - -USER policy -WORKDIR $POLICY_HOME/bin -ENTRYPOINT [ "./http-participant.sh" ] diff --git a/packages/policy-clamp-docker/src/main/docker/KserveParticipant-Suse.Dockerfile b/packages/policy-clamp-docker/src/main/docker/KserveParticipant-Suse.Dockerfile deleted file mode 100644 index b4d204956..000000000 --- a/packages/policy-clamp-docker/src/main/docker/KserveParticipant-Suse.Dockerfile +++ /dev/null @@ -1,66 +0,0 @@ -#------------------------------------------------------------------------------- -# ============LICENSE_START======================================================= -# 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 -# -# 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========================================================= -#------------------------------------------------------------------------------- - -FROM busybox AS tarball -RUN mkdir /packages /extracted -COPY /maven/lib/kserve-participant.tar.gz /packages/ -RUN tar xvzf /packages/kserve-participant.tar.gz --directory /extracted/ - -FROM opensuse/leap:15.4 - -LABEL maintainer="Policy Team" -LABEL org.opencontainers.image.title="Policy CLAMP ACM KSERVE Participant" -LABEL org.opencontainers.image.description="Policy CLAMP ACM KSERVE Participant image based on OpenSuse" -LABEL org.opencontainers.image.url="https://github.com/onap/policy-clamp" -LABEL org.opencontainers.image.vendor="ONAP Policy Team" -LABEL org.opencontainers.image.licenses="Apache-2.0" -LABEL org.opencontainers.image.created="${git.build.time}" -LABEL org.opencontainers.image.version="${git.build.version}" -LABEL org.opencontainers.image.revision="${git.commit.id.abbrev}" - -ARG POLICY_LOGS=/var/log/onap/policy/kserve-participant - -ENV POLICY_LOGS=$POLICY_LOGS -ENV POLICY_HOME=/opt/app/policy/clamp -ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 -ENV JAVA_HOME=/usr/lib64/jvm/java-11-openjdk-11 - -RUN zypper -n -q install --no-recommends gzip java-11-openjdk-headless netcat-openbsd tar wget && \ - zypper -n -q update && zypper -n -q clean --all && \ - groupadd --system policy && \ - useradd --system --shell /bin/sh -G policy policy && \ - mkdir -p /app $POLICY_HOME $POLICY_LOGS && \ - chown -R policy:policy /app $POLICY_HOME $POLICY_LOGS - -COPY --chown=policy:policy --from=tarball /extracted $POLICY_HOME - -WORKDIR $POLICY_HOME -COPY --chown=policy:policy kserve-participant.sh bin/ -COPY --chown=policy:policy /maven/policy-clamp-participant-impl-kserve.jar /app/app.jar - -RUN chmod 755 bin/*.sh - -EXPOSE 8087 - -USER policy -WORKDIR $POLICY_HOME/bin -ENTRYPOINT [ "./kserve-participant.sh" ] - - diff --git a/packages/policy-clamp-docker/src/main/docker/KubernetesParticipant-Suse.Dockerfile b/packages/policy-clamp-docker/src/main/docker/KubernetesParticipant-Suse.Dockerfile deleted file mode 100644 index 18175f3a7..000000000 --- a/packages/policy-clamp-docker/src/main/docker/KubernetesParticipant-Suse.Dockerfile +++ /dev/null @@ -1,74 +0,0 @@ -#------------------------------------------------------------------------------- -# ============LICENSE_START======================================================= -# Copyright (C) 2022 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. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# SPDX-License-Identifier: Apache-2.0 -# ============LICENSE_END========================================================= -#------------------------------------------------------------------------------- - -FROM busybox AS tarball -RUN mkdir /packages /extracted -COPY /maven/lib/kubernetes-participant.tar.gz /packages/ -RUN tar xvzf /packages/kubernetes-participant.tar.gz --directory /extracted/ - -FROM opensuse/leap:15.4 - -LABEL maintainer="Policy Team" -LABEL org.opencontainers.image.title="Policy CLAMP ACM K8S Participant" -LABEL org.opencontainers.image.description="Policy CLAMP ACM K8S Participant image based on OpenSuse" -LABEL org.opencontainers.image.url="https://github.com/onap/policy-clamp" -LABEL org.opencontainers.image.vendor="ONAP Policy Team" -LABEL org.opencontainers.image.licenses="Apache-2.0" -LABEL org.opencontainers.image.created="${git.build.time}" -LABEL org.opencontainers.image.version="${git.build.version}" -LABEL org.opencontainers.image.revision="${git.commit.id.abbrev}" - -ARG POLICY_LOGS=/var/log/onap/policy/k8s-participant - -ENV POLICY_LOGS=$POLICY_LOGS -ENV POLICY_HOME=/opt/app/policy/clamp -ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 -ENV JAVA_HOME=/usr/lib64/jvm/java-11-openjdk-11 - -RUN zypper -n -q install --no-recommends gzip java-11-openjdk-headless netcat-openbsd tar wget && \ - zypper -n -q update && zypper -n -q clean --all && \ - groupadd --system policy && \ - useradd --system --shell /bin/sh -G policy policy && \ - mkdir -p /app $POLICY_HOME $POLICY_LOGS && \ - chown -R policy:policy /app $POLICY_HOME $POLICY_LOGS - -COPY --chown=policy:policy --from=tarball /extracted $POLICY_HOME - -WORKDIR $POLICY_HOME -COPY --chown=policy:policy kubernetes-participant.sh bin/ -COPY --chown=policy:policy /maven/policy-clamp-participant-impl-kubernetes.jar /app/app.jar - -RUN chmod 755 bin/*.sh && \ - wget -nv https://get.helm.sh/helm-v3.5.2-linux-amd64.tar.gz && \ - tar xvf helm-v3.5.2-linux-amd64.tar.gz && \ - mv linux-amd64/helm /usr/local/bin && \ - rm -rf linux-amd64 && \ - rm helm-v3.5.2-linux-amd64.tar.gz && \ - wget -nv https://storage.googleapis.com/kubernetes-release/release/v1.21.1/bin/linux/amd64/kubectl && \ - chmod +x kubectl && \ - mv kubectl /usr/local/bin/kubectl - -EXPOSE 8083 - -USER policy -WORKDIR $POLICY_HOME/bin -ENTRYPOINT [ "./kubernetes-participant.sh" ] - - diff --git a/packages/policy-clamp-docker/src/main/docker/PolicyParticipant-Suse.Dockerfile b/packages/policy-clamp-docker/src/main/docker/PolicyParticipant-Suse.Dockerfile deleted file mode 100644 index 6373ddf97..000000000 --- a/packages/policy-clamp-docker/src/main/docker/PolicyParticipant-Suse.Dockerfile +++ /dev/null @@ -1,64 +0,0 @@ -#------------------------------------------------------------------------------- -# ============LICENSE_START======================================================= -# Copyright (C) 2022 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. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# SPDX-License-Identifier: Apache-2.0 -# ============LICENSE_END========================================================= -#------------------------------------------------------------------------------- - -FROM busybox AS tarball -RUN mkdir /packages /extracted -COPY /maven/lib/policy-participant.tar.gz /packages/ -RUN tar xvzf /packages/policy-participant.tar.gz --directory /extracted/ - -FROM opensuse/leap:15.4 - -LABEL maintainer="Policy Team" -LABEL org.opencontainers.image.title="Policy CLAMP ACM Policy Framework Participant" -LABEL org.opencontainers.image.description="Policy CLAMP ACM Policy Framework Participant image based on OpenSuse" -LABEL org.opencontainers.image.url="https://github.com/onap/policy-clamp" -LABEL org.opencontainers.image.vendor="ONAP Policy Team" -LABEL org.opencontainers.image.licenses="Apache-2.0" -LABEL org.opencontainers.image.created="${git.build.time}" -LABEL org.opencontainers.image.version="${git.build.version}" -LABEL org.opencontainers.image.revision="${git.commit.id.abbrev}" - -ARG POLICY_LOGS=/var/log/onap/policy/pf-participant - -ENV POLICY_LOGS=$POLICY_LOGS -ENV POLICY_HOME=/opt/app/policy/clamp -ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 -ENV JAVA_HOME=/usr/lib64/jvm/java-11-openjdk-11 - -RUN zypper -n -q install --no-recommends java-11-openjdk-headless netcat-openbsd && \ - zypper -n -q update && zypper -n -q clean --all && \ - groupadd --system policy && \ - useradd --system --shell /bin/sh -G policy policy && \ - mkdir -p $POLICY_HOME $POLICY_LOGS && \ - chown -R policy:policy $POLICY_HOME $POLICY_LOGS - -COPY --chown=policy:policy --from=tarball /extracted $POLICY_HOME - -WORKDIR $POLICY_HOME -COPY --chown=policy:policy policy-participant.sh bin/ -COPY --chown=policy:policy /maven/policy-clamp-participant-impl-policy.jar /app/app.jar - -RUN chmod 755 bin/*.sh - -EXPOSE 8085 - -USER policy -WORKDIR $POLICY_HOME/bin -ENTRYPOINT [ "./policy-participant.sh" ] diff --git a/packages/policy-clamp-docker/src/main/docker/SimParticipant-Suse.Dockerfile b/packages/policy-clamp-docker/src/main/docker/SimParticipant-Suse.Dockerfile deleted file mode 100644 index 29e8b4839..000000000 --- a/packages/policy-clamp-docker/src/main/docker/SimParticipant-Suse.Dockerfile +++ /dev/null @@ -1,64 +0,0 @@ -#------------------------------------------------------------------------------- -# ============LICENSE_START======================================================= -# Copyright (C) 2022 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. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# SPDX-License-Identifier: Apache-2.0 -# ============LICENSE_END========================================================= -#------------------------------------------------------------------------------- - -FROM busybox AS tarball -RUN mkdir /packages /extracted -COPY /maven/lib/sim-participant.tar.gz /packages/ -RUN tar xvzf /packages/sim-participant.tar.gz --directory /extracted/ - -FROM opensuse/leap:15.4 - -LABEL maintainer="Policy Team" -LABEL org.opencontainers.image.title="Policy CLAMP ACM Simulator Participant" -LABEL org.opencontainers.image.description="Policy CLAMP ACM Simulator Participant image based on OpenSuse" -LABEL org.opencontainers.image.url="https://github.com/onap/policy-clamp" -LABEL org.opencontainers.image.vendor="ONAP Policy Team" -LABEL org.opencontainers.image.licenses="Apache-2.0" -LABEL org.opencontainers.image.created="${git.build.time}" -LABEL org.opencontainers.image.version="${git.build.version}" -LABEL org.opencontainers.image.revision="${git.commit.id.abbrev}" - -ARG POLICY_LOGS=/var/log/onap/policy/sim-participant - -ENV POLICY_LOGS=$POLICY_LOGS -ENV POLICY_HOME=/opt/app/policy/clamp -ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 -ENV JAVA_HOME=/usr/lib64/jvm/java-11-openjdk-11 - -RUN zypper -n -q install --no-recommends java-11-openjdk-headless netcat-openbsd && \ - zypper -n -q update && zypper -n -q clean --all && \ - groupadd --system policy && \ - useradd --system --shell /bin/sh -G policy policy && \ - mkdir -p $POLICY_HOME $POLICY_LOGS && \ - chown -R policy:policy $POLICY_HOME $POLICY_LOGS - -COPY --chown=policy:policy --from=tarball /extracted $POLICY_HOME - -WORKDIR $POLICY_HOME -COPY --chown=policy:policy sim-participant.sh bin/ -COPY --chown=policy:policy /maven/policy-clamp-participant-impl-sim.jar /app/app.jar - -RUN chmod 755 bin/*.sh - -EXPOSE 8084 - -USER policy -WORKDIR $POLICY_HOME/bin -ENTRYPOINT [ "./sim-participant.sh" ] diff --git a/packages/policy-clamp-tarball/src/main/resources/etc/AcRuntimeParameters.yaml b/packages/policy-clamp-tarball/src/main/resources/etc/AcRuntimeParameters.yaml index 28938c0e6..64445abda 100644 --- a/packages/policy-clamp-tarball/src/main/resources/etc/AcRuntimeParameters.yaml +++ b/packages/policy-clamp-tarball/src/main/resources/etc/AcRuntimeParameters.yaml @@ -3,7 +3,7 @@ spring: user: name: runtimeUser password: zb!XztG34 - mvc: + http: converters: preferred-json-mapper: gson datasource: @@ -21,7 +21,6 @@ spring: ddl-auto: none naming: physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl - implicit-strategy: org.onap.policy.common.spring.utils.CustomImplicitNamingStrategy properties: hibernate: format_sql: true diff --git a/policy-common/pom.xml b/policy-common/pom.xml index dd64bdb2d..0f891c26c 100644 --- a/policy-common/pom.xml +++ b/policy-common/pom.xml @@ -92,10 +92,6 @@ org.apache.commons commons-jexl3 - - org.hibernate.orm - hibernate-core - org.projectlombok lombok @@ -112,14 +108,6 @@ ch.qos.logback logback-classic - - org.springframework - spring-core - - - org.springframework - spring-web - org.yaml snakeyaml diff --git a/policy-common/src/main/java/org/onap/policy/common/message/bus/event/kafka/KafkaPublisherWrapper.java b/policy-common/src/main/java/org/onap/policy/common/message/bus/event/kafka/KafkaPublisherWrapper.java index 86b9e9366..41866bdb3 100644 --- a/policy-common/src/main/java/org/onap/policy/common/message/bus/event/kafka/KafkaPublisherWrapper.java +++ b/policy-common/src/main/java/org/onap/policy/common/message/bus/event/kafka/KafkaPublisherWrapper.java @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2024 Nordix Foundation. + * Copyright (C) 2024-2025 OpenInfra Foundation Europe. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,7 +31,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * Kafka based library publisher. + * Kafka-based library publisher. */ public class KafkaPublisherWrapper implements BusPublisher { @@ -79,7 +79,19 @@ public class KafkaPublisherWrapper implements BusPublisher { TracingProducerInterceptor.class.getName()); } - producer = new KafkaProducer<>(kafkaProps); + producer = createProducer(kafkaProps); + } + + /** + * Creates a Kafka Producer with the given properties. + * + * @param kafkaProps the properties to configure the Kafka Producer, including + * details such as bootstrap servers, serializers, and other + * configurations. + * @return a configured KafkaProducer instance ready for sending messages to Kafka topics. + */ + protected KafkaProducer createProducer(Properties kafkaProps) { + return new KafkaProducer<>(kafkaProps); } @Override diff --git a/policy-common/src/main/java/org/onap/policy/common/spring/utils/CustomImplicitNamingStrategy.java b/policy-common/src/main/java/org/onap/policy/common/spring/utils/CustomImplicitNamingStrategy.java deleted file mode 100644 index d9a7e97c0..000000000 --- a/policy-common/src/main/java/org/onap/policy/common/spring/utils/CustomImplicitNamingStrategy.java +++ /dev/null @@ -1,39 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * 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. - * 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.common.spring.utils; - -import java.io.Serial; -import org.hibernate.boot.model.naming.Identifier; -import org.hibernate.boot.model.naming.ImplicitJoinColumnNameSource; -import org.hibernate.boot.model.naming.ImplicitNamingStrategyJpaCompliantImpl; - -public class CustomImplicitNamingStrategy extends ImplicitNamingStrategyJpaCompliantImpl { - - @Serial - private static final long serialVersionUID = 8666774028328486896L; - - @Override - public Identifier determineJoinColumnName(ImplicitJoinColumnNameSource source) { - String name = source.getReferencedColumnName().getText(); - return toIdentifier(name, source.getBuildingContext()); - } -} diff --git a/policy-common/src/test/java/org/onap/policy/common/message/bus/event/kafka/KafkaPublisherWrapperTest.java b/policy-common/src/test/java/org/onap/policy/common/message/bus/event/kafka/KafkaPublisherWrapperTest.java index 8e13af239..69e315197 100644 --- a/policy-common/src/test/java/org/onap/policy/common/message/bus/event/kafka/KafkaPublisherWrapperTest.java +++ b/policy-common/src/test/java/org/onap/policy/common/message/bus/event/kafka/KafkaPublisherWrapperTest.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2024 Nordix Foundation + * Copyright (C) 2024-2025 OpenInfra Foundation Europe. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ package org.onap.policy.common.message.bus.event.kafka; import static org.assertj.core.api.Assertions.assertThatCode; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; @@ -29,7 +30,6 @@ import static org.mockito.Mockito.when; import java.util.Collections; import java.util.Properties; import org.apache.kafka.clients.producer.KafkaProducer; -import org.apache.kafka.clients.producer.Producer; import org.apache.kafka.clients.producer.ProducerRecord; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -39,7 +39,7 @@ import org.onap.policy.common.parameters.topic.BusTopicParams; class KafkaPublisherWrapperTest { private KafkaPublisherWrapper kafkaPublisherWrapper; - private Producer mockProducer; + private KafkaProducer mockProducer; private BusTopicParams mockBusTopicParams; @BeforeEach @@ -54,7 +54,7 @@ class KafkaPublisherWrapperTest { when(mockBusTopicParams.isAllowTracing()).thenReturn(false); kafkaPublisherWrapper = new KafkaPublisherWrapper(mockBusTopicParams) { - private Producer createProducer(Properties props) { // NOSONAR instance creation + public KafkaProducer createProducer(Properties props) { // NOSONAR instance creation return mockProducer; } }; @@ -88,7 +88,7 @@ class KafkaPublisherWrapperTest { @Test void testSendFailure() { when(mockProducer.send(ArgumentMatchers.any(ProducerRecord.class))).thenThrow(RuntimeException.class); - assertTrue(kafkaPublisherWrapper.send("partitionId", "testMessage")); + assertFalse(kafkaPublisherWrapper.send("partitionId", "testMessage")); } @Test diff --git a/policy-common/src/test/java/org/onap/policy/common/spring/utils/CustomImplicitNamingStrategyTest.java b/policy-common/src/test/java/org/onap/policy/common/spring/utils/CustomImplicitNamingStrategyTest.java deleted file mode 100644 index 09719dd3d..000000000 --- a/policy-common/src/test/java/org/onap/policy/common/spring/utils/CustomImplicitNamingStrategyTest.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * Copyright (C) 2024 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.common.spring.utils; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import org.hibernate.boot.model.naming.Identifier; -import org.hibernate.boot.model.naming.ImplicitJoinColumnNameSource; -import org.hibernate.boot.model.relational.Database; -import org.hibernate.boot.spi.InFlightMetadataCollector; -import org.hibernate.boot.spi.MetadataBuildingContext; -import org.hibernate.engine.jdbc.env.spi.IdentifierHelper; -import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; -import org.mockito.Mock; - -class CustomImplicitNamingStrategyTest { - - static CustomImplicitNamingStrategy strategy; - - @Mock - static ImplicitJoinColumnNameSource source; - - @BeforeAll - static void setUpBeforeClass() { - strategy = new CustomImplicitNamingStrategy(); - source = mock(ImplicitJoinColumnNameSource.class); - } - - @Test - void testDetermineJoinColumnName() { - Identifier identifier = new Identifier("identifier", true); - - MetadataBuildingContext buildingContextMock = mock(MetadataBuildingContext.class); - InFlightMetadataCollector flightCollectorMock = mock(InFlightMetadataCollector.class); - Database databaseMock = mock(Database.class); - - when(flightCollectorMock.getDatabase()).thenReturn(databaseMock); - when(source.getReferencedColumnName()).thenReturn(identifier); - when(source.getBuildingContext()).thenReturn(buildingContextMock); - when(buildingContextMock.getMetadataCollector()).thenReturn(flightCollectorMock); - - JdbcEnvironment environmentMock = mock(JdbcEnvironment.class); - when(databaseMock.getJdbcEnvironment()).thenReturn(environmentMock); - - IdentifierHelper helperMock = mock(IdentifierHelper.class); - when(environmentMock.getIdentifierHelper()).thenReturn(helperMock); - when(helperMock.toIdentifier(anyString())).thenReturn(identifier); - - Identifier result = strategy.determineJoinColumnName(source); - assertEquals(identifier, result); - } - -} diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/ConverterConfiguration.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/converter/ConverterConfiguration.java similarity index 51% rename from runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/ConverterConfiguration.java rename to runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/converter/ConverterConfiguration.java index f08e28f70..9a56be292 100644 --- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/ConverterConfiguration.java +++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/converter/ConverterConfiguration.java @@ -1,27 +1,25 @@ -/*- +/* * ============LICENSE_START======================================================= - * Copyright (C) 2021-2022 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 + * 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 + * 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. * - * 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========================================================= + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= */ -package org.onap.policy.clamp.acm.runtime.config; +package org.onap.policy.clamp.acm.runtime.config.converter; import java.util.List; -import org.onap.policy.common.spring.utils.YamlHttpMessageConverter; import org.springframework.context.annotation.Configuration; import org.springframework.http.MediaType; import org.springframework.http.converter.HttpMessageConverter; diff --git a/policy-common/src/main/java/org/onap/policy/common/spring/utils/YamlHttpMessageConverter.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/converter/YamlHttpMessageConverter.java similarity index 69% rename from policy-common/src/main/java/org/onap/policy/common/spring/utils/YamlHttpMessageConverter.java rename to runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/converter/YamlHttpMessageConverter.java index 5fa026089..0e6e64bd8 100644 --- a/policy-common/src/main/java/org/onap/policy/common/spring/utils/YamlHttpMessageConverter.java +++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/converter/YamlHttpMessageConverter.java @@ -1,24 +1,23 @@ -/*- +/* * ============LICENSE_START======================================================= - * Copyright (C) 2022-2023 Bell Canada. 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 + * 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 + * 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. * - * 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========================================================= + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= */ -package org.onap.policy.common.spring.utils; +package org.onap.policy.clamp.acm.runtime.config.converter; import java.io.IOException; import java.io.InputStreamReader; @@ -37,6 +36,7 @@ import org.springframework.http.MediaType; import org.springframework.http.converter.AbstractGenericHttpMessageConverter; import org.springframework.http.converter.HttpMessageNotReadableException; import org.springframework.http.converter.HttpMessageNotWritableException; +import org.springframework.lang.NonNull; import org.springframework.lang.Nullable; /** @@ -54,13 +54,15 @@ public class YamlHttpMessageConverter extends AbstractGenericHttpMessageConverte } @Override - public final Object read(Type type, @Nullable Class contextClass, HttpInputMessage inputMessage) - throws IOException { + @NonNull + public final Object read(@NonNull Type type, @Nullable Class contextClass, + @NonNull HttpInputMessage inputMessage) { return readResolved(GenericTypeResolver.resolveType(type, contextClass), inputMessage); } @Override - protected final Object readInternal(Class clazz, HttpInputMessage inputMessage) throws IOException { + @NonNull + protected final Object readInternal(@NonNull Class clazz, @NonNull HttpInputMessage inputMessage) { return readResolved(clazz, inputMessage); } @@ -70,8 +72,8 @@ public class YamlHttpMessageConverter extends AbstractGenericHttpMessageConverte } @Override - protected final void writeInternal(Object object, @Nullable Type type, HttpOutputMessage outputMessage) - throws IOException { + protected final void writeInternal(@NonNull Object object, @Nullable Type type, + @NonNull HttpOutputMessage outputMessage) { try (var writer = getWriter(outputMessage)) { writeInternal(object, writer); writer.flush(); @@ -84,7 +86,7 @@ public class YamlHttpMessageConverter extends AbstractGenericHttpMessageConverte TRANSLATOR.toYaml(writer, object); } - private Object readResolved(Type resolvedType, HttpInputMessage inputMessage) throws IOException { + private Object readResolved(Type resolvedType, HttpInputMessage inputMessage) { try (var reader = getReader(inputMessage)) { return readInternal(resolvedType, reader); } catch (Exception ex) { diff --git a/runtime-acm/src/main/resources/application.yaml b/runtime-acm/src/main/resources/application.yaml index 84d805df7..244b08b6e 100644 --- a/runtime-acm/src/main/resources/application.yaml +++ b/runtime-acm/src/main/resources/application.yaml @@ -5,7 +5,7 @@ spring: user: name: runtimeUser password: zb!XztG34 - mvc: + http: converters: preferred-json-mapper: gson datasource: @@ -23,7 +23,6 @@ spring: ddl-auto: none naming: physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl - implicit-strategy: org.onap.policy.common.spring.utils.CustomImplicitNamingStrategy properties: hibernate: format_sql: true diff --git a/policy-common/src/test/java/org/onap/policy/common/spring/utils/YamlHttpMessageConverterTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/config/converter/YamlHttpMessageConverterTest.java similarity index 70% rename from policy-common/src/test/java/org/onap/policy/common/spring/utils/YamlHttpMessageConverterTest.java rename to runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/config/converter/YamlHttpMessageConverterTest.java index 0c4674125..7b7ca8727 100644 --- a/policy-common/src/test/java/org/onap/policy/common/spring/utils/YamlHttpMessageConverterTest.java +++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/config/converter/YamlHttpMessageConverterTest.java @@ -1,24 +1,23 @@ /* * ============LICENSE_START======================================================= - * ONAP - * ================================================================================ - * Copyright (C) 2024 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * 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 + * 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. * - * 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. - * ============LICENSE_END========================================================= + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= */ -package org.onap.policy.common.spring.utils; +package org.onap.policy.clamp.acm.runtime.config.converter; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; @@ -93,7 +92,7 @@ class YamlHttpMessageConverterTest { // Mocking HttpHeaders HttpHeaders headers = mock(HttpHeaders.class); when(headers.getContentType()).thenReturn(MediaType.APPLICATION_JSON); // Return JSON media type - when(headers.getAcceptCharset()).thenReturn(null); // Return null to use default charset + when(headers.getAcceptCharset()).thenReturn(null); // Return null to use the default charset // Mocking HttpOutputMessage HttpOutputMessage outputMessage = mock(HttpOutputMessage.class); @@ -118,7 +117,7 @@ class YamlHttpMessageConverterTest { void testWriteInternalWithException() throws IOException { // Mocking HttpHeaders HttpHeaders headers = mock(HttpHeaders.class); - when(headers.getContentType()).thenReturn(MediaType.APPLICATION_JSON); // Return YAML media type + when(headers.getContentType()).thenReturn(MediaType.APPLICATION_JSON); // Should return YAML media type // Mocking HttpOutputMessage to throw an IOException when getBody() is called HttpOutputMessage outputMessage = mock(HttpOutputMessage.class); @@ -133,4 +132,19 @@ class YamlHttpMessageConverterTest { assertThrows(HttpMessageNotWritableException.class, () -> converter.write(map, null, outputMessage)); } + @Test + void testThrowException_NullValues() { + assertThrows(NullPointerException.class, () -> converter.write(null, null, null)); + assertThrows(HttpMessageNotReadableException.class, () -> converter.read(null, null, null)); + assertThrows(HttpMessageNotReadableException.class, () -> converter.read(Map.class, null, null)); + assertThrows(HttpMessageNotWritableException.class, () -> converter.writeInternal(null, null, null)); + assertThrows(HttpMessageNotReadableException.class, () -> converter.readInternal(null, null)); + assertThrows(HttpMessageNotReadableException.class, () -> converter.readInternal(Map.class, null)); + + var map = new HashMap<>(); + map.put("key", "value"); + assertThrows(NullPointerException.class, () -> converter.write(map, null, null)); + assertThrows(HttpMessageNotWritableException.class, () -> converter.writeInternal(map, null, null)); + } + } diff --git a/settings.xml b/settings.xml new file mode 100644 index 000000000..39ff52d95 --- /dev/null +++ b/settings.xml @@ -0,0 +1,174 @@ + + + + + + + onap-settings + + https://nexus.onap.org + https://nexus.onap.org/content/sites/raw + https://nexus.onap.org/service/local/repositories/raw/content + ecomp-raw + + + nexus3.onap.org:10003 + nexus3.onap.org:10002 + nexus3.onap.org:10001 + nexus3.onap.org:10003 + + + + onap-snapshots + + + onap-snapshots + onap-snapshots + https://nexus.onap.org/content/repositories/snapshots/ + + false + + + true + + + + + + onap-snapshots + onap-snapshots + https://nexus.onap.org/content/repositories/snapshots/ + + false + + + true + + + + + + onap-releases + + + onap-releases + onap-releases + https://nexus.onap.org/content/repositories/releases/ + + true + + + false + + + + + + onap-releases + onap-releases + https://nexus.onap.org/content/repositories/releases/ + + true + + + false + + + + + + onap-public + + + central + https://repo1.maven.org/maven2/ + + + onap-public + onap-public + https://nexus.onap.org/content/repositories/public/ + + true + + + false + + + + + + central + https://repo1.maven.org/maven2/ + + + onap-public + onap-public + https://nexus.onap.org/content/repositories/public/ + + true + + + false + + + + + + + local-public + + + local-public + local-public + http://nexus-proxy:8081/nexus/content/repositories/public/ + + true + + + false + + + + + + local-public + local-public + http://nexus-proxy:8081/nexus/content/repositories/public/ + + true + + + false + + + + + + + + onap-settings + onap-snapshots + onap-releases + onap-public + + + + -- 2.16.6