use of org.dbflute.logic.jdbc.urlanalyzer.DfUrlAnalyzer in project dbflute-core by dbflute.
the class DfUrlAnalyzerSQLiteTest method test_extractCatalog_option.
public void test_extractCatalog_option() throws Exception {
// ## Arrange ##
DfUrlAnalyzer analyzer = createTarget("jdbc:sqlite:../src/main/resources/ponpon/exampledb.db;charSet=UTF-8");
// ## Act ##
String catalog = analyzer.extractCatalog();
// ## Assert ##
assertEquals("exampledb", catalog);
}
use of org.dbflute.logic.jdbc.urlanalyzer.DfUrlAnalyzer in project dbflute-core by dbflute.
the class DfUrlAnalyzerSQLiteTest method test_extractCatalog_basic.
public void test_extractCatalog_basic() throws Exception {
// ## Arrange ##
DfUrlAnalyzer analyzer = createTarget("jdbc:sqlite:../src/main/resources/ponpon/exampledb.db");
// ## Act ##
String catalog = analyzer.extractCatalog();
// ## Assert ##
assertEquals("exampledb", catalog);
}
use of org.dbflute.logic.jdbc.urlanalyzer.DfUrlAnalyzer in project dbflute-core by dbflute.
the class DfReplaceSchemaProperties method createAdditionalUserConnection.
public Connection createAdditionalUserConnection(String additonalUser) {
final Map<String, String> propertyMap = getAdditionalUserPropertyMap(additonalUser);
if (propertyMap == null) {
return null;
}
final String title = "replaceSchemaDefinitionMap#additionalUserMap$";
final String driver = getDatabaseProperties().getDatabaseDriver();
final String url;
{
String property = resolveDispatchVariable(title + "url", propertyMap.get("url"));
if (property != null && property.trim().length() > 0) {
url = property;
} else {
url = getDatabaseProperties().getDatabaseUrl();
}
}
final DfUrlAnalyzerFactory factory = new DfUrlAnalyzerFactory(getBasicProperties(), url);
final DfUrlAnalyzer analyzer = factory.createAnalyzer();
final String catalog = analyzer.extractCatalog();
final String schema = propertyMap.get("schema");
final UnifiedSchema unifiedSchema = UnifiedSchema.createAsDynamicSchema(catalog, schema);
final String user = resolveDispatchVariable(title + "user", propertyMap.get("user"));
final String password = resolvePasswordVariable(title + "password", additonalUser, propertyMap.get("password"));
final Properties prop = getDatabaseProperties().getConnectionProperties();
prop.setProperty("user", user);
prop.setProperty("password", password);
_log.info("...Creating a connection for additional user: " + user);
return createConnection(driver, url, unifiedSchema, prop);
}
use of org.dbflute.logic.jdbc.urlanalyzer.DfUrlAnalyzer in project dbflute-core by dbflute.
the class DfDatabaseProperties method extractCatalogFromUrl.
public String extractCatalogFromUrl(String url) {
final DfUrlAnalyzerFactory factory = new DfUrlAnalyzerFactory(getBasicProperties(), url);
final DfUrlAnalyzer analyzer = factory.createAnalyzer();
final String extracted = analyzer.extractCatalog();
return Srl.is_NotNull_and_NotTrimmedEmpty(extracted) ? extracted : null;
}
use of org.dbflute.logic.jdbc.urlanalyzer.DfUrlAnalyzer in project dbflute-core by dbflute.
the class DfUrlAnalyzerPostgreSQLTest method test_extractCatalog_nohost.
public void test_extractCatalog_nohost() throws Exception {
// ## Arrange ##
DfUrlAnalyzer analyzer = createTarget("jdbc:postgresql:exampledb");
// ## Act ##
String catalog = analyzer.extractCatalog();
// ## Assert ##
assertEquals("exampledb", catalog);
}
Aggregations