aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThomas Nelson <nelson24@att.com>2019-07-09 14:47:39 +0000
committerGerrit Code Review <gerrit@onap.org>2019-07-09 14:47:39 +0000
commitffd09274f30926e38b689fc082dd6f7d0bcc491c (patch)
treefca68010218097b7682d567d8fbe4cc942dd3622 /src
parent93eed2b312380d1d25d0e6ac49290aeb11830f05 (diff)
parentde5b68397c2e54c22e500f1f70ca3d7ca7c75150 (diff)
Merge "Sonar fix in RestMusicHealthCheckAPI.java"
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/onap/music/rest/RestMusicHealthCheckAPI.java14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/main/java/org/onap/music/rest/RestMusicHealthCheckAPI.java b/src/main/java/org/onap/music/rest/RestMusicHealthCheckAPI.java
index 73afe6a1..eef3aa3a 100644
--- a/src/main/java/org/onap/music/rest/RestMusicHealthCheckAPI.java
+++ b/src/main/java/org/onap/music/rest/RestMusicHealthCheckAPI.java
@@ -67,6 +67,8 @@ public class RestMusicHealthCheckAPI {
private static final String INVALID_MESSAGE = "Consistency level is invalid...";
private static final String INACTIVE_MESSAGE = "One or more nodes in the Cluster is/are down or not responding.";
private static final String ACTIVE_MESSAGE = "Cassandra Running and Listening to requests";
+ private static final String STATUS_KEY = "status";
+ private static final String MESSAGE_KEY = "message";
@GET
@Path("/pingCassandra/{consistency}")
@@ -80,21 +82,21 @@ public class RestMusicHealthCheckAPI {
Map<String, Object> resultMap = new HashMap<>();
if(ConsistencyLevel.valueOf(consistency) == null) {
- resultMap.put("status",INVALID_STATUS);
- resultMap.put("message", INVALID_MESSAGE);
+ resultMap.put(STATUS_KEY,INVALID_STATUS);
+ resultMap.put(MESSAGE_KEY, INVALID_MESSAGE);
resultMap.put(INVALID_STATUS, INVALID_STATUS);
return Response.status(Status.BAD_REQUEST).entity(resultMap).build();
}
MusicHealthCheck cassHealthCheck = new MusicHealthCheck();
String status = cassHealthCheck.getCassandraStatus(consistency);
if(status.equals(ACTIVE_STATUS)) {
- resultMap.put("status",ACTIVE_STATUS);
- resultMap.put("message", ACTIVE_MESSAGE);
+ resultMap.put(STATUS_KEY,ACTIVE_STATUS);
+ resultMap.put(MESSAGE_KEY, ACTIVE_MESSAGE);
resultMap.put(ACTIVE_STATUS, ACTIVE_MESSAGE);
return Response.status(Status.OK).entity(resultMap).build();
} else {
- resultMap.put("status",INACTIVE_STATUS);
- resultMap.put("message", INACTIVE_MESSAGE);
+ resultMap.put(STATUS_KEY,INACTIVE_STATUS);
+ resultMap.put(MESSAGE_KEY, INACTIVE_MESSAGE);
resultMap.put(INACTIVE_STATUS, INACTIVE_MESSAGE);
return Response.status(Status.BAD_REQUEST).entity(resultMap).build();
}