X-Git-Url: https://gerrit.onap.org/r/gitweb?p=music.git;a=blobdiff_plain;f=music-rest%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fmusic%2Feelf%2Fhealthcheck%2FMusicHealthCheck.java;h=acbbdd186106bcb2b63a3ad5be1cfe23c9a5a704;hp=fbfc0de671c6be47de1f063474fa4abfa72acf0c;hb=7fda9bd76272ba4712fa810632ce252dfafe3363;hpb=9399b2eed91169c719acd9a966b4c5ed560897a8 diff --git a/music-rest/src/main/java/org/onap/music/eelf/healthcheck/MusicHealthCheck.java b/music-rest/src/main/java/org/onap/music/eelf/healthcheck/MusicHealthCheck.java index fbfc0de6..acbbdd18 100644 --- a/music-rest/src/main/java/org/onap/music/eelf/healthcheck/MusicHealthCheck.java +++ b/music-rest/src/main/java/org/onap/music/eelf/healthcheck/MusicHealthCheck.java @@ -94,10 +94,15 @@ public class MusicHealthCheck { pQuery.appendQueryString("insert into admin.healthcheck (id) values (?)"); pQuery.addValue(randomUUID); ResultType rs = null; - rs = MusicCore.nonKeyRelatedPut(pQuery, consistency); + rs = nonKeyRelatedPut(pQuery, consistency); logger.info(rs.toString()); return null != rs; + } + + /*For unit testing purpose only*/ + public ResultType nonKeyRelatedPut(PreparedQueryObject pQuery, String consistency) throws MusicServiceException, MusicQueryException { + return MusicCore.nonKeyRelatedPut(pQuery, consistency); } private void cleanHealthCheckId(UUID randomUUID) throws MusicServiceException, MusicQueryException { @@ -105,11 +110,14 @@ public class MusicHealthCheck { PreparedQueryObject deleteQueryObject = new PreparedQueryObject(); deleteQueryObject.appendQueryString(cleanQuery); deleteQueryObject.addValue(randomUUID); - MusicDataStoreHandle.getDSHandle().executePut(deleteQueryObject, "eventual"); + executeEventualPut(deleteQueryObject); logger.info(EELFLoggerDelegate.applicationLogger, "Cassandra healthcheck responded and cleaned up."); } - + /*For unit testing purpose only*/ + public void executeEventualPut(PreparedQueryObject deleteQueryObject) throws MusicServiceException, MusicQueryException { + MusicDataStoreHandle.getDSHandle().executePut(deleteQueryObject, "eventual"); + } private boolean createKeyspace() throws MusicServiceException,MusicQueryException { PreparedQueryObject pQuery = new PreparedQueryObject();