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
Can variables be used in send action.payload() and query action.statement()? #645
Comments
Hi! Thx for the report. 👍 So a workaround should be: query(action -> action.dataSource(dataSource)
.statement("SELECT ${stage8sql}")
.validate("INBUND_OTBUND_CD", "F"))
) with
I've changed the behavior in a dedicated bugfix branch real quick, but it would be necessary to add some additional test cases etc. Nevertheless, I am confident this change will make it into the next release so that you are able to put the complete select statement into a properties file. Concerning the file system resource: I hope that helps you out. BR, |
A little addition to the You could use the Citrus properties:
Java code http()
.client(todoClient)
.send()
.post("/todolist")
.payload(FileUtils.getFileResource("${payload}", testContext)); I'd also recommend to use classpath references instead of absolute file paths. BR, |
Thanks for the help |
I'm using JMS and MQ but I can adapt your http example above to replace my current .payload() statement. |
Hi! Please have a look at our JMS-Sample. BR, |
I assume the questions have been answered so there is just the bug left to be fixed. BR, |
Correct.
From: Sven Hettwer <notifications@github.com>
Sent: Friday, May 24, 2019 11:41 AM
To: citrusframework/citrus <citrus@noreply.github.com>
Cc: Shirey, John D [US] (TS) <John.Shirey@ngc.com>; Author <author@noreply.github.com>
Subject: EXT :Re: [citrusframework/citrus] Can variables be used in send action.payload() and query action.statement()? (#645)
I assume the questions have been answered so there is just the bug left to be fixed.
BR,
Sven
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#645?email_source=notifications&email_token=ALV4HVLVGS4JY3B7EDWMGKDPXAEA5A5CNFSM4HINX722YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWFYENQ#issuecomment-495682102>, or mute the thread<https://github.com/notifications/unsubscribe-auth/ALV4HVOW7TF6RQO6GXXMVALPXAEA5ANCNFSM4HINX72Q>.
|
I noticed that your Git Hub page was down and can’t be access from the Citrus Framework web site because I had an additional question.
When I use the Citrus XPath function I sometimes get the following exception: “XML document structures must start and end within the same entity”.
The problem appears to be the length of the XML string that I am passing to the function. If the string is less than 1000 characters it is processed correctly by the function. If it is over 1000 characters I get the exception from org.apache.xerxes.parsers.DOMParserImpl.parse. It appears that somewhere between the Echo action where the XPath function is invoked to the parser the XML string is being truncated.
Thanks,
John Shirey
From: Sven Hettwer <notifications@github.com>
Sent: Friday, May 24, 2019 11:41 AM
To: citrusframework/citrus <citrus@noreply.github.com>
Cc: Shirey, John D [US] (TS) <John.Shirey@ngc.com>; Author <author@noreply.github.com>
Subject: EXT :Re: [citrusframework/citrus] Can variables be used in send action.payload() and query action.statement()? (#645)
I assume the questions have been answered so there is just the bug left to be fixed.
BR,
Sven
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#645?email_source=notifications&email_token=ALV4HVLVGS4JY3B7EDWMGKDPXAEA5A5CNFSM4HINX722YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWFYENQ#issuecomment-495682102>, or mute the thread<https://github.com/notifications/unsubscribe-auth/ALV4HVOW7TF6RQO6GXXMVALPXAEA5ANCNFSM4HINX72Q>.
|
I just looked at the results again and it is not a string length issue. It seems that whenever the parser runs into a “,” in the XML string it throws that exception “XML document structures must start and end within the same entity”.
John Shirey
Northrop Grumman PSPD Project Team
Office: 571-468-6773
Cell: 301-922-2573
john.d.shirey@cbp.dhs.gov<mailto:john.d.shirey@cbp.dhs.gov>
From: Shirey, John D [US] (TS) <John.Shirey@ngc.com>
Sent: Wednesday, May 29, 2019 1:46 PM
To: 'citrusframework/citrus' <reply@reply.github.com>
Cc: SHIREY, JOHN D. <john.d.shirey@cbp.dhs.gov>
Subject: RE: EXT :Re: [citrusframework/citrus] Can variables be used in send action.payload() and query action.statement()? (#645)
I noticed that your Git Hub page was down and can’t be access from the Citrus Framework web site because I had an additional question.
When I use the Citrus XPath function I sometimes get the following exception: “XML document structures must start and end within the same entity”.
The problem appears to be the length of the XML string that I am passing to the function. If the string is less than 1000 characters it is processed correctly by the function. If it is over 1000 characters I get the exception from org.apache.xerxes.parsers.DOMParserImpl.parse. It appears that somewhere between the Echo action where the XPath function is invoked to the parser the XML string is being truncated.
Thanks,
John Shirey
From: Sven Hettwer <notifications@github.com>
Sent: Friday, May 24, 2019 11:41 AM
To: citrusframework/citrus <citrus@noreply.github.com>
Cc: Shirey, John D [US] (TS) <John.Shirey@ngc.com>; Author <author@noreply.github.com>
Subject: EXT :Re: [citrusframework/citrus] Can variables be used in send action.payload() and query action.statement()? (#645)
I assume the questions have been answered so there is just the bug left to be fixed.
BR,
Sven
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#645?email_source=notifications&email_token=ALV4HVLVGS4JY3B7EDWMGKDPXAEA5A5CNFSM4HINX722YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWFYENQ#issuecomment-495682102>, or mute the thread<https://github.com/notifications/unsubscribe-auth/ALV4HVOW7TF6RQO6GXXMVALPXAEA5ANCNFSM4HINX72Q>.
|
Hi! It might be the case that you just hit a short downtime of GitHub. This affects the citrus repository as well as the website, because the website ist hosted on GitHub as well. Concerning your question. As you already mentioned, this is not a Citrus issue but an issue of on of our dependencies, namely BR, |
Thanks. We resolved the issue by escaping all of the commas in the XML string.
From: Sven Hettwer <notifications@github.com>
Sent: Wednesday, June 5, 2019 8:44 AM
To: citrusframework/citrus <citrus@noreply.github.com>
Cc: Shirey, John D [US] (TS) <John.Shirey@ngc.com>; Author <author@noreply.github.com>
Subject: EXT :Re: [citrusframework/citrus] Can variables be used in send action.payload() and query action.statement()? (#645)
Hi!
It might be the case that you just hit a short downtime of GitHub. This affects the citrus repository as well as the website, because the website ist hosted on GitHub as well.
Concerning your question. As you already mentioned, this is not a Citrus issue but an issue of on of our dependencies, namely org.apache.xerxes.parsers.DOMParserImpl.parse. So please ask the xerxes parser team for help on this one.
BR,
Sven
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#645?email_source=notifications&email_token=ALV4HVKRJCMB27T2L4SW2M3PY6YINA5CNFSM4HINX722YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODW7SQMQ#issuecomment-499066930>, or mute the thread<https://github.com/notifications/unsubscribe-auth/ALV4HVJPW2KN7FBOJIZY5MLPY6YINANCNFSM4HINX72Q>.
|
Awesome! Thanks for sharing the solution. 👍 |
@bbortt need check this issue. I`m think it solved problem, true? |
@akuz0 sounds like it, thanks for the hint. |
Citrus Version
2.7.8
Question
Can variables be used in send action.payload() and query action.statement()?
What I've tried so far
In my Citrus Framework test cases it was recommended to me that I should try and read resource file path strings and SQL select statement strings as properties use them in variables instead of hard coding the stings in my test cases.
So I am trying to use a property file to populate Citrus global variables with resource file paths and SQL select statements. The properties (resource file path and SQL select statement strings) get loaded into the Text Context global variables just fine.
However when the file path string gets passed to FileUtils it is the variable name that gets passed instead of the string inside the variable.
Reading file resource: '${0150reqpath}' (encoding is 'windows-1252') => Failed to read payload resource
And when the SQL select string gets passed to validateSqlStatement again it is the variable name that gets passed instead of the string inside the variable.
Missing keyword SELECT in statement: ${stage8sql}
I've tried variable names with ${} around them and without
I've tried no quotes around the stings in the property file and "" around the strings in the property file.
Additional information
citrus-context.xml exerpt
rfsstest.properties
RFSStest0150prop.java
The text was updated successfully, but these errors were encountered: