2 * ========================LICENSE_START=================================
4 * ======================================================================
5 * Copyright (C) 2025 OpenInfra Foundation Europe. All rights reserved.
6 * ======================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ========================LICENSE_END===================================
21 package org.onap.ccsdk.oran.a1policymanagementservice.utils.v3;
23 import org.junit.jupiter.api.BeforeEach;
24 import org.junit.jupiter.api.DisplayName;
25 import org.junit.jupiter.api.Test;
26 import org.junit.jupiter.api.extension.ExtendWith;
27 import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ApplicationConfig;
28 import org.onap.ccsdk.oran.a1policymanagementservice.controllers.OpenPolicyAgentSimulatorController;
29 import org.springframework.beans.factory.annotation.Autowired;
30 import org.springframework.boot.test.context.SpringBootTest;
31 import org.springframework.boot.test.system.CapturedOutput;
32 import org.springframework.boot.test.system.OutputCaptureExtension;
33 import org.springframework.boot.test.web.server.LocalServerPort;
34 import org.springframework.http.HttpStatus;
35 import org.springframework.http.ResponseEntity;
36 import org.springframework.test.context.TestPropertySource;
37 import reactor.core.publisher.Mono;
38 import static org.junit.jupiter.api.Assertions.assertTrue;
40 @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
41 @ExtendWith({OutputCaptureExtension.class})
42 @TestPropertySource(properties = {
43 "server.ssl.key-store=./config/keystore.jks",
44 "app.webclient.trust-store=./config/truststore.jks",
45 "app.vardata-directory=./target",
46 "app.config-file-schema-path=/application_configuration_schema.json",
47 "logging.reactive-entry-exit-filter-enabled=true",
48 "logging.level.org.onap.ccsdk.oran.a1policymanagementservice=TRACE",
49 "logging.reactive-entry-exit-filter-exclude-paths=null"
51 class ReactiveEntryExitFilterNullPathTest {
53 private ApplicationConfig applicationConfig;
56 private TestHelperTest testHelperTest;
63 testHelperTest.port = port;
64 this.applicationConfig.setAuthProviderUrl(testHelperTest.baseUrl() + OpenPolicyAgentSimulatorController.ACCESS_CONTROL_URL);
68 @DisplayName("test verify entry exit log for health actuator is present")
69 void testHealthActuatorFilterOmitted(CapturedOutput capturedOutput) throws Exception {
70 String url = "/actuator/health";
71 Mono<ResponseEntity<String>> responseGetHealthMono =
72 testHelperTest.restClient(testHelperTest.baseUrl(), false).getForEntity(url);
73 testHelperTest.testSuccessResponse(responseGetHealthMono, HttpStatus.OK, responseBody -> responseBody.contains("UP"));
74 assertTrue(capturedOutput.getOut().contains("Request received with path: /actuator/health"));
75 assertTrue(capturedOutput.getOut().contains("the response is:"));