Package org.apache.tomcat.jdbc.pool

Examples of org.apache.tomcat.jdbc.pool.DataSourceProxy


    public TestConnectionState(String name) {
        super(name);
    }

    public void testAutoCommitFalse() throws Exception {
        DataSourceProxy d1 = this.createDefaultDataSource();
        d1.setMaxActive(1);
        d1.setMinIdle(1);
        d1.setMaxIdle(1);
        d1.setJdbcInterceptors(ConnectionState.class.getName());
        d1.setDefaultAutoCommit(Boolean.FALSE);
        Connection c1 = d1.getConnection();
        assertFalse("Auto commit should be false",c1.getAutoCommit());
        c1.setAutoCommit(true);
        assertTrue("Auto commit should be true",c1.getAutoCommit());
        c1.close();
        c1 = d1.getConnection();
        assertFalse("Auto commit should be false for a reused connection",c1.getAutoCommit());
        d1.close(true);
        assertTrue("Connection should be closed",c1.isClosed());
    }
View Full Code Here


        d1.close(true);
        assertTrue("Connection should be closed",c1.isClosed());
    }
   
    public void testAutoCommitTrue() throws Exception {
        DataSourceProxy d1 = this.createDefaultDataSource();
        d1.setMaxActive(1);
        d1.setJdbcInterceptors(ConnectionState.class.getName());
        d1.setDefaultAutoCommit(Boolean.TRUE);
        d1.setMinIdle(1);
        Connection c1 = d1.getConnection();
        assertTrue("Auto commit should be true",c1.getAutoCommit());
        c1.setAutoCommit(false);
        assertFalse("Auto commit should be false",c1.getAutoCommit());
        c1.close();
        c1 = d1.getConnection();
        assertTrue("Auto commit should be true for a reused connection",c1.getAutoCommit());
    }
View Full Code Here

        c1 = d1.getConnection();
        assertTrue("Auto commit should be true for a reused connection",c1.getAutoCommit());
    }
   
    public void testDefaultCatalog() throws Exception {
        DataSourceProxy d1 = this.createDefaultDataSource();
        d1.setMaxActive(1);
        d1.setJdbcInterceptors(ConnectionState.class.getName());
        d1.setDefaultCatalog("information_schema");
        d1.setMinIdle(1);
        Connection c1 = d1.getConnection();
        assertEquals("Catalog should be information_schema",c1.getCatalog(),"information_schema");
        c1.close();
        c1 = d1.getConnection();
        assertEquals("Catalog should be information_schema",c1.getCatalog(),"information_schema");
        c1.setCatalog("mysql");
        assertEquals("Catalog should be information_schema",c1.getCatalog(),"mysql");
        c1.close();
        c1 = d1.getConnection();
        assertEquals("Catalog should be information_schema",c1.getCatalog(),"information_schema");
    }
View Full Code Here

public class TestConnectionState extends DefaultTestCase {

    @Test
    public void testAutoCommitFalse() throws Exception {
        DataSourceProxy d1 = this.createDefaultDataSource();
        d1.setMaxActive(1);
        d1.setMinIdle(1);
        d1.setMaxIdle(1);
        d1.setJdbcInterceptors(ConnectionState.class.getName());
        d1.setDefaultAutoCommit(Boolean.FALSE);
        Connection c1 = d1.getConnection();
        Assert.assertFalse("Auto commit should be false",c1.getAutoCommit());
        c1.setAutoCommit(true);
        Assert.assertTrue("Auto commit should be true",c1.getAutoCommit());
        c1.close();
        c1 = d1.getConnection();
        Assert.assertFalse("Auto commit should be false for a reused connection",c1.getAutoCommit());
        d1.close(true);
        Assert.assertTrue("Connection should be closed",c1.isClosed());
    }
View Full Code Here

        Assert.assertTrue("Connection should be closed",c1.isClosed());
    }

    @Test
    public void testAutoCommitTrue() throws Exception {
        DataSourceProxy d1 = this.createDefaultDataSource();
        d1.setMaxActive(1);
        d1.setJdbcInterceptors(ConnectionState.class.getName());
        d1.setDefaultAutoCommit(Boolean.TRUE);
        d1.setMinIdle(1);
        Connection c1 = d1.getConnection();
        Assert.assertTrue("Auto commit should be true",c1.getAutoCommit());
        c1.setAutoCommit(false);
        Assert.assertFalse("Auto commit should be false",c1.getAutoCommit());
        c1.close();
        c1 = d1.getConnection();
        Assert.assertTrue("Auto commit should be true for a reused connection",c1.getAutoCommit());
    }
View Full Code Here

        Assert.assertTrue("Auto commit should be true for a reused connection",c1.getAutoCommit());
    }

    @Test
    public void testDefaultCatalog() throws Exception {
        DataSourceProxy d1 = this.createDefaultDataSource();
        d1.setMaxActive(1);
        d1.setJdbcInterceptors(ConnectionState.class.getName());
        d1.setDefaultCatalog("information_schema");
        d1.setMinIdle(1);
        Connection c1 = d1.getConnection();
        Assert.assertEquals("Catalog should be information_schema",c1.getCatalog(),"information_schema");
        c1.close();
        c1 = d1.getConnection();
        Assert.assertEquals("Catalog should be information_schema",c1.getCatalog(),"information_schema");
        c1.setCatalog("mysql");
        Assert.assertEquals("Catalog should be information_schema",c1.getCatalog(),"mysql");
        c1.close();
        c1 = d1.getConnection();
        Assert.assertEquals("Catalog should be information_schema",c1.getCatalog(),"information_schema");
    }
View Full Code Here

    public TestConnectionState(String name) {
        super(name);
    }

    public void testAutoCommitFalse() throws Exception {
        DataSourceProxy d1 = this.createDefaultDataSource();
        d1.setMaxActive(1);
        d1.setMinIdle(1);
        d1.setMaxIdle(1);
        d1.setJdbcInterceptors(ConnectionState.class.getName());
        d1.setDefaultAutoCommit(Boolean.FALSE);
        Connection c1 = d1.getConnection();
        assertFalse("Auto commit should be false",c1.getAutoCommit());
        c1.setAutoCommit(true);
        assertTrue("Auto commit should be true",c1.getAutoCommit());
        c1.close();
        c1 = d1.getConnection();
        assertFalse("Auto commit should be false for a reused connection",c1.getAutoCommit());
        d1.close(true);
        assertTrue("Connection should be closed",c1.isClosed());
    }
View Full Code Here

        d1.close(true);
        assertTrue("Connection should be closed",c1.isClosed());
    }

    public void testAutoCommitTrue() throws Exception {
        DataSourceProxy d1 = this.createDefaultDataSource();
        d1.setMaxActive(1);
        d1.setJdbcInterceptors(ConnectionState.class.getName());
        d1.setDefaultAutoCommit(Boolean.TRUE);
        d1.setMinIdle(1);
        Connection c1 = d1.getConnection();
        assertTrue("Auto commit should be true",c1.getAutoCommit());
        c1.setAutoCommit(false);
        assertFalse("Auto commit should be false",c1.getAutoCommit());
        c1.close();
        c1 = d1.getConnection();
        assertTrue("Auto commit should be true for a reused connection",c1.getAutoCommit());
    }
View Full Code Here

        c1 = d1.getConnection();
        assertTrue("Auto commit should be true for a reused connection",c1.getAutoCommit());
    }

    public void testDefaultCatalog() throws Exception {
        DataSourceProxy d1 = this.createDefaultDataSource();
        d1.setMaxActive(1);
        d1.setJdbcInterceptors(ConnectionState.class.getName());
        d1.setDefaultCatalog("information_schema");
        d1.setMinIdle(1);
        Connection c1 = d1.getConnection();
        assertEquals("Catalog should be information_schema",c1.getCatalog(),"information_schema");
        c1.close();
        c1 = d1.getConnection();
        assertEquals("Catalog should be information_schema",c1.getCatalog(),"information_schema");
        c1.setCatalog("mysql");
        assertEquals("Catalog should be information_schema",c1.getCatalog(),"mysql");
        c1.close();
        c1 = d1.getConnection();
        assertEquals("Catalog should be information_schema",c1.getCatalog(),"information_schema");
    }
View Full Code Here

TOP

Related Classes of org.apache.tomcat.jdbc.pool.DataSourceProxy

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.