diff options
author | Priyank Maheshwari <priyank.maheshwari@est.tech> | 2024-08-16 10:09:09 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2024-08-16 10:09:09 +0000 |
commit | 4dfd43bab5ab8988796421567b3045fd96bd483b (patch) | |
tree | 119e0291371114059e69564285c1daf64c71cd71 /integration-test | |
parent | 48ee3f5ef9d78bfd7b01995293725913c20a37d8 (diff) | |
parent | e31db7316963f7554c493c1e65ff21df37f8f0b2 (diff) |
Merge "Refactored Data Job interfaces"
Diffstat (limited to 'integration-test')
3 files changed, 14 insertions, 13 deletions
diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/base/DmiDispatcher.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/base/DmiDispatcher.groovy index 5ce2475d7d..56d8f19e64 100644 --- a/integration-test/src/test/groovy/org/onap/cps/integration/base/DmiDispatcher.groovy +++ b/integration-test/src/test/groovy/org/onap/cps/integration/base/DmiDispatcher.groovy @@ -20,6 +20,8 @@ package org.onap.cps.integration.base +import org.onap.cps.ncmp.api.datajobs.models.SubJobWriteRequest + import static org.onap.cps.integration.base.CpsIntegrationSpecBase.readResourceDataFile import groovy.json.JsonSlurper @@ -91,23 +93,23 @@ class DmiDispatcher extends Dispatcher { case ~'^/dmi/v1/data$': return mockResponseWithBody(HttpStatus.ACCEPTED, '{}') - // get write sub job response - case ~'^/dmi/v1/writeJob/(.*)$': - return mockWriteJobResponse(request) - // get data job status - case ~'^/dmi/v1/dataJob/(.*)/dataProducerJob/(.*)/status(.*)$': + case ~'^/dmi/v1/cmwriteJob/dataProducer/(.*)/dataProducerJob/(.*)/status$': return mockResponseWithBody(HttpStatus.OK, '{"status":"status details from mock service"}') + // get write sub job response + case ~'^/dmi/v1/cmwriteJob(.*)$': + return mockWriteJobResponse(request) + default: throw new IllegalArgumentException('Mock DMI does not implement endpoint ' + request.path) } } def mockWriteJobResponse(request) { - def requestId = Matcher.lastMatcher[0][1] + def destination = Matcher.lastMatcher[0][1] def subJobWriteRequest = jsonSlurper.parseText(request.getBody().readUtf8()) - this.receivedSubJobs.put(requestId, subJobWriteRequest) + this.receivedSubJobs.put(destination, subJobWriteRequest) def response = '{"subJobId":"some sub job id", "dmiServiceName":"some dmi service name", "dataProducerId":"some data producer id"}' return mockResponseWithBody(HttpStatus.OK, response) } diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/functional/ncmp/DataJobStatusServiceSpec.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/functional/ncmp/DataJobStatusServiceSpec.groovy index fdcad2b47b..6e5c0e40c2 100644 --- a/integration-test/src/test/groovy/org/onap/cps/integration/functional/ncmp/DataJobStatusServiceSpec.groovy +++ b/integration-test/src/test/groovy/org/onap/cps/integration/functional/ncmp/DataJobStatusServiceSpec.groovy @@ -12,12 +12,11 @@ class DataJobStatusServiceSpec extends CpsIntegrationSpecBase { def 'Get the status of a data job from DMI.'() { given: 'the required data about the data job' def dmiServiceName = DMI1_URL - def requestId = 'some-request-id' - def dataProducerJobId = 'some-data-producer-job-id' def dataProducerId = 'some-data-producer-id' + def dataProducerJobId = 'some-data-producer-job-id' def authorization = 'my authorization header' when: 'the data job status checked' - def result = dataJobStatusService.getDataJobStatus(authorization, dmiServiceName, requestId, dataProducerJobId, dataProducerId) + def result = dataJobStatusService.getDataJobStatus(authorization, dmiServiceName, dataProducerId, dataProducerJobId) then: 'the status is that defined in the mock service.' assert result == 'status details from mock service' } diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/functional/ncmp/WriteSubJobSpec.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/functional/ncmp/WriteSubJobSpec.groovy index b73634f40b..834e1399e3 100644 --- a/integration-test/src/test/groovy/org/onap/cps/integration/functional/ncmp/WriteSubJobSpec.groovy +++ b/integration-test/src/test/groovy/org/onap/cps/integration/functional/ncmp/WriteSubJobSpec.groovy @@ -52,7 +52,7 @@ class WriteSubJobSpec extends CpsIntegrationSpecBase { given: 'the required input data for the write job' def authorization = 'my authorization header' def dataJobWriteRequest = new DataJobWriteRequest([new WriteOperation('p1', '', '', null), new WriteOperation('p2', '', '', null), new WriteOperation('p3', '', '', null)]) - def myDataJobMetadata = new DataJobMetadata('', '', '') + def myDataJobMetadata = new DataJobMetadata('d1', '', '') def dataJobId = 'my-data-job-id' when: 'sending a write job to NCMP with 2 sub-jobs for DMI 1 and 1 sub-job for DMI 2' def response = dataJobService.writeDataJob(authorization, dataJobId, myDataJobMetadata, dataJobWriteRequest) @@ -63,12 +63,12 @@ class WriteSubJobSpec extends CpsIntegrationSpecBase { assert response[0].dmiServiceName == "some dmi service name" assert response[0].dataProducerId == "some data producer id" and: 'dmi 1 received the correct job details' - def receivedSubJobsForDispatcher1 = dmiDispatcher1.receivedSubJobs['my-data-job-id']['data'].collect() + def receivedSubJobsForDispatcher1 = dmiDispatcher1.receivedSubJobs['?destination=d1']['data'].collect() assert receivedSubJobsForDispatcher1.size() == 2 assert receivedSubJobsForDispatcher1[0]['path'] == 'p1' assert receivedSubJobsForDispatcher1[1]['path'] == 'p2' and: 'dmi 2 received the correct job details' - def receivedSubJobsForDispatcher2 = dmiDispatcher2.receivedSubJobs['my-data-job-id']['data'].collect() + def receivedSubJobsForDispatcher2 = dmiDispatcher2.receivedSubJobs['?destination=d1']['data'].collect() assert receivedSubJobsForDispatcher2.size() == 1 assert receivedSubJobsForDispatcher2[0]['path'] == 'p3' } |