Search in sources :

Example 1 with ExceptionContextProvider

use of org.mule.runtime.core.api.execution.ExceptionContextProvider in project mule by mulesoft.

the class DefaultMessageProcessorChainTestCase method before.

@Before
public void before() throws MuleException {
    nonBlockingProcessorsExecuted.set(0);
    muleContext = spy(super.muleContext);
    ErrorTypeLocator errorTypeLocator = mock(ErrorTypeLocator.class);
    ErrorType errorType = mock(ErrorType.class);
    ExceptionContextProvider exceptionContextProvider = mock(ExceptionContextProvider.class);
    MuleConfiguration muleConfiguration = mock(MuleConfiguration.class);
    when(muleConfiguration.isContainerMode()).thenReturn(false);
    when(muleConfiguration.getId()).thenReturn(randomNumeric(3));
    when(muleConfiguration.getShutdownTimeout()).thenReturn(1000L);
    when(muleContext.getConfiguration()).thenReturn(muleConfiguration);
    when(((PrivilegedMuleContext) muleContext).getErrorTypeLocator()).thenReturn(errorTypeLocator);
    when(muleContext.getExceptionContextProviders()).thenReturn(singletonList(exceptionContextProvider));
    when(errorTypeLocator.lookupErrorType((Exception) any())).thenReturn(errorType);
    flow = builder("flow", muleContext).processingStrategyFactory(processingStrategyFactory).build();
    flow.initialise();
    flow.start();
}
Also used : ExceptionContextProvider(org.mule.runtime.core.api.execution.ExceptionContextProvider) MuleConfiguration(org.mule.runtime.core.api.config.MuleConfiguration) ErrorType(org.mule.runtime.api.message.ErrorType) ErrorTypeLocator(org.mule.runtime.core.privileged.exception.ErrorTypeLocator) PrivilegedMuleContext(org.mule.runtime.core.privileged.PrivilegedMuleContext) Before(org.junit.Before)

Aggregations

Before (org.junit.Before)1 ErrorType (org.mule.runtime.api.message.ErrorType)1 MuleConfiguration (org.mule.runtime.core.api.config.MuleConfiguration)1 ExceptionContextProvider (org.mule.runtime.core.api.execution.ExceptionContextProvider)1 PrivilegedMuleContext (org.mule.runtime.core.privileged.PrivilegedMuleContext)1 ErrorTypeLocator (org.mule.runtime.core.privileged.exception.ErrorTypeLocator)1