- SvcLogicContext ctx = new SvcLogicContext();
- log.trace("Received unEscapeData call with params : " + inParams);
- inParams.put(ConfigGeneratorConstant.INPUT_PARAM_RESPONSE_PRIFIX, "tmp");
- inParams.put(ConfigGeneratorConstant.INPUT_PARAM_ESCAPE_DATA, "//");
- inParams.put(ConfigGeneratorConstant.INPUT_PARAM_DATA_TYPE, "XML");
- convertNode.unEscapeData(inParams, ctx);
- assertEquals(ConfigGeneratorConstant.OUTPUT_STATUS_SUCCESS,ctx.getAttribute("tmp." + ConfigGeneratorConstant.OUTPUT_PARAM_STATUS));
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_RESPONSE_PRIFIX, "");
+ inParams.put("contextKey", "tmp.uploadConfigInfo");
+ expectedEx.expect(SvcLogicException.class);
+ expectedEx.expectMessage("Mock Exception");
+ convertNode.convertContextToJson(inParams, ctx);
+ }
+
+ private void convertJson2Context(String jsonFile, Map<String, String> inParams,
+ SvcLogicContext ctx) throws IOException, SvcLogicException {
+ ConvertNode convertNode = new ConvertNode();
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_RESPONSE_PRIFIX, "test");
+ String jsonData = IOUtils
+ .toString(TestMergeNode.class.getClassLoader().getResourceAsStream(jsonFile),
+ StandardCharsets.UTF_8);
+ log.info("TestConvertNode.testConvertJson2DGContext()" + jsonData);
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_JSON_DATA, jsonData);
+ convertNode.convertJson2DGContext(inParams, ctx);
+ assertEquals(ConfigGeneratorConstant.OUTPUT_STATUS_SUCCESS, ctx.getAttribute("test." + ConfigGeneratorConstant.OUTPUT_PARAM_STATUS));