dataType:
type: string
data:
- type: object
+ type: string
cmHandleProperties:
type: object
additionalProperties:
* @return response from sdnc
*/
String writeResourceDataPassthroughForCmHandle(String cmHandle, String resourceIdentifier, String dataType,
- Object data);
+ String data);
}
\ No newline at end of file
@Override
public String writeResourceDataPassthroughForCmHandle(final String cmHandle, final String resourceIdentifier,
- final String dataType, final Object data) {
- final String jsonData;
- try {
- jsonData = objectMapper.writeValueAsString(data);
- } catch (final JsonProcessingException e) {
- log.error("JSON exception occurred when processing pass through request data for the given cmHandle {}",
- cmHandle);
- throw new DmiException("Unable to process incoming JSON from the request body.",
- "JSON exception occurred when writing data for the given cmHandle " + cmHandle, e);
- }
+ final String dataType, final String data) {
final ResponseEntity<String> responseEntity =
- sdncOperations.writeResourceDataPassthroughRunning(cmHandle, resourceIdentifier, dataType, jsonData);
+ sdncOperations.writeResourceDataPassthroughRunning(cmHandle, resourceIdentifier, dataType, data);
if (responseEntity.getStatusCode() == HttpStatus.CREATED) {
return responseEntity.getBody();
} else {
def writeDataforCmHandlePassthroughRunning = "${basePathV1}/ch/some-cmHandle/data/ds/ncmp-datastore:passthrough-running/some-resourceIdentifier"
def jsonData = TestUtils.getResourceFileContent('WriteDataForCmHandle.json')
and: 'dmi service is called'
- mockDmiService.writeResourceDataPassthroughForCmHandle('some-cmHandle', 'some-resourceIdentifier', 'application/json', ['some-data': 'some-value']) >> '{some-json}'
+ mockDmiService.writeResourceDataPassthroughForCmHandle('some-cmHandle', 'some-resourceIdentifier', 'application/json', '{ some data }') >> '{some-json}'
when: 'write cmHandle passthrough running post api is invoked with json data'
def response = mvc.perform(
post(writeDataforCmHandlePassthroughRunning).contentType(MediaType.APPLICATION_JSON)
mockObjectMapper.writeValueAsString(_) >> jsonString
when: 'write resource data for pass through method is invoked'
objectUnderTest.writeResourceDataPassthroughForCmHandle('some-cmHandle',
- 'some-resourceIdentifier', 'some-dataType', new Object())
+ 'some-resourceIdentifier', 'some-dataType', 'some-json-data')
then: 'a dmi exception is thrown'
thrown(DmiException.class)
where: 'the following combinations are tested'
{
"operation": "create",
"dataType": "application/json",
- "data": {
- "some-data": "some-value"
- },
+ "data": "{ some data }",
"cmHandleProperties": {
"some-property": "some-property-value"
}