unnecessary imports removed
[music.git] / music-core / src / main / java / org / onap / music / lockingservice / cassandra / CassaLockStore.java
index cb6816e..f1e0e08 100644 (file)
@@ -40,8 +40,6 @@ import org.onap.music.main.ResultType;
 import org.onap.music.main.ReturnType;
 import com.datastax.driver.core.ResultSet;
 import com.datastax.driver.core.Row;
-import com.datastax.driver.core.Session;
-import com.datastax.driver.extras.codecs.enums.EnumNameCodec;
 
 /*
  * This is the lock store that is built on top of Cassandra that is used by MUSIC to maintain lock state. 
@@ -50,7 +48,7 @@ import com.datastax.driver.extras.codecs.enums.EnumNameCodec;
 public class CassaLockStore {
     
     private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(CassaLockStore.class);
-    private static String table_prepend_name = "lockQ_";
+    public static final String table_prepend_name = "lockQ_";
     private MusicDataStore dsHandle;
     
     public CassaLockStore() {
@@ -478,7 +476,7 @@ public class CassaLockStore {
         queryObject.appendQueryString(" WHERE lockType = ? ALLOW FILTERING");
         queryObject.addValue(LockType.WRITE);
 
-        DeadlockDetectionUtil ddu = new DeadlockDetectionUtil();
+        DeadlockDetectionUtil ddu = getDeadlockDetectionUtil();
 
         ResultSet rs = dsHandle.executeLocalQuorumConsistencyGet(queryObject);
         logger.debug("rs has " + rs.getAvailableWithoutFetching() + (rs.isFullyFetched()?"":" (or more!)") );
@@ -493,6 +491,14 @@ public class CassaLockStore {
         return deadlock;
     }
 
+    /**
+     * This is used for testing purpose
+     * @return new DeadlockDetectionUtil object
+     */
+    DeadlockDetectionUtil getDeadlockDetectionUtil() {
+       return new DeadlockDetectionUtil();
+    }
+    
     public List<String> getAllLocksForOwner(String ownerId, String keyspace, String table) throws MusicServiceException, MusicQueryException {
         List<String> toRet = new ArrayList<String>();
         String lockTable = table_prepend_name + table;