diff options
Diffstat (limited to 'cps-ncmp-rest')
2 files changed, 19 insertions, 20 deletions
diff --git a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java index af5f226a4f..6a2e9a1541 100755 --- a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java +++ b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java @@ -148,7 +148,7 @@ public class NetworkCmProxyController implements NetworkCmProxyApi { * Patch resource data. * * @param datastoreName name of the datastore (currently only supports "ncmp-datastore:passthrough-running") - * @param cmHandle cm handle identifier + * @param cmHandleReference cm handle or alternate identifier * @param resourceIdentifier resource identifier * @param requestBody the request body * @param contentType content type of body @@ -158,7 +158,7 @@ public class NetworkCmProxyController implements NetworkCmProxyApi { @Override public ResponseEntity<Object> patchResourceDataRunningForCmHandle(final String datastoreName, - final String cmHandle, + final String cmHandleReference, final String resourceIdentifier, final Object requestBody, final String contentType, @@ -168,7 +168,7 @@ public class NetworkCmProxyController implements NetworkCmProxyApi { final Object responseObject = networkCmProxyFacade .writeResourceDataPassThroughRunningForCmHandle( - cmHandle, resourceIdentifier, PATCH, + cmHandleReference, resourceIdentifier, PATCH, jsonObjectMapper.asJsonString(requestBody), contentType, authorization); return ResponseEntity.ok(responseObject); } @@ -177,7 +177,7 @@ public class NetworkCmProxyController implements NetworkCmProxyApi { * Create resource data for given cm-handle. * * @param datastoreName name of the datastore (currently only supports "ncmp-datastore:passthrough-running") - * @param cmHandle cm handle identifier + * @param cmHandleReference cm handle or alternate identifier * @param resourceIdentifier resource identifier * @param requestBody the request body * @param contentType content type of body @@ -186,14 +186,14 @@ public class NetworkCmProxyController implements NetworkCmProxyApi { */ @Override public ResponseEntity<Void> createResourceDataRunningForCmHandle(final String datastoreName, - final String cmHandle, + final String cmHandleReference, final String resourceIdentifier, final Object requestBody, final String contentType, final String authorization) { validateDataStore(PASSTHROUGH_RUNNING, datastoreName); - networkCmProxyFacade.writeResourceDataPassThroughRunningForCmHandle(cmHandle, + networkCmProxyFacade.writeResourceDataPassThroughRunningForCmHandle(cmHandleReference, resourceIdentifier, CREATE, jsonObjectMapper.asJsonString(requestBody), contentType, authorization); return new ResponseEntity<>(HttpStatus.CREATED); } @@ -202,7 +202,7 @@ public class NetworkCmProxyController implements NetworkCmProxyApi { * Update resource data for given cm-handle. * * @param datastoreName name of the datastore (currently only supports "ncmp-datastore:passthrough-running") - * @param cmHandle cm handle identifier + * @param cmHandleReference cm handle or alternate identifier * @param resourceIdentifier resource identifier * @param requestBody the request body * @param contentType content type of the body @@ -212,14 +212,14 @@ public class NetworkCmProxyController implements NetworkCmProxyApi { @Override public ResponseEntity<Object> updateResourceDataRunningForCmHandle(final String datastoreName, - final String cmHandle, + final String cmHandleReference, final String resourceIdentifier, final Object requestBody, final String contentType, final String authorization) { validateDataStore(PASSTHROUGH_RUNNING, datastoreName); - networkCmProxyFacade.writeResourceDataPassThroughRunningForCmHandle(cmHandle, + networkCmProxyFacade.writeResourceDataPassThroughRunningForCmHandle(cmHandleReference, resourceIdentifier, UPDATE, jsonObjectMapper.asJsonString(requestBody), contentType, authorization); return new ResponseEntity<>(HttpStatus.OK); } @@ -228,7 +228,7 @@ public class NetworkCmProxyController implements NetworkCmProxyApi { * Delete resource data for a given cm-handle. * * @param datastoreName name of the datastore (currently only supports "ncmp-datastore:passthrough-running") - * @param cmHandle cm handle identifier + * @param cmHandleReference cm handle or alternate identifier * @param resourceIdentifier resource identifier * @param contentType content type of the body * @param authorization contents of Authorization header, or null if not present @@ -236,14 +236,14 @@ public class NetworkCmProxyController implements NetworkCmProxyApi { */ @Override public ResponseEntity<Void> deleteResourceDataRunningForCmHandle(final String datastoreName, - final String cmHandle, + final String cmHandleReference, final String resourceIdentifier, final String contentType, final String authorization) { validateDataStore(PASSTHROUGH_RUNNING, datastoreName); - networkCmProxyFacade.writeResourceDataPassThroughRunningForCmHandle(cmHandle, + networkCmProxyFacade.writeResourceDataPassThroughRunningForCmHandle(cmHandleReference, resourceIdentifier, DELETE, NO_BODY, contentType, authorization); return new ResponseEntity<>(HttpStatus.NO_CONTENT); } @@ -317,13 +317,13 @@ public class NetworkCmProxyController implements NetworkCmProxyApi { /** * Get Cm Handle State by Cm Handle Id. * - * @param cmHandleId cm-handle identifier + * @param cmHandleReference cm-handle or alternate identifier * @return cm handle state */ @Override public ResponseEntity<RestOutputCmHandleCompositeState> getCmHandleStateByCmHandleId( - final String cmHandleId) { - final CompositeState cmHandleState = networkCmProxyInventoryFacade.getCmHandleCompositeState(cmHandleId); + final String cmHandleReference) { + final CompositeState cmHandleState = networkCmProxyInventoryFacade.getCmHandleCompositeState(cmHandleReference); final RestOutputCmHandleCompositeState restOutputCmHandleCompositeState = new RestOutputCmHandleCompositeState(); restOutputCmHandleCompositeState.setState( diff --git a/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy b/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy index 9f5331dbc3..92b47c6c8b 100644 --- a/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy +++ b/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy @@ -32,7 +32,6 @@ import groovy.json.JsonSlurper import org.mapstruct.factory.Mappers import org.onap.cps.TestUtils import org.onap.cps.events.EventsPublisher -import org.onap.cps.ncmp.api.data.models.CmResourceAddress import org.onap.cps.ncmp.api.inventory.NetworkCmProxyInventoryFacade import org.onap.cps.ncmp.api.inventory.models.CompositeState import org.onap.cps.ncmp.api.inventory.models.NcmpServiceCmHandle @@ -95,7 +94,7 @@ class NetworkCmProxyControllerSpec extends Specification { NetworkCmProxyInventoryFacade mockNetworkCmProxyInventoryFacade = Mock() @SpringBean - AlternateIdMatcher mockalternateIdMatcher = Mock() + AlternateIdMatcher mockAlternateIdMatcher = Mock() @SpringBean ObjectMapper objectMapper = new ObjectMapper() @@ -324,13 +323,13 @@ class NetworkCmProxyControllerSpec extends Specification { assertContainsPublicProperties(response) } - def 'Get Cm Handle composite state by Cm Handle id.'() { + def 'Get Cm Handle composite state by Cm Handle Reference.'() { given: 'a cm handle state endpoint' - def cmHandlePropertiesEndpoint = "$ncmpBasePathV1/ch/some-cm-handle/state" + def cmHandlePropertiesEndpoint = "$ncmpBasePathV1/ch/some-cm-handle-reference/state" and: 'some cm handle composite state' def compositeState = compositeStateTestObject() and: 'the service method is invoked with the cm handle id returning the cm handle composite state' - 1 * mockNetworkCmProxyInventoryFacade.getCmHandleCompositeState('some-cm-handle') >> compositeState + 1 * mockNetworkCmProxyInventoryFacade.getCmHandleCompositeState('some-cm-handle-reference') >> compositeState when: 'the cm handle state api is invoked' def response = mvc.perform(get(cmHandlePropertiesEndpoint)).andReturn().response then: 'the correct response is returned' |