summaryrefslogtreecommitdiffstats
path: root/cps-ncmp-service/src/test
diff options
context:
space:
mode:
authormpriyank <priyank.maheshwari@est.tech>2024-02-23 10:35:37 +0000
committerPriyank Maheshwari <priyank.maheshwari@est.tech>2024-02-23 15:50:08 +0000
commitffb7ec84c0a491a26d05ad1017efb1b5fbacf735 (patch)
tree3932c9b7bef27a7978cba6f079fe99dc20832b62 /cps-ncmp-service/src/test
parentb8e677fa9a3ca3657b004f34742e6c8664dad3ec (diff)
Remove subscriptionModelLoader flag
- removed the flag as the functionality around model loader is stable now - removed the config parameter from the application yaml file as well Issue-ID: CPS-2112 Change-Id: Ie4e3317c0689615b900dcd9bbf1896bc3a5f37b3 Signed-off-by: mpriyank <priyank.maheshwari@est.tech>
Diffstat (limited to 'cps-ncmp-service/src/test')
-rw-r--r--cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/cmsubscription/CmNotificationSubscriptionNcmpInEventConsumerSpec.groovy2
-rw-r--r--cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/init/CmDataSubscriptionModelLoaderSpec.groovy35
-rw-r--r--cps-ncmp-service/src/test/resources/application.yml2
3 files changed, 10 insertions, 29 deletions
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/cmsubscription/CmNotificationSubscriptionNcmpInEventConsumerSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/cmsubscription/CmNotificationSubscriptionNcmpInEventConsumerSpec.groovy
index 6a3d4bef7b..1074229489 100644
--- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/cmsubscription/CmNotificationSubscriptionNcmpInEventConsumerSpec.groovy
+++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/cmsubscription/CmNotificationSubscriptionNcmpInEventConsumerSpec.groovy
@@ -71,8 +71,6 @@ class CmNotificationSubscriptionNcmpInEventConsumerSpec extends MessagingBaseSpe
def consumerRecord = new ConsumerRecord<String, CloudEvent>('topic-name', 0, 0, 'event-key', testCloudEventSent)
and: 'notifications are enabled'
objectUnderTest.notificationFeatureEnabled = true
- and: 'subscription model loader is enabled'
- objectUnderTest.subscriptionModelLoaderEnabled = true
when: 'the valid event is consumed'
objectUnderTest.consumeSubscriptionEvent(consumerRecord)
then: 'an event is logged with level INFO'
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/init/CmDataSubscriptionModelLoaderSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/init/CmDataSubscriptionModelLoaderSpec.groovy
index bde9961c2f..f3b405b117 100644
--- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/init/CmDataSubscriptionModelLoaderSpec.groovy
+++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/init/CmDataSubscriptionModelLoaderSpec.groovy
@@ -20,24 +20,23 @@
package org.onap.cps.ncmp.init
-import org.onap.cps.api.CpsAnchorService
-import org.onap.cps.ncmp.api.impl.exception.NcmpStartUpException
-import org.onap.cps.spi.exceptions.AlreadyDefinedException
-
-import static org.onap.cps.ncmp.api.impl.ncmppersistence.NcmpPersistence.NCMP_DATASPACE_NAME
-
import ch.qos.logback.classic.Level
import ch.qos.logback.classic.Logger
import ch.qos.logback.core.read.ListAppender
-import org.onap.cps.api.CpsDataspaceService
+import org.onap.cps.api.CpsAnchorService
import org.onap.cps.api.CpsDataService
+import org.onap.cps.api.CpsDataspaceService
import org.onap.cps.api.CpsModuleService
+import org.onap.cps.ncmp.api.impl.exception.NcmpStartUpException
+import org.onap.cps.spi.exceptions.AlreadyDefinedException
import org.onap.cps.spi.model.Dataspace
import org.slf4j.LoggerFactory
import org.springframework.boot.context.event.ApplicationReadyEvent
import org.springframework.context.annotation.AnnotationConfigApplicationContext
import spock.lang.Specification
+import static org.onap.cps.ncmp.api.impl.ncmppersistence.NcmpPersistence.NCMP_DATASPACE_NAME
+
class CmDataSubscriptionModelLoaderSpec extends Specification {
def mockCpsDataspaceService = Mock(CpsDataspaceService)
@@ -67,9 +66,7 @@ class CmDataSubscriptionModelLoaderSpec extends Specification {
}
def 'Onboard subscription model via application ready event.'() {
- given:'model loader is enabled'
- objectUnderTest.subscriptionModelLoaderEnabled = true
- and: 'dataspace is ready for use'
+ given: 'dataspace is ready for use'
mockCpsDataspaceService.getDataspace(NCMP_DATASPACE_NAME) >> new Dataspace('')
when: 'the application is ready'
objectUnderTest.onApplicationEvent(Mock(ApplicationReadyEvent))
@@ -81,14 +78,14 @@ class CmDataSubscriptionModelLoaderSpec extends Specification {
1 * mockCpsDataService.saveData(NCMP_DATASPACE_NAME, 'cm-data-subscriptions', '{"datastores":{}}', _)
and: 'the data service is called once to create datastore for Passthrough-operational'
1 * mockCpsDataService.saveData(NCMP_DATASPACE_NAME, 'cm-data-subscriptions', '/datastores',
- '{"datastore":[{"name":"ncmp-datastore:passthrough-operational","cm-handles":{}}]}', _, _)
+ '{"datastore":[{"name":"ncmp-datastore:passthrough-operational","cm-handles":{}}]}', _, _)
and: 'the data service is called once to create datastore for Passthrough-running'
1 * mockCpsDataService.saveData(NCMP_DATASPACE_NAME, 'cm-data-subscriptions', '/datastores',
- '{"datastore":[{"name":"ncmp-datastore:passthrough-running","cm-handles":{}}]}', _, _)
+ '{"datastore":[{"name":"ncmp-datastore:passthrough-running","cm-handles":{}}]}', _, _)
}
def 'Create node for datastore with already defined exception.'() {
- given:'the data service throws an Already Defined exception'
+ given: 'the data service throws an Already Defined exception'
mockCpsDataService.saveData(*_) >> { throw AlreadyDefinedException.forDataNodes([], 'some context') }
when: 'attempt to create datastore'
objectUnderTest.createDatastore('some datastore')
@@ -110,16 +107,4 @@ class CmDataSubscriptionModelLoaderSpec extends Specification {
assert thrown.details.contains('test message')
}
- def 'Subscription model loader disabled.' () {
- given: 'model loader is disabled'
- objectUnderTest.subscriptionModelLoaderEnabled = false
- when: 'application is ready'
- objectUnderTest.onApplicationEvent(Mock(ApplicationReadyEvent))
- then: 'no interaction with admin service'
- 0 * mockCpsDataspaceService.getDataspace(_)
- then: 'a message is logged that the function is disabled'
- def logs = loggingListAppender.list.toString()
- assert logs.contains('Subscription Model Loader is disabled')
- }
-
}
diff --git a/cps-ncmp-service/src/test/resources/application.yml b/cps-ncmp-service/src/test/resources/application.yml
index a4bb4e8124..a3283ff40f 100644
--- a/cps-ncmp-service/src/test/resources/application.yml
+++ b/cps-ncmp-service/src/test/resources/application.yml
@@ -50,8 +50,6 @@ ncmp:
async-executor:
parallelism-level: 3
- model-loader:
- subscription: true
# Custom Hazelcast Config.
hazelcast: