[
https://issues.apache.org/jira/browse/TAP5-2398?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jochen Kemnade updated TAP5-2398:
---------------------------------
Labels: bulk-close-candidate (was: )
This issue affects an old version of Tapestry that is not actively developed
anymore, and is therefore prone to be bulk-closed in the near future.
If the issue still persists with the most recent version of Tapestry (currently
5.4.0, available from Maven Central), please update it as soon as possible and
add '5.4.0') to the issue's affected versions.
> 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
> Labels: bulk-close-candidate
>
> 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)