Package org.apache.tomcat.jdbc.test

Examples of org.apache.tomcat.jdbc.test.DefaultProperties


    }

    @Test
    public void testPool() throws SQLException, InterruptedException {
        DriverManager.setLoginTimeout(1);
        PoolProperties poolProperties = new DefaultProperties();
        int threadsCount = 3;
        poolProperties.setMaxActive(threadsCount);
        poolProperties.setMaxIdle(threadsCount);
        poolProperties.setMinIdle(0);
        poolProperties.setMaxWait(5000);
        poolProperties.setInitialSize(0);
        poolProperties.setRemoveAbandoned(true);
        poolProperties.setRemoveAbandonedTimeout(300);
        poolProperties.setRollbackOnReturn(true);
        poolProperties.setFairQueue(fairQueue);
        final DataSource ds = new DataSource(poolProperties);

        final CountDownLatch openedLatch = new CountDownLatch(threadsCount);
        final CountDownLatch closedLatch = new CountDownLatch(threadsCount);
        final CountDownLatch toCloseLatch = new CountDownLatch(1);
View Full Code Here


    public Bug54227() {
    }

    @Test
    public void testPool() throws SQLException, InterruptedException {
        PoolProperties poolProperties = new DefaultProperties();
        poolProperties.setMinIdle(0);
        poolProperties.setInitialSize(0);
        poolProperties.setMaxActive(1);
        poolProperties.setMaxWait(5000);
        poolProperties.setMaxAge(100);
        poolProperties.setRemoveAbandoned(false);

        final DataSource ds = new DataSource(poolProperties);
        Connection con;
        Connection actual1;
        Connection actual2;
View Full Code Here

        });
    }

    @Test
    public void testPool() throws SQLException {
        PoolProperties poolProperties = new DefaultProperties();
        poolProperties.setMinIdle(0);
        poolProperties.setInitialSize(0);
        poolProperties.setMaxWait(5000);
        poolProperties.setRemoveAbandoned(true);
        poolProperties.setRemoveAbandonedTimeout(300);
        poolProperties.setRollbackOnReturn(true);
        poolProperties.setInitSQL(initSQL);
        final DataSource ds = new DataSource(poolProperties);
        ds.getConnection().close();
        assertNull(poolProperties.getInitSQL());
    }
View Full Code Here

public class Bug54978 {

    @Test
    public void testIllegalValidationQuery() {
        PoolProperties poolProperties = new DefaultProperties();
        poolProperties.setMinIdle(0);
        poolProperties.setInitialSize(1);
        poolProperties.setMaxActive(1);
        poolProperties.setMaxWait(5000);
        poolProperties.setMaxAge(100);
        poolProperties.setRemoveAbandoned(false);
        poolProperties.setTestOnBorrow(true);
        poolProperties.setTestOnConnect(false);
        poolProperties.setValidationQuery("sdadsada");
        final DataSource ds = new DataSource(poolProperties);
        try {
            ds.getConnection().close();
            fail("Validation should have failed.");
        }catch (SQLException x) {
View Full Code Here

        }
    }

    @Test
    public void testIllegalValidationQueryWithLegalInit() throws SQLException {
        PoolProperties poolProperties = new DefaultProperties();
        poolProperties.setMinIdle(0);
        poolProperties.setInitialSize(1);
        poolProperties.setMaxActive(1);
        poolProperties.setMaxWait(5000);
        poolProperties.setMaxAge(100);
        poolProperties.setRemoveAbandoned(false);
        poolProperties.setTestOnBorrow(true);
        poolProperties.setTestOnConnect(false);
        poolProperties.setValidationQuery("sdadsada");
        poolProperties.setInitSQL("SELECT 1");
        final DataSource ds = new DataSource(poolProperties);
        ds.getConnection().close();
    }
View Full Code Here

   * @throws SQLException
   */
  public static void main(String[] args) throws SQLException
  {
    org.apache.tomcat.jdbc.pool.DataSource datasource = null;
    PoolConfiguration p = new DefaultProperties();

    p.setJmxEnabled(true);
    p.setTestOnBorrow(false);
    p.setTestOnReturn(false);
    p.setValidationInterval(1000);
    p.setTimeBetweenEvictionRunsMillis(2000);

    p.setMaxWait(2000);
    p.setMinEvictableIdleTimeMillis(1000);

    datasource = new org.apache.tomcat.jdbc.pool.DataSource();
    datasource.setPoolProperties(p);
    datasource.setJdbcInterceptors("org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReportJmx(threshold=200)");
    ConnectionPool pool = datasource.createPool();
View Full Code Here

public class Bug51582 {

    public static void main(String[] args) throws SQLException {
        org.apache.tomcat.jdbc.pool.DataSource datasource = null;
        PoolConfiguration p = new DefaultProperties();
        p.setJmxEnabled(true);
        p.setTestOnBorrow(false);
        p.setTestOnReturn(false);
        p.setValidationInterval(1000);
        p.setTimeBetweenEvictionRunsMillis(2000);
        p.setMaxWait(2000);
        p.setMinEvictableIdleTimeMillis(1000);
        datasource = new org.apache.tomcat.jdbc.pool.DataSource();
        datasource.setPoolProperties(p);
        datasource.setJdbcInterceptors("org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReportJmx(threshold=200)");
        ConnectionPool pool = datasource.createPool();
        Connection con = pool.getConnection();
View Full Code Here

    }

    @Test
    public void testPool() throws SQLException, InterruptedException {
        DriverManager.setLoginTimeout(1);
        PoolProperties poolProperties = new DefaultProperties();
        int threadsCount = 3;
        poolProperties.setMaxActive(threadsCount);
        poolProperties.setMaxIdle(threadsCount);
        poolProperties.setMinIdle(0);
        poolProperties.setMaxWait(5000);
        poolProperties.setInitialSize(0);
        poolProperties.setRemoveAbandoned(true);
        poolProperties.setRemoveAbandonedTimeout(300);
        poolProperties.setRollbackOnReturn(true);
        poolProperties.setFairQueue(fairQueue);
        final DataSource ds = new DataSource(poolProperties);

        final CountDownLatch openedLatch = new CountDownLatch(threadsCount);
        final CountDownLatch closedLatch = new CountDownLatch(threadsCount);
        final CountDownLatch toCloseLatch = new CountDownLatch(1);
View Full Code Here

   * @throws SQLException
   */
  public static void main(String[] args) throws SQLException
  {
    org.apache.tomcat.jdbc.pool.DataSource datasource = null;
    PoolConfiguration p = new DefaultProperties();

    p.setJmxEnabled(true);
    p.setTestOnBorrow(false);
    p.setTestOnReturn(false);
    p.setValidationInterval(1000);
    p.setTimeBetweenEvictionRunsMillis(2000);

    p.setMaxWait(2000);
    p.setMinEvictableIdleTimeMillis(1000);

    datasource = new org.apache.tomcat.jdbc.pool.DataSource();
    datasource.setPoolProperties(p);
    datasource.setJdbcInterceptors("org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReportJmx(threshold=200)");
    ConnectionPool pool = datasource.createPool();
View Full Code Here

TOP

Related Classes of org.apache.tomcat.jdbc.test.DefaultProperties

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.