org.eclipse.xtext.junit4.IInjectorProvider Java Examples
The following examples show how to use
org.eclipse.xtext.junit4.IInjectorProvider.
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 |
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: InjectorProviders.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
public static IInjectorProvider getOrCreateInjectorProvider(TestClass testClass) { InjectWith injectWith = testClass.getJavaClass().getAnnotation(InjectWith.class); if (injectWith != null) { Class<? extends IInjectorProvider> klass = injectWith.value(); IInjectorProvider injectorProvider = injectorProviderClassCache.get(klass); if (injectorProvider == null) { try { injectorProvider = klass.getDeclaredConstructor().newInstance(); injectorProviderClassCache.put(klass, injectorProvider); } catch (Exception e) { throwUncheckedException(e); } } return injectorProvider; } return null; }
Example #3
Source File: AbstractParallelScenarioRunner.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@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); } } }; }
Example #4
Source File: AbstractParallelScenarioRunner.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Override protected void process(String data) throws Exception { IInjectorProvider delegate = getOrCreateInjectorProvider().getDelegate(); ScenarioProcessor processor = delegate.getInjector().getInstance(getProcessorClass()); String preProcessed = processor.preProcess(data); if (preProcessed == null) { throw new AssumptionViolatedException("Input is filtered by the pre processing step: " + data); } doProcess(preProcessed, processor); }
Example #5
Source File: WrappingInjectorProvider.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
public WrappingInjectorProvider(IInjectorProvider delegate) { this.delegate = delegate; stateBeforeInjectorCreation = GlobalRegistries.makeCopyOfGlobalState(); this.injector = createInjector(); registerFactory(injector); stateAfterInjectorCreation = GlobalRegistries.makeCopyOfGlobalState(); stateBeforeInjectorCreation.restoreGlobalState(); }
Example #6
Source File: InjectorCache.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
public static WrappingInjectorProvider wrap(IInjectorProvider delegate) { WrappingInjectorProvider result = cachedInjectors.get(delegate); if (result == null) { result = new WrappingInjectorProvider(delegate); cachedInjectors.put(delegate, result); } return result; }
Example #7
Source File: InjectorProviders.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
public static IInjectorProvider getInjectorProvider(TestClass testClass) { InjectWith injectWith = testClass.getJavaClass().getAnnotation(InjectWith.class); if (injectWith != null) { return injectorProviderClassCache.get(injectWith.value()); } return null; }
Example #8
Source File: InjectorProviders.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
public static IInjectorProvider createInjectorProvider(TestClass testClass) { InjectWith injectWith = testClass.getJavaClass().getAnnotation(InjectWith.class); if (injectWith != null) { try { return injectWith.value().getDeclaredConstructor().newInstance(); } catch (Exception e) { throwUncheckedException(e); } } return null; }
Example #9
Source File: WrappingInjectorProvider.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
public IInjectorProvider getDelegate() { return delegate; }