smrunner: output listener should split multiline text in lines (for CIDR fake process handler)

This commit is contained in:
Roman Chernyatchik
2011-04-29 15:47:19 +04:00
parent 236098f4c1
commit eb57fe5fc8
@@ -87,6 +87,22 @@ public class OutputToGeneralTestEventsConverter implements ProcessOutputConsumer
}
public void process(final String text, final Key outputType) {
final int textLength = text.length();
// if text is multi line:
if (textLength > 1 && text.substring(0, text.length() - 1).contains("\n")) {
// some fake process handler may not auto-split text in lines
final String[] lines = StringUtil.splitByLines(text);
for (String line : lines) {
processLine(line, outputType);
}
}
else {
// one line
processLine(text, outputType);
}
}
private void processLine(String text, Key outputType) {
if (outputType != ProcessOutputTypes.STDERR && outputType != ProcessOutputTypes.SYSTEM) {
// we check for consistently only std output
// because all events must be send to stdout