summaryrefslogtreecommitdiffstats
path: root/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/main/java
diff options
context:
space:
mode:
authorJoss Armstrong <joss.armstrong@ericsson.com>2019-02-07 14:46:51 +0000
committerTakamune Cho <takamune.cho@att.com>2019-02-07 18:31:24 +0000
commit595c26c17a55c3e173756dc99a94ea8c8c9c5608 (patch)
tree1d1c4d1d9bf639659654563092cdf985185a8163 /appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/main/java
parentcc99c1785390c6ca9f40bb0d6d2b42ee55f38941 (diff)
Test coverage in lockmanager.sql.pessimistic
Increased package coverage from 52% to 98% Issue-ID: APPC-1400 Change-Id: Iabce54c1004f4c5f1729d11b2ae40003d202625e Signed-off-by: Joss Armstrong <joss.armstrong@ericsson.com>
Diffstat (limited to 'appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/main/java')
-rw-r--r--appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/main/java/org/onap/appc/lockmanager/impl/sql/pessimistic/SqlLockManager.java20
1 files changed, 11 insertions, 9 deletions
diff --git a/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/main/java/org/onap/appc/lockmanager/impl/sql/pessimistic/SqlLockManager.java b/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/main/java/org/onap/appc/lockmanager/impl/sql/pessimistic/SqlLockManager.java
index ab3db91ee..59e84eb1d 100644
--- a/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/main/java/org/onap/appc/lockmanager/impl/sql/pessimistic/SqlLockManager.java
+++ b/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/main/java/org/onap/appc/lockmanager/impl/sql/pessimistic/SqlLockManager.java
@@ -5,6 +5,8 @@
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Copyright (C) 2017 Amdocs
+ * ================================================================================
+ * Modifications Copyright (C) 2019 Ericsson
* =============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,10 +37,10 @@ import org.onap.appc.lockmanager.impl.sql.Messages;
abstract class SqlLockManager extends JdbcLockManager {
- private static final String SQL_LOAD_LOCK_RECORD = "SELECT * FROM %s WHERE RESOURCE_ID=?";
- private static final String SQL_INSERT_LOCK_RECORD = "INSERT INTO %s (RESOURCE_ID, OWNER_ID, UPDATED, TIMEOUT) VALUES (?, ?, ?, ?)";
- private static final String SQL_UPDATE_LOCK_RECORD = "UPDATE %s SET OWNER_ID=?, UPDATED=?, TIMEOUT=? WHERE RESOURCE_ID=?";
- private static final String SQL_CURRENT_TIMESTAMP = "SELECT CURRENT_TIMESTAMP()";
+ static final String SQL_LOAD_LOCK_RECORD = "SELECT * FROM %s WHERE RESOURCE_ID=?";
+ static final String SQL_INSERT_LOCK_RECORD = "INSERT INTO %s (RESOURCE_ID, OWNER_ID, UPDATED, TIMEOUT) VALUES (?, ?, ?, ?)";
+ static final String SQL_UPDATE_LOCK_RECORD = "UPDATE %s SET OWNER_ID=?, UPDATED=?, TIMEOUT=? WHERE RESOURCE_ID=?";
+ static final String SQL_CURRENT_TIMESTAMP = "SELECT CURRENT_TIMESTAMP()";
private String sqlLoadLockRecord;
private String sqlInsertLockRecord;
@@ -86,13 +88,13 @@ abstract class SqlLockManager extends JdbcLockManager {
@Override
public boolean isLocked(String resource) {
- Connection connection=openDbConnection();
+ Connection connection = openDbConnection();
try {
- LockRecord lockRecord=loadLockRecord(connection,resource);
- if(lockRecord==null){
+ LockRecord lockRecord = loadLockRecord(connection,resource);
+ if(lockRecord == null){
return false;
}else{
- if(lockRecord.getOwner()==null){
+ if(lockRecord.getOwner() == null){
return false;
}else if(isLockExpired(lockRecord, connection)){
return false;
@@ -112,7 +114,7 @@ abstract class SqlLockManager extends JdbcLockManager {
Connection connection=openDbConnection();
try {
org.onap.appc.lockmanager.impl.sql.pessimistic.LockRecord lockRecord=loadLockRecord(connection,resource);
- if(lockRecord==null || lockRecord.getOwner() ==null ){
+ if(lockRecord == null || lockRecord.getOwner() == null ){
return null;
}else{
if(isLockExpired(lockRecord, connection)){