@Test public void executeInvalidJsonObject() { final Map<String, String> resultMap = jsonPathQuery.execute(null, "$.a"); assertEquals(resultMap.get(OutputNames.RETURN_CODE), ReturnCodes.FAILURE); assertEquals(resultMap.get(OutputNames.RETURN_RESULT), INVALID_JSONOBJECT); assertNotNull(resultMap.get(OutputNames.EXCEPTION)); }
@Action(name = "JSON Path Query", outputs = { @Output(OutputNames.RETURN_RESULT), @Output(OutputNames.RETURN_CODE), @Output(OutputNames.EXCEPTION) }, responses = { @Response(text = ResponseNames.SUCCESS, field = OutputNames.RETURN_CODE, value = ReturnCodes.SUCCESS, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED), @Response(text = ResponseNames.FAILURE, field = OutputNames.RETURN_CODE, value = ReturnCodes.FAILURE, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR, isOnFail = true) }) public Map<String, String> execute( @Param(value = Constants.InputNames.JSON_OBJECT, required = true) String jsonObject, @Param(value = Constants.InputNames.JSON_PATH, required = true) String jsonPath) { try { final JsonNode jsonNode = JsonService.evaluateJsonPathQuery(jsonObject, jsonPath); if (!jsonNode.isNull()) { return OutputUtilities.getSuccessResultsMap(jsonNode.toString()); } return OutputUtilities.getSuccessResultsMap(NULL_STRING); } catch (Exception exception) { return OutputUtilities.getFailureResultsMap(exception); } }
JsonPathQuery { @Action(name = "JSON Path Query", outputs = { @Output(OutputNames.RETURN_RESULT), @Output(OutputNames.RETURN_CODE), @Output(OutputNames.EXCEPTION) }, responses = { @Response(text = ResponseNames.SUCCESS, field = OutputNames.RETURN_CODE, value = ReturnCodes.SUCCESS, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED), @Response(text = ResponseNames.FAILURE, field = OutputNames.RETURN_CODE, value = ReturnCodes.FAILURE, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR, isOnFail = true) }) public Map<String, String> execute( @Param(value = Constants.InputNames.JSON_OBJECT, required = true) String jsonObject, @Param(value = Constants.InputNames.JSON_PATH, required = true) String jsonPath) { try { final JsonNode jsonNode = JsonService.evaluateJsonPathQuery(jsonObject, jsonPath); if (!jsonNode.isNull()) { return OutputUtilities.getSuccessResultsMap(jsonNode.toString()); } return OutputUtilities.getSuccessResultsMap(NULL_STRING); } catch (Exception exception) { return OutputUtilities.getFailureResultsMap(exception); } } }
JsonPathQuery { @Action(name = "JSON Path Query", outputs = { @Output(OutputNames.RETURN_RESULT), @Output(OutputNames.RETURN_CODE), @Output(OutputNames.EXCEPTION) }, responses = { @Response(text = ResponseNames.SUCCESS, field = OutputNames.RETURN_CODE, value = ReturnCodes.SUCCESS, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED), @Response(text = ResponseNames.FAILURE, field = OutputNames.RETURN_CODE, value = ReturnCodes.FAILURE, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR, isOnFail = true) }) public Map<String, String> execute( @Param(value = Constants.InputNames.JSON_OBJECT, required = true) String jsonObject, @Param(value = Constants.InputNames.JSON_PATH, required = true) String jsonPath) { try { final JsonNode jsonNode = JsonService.evaluateJsonPathQuery(jsonObject, jsonPath); if (!jsonNode.isNull()) { return OutputUtilities.getSuccessResultsMap(jsonNode.toString()); } return OutputUtilities.getSuccessResultsMap(NULL_STRING); } catch (Exception exception) { return OutputUtilities.getFailureResultsMap(exception); } }  }
JsonPathQuery { @Action(name = "JSON Path Query", outputs = { @Output(OutputNames.RETURN_RESULT), @Output(OutputNames.RETURN_CODE), @Output(OutputNames.EXCEPTION) }, responses = { @Response(text = ResponseNames.SUCCESS, field = OutputNames.RETURN_CODE, value = ReturnCodes.SUCCESS, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED), @Response(text = ResponseNames.FAILURE, field = OutputNames.RETURN_CODE, value = ReturnCodes.FAILURE, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR, isOnFail = true) }) public Map<String, String> execute( @Param(value = Constants.InputNames.JSON_OBJECT, required = true) String jsonObject, @Param(value = Constants.InputNames.JSON_PATH, required = true) String jsonPath) { try { final JsonNode jsonNode = JsonService.evaluateJsonPathQuery(jsonObject, jsonPath); if (!jsonNode.isNull()) { return OutputUtilities.getSuccessResultsMap(jsonNode.toString()); } return OutputUtilities.getSuccessResultsMap(NULL_STRING); } catch (Exception exception) { return OutputUtilities.getFailureResultsMap(exception); } }  @Action(name = "JSON Path Query", outputs = { @Output(OutputNames.RETURN_RESULT), @Output(OutputNames.RETURN_CODE), @Output(OutputNames.EXCEPTION) }, responses = { @Response(text = ResponseNames.SUCCESS, field = OutputNames.RETURN_CODE, value = ReturnCodes.SUCCESS, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED), @Response(text = ResponseNames.FAILURE, field = OutputNames.RETURN_CODE, value = ReturnCodes.FAILURE, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR, isOnFail = true) }) Map<String, String> execute(
            @Param(value = Constants.InputNames.JSON_OBJECT, required = true) String jsonObject,
            @Param(value = Constants.InputNames.JSON_PATH, required = true) String jsonPath); }
JsonPathQuery { @Action(name = "JSON Path Query", outputs = { @Output(OutputNames.RETURN_RESULT), @Output(OutputNames.RETURN_CODE), @Output(OutputNames.EXCEPTION) }, responses = { @Response(text = ResponseNames.SUCCESS, field = OutputNames.RETURN_CODE, value = ReturnCodes.SUCCESS, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED), @Response(text = ResponseNames.FAILURE, field = OutputNames.RETURN_CODE, value = ReturnCodes.FAILURE, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR, isOnFail = true) }) public Map<String, String> execute( @Param(value = Constants.InputNames.JSON_OBJECT, required = true) String jsonObject, @Param(value = Constants.InputNames.JSON_PATH, required = true) String jsonPath) { try { final JsonNode jsonNode = JsonService.evaluateJsonPathQuery(jsonObject, jsonPath); if (!jsonNode.isNull()) { return OutputUtilities.getSuccessResultsMap(jsonNode.toString()); } return OutputUtilities.getSuccessResultsMap(NULL_STRING); } catch (Exception exception) { return OutputUtilities.getFailureResultsMap(exception); } }  @Action(name = "JSON Path Query", outputs = { @Output(OutputNames.RETURN_RESULT), @Output(OutputNames.RETURN_CODE), @Output(OutputNames.EXCEPTION) }, responses = { @Response(text = ResponseNames.SUCCESS, field = OutputNames.RETURN_CODE, value = ReturnCodes.SUCCESS, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED), @Response(text = ResponseNames.FAILURE, field = OutputNames.RETURN_CODE, value = ReturnCodes.FAILURE, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR, isOnFail = true) }) Map<String, String> execute(
            @Param(value = Constants.InputNames.JSON_OBJECT, required = true) String jsonObject,
            @Param(value = Constants.InputNames.JSON_PATH, required = true) String jsonPath);  }