Package com.mockrunner.mock.web

Examples of com.mockrunner.mock.web.MockServletOutputStream


        request.setScheme("http");
        request.setServerName("localhost");

        request.setContextPath("geoserver");

        MockServletOutputStream output = new MockServletOutputStream();
        response = new MockHttpServletResponse();

        handler = new DefaultServiceExceptionHandler();
       
        requestInfo = new Request();
View Full Code Here


     * @param response
     * @return
     */
    protected ByteArrayInputStream getBinaryInputStream(MockHttpServletResponse response) {
        try {
            MockServletOutputStream os = (MockServletOutputStream) response.getOutputStream();
            final Field field = os.getClass().getDeclaredField("buffer");
            field.setAccessible(true);
            ByteArrayOutputStream bos = (ByteArrayOutputStream) field.get(os);
            return new ByteArrayInputStream(bos.toByteArray());
        } catch (Exception e) {
            throw new RuntimeException("Whoops, did you change the MockRunner version? "
View Full Code Here

public class MonitorServletResponseTest extends TestCase {

    public void testOutputStream() throws IOException {
        byte[] data = data();
       
        MockServletOutputStream mock = new MockServletOutputStream();
        MonitorOutputStream out = new MonitorOutputStream(mock);
        out.write(data);
       
        assertEquals(data.length, mock.getBinaryContent().length);
        assertEquals(data.length, out.getBytesWritten());
    }
View Full Code Here

     * @param response
     * @return
     */
    protected ByteArrayInputStream getBinaryInputStream(MockHttpServletResponse response) {
        try {
            MockServletOutputStream os = (MockServletOutputStream) response.getOutputStream();
            final Field field = os.getClass().getDeclaredField("buffer");
            field.setAccessible(true);
            ByteArrayOutputStream bos = (ByteArrayOutputStream) field.get(os);
            return new ByteArrayInputStream(bos.toByteArray());
        } catch (Exception e) {
            throw new RuntimeException("Whoops, did you change the MockRunner version? "
View Full Code Here

     * @param response
     * @return
     */
    protected byte[] getBinary(MockHttpServletResponse response) {
        try {
            MockServletOutputStream os = (MockServletOutputStream) response.getOutputStream();
            final Field field = os.getClass().getDeclaredField("buffer");
            field.setAccessible(true);
            ByteArrayOutputStream bos = (ByteArrayOutputStream) field.get(os);
            return bos.toByteArray();
        } catch (Exception e) {
            throw new RuntimeException("Whoops, did you change the MockRunner version? "
View Full Code Here

     * @param response
     * @return
     */
    protected ByteArrayInputStream getBinaryInputStream(MockHttpServletResponse response) {
        try {
            MockServletOutputStream os = (MockServletOutputStream) response.getOutputStream();
            final Field field = os.getClass().getDeclaredField("buffer");
            field.setAccessible(true);
            ByteArrayOutputStream bos = (ByteArrayOutputStream) field.get(os);
            return new ByteArrayInputStream(bos.toByteArray());
        } catch (Exception e) {
            throw new RuntimeException("Whoops, did you change the MockRunner version? "
View Full Code Here

    @Test
    public void testOutputStream() throws IOException {
        byte[] data = data();
       
        MockServletOutputStream mock = new MockServletOutputStream();
        MonitorOutputStream out = new MonitorOutputStream(mock);
        out.write(data);
       
        assertEquals(data.length, mock.getBinaryContent().length);
        assertEquals(data.length, out.getBytesWritten());
    }
View Full Code Here

        request.setScheme("http");
        request.setServerName("localhost");

        request.setContextPath("geoserver");

        MockServletOutputStream output = new MockServletOutputStream();
        response = new MockHttpServletResponse();

        handler = new DefaultServiceExceptionHandler();
       
        requestInfo = new Request();
View Full Code Here

TOP

Related Classes of com.mockrunner.mock.web.MockServletOutputStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.