aboutsummaryrefslogtreecommitdiffstats
path: root/integration-test
diff options
context:
space:
mode:
authorSourabh Sourabh <sourabh.sourabh@est.tech>2024-06-21 09:28:37 +0000
committerGerrit Code Review <gerrit@onap.org>2024-06-21 09:28:37 +0000
commit01b58388db5d6a16c8a3f946fbfb82100377cbda (patch)
treebd93079a38d1ef660b08f3f0fb5bd5a2a645a886 /integration-test
parente9893a3d2150bbb3256b09ecdab6d627fea95335 (diff)
parentdbed81b6cece07c8950fa2f32f6f05eba3bb991e (diff)
Merge "Introducing NCMP Facades"
Diffstat (limited to 'integration-test')
-rw-r--r--integration-test/src/test/groovy/org/onap/cps/integration/base/CpsIntegrationSpecBase.groovy37
-rw-r--r--integration-test/src/test/groovy/org/onap/cps/integration/functional/NcmpBearerTokenPassthroughSpec.groovy16
-rw-r--r--integration-test/src/test/groovy/org/onap/cps/integration/functional/NcmpCmHandleCreateSpec.groovy19
-rw-r--r--integration-test/src/test/groovy/org/onap/cps/integration/functional/NcmpCmHandleUpgradeSpec.groovy14
4 files changed, 46 insertions, 40 deletions
diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/base/CpsIntegrationSpecBase.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/base/CpsIntegrationSpecBase.groovy
index 85f479f2a0..0c5c8165f1 100644
--- a/integration-test/src/test/groovy/org/onap/cps/integration/base/CpsIntegrationSpecBase.groovy
+++ b/integration-test/src/test/groovy/org/onap/cps/integration/base/CpsIntegrationSpecBase.groovy
@@ -21,14 +21,7 @@
package org.onap.cps.integration.base
-import static org.onap.cps.ncmp.api.impl.ncmppersistence.NcmpPersistence.NCMP_DATASPACE_NAME
-import static org.onap.cps.ncmp.api.impl.ncmppersistence.NcmpPersistence.NCMP_DMI_REGISTRY_ANCHOR
-import static org.onap.cps.ncmp.api.impl.ncmppersistence.NcmpPersistence.NCMP_DMI_REGISTRY_PARENT
-
-import java.time.OffsetDateTime
-import java.time.format.DateTimeFormatter
import okhttp3.mockwebserver.MockWebServer
-import org.onap.cps.ncmp.api.impl.inventory.InventoryPersistence
import org.onap.cps.api.CpsAnchorService
import org.onap.cps.api.CpsDataService
import org.onap.cps.api.CpsDataspaceService
@@ -36,20 +29,22 @@ import org.onap.cps.api.CpsModuleService
import org.onap.cps.api.CpsQueryService
import org.onap.cps.integration.DatabaseTestContainer
import org.onap.cps.integration.KafkaTestContainer
-import org.onap.cps.ncmp.api.NetworkCmProxyCmHandleQueryService
-import org.onap.cps.ncmp.api.NetworkCmProxyDataService
import org.onap.cps.ncmp.api.NetworkCmProxyQueryService
+import org.onap.cps.ncmp.api.ParameterizedCmHandleQueryService
+import org.onap.cps.ncmp.api.impl.NetworkCmProxyFacade
+import org.onap.cps.ncmp.api.impl.NetworkCmProxyInventoryFacade
import org.onap.cps.ncmp.api.impl.inventory.CmHandleState
+import org.onap.cps.ncmp.api.impl.inventory.InventoryPersistence
import org.onap.cps.ncmp.api.impl.inventory.sync.ModuleSyncWatchdog
import org.onap.cps.ncmp.api.models.DmiPluginRegistration
import org.onap.cps.ncmp.api.models.NcmpServiceCmHandle
+import org.onap.cps.ncmp.utils.AlternateIdMatcher
import org.onap.cps.spi.exceptions.DataspaceNotFoundException
import org.onap.cps.spi.model.DataNode
import org.onap.cps.spi.repository.DataspaceRepository
import org.onap.cps.spi.utils.SessionManager
-import org.onap.cps.ncmp.utils.AlternateIdMatcher
-import org.onap.cps.utils.JsonObjectMapper
import org.onap.cps.utils.ContentType
+import org.onap.cps.utils.JsonObjectMapper
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.autoconfigure.EnableAutoConfiguration
import org.springframework.boot.autoconfigure.domain.EntityScan
@@ -63,6 +58,13 @@ import spock.lang.Shared
import spock.lang.Specification
import spock.util.concurrent.PollingConditions
+import java.time.OffsetDateTime
+import java.time.format.DateTimeFormatter
+
+import static org.onap.cps.ncmp.api.impl.ncmppersistence.NcmpPersistence.NCMP_DATASPACE_NAME
+import static org.onap.cps.ncmp.api.impl.ncmppersistence.NcmpPersistence.NCMP_DMI_REGISTRY_ANCHOR
+import static org.onap.cps.ncmp.api.impl.ncmppersistence.NcmpPersistence.NCMP_DMI_REGISTRY_PARENT
+
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.MOCK, classes = [CpsDataspaceService])
@Testcontainers
@EnableAutoConfiguration
@@ -100,10 +102,13 @@ abstract class CpsIntegrationSpecBase extends Specification {
SessionManager sessionManager
@Autowired
- NetworkCmProxyCmHandleQueryService networkCmProxyCmHandleQueryService
+ ParameterizedCmHandleQueryService networkCmProxyCmHandleQueryService
+
+ @Autowired
+ NetworkCmProxyFacade networkCmProxyFacade
@Autowired
- NetworkCmProxyDataService networkCmProxyDataService
+ NetworkCmProxyInventoryFacade NetworkCmProxyInventoryFacade
@Autowired
NetworkCmProxyQueryService networkCmProxyQueryService
@@ -212,10 +217,10 @@ abstract class CpsIntegrationSpecBase extends Specification {
def registerCmHandle(dmiPlugin, cmHandleId, moduleSetTag) {
def cmHandleToCreate = new NcmpServiceCmHandle(cmHandleId: cmHandleId, moduleSetTag: moduleSetTag)
- networkCmProxyDataService.updateDmiRegistrationAndSyncModule(new DmiPluginRegistration(dmiPlugin: dmiPlugin, createdCmHandles: [cmHandleToCreate]))
+ networkCmProxyInventoryFacade.updateDmiRegistrationAndSyncModule(new DmiPluginRegistration(dmiPlugin: dmiPlugin, createdCmHandles: [cmHandleToCreate]))
moduleSyncWatchdog.moduleSyncAdvisedCmHandles()
new PollingConditions().within(3, () -> {
- CmHandleState.READY == networkCmProxyDataService.getCmHandleCompositeState(cmHandleId).cmHandleState
+ CmHandleState.READY == networkCmProxyInventoryFacade.getCmHandleCompositeState(cmHandleId).cmHandleState
})
}
@@ -224,7 +229,7 @@ abstract class CpsIntegrationSpecBase extends Specification {
}
def deregisterCmHandles(dmiPlugin, cmHandleIds) {
- networkCmProxyDataService.updateDmiRegistrationAndSyncModule(new DmiPluginRegistration(dmiPlugin: dmiPlugin, removedCmHandles: cmHandleIds))
+ networkCmProxyInventoryFacade.updateDmiRegistrationAndSyncModule(new DmiPluginRegistration(dmiPlugin: dmiPlugin, removedCmHandles: cmHandleIds))
}
def overrideCmHandleLastUpdateTime(cmHandleId, newUpdateTime) {
diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/functional/NcmpBearerTokenPassthroughSpec.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/functional/NcmpBearerTokenPassthroughSpec.groovy
index 4ffe586a99..2a35313f74 100644
--- a/integration-test/src/test/groovy/org/onap/cps/integration/functional/NcmpBearerTokenPassthroughSpec.groovy
+++ b/integration-test/src/test/groovy/org/onap/cps/integration/functional/NcmpBearerTokenPassthroughSpec.groovy
@@ -20,14 +20,6 @@
package org.onap.cps.integration.functional
-import static org.springframework.http.HttpMethod.GET
-import static org.springframework.http.HttpMethod.DELETE
-import static org.springframework.http.HttpMethod.PATCH
-import static org.springframework.http.HttpMethod.POST
-import static org.springframework.http.HttpMethod.PUT
-import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.request
-import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status
-
import okhttp3.mockwebserver.Dispatcher
import okhttp3.mockwebserver.MockResponse
import okhttp3.mockwebserver.RecordedRequest
@@ -38,6 +30,14 @@ import org.springframework.http.HttpStatus
import org.springframework.http.MediaType
import spock.util.concurrent.PollingConditions
+import static org.springframework.http.HttpMethod.DELETE
+import static org.springframework.http.HttpMethod.GET
+import static org.springframework.http.HttpMethod.PATCH
+import static org.springframework.http.HttpMethod.POST
+import static org.springframework.http.HttpMethod.PUT
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.request
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status
+
class NcmpBearerTokenPassthroughSpec extends CpsIntegrationSpecBase {
def lastAuthHeaderReceived = null
diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/functional/NcmpCmHandleCreateSpec.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/functional/NcmpCmHandleCreateSpec.groovy
index 5c337f179b..8186c41914 100644
--- a/integration-test/src/test/groovy/org/onap/cps/integration/functional/NcmpCmHandleCreateSpec.groovy
+++ b/integration-test/src/test/groovy/org/onap/cps/integration/functional/NcmpCmHandleCreateSpec.groovy
@@ -20,13 +20,11 @@
package org.onap.cps.integration.functional
-import java.time.Duration
-import java.time.OffsetDateTime
import org.apache.kafka.common.TopicPartition
import org.apache.kafka.common.serialization.StringDeserializer
import org.onap.cps.integration.KafkaTestContainer
import org.onap.cps.integration.base.CpsIntegrationSpecBase
-import org.onap.cps.ncmp.api.NetworkCmProxyDataService
+import org.onap.cps.ncmp.api.impl.NetworkCmProxyInventoryFacade
import org.onap.cps.ncmp.api.impl.inventory.CmHandleState
import org.onap.cps.ncmp.api.impl.inventory.LockReasonCategory
import org.onap.cps.ncmp.api.models.CmHandleRegistrationResponse
@@ -35,14 +33,17 @@ import org.onap.cps.ncmp.api.models.NcmpServiceCmHandle
import org.onap.cps.ncmp.events.lcm.v1.LcmEvent
import spock.util.concurrent.PollingConditions
+import java.time.Duration
+import java.time.OffsetDateTime
+
class NcmpCmHandleCreateSpec extends CpsIntegrationSpecBase {
- NetworkCmProxyDataService objectUnderTest
+ NetworkCmProxyInventoryFacade objectUnderTest
def kafkaConsumer = KafkaTestContainer.getConsumer('ncmp-group', StringDeserializer.class)
def setup() {
- objectUnderTest = networkCmProxyDataService
+ objectUnderTest = networkCmProxyInventoryFacade
}
def 'CM Handle registration is successful.'() {
@@ -55,7 +56,7 @@ class NcmpCmHandleCreateSpec extends CpsIntegrationSpecBase {
when: 'a CM-handle is registered for creation'
def cmHandleToCreate = new NcmpServiceCmHandle(cmHandleId: 'ch-1')
def dmiPluginRegistration = new DmiPluginRegistration(dmiPlugin: DMI_URL, createdCmHandles: [cmHandleToCreate])
- def dmiPluginRegistrationResponse = networkCmProxyDataService.updateDmiRegistrationAndSyncModule(dmiPluginRegistration)
+ def dmiPluginRegistrationResponse = objectUnderTest.updateDmiRegistrationAndSyncModule(dmiPluginRegistration)
then: 'registration gives successful response'
assert dmiPluginRegistrationResponse.createdCmHandles == [CmHandleRegistrationResponse.createSuccessResponse('ch-1')]
@@ -93,7 +94,7 @@ class NcmpCmHandleCreateSpec extends CpsIntegrationSpecBase {
when: 'a CM-handle is registered for creation'
def cmHandleToCreate = new NcmpServiceCmHandle(cmHandleId: 'ch-1')
def dmiPluginRegistration = new DmiPluginRegistration(dmiPlugin: DMI_URL, createdCmHandles: [cmHandleToCreate])
- networkCmProxyDataService.updateDmiRegistrationAndSyncModule(dmiPluginRegistration)
+ objectUnderTest.updateDmiRegistrationAndSyncModule(dmiPluginRegistration)
and: 'module sync runs'
moduleSyncWatchdog.moduleSyncAdvisedCmHandles()
@@ -121,7 +122,7 @@ class NcmpCmHandleCreateSpec extends CpsIntegrationSpecBase {
when: 'a CM-handle is registered for creation with moduleSetTag "B"'
def cmHandleToCreate = new NcmpServiceCmHandle(cmHandleId: 'ch-3', moduleSetTag: 'B')
- networkCmProxyDataService.updateDmiRegistrationAndSyncModule(new DmiPluginRegistration(dmiPlugin: DMI_URL, createdCmHandles: [cmHandleToCreate]))
+ objectUnderTest.updateDmiRegistrationAndSyncModule(new DmiPluginRegistration(dmiPlugin: DMI_URL, createdCmHandles: [cmHandleToCreate]))
then: 'the CM-handle goes to READY state after module sync'
moduleSyncWatchdog.moduleSyncAdvisedCmHandles()
@@ -146,7 +147,7 @@ class NcmpCmHandleCreateSpec extends CpsIntegrationSpecBase {
when: 'CM-handles are registered for creation'
def cmHandlesToCreate = [new NcmpServiceCmHandle(cmHandleId: 'ch-1'), new NcmpServiceCmHandle(cmHandleId: 'ch-2')]
def dmiPluginRegistration = new DmiPluginRegistration(dmiPlugin: DMI_URL, createdCmHandles: cmHandlesToCreate)
- networkCmProxyDataService.updateDmiRegistrationAndSyncModule(dmiPluginRegistration)
+ objectUnderTest.updateDmiRegistrationAndSyncModule(dmiPluginRegistration)
and: 'module sync runs'
moduleSyncWatchdog.moduleSyncAdvisedCmHandles()
then: 'CM-handles go to LOCKED state'
diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/functional/NcmpCmHandleUpgradeSpec.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/functional/NcmpCmHandleUpgradeSpec.groovy
index 4d1d77e694..f5c0b7bea7 100644
--- a/integration-test/src/test/groovy/org/onap/cps/integration/functional/NcmpCmHandleUpgradeSpec.groovy
+++ b/integration-test/src/test/groovy/org/onap/cps/integration/functional/NcmpCmHandleUpgradeSpec.groovy
@@ -21,7 +21,7 @@
package org.onap.cps.integration.functional
import org.onap.cps.integration.base.CpsIntegrationSpecBase
-import org.onap.cps.ncmp.api.NetworkCmProxyDataService
+import org.onap.cps.ncmp.api.impl.NetworkCmProxyInventoryFacade
import org.onap.cps.ncmp.api.impl.inventory.CmHandleState
import org.onap.cps.ncmp.api.impl.inventory.LockReasonCategory
import org.onap.cps.ncmp.api.models.CmHandleRegistrationResponse
@@ -31,13 +31,13 @@ import spock.util.concurrent.PollingConditions
class NcmpCmHandleUpgradeSpec extends CpsIntegrationSpecBase {
- NetworkCmProxyDataService objectUnderTest
+ NetworkCmProxyInventoryFacade objectUnderTest
static final CM_HANDLE_ID = 'ch-1'
static final CM_HANDLE_ID_WITH_EXISTING_MODULE_SET_TAG = 'ch-2'
def setup() {
- objectUnderTest = networkCmProxyDataService
+ objectUnderTest = networkCmProxyInventoryFacade
}
def 'Upgrade CM-handle with new moduleSetTag or no moduleSetTag.'() {
@@ -48,7 +48,7 @@ class NcmpCmHandleUpgradeSpec extends CpsIntegrationSpecBase {
when: "the CM-handle is upgraded with given moduleSetTag '${updatedModuleSetTag}'"
def cmHandlesToUpgrade = new UpgradedCmHandles(cmHandles: [CM_HANDLE_ID], moduleSetTag: updatedModuleSetTag)
- def dmiPluginRegistrationResponse = networkCmProxyDataService.updateDmiRegistrationAndSyncModule(
+ def dmiPluginRegistrationResponse = objectUnderTest.updateDmiRegistrationAndSyncModule(
new DmiPluginRegistration(dmiPlugin: DMI_URL, upgradedCmHandles: cmHandlesToUpgrade))
then: 'registration gives successful response'
@@ -101,7 +101,7 @@ class NcmpCmHandleUpgradeSpec extends CpsIntegrationSpecBase {
when: "CM-handle is upgraded to moduleSetTag '${updatedModuleSetTag}'"
def cmHandlesToUpgrade = new UpgradedCmHandles(cmHandles: [CM_HANDLE_ID], moduleSetTag: updatedModuleSetTag)
- def dmiPluginRegistrationResponse = networkCmProxyDataService.updateDmiRegistrationAndSyncModule(
+ def dmiPluginRegistrationResponse = objectUnderTest.updateDmiRegistrationAndSyncModule(
new DmiPluginRegistration(dmiPlugin: DMI_URL, upgradedCmHandles: cmHandlesToUpgrade))
then: 'registration gives successful response'
@@ -139,7 +139,7 @@ class NcmpCmHandleUpgradeSpec extends CpsIntegrationSpecBase {
when: 'CM-handle is upgraded with the same moduleSetTag'
def cmHandlesToUpgrade = new UpgradedCmHandles(cmHandles: [CM_HANDLE_ID], moduleSetTag: 'same')
- networkCmProxyDataService.updateDmiRegistrationAndSyncModule(
+ objectUnderTest.updateDmiRegistrationAndSyncModule(
new DmiPluginRegistration(dmiPlugin: DMI_URL, upgradedCmHandles: cmHandlesToUpgrade))
then: 'CM-handle remains in READY state'
@@ -164,7 +164,7 @@ class NcmpCmHandleUpgradeSpec extends CpsIntegrationSpecBase {
when: 'the CM-handle is upgraded'
def cmHandlesToUpgrade = new UpgradedCmHandles(cmHandles: [CM_HANDLE_ID], moduleSetTag: 'newTag')
- networkCmProxyDataService.updateDmiRegistrationAndSyncModule(
+ objectUnderTest.updateDmiRegistrationAndSyncModule(
new DmiPluginRegistration(dmiPlugin: DMI_URL, upgradedCmHandles: cmHandlesToUpgrade))
and: 'module sync runs'