aboutsummaryrefslogtreecommitdiffstats
path: root/music-core/src/main
diff options
context:
space:
mode:
authorTschaen, Brendan <ctschaen@att.com>2019-12-10 15:25:27 -0500
committerTschaen, Brendan <ctschaen@att.com>2020-01-02 11:05:01 -0500
commit44e100ca89e8c01f0309c6669cff21f6863716be (patch)
tree69c597b4400ab2932ad92b93c2ad6afa78dc536c /music-core/src/main
parent5a7bf5e9f67701d1587ab7df48ce392a5fe8d940 (diff)
Unit tests for MusicDataStore and CassaLockStore
Change-Id: I8ad41f58262210204a34cf62e4172653d335d983 Issue-ID: MUSIC-521 Signed-off-by: Tschaen, Brendan <ctschaen@att.com>
Diffstat (limited to 'music-core/src/main')
-rwxr-xr-xmusic-core/src/main/java/org/onap/music/datastore/MusicDataStore.java21
1 files changed, 10 insertions, 11 deletions
diff --git a/music-core/src/main/java/org/onap/music/datastore/MusicDataStore.java b/music-core/src/main/java/org/onap/music/datastore/MusicDataStore.java
index 2e17670f..dd911491 100755
--- a/music-core/src/main/java/org/onap/music/datastore/MusicDataStore.java
+++ b/music-core/src/main/java/org/onap/music/datastore/MusicDataStore.java
@@ -61,6 +61,10 @@ import com.datastax.driver.extras.codecs.enums.EnumNameCodec;
*
*/
public class MusicDataStore {
+
+ public static final String CONSISTENCY_LEVEL_ONE = "ONE";
+ public static final String CONSISTENCY_LEVEL_QUORUM = "QUORUM";
+ public static final String CONSISTENCY_LEVEL_LOCAL_QUORUM = "LOCAL_QUORUM";
private Session session;
private Cluster cluster;
@@ -466,16 +470,11 @@ public class MusicDataStore {
ResultSet results = null;
try {
SimpleStatement statement = new SimpleStatement(queryObject.getQuery(), queryObject.getValues().toArray());
-
- if (consistencyLevel.equalsIgnoreCase(MusicUtil.ONE)) {
- if(queryObject.getConsistency() == null) {
+ if (consistencyLevel.equalsIgnoreCase(CONSISTENCY_LEVEL_ONE)) {
statement.setConsistencyLevel(ConsistencyLevel.ONE);
- } else {
- statement.setConsistencyLevel(MusicUtil.getConsistencyLevel(queryObject.getConsistency()));
- }
- } else if (consistencyLevel.equalsIgnoreCase(MusicUtil.QUORUM)) {
+ } else if (consistencyLevel.equalsIgnoreCase(CONSISTENCY_LEVEL_QUORUM)) {
statement.setConsistencyLevel(ConsistencyLevel.QUORUM);
- } else if (consistencyLevel.equalsIgnoreCase(MusicUtil.LOCAL_QUORUM)) {
+ } else if (consistencyLevel.equalsIgnoreCase(CONSISTENCY_LEVEL_LOCAL_QUORUM)) {
statement.setConsistencyLevel(ConsistencyLevel.LOCAL_QUORUM);
}
@@ -498,7 +497,7 @@ public class MusicDataStore {
*/
public ResultSet executeOneConsistencyGet(PreparedQueryObject queryObject)
throws MusicServiceException, MusicQueryException {
- return executeGet(queryObject, MusicUtil.ONE);
+ return executeGet(queryObject, CONSISTENCY_LEVEL_ONE);
}
/**
@@ -509,7 +508,7 @@ public class MusicDataStore {
*/
public ResultSet executeLocalQuorumConsistencyGet(PreparedQueryObject queryObject)
throws MusicServiceException, MusicQueryException {
- return executeGet(queryObject, MusicUtil.LOCAL_QUORUM);
+ return executeGet(queryObject, CONSISTENCY_LEVEL_LOCAL_QUORUM);
}
/**
@@ -520,7 +519,7 @@ public class MusicDataStore {
*/
public ResultSet executeQuorumConsistencyGet(PreparedQueryObject queryObject)
throws MusicServiceException, MusicQueryException {
- return executeGet(queryObject, MusicUtil.QUORUM);
+ return executeGet(queryObject, CONSISTENCY_LEVEL_QUORUM);
}
}