Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

escapeXml() won't work with , in sub-XML #94

Closed
toschneck opened this issue Apr 22, 2016 · 1 comment
Closed

escapeXml() won't work with , in sub-XML #94

toschneck opened this issue Apr 22, 2016 · 1 comment

Comments

@toschneck
Copy link
Collaborator

If the function escapeXML will be used with a content which contains an comma, the Function will get internal 2 Arguments if i set an Breakpoint and throw the Error Invalid function parameter usage! Missing parameter!

Breackpoint EscapeXmlFunction.java

 if (CollectionUtils.isEmpty(parameterList) || parameterList.size() != 1) {
            throw new InvalidFunctionUsageException("Invalid function parameter usage! Missing parameter!");
        }

        return StringEscapeUtils.escapeXml(parameterList.get(0));

request.xml

 <VAL_IN>citrus:escapeXml('<VAL_IN >
                    <test>with , an error occurs</test>
                  ')
 </VAL_IN>

error

com.consol.citrus.exceptions.InvalidFunctionUsageException: Invalid function parameter usage! Missing parameter!
    at com.consol.citrus.functions.core.EscapeXmlFunction.execute(EscapeXmlFunction.java:39)
    at com.consol.citrus.functions.FunctionUtils.resolveFunction(FunctionUtils.java:143)
    at com.consol.citrus.functions.FunctionUtils.replaceFunctionsInString(FunctionUtils.java:96)
    at com.consol.citrus.context.TestContext.replaceDynamicContentInString(TestContext.java:255)
    at com.consol.citrus.context.TestContext.replaceDynamicContentInString(TestContext.java:241)
    at com.consol.citrus.validation.builder.StaticMessageContentBuilder.buildMessagePayload(StaticMessageContentBuilder.java:70)
    at com.consol.citrus.validation.builder.StaticMessageContentBuilder.buildMessageContent(StaticMessageContentBuilder.java:52)
    at com.consol.citrus.actions.ReceiveMessageAction.createControlMessage(ReceiveMessageAction.java:219)
    at com.consol.citrus.actions.ReceiveMessageAction.validateMessage(ReceiveMessageAction.java:194)
    at com.consol.citrus.actions.ReceiveMessageAction.doExecute(ReceiveMessageAction.java:133)
    at com.consol.citrus.actions.AbstractTestAction.execute(AbstractTestAction.java:42)
    at com.consol.citrus.container.Sequence.doExecute(Sequence.java:47)
    at com.consol.citrus.actions.AbstractTestAction.execute(AbstractTestAction.java:42)
    at com.consol.citrus.container.Parallel$ActionRunner.run(Parallel.java:107)
    at java.lang.Thread.run(Thread.java:745)
@codemental
Copy link

This issue still appears when there are more comma "," characters. Like in this example:

@matchesXml('citrus:escapeXml('
                <PARENT_ELEMENT>
                    <TEST_FIELD1>CRM</TEST_FIELD1>
                    <TEST_FIELD2>StatNo=9899, SeqNo=567</TEST_FIELD2>
                    <TEST_FIELD3>LinkStatNo=8988, LinkSeqNo=789</TEST_FIELD3>
                </PARENT_ELEMENT>
')')@

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants