/*
- * ============LICENSE_START=======================================================
+ * ============LICENSE_START=======================================================
* Copyright (C) 2022 Nordix Foundation
* Modifications Copyright (C) 2022 Bell Canada
* ================================================================================
given: 'A locked state'
def compositeState = new CompositeState(lockReason: lockReason)
when: 'update cm handle details and attempts is called'
- objectUnderTest.updateLockReasonDetailsAndAttempts(compositeState, LockReasonCategory.LOCKED_MISBEHAVING, 'new error message')
+ objectUnderTest.updateLockReasonDetailsAndAttempts(compositeState, LockReasonCategory.LOCKED_MODULE_SYNC_FAILED, 'new error message')
then: 'the composite state lock reason and details are updated'
- assert compositeState.lockReason.lockReasonCategory == LockReasonCategory.LOCKED_MISBEHAVING
+ assert compositeState.lockReason.lockReasonCategory == LockReasonCategory.LOCKED_MODULE_SYNC_FAILED
assert compositeState.lockReason.details == expectedDetails
where:
scenario | lockReason || expectedDetails
'exists' | CompositeState.LockReason.builder().details("Attempt #2 failed: some error message").build() || 'Attempt #3 failed: new error message'
}
- def 'Get all locked Cm-Handle where Lock Reason is LOCKED_MISBEHAVING cm handle #scenario'() {
+ def 'Get all locked Cm-Handle where Lock Reason is LOCKED_MODULE_SYNC_FAILED cm handle #scenario'() {
given: 'the cps (persistence service) returns a collection of data nodes'
mockInventoryPersistence.getCmHandleDataNodesByCpsPath(
- '//lock-reason[@reason="LOCKED_MISBEHAVING"]/ancestor::cm-handles',
+ '//lock-reason[@reason="LOCKED_MODULE_SYNC_FAILED"]/ancestor::cm-handles',
FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS) >> [dataNode ]
when: 'get locked Misbehaving cm handle is called'
- def result = objectUnderTest.getLockedMisbehavingYangModelCmHandles()
+ def result = objectUnderTest.getModuleSyncFailedCmHandles()
then: 'the returned cm handle collection is the correct size'
result.size() == 1
and: 'the correct cm handle is returned'
def 'Retry Locked Cm-Handle where the last update time is #scenario'() {
when: 'retry locked cm handle is invoked'
def result = objectUnderTest.isReadyForRetry(new CompositeStateBuilder()
- .withLockReason(LockReasonCategory.LOCKED_MISBEHAVING, details)
+ .withLockReason(LockReasonCategory.LOCKED_MODULE_SYNC_FAILED, details)
.withLastUpdatedTime(lastUpdateTime).build())
then: 'result returns #expectedResult'
result == expectedResult
where:
- scenario | lastUpdateTime | details || expectedResult
- 'is the first attempt' | '1900-01-01T00:00:00.000+0100' | 'First Attempt' || true
- 'is greater than one minute' | '1900-01-01T00:00:00.000+0100' | 'Attempt #1 failed:' || true
- 'is less than eight minutes' | formattedDateAndTime | 'Attempt #3 failed:' || false
+ scenario | lastUpdateTime | details || expectedResult
+ 'the first attempt' | '1900-01-01T00:00:00.000+0100' | 'First Attempt' || true
+ 'greater than one minute' | '1900-01-01T00:00:00.000+0100' | 'Attempt #1 failed:' || true
+ 'less than eight minutes' | formattedDateAndTime | 'Attempt #3 failed:' || false
}