use of org.gradle.internal.io.LineBufferingOutputStream in project gradle by gradle.
the class LineBufferingOutputStreamTest method splitsLongLines.
@Test
public void splitsLongLines() throws IOException {
LineBufferingOutputStream outputStream = new LineBufferingOutputStream(action, 8, 13);
context.checking(new Expectations() {
{
one(action).text("1234567890123");
one(action).text("4567890123456");
one(action).text("789");
one(action).endOfStream(null);
}
});
outputStream.write("12345678901234567890123456789".getBytes());
outputStream.close();
}
use of org.gradle.internal.io.LineBufferingOutputStream in project gradle by gradle.
the class LineBufferingOutputStreamTest method logsPartialLineOnClose.
@Test
public void logsPartialLineOnClose() throws IOException {
LineBufferingOutputStream outputStream = new LineBufferingOutputStream(action, 8);
context.checking(new Expectations() {
{
one(action).text("line 1");
one(action).endOfStream(null);
}
});
outputStream.write("line 1".getBytes());
outputStream.close();
}
use of org.gradle.internal.io.LineBufferingOutputStream in project gradle by gradle.
the class LineBufferingOutputStreamTest method logsNothingOnCloseWhenNothingHasBeenWrittenToStream.
@Test
public void logsNothingOnCloseWhenNothingHasBeenWrittenToStream() throws IOException {
LineBufferingOutputStream outputStream = new LineBufferingOutputStream(action, 8);
context.checking(new Expectations() {
{
one(action).endOfStream(null);
}
});
outputStream.close();
}
use of org.gradle.internal.io.LineBufferingOutputStream in project gradle by gradle.
the class InProcessGradleExecuter method createLoggingManager.
private LoggingManagerInternal createLoggingManager(StartParameter startParameter, final StandardOutputListener outputListener) {
LoggingManagerInternal loggingManager = GLOBAL_SERVICES.getFactory(LoggingManagerInternal.class).create();
loggingManager.captureSystemSources();
ConsoleOutput consoleOutput = startParameter.getConsoleOutput();
if (consoleOutput == ConsoleOutput.Auto) {
// IDEA runs tests attached to a console, use plain so test can assume never attached to a console
// Should really run all tests against a plain and a rich console to make these assumptions explicit
consoleOutput = ConsoleOutput.Plain;
}
loggingManager.attachConsole(new TeeOutputStream(System.out, new LineBufferingOutputStream(new TextStream() {
@Override
public void text(String text) {
outputListener.onOutput(text);
}
@Override
public void endOfStream(@Nullable Throwable failure) {
}
})), consoleOutput);
return loggingManager;
}
Aggregations