HikariJDBCParameterDecorator implements JDBCParameterDecorator<HikariDataSource> { @Override public HikariDataSource decorate(final HikariDataSource dataSource) { dataSource.getDataSourceProperties().setProperty("useServerPrepStmts", Boolean.TRUE.toString()); dataSource.getDataSourceProperties().setProperty("cachePrepStmts", Boolean.TRUE.toString()); dataSource.getDataSourceProperties().setProperty("prepStmtCacheSize", "250"); dataSource.getDataSourceProperties().setProperty("prepStmtCacheSqlLimit", "2048"); dataSource.getDataSourceProperties().setProperty("useLocalSessionState", Boolean.TRUE.toString()); dataSource.getDataSourceProperties().setProperty("rewriteBatchedStatements", Boolean.TRUE.toString()); dataSource.getDataSourceProperties().setProperty("cacheResultSetMetadata", Boolean.FALSE.toString()); dataSource.getDataSourceProperties().setProperty("cacheServerConfiguration", Boolean.TRUE.toString()); dataSource.getDataSourceProperties().setProperty("elideSetAutoCommits", Boolean.TRUE.toString()); dataSource.getDataSourceProperties().setProperty("maintainTimeStats", Boolean.FALSE.toString()); dataSource.getDataSourceProperties().setProperty("netTimeoutForStreamingResults", "0"); dataSource.getDataSourceProperties().setProperty("tinyInt1isBit", Boolean.FALSE.toString()); return new HikariDataSource(dataSource); }  @Override HikariDataSource decorate(final HikariDataSource dataSource); @Override Class<HikariDataSource> getType();  }
@Test public void assertDecoratedHikariDataSource() { HikariDataSource dataSource = new HikariDataSource(); dataSource.setDriverClassName("org.apache.shardingsphere.jdbc.test.MockedDriver"); dataSource.setJdbcUrl("mock:jdbc"); HikariDataSource actual = new HikariJDBCParameterDecorator().decorate(dataSource); Properties props = actual.getDataSourceProperties(); assertThat(props.getProperty("useServerPrepStmts"), is(Boolean.TRUE.toString())); assertThat(props.getProperty("cachePrepStmts"), is(Boolean.TRUE.toString())); assertThat(props.getProperty("prepStmtCacheSize"), is("250")); assertThat(props.getProperty("prepStmtCacheSqlLimit"), is("2048")); assertThat(props.getProperty("useLocalSessionState"), is(Boolean.TRUE.toString())); assertThat(props.getProperty("rewriteBatchedStatements"), is(Boolean.TRUE.toString())); assertThat(props.getProperty("cacheResultSetMetadata"), is(Boolean.FALSE.toString())); assertThat(props.getProperty("cacheServerConfiguration"), is(Boolean.TRUE.toString())); assertThat(props.getProperty("elideSetAutoCommits"), is(Boolean.TRUE.toString())); assertThat(props.getProperty("maintainTimeStats"), is(Boolean.FALSE.toString())); assertThat(props.getProperty("netTimeoutForStreamingResults"), is("0")); assertThat(props.getProperty("tinyInt1isBit"), is(Boolean.FALSE.toString())); }