diff options
author | Thomas Nelson <nelson24@att.com> | 2019-07-09 14:47:39 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-07-09 14:47:39 +0000 |
commit | ffd09274f30926e38b689fc082dd6f7d0bcc491c (patch) | |
tree | fca68010218097b7682d567d8fbe4cc942dd3622 /src/main/java/org/onap | |
parent | 93eed2b312380d1d25d0e6ac49290aeb11830f05 (diff) | |
parent | de5b68397c2e54c22e500f1f70ca3d7ca7c75150 (diff) |
Merge "Sonar fix in RestMusicHealthCheckAPI.java"
Diffstat (limited to 'src/main/java/org/onap')
-rw-r--r-- | src/main/java/org/onap/music/rest/RestMusicHealthCheckAPI.java | 14 |
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(); } |