aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/main/java/org/onap/policy/pap/main/rest/HealthCheckRestControllerV1.java
diff options
context:
space:
mode:
authora.sreekumar <ajith.sreekumar@bell.ca>2021-12-03 11:27:32 +0000
committera.sreekumar <ajith.sreekumar@bell.ca>2021-12-14 17:58:20 +0000
commit4694c152f69380f4d3d64bde0a13d15fb59a71f3 (patch)
tree38c9e0b1117323c58536706a66830109225d6200 /main/src/main/java/org/onap/policy/pap/main/rest/HealthCheckRestControllerV1.java
parentc51fa0d4e953518571a115af4afdea80a17ed605 (diff)
Migrate pap startup & controllers to spring boot
This commit migrates pap config, startup and controllers to spring boot. Change-Id: Icf91d728160a23db614dfba6b40ddccd2f6163a5 Issue-ID: POLICY-3754 Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
Diffstat (limited to 'main/src/main/java/org/onap/policy/pap/main/rest/HealthCheckRestControllerV1.java')
-rw-r--r--main/src/main/java/org/onap/policy/pap/main/rest/HealthCheckRestControllerV1.java24
1 files changed, 16 insertions, 8 deletions
diff --git a/main/src/main/java/org/onap/policy/pap/main/rest/HealthCheckRestControllerV1.java b/main/src/main/java/org/onap/policy/pap/main/rest/HealthCheckRestControllerV1.java
index 8cb3acfa..19e47646 100644
--- a/main/src/main/java/org/onap/policy/pap/main/rest/HealthCheckRestControllerV1.java
+++ b/main/src/main/java/org/onap/policy/pap/main/rest/HealthCheckRestControllerV1.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2019,2021 Nordix Foundation.
* Modifications Copyright (C) 2019 AT&T Intellectual Property.
+ * Modifications Copyright (C) 2021 Bell Canada. 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.
@@ -25,27 +26,34 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import io.swagger.annotations.Authorization;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.core.Response;
+import lombok.RequiredArgsConstructor;
import org.onap.policy.common.endpoints.report.HealthCheckReport;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
/**
* Class to provide REST endpoints for PAP component health check.
*
* @author Ram Krishna Verma (ram.krishna.verma@est.tech)
*/
-public class HealthCheckRestControllerV1 extends PapRestControllerV1 {
+@RestController
+@RequestMapping(path = "/policy/pap/v1")
+@RequiredArgsConstructor
+public class HealthCheckRestControllerV1 extends PapRestControllerV1 {
- @GET
- @Path("healthcheck")
+ private final HealthCheckProvider provider;
+
+ @GetMapping("healthcheck")
@ApiOperation(value = "Perform healthcheck",
notes = "Returns healthy status of the Policy Administration component",
response = HealthCheckReport.class, authorizations = @Authorization(value = AUTHORIZATION_TYPE))
@ApiResponses(value = {@ApiResponse(code = AUTHENTICATION_ERROR_CODE, message = AUTHENTICATION_ERROR_MESSAGE),
@ApiResponse(code = AUTHORIZATION_ERROR_CODE, message = AUTHORIZATION_ERROR_MESSAGE),
@ApiResponse(code = SERVER_ERROR_CODE, message = SERVER_ERROR_MESSAGE)})
- public Response healthcheck() {
- return Response.status(Response.Status.OK).entity(new HealthCheckProvider().performHealthCheck()).build();
+ public ResponseEntity<HealthCheckReport> healthcheck() {
+ return ResponseEntity.ok().body(provider.performHealthCheck());
}
+
}