From e8f1b7235f8338fbb9eba28d8cff29d3d6adf6e7 Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Wed, 18 Jul 2018 13:49:42 -0400 Subject: 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 --- .../java/org/onap/policy/drools/core/lock/SimpleLockManagerTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'policy-core/src/test/java') 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)); -- cgit 1.2.3-korg