use of org.mule.runtime.core.internal.exception.OnErrorPropagateHandler in project mule by mulesoft.
the class MessageProcessorsTestCase method setup.
@Before
public void setup() throws MuleException {
flow = mock(Flow.class, RETURNS_DEEP_STUBS);
OnErrorPropagateHandler exceptionHandler = new OnErrorPropagateHandler();
exceptionHandler.setMuleContext(muleContext);
exceptionHandler.setNotificationFirer(((MuleContextWithRegistries) muleContext).getRegistry().lookupObject(NotificationDispatcher.class));
exceptionHandler.initialise();
when(flow.getExceptionListener()).thenReturn(exceptionHandler);
eventContext = (BaseEventContext) create(flow, TEST_CONNECTOR_LOCATION);
input = builder(eventContext).message(of(TEST_MESSAGE)).build();
output = builder(eventContext).message(of(TEST_MESSAGE)).build();
response = builder(eventContext).message(of(TEST_MESSAGE)).build();
responsePublisher = eventContext.getResponsePublisher();
}
use of org.mule.runtime.core.internal.exception.OnErrorPropagateHandler in project mule by mulesoft.
the class MuleContextUtils method mockMuleContext.
public static MuleContextWithRegistries mockMuleContext() {
final MuleContextWithRegistries muleContext = mock(DefaultMuleContext.class, withSettings().defaultAnswer(RETURNS_DEEP_STUBS).extraInterfaces(PrivilegedMuleContext.class));
when(muleContext.getUniqueIdString()).thenReturn(UUID.getUUID());
when(muleContext.getDefaultErrorHandler(empty())).thenReturn(new OnErrorPropagateHandler());
StreamingManager streamingManager = mock(StreamingManager.class, RETURNS_DEEP_STUBS);
try {
MuleRegistry registry = mock(MuleRegistry.class);
when(muleContext.getRegistry()).thenReturn(registry);
ComponentInitialStateManager componentInitialStateManager = mock(ComponentInitialStateManager.class);
when(componentInitialStateManager.mustStartMessageSource(any())).thenReturn(true);
when(registry.lookupObject(ComponentInitialStateManager.SERVICE_ID)).thenReturn(componentInitialStateManager);
doReturn(streamingManager).when(registry).lookupObject(StreamingManager.class);
doReturn(mock(NotificationDispatcher.class)).when(registry).lookupObject(NotificationDispatcher.class);
doReturn(mock(ObjectStoreManager.class, RETURNS_DEEP_STUBS)).when(registry).lookupObject(OBJECT_STORE_MANAGER);
} catch (RegistrationException e) {
throw new RuntimeException(e);
}
return muleContext;
}
Aggregations