summaryrefslogtreecommitdiffstats
path: root/models-interactions/model-simulators/src/main
diff options
context:
space:
mode:
authora.sreekumar <ajith.sreekumar@bell.ca>2020-10-07 11:26:37 +0100
committera.sreekumar <ajith.sreekumar@bell.ca>2020-10-07 11:35:59 +0100
commitc3599bd58bc5e6738570f5737d6a3129573f0e8a (patch)
tree016a2921bb1568c91e0a0dcd5f6c10e9b8c289d0 /models-interactions/model-simulators/src/main
parentf617d00767a6f137c0941b9ee531e3d9b1ef0196 (diff)
Adding basic logging to CDS Simulator
1) Adding log statements to capture actions taken by CDS Simulator. 2) Fixing the way CDSRequest input is read from a String. StandardCoder decode method cannot directly decode from a String to protobuf type. Change-Id: I597c64ffb095f6a518b0b6c67c1617ca789ad7d6 Issue-ID: POLICY-2828 Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
Diffstat (limited to 'models-interactions/model-simulators/src/main')
-rw-r--r--models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/CdsSimulator.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/CdsSimulator.java b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/CdsSimulator.java
index 3418780bc..6c505b3d9 100644
--- a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/CdsSimulator.java
+++ b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/CdsSimulator.java
@@ -39,8 +39,13 @@ import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceIn
import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOutput;
import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOutput.Builder;
import org.onap.policy.common.utils.resources.ResourceUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class CdsSimulator {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(CdsSimulator.class);
+
@Getter
private final int port;
@@ -83,6 +88,7 @@ public class CdsSimulator {
@Override
public void onNext(final ExecutionServiceInput executionServiceInput) {
+ LOGGER.info("Received request input to CDS: {}", executionServiceInput);
try {
String responseString = getResponseString(executionServiceInput, countOfSuccesfulEvents);
Builder builder = ExecutionServiceOutput.newBuilder();
@@ -141,11 +147,14 @@ public class CdsSimulator {
} else {
resourceName = resourceName + ".json";
}
+ LOGGER.info("Fetching response from {}", resourceName);
String responseString = ResourceUtils.getResourceAsString(resourceLocation + resourceName);
if (responseString == null) {
+ LOGGER.info("Expected response file {} not found in {}", resourceName, resourceLocation);
responseString = ResourceUtils.getResourceAsString(resourceLocation
+ "DefaultResponseEvent.json");
}
+ LOGGER.debug("Returning response from CDS Simulator: {}", responseString);
return responseString;
}
}