You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by "Jochen Kemnade (JIRA)" <ji...@apache.org> on 2015/08/19 15:33:46 UTC

[jira] [Updated] (TAP5-2398) No way to access raw ByteArrayOutputStream in TestableResponse

     [ https://issues.apache.org/jira/browse/TAP5-2398?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jochen Kemnade updated TAP5-2398:
---------------------------------
    Issue Type: Improvement  (was: Bug)

> No way to access raw ByteArrayOutputStream in TestableResponse
> --------------------------------------------------------------
>
>                 Key: TAP5-2398
>                 URL: https://issues.apache.org/jira/browse/TAP5-2398
>             Project: Tapestry 5
>          Issue Type: Improvement
>          Components: tapestry-test
>    Affects Versions: 5.3.7
>            Reporter: Mohammad Sarhan
>            Priority: Minor
>
> Request: Give access to the underlying ByteArrayOutputStream object in TestableResponse. 
> I have a few pages that return raw protocolbuffer. I contribute a ComponentEventResultProcessor which simply takes the response.getOutput() and writes the data to it.
> So here is the real issue. When i run my test via PageTester, the only way to get the outputstream data is by calling  TestableResponse.getOutput() which returns a string. This string is malformed. What i really want is to be able to access the TestableResponse.output field and then call toByteArray() which i can then feed into my parse method of the protocol buffer object.
> Example:
> ## This doesn't work
> TestableResponse res = tester.renderResponse("api/quote");
> Message.Response messageResponse = Message.Response.parseFrom(res.getOutput().getBytes());
> ## This would work if i had access to the underlying ByteArrayOutputStream
> TestableResponse res = tester.renderResponse("api/quote");
> Message.Response messageResponse = Message.Response.parseFrom(res.getOutputStream().toByteArray());
> protocolbuffer is tricky. I didn't hit this problem until a value got encoded that didn't decode properly via the "toString()" with the first example.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)