aboutsummaryrefslogtreecommitdiffstats
path: root/integration-test/src
diff options
context:
space:
mode:
authormpriyank <priyank.maheshwari@est.tech>2024-11-27 14:43:28 +0000
committermpriyank <priyank.maheshwari@est.tech>2024-12-19 15:38:36 +0000
commita7206655a004659bd1251c70db0acfd0f58e40d4 (patch)
tree852a2331753c722e46c03ac6b508a14b646f24e1 /integration-test/src
parent40578d56733247540a09b6bbf000181b46b5c1fc (diff)
Cps and Ncmp distributed lock for various use cases
- introduced cpsAndNcmpLock to be used for any use case needing coordination. Since it can be used for any use case hence placing the class accordingly. - currently lock is being used for populating workQueue. - Removed FencedLock as it was part of CPSubsystem which is moved to hazelcast-enterprise in 5.5.* version onwards. - added info level logging statement to verify just one thread at a time in the critical section - Note : integration test to be part of a separate patch. Issue-ID: CPS-2479 Change-Id: I0f33c7232786c517383e5093fda91fd9a1839021 Signed-off-by: mpriyank <priyank.maheshwari@est.tech>
Diffstat (limited to 'integration-test/src')
-rw-r--r--integration-test/src/test/groovy/org/onap/cps/integration/base/CpsIntegrationSpecBase.groovy4
-rw-r--r--integration-test/src/test/groovy/org/onap/cps/integration/functional/ncmp/ModuleSyncWatchdogIntegrationSpec.groovy9
2 files changed, 13 insertions, 0 deletions
diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/base/CpsIntegrationSpecBase.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/base/CpsIntegrationSpecBase.groovy
index 9fc36331e2..16b4460492 100644
--- a/integration-test/src/test/groovy/org/onap/cps/integration/base/CpsIntegrationSpecBase.groovy
+++ b/integration-test/src/test/groovy/org/onap/cps/integration/base/CpsIntegrationSpecBase.groovy
@@ -22,6 +22,7 @@
package org.onap.cps.integration.base
import com.hazelcast.collection.ISet
+import com.hazelcast.map.IMap
import okhttp3.mockwebserver.MockWebServer
import org.onap.cps.api.CpsAnchorService
import org.onap.cps.api.CpsDataService
@@ -123,6 +124,9 @@ abstract class CpsIntegrationSpecBase extends Specification {
BlockingQueue<String> moduleSyncWorkQueue
@Autowired
+ IMap<String, String> cpsAndNcmpLock
+
+ @Autowired
JsonObjectMapper jsonObjectMapper
@Autowired
diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/functional/ncmp/ModuleSyncWatchdogIntegrationSpec.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/functional/ncmp/ModuleSyncWatchdogIntegrationSpec.groovy
index 43bcbdb4f4..a6e56ab22d 100644
--- a/integration-test/src/test/groovy/org/onap/cps/integration/functional/ncmp/ModuleSyncWatchdogIntegrationSpec.groovy
+++ b/integration-test/src/test/groovy/org/onap/cps/integration/functional/ncmp/ModuleSyncWatchdogIntegrationSpec.groovy
@@ -151,6 +151,15 @@ class ModuleSyncWatchdogIntegrationSpec extends CpsIntegrationSpecBase {
}
}
+ def populateQueueWithoutDelayCallable = () -> {
+ try {
+ objectUnderTest.populateWorkQueueIfNeeded()
+ return 'task acquired the lock first'
+ } catch (InterruptedException e) {
+ e.printStackTrace()
+ }
+ }
+
def populateQueueWithDelay = () -> {
try {
Thread.sleep(10)