Package bitronix.tm.resource.jdbc

Examples of bitronix.tm.resource.jdbc.PooledConnectionProxy


    public void testPrepareRuntimeFailureCase() throws Exception {
        BitronixTransactionManager tm = TransactionManagerServices.getTransactionManager();
        tm.begin();

        Connection connection1 = poolingDataSource1.getConnection();
        PooledConnectionProxy handle = (PooledConnectionProxy) connection1;
        JdbcPooledConnection pc1 = handle.getPooledConnection();
            XAConnection xaConnection1 = (XAConnection) getWrappedXAConnectionOf(pc1);
            MockXAResource mockXAResource = (MockXAResource) xaConnection1.getXAResource();
            mockXAResource.setPrepareException(new RuntimeException("driver error"));
        connection1.createStatement();
View Full Code Here


    public void testExpectNoHeuristic() throws Exception {
        tm.begin();
        tm.setTransactionTimeout(10); // TX must not timeout

        Connection connection1 = poolingDataSource1.getConnection();
        PooledConnectionProxy handle = (PooledConnectionProxy) connection1;
        XAConnection xaConnection2 = (XAConnection) AbstractMockJdbcTest.getWrappedXAConnectionOf(handle.getPooledConnection());
        connection1.createStatement();

        final MockXAResource mockXAResource2 = (MockXAResource) xaConnection2.getXAResource();
        mockXAResource2.setCommitException(createXAException("resource 2 commit failed with XAER_RMERR", XAException.XAER_RMERR));
View Full Code Here

    public void testPrepareFailureRollbackFailure() throws Exception {
        tm.begin();
        tm.setTransactionTimeout(10); // TX must not timeout

        Connection connection1 = poolingDataSource1.getConnection();
        PooledConnectionProxy handle = (PooledConnectionProxy) connection1;
        XAConnection xaConnection1 = (XAConnection) AbstractMockJdbcTest.getWrappedXAConnectionOf(handle.getPooledConnection());
        connection1.createStatement();

        Connection connection2 = poolingDataSource2.getConnection();
        PooledConnectionProxy handle2 = (PooledConnectionProxy) connection2;
        XAConnection xaConnection2 = (XAConnection) AbstractMockJdbcTest.getWrappedXAConnectionOf(handle2.getPooledConnection());
        connection2.createStatement();

        final MockXAResource mockXAResource1 = (MockXAResource) xaConnection1.getXAResource();
        mockXAResource1.setRollbackException(createXAException("resource 1 rollback failed", XAException.XAER_INVAL));
View Full Code Here

        Connection connection1 = poolingDataSource1.getConnection();
        connection1.createStatement();

        Connection connection2 = poolingDataSource2.getConnection();
        PooledConnectionProxy handle = (PooledConnectionProxy) connection2;
        XAConnection xaConnection2 = (XAConnection) AbstractMockJdbcTest.getWrappedXAConnectionOf(handle.getPooledConnection());
        connection2.createStatement();

        Connection connection3 = poolingDataSource2.getConnection();
        connection3.createStatement();
View Full Code Here

    public void testPrepareLrcFailure() throws Exception {
        tm.begin();
        tm.setTransactionTimeout(10); // TX must not timeout

        Connection connection1 = poolingDataSource1.getConnection();
        PooledConnectionProxy handle = (PooledConnectionProxy) connection1;
        XAConnection xaConnection1 = (XAConnection) AbstractMockJdbcTest.getWrappedXAConnectionOf(handle.getPooledConnection());
        connection1.createStatement();

        Connection connection2 = poolingDataSourceLrc.getConnection();
        connection2.createStatement();
       
View Full Code Here

          }
        };
        thread2.start();
        thread2.join();

        PooledConnectionProxy handle1 = (PooledConnectionProxy) twoConnections.get(0);
        PooledConnectionProxy handle2 = (PooledConnectionProxy) twoConnections.get(1);
        assertNotSame(handle1.getProxiedDelegate(), handle2.getProxiedDelegate());

    }
View Full Code Here

        connection1.createStatement();

        if (log.isDebugEnabled()) { log.debug("*** getting second connection from DS2"); }
        Connection connection2 = poolingDataSource2.getConnection();

        PooledConnectionProxy handle1 = (PooledConnectionProxy) connection1;
        PooledConnectionProxy handle2 = (PooledConnectionProxy) connection2;
        assertNotSame(handle1.getProxiedDelegate(), handle2.getProxiedDelegate());

        connection1.close();
        connection2.close();

        tm.commit();
View Full Code Here

        connection1.createStatement();

        if (log.isDebugEnabled()) { log.debug("*** getting second connection from DS1"); }
        Connection connection2 = poolingDataSource1.getConnection();

        PooledConnectionProxy handle1 = (PooledConnectionProxy) connection1;
        PooledConnectionProxy handle2 = (PooledConnectionProxy) connection2;
        assertNotSame(handle1.getProxiedDelegate(), handle2.getProxiedDelegate());

        connection1.close();
        connection2.close();
    }
View Full Code Here

        connection1.createStatement();

        if (log.isDebugEnabled()) { log.debug("*** getting second connection from DS2"); }
        Connection connection2 = poolingDataSource2.getConnection();

        PooledConnectionProxy handle1 = (PooledConnectionProxy) connection1;
        PooledConnectionProxy handle2 = (PooledConnectionProxy) connection2;
        assertNotSame(handle1.getProxiedDelegate(), handle2.getProxiedDelegate());

        connection1.close();
        connection2.close();
    }
View Full Code Here

        Connection connection1 = poolingDataSource1.getConnection();

        if (log.isDebugEnabled()) { log.debug("*** getting second connection from DS1"); }
        Connection connection2 = poolingDataSource1.getConnection();

        PooledConnectionProxy handle1 = (PooledConnectionProxy) connection1;
        PooledConnectionProxy handle2 = (PooledConnectionProxy) connection2;
        assertSame(handle1.getProxiedDelegate(), handle2.getProxiedDelegate());

        connection1.close();
        connection2.close();

        tm.commit();
View Full Code Here

TOP

Related Classes of bitronix.tm.resource.jdbc.PooledConnectionProxy

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.