use of org.mule.runtime.api.connection.ConnectionValidationResult in project mule by mulesoft.
the class ForwardingSoapClientConnectionProviderTestCase method invalidProvider.
@Test
public void invalidProvider() throws Exception {
ConnectionValidationResult result = new ForwardingSoapClientConnectionProvider(new ValidableServiceProvider(false), dispatcherProvider, ctx).validate(null);
assertThat(result.isValid(), is(false));
assertThat(result.getException(), instanceOf(SoapServiceProviderConfigurationException.class));
assertThat(result.getMessage(), is(ERROR_MESSAGE));
}
use of org.mule.runtime.api.connection.ConnectionValidationResult in project mule by mulesoft.
the class ExtensionConnectivityTestingStrategyTestCase method testConnectivityWithConnectionProvider.
private ConnectionValidationResult testConnectivityWithConnectionProvider(boolean isValidConnection) throws MuleException {
when(connectionProviderResolver.resolve(any())).thenReturn(new Pair<>(connectionProvider, mock(ResolverSetResult.class)));
ConnectionValidationResult validationResult;
if (isValidConnection) {
validationResult = ConnectionValidationResult.success();
} else {
validationResult = ConnectionValidationResult.failure("", null);
}
when(connectionProvider.validate(any())).thenReturn(validationResult);
ConnectionValidationResult connectionResult = extensionConnectivityTestingStrategy.testConnectivity(connectionProviderResolver);
return connectionResult;
}
use of org.mule.runtime.api.connection.ConnectionValidationResult in project mule by mulesoft.
the class ExtensionConnectivityTestingStrategyTestCase method connectionProviderInConfigWithInvalidConnection.
@Test
public void connectionProviderInConfigWithInvalidConnection() throws MuleException {
ConnectionValidationResult connectionResult = testConnectivityWithConnectionProvider(false);
assertThat(connectionResult.isValid(), is(false));
}
use of org.mule.runtime.api.connection.ConnectionValidationResult in project mule by mulesoft.
the class TestConnectivityUtils method assertConnection.
private void assertConnection(String configName, boolean isSuccess, Matcher<Exception> exceptionMatcher, Matcher<ErrorType> codeMatcher) {
ConnectivityTestingService testingService = registry.<ConnectivityTestingService>lookupByName(CONNECTIVITY_TESTING_SERVICE_KEY).get();
ConnectionValidationResult validationResult = testingService.testConnection(builder().globalName(configName).build());
assertThat(validationResult.isValid(), is(isSuccess));
if (!isSuccess) {
assertThat(validationResult.getException(), exceptionMatcher);
assertThat(validationResult.getErrorType().orElse(null), codeMatcher);
}
}
Aggregations