From: FrancescoFioraEst Date: Mon, 26 Jan 2026 14:10:00 +0000 (+0000) Subject: Remove duplicate Spring config files from ACM-R X-Git-Tag: 9.0.1~10 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=4cac9ea564b1ad9250e25041965f6188712613fc;p=policy%2Fclamp.git Remove duplicate Spring config files from ACM-R Issue-ID: POLICY-5511 Change-Id: Id27befafcfdcfd02ff3db48f7f1d94f91a38d959 Signed-off-by: FrancescoFioraEst --- diff --git a/packages/policy-clamp-docker/src/main/docker/acm-runtime.sh b/packages/policy-clamp-docker/src/main/docker/acm-runtime.sh index 97cf6ab8e..df2a06e80 100644 --- a/packages/policy-clamp-docker/src/main/docker/acm-runtime.sh +++ b/packages/policy-clamp-docker/src/main/docker/acm-runtime.sh @@ -1,7 +1,7 @@ #!/usr/bin/env sh # # ============LICENSE_START======================================================= -# Copyright (C) 2021-2022, 2025 OpenInfra Foundation Europe. All rights reserved. +# Copyright (C) 2021-2022, 2025,2026 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. @@ -19,16 +19,6 @@ # ============LICENSE_END========================================================= # -if [ "$#" -eq 1 ]; then - CONFIG_FILE=$1 -fi - -if [ -z "$CONFIG_FILE" ]; then - CONFIG_FILE="${POLICY_HOME}/etc/AcRuntimeParameters.yaml" -fi - -echo "Policy clamp runtime acm config file: $CONFIG_FILE" - 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/ @@ -36,11 +26,4 @@ fi "$JAVA_HOME"/bin/java \ -Dlogging.config="${POLICY_HOME}/etc/logback.xml" \ - -Dcom.sun.management.jmxremote.rmi.port=9090 \ - -Dcom.sun.management.jmxremote=true \ - -Dcom.sun.management.jmxremote.port=9090 \ - -Dcom.sun.management.jmxremote.ssl=false \ - -Dcom.sun.management.jmxremote.authenticate=false \ - -Dcom.sun.management.jmxremote.local.only=false \ - -jar /app/app.jar \ - --spring.config.location="${CONFIG_FILE}" + -jar /app/app.jar diff --git a/packages/policy-clamp-tarball/src/main/resources/etc/AcRuntimeParameters.yaml b/packages/policy-clamp-tarball/src/main/resources/etc/AcRuntimeParameters.yaml deleted file mode 100644 index 64445abda..000000000 --- a/packages/policy-clamp-tarball/src/main/resources/etc/AcRuntimeParameters.yaml +++ /dev/null @@ -1,82 +0,0 @@ -spring: - security: - user: - name: runtimeUser - password: zb!XztG34 - http: - converters: - preferred-json-mapper: gson - datasource: - url: jdbc:postgresql://${postgresql.host:postgres}:${postgresql.port:5432}/clampacm - driverClassName: org.postgresql.jdbc.Driver - username: policy_user - password: policy_user - hikari: - connectionTimeout: 30000 - idleTimeout: 600000 - maxLifetime: 1800000 - maximumPoolSize: 10 - jpa: - hibernate: - ddl-auto: none - naming: - physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl - properties: - hibernate: - format_sql: true - -security: - enable-csrf: false - -server: - servlet: - context-path: /onap/policy/clamp/acm - port: 6969 - error: - path: /error - -runtime: - topics: - operationTopic: policy-acruntime-participant - syncTopic: acm-ppnt-sync - participantParameters: - heartBeatMs: 20000 - maxStatusWaitMs: 200000 - topicParameterGroup: - topicSources: - - - topic: ${runtime.topics.operationTopic} - servers: - - ${topicServer:kafka:9092} - topicCommInfrastructure: NOOP - fetchTimeout: 15000 - useHttps: true - topicSinks: - - - topic: ${runtime.topics.operationTopic} - servers: - - ${topicServer:kafka:9092} - topicCommInfrastructure: NOOP - useHttps: true - - - topic: ${runtime.topics.syncTopic} - servers: - - ${topicServer:kafka:9092} - topicCommInfrastructure: NOOP - useHttps: true - acmParameters: - toscaElementName: org.onap.policy.clamp.acm.AutomationCompositionElement - toscaCompositionName: org.onap.policy.clamp.acm.AutomationComposition - -management: - endpoints: - web: - base-path: / - exposure: - include: health, metrics, prometheus - endpoint: - health: - show-details: always - probes: - enabled: true - show-components: always diff --git a/runtime-acm/src/main/resources/application.yaml b/runtime-acm/src/main/resources/application.yaml index 244b08b6e..f4661b9ca 100644 --- a/runtime-acm/src/main/resources/application.yaml +++ b/runtime-acm/src/main/resources/application.yaml @@ -3,16 +3,16 @@ spring: active: default security: user: - name: runtimeUser - password: zb!XztG34 + name: ${RUNTIME_USER} + password: ${RUNTIME_PASSWORD} http: converters: preferred-json-mapper: gson datasource: - url: jdbc:postgresql://${postgresql.host:localhost}:${postgresql.port:5432}/clampacm + url: jdbc:postgresql://${SQL_HOST:localhost}:${SQL_PORT:5432}/clampacm driverClassName: org.postgresql.Driver - username: policy - password: P01icY + username: ${SQL_USER} + password: ${SQL_PASSWORD} hikari: connectionTimeout: 30000 idleTimeout: 600000 @@ -36,38 +36,68 @@ server: runtime: topics: - operationTopic: policy-acruntime-participant - syncTopic: acm-ppnt-sync + operationTopic: ${RUNTIME_OPERATION_TOPIC:policy-acruntime-participant} + syncTopic: ${RUNTIME_SYNC_TOPIC:acm-ppnt-sync} participantParameters: - heartBeatMs: 20000 - maxStatusWaitMs: 150000 - maxOperationWaitMs: 200000 + heartBeatMs: ${HEART_BEAT:120000} + maxStatusWaitMs: ${MAX_STATUS_WAIT:150000} + maxOperationWaitMs: ${MAX_OPERATION_WAIT:36000} topicParameterGroup: topicSources: - topic: ${runtime.topics.operationTopic} servers: - - ${topicServer:kafka:9092} - topicCommInfrastructure: NOOP + - ${KAFKA_SERVER:kafka:9092} + topicCommInfrastructure: ${TOPIC_COMM_INFRASTRUCTURE:NOOP} fetchTimeout: 15000 + useHttps: ${KAFKA_USE_HTTPS:false} + additionalProps: + group.id : ${KAFKA_GROUP_ID:acm-runtime} + max.poll.records: ${KAFKA_MAX_POLL_RECORDS:100} + max.partition.fetch.bytes: ${KAFKA_MAX_PARTITION_FETCH_BYTES:524288} + fetch.max.bytes: ${KAFKA_FETCH_MAX_BYTES:10485760} + enable.auto.commit: ${KAFKA_ENABLE_AUTO_COMMIT:true} + allow.auto.create.topics: ${KAFKA_ALLOW_AUTO_CREATE_TOPICS:true} + security.protocol: ${KAFKA_SECURITY_PROTOCOL:PLAINTEXT} + sasl.mechanism: ${KAFKA_SASL_MECHANISM:GSSAPI} + sasl.jaas.config: ${KAFKA_SASL_JAAS_CONFIG:} topicSinks: - topic: ${runtime.topics.operationTopic} servers: - - ${topicServer:kafka:9092} - topicCommInfrastructure: NOOP + - ${KAFKA_SERVER:kafka:9092} + topicCommInfrastructure: ${TOPIC_COMM_INFRASTRUCTURE:NOOP} + useHttps: ${KAFKA_USE_HTTPS:false} + additionalProps: + allow.auto.create.topics: ${KAFKA_ALLOW_AUTO_CREATE_TOPICS:true} + security.protocol: ${KAFKA_SECURITY_PROTOCOL:PLAINTEXT} + sasl.mechanism: ${KAFKA_SASL_MECHANISM:GSSAPI} + sasl.jaas.config: ${KAFKA_SASL_JAAS_CONFIG:} - topic: ${runtime.topics.syncTopic} servers: - - ${topicServer:kafka:9092} - topicCommInfrastructure: NOOP + - ${KAFKA_SERVER:kafka:9092} + topicCommInfrastructure: ${TOPIC_COMM_INFRASTRUCTURE:NOOP} + useHttps: ${KAFKA_USE_HTTPS:false} + additionalProps: + allow.auto.create.topics: ${KAFKA_ALLOW_AUTO_CREATE_TOPICS:true} + security.protocol: ${KAFKA_SECURITY_PROTOCOL:PLAINTEXT} + sasl.mechanism: ${KAFKA_SASL_MECHANISM:GSSAPI} + sasl.jaas.config: ${KAFKA_SASL_JAAS_CONFIG:} acmParameters: - toscaElementName: org.onap.policy.clamp.acm.AutomationCompositionElement - toscaCompositionName: org.onap.policy.clamp.acm.AutomationComposition - enableEncryption: true + toscaElementName: ${TOSCA_ELEMENT_NAME:org.onap.policy.clamp.acm.AutomationCompositionElement} + toscaCompositionName: ${TOSCA_COMPOSITION_NAME:org.onap.policy.clamp.acm.AutomationComposition} + enableEncryption: ${MSG_ENABLE_ENCRYPTION:false} management: + server: + port: ${PROMETHEUS_PORT:6970} + tracing: + propagation: + produce: ${JAEGER_PRODUCER_TYPE:B3} + sampling: + probability: ${JAEGER_SAMPLING_PROBABILITY:1.0} endpoints: web: - base-path: / + base-path: /actuator exposure: include: health, metrics, prometheus endpoint: @@ -76,3 +106,17 @@ management: probes: enabled: true show-components: always + health: + db: + enabled: false + +tracing: + enabled: ${ALLOW_TRACING:false} + exporter: + endpoint: ${TRACING_EXPORTER_ENDPOINT:http://jaeger:4318/v1/traces} + protocol: ${TRACING_EXPORTER_PROTOCOL:http} + sampler: + jaeger-remote: + endpoint: ${TRACING_SAMPLER_ENDPOINT:http://jaeger:14250} + +basicAuth: ${BASIC_AUTH:true} diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/main/rest/ActuatorControllerTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/main/rest/ActuatorControllerTest.java index a3448c5e3..41f6b7a02 100644 --- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/main/rest/ActuatorControllerTest.java +++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/main/rest/ActuatorControllerTest.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2021-2025 OpenInfra Foundation Europe. All rights reserved. + * Copyright (C) 2021-2026 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. @@ -25,7 +25,6 @@ import static org.springframework.http.MediaType.TEXT_PLAIN; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.onap.policy.common.message.bus.event.TopicEndpoint; import org.onap.policy.common.message.bus.event.TopicEndpointManager; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -39,10 +38,13 @@ import org.springframework.web.reactive.function.client.ExchangeFilterFunctions; @AutoConfigureObservability @AutoConfigureWebTestClient -@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = {"management.server.port:"}) @ActiveProfiles("test") class ActuatorControllerTest { + public static final String HEALTH = "/actuator/health"; + public static final String STATUS_CODE = "$.status.code"; + @Autowired private WebTestClient webClient; @@ -59,43 +61,43 @@ class ActuatorControllerTest { @Test void testGetHealth() { - webClient.get().uri("/health").accept(APPLICATION_JSON) + webClient.get().uri(HEALTH).accept(APPLICATION_JSON) .exchange().expectStatus().isOk() - .expectBody().jsonPath("$.status.code").isEqualTo("UP"); + .expectBody().jsonPath(STATUS_CODE).isEqualTo("UP"); - TopicEndpoint topicEndpoint = TopicEndpointManager.getManager(); + var topicEndpoint = TopicEndpointManager.getManager(); topicEndpoint.stop(); - webClient.get().uri("/health").accept(APPLICATION_JSON) + webClient.get().uri(HEALTH).accept(APPLICATION_JSON) .exchange().expectStatus().is5xxServerError() - .expectBody().jsonPath("$.status.code").isEqualTo("DOWN"); + .expectBody().jsonPath(STATUS_CODE).isEqualTo("DOWN"); topicEndpoint.start(); } @Test void testHealthIndicator() { - TopicEndpoint topicEndpoint = TopicEndpointManager.getManager(); + var topicEndpoint = TopicEndpointManager.getManager(); topicEndpoint.getNoopTopicSource("policy-acruntime-participant").stop(); - webClient.get().uri("/health").accept(APPLICATION_JSON) + webClient.get().uri(HEALTH).accept(APPLICATION_JSON) .exchange().expectStatus().is5xxServerError() - .expectBody().jsonPath("$.status.code").isEqualTo("OUT_OF_SERVICE"); + .expectBody().jsonPath(STATUS_CODE).isEqualTo("OUT_OF_SERVICE"); topicEndpoint.getNoopTopicSource("policy-acruntime-participant").start(); topicEndpoint.getNoopTopicSink("acm-ppnt-sync").stop(); - webClient.get().uri("/health").accept(APPLICATION_JSON) + webClient.get().uri(HEALTH).accept(APPLICATION_JSON) .exchange().expectStatus().is5xxServerError() - .expectBody().jsonPath("$.status.code").isEqualTo("OUT_OF_SERVICE"); + .expectBody().jsonPath(STATUS_CODE).isEqualTo("OUT_OF_SERVICE"); topicEndpoint.getNoopTopicSink("acm-ppnt-sync").start(); } @Test void testGetMetrics() { - webClient.get().uri("/metrics").accept(APPLICATION_JSON) + webClient.get().uri("/actuator/metrics").accept(APPLICATION_JSON) .exchange().expectStatus().isOk(); } @Test void testGetPrometheus() { - webClient.get().uri("/prometheus").accept(TEXT_PLAIN) + webClient.get().uri("/actuator/prometheus").accept(TEXT_PLAIN) .exchange().expectStatus().isOk(); } diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/main/rest/PrometheusNoAuthTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/main/rest/PrometheusNoAuthTest.java index 87e43ea8c..cdae223d5 100644 --- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/main/rest/PrometheusNoAuthTest.java +++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/main/rest/PrometheusNoAuthTest.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2023-2024 Nordix Foundation. + * Copyright (C) 2023-2024,2026 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. @@ -33,7 +33,7 @@ import org.springframework.test.web.reactive.server.WebTestClient; @AutoConfigureObservability(tracing = false) @ExtendWith(SpringExtension.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, properties = {"management.server.port:"}) @ActiveProfiles({"prometheus-noauth", "default"}) class PrometheusNoAuthTest { @@ -42,7 +42,7 @@ class PrometheusNoAuthTest { @Test void testGetPrometheus() { - webClient.get().uri("/prometheus").accept(TEXT_PLAIN) + webClient.get().uri("/actuator/prometheus").accept(TEXT_PLAIN) .exchange().expectStatus().isOk(); } } diff --git a/runtime-acm/src/test/resources/application-hibernate-validation.yaml b/runtime-acm/src/test/resources/application-hibernate-validation.yaml index 9975fe1fd..db72ca16b 100644 --- a/runtime-acm/src/test/resources/application-hibernate-validation.yaml +++ b/runtime-acm/src/test/resources/application-hibernate-validation.yaml @@ -1,4 +1,8 @@ spring: + security: + user: + name: runtimeUser + password: zb!XztG34 liquibase: enabled: true jpa: diff --git a/runtime-acm/src/test/resources/application-prometheus-noauth.yaml b/runtime-acm/src/test/resources/application-prometheus-noauth.yaml index 9815fe343..801ca5b74 100644 --- a/runtime-acm/src/test/resources/application-prometheus-noauth.yaml +++ b/runtime-acm/src/test/resources/application-prometheus-noauth.yaml @@ -1,4 +1,8 @@ spring: + security: + user: + name: runtimeUser + password: datasource: url: jdbc:h2:mem:testdb driverClassName: org.h2.Driver diff --git a/runtime-acm/src/test/resources/application-test.yaml b/runtime-acm/src/test/resources/application-test.yaml index e06a3c942..d771d8548 100644 --- a/runtime-acm/src/test/resources/application-test.yaml +++ b/runtime-acm/src/test/resources/application-test.yaml @@ -1,4 +1,8 @@ spring: + security: + user: + name: runtimeUser + password: zb!XztG34 datasource: url: jdbc:h2:mem:testdb driverClassName: org.h2.Driver