citrus icon indicating copy to clipboard operation
citrus copied to clipboard

citrus-http:server plaintext validator succeeds in v2.7.2 but fails in v2.7.8

Open binhthai opened this issue 6 years ago • 4 comments

Citrus Version 2.7.8

Expected behavior I'm upgrading from 2.7.2 to 2.7.8. A test case containing the action below succeeds in 2.7.2 but fails in 2.7.8. I would expected that it also succeeds in 2.7.8. May I ask you for any hint for a fix?

Thanks & Regards,

Binh

Actual behavior Test case failed with following exception:

com.consol.citrus.exceptions.TestCaseFailedException: Text values not equal, expected 'email_addr=Max.Mustermann%40gmail.com&extref=vDqGHtBt&last_name=Mustermann&first_name=Max' but was '{email_addr=[[email protected]], extref=[vDqGHtBt], last_name=[Mustermann], first_name=[Max]}'

Test case sample Action from test case:

<receive endpoint="sampleHttpServer">
  <selector>
    <element name="citrus_http_request_uri" value="/exampleuri"/>
  </selector>
  <message type="plaintext">
    <data>
      <![CDATA[email_addr=Max.Mustermann%40gmail.com&extref=${referenceId}&last_name=Mustermann&first_name=Max
      ]]>
    </data>
  </message>
  <header>
    <element name="citrus_http_method" value="POST"/>
    <element name="Content-Type" value="application/x-www-form-urlencoded"/>
  </header>
</receive>

binhthai avatar Jan 11 '19 15:01 binhthai

Hi!

The issue occurs since v2.7.5. It seems, it is caused by #359 where we changed the type of the incoming messages from HttpEntity to HttpEntity<?>. In the latter, the body is not interpreted as string anymore but as a map. The conversion into a string representation is now missing and this is why the validation fails in your test case.

Unfortunately, I think there is no workaround available.

BR, Sven

svettwer avatar Jan 13 '19 21:01 svettwer

Hi Sven,

Thanks a lot for your prompt info. Is there any plan to re-enable the string representation in a future version? Otherwise the solution is to adapt the test cases, isn't it?

Best regards,

Binh

binhthai avatar Jan 14 '19 07:01 binhthai

Hi!

Is there any plan to re-enable the string representation in a future version?

Absolutely, yes. As you can see, I labeled this issue as bug with medium priority. I can't give you a date for the fix but it's definitely planned.

Otherwise the solution is to adapt the test cases, isn't it?

Yeah, you could just put the payload representation {email_addr=[[email protected]], extref=[vDqGHtBt], last_name=[Mustermann], first_name=[Max]} into your test case. That's not clean nor nice but it should help to get your test running again.

BR, Sven

svettwer avatar Jan 14 '19 08:01 svettwer

Hi Sven,

Many thanks for the statement. On my side I keep v2.7.2 for now.

Best regards,

Binh

binhthai avatar Jan 14 '19 08:01 binhthai