use of org.mule.runtime.api.connection.ConnectionException in project mule by mulesoft.
the class DefaultExecutionMediatorTestCase method decoratedException.
@Test
public void decoratedException() throws Throwable {
stubException();
final Exception decoratedException = mock(Exception.class);
when(configurationInterceptor2.onError(same(operationContext), same(connectionException))).thenReturn(decoratedException);
assertException(e -> {
assertThat(e, is(sameInstance(decoratedException)));
assertAfter(null);
});
}
use of org.mule.runtime.api.connection.ConnectionException in project mule by mulesoft.
the class ExtensionMessageSourceTestCase method failWithConnectionExceptionWhenStartingAndGetsReconnected.
@Test
public void failWithConnectionExceptionWhenStartingAndGetsReconnected() throws Exception {
doThrow(new RuntimeException(new ConnectionException(ERROR_MESSAGE))).doThrow(new RuntimeException(new ConnectionException(ERROR_MESSAGE))).doNothing().when(source).onStart(sourceCallback);
messageSource.initialise();
messageSource.start();
verify(source, times(3)).onStart(sourceCallback);
verify(source, times(2)).onStop();
}
use of org.mule.runtime.api.connection.ConnectionException in project mule by mulesoft.
the class ExtensionMessageSourceTestCase method handleExceptionAndRestart.
@Test
public void handleExceptionAndRestart() throws Exception {
start();
messageSource.onException(new ConnectionException(ERROR_MESSAGE));
verify(source).onStop();
verify(ioScheduler, never()).stop();
verify(cpuLightScheduler, never()).stop();
verify(source, times(2)).onStart(sourceCallback);
}
use of org.mule.runtime.api.connection.ConnectionException in project mule by mulesoft.
the class LifecycleAwareConfigurationInstanceTestCase method testConnectivityFailsUponStart.
@Test
public void testConnectivityFailsUponStart() throws Exception {
if (connectionProvider.isPresent()) {
Exception connectionException = new ConnectionException("Oops!");
when(connectionManager.testConnectivity(interceptable)).thenReturn(failure(connectionException.getMessage(), connectionException));
interceptable.initialise();
try {
interceptable.start();
fail("Was expecting connectivity testing to fail");
} catch (Exception e) {
verify(connectionManager, times(RECONNECTION_MAX_ATTEMPTS + 1)).testConnectivity(interceptable);
assertThat(e.getCause(), is(instanceOf(RetryPolicyExhaustedException.class)));
}
}
}
use of org.mule.runtime.api.connection.ConnectionException in project mule by mulesoft.
the class ExceptionHandlerManagerTestCase method handleConnectionException.
@Test
public void handleConnectionException() {
ConnectionException rootCause = new ConnectionException(ERROR_MESSAGE, new Exception());
Throwable throwable = manager.handleThrowable(new Throwable(new RuntimeException(new ExecutionException(rootCause))));
assertThat(throwable, is(instanceOf(ConnectionException.class)));
assertThat(throwable.getMessage(), is(ERROR_MESSAGE));
assertThat(throwable, is(sameInstance(rootCause)));
}
Aggregations