From 1fbfdd83490bb4dc8835a3d80dd7fdcbebd7cd7c Mon Sep 17 00:00:00 2001 From: Michael Simon <simon@kit.edu> Date: Fri, 19 Jan 2024 08:00:46 +0100 Subject: [PATCH] ISSUE-182 Add first demo status check --- bwreg-webapp/pom.xml | 23 ++++++++++++++----- .../rest/JaxRsApplicationActivator.java | 5 ++-- .../kit/scc/webreg/rest/StatusController.java | 17 ++++++++++++++ pom.xml | 20 +++++++--------- 4 files changed, 44 insertions(+), 21 deletions(-) create mode 100644 bwreg-webapp/src/main/java/edu/kit/scc/webreg/rest/StatusController.java diff --git a/bwreg-webapp/pom.xml b/bwreg-webapp/pom.xml index 50b5f5ce7..0f9faec23 100644 --- a/bwreg-webapp/pom.xml +++ b/bwreg-webapp/pom.xml @@ -2,7 +2,8 @@ and the accompanying materials are made available under the terms of the GNU Public License v3.0 which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html Contributors: Michael Simon - initial --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>bwreg-webapp</artifactId> @@ -167,6 +168,16 @@ <artifactId>jakarta.jakartaee-api</artifactId> <scope>provided</scope> </dependency> + <dependency> + <groupId>org.eclipse.microprofile.health</groupId> + <artifactId>microprofile-health-api</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.eclipse.microprofile.config</groupId> + <artifactId>microprofile-config-api</artifactId> + <scope>provided</scope> + </dependency> <dependency> <groupId>org.primefaces</groupId> @@ -185,8 +196,8 @@ <artifactId>all-themes</artifactId> </dependency> <dependency> - <groupId>org.webjars</groupId> - <artifactId>font-awesome</artifactId> + <groupId>org.webjars</groupId> + <artifactId>font-awesome</artifactId> </dependency> <dependency> <groupId>org.omnifaces</groupId> @@ -239,12 +250,12 @@ </dependency> <dependency> - <groupId>com.nimbusds</groupId> - <artifactId>oauth2-oidc-sdk</artifactId> + <groupId>com.nimbusds</groupId> + <artifactId>oauth2-oidc-sdk</artifactId> <scope>provided</scope> </dependency> -<!-- + <!-- <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> diff --git a/bwreg-webapp/src/main/java/edu/kit/scc/webreg/rest/JaxRsApplicationActivator.java b/bwreg-webapp/src/main/java/edu/kit/scc/webreg/rest/JaxRsApplicationActivator.java index a86d3b2c9..06e4d27bd 100644 --- a/bwreg-webapp/src/main/java/edu/kit/scc/webreg/rest/JaxRsApplicationActivator.java +++ b/bwreg-webapp/src/main/java/edu/kit/scc/webreg/rest/JaxRsApplicationActivator.java @@ -13,9 +13,6 @@ package edu.kit.scc.webreg.rest; import java.util.HashSet; import java.util.Set; -import jakarta.ws.rs.ApplicationPath; -import jakarta.ws.rs.core.Application; - import edu.kit.scc.webreg.rest.exc.AssertionExceptionMapper; import edu.kit.scc.webreg.rest.exc.GenericRestInterfaceExceptionMapper; import edu.kit.scc.webreg.rest.exc.LoginFailedExceptionMapper; @@ -36,6 +33,8 @@ import edu.kit.scc.webreg.rest.exc.UserCreateExceptionMapper; import edu.kit.scc.webreg.rest.exc.UserNotRegisteredExceptionMapper; import edu.kit.scc.webreg.rest.exc.UserUpdateFailedExceptionMapper; import edu.kit.scc.webreg.rest.exc.ValidationExceptionMapper; +import jakarta.ws.rs.ApplicationPath; +import jakarta.ws.rs.core.Application; @ApplicationPath("/rest") public class JaxRsApplicationActivator extends Application { diff --git a/bwreg-webapp/src/main/java/edu/kit/scc/webreg/rest/StatusController.java b/bwreg-webapp/src/main/java/edu/kit/scc/webreg/rest/StatusController.java new file mode 100644 index 000000000..dce2b65ce --- /dev/null +++ b/bwreg-webapp/src/main/java/edu/kit/scc/webreg/rest/StatusController.java @@ -0,0 +1,17 @@ +package edu.kit.scc.webreg.rest; + +import org.eclipse.microprofile.health.HealthCheck; +import org.eclipse.microprofile.health.HealthCheckResponse; +import org.eclipse.microprofile.health.Liveness; + +import jakarta.enterprise.context.ApplicationScoped; + +@Liveness +@ApplicationScoped +public class StatusController implements HealthCheck { + + @Override + public HealthCheckResponse call() { + return HealthCheckResponse.up("Simple health check"); + } +} diff --git a/pom.xml b/pom.xml index 091097695..d84c8ce68 100644 --- a/pom.xml +++ b/pom.xml @@ -103,23 +103,19 @@ <scope>import</scope> <optional>false</optional> </dependency> + <dependency> + <groupId>org.wildfly.bom</groupId> + <artifactId>wildfly-microprofile</artifactId> + <version>${org.wildfly.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> <dependency> <groupId>jakarta.platform</groupId> <artifactId>jakarta.jakartaee-api</artifactId> <version>${javax.javaee.version}</version> </dependency> - <!-- - <dependency> - <groupId>jakarta.xml.bind</groupId> - <artifactId>jakarta.xml.bind-api</artifactId> - <version>${jakarta.xml.bind}</version> - </dependency> - <dependency> - <groupId>com.sun.xml.bind</groupId> - <artifactId>jaxb-impl</artifactId> - <version>${jakarta.xml.bind}</version> - </dependency> - --> + <dependency> <groupId>org.opensaml</groupId> <artifactId>opensaml-core-api</artifactId> -- GitLab