@VisibleForTesting void initSettings() { properties = new Properties(); completeProperties(settings, properties, SONAR_JDBC); completeDefaultProperty(properties, JDBC_URL.getKey(), DEFAULT_URL); doCompleteProperties(properties); dialect = DialectUtils.find(properties.getProperty(SONAR_JDBC_DIALECT), properties.getProperty(JDBC_URL.getKey())); properties.setProperty(SONAR_JDBC_DRIVER, dialect.getDefaultDriverClassName()); }
@Test(expected = MessageException.class) public void testFindNoMatch() { DialectUtils.find("foo", "bar"); } }
@Test public void testFindById() { Dialect d = DialectUtils.find("mysql", null); assertThat(d).isInstanceOf(MySql.class); }
@Test public void testFindByJdbcUrl() { Dialect d = DialectUtils.find(null, "jdbc:mysql:foo:bar"); assertThat(d).isInstanceOf(MySql.class); }
@VisibleForTesting void initSettings() { properties = new Properties(); completeProperties(settings, properties, SONAR_JDBC); completeDefaultProperty(properties, DatabaseProperties.PROP_URL, DEFAULT_URL); doCompleteProperties(properties); dialect = DialectUtils.find(properties.getProperty(SONAR_JDBC_DIALECT), properties.getProperty(SONAR_JDBC_URL)); properties.setProperty(DatabaseProperties.PROP_DRIVER, dialect.getDefaultDriverClassName()); }
@VisibleForTesting void initSettings() { properties = new Properties(); completeProperties(settings, properties, SONAR_JDBC); completeDefaultProperty(properties, JDBC_URL.getKey(), DEFAULT_URL); doCompleteProperties(properties); dialect = DialectUtils.find(properties.getProperty(SONAR_JDBC_DIALECT), properties.getProperty(JDBC_URL.getKey())); properties.setProperty(SONAR_JDBC_DRIVER, dialect.getDefaultDriverClassName()); }