Package org.apache.ace.processlauncher.util

Examples of org.apache.ace.processlauncher.util.InputStreamRedirector.run()


    public void testInputStreamEOFCausesOutputStreamToBeClosedOk() throws IOException {
        InputStream myIS = new ByteArrayInputStream("hello world!".getBytes());
        OutputStream mockOS = mock(OutputStream.class);

        InputStreamRedirector redirector = new InputStreamRedirector(myIS, mockOS);
        redirector.run();

        verify(mockOS).close();
    }

    /**
 
View Full Code Here


        InputStream myIS = new ByteArrayInputStream(input.getBytes());
        ByteArrayOutputStream myOS = new ByteArrayOutputStream();

        InputStreamRedirector redirector = new InputStreamRedirector(myIS, myOS);
        redirector.run();

        assertEquals(input, myOS.toString());
    }

    /**
 
View Full Code Here

        InputStream myIS = createExceptionThrowingInputStream();
        ByteArrayOutputStream myOS = new ByteArrayOutputStream();

        InputStreamRedirector redirector = new InputStreamRedirector(myIS, myOS);

        redirector.run();

        verify(myIS, atLeast(1)).read(Mockito.<byte[]>any(), anyInt(), anyInt());

        // Verify that the exception is indeed logged...
        String stdout = myOS.toString();
View Full Code Here

        InputStream myIS = createExceptionThrowingInputStream();
        OutputStream myOS = mock(OutputStream.class);

        InputStreamRedirector redirector = new InputStreamRedirector(myIS, myOS);

        redirector.run();

        verify(myIS, atLeast(1)).read(Mockito.<byte[]>any(), anyInt(), anyInt());
        verify(myOS).close();
    }
View Full Code Here

    public void testWithoutOutputStreamOk() throws Exception {
        InputStream myIS = new ByteArrayInputStream("hello world!".getBytes());

        InputStreamRedirector redirector = new InputStreamRedirector(myIS);

        redirector.run();
    }

    /**
     * Creates an input stream that keeps pretending its returning data when its
     * {@link InputStream#read(byte[])} method is called.
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.