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);
}
}
Aggregations