From 7f227628678c660b0db3a2da43123d2b531018af Mon Sep 17 00:00:00 2001 From: emaclee Date: Mon, 4 Apr 2022 15:38:26 +0100 Subject: Add methods to Lock Anchor entity Added separate integration and mock-based unit tests Issue-ID: CPS-898 Signed-off-by: emaclee Change-Id: I14d1d1c41759ce028e2417fdd2df001280e19ab2 --- .../org/onap/cps/api/impl/CpsDataServiceImplSpec.groovy | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'cps-service/src/test/groovy') diff --git a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsDataServiceImplSpec.groovy b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsDataServiceImplSpec.groovy index faeba8d51a..8b9d545295 100644 --- a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsDataServiceImplSpec.groovy +++ b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsDataServiceImplSpec.groovy @@ -430,4 +430,21 @@ class CpsDataServiceImplSpec extends Specification { then: 'the persistence service method to close session is invoked' 1 * mockCpsDataPersistenceService.closeSession(sessionId) } + + def 'lock anchor with no timeout parameter'(){ + when: 'lock anchor method with no timeout parameter with details of anchor entity to lock' + objectUnderTest.lockAnchor('some-sessionId', 'some-dataspaceName', 'some-anchorName') + then: 'the persistence service method to lock anchor is invoked with default timeout' + 1 * mockCpsDataPersistenceService.lockAnchor('some-sessionId', 'some-dataspaceName', + 'some-anchorName', 300L) + } + + def 'lock anchor with timeout parameter'(){ + when: 'lock anchor method with timeout parameter is called with details of anchor entity to lock' + objectUnderTest.lockAnchor('some-sessionId', 'some-dataspaceName', + 'some-anchorName', 250L) + then: 'the persistence service method to lock anchor is invoked with the given timeout' + 1 * mockCpsDataPersistenceService.lockAnchor('some-sessionId', 'some-dataspaceName', + 'some-anchorName', 250L) + } } -- cgit 1.2.3-korg