use of com.intellij.execution.executors.DefaultRunExecutor in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoEventsConverterTestCase method doTest.
protected void doTest() {
Executor executor = new DefaultRunExecutor();
GoTestRunConfiguration runConfig = new GoTestRunConfiguration(myFixture.getProject(), "", GoTestRunConfigurationType.getInstance());
runConfig.setTestFramework(getTestFramework());
GoTestConsoleProperties consoleProperties = new GoTestConsoleProperties(runConfig, executor);
GoTestEventsConverterBase converter = (GoTestEventsConverterBase) consoleProperties.createTestEventsConverter("gotest", consoleProperties);
LoggingServiceMessageVisitor serviceMessageVisitor = new LoggingServiceMessageVisitor();
try {
for (String line : FileUtil.loadLines(new File(getTestDataPath(), getTestName(true) + ".txt"), CharsetToolkit.UTF8)) {
converter.processServiceMessages(line + "\n", ProcessOutputTypes.STDOUT, serviceMessageVisitor);
}
} catch (IOException | ParseException e) {
throw new RuntimeException(e);
}
((OutputToGeneralTestEventsConverter) converter).flushBufferBeforeTerminating();
Disposer.dispose((OutputToGeneralTestEventsConverter) converter);
assertSameLinesWithFile(getTestDataPath() + "/" + getTestName(true) + "-expected.txt", serviceMessageVisitor.getLog());
}
use of com.intellij.execution.executors.DefaultRunExecutor in project intellij-community by JetBrains.
the class GeneralToSMTRunnerEventsConvertorTest method testPreserveFullOutputAfterImport.
public void testPreserveFullOutputAfterImport() throws Exception {
mySuite.addChild(mySimpleTest);
for (int i = 0; i < 550; i++) {
String message = "line" + i + "\n";
mySimpleTest.addLast(printer -> printer.print(message, ConsoleViewContentType.NORMAL_OUTPUT));
}
mySimpleTest.setFinished();
mySuite.setFinished();
SAXTransformerFactory transformerFactory = (SAXTransformerFactory) TransformerFactory.newInstance();
TransformerHandler handler = transformerFactory.newTransformerHandler();
handler.getTransformer().setOutputProperty(OutputKeys.INDENT, "yes");
handler.getTransformer().setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
File output = FileUtil.createTempFile("output", "");
try {
FileUtilRt.createParentDirs(output);
handler.setResult(new StreamResult(new FileWriter(output)));
MockRuntimeConfiguration configuration = new MockRuntimeConfiguration(getProject());
TestResultsXmlFormatter.execute(mySuite, configuration, new SMTRunnerConsoleProperties(configuration, "framework", new DefaultRunExecutor()), handler);
String savedText = FileUtil.loadFile(output);
assertTrue(savedText.split("\n").length > 550);
myEventsProcessor.onStartTesting();
ImportedToGeneralTestEventsConverter.parseTestResults(() -> new StringReader(savedText), myEventsProcessor);
myEventsProcessor.onFinishTesting();
List<? extends SMTestProxy> children = myResultsViewer.getTestsRootNode().getChildren();
assertSize(1, children);
SMTestProxy testProxy = children.get(0);
MockPrinter mockPrinter = new MockPrinter();
testProxy.printOn(mockPrinter);
assertSize(550, mockPrinter.getAllOut().split("\n"));
} finally {
FileUtil.delete(output);
}
}
Aggregations