aboutsummaryrefslogtreecommitdiffstats
path: root/integration-test/src
diff options
context:
space:
mode:
authormpriyank <priyank.maheshwari@est.tech>2024-07-01 12:32:27 +0100
committermpriyank <priyank.maheshwari@est.tech>2024-07-04 10:15:47 +0100
commitbac230bdbe224023d424eda2cd2ef7422f5c3ed6 (patch)
tree6690acdffa3fbe62f0057bbb66c3812841ace141 /integration-test/src
parent620ab09e76ae4c9072f799687b4e4ae41939df1e (diff)
refactor cmsubscription code
- Moved cmsubscription to the impl package instead of api. - Below packages are renamed or newly created for code and tests - moved ..api.cmsubsription to ..impl.cmsubscription - renamed ..api.cmsubscription.mappers to ..impl.cmsubscription.ncmp or dmi as per the functionality - renamed ..api.cmsubscription.model to ..impl.cmsubscription.models - removed ..api.cmsubscription.producer/consumer and classes moved to ..impl.cmsubscription.ncmp/dmi - new package ..impl.cmsubscription.cache to hold cache config and cache operations - new package ..impl.cmsubscription.avc to hold the CmAvcEventConsumer for the notifications emitted as a result of the subscriptions - Removed the prefix CmNotificationSubscription for majority of the classes , not removed for Config and model classes - Renamed the schemas and package structure as per the code refactoring Note: *EventsFacade and *MappersFacade to be removed in the next patchset Issue-ID: CPS-2298 Change-Id: I1d788ab745d65965570e28beaefa511cbe4a8547 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/functional/NcmpCmNotificationSubscriptionSpec.groovy47
1 files changed, 22 insertions, 25 deletions
diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/functional/NcmpCmNotificationSubscriptionSpec.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/functional/NcmpCmNotificationSubscriptionSpec.groovy
index c2768f1942..49a4b4d60b 100644
--- a/integration-test/src/test/groovy/org/onap/cps/integration/functional/NcmpCmNotificationSubscriptionSpec.groovy
+++ b/integration-test/src/test/groovy/org/onap/cps/integration/functional/NcmpCmNotificationSubscriptionSpec.groovy
@@ -21,7 +21,7 @@
package org.onap.cps.integration.functional
import org.onap.cps.integration.base.CpsIntegrationSpecBase
-import org.onap.cps.ncmp.api.impl.events.cmsubscription.service.CmNotificationSubscriptionPersistenceService
+import org.onap.cps.ncmp.impl.cmnotificationsubscription.utils.CmSubscriptionPersistenceService
import org.springframework.beans.factory.annotation.Autowired
import static org.onap.cps.ncmp.api.data.models.DatastoreType.PASSTHROUGH_RUNNING
@@ -29,23 +29,22 @@ import static org.onap.cps.ncmp.api.data.models.DatastoreType.PASSTHROUGH_RUNNIN
class NcmpCmNotificationSubscriptionSpec extends CpsIntegrationSpecBase {
@Autowired
- CmNotificationSubscriptionPersistenceService cmNotificationSubscriptionPersistenceService;
+ CmSubscriptionPersistenceService cmSubscriptionPersistenceService
def 'Adding a new cm notification subscription'() {
given: 'there is no ongoing cm subscription for the following'
def datastoreType = PASSTHROUGH_RUNNING
def cmHandleId = 'ch-1'
def xpath = '/x/y'
- assert cmNotificationSubscriptionPersistenceService.
- getOngoingCmNotificationSubscriptionIds(datastoreType,cmHandleId,xpath).size() == 0
+ assert cmSubscriptionPersistenceService.
+ getOngoingCmSubscriptionIds(datastoreType, cmHandleId, xpath).size() == 0
when: 'we add a new cm notification subscription'
- cmNotificationSubscriptionPersistenceService.addCmNotificationSubscription(datastoreType,cmHandleId,xpath,
+ cmSubscriptionPersistenceService.addCmSubscription(datastoreType, cmHandleId, xpath,
'subId-1')
then: 'there is an ongoing cm subscription for that CM handle and xpath'
- assert cmNotificationSubscriptionPersistenceService.isOngoingCmNotificationSubscription(datastoreType,cmHandleId,xpath)
+ assert cmSubscriptionPersistenceService.isOngoingCmSubscription(datastoreType, cmHandleId, xpath)
and: 'only one subscription id is related to now ongoing cm subscription'
- assert cmNotificationSubscriptionPersistenceService.
- getOngoingCmNotificationSubscriptionIds(datastoreType,cmHandleId,xpath).size() == 1
+ assert cmSubscriptionPersistenceService.getOngoingCmSubscriptionIds(datastoreType, cmHandleId, xpath).size() == 1
}
def 'Adding a cm notification subscription to the already existing cm handle but non existing xpath'() {
@@ -53,18 +52,17 @@ class NcmpCmNotificationSubscriptionSpec extends CpsIntegrationSpecBase {
def datastoreType = PASSTHROUGH_RUNNING
def cmHandleId = 'ch-1'
def existingXpath = '/x/y'
- assert cmNotificationSubscriptionPersistenceService.isOngoingCmNotificationSubscription(datastoreType,cmHandleId,existingXpath)
+ assert cmSubscriptionPersistenceService.isOngoingCmSubscription(datastoreType, cmHandleId, existingXpath)
and: 'a non existing cm subscription with same datastore name and cm handle but different xpath'
def nonExistingXpath = '/x2/y2'
- assert !cmNotificationSubscriptionPersistenceService.isOngoingCmNotificationSubscription(datastoreType,cmHandleId,nonExistingXpath)
+ assert !cmSubscriptionPersistenceService.isOngoingCmSubscription(datastoreType, cmHandleId, nonExistingXpath)
when: 'a new cm notification subscription is made for the existing cm handle and non existing xpath'
- cmNotificationSubscriptionPersistenceService.addCmNotificationSubscription(datastoreType,cmHandleId, nonExistingXpath,
+ cmSubscriptionPersistenceService.addCmSubscription(datastoreType, cmHandleId, nonExistingXpath,
'subId-2')
then: 'there is an ongoing cm subscription for that CM handle and xpath'
- assert cmNotificationSubscriptionPersistenceService.isOngoingCmNotificationSubscription(datastoreType,cmHandleId,nonExistingXpath)
+ assert cmSubscriptionPersistenceService.isOngoingCmSubscription(datastoreType, cmHandleId, nonExistingXpath)
and: 'only one subscription id is related to now ongoing cm subscription'
- assert cmNotificationSubscriptionPersistenceService.
- getOngoingCmNotificationSubscriptionIds(datastoreType,cmHandleId,nonExistingXpath).size() == 1
+ assert cmSubscriptionPersistenceService.getOngoingCmSubscriptionIds(datastoreType, cmHandleId, nonExistingXpath).size() == 1
}
def 'Adding a cm notification subscription to the already existing cm handle and xpath'() {
@@ -73,10 +71,10 @@ class NcmpCmNotificationSubscriptionSpec extends CpsIntegrationSpecBase {
def cmHandleId = 'ch-1'
def xpath = '/x/y'
when: 'a new cm notification subscription is made for the SAME CM handle and xpath'
- cmNotificationSubscriptionPersistenceService.addCmNotificationSubscription(datastoreType,cmHandleId,xpath,
+ cmSubscriptionPersistenceService.addCmSubscription(datastoreType, cmHandleId, xpath,
'subId-3')
then: 'it is added to the ongoing list of subscription ids'
- def subscriptionIds = cmNotificationSubscriptionPersistenceService.getOngoingCmNotificationSubscriptionIds(datastoreType,cmHandleId,xpath)
+ def subscriptionIds = cmSubscriptionPersistenceService.getOngoingCmSubscriptionIds(datastoreType, cmHandleId, xpath)
assert subscriptionIds.size() == 2
and: 'both subscription ids exists for the CM handle and xpath'
assert subscriptionIds.contains("subId-1") && subscriptionIds.contains("subId-3")
@@ -89,13 +87,12 @@ class NcmpCmNotificationSubscriptionSpec extends CpsIntegrationSpecBase {
def xpath = '/x/y'
and: 'the number of subscribers is as follows'
def originalNumberOfSubscribers =
- cmNotificationSubscriptionPersistenceService.getOngoingCmNotificationSubscriptionIds(datastoreType,cmHandleId,xpath).size()
+ cmSubscriptionPersistenceService.getOngoingCmSubscriptionIds(datastoreType, cmHandleId, xpath).size()
when: 'a subscriber is removed'
- cmNotificationSubscriptionPersistenceService.removeCmNotificationSubscription(datastoreType,cmHandleId,xpath,'subId-3')
+ cmSubscriptionPersistenceService.removeCmSubscription(datastoreType, cmHandleId, xpath, 'subId-3')
then: 'the number of subscribers is reduced by 1'
- def updatedNumberOfSubscribers =
- cmNotificationSubscriptionPersistenceService.getOngoingCmNotificationSubscriptionIds(datastoreType,cmHandleId,xpath).size()
- assert updatedNumberOfSubscribers == originalNumberOfSubscribers-1
+ def updatedNumberOfSubscribers = cmSubscriptionPersistenceService.getOngoingCmSubscriptionIds(datastoreType, cmHandleId, xpath).size()
+ assert updatedNumberOfSubscribers == originalNumberOfSubscribers - 1
}
def 'Removing the LAST cm notification subscriber for a given cm handle, datastore and xpath'() {
@@ -104,12 +101,12 @@ class NcmpCmNotificationSubscriptionSpec extends CpsIntegrationSpecBase {
def cmHandleId = 'ch-1'
def xpath = '/x/y'
and: 'there is only one subscriber'
- assert cmNotificationSubscriptionPersistenceService
- .getOngoingCmNotificationSubscriptionIds(datastoreType,cmHandleId,xpath).size() == 1
+ assert cmSubscriptionPersistenceService
+ .getOngoingCmSubscriptionIds(datastoreType, cmHandleId, xpath).size() == 1
when: 'only subscriber is removed'
- cmNotificationSubscriptionPersistenceService.removeCmNotificationSubscription(datastoreType,cmHandleId,xpath,'subId-1')
+ cmSubscriptionPersistenceService.removeCmSubscription(datastoreType, cmHandleId, xpath, 'subId-1')
then: 'there are no longer any subscriptions for the cm handle, datastore and xpath'
- assert !cmNotificationSubscriptionPersistenceService.isOngoingCmNotificationSubscription(datastoreType, cmHandleId, xpath)
+ assert !cmSubscriptionPersistenceService.isOngoingCmSubscription(datastoreType, cmHandleId, xpath)
}
}