aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--a1-policy-management/config/application.yaml1
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/BeanFactory.java4
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/AsyncRestClientFactory.java9
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfig.java54
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/WebClientConfig.java6
-rw-r--r--a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ApplicationTest.java11
-rw-r--r--a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationControllerTest.java39
-rw-r--r--a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v3/PolicyControllerV3Test.java14
-rw-r--r--a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/utils/v3/ReactiveEntryExitFilterDisableTest.java23
-rw-r--r--a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/utils/v3/ReactiveEntryExitFilterTest.java22
-rw-r--r--a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/utils/v3/TestHelperTest.java7
11 files changed, 138 insertions, 52 deletions
diff --git a/a1-policy-management/config/application.yaml b/a1-policy-management/config/application.yaml
index 95c5f758..4b1dbcef 100644
--- a/a1-policy-management/config/application.yaml
+++ b/a1-policy-management/config/application.yaml
@@ -121,6 +121,7 @@ server:
http-port: 8081
shutdown: "graceful"
ssl:
+ enabled: true
key-store-type: JKS
key-store-password: policy_agent
key-store: /opt/app/policy-agent/etc/cert/keystore.jks
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/BeanFactory.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/BeanFactory.java
index 4d1fa331..4d825f85 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/BeanFactory.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/BeanFactory.java
@@ -3,7 +3,7 @@
* ONAP : ccsdk oran
* ======================================================================
* Copyright (C) 2019-2020 Nordix Foundation. All rights reserved.
- * Copyright (C) 2023-2024 OpenInfra Foundation Europe. All rights reserved.
+ * 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.
@@ -37,7 +37,7 @@ import org.springframework.context.annotation.Configuration;
@Configuration
public class BeanFactory {
- @Value("${server.http-port}")
+ @Value("${server.http-port:0}")
private int httpPort = 0;
@Bean
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/AsyncRestClientFactory.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/AsyncRestClientFactory.java
index 204af9c0..6d642a31 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/AsyncRestClientFactory.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/AsyncRestClientFactory.java
@@ -3,6 +3,8 @@
* ONAP : ccsdk oran
* ======================================================================
* Copyright (C) 2019-2022 Nordix Foundation. All rights reserved.
+ * Modifications 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.
@@ -59,7 +61,12 @@ public class AsyncRestClientFactory {
public AsyncRestClientFactory(WebClientConfig clientConfig, SecurityContext securityContext) {
if (clientConfig != null) {
- this.sslContextFactory = new CachingSslContextFactory(clientConfig);
+ if (clientConfig.isSslEnabled()) {
+ this.sslContextFactory = new CachingSslContextFactory(clientConfig);
+ } else {
+ this.sslContextFactory = null;
+ logger.debug("SSL is turned OFF for the web client");
+ }
this.httpProxyConfig = clientConfig.getHttpProxyConfig();
} else {
logger.warn("No configuration for web client defined, HTTPS will not work");
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfig.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfig.java
index 6d8d52de..360369c0 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfig.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfig.java
@@ -3,7 +3,8 @@
* ONAP : ccsdk oran
* ======================================================================
* Copyright (C) 2019-2020 Nordix Foundation. All rights reserved.
- * Modifications Copyright (C) 2023-2025 OpenInfra Foundation Europe. All rights reserved.
+ * Modifications 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.
@@ -39,36 +40,40 @@ import reactor.netty.transport.ProxyProvider;
public class ApplicationConfig {
@Getter
- @Value("${app.filepath}")
+ @Value("${app.filepath:null}")
private String localConfigurationFilePath;
@Getter
- @Value("${app.config-file-schema-path:}")
+ @Value("${app.config-file-schema-path:null}")
private String configurationFileSchemaPath;
@Getter
@Value("${app.vardata-directory:null}")
private String vardataDirectory;
- @Value("${server.ssl.key-store-type}")
+ @Getter
+ @Value("${server.ssl.enabled:true}")
+ private boolean sslEnabled;
+
+ @Value("${server.ssl.key-store-type:null}")
private String sslKeyStoreType = "";
- @Value("${server.ssl.key-store-password}")
+ @Value("${server.ssl.key-store-password:null}")
private String sslKeyStorePassword = "";
- @Value("${server.ssl.key-store}")
+ @Value("${server.ssl.key-store:null}")
private String sslKeyStore = "";
- @Value("${server.ssl.key-password}")
+ @Value("${server.ssl.key-password:null}")
private String sslKeyPassword = "";
- @Value("${app.webclient.trust-store-used}")
+ @Value("${app.webclient.trust-store-used:false}")
private boolean sslTrustStoreUsed = false;
- @Value("${app.webclient.trust-store-password}")
+ @Value("${app.webclient.trust-store-password:null}")
private String sslTrustStorePassword = "";
- @Value("${app.webclient.trust-store}")
+ @Value("${app.webclient.trust-store:null}")
private String sslTrustStore = "";
@Value("${app.webclient.http.proxy-host:}")
@@ -133,17 +138,26 @@ public class ApplicationConfig {
.httpProxyPort(this.httpProxyPort) //
.httpProxyType(ProxyProvider.Proxy.valueOf(this.httpProxyType)) //
.build();
+ if (sslEnabled) {
+ this.webClientConfig = WebClientConfig.builder() //
+ .sslEnabled(true)
+ .keyStoreType(this.sslKeyStoreType) //
+ .keyStorePassword(this.sslKeyStorePassword) //
+ .keyStore(this.sslKeyStore) //
+ .keyPassword(this.sslKeyPassword) //
+ .isTrustStoreUsed(this.sslTrustStoreUsed) //
+ .trustStore(this.sslTrustStore) //
+ .trustStorePassword(this.sslTrustStorePassword) //
+ .httpProxyConfig(httpProxyConfig) //
+ .build();
+ } else {
+ this.webClientConfig = WebClientConfig.builder() //
+ .sslEnabled(false)
+ .isTrustStoreUsed(false)
+ .httpProxyConfig(httpProxyConfig) //
+ .build();
+ }
- this.webClientConfig = WebClientConfig.builder() //
- .keyStoreType(this.sslKeyStoreType) //
- .keyStorePassword(this.sslKeyStorePassword) //
- .keyStore(this.sslKeyStore) //
- .keyPassword(this.sslKeyPassword) //
- .isTrustStoreUsed(this.sslTrustStoreUsed) //
- .trustStore(this.sslTrustStore) //
- .trustStorePassword(this.sslTrustStorePassword) //
- .httpProxyConfig(httpProxyConfig) //
- .build();
}
return this.webClientConfig;
}
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/WebClientConfig.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/WebClientConfig.java
index ab2958c6..1f22d995 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/WebClientConfig.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/WebClientConfig.java
@@ -3,6 +3,8 @@
* ONAP : ccsdk oran
* ======================================================================
* Copyright (C) 2020-2023 Nordix Foundation. All rights reserved.
+ * Modifications 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.
@@ -23,13 +25,15 @@ package org.onap.ccsdk.oran.a1policymanagementservice.configuration;
import lombok.Builder;
import lombok.Getter;
import lombok.ToString;
-
import reactor.netty.transport.ProxyProvider;
@Builder
@Getter
@ToString
public class WebClientConfig {
+
+ private boolean sslEnabled;
+
private String keyStoreType;
private String keyStorePassword;
diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ApplicationTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ApplicationTest.java
index 5ed8642a..864a1c53 100644
--- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ApplicationTest.java
+++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ApplicationTest.java
@@ -3,6 +3,8 @@
* ONAP : ccsdk oran
* ======================================================================
* Copyright (C) 2019-2023 Nordix Foundation. All rights reserved.
+ * Modifications 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.
@@ -1170,6 +1172,7 @@ class ApplicationTest {
private AsyncRestClient restClient(String baseUrl, boolean useTrustValidation) {
WebClientConfig config = this.applicationConfig.getWebClientConfig();
config = WebClientConfig.builder()
+ .sslEnabled(config.isSslEnabled())
.keyStoreType(config.getKeyStoreType())
.keyStorePassword(config.getKeyStorePassword())
.keyStore(config.getKeyStore())
@@ -1185,8 +1188,12 @@ class ApplicationTest {
}
- private String baseUrl() {
- return "https://localhost:" + port;
+ public String baseUrl() {
+ if (applicationConfig.isSslEnabled()) {
+ return "https://localhost:" + port;
+ } else {
+ return "http://localhost:" + port;
+ }
}
private AsyncRestClient restClient(boolean useTrustValidation) {
diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationControllerTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationControllerTest.java
index e46b8367..05f82c6d 100644
--- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationControllerTest.java
+++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationControllerTest.java
@@ -1,6 +1,8 @@
/*-
* ========================LICENSE_START=================================
* Copyright (C) 2020-2023 Nordix Foundation. All rights reserved.
+ * Modifications 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.
@@ -64,8 +66,6 @@ import reactor.test.StepVerifier;
"app.config-file-schema-path=/application_configuration_schema.json" //
})
class ConfigurationControllerTest {
- @Autowired
- ApplicationContext context;
@Autowired
ApplicationConfig applicationConfig;
@@ -166,19 +166,28 @@ class ConfigurationControllerTest {
private AsyncRestClient restClient() {
WebClientConfig config = this.applicationConfig.getWebClientConfig();
- config = WebClientConfig.builder() //
- .keyStoreType(config.getKeyStoreType()) //
- .keyStorePassword(config.getKeyStorePassword()) //
- .keyStore(config.getKeyStore()) //
- .keyPassword(config.getKeyPassword()) //
- .isTrustStoreUsed(false) //
- .trustStore(config.getTrustStore()) //
- .trustStorePassword(config.getTrustStorePassword()) //
- .httpProxyConfig(config.getHttpProxyConfig()) //
- .build();
-
- AsyncRestClientFactory f = new AsyncRestClientFactory(config, new SecurityContext(""));
- return f.createRestClientNoHttpProxy("https://localhost:" + port);
+ if (applicationConfig.isSslEnabled()) {
+ config = WebClientConfig.builder() //
+ .sslEnabled(applicationConfig.isSslEnabled())
+ .keyStoreType(config.getKeyStoreType()) //
+ .keyStorePassword(config.getKeyStorePassword()) //
+ .keyStore(config.getKeyStore()) //
+ .keyPassword(config.getKeyPassword()) //
+ .isTrustStoreUsed(config.isTrustStoreUsed()) //
+ .trustStore(config.getTrustStore()) //
+ .trustStorePassword(config.getTrustStorePassword()) //
+ .httpProxyConfig(config.getHttpProxyConfig()) //
+ .build();
+
+ AsyncRestClientFactory f = new AsyncRestClientFactory(config, new SecurityContext(""));
+ return f.createRestClientNoHttpProxy("https://localhost:" + port);
+ } else {
+ config = WebClientConfig.builder()
+ .httpProxyConfig(config.getHttpProxyConfig())
+ .build();
+ AsyncRestClientFactory f = new AsyncRestClientFactory(config, new SecurityContext(""));
+ return f.createRestClientNoHttpProxy("http://localhost:" + port);
+ }
}
}
diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v3/PolicyControllerV3Test.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v3/PolicyControllerV3Test.java
index 2904a069..36e88238 100644
--- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v3/PolicyControllerV3Test.java
+++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v3/PolicyControllerV3Test.java
@@ -163,7 +163,7 @@ class PolicyControllerV3Test {
Mono<ResponseEntity<String>> responseMono = testHelperTest.restClientV3().postForEntity(url, policyBody);
testHelperTest.testSuccessResponse(responseMono, HttpStatus.CREATED, responseBody ->
responseBody.contains("{\"scope\":{\"ueId\":\"ue5100\",\"qosId\":\"qos5100\"},\"qosObjectives\":{\"priorityLevel\":5100.0}}"));
- testHelperTest.testSuccessHeader(responseMono, "location", headerValue -> headerValue.contains("https://localhost:" + port + "/a1-policy-management/v1/policies/"));
+ testHelperTest.testSuccessHeader(responseMono, "location", headerValue -> headerValue.contains(testHelperTest.baseUrl() + "/a1-policy-management/v1/policies/"));
}
@@ -179,7 +179,7 @@ class PolicyControllerV3Test {
Mono<ResponseEntity<String>> responseMono = testHelperTest.restClientV3().postForEntity(url, policyBody);
testHelperTest.testSuccessResponse(responseMono, HttpStatus.CREATED, responseBody ->
responseBody.contains("{\"scope\":{\"ueId\":\"ue5100\",\"qosId\":\"qos5100\"},\"qosObjectives\":{\"priorityLevel\":5100.0}}"));
- testHelperTest.testSuccessHeader(responseMono, "location", headerValue -> headerValue.contains("https://localhost:" + port + "/a1-policy-management/v1/policies/"));
+ testHelperTest.testSuccessHeader(responseMono, "location", headerValue -> headerValue.contains(testHelperTest.baseUrl() + "/a1-policy-management/v1/policies/"));
}
@@ -195,7 +195,7 @@ class PolicyControllerV3Test {
Mono<ResponseEntity<String>> responseMono = testHelperTest.restClientV3().postForEntity(url, policyBody);
testHelperTest.testSuccessResponse(responseMono, HttpStatus.CREATED, responseBody ->
responseBody.contains("{\"scope\":{\"ueId\":\"ue5100\",\"qosId\":\"qos5100\"},\"qosObjectives\":{\"priorityLevel\":5100.0}}"));
- testHelperTest.testSuccessHeader(responseMono, "location", headerValue -> headerValue.contains("https://localhost:" + port + "/a1-policy-management/v1/policies/"));
+ testHelperTest.testSuccessHeader(responseMono, "location", headerValue -> headerValue.contains(testHelperTest.baseUrl() + "/a1-policy-management/v1/policies/"));
}
@@ -211,7 +211,7 @@ class PolicyControllerV3Test {
Mono<ResponseEntity<String>> responseMono = testHelperTest.restClientV3().postForEntity(url, policyBody);
testHelperTest.testSuccessResponse(responseMono, HttpStatus.CREATED, responseBody ->
responseBody.contains("{\"scope\":{\"ueId\":\"ue5100\",\"qosId\":\"qos5100\"},\"qosObjectives\":{\"priorityLevel\":5100.0}}"));
- testHelperTest.testSuccessHeader(responseMono, "location", headerValue -> headerValue.contains("https://localhost:" + port + "/a1-policy-management/v1/policies/"));
+ testHelperTest.testSuccessHeader(responseMono, "location", headerValue -> headerValue.contains(testHelperTest.baseUrl() + "/a1-policy-management/v1/policies/"));
}
@Test
@@ -237,7 +237,7 @@ class PolicyControllerV3Test {
testHelperTest.addPolicyType(policyTypeName, nonRtRicId);
String policyBody = testHelperTest.postBadPolicyBody(nonRtRicId, policyTypeName, "");
Mono<ResponseEntity<String>> responseMono = testHelperTest.restClientV3().postForEntity(url, policyBody);
- testHelperTest.testSuccessHeader(responseMono, "location", headerValue -> headerValue.contains("https://localhost:" + port + "/a1-policy-management/v1/policies/"));
+ testHelperTest.testSuccessHeader(responseMono, "location", headerValue -> headerValue.contains(testHelperTest.baseUrl() + "/a1-policy-management/v1/policies/"));
}
@Test
@@ -250,7 +250,7 @@ class PolicyControllerV3Test {
testHelperTest.addPolicyType(policyTypeName, nonRtRicId);
String policyBody = testHelperTest.postBadPolicyBody(nonRtRicId, policyTypeName, "");
Mono<ResponseEntity<String>> responseMono = testHelperTest.restClientV3().postForEntity(url, policyBody);
- testHelperTest.testSuccessHeader(responseMono, "location", headerValue -> headerValue.contains("https://localhost:" + port + "/a1-policy-management/v1/policies/"));
+ testHelperTest.testSuccessHeader(responseMono, "location", headerValue -> headerValue.contains(testHelperTest.baseUrl() + "/a1-policy-management/v1/policies/"));
}
@Test
@@ -262,7 +262,7 @@ class PolicyControllerV3Test {
testHelperTest.addPolicyType(policyTypeName, nonRtRicId);
String policyBody = testHelperTest.postPolicyBody(nonRtRicId, policyTypeName, "1");
Mono<ResponseEntity<String>> responseMono = testHelperTest.restClientV3().postForEntity(url, policyBody);
- testHelperTest.testSuccessHeader(responseMono, "location", headerValue -> headerValue.contains("https://localhost:" + port + "/a1-policy-management/v1/policies/1"));
+ testHelperTest.testSuccessHeader(responseMono, "location", headerValue -> headerValue.contains(testHelperTest.baseUrl() + "/a1-policy-management/v1/policies/1"));
}
@Test
diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/utils/v3/ReactiveEntryExitFilterDisableTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/utils/v3/ReactiveEntryExitFilterDisableTest.java
index 54b9d295..94ab47db 100644
--- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/utils/v3/ReactiveEntryExitFilterDisableTest.java
+++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/utils/v3/ReactiveEntryExitFilterDisableTest.java
@@ -1,3 +1,23 @@
+/*-
+ * ========================LICENSE_START=================================
+ * ONAP : ccsdk oran
+ * ======================================================================
+ * 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.
+ * ========================LICENSE_END===================================
+ */
+
package org.onap.ccsdk.oran.a1policymanagementservice.utils.v3;
import org.junit.jupiter.api.AfterAll;
@@ -24,7 +44,6 @@ import java.lang.invoke.MethodHandles;
import java.nio.file.Path;
import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertTrue;
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@ExtendWith({OutputCaptureExtension.class})
@@ -74,7 +93,7 @@ class ReactiveEntryExitFilterDisableTest {
Mono<ResponseEntity<String>> responseMono = testHelperTest.restClientV3().postForEntity(url, policyBody);
testHelperTest.testSuccessResponse(responseMono, HttpStatus.CREATED, responseBody ->
responseBody.contains("{\"scope\":{\"ueId\":\"ue5100\",\"qosId\":\"qos5100\"},\"qosObjectives\":{\"priorityLevel\":5100.0}}"));
- testHelperTest.testSuccessHeader(responseMono, "location", headerValue -> headerValue.contains("https://localhost:" + port + "/a1-policy-management/v1/policies/"));
+ testHelperTest.testSuccessHeader(responseMono, "location", headerValue -> headerValue.contains(testHelperTest.baseUrl() + "/a1-policy-management/v1/policies/"));
assertFalse(capturedOutput.getOut().contains("Request received with path: /a1-policy-management/v1/policies"));
assertFalse(capturedOutput.getOut().contains("the Status code of the response: 201 CREATED"));
assertFalse(capturedOutput.getOut().contains("the response is:"));
diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/utils/v3/ReactiveEntryExitFilterTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/utils/v3/ReactiveEntryExitFilterTest.java
index 9e0f60ea..0086c1eb 100644
--- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/utils/v3/ReactiveEntryExitFilterTest.java
+++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/utils/v3/ReactiveEntryExitFilterTest.java
@@ -1,3 +1,23 @@
+/*-
+ * ========================LICENSE_START=================================
+ * ONAP : ccsdk oran
+ * ======================================================================
+ * 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.
+ * ========================LICENSE_END===================================
+ */
+
package org.onap.ccsdk.oran.a1policymanagementservice.utils.v3;
import org.junit.jupiter.api.AfterAll;
@@ -74,7 +94,7 @@ class ReactiveEntryExitFilterTest {
Mono<ResponseEntity<String>> responseMono = testHelperTest.restClientV3().postForEntity(url, policyBody);
testHelperTest.testSuccessResponse(responseMono, HttpStatus.CREATED, responseBody ->
responseBody.contains("{\"scope\":{\"ueId\":\"ue5100\",\"qosId\":\"qos5100\"},\"qosObjectives\":{\"priorityLevel\":5100.0}}"));
- testHelperTest.testSuccessHeader(responseMono, "location", headerValue -> headerValue.contains("https://localhost:" + port + "/a1-policy-management/v1/policies/"));
+ testHelperTest.testSuccessHeader(responseMono, "location", headerValue -> headerValue.contains(testHelperTest.baseUrl() + "/a1-policy-management/v1/policies/"));
assertTrue(capturedOutput.getOut().contains("Request received with path: /a1-policy-management/v1/policies"));
assertTrue(capturedOutput.getOut().contains("the Status code of the response: 201 CREATED"));
assertTrue(capturedOutput.getOut().contains("the response is:"));
diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/utils/v3/TestHelperTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/utils/v3/TestHelperTest.java
index a7b8cc9b..a9ff597c 100644
--- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/utils/v3/TestHelperTest.java
+++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/utils/v3/TestHelperTest.java
@@ -93,6 +93,7 @@ public class TestHelperTest {
public AsyncRestClient restClient(String baseUrl, boolean useTrustValidation) {
WebClientConfig config = this.applicationConfig.getWebClientConfig();
config = WebClientConfig.builder()
+ .sslEnabled(config.isSslEnabled())
.keyStoreType(config.getKeyStoreType())
.keyStorePassword(config.getKeyStorePassword())
.keyStore(config.getKeyStore())
@@ -109,7 +110,11 @@ public class TestHelperTest {
}
public String baseUrl() {
- return "https://localhost:" + port;
+ if (applicationConfig.isSslEnabled()) {
+ return "https://localhost:" + port;
+ } else {
+ return "http://localhost:" + port;
+ }
}
public AsyncRestClient restClientV3(boolean useTrustValidation) {