Search in sources :

Example 1 with StatementProxyXA

use of io.seata.rm.datasource.xa.StatementProxyXA in project seata by seata.

the class ConnectionProxyXATest method testCreateStatement.

@Test
public void testCreateStatement() throws Throwable {
    Connection connection = Mockito.mock(Connection.class);
    Mockito.when(connection.getAutoCommit()).thenReturn(true);
    XAConnection xaConnection = Mockito.mock(XAConnection.class);
    BaseDataSourceResource<ConnectionProxyXA> baseDataSourceResource = Mockito.mock(BaseDataSourceResource.class);
    String xid = "xxx";
    ConnectionProxyXA connectionProxyXA = new ConnectionProxyXA(connection, xaConnection, baseDataSourceResource, xid);
    Statement statement = connectionProxyXA.createStatement();
    Assertions.assertTrue(statement instanceof StatementProxyXA);
}
Also used : ConnectionProxyXA(io.seata.rm.datasource.xa.ConnectionProxyXA) Statement(java.sql.Statement) StatementProxyXA(io.seata.rm.datasource.xa.StatementProxyXA) Connection(java.sql.Connection) XAConnection(javax.sql.XAConnection) XAConnection(javax.sql.XAConnection) Test(org.junit.jupiter.api.Test)

Aggregations

ConnectionProxyXA (io.seata.rm.datasource.xa.ConnectionProxyXA)1 StatementProxyXA (io.seata.rm.datasource.xa.StatementProxyXA)1 Connection (java.sql.Connection)1 Statement (java.sql.Statement)1 XAConnection (javax.sql.XAConnection)1 Test (org.junit.jupiter.api.Test)1