@Test public void testNotFound() { String xPathQuery = "/element1"; String attributeName = "newAttr"; String value = "New Value"; Map<String, String> result = addAttribute.execute(xml, EMPTY_STRING, xPathQuery, attributeName, value, FALSE); assertEquals(ResponseNames.FAILURE, result.get(RESULT_TEXT)); assertEquals(FAILURE, result.get(RETURN_CODE)); assertEquals(GENERAL_ERROR + ELEMENT_NOT_FOUND, result.get(ERROR_MESSAGE)); }
@Action(name = "Add Attribute", outputs = { @Output(RETURN_CODE), @Output(RETURN_RESULT), @Output(RESULT_XML), @Output(Constants.Outputs.ERROR_MESSAGE)}, responses = { @Response(text = ResponseNames.SUCCESS, field = RETURN_CODE, value = SUCCESS, matchType = COMPARE_EQUAL), @Response(text = ResponseNames.FAILURE, field = RETURN_CODE, value = FAILURE, matchType = COMPARE_EQUAL, isDefault = true, isOnFail = true)}) public Map<String, String> execute( @Param(value = XML_DOCUMENT, required = true) String xmlDocument, @Param(value = XML_DOCUMENT_SOURCE) String xmlDocumentSource, @Param(value = XPATH_ELEMENT_QUERY, required = true) String xPathElementQuery, @Param(value = ATTRIBUTE_NAME, required = true) String attributeName, @Param(value = VALUE, required = true) String value, @Param(value = SECURE_PROCESSING) String secureProcessing) { final CommonInputs inputs = new CommonInputs.CommonInputsBuilder() .withXmlDocument(xmlDocument) .withXmlDocumentSource(xmlDocumentSource) .withXpathQuery(xPathElementQuery) .withSecureProcessing(secureProcessing) .build(); final CustomInputs customInputs = new CustomInputs.CustomInputsBuilder() .withAttributeName(attributeName) .withValue(value) .build(); return new AddAttributeService().execute(inputs, customInputs); }
AddAttribute { @Action(name = "Add Attribute", outputs = { @Output(RETURN_CODE), @Output(RETURN_RESULT), @Output(RESULT_XML), @Output(Constants.Outputs.ERROR_MESSAGE)}, responses = { @Response(text = ResponseNames.SUCCESS, field = RETURN_CODE, value = SUCCESS, matchType = COMPARE_EQUAL), @Response(text = ResponseNames.FAILURE, field = RETURN_CODE, value = FAILURE, matchType = COMPARE_EQUAL, isDefault = true, isOnFail = true)}) public Map<String, String> execute( @Param(value = XML_DOCUMENT, required = true) String xmlDocument, @Param(value = XML_DOCUMENT_SOURCE) String xmlDocumentSource, @Param(value = XPATH_ELEMENT_QUERY, required = true) String xPathElementQuery, @Param(value = ATTRIBUTE_NAME, required = true) String attributeName, @Param(value = VALUE, required = true) String value, @Param(value = SECURE_PROCESSING) String secureProcessing) { final CommonInputs inputs = new CommonInputs.CommonInputsBuilder() .withXmlDocument(xmlDocument) .withXmlDocumentSource(xmlDocumentSource) .withXpathQuery(xPathElementQuery) .withSecureProcessing(secureProcessing) .build(); final CustomInputs customInputs = new CustomInputs.CustomInputsBuilder() .withAttributeName(attributeName) .withValue(value) .build(); return new AddAttributeService().execute(inputs, customInputs); } }
AddAttribute { @Action(name = "Add Attribute", outputs = { @Output(RETURN_CODE), @Output(RETURN_RESULT), @Output(RESULT_XML), @Output(Constants.Outputs.ERROR_MESSAGE)}, responses = { @Response(text = ResponseNames.SUCCESS, field = RETURN_CODE, value = SUCCESS, matchType = COMPARE_EQUAL), @Response(text = ResponseNames.FAILURE, field = RETURN_CODE, value = FAILURE, matchType = COMPARE_EQUAL, isDefault = true, isOnFail = true)}) public Map<String, String> execute( @Param(value = XML_DOCUMENT, required = true) String xmlDocument, @Param(value = XML_DOCUMENT_SOURCE) String xmlDocumentSource, @Param(value = XPATH_ELEMENT_QUERY, required = true) String xPathElementQuery, @Param(value = ATTRIBUTE_NAME, required = true) String attributeName, @Param(value = VALUE, required = true) String value, @Param(value = SECURE_PROCESSING) String secureProcessing) { final CommonInputs inputs = new CommonInputs.CommonInputsBuilder() .withXmlDocument(xmlDocument) .withXmlDocumentSource(xmlDocumentSource) .withXpathQuery(xPathElementQuery) .withSecureProcessing(secureProcessing) .build(); final CustomInputs customInputs = new CustomInputs.CustomInputsBuilder() .withAttributeName(attributeName) .withValue(value) .build(); return new AddAttributeService().execute(inputs, customInputs); }  }
AddAttribute { @Action(name = "Add Attribute", outputs = { @Output(RETURN_CODE), @Output(RETURN_RESULT), @Output(RESULT_XML), @Output(Constants.Outputs.ERROR_MESSAGE)}, responses = { @Response(text = ResponseNames.SUCCESS, field = RETURN_CODE, value = SUCCESS, matchType = COMPARE_EQUAL), @Response(text = ResponseNames.FAILURE, field = RETURN_CODE, value = FAILURE, matchType = COMPARE_EQUAL, isDefault = true, isOnFail = true)}) public Map<String, String> execute( @Param(value = XML_DOCUMENT, required = true) String xmlDocument, @Param(value = XML_DOCUMENT_SOURCE) String xmlDocumentSource, @Param(value = XPATH_ELEMENT_QUERY, required = true) String xPathElementQuery, @Param(value = ATTRIBUTE_NAME, required = true) String attributeName, @Param(value = VALUE, required = true) String value, @Param(value = SECURE_PROCESSING) String secureProcessing) { final CommonInputs inputs = new CommonInputs.CommonInputsBuilder() .withXmlDocument(xmlDocument) .withXmlDocumentSource(xmlDocumentSource) .withXpathQuery(xPathElementQuery) .withSecureProcessing(secureProcessing) .build(); final CustomInputs customInputs = new CustomInputs.CustomInputsBuilder() .withAttributeName(attributeName) .withValue(value) .build(); return new AddAttributeService().execute(inputs, customInputs); }  @Action(name = "Add Attribute", outputs = { @Output(RETURN_CODE), @Output(RETURN_RESULT), @Output(RESULT_XML), @Output(Constants.Outputs.ERROR_MESSAGE)}, responses = { @Response(text = ResponseNames.SUCCESS, field = RETURN_CODE, value = SUCCESS, matchType = COMPARE_EQUAL), @Response(text = ResponseNames.FAILURE, field = RETURN_CODE, value = FAILURE, matchType = COMPARE_EQUAL, isDefault = true, isOnFail = true)}) Map<String, String> execute(
            @Param(value = XML_DOCUMENT, required = true) String xmlDocument,
            @Param(value = XML_DOCUMENT_SOURCE) String xmlDocumentSource,
            @Param(value = XPATH_ELEMENT_QUERY, required = true) String xPathElementQuery,
            @Param(value = ATTRIBUTE_NAME, required = true) String attributeName,
            @Param(value = VALUE, required = true) String value,
            @Param(value = SECURE_PROCESSING) String secureProcessing); }
AddAttribute { @Action(name = "Add Attribute", outputs = { @Output(RETURN_CODE), @Output(RETURN_RESULT), @Output(RESULT_XML), @Output(Constants.Outputs.ERROR_MESSAGE)}, responses = { @Response(text = ResponseNames.SUCCESS, field = RETURN_CODE, value = SUCCESS, matchType = COMPARE_EQUAL), @Response(text = ResponseNames.FAILURE, field = RETURN_CODE, value = FAILURE, matchType = COMPARE_EQUAL, isDefault = true, isOnFail = true)}) public Map<String, String> execute( @Param(value = XML_DOCUMENT, required = true) String xmlDocument, @Param(value = XML_DOCUMENT_SOURCE) String xmlDocumentSource, @Param(value = XPATH_ELEMENT_QUERY, required = true) String xPathElementQuery, @Param(value = ATTRIBUTE_NAME, required = true) String attributeName, @Param(value = VALUE, required = true) String value, @Param(value = SECURE_PROCESSING) String secureProcessing) { final CommonInputs inputs = new CommonInputs.CommonInputsBuilder() .withXmlDocument(xmlDocument) .withXmlDocumentSource(xmlDocumentSource) .withXpathQuery(xPathElementQuery) .withSecureProcessing(secureProcessing) .build(); final CustomInputs customInputs = new CustomInputs.CustomInputsBuilder() .withAttributeName(attributeName) .withValue(value) .build(); return new AddAttributeService().execute(inputs, customInputs); }  @Action(name = "Add Attribute", outputs = { @Output(RETURN_CODE), @Output(RETURN_RESULT), @Output(RESULT_XML), @Output(Constants.Outputs.ERROR_MESSAGE)}, responses = { @Response(text = ResponseNames.SUCCESS, field = RETURN_CODE, value = SUCCESS, matchType = COMPARE_EQUAL), @Response(text = ResponseNames.FAILURE, field = RETURN_CODE, value = FAILURE, matchType = COMPARE_EQUAL, isDefault = true, isOnFail = true)}) Map<String, String> execute(
            @Param(value = XML_DOCUMENT, required = true) String xmlDocument,
            @Param(value = XML_DOCUMENT_SOURCE) String xmlDocumentSource,
            @Param(value = XPATH_ELEMENT_QUERY, required = true) String xPathElementQuery,
            @Param(value = ATTRIBUTE_NAME, required = true) String attributeName,
            @Param(value = VALUE, required = true) String value,
            @Param(value = SECURE_PROCESSING) String secureProcessing);  }