use of org.mule.test.heisenberg.extension.exception.HeisenbergException in project mule by mulesoft.
the class ExceptionHandlerManagerTestCase method beforeTest.
@Before
public void beforeTest() {
when(extensionFactory.createHandler()).thenReturn(extensionEnricher);
mockExceptionEnricher(extensionModel, extensionFactory);
mockExceptionEnricher(sourceModel, sourceFactory);
when(sourceEnricher.enrichException(any(Exception.class))).thenReturn(new HeisenbergException(ERROR_MESSAGE));
when(sourceFactory.createHandler()).thenReturn(sourceEnricher);
when(extensionModel.getXmlDslModel()).thenReturn(XmlDslModel.builder().setPrefix("test-extension").build());
when(extensionModel.getName()).thenReturn("Test Extension");
when(sourceModel.getName()).thenReturn("Test Source");
manager = new ExceptionHandlerManager(extensionModel, sourceModel);
}
use of org.mule.test.heisenberg.extension.exception.HeisenbergException in project mule by mulesoft.
the class DefaultExecutionMediatorTestCase method before.
@Before
public void before() throws Exception {
when(configurationInstance.getStatistics()).thenReturn(configurationStats);
when(configurationInstance.getName()).thenReturn(DUMMY_NAME);
when(configurationInstance.getModel()).thenReturn(configurationModel);
when(extensionModel.getName()).thenReturn(DUMMY_NAME);
when(extensionModel.getModelProperty(ClassLoaderModelProperty.class)).thenReturn(empty());
mockExceptionEnricher(extensionModel, null);
mockExceptionEnricher(operationModel, null);
when(operationExecutor.execute(operationContext)).thenReturn(just(result));
when(operationExceptionExecutor.execute(operationContext)).thenReturn(error(exception));
when(operationContext.getConfiguration()).thenReturn(Optional.of(configurationInstance));
when(operationContext.getExtensionModel()).thenReturn(extensionModel);
when(operationContext.getTransactionConfig()).thenReturn(empty());
when(operationContext.getRetryPolicyTemplate()).thenReturn(empty());
when(operationContext.getCurrentScheduler()).thenReturn(IMMEDIATE_SCHEDULER);
when(extensionModel.getXmlDslModel()).thenReturn(XmlDslModel.builder().setPrefix("test-extension").build());
mediator = new DefaultExecutionMediator(extensionModel, operationModel, new DefaultConnectionManager(muleContext), muleContext.getErrorTypeRepository());
final ReconnectableConnectionProviderWrapper<Object> connectionProviderWrapper = new ReconnectableConnectionProviderWrapper<>(null, new ReconnectionConfig(true, new SimpleRetryPolicyTemplate(10, RETRY_COUNT)));
initialiseIfNeeded(connectionProviderWrapper, true, muleContext);
Optional<ConnectionProvider> connectionProvider = Optional.of(connectionProviderWrapper);
when(configurationInstance.getConnectionProvider()).thenReturn(connectionProvider);
when(exceptionEnricher.enrichException(exception)).thenReturn(new HeisenbergException(ERROR));
setInterceptors((Interceptable) configurationInstance, configurationInterceptor1, configurationInterceptor2);
setInterceptors((Interceptable) operationExecutor, operationInterceptor1, operationInterceptor2);
defineOrder(configurationInterceptor1, configurationInterceptor2, operationInterceptor1, operationInterceptor2);
}
Aggregations