@Test public void newConnectionWithUnknownConnector() throws SchemaCrawlerException { final DatabaseConnector databaseConnector = DatabaseConnector.UNKNOWN; final DatabaseConnectionSource expectedDatabaseConnectionSource = expectedDatabaseConnectionSource("jdbc:hsqldb:hsql: final DatabaseConnectionSource databaseConnectionSource = databaseConnector.newDatabaseConnectionSource( new DatabaseUrlConnectionOptions("jdbc:hsqldb:hsql: assertThat( databaseConnectionSource.getConnectionUrl(), is(expectedDatabaseConnectionSource.getConnectionUrl())); }
public DatabaseConnectionSource newDatabaseConnectionSource( final DatabaseConnectionOptions connectionOptions) throws SchemaCrawlerException { requireNonNull(connectionOptions, "No database connection options provided"); final DatabaseConnectionSource databaseConnectionSource; if (connectionOptions instanceof DatabaseUrlConnectionOptions) { final DatabaseUrlConnectionOptions databaseUrlConnectionOptions = (DatabaseUrlConnectionOptions) connectionOptions; databaseConnectionSource = new DatabaseConnectionSource(databaseUrlConnectionOptions.getConnectionUrl()); } else if (connectionOptions instanceof DatabaseServerHostConnectionOptions) { final DatabaseServerHostConnectionOptions serverHostConnectionOptions = (DatabaseServerHostConnectionOptions) connectionOptions; final String host = serverHostConnectionOptions.getHost(); final Integer port = serverHostConnectionOptions.getPort(); final String database = serverHostConnectionOptions.getDatabase(); final Map<String, String> urlx = serverHostConnectionOptions.getUrlx(); final DatabaseConnectionUrlBuilder databaseConnectionUrlBuilder = urlBuildProcess.get(); databaseConnectionUrlBuilder.withHost(host); databaseConnectionUrlBuilder.withPort(port); databaseConnectionUrlBuilder.withDatabase(database); databaseConnectionUrlBuilder.withUrlx(urlx); final String connectionUrl = databaseConnectionUrlBuilder.toURL(); final Map<String, String> connectionUrlx = databaseConnectionUrlBuilder.toURLx(); databaseConnectionSource = new DatabaseConnectionSource(connectionUrl, connectionUrlx); } else { throw new SchemaCrawlerException("Could not create new database connection source"); } return databaseConnectionSource; }
DatabaseConnector implements Options { public DatabaseConnectionSource newDatabaseConnectionSource( final DatabaseConnectionOptions connectionOptions) throws SchemaCrawlerException { requireNonNull(connectionOptions, "No database connection options provided"); final DatabaseConnectionSource databaseConnectionSource; if (connectionOptions instanceof DatabaseUrlConnectionOptions) { final DatabaseUrlConnectionOptions databaseUrlConnectionOptions = (DatabaseUrlConnectionOptions) connectionOptions; databaseConnectionSource = new DatabaseConnectionSource(databaseUrlConnectionOptions.getConnectionUrl()); } else if (connectionOptions instanceof DatabaseServerHostConnectionOptions) { final DatabaseServerHostConnectionOptions serverHostConnectionOptions = (DatabaseServerHostConnectionOptions) connectionOptions; final String host = serverHostConnectionOptions.getHost(); final Integer port = serverHostConnectionOptions.getPort(); final String database = serverHostConnectionOptions.getDatabase(); final Map<String, String> urlx = serverHostConnectionOptions.getUrlx(); final DatabaseConnectionUrlBuilder databaseConnectionUrlBuilder = urlBuildProcess.get(); databaseConnectionUrlBuilder.withHost(host); databaseConnectionUrlBuilder.withPort(port); databaseConnectionUrlBuilder.withDatabase(database); databaseConnectionUrlBuilder.withUrlx(urlx); final String connectionUrl = databaseConnectionUrlBuilder.toURL(); final Map<String, String> connectionUrlx = databaseConnectionUrlBuilder.toURLx(); databaseConnectionSource = new DatabaseConnectionSource(connectionUrl, connectionUrlx); } else { throw new SchemaCrawlerException("Could not create new database connection source"); } return databaseConnectionSource; } }
DatabaseConnector implements Options { public DatabaseConnectionSource newDatabaseConnectionSource( final DatabaseConnectionOptions connectionOptions) throws SchemaCrawlerException { requireNonNull(connectionOptions, "No database connection options provided"); final DatabaseConnectionSource databaseConnectionSource; if (connectionOptions instanceof DatabaseUrlConnectionOptions) { final DatabaseUrlConnectionOptions databaseUrlConnectionOptions = (DatabaseUrlConnectionOptions) connectionOptions; databaseConnectionSource = new DatabaseConnectionSource(databaseUrlConnectionOptions.getConnectionUrl()); } else if (connectionOptions instanceof DatabaseServerHostConnectionOptions) { final DatabaseServerHostConnectionOptions serverHostConnectionOptions = (DatabaseServerHostConnectionOptions) connectionOptions; final String host = serverHostConnectionOptions.getHost(); final Integer port = serverHostConnectionOptions.getPort(); final String database = serverHostConnectionOptions.getDatabase(); final Map<String, String> urlx = serverHostConnectionOptions.getUrlx(); final DatabaseConnectionUrlBuilder databaseConnectionUrlBuilder = urlBuildProcess.get(); databaseConnectionUrlBuilder.withHost(host); databaseConnectionUrlBuilder.withPort(port); databaseConnectionUrlBuilder.withDatabase(database); databaseConnectionUrlBuilder.withUrlx(urlx); final String connectionUrl = databaseConnectionUrlBuilder.toURL(); final Map<String, String> connectionUrlx = databaseConnectionUrlBuilder.toURLx(); databaseConnectionSource = new DatabaseConnectionSource(connectionUrl, connectionUrlx); } else { throw new SchemaCrawlerException("Could not create new database connection source"); } return databaseConnectionSource; } protected  DatabaseConnector(
      final DatabaseServerType dbServerType,
      final Predicate<String> supportsUrl,
      final BiConsumer<InformationSchemaViewsBuilder, Connection>
          informationSchemaViewsBuildProcess,
      final BiConsumer<SchemaRetrievalOptionsBuilder, Connection>
          schemaRetrievalOptionsBuildProcess,
      final Consumer<LimitOptionsBuilder> limitOptionsBuildProcess,
      final Supplier<DatabaseConnectionUrlBuilder> urlBuildProcess); }
DatabaseConnector implements Options { public DatabaseConnectionSource newDatabaseConnectionSource( final DatabaseConnectionOptions connectionOptions) throws SchemaCrawlerException { requireNonNull(connectionOptions, "No database connection options provided"); final DatabaseConnectionSource databaseConnectionSource; if (connectionOptions instanceof DatabaseUrlConnectionOptions) { final DatabaseUrlConnectionOptions databaseUrlConnectionOptions = (DatabaseUrlConnectionOptions) connectionOptions; databaseConnectionSource = new DatabaseConnectionSource(databaseUrlConnectionOptions.getConnectionUrl()); } else if (connectionOptions instanceof DatabaseServerHostConnectionOptions) { final DatabaseServerHostConnectionOptions serverHostConnectionOptions = (DatabaseServerHostConnectionOptions) connectionOptions; final String host = serverHostConnectionOptions.getHost(); final Integer port = serverHostConnectionOptions.getPort(); final String database = serverHostConnectionOptions.getDatabase(); final Map<String, String> urlx = serverHostConnectionOptions.getUrlx(); final DatabaseConnectionUrlBuilder databaseConnectionUrlBuilder = urlBuildProcess.get(); databaseConnectionUrlBuilder.withHost(host); databaseConnectionUrlBuilder.withPort(port); databaseConnectionUrlBuilder.withDatabase(database); databaseConnectionUrlBuilder.withUrlx(urlx); final String connectionUrl = databaseConnectionUrlBuilder.toURL(); final Map<String, String> connectionUrlx = databaseConnectionUrlBuilder.toURLx(); databaseConnectionSource = new DatabaseConnectionSource(connectionUrl, connectionUrlx); } else { throw new SchemaCrawlerException("Could not create new database connection source"); } return databaseConnectionSource; } protected  DatabaseConnector(
      final DatabaseServerType dbServerType,
      final Predicate<String> supportsUrl,
      final BiConsumer<InformationSchemaViewsBuilder, Connection>
          informationSchemaViewsBuildProcess,
      final BiConsumer<SchemaRetrievalOptionsBuilder, Connection>
          schemaRetrievalOptionsBuildProcess,
      final Consumer<LimitOptionsBuilder> limitOptionsBuildProcess,
      final Supplier<DatabaseConnectionUrlBuilder> urlBuildProcess); final DatabaseServerType getDatabaseServerType(); PluginCommand getHelpCommand(); final SchemaRetrievalOptionsBuilder getSchemaRetrievalOptionsBuilder(
      final Connection connection); DatabaseConnectionSource newDatabaseConnectionSource(
      final DatabaseConnectionOptions connectionOptions); final SchemaCrawlerOptions setSchemaCrawlerOptionsDefaults(
      final SchemaCrawlerOptions schemaCrawlerOptions); final boolean supportsUrl(final String url); @Override String toString(); }
DatabaseConnector implements Options { public DatabaseConnectionSource newDatabaseConnectionSource( final DatabaseConnectionOptions connectionOptions) throws SchemaCrawlerException { requireNonNull(connectionOptions, "No database connection options provided"); final DatabaseConnectionSource databaseConnectionSource; if (connectionOptions instanceof DatabaseUrlConnectionOptions) { final DatabaseUrlConnectionOptions databaseUrlConnectionOptions = (DatabaseUrlConnectionOptions) connectionOptions; databaseConnectionSource = new DatabaseConnectionSource(databaseUrlConnectionOptions.getConnectionUrl()); } else if (connectionOptions instanceof DatabaseServerHostConnectionOptions) { final DatabaseServerHostConnectionOptions serverHostConnectionOptions = (DatabaseServerHostConnectionOptions) connectionOptions; final String host = serverHostConnectionOptions.getHost(); final Integer port = serverHostConnectionOptions.getPort(); final String database = serverHostConnectionOptions.getDatabase(); final Map<String, String> urlx = serverHostConnectionOptions.getUrlx(); final DatabaseConnectionUrlBuilder databaseConnectionUrlBuilder = urlBuildProcess.get(); databaseConnectionUrlBuilder.withHost(host); databaseConnectionUrlBuilder.withPort(port); databaseConnectionUrlBuilder.withDatabase(database); databaseConnectionUrlBuilder.withUrlx(urlx); final String connectionUrl = databaseConnectionUrlBuilder.toURL(); final Map<String, String> connectionUrlx = databaseConnectionUrlBuilder.toURLx(); databaseConnectionSource = new DatabaseConnectionSource(connectionUrl, connectionUrlx); } else { throw new SchemaCrawlerException("Could not create new database connection source"); } return databaseConnectionSource; } protected  DatabaseConnector(
      final DatabaseServerType dbServerType,
      final Predicate<String> supportsUrl,
      final BiConsumer<InformationSchemaViewsBuilder, Connection>
          informationSchemaViewsBuildProcess,
      final BiConsumer<SchemaRetrievalOptionsBuilder, Connection>
          schemaRetrievalOptionsBuildProcess,
      final Consumer<LimitOptionsBuilder> limitOptionsBuildProcess,
      final Supplier<DatabaseConnectionUrlBuilder> urlBuildProcess); final DatabaseServerType getDatabaseServerType(); PluginCommand getHelpCommand(); final SchemaRetrievalOptionsBuilder getSchemaRetrievalOptionsBuilder(
      final Connection connection); DatabaseConnectionSource newDatabaseConnectionSource(
      final DatabaseConnectionOptions connectionOptions); final SchemaCrawlerOptions setSchemaCrawlerOptionsDefaults(
      final SchemaCrawlerOptions schemaCrawlerOptions); final boolean supportsUrl(final String url); @Override String toString(); static final DatabaseConnector UNKNOWN; }