use of org.eclipse.n4js.tester.internal.TesterActivator in project n4js by eclipse.
the class TesterFrontEnd method computeDerivedValues.
/**
* Similar to {@link RunnerFrontEnd#computeDerivedValues(RunConfiguration)}, but for testing.
*/
public void computeDerivedValues(TestConfiguration config) {
// A) compute derived values for the run(!) configuration (will delegate to runner)
runnerFrontEnd.computeDerivedValues(config, false);
// B) compute derived values for the test configuration
// B.1) compute the test tree (note: will create a new session ID every time this is called)
final TestTree testTree = testDiscoveryHelper.collectTests(config.getUserSelection());
config.setTestTree(testTree);
// B.2) pass test tree as execution data
try {
// Read out port of running IDE-server and pass it to end-point-computation in tree-transformer
TesterActivator testerActivator = TesterActivator.getInstance();
int port = testerActivator != null ? testerActivator.getServerPort() : PORT_PLACEHOLDER_MAGIC_NUMBER;
config.setResultReportingPort(port);
testTreeTransformer.setHttpServerPort(Integer.toString(port));
final String testTreeAsJSON = objectMapper.writeValueAsString(testTreeTransformer.apply(testTree));
config.setExecutionData(TestConfiguration.EXEC_DATA_KEY__TEST_TREE, testTreeAsJSON);
} catch (IOException e) {
e.printStackTrace();
}
// B.3) delegate further computation to the specific tester implementation
ITester tester = testerRegistry.getTester(config);
tester.prepareConfiguration(config);
}
Aggregations