diff options
-rw-r--r-- | pom.xml | 28 | ||||
-rw-r--r-- | src/main/resources/application.properties | 2 | ||||
-rw-r--r-- | src/test/java/org/onap/aai/modelloader/actuator/ActuatorTest.java | 45 | ||||
-rw-r--r-- | version.properties | 2 |
4 files changed, 51 insertions, 26 deletions
@@ -33,7 +33,7 @@ <groupId>org.onap.aai.model-loader</groupId> <artifactId>model-loader</artifactId> <name>aai-model-loader</name> - <version>1.14.1-SNAPSHOT</version> + <version>1.14.2-SNAPSHOT</version> <dependencyManagement> <dependencies> @@ -60,10 +60,11 @@ <docker.location>${basedir}/target</docker.location> <spring-boot.version>2.7.18</spring-boot.version> <spring-cloud.version>2021.0.8</spring-cloud.version> + <spring-kafka.version>2.9.13</spring-kafka.version> <apache.commons-text.version>1.10.0</apache.commons-text.version> - <commons-compress.version>1.22</commons-compress.version> + <commons-compress.version>1.27.0</commons-compress.version> + <commons-io.version>2.16.1</commons-io.version> <gson.version>2.10.1</gson.version> - <hamcrest-all.version>1.3</hamcrest-all.version> <babel.version>1.13.0</babel.version> <sdc-distribution-client.version>2.0.0</sdc-distribution-client.version> <logback.version>1.2.11</logback.version> @@ -240,20 +241,31 @@ </dependency> <dependency> <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-webflux</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-aop</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> - </dependency> + </dependency> + <dependency> + <groupId>io.micrometer</groupId> + <artifactId>micrometer-registry-prometheus</artifactId> + </dependency> <dependency> <groupId>org.springframework.kafka</groupId> <artifactId>spring-kafka</artifactId> + <version>${spring-kafka.version}</version> </dependency> <dependency> <groupId>org.springframework.kafka</groupId> <artifactId>spring-kafka-test</artifactId> + <version>${spring-kafka.version}</version> <scope>test</scope> </dependency> <dependency> @@ -313,7 +325,7 @@ <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> - <version>2.11.0</version> + <version>${commons-io.version}</version> </dependency> <dependency> <groupId>org.apache.commons</groupId> @@ -335,12 +347,6 @@ <!-- Test dependencies --> <dependency> - <groupId>org.hamcrest</groupId> - <artifactId>hamcrest-all</artifactId> - <version>${hamcrest-all.version}</version> - <scope>test</scope> - </dependency> - <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter</artifactId> <scope>test</scope> diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index d3b4f45..ab5186a 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -29,3 +29,5 @@ server.tomcat.threads.min-spare=25 # Spring Boot logging logging.config=${logback.configurationFile} + +management.endpoints.web.exposure.include=* diff --git a/src/test/java/org/onap/aai/modelloader/actuator/ActuatorTest.java b/src/test/java/org/onap/aai/modelloader/actuator/ActuatorTest.java index e9a6da5..2ccbb0c 100644 --- a/src/test/java/org/onap/aai/modelloader/actuator/ActuatorTest.java +++ b/src/test/java/org/onap/aai/modelloader/actuator/ActuatorTest.java @@ -19,29 +19,46 @@ */ package org.onap.aai.modelloader.actuator; -import static org.junit.jupiter.api.Assertions.assertEquals; - import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.boot.test.web.server.LocalServerPort; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.client.RestTemplate; +import org.springframework.test.context.TestPropertySource; +import org.springframework.test.web.reactive.server.WebTestClient; +@AutoConfigureWebTestClient +@TestPropertySource(properties = { + "management.endpoints.web.exposure.include=prometheus,metrics,info,health" +}) @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) public class ActuatorTest { - - @Autowired RestTemplate restTemplate; - @LocalServerPort - private int serverPort; + + @Autowired + private WebTestClient webTestClient; @Test public void thatLivenessEndpointReturnsOk() { - String url = String.format("http://localhost:%s/actuator/health", serverPort); - ResponseEntity<String> entity = restTemplate.getForEntity(url, String.class); - assertEquals(entity.getStatusCode(), HttpStatus.OK); - assertEquals(entity.getBody(), "{\"status\":\"UP\"}"); + webTestClient.get().uri("/actuator/health") + .exchange() + .expectStatus().isOk() + .expectBody() + .jsonPath("$.status") + .isEqualTo("UP"); } + + // @Test + // public void testPrometheusEndpoint() { + // webTestClient.get().uri("/actuator/prometheus") + // .exchange() + // .expectStatus().isOk() + // .expectHeader().contentType("text/plain; charset=utf-8") + // .expectBody(String.class) + // .consumeWith(response -> { + // String responseBody = response.getResponseBody(); + // assert responseBody != null; + // assert responseBody.contains("# HELP"); + // assert responseBody.contains("# TYPE"); + // }); + // } } diff --git a/version.properties b/version.properties index 5cd0baf..44f7d2f 100644 --- a/version.properties +++ b/version.properties @@ -25,7 +25,7 @@ major=1 minor=14 -patch=1 +patch=2 base_version=${major}.${minor}.${patch} |