import static org.onap.cps.ncmp.api.impl.events.mapper.CloudEventMapper.toTargetEvent;
import io.cloudevents.CloudEvent;
-import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.onap.cps.ncmp.events.cmsubscription_merge1_0_0.client_to_ncmp.CmSubscriptionNcmpInEvent;
@Component
@Slf4j
-@RequiredArgsConstructor
public class CmSubscriptionNcmpInEventConsumer {
@Value("${notification.enabled:true}")
def 'Consume valid CMSubscription create message'() {
given: 'a cmsubscription event'
- def jsonData = TestUtils.getResourceFileContent('cmSubscriptionNcmpInEvent.json')
+ def jsonData = TestUtils.getResourceFileContent('cmSubscription/cmSubscriptionNcmpInEvent.json')
def testEventSent = jsonObjectMapper.convertJsonString(jsonData, CmSubscriptionNcmpInEvent.class)
def testCloudEventSent = CloudEventBuilder.v1()
.withData(objectMapper.writeValueAsBytes(testEventSent))
+++ /dev/null
-{
- "data": {
- "subscription": {
- "clientID": "SCO-9989752",
- "name": "cm-subscription-001"
- },
- "dataType": {
- "dataspace": "ALL",
- "dataCategory": "CM",
- "dataProvider": "CM-SERVICE"
- },
- "predicates": {
- "targets":[
- {
- "id":"CMHandle2",
- "additional-properties":{
- "Books":"Novel"
- }
- },
- {
- "id":"CMHandle1",
- "additional-properties":{
- "Books":"Social Media"
- }
- }
- ],
- "datastore": "passthrough-running",
- "datastore-xpath-filter": "//_3gpp-nr-nrm-gnbdufunction:GNBDUFunction/_3gpp-nr-nrm-nrcelldu:NRCellDU/ | //_3gpp-nr-nrm-gnbcuupfunction:GNBCUUPFunction// | //_3gpp-nr-nrm-gnbcucpfunction:GNBCUCPFunction/_3gpp-nr-nrm-nrcelldu:NRCellCU// | //_3gpp-nr-nrm-nrsectorcarrier:NRSectorCarrier//"
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-{
- "data": {
- "clientId": "SCO-9989752",
- "subscriptionName": "cm-subscription-001",
- "dmiName": "dminame1",
- "subscriptionStatus": [
- {
- "id": "CMHandle1",
- "status": "REJECTED",
- "details": "Some error message from the DMI"
- },
- {
- "id": "CMHandle2",
- "status": "REJECTED",
- "details": "Some other error message from the DMI"
- }
- ]
- }
-}
\ No newline at end of file
+++ /dev/null
-{
- "clientId": "SCO-9989752",
- "subscriptionName": "cm-subscription-001",
- "cmSubscriptionStatus": [
- {
- "id": "CMHandle1",
- "status": "REJECTED",
- "details": "Some error message from the DMI"
- },
- {
- "id": "CMHandle2",
- "status": "REJECTED",
- "details": "Some other error message from the DMI"
- },
- {
- "id": "CMHandle3",
- "status": "PENDING",
- "details": "Some error causes pending"
- },
- {
- "id": "CMHandle4",
- "status": "PENDING",
- "details": "Some other error happened"
- },
- {
- "id": "CMHandle5",
- "status": "PENDING",
- "details": "Some other error happened"
- }
- ]
-}
\ No newline at end of file
+++ /dev/null
-{
- "data": {
- "subscription": {
- "clientID": "SCO-9989752",
- "name": "cm-subscription-001"
- },
- "dataType": {
- "dataspace": "ALL",
- "dataCategory": "CM",
- "dataProvider": "CM-SERVICE"
- },
- "predicates": {
- "targets": [
- "CMHandle1",
- "CMHandle2",
- "CMHandle3"
- ],
- "datastore": "ncmp-datastore:passthrough-running",
- "datastore-xpath-filter": "//_3gpp-nr-nrm-gnbdufunction:GNBDUFunction/_3gpp-nr-nrm-nrcelldu:NRCellDU/ | //_3gpp-nr-nrm-gnbcuupfunction:GNBCUUPFunction// | //_3gpp-nr-nrm-gnbcucpfunction:GNBCUCPFunction/_3gpp-nr-nrm-nrcelldu:NRCellCU// | //_3gpp-nr-nrm-nrsectorcarrier:NRSectorCarrier//"
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-{
- "data": {
- "statusCode": 104,
- "statusMessage": "partially applied subscription",
- "additionalInfo": {
- "rejected": [
- {
- "details": "Some other error message from the DMI",
- "targets": ["CMHandle2"]
- },
- {
- "details": "Some error message from the DMI",
- "targets": ["CMHandle1"]
- }
- ],
- "pending": [
- {
- "details": "Some other error happened",
- "targets": ["CMHandle4", "CMHandle5"]
- },
- {
- "details": "Some error causes pending",
- "targets": ["CMHandle3"]
- }
- ]
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-{
- "data": {
- "statusCode": 104,
- "statusMessage": "partially applied subscription",
- "additionalInfo": {
- "rejected": [
- {
- "details": "Cm handle does not exist",
- "targets": ["CMHandle1"]
- }
- ],
- "pending": [
- {
- "details": "Subscription forwarded to dmi plugin",
- "targets": ["CMHandle3"]
- }
- ]
- }
- }
-}
\ No newline at end of file