use of io.vertx.sqlclient.spi.Driver in project hibernate-reactive by hibernate.
the class DefaultSqlClientPool method findDriver.
/**
* When there are multiple candidate drivers in the classpath,
* {@link Pool#pool} throws a {@link ServiceConfigurationError},
* so we need to disambiguate according to the scheme specified
* in the given {@link URI}.
*
* @param uri the JDBC URL or database URI
* @param originalError the error that was thrown
*
* @return the disambiguated {@link Driver}
*/
private Driver findDriver(URI uri, ServiceConfigurationError originalError) {
String scheme = scheme(uri);
for (Driver d : ServiceLoader.load(Driver.class)) {
String driverName = d.getClass().getCanonicalName();
LOG.detectedDriver(driverName);
if (matchesScheme(driverName, scheme)) {
return d;
}
}
throw new ConfigurationException("No suitable drivers found for URI scheme: " + scheme, originalError);
}
use of io.vertx.sqlclient.spi.Driver in project vertx-sql-client by eclipse-vertx.
the class DriverTestBase method testServiceLoader.
@Test
public void testServiceLoader(TestContext ctx) {
List<Driver> drivers = new ArrayList<>();
for (Driver d : ServiceLoader.load(Driver.class)) {
drivers.add(d);
}
assertEquals("Expected to find exactly 1 Driver but found: " + drivers, 1, drivers.size());
}
Aggregations