summaryrefslogtreecommitdiffstats
path: root/cps-ncmp-rest-stub/src/main/java/org/onap
diff options
context:
space:
mode:
authorputhuparambil.aditya <aditya.puthuparambil@bell.ca>2022-06-27 16:11:36 +0100
committerputhuparambil.aditya <aditya.puthuparambil@bell.ca>2022-07-01 10:42:22 +0100
commitfa86bb96dd2d8aaba4bd7ecd0d881305eab174e3 (patch)
treedc2bcc78356bad9c1575d25961109d8bf42f7c7d /cps-ncmp-rest-stub/src/main/java/org/onap
parent89c2f729954a4c93bebcd3b7495df8d191ba00b9 (diff)
cps-ncmp-rest-stub can not be compiled and executed
Issue-ID: CPS-1094 Signed-off-by: puthuparambil.aditya <aditya.puthuparambil@bell.ca> Change-Id: I2cd010e0bbe140198db22cf1f62cc8b0b9c80729
Diffstat (limited to 'cps-ncmp-rest-stub/src/main/java/org/onap')
-rw-r--r--cps-ncmp-rest-stub/src/main/java/org/onap/cps/ncmp/rest/stub/controller/NetworkCmProxyStubController.java31
1 files changed, 17 insertions, 14 deletions
diff --git a/cps-ncmp-rest-stub/src/main/java/org/onap/cps/ncmp/rest/stub/controller/NetworkCmProxyStubController.java b/cps-ncmp-rest-stub/src/main/java/org/onap/cps/ncmp/rest/stub/controller/NetworkCmProxyStubController.java
index 6362cf1e15..45408b0ebf 100644
--- a/cps-ncmp-rest-stub/src/main/java/org/onap/cps/ncmp/rest/stub/controller/NetworkCmProxyStubController.java
+++ b/cps-ncmp-rest-stub/src/main/java/org/onap/cps/ncmp/rest/stub/controller/NetworkCmProxyStubController.java
@@ -24,6 +24,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -32,9 +33,7 @@ import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import lombok.extern.slf4j.Slf4j;
import org.onap.cps.ncmp.rest.api.NetworkCmProxyApi;
-import org.onap.cps.ncmp.rest.model.CmHandleQueryRestParameters;
-import org.onap.cps.ncmp.rest.model.CmHandles;
-import org.onap.cps.ncmp.rest.model.Conditions;
+import org.onap.cps.ncmp.rest.model.CmHandleQueryParameters;
import org.onap.cps.ncmp.rest.model.RestModuleReference;
import org.onap.cps.ncmp.rest.model.RestOutputCmHandle;
import org.onap.cps.ncmp.rest.model.RestOutputCmHandlePublicProperties;
@@ -68,18 +67,26 @@ public class NetworkCmProxyStubController implements NetworkCmProxyApi {
}
@Override
- public ResponseEntity<CmHandles> executeCmHandleSearch(@Valid final Conditions body) {
- final ObjectMapper mapper = new ObjectMapper();
- CmHandles cmHandles = new CmHandles();
+ public ResponseEntity<List<RestOutputCmHandle>> searchCmHandles(
+ final CmHandleQueryParameters cmHandleQueryParameters) {
+ List<RestOutputCmHandle> restOutputCmHandles = null;
// read JSON file and map/convert to java POJO
final ClassPathResource resource = new ClassPathResource(pathToResponseFiles + "cmHandlesSearch.json");
try (InputStream inputStream = resource.getInputStream()) {
final String string = new String(inputStream.readAllBytes(), StandardCharsets.UTF_8);
- cmHandles = mapper.readValue(string, CmHandles.class);
+ final ObjectMapper mapper = new ObjectMapper();
+ restOutputCmHandles = Arrays.asList(mapper.readValue(string, RestOutputCmHandle[].class));
} catch (final IOException exception) {
log.error("Error reading the file.", exception);
+ return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build();
}
- return ResponseEntity.ok(cmHandles);
+ return ResponseEntity.ok(restOutputCmHandles);
+ }
+
+ @Override
+ public ResponseEntity<List<String>> searchCmHandleIds(
+ final CmHandleQueryParameters cmHandleQueryParameters) {
+ return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
@Override
@@ -107,16 +114,17 @@ public class NetworkCmProxyStubController implements NetworkCmProxyApi {
final String resourceIdentifier, final String optionsParamInQuery, final String topicParamInQuery) {
final ResponseEntity<Map<String, Object>> asyncResponse = populateAsyncResponse(topicParamInQuery);
final Map<String, Object> asyncResponseData = asyncResponse.getBody();
- final ObjectMapper mapper = new ObjectMapper();
Object responseObject = null;
// read JSON file and map/convert to java POJO
final ClassPathResource resource = new ClassPathResource(pathToResponseFiles
+ "passthrough-operational-example.json");
try (InputStream inputStream = resource.getInputStream()) {
final String string = new String(inputStream.readAllBytes(), StandardCharsets.UTF_8);
+ final ObjectMapper mapper = new ObjectMapper();
responseObject = mapper.readValue(string, Object.class);
} catch (final IOException exception) {
log.error("Error reading the file.", exception);
+ return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build();
}
if (asyncResponseData == null) {
return ResponseEntity.ok(responseObject);
@@ -138,11 +146,6 @@ public class NetworkCmProxyStubController implements NetworkCmProxyApi {
}
@Override
- public ResponseEntity<List<String>> queryCmHandles(final CmHandleQueryRestParameters body) {
- return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
- }
-
- @Override
public ResponseEntity<RestOutputCmHandle> retrieveCmHandleDetailsById(final String cmHandleId) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}