io.r2dbc.spi.ConnectionFactoryMetadata Java Examples

The following examples show how to use io.r2dbc.spi.ConnectionFactoryMetadata. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MSSQLR2DBCDatabaseContainerProvider.java    From testcontainers-java with MIT License 5 votes vote down vote up
@Nullable
@Override
public ConnectionFactoryMetadata getMetadata(ConnectionFactoryOptions options) {
    ConnectionFactoryOptions.Builder builder = options.mutate();
    if (!options.hasOption(ConnectionFactoryOptions.USER)) {
        builder.option(ConnectionFactoryOptions.USER, MSSQLServerContainer.DEFAULT_USER);
    }
    if (!options.hasOption(ConnectionFactoryOptions.PASSWORD)) {
        builder.option(ConnectionFactoryOptions.PASSWORD, MSSQLServerContainer.DEFAULT_PASSWORD);
    }
    return R2DBCDatabaseContainerProvider.super.getMetadata(builder.build());
}
 
Example #2
Source File: R2DBCDatabaseContainerProvider.java    From testcontainers-java with MIT License 5 votes vote down vote up
@Nullable
default ConnectionFactoryMetadata getMetadata(ConnectionFactoryOptions options) {
    ConnectionFactoryOptions.Builder builder = options.mutate();
    if (!options.hasOption(ConnectionFactoryOptions.HOST)) {
        builder.option(ConnectionFactoryOptions.HOST, "localhost");
    }
    if (!options.hasOption(ConnectionFactoryOptions.PORT)) {
        builder.option(ConnectionFactoryOptions.PORT, 65535);
    }

    ConnectionFactory connectionFactory = ConnectionFactories.find(builder.build());
    return connectionFactory != null ? connectionFactory.getMetadata() : null;
}
 
Example #3
Source File: PostgreSQLR2DBCDatabaseContainerProvider.java    From testcontainers-java with MIT License 5 votes vote down vote up
@Nullable
@Override
public ConnectionFactoryMetadata getMetadata(ConnectionFactoryOptions options) {
    ConnectionFactoryOptions.Builder builder = options.mutate();
    if (!options.hasOption(ConnectionFactoryOptions.USER)) {
        builder.option(ConnectionFactoryOptions.USER, PostgreSQLContainer.DEFAULT_USER);
    }
    if (!options.hasOption(ConnectionFactoryOptions.PASSWORD)) {
        builder.option(ConnectionFactoryOptions.PASSWORD, PostgreSQLContainer.DEFAULT_PASSWORD);
    }
    return R2DBCDatabaseContainerProvider.super.getMetadata(builder.build());
}
 
Example #4
Source File: MySQLR2DBCDatabaseContainerProvider.java    From testcontainers-java with MIT License 5 votes vote down vote up
@Nullable
@Override
public ConnectionFactoryMetadata getMetadata(ConnectionFactoryOptions options) {
    ConnectionFactoryOptions.Builder builder = options.mutate();
    if (!options.hasOption(ConnectionFactoryOptions.USER)) {
        builder.option(ConnectionFactoryOptions.USER, MySQLContainer.DEFAULT_USER);
    }
    if (!options.hasOption(ConnectionFactoryOptions.PASSWORD)) {
        builder.option(ConnectionFactoryOptions.PASSWORD, MySQLContainer.DEFAULT_PASSWORD);
    }
    return R2DBCDatabaseContainerProvider.super.getMetadata(builder.build());
}
 
Example #5
Source File: MariaDBR2DBCDatabaseContainerProvider.java    From testcontainers-java with MIT License 5 votes vote down vote up
@Nullable
@Override
public ConnectionFactoryMetadata getMetadata(ConnectionFactoryOptions options) {
    ConnectionFactoryOptions.Builder builder = options.mutate();
    if (!options.hasOption(ConnectionFactoryOptions.USER)) {
        builder.option(ConnectionFactoryOptions.USER, MariaDBContainer.DEFAULT_USER);
    }
    if (!options.hasOption(ConnectionFactoryOptions.PASSWORD)) {
        builder.option(ConnectionFactoryOptions.PASSWORD, MariaDBContainer.DEFAULT_PASSWORD);
    }
    return R2DBCDatabaseContainerProvider.super.getMetadata(builder.build());
}
 
Example #6
Source File: MySqlConnectionFactory.java    From r2dbc-mysql with Apache License 2.0 4 votes vote down vote up
@Override
public ConnectionFactoryMetadata getMetadata() {
    return MySqlConnectionFactoryMetadata.INSTANCE;
}
 
Example #7
Source File: SpannerConnectionFactory.java    From cloud-spanner-r2dbc with Apache License 2.0 4 votes vote down vote up
@Override
public ConnectionFactoryMetadata getMetadata() {
  return SpannerConnectionFactoryMetadata.INSTANCE;
}
 
Example #8
Source File: MySqlConnectionFactory.java    From r2dbc-mysql with Apache License 2.0 4 votes vote down vote up
@Override
public ConnectionFactoryMetadata getMetadata() {
    return MySqlConnectionFactoryMetadata.INSTANCE;
}
 
Example #9
Source File: TestcontainersR2DBCConnectionFactory.java    From testcontainers-java with MIT License 4 votes vote down vote up
@Override
public ConnectionFactoryMetadata getMetadata() {
    return containerProvider.getMetadata(options);
}
 
Example #10
Source File: AbstractR2DBCDatabaseContainerTest.java    From testcontainers-java with MIT License 4 votes vote down vote up
@Test
public final void testGetMetadata() {
    ConnectionFactory connectionFactory = ConnectionFactories.get(createR2DBCUrl());
    ConnectionFactoryMetadata metadata = connectionFactory.getMetadata();
    assertThat(metadata).isNotNull();
}