aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFiete Ostkamp <Fiete.Ostkamp@telekom.de>2024-05-18 19:52:40 +0200
committerFiete Ostkamp <Fiete.Ostkamp@telekom.de>2024-05-21 13:39:16 +0200
commit9d93fb4e58c23ddcb252e6812557bb2dbdcd4ce9 (patch)
tree33d90b6a41b2764e12d06e2e1a123a934371e299
parentc4208db72297836601e1e4a579b60f96960bbdf3 (diff)
Add spring-boot actuator to model-loader1.14.1
- add actuator that enables liveness probes - allow passing in jvm args to the running process (for debugging or profiling) - bump version to 1.14.1 Issue-ID: AAI-3852 Change-Id: Id4b8c5d5402a8eeaf1630a3cdcdfc68471a26a94 Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
-rw-r--r--pom.xml11
-rw-r--r--src/main/bin/start.sh2
-rw-r--r--src/test/java/org/onap/aai/modelloader/actuator/ActuatorTest.java47
-rw-r--r--version.properties2
4 files changed, 53 insertions, 9 deletions
diff --git a/pom.xml b/pom.xml
index 7e50b9c..2574071 100644
--- a/pom.xml
+++ b/pom.xml
@@ -33,7 +33,7 @@
<groupId>org.onap.aai.model-loader</groupId>
<artifactId>model-loader</artifactId>
<name>aai-model-loader</name>
- <version>1.14.0-SNAPSHOT</version>
+ <version>1.14.1-SNAPSHOT</version>
<dependencyManagement>
<dependencies>
@@ -244,19 +244,16 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.apache.kafka</groupId>
- <artifactId>kafka-clients</artifactId>
- <!-- <version>3.3.1</version> -->
- </dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-actuator</artifactId>
+ </dependency>
<dependency>
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka</artifactId>
- <!-- <version>3.1.2</version> -->
</dependency>
<dependency>
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka-test</artifactId>
- <!-- <version>3.1.1</version> -->
<scope>test</scope>
</dependency>
<dependency>
diff --git a/src/main/bin/start.sh b/src/main/bin/start.sh
index 19d2717..ea42d7f 100644
--- a/src/main/bin/start.sh
+++ b/src/main/bin/start.sh
@@ -42,4 +42,4 @@ PROPS="$PROPS -Dserver.port=9500"
JVM_MAX_HEAP=${MAX_HEAP:-1024}
echo "java $java_runtime_arguments $PROPS -jar $JARFILE"
-java $java_runtime_arguments $PROPS -jar $JARFILE
+java $java_runtime_arguments ${JVM_ARGS} $PROPS -jar $JARFILE
diff --git a/src/test/java/org/onap/aai/modelloader/actuator/ActuatorTest.java b/src/test/java/org/onap/aai/modelloader/actuator/ActuatorTest.java
new file mode 100644
index 0000000..e9a6da5
--- /dev/null
+++ b/src/test/java/org/onap/aai/modelloader/actuator/ActuatorTest.java
@@ -0,0 +1,47 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2024 Deutsche Telekom AG Intellectual Property. 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.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.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;
+
+@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
+public class ActuatorTest {
+
+ @Autowired RestTemplate restTemplate;
+ @LocalServerPort
+ private int serverPort;
+
+ @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\"}");
+ }
+}
diff --git a/version.properties b/version.properties
index d035ea2..5cd0baf 100644
--- a/version.properties
+++ b/version.properties
@@ -25,7 +25,7 @@
major=1
minor=14
-patch=0
+patch=1
base_version=${major}.${minor}.${patch}