Package org.apache.geronimo.connector.mock

Examples of org.apache.geronimo.connector.mock.ConnectionExtension


    }

    public void testUserTransactionEnlistingExistingConnections() throws Throwable {
        mockComponent = new DefaultInterceptor() {
            public Object invoke(ConnectorInstanceContext newConnectorInstanceContext) throws Throwable {
                ConnectionExtension mockConnection = (ConnectionExtension) connectionFactory.getConnection();
                mockManagedConnection = mockConnection.getManagedConnection();
                userTransaction.begin();
                MockXAResource mockXAResource = (MockXAResource) mockManagedConnection.getXAResource();
                assertEquals("XAResource should know one xid", 1, mockXAResource.getKnownXids().size());
                assertNull("Should not be committed", mockXAResource.getCommitted());
                userTransaction.commit();
                assertNotNull("Should be committed", mockXAResource.getCommitted());
                mockConnection.close();
                return null;
            }
        };
        userTransaction = new GeronimoUserTransaction(transactionManager);
        defaultComponentInterceptor.invoke(connectorInstanceContext);
View Full Code Here


    public void testUnshareableConnections() throws Throwable {
        unshareableResources.add(name);
        mockComponent = new DefaultInterceptor() {
            public Object invoke(ConnectorInstanceContext newConnectorInstanceContext) throws Throwable {
                ConnectionExtension mockConnection1 = (ConnectionExtension) connectionFactory.getConnection();
                mockManagedConnection = mockConnection1.getManagedConnection();
                ConnectionExtension mockConnection2 = (ConnectionExtension) connectionFactory.getConnection();
                //the 2 cx are for the same RM, so tm will call commit only one one (the first)
                //mockManagedConnection = mockConnection2.getManagedConnection();
                assertNotNull("Expected non-null managedconnection 1", mockConnection1.getManagedConnection());
                assertNotNull("Expected non-null managedconnection 2", mockConnection2.getManagedConnection());
                assertTrue("Expected different managed connections for each unshared handle", mockConnection1.getManagedConnection() != mockConnection2.getManagedConnection());

                mockConnection1.close();
                mockConnection2.close();
                return null;
            }

        };
        transactionManager.begin();
View Full Code Here

TOP

Related Classes of org.apache.geronimo.connector.mock.ConnectionExtension

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.