org.eclipse.xtext.junit4.IRegistryConfigurator Java Examples

The following examples show how to use org.eclipse.xtext.junit4.IRegistryConfigurator. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractScenarioRunner.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
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();
		}
	}
}
 
Example #2
Source File: AbstractParallelScenarioRunner.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@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);
			}
		}
	};
}