use of org.eclipse.xtext.junit4.IRegistryConfigurator in project xtext-eclipse by eclipse.
the class AbstractParallelScenarioRunner method childrenInvoker.
@Override
protected Statement childrenInvoker(final RunNotifier notifier) {
return new Statement() {
@Override
public void evaluate() throws Throwable {
WrappingInjectorProvider wrapped = getOrCreateInjectorProvider();
wrapped.setupRegistry();
try {
prepareChildren(notifier);
} finally {
wrapped.restoreRegistry();
}
IInjectorProvider delegate = wrapped.getDelegate();
if (delegate instanceof IRegistryConfigurator) {
IRegistryConfigurator registryConfigurator = (IRegistryConfigurator) delegate;
registryConfigurator.setupRegistry();
try {
runChildren(notifier);
} finally {
registryConfigurator.restoreRegistry();
}
} else {
runChildren(notifier);
}
}
};
}
use of org.eclipse.xtext.junit4.IRegistryConfigurator in project xtext-eclipse by eclipse.
the class AbstractScenarioRunner method methodBlock.
@Override
protected Statement methodBlock(final FrameworkMethod method) {
IInjectorProvider injectorProvider = getOrCreateInjectorProvider();
final IRegistryConfigurator registryConfigurator = (IRegistryConfigurator) injectorProvider;
registryConfigurator.setupRegistry();
final Statement methodBlock = superMethodBlock(method);
return new Statement() {
@Override
public void evaluate() throws Throwable {
try {
try {
methodBlock.evaluate();
throw new AssumptionViolatedException("Method " + method.getName() + " did parse any input");
} finally {
registryConfigurator.restoreRegistry();
}
} catch (TestDataCarrier testData) {
process(testData.getData());
}
}
};
}
use of org.eclipse.xtext.junit4.IRegistryConfigurator in project xtext-eclipse by eclipse.
the class AbstractScenarioRunner method process.
protected void process(String data) throws Exception {
IInjectorProvider delegate = getOrCreateInjectorProvider().getDelegate();
if (delegate instanceof IRegistryConfigurator) {
IRegistryConfigurator registryConfigurator = (IRegistryConfigurator) delegate;
registryConfigurator.setupRegistry();
try {
ScenarioProcessor processor = delegate.getInjector().getInstance(processorClass);
String preProcessed = processor.preProcess(data);
if (preProcessed == null) {
throw new AssumptionViolatedException("Input is filtered by the pre processing step: " + data);
}
doProcess(preProcessed, processor);
} finally {
registryConfigurator.restoreRegistry();
}
}
}
Aggregations