Example usage for org.apache.commons.dbcp2 BasicDataSource getDefaultQueryTimeout

List of usage examples for org.apache.commons.dbcp2 BasicDataSource getDefaultQueryTimeout

Introduction

In this page you can find the example usage for org.apache.commons.dbcp2 BasicDataSource getDefaultQueryTimeout.

Prototype

public Integer getDefaultQueryTimeout() 

Source Link

Document

Obtain the default query timeout that will be used for java.sql.Statement Statement s created from this connection.

Usage

From source file:org.apache.druid.metadata.SQLMetadataConnectorTest.java

@Test
public void testBasicDataSourceCreation() throws Exception {
    MetadataStorageConnectorConfig config = getDbcpPropertiesFile(true, "host", 1234, "connectURI", "user",
            "{\"type\":\"default\",\"password\":\"nothing\"}", "nothing");
    TestSQLMetadataConnector testSQLMetadataConnector = new TestSQLMetadataConnector(
            Suppliers.ofInstance(config), Suppliers.ofInstance(tablesConfig));
    BasicDataSource dataSource = testSQLMetadataConnector.getDatasource();
    Assert.assertEquals(dataSource.getMaxConnLifetimeMillis(), 1200000);
    Assert.assertEquals((long) dataSource.getDefaultQueryTimeout(), 30000);
}