diff options
author | a.sreekumar <ajith.sreekumar@bell.ca> | 2020-10-12 17:22:32 +0100 |
---|---|---|
committer | a.sreekumar <ajith.sreekumar@bell.ca> | 2020-10-13 16:08:19 +0100 |
commit | e8c84108137d06ae3b7e4e1c1989d9ee9e33c980 (patch) | |
tree | 7569c923a2bc198e07b3174bd6e58b356bcc4704 /models-interactions/model-simulators/src/test/java | |
parent | 4201789ab88e2f322ae7f701d1f43d5b5b3bafce (diff) |
Bug fixes and improvements in CDS Simulator
1) CDS Simulator was not able to run alone. It needed one of the
RestServer simulators to start up to continue running. Providing the cds
simulators parameters alone in the config file was resulting in
termination of the Main process. This is fixed.
2) Response from the CDS Simuator when blueprint and action names are
unknown (in real cases, when a corresponding CBA is not uploaded to CDS) is updated to mimic an actual CDS response instead of always
returning a dummy success response.
Change-Id: I79a6d158addaad31649809006d1e3c1dfdb47a1f
Issue-ID: POLICY-2828
Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
Diffstat (limited to 'models-interactions/model-simulators/src/test/java')
-rw-r--r-- | models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/CdsSimulatorTest.java | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/CdsSimulatorTest.java b/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/CdsSimulatorTest.java index cd4f3b593..07ec0dc04 100644 --- a/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/CdsSimulatorTest.java +++ b/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/CdsSimulatorTest.java @@ -128,13 +128,16 @@ public class CdsSimulatorTest { } @Test - public void testGetResponseString() throws IOException, CoderException, ParseException { + public void testGetResponse() throws IOException, CoderException, ParseException { CdsSimulator cdsSimulator = new CdsSimulator(Util.LOCALHOST, sim.getPort()); String reqstr = ResourceUtils.getResourceAsString( "org/onap/policy/simulators/cds/cds.request.json"); String responseqstr = ResourceUtils.getResourceAsString( "org/onap/policy/simulators/cds/pm_control-create-subscription.json"); ExecutionServiceInput request = coder.decode(reqstr, ExecutionServiceInput.class); - assertEquals(responseqstr, cdsSimulator.getResponseString(request, 0)); + org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOutput.Builder esoBuilder = + ExecutionServiceOutput.newBuilder(); + JsonFormat.parser().ignoringUnknownFields().merge(responseqstr, esoBuilder); + assertEquals(esoBuilder.toString(), cdsSimulator.getResponse(request, 0).toString()); } } |