summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorArundathi Patil <arundpil@in.ibm.com>2019-07-09 08:47:49 +0530
committerArundathi Patil <arundpil@in.ibm.com>2019-07-09 08:48:14 +0530
commitde5b68397c2e54c22e500f1f70ca3d7ca7c75150 (patch)
tree9ec5a4a51e8fd7650457d189379bf8e60695fd9c /src
parent5b43c6998e98f2fe9695f8dc9dc86be8bac2a320 (diff)
Sonar fix in RestMusicHealthCheckAPI.java
Fixed sonar issues in this file Issue-ID: MUSIC-429 Change-Id: If56fa1064651e6df2c49fc5835efdd310ead5bbe Signed-off-by: Arundathi Patil <arundpil@in.ibm.com>
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();
}