summaryrefslogtreecommitdiffstats
path: root/policy-core/src/test/java
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2018-07-18 13:49:42 -0400
committerJim Hahn <jrh3@att.com>2018-07-18 14:54:29 -0400
commite8f1b7235f8338fbb9eba28d8cff29d3d6adf6e7 (patch)
treea71afb05855a68ef5ada2ffffaab74ab901b8ae4 /policy-core/src/test/java
parent6d7f829afe8e91d2c1cf33ec8dc770a515c9959d (diff)
Deny subsequent lock()
This is the final step of separating the lock "refresh" operation from the original "lock" operation. This step entails rejecting subsequent "lock" requests, even by the same owner, when a resource is already locked; "refresh" should now be used, instead, to extend a lock. Modified comments to indicate that the lock can only be extended using "refresh". Change-Id: I406cf60c076dbce87afbd94fb301732359dbd2db Issue-ID: POLICY-872 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'policy-core/src/test/java')
-rw-r--r--policy-core/src/test/java/org/onap/policy/drools/core/lock/SimpleLockManagerTest.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/policy-core/src/test/java/org/onap/policy/drools/core/lock/SimpleLockManagerTest.java b/policy-core/src/test/java/org/onap/policy/drools/core/lock/SimpleLockManagerTest.java
index df6fb10a..feabdbc0 100644
--- a/policy-core/src/test/java/org/onap/policy/drools/core/lock/SimpleLockManagerTest.java
+++ b/policy-core/src/test/java/org/onap/policy/drools/core/lock/SimpleLockManagerTest.java
@@ -116,7 +116,7 @@ public class SimpleLockManagerTest {
assertTrue(mgr.isLockedBy(RESOURCE_A, OWNER1));
// extend the lock
- mgr.lock(RESOURCE_A, OWNER1, MAX_AGE_SEC);
+ mgr.refresh(RESOURCE_A, OWNER1, MAX_AGE_SEC);
// verify still locked after sleeping the other half of the cycle
testTime.sleep(MAX_AGE_MS/2+1);
@@ -132,7 +132,7 @@ public class SimpleLockManagerTest {
mgr.lock(RESOURCE_A, OWNER1, MAX_AGE_SEC);
// same owner
- assertTrue(mgr.lock(RESOURCE_A, OWNER1, MAX_AGE_SEC));
+ assertFalse(mgr.lock(RESOURCE_A, OWNER1, MAX_AGE_SEC));
// different owner
assertFalse(mgr.lock(RESOURCE_A, OWNER2, MAX_AGE_SEC));