You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Mohammad Sarhan (JIRA)" <ji...@apache.org> on 2014/10/10 21:36:34 UTC
[jira] [Created] (TAP5-2398) No way to access raw
ByteArrayOutputStream
Mohammad Sarhan created TAP5-2398:
-------------------------------------
Summary: No way to access raw ByteArrayOutputStream
Key: TAP5-2398
URL: https://issues.apache.org/jira/browse/TAP5-2398
Project: Tapestry 5
Issue Type: Bug
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)