diff options
Diffstat (limited to 'cps-service/src/test')
3 files changed, 20 insertions, 15 deletions
diff --git a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsModuleServiceImplSpec.groovy b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsModuleServiceImplSpec.groovy index d719b3d24e..2c23aa1bc8 100644 --- a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsModuleServiceImplSpec.groovy +++ b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsModuleServiceImplSpec.groovy @@ -25,6 +25,7 @@ package org.onap.cps.api.impl import org.onap.cps.TestUtils import org.onap.cps.spi.CpsModulePersistenceService import org.onap.cps.spi.exceptions.ModelValidationException +import org.onap.cps.spi.model.ExtendedModuleReference import org.onap.cps.spi.model.ModuleReference import org.spockframework.spring.SpringBean import org.springframework.beans.factory.annotation.Autowired @@ -63,7 +64,7 @@ class CpsModuleServiceImplSpec extends Specification { def 'Create schema set from new modules and existing modules.'() { given: 'a list of existing modules module reference' - def moduleReferenceForExistingModule = new ModuleReference("test", "test.org", "2021-10-12") + def moduleReferenceForExistingModule = new ExtendedModuleReference("test", "test.org", "2021-10-12") def listOfExistingModulesModuleReference = [moduleReferenceForExistingModule] when: 'create schema set from modules method is invoked' objectUnderTest.createSchemaSetFromModules("someDataspaceName", "someSchemaSetName", [newModule: "newContent"], listOfExistingModulesModuleReference) @@ -90,7 +91,7 @@ class CpsModuleServiceImplSpec extends Specification { then: 'the correct schema set is returned' result.getName().contains('someSchemaSet') result.getDataspaceName().contains('someDataspace') - result.getModuleReferences().contains(new ModuleReference('stores', 'org:onap:ccsdk:sample', '2020-09-15')) + result.getExtendedModuleReferences().contains(new ExtendedModuleReference('stores', 'org:onap:ccsdk:sample', '2020-09-15')) } def 'Schema set caching.'() { @@ -117,9 +118,18 @@ class CpsModuleServiceImplSpec extends Specification { def 'Get all yang resources module references.'(){ given: 'an already present module reference' + def moduleReferences = [new ExtendedModuleReference()] + mockModuleStoreService.getYangResourceModuleReferences('someDataspaceName') >> moduleReferences + expect: 'the list provided by persistence service is returned as result' + objectUnderTest.getYangResourceModuleReferences('someDataspaceName') == moduleReferences + } + + + def 'Get all yang resources module references for the given dataspace name and anchor name.'(){ + given: 'the module store service service returns a list module references' def moduleReferences = [new ModuleReference()] - mockModuleStoreService.getAllYangResourcesModuleReferences() >> moduleReferences + mockModuleStoreService.getYangResourceModuleReferences('someDataspaceName', 'someAnchorName') >> moduleReferences expect: 'the list provided by persistence service is returned as result' - objectUnderTest.getAllYangResourcesModuleReferences() == moduleReferences + objectUnderTest.getYangResourcesModuleReferences('someDataspaceName', 'someAnchorName') == moduleReferences } } diff --git a/cps-service/src/test/groovy/org/onap/cps/notification/NotificationServiceSpec.groovy b/cps-service/src/test/groovy/org/onap/cps/notification/NotificationServiceSpec.groovy index 875113d225..ca704edb4c 100644 --- a/cps-service/src/test/groovy/org/onap/cps/notification/NotificationServiceSpec.groovy +++ b/cps-service/src/test/groovy/org/onap/cps/notification/NotificationServiceSpec.groovy @@ -36,7 +36,6 @@ import spock.lang.Specification import java.util.concurrent.TimeUnit @SpringBootTest -@EnableAsync @EnableConfigurationProperties @ContextConfiguration(classes = [NotificationProperties, NotificationService, NotificationErrorHandler, AsyncConfig]) class NotificationServiceSpec extends Specification { @@ -105,10 +104,4 @@ class NotificationServiceSpec extends Specification { 1 * spyNotificationErrorHandler.onException(_, _, _, _) } - NotificationService createNotificationService(boolean notificationEnabled) { - spyNotificationProperties = Spy(notificationProperties) - spyNotificationProperties.isEnabled() >> notificationEnabled - return new NotificationService(spyNotificationProperties, mockNotificationPublisher, - mockCpsDataUpdatedEventFactory, spyNotificationErrorHandler) - } } diff --git a/cps-service/src/test/resources/application.yml b/cps-service/src/test/resources/application.yml index b1546d74f3..436c3d4c34 100644 --- a/cps-service/src/test/resources/application.yml +++ b/cps-service/src/test/resources/application.yml @@ -22,10 +22,12 @@ notification: enabled-dataspaces: ".*-published,.*-important" enabled: true topic: cps-event - async-executor: - core-pool-size: 2 - max-pool-size: 10 - queue-capacity: 0 + async: + enabled: true + executor: + core-pool-size: 2 + max-pool-size: 10 + queue-capacity: 0 spring: kafka: |