use of java.io.PipedOutputStream in project sonarlint-core by SonarSource.
the class SettingsDownloaderTest method testFetchProjectSettings.
@Test
public void testFetchProjectSettings() throws Exception {
SonarLintWsClient wsClient = WsClientTestUtils.createMock();
Settings.FieldValues.Value.Builder valuesBuilder = Value.newBuilder();
valuesBuilder.getMutableValue().put("filepattern", "**/*.xml");
valuesBuilder.getMutableValue().put("rulepattern", "*:S12345");
Value value1 = valuesBuilder.build();
valuesBuilder.clear();
valuesBuilder.getMutableValue().put("filepattern", "**/*.java");
valuesBuilder.getMutableValue().put("rulepattern", "*:S456");
Value value2 = valuesBuilder.build();
ValuesWsResponse response = ValuesWsResponse.newBuilder().addSettings(Setting.newBuilder().setKey("sonar.inclusions").setValues(Values.newBuilder().addValues("**/*.java"))).addSettings(Setting.newBuilder().setKey("sonar.java.fileSuffixes").setValue("*.java")).addSettings(Setting.newBuilder().setKey("sonar.issue.exclusions.multicriteria").setFieldValues(FieldValues.newBuilder().addFieldValues(value1).addFieldValues(value2)).build()).build();
PipedInputStream in = new PipedInputStream();
final PipedOutputStream out = new PipedOutputStream(in);
response.writeTo(out);
out.close();
WsClientTestUtils.addResponse(wsClient, "/api/settings/values.protobuf?component=foo", in);
Builder builder = ModuleConfiguration.newBuilder();
new SettingsDownloader(wsClient).fetchProjectSettings("6.3", "foo", null, builder);
assertThat(builder.getPropertiesMap()).containsOnly(entry("sonar.inclusions", "**/*.java"), entry("sonar.java.fileSuffixes", "*.java"), entry("sonar.issue.exclusions.multicriteria", "1,2"), entry("sonar.issue.exclusions.multicriteria.1.filepattern", "**/*.xml"), entry("sonar.issue.exclusions.multicriteria.1.rulepattern", "*:S12345"), entry("sonar.issue.exclusions.multicriteria.2.filepattern", "**/*.java"), entry("sonar.issue.exclusions.multicriteria.2.rulepattern", "*:S456"));
}
use of java.io.PipedOutputStream in project sonarlint-core by SonarSource.
the class CommandExecutor method createStreamHandler.
private ExecuteStreamHandler createStreamHandler() throws IOException {
out = new ByteArrayOutputStream();
err = new ByteArrayOutputStream();
PipedOutputStream outPiped = new PipedOutputStream();
InputStream inPiped = new PipedInputStream(outPiped);
in = outPiped;
TeeOutputStream teeOut = new TeeOutputStream(out, System.out);
TeeOutputStream teeErr = new TeeOutputStream(err, System.err);
return new PumpStreamHandler(teeOut, teeErr, inPiped);
}
use of java.io.PipedOutputStream in project hale by halestudio.
the class ConsoleController method makeConsoleOutput.
/**
* Creates an InputStream that can be used by the console service to write
* command results. The output stream will be connected via a pipe with
* {@link #_input}, so results can be read from that input stream.
*
* @return the output stream
*/
private OutputStream makeConsoleOutput() {
PipedInputStream input = new PipedInputStream(1024 * 1024);
_input = input;
try {
return new PipedOutputStream(input);
} catch (IOException e) {
throw new IllegalStateException("Could not create console pipe");
}
}
use of java.io.PipedOutputStream in project hale by halestudio.
the class ConsoleController method makeConsoleInput.
/**
* Creates an InputStream that can be used in the console service to read
* the commands. The input stream will be connected via a pipe with
* {@link #_output}, so commands can be written to the output stream and
* will be read by the console service.
*
* @return the input stream
*/
private InputStream makeConsoleInput() {
PipedInputStream result = new PipedInputStream(1024 * 1024);
try {
OutputStream output = new PipedOutputStream(result);
_output = new PrintWriter(new OutputStreamWriter(output));
} catch (IOException e) {
throw new IllegalStateException("Could not create console pipe");
}
return result;
}
use of java.io.PipedOutputStream in project pentaho-kettle by pentaho.
the class Log4jPipedAppenderTest method close.
@Test
public void close() throws IOException {
PipedOutputStream pipedOutputStream = mock(PipedOutputStream.class);
log4jPipedAppender.setPipedOutputStream(pipedOutputStream);
log4jPipedAppender.close();
verify(pipedOutputStream).close();
}
Aggregations