Search in sources :

Example 1 with ConnectivityTestingService

use of org.mule.runtime.api.connectivity.ConnectivityTestingService 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);
    }
}
Also used : ConnectionValidationResult(org.mule.runtime.api.connection.ConnectionValidationResult) ConnectivityTestingService(org.mule.runtime.api.connectivity.ConnectivityTestingService)

Aggregations

ConnectionValidationResult (org.mule.runtime.api.connection.ConnectionValidationResult)1 ConnectivityTestingService (org.mule.runtime.api.connectivity.ConnectivityTestingService)1