Search in sources :

Example 1 with XidImpl

use of org.teiid.client.xa.XidImpl in project teiid by teiid.

the class TestXAConnection method testConnectionClose.

@Test
public void testConnectionClose() throws Exception {
    final ConnectionImpl mmConn = TestConnection.getMMConnection();
    XAConnectionImpl xaConn = new XAConnectionImpl(mmConn);
    Connection conn = xaConn.getConnection();
    StatementImpl stmt = (StatementImpl) conn.createStatement();
    conn.setAutoCommit(false);
    conn.close();
    ServerConnection sc = xaConn.getConnectionImpl().getServerConnection();
    Mockito.verify(sc, VerificationModeFactory.times(1)).cleanUp();
    assertTrue(stmt.isClosed());
    assertTrue(conn.getAutoCommit());
    conn = xaConn.getConnection();
    stmt = (StatementImpl) conn.createStatement();
    XAResource resource = xaConn.getXAResource();
    resource.start(new XidImpl(1, new byte[0], new byte[0]), XAResource.TMNOFLAGS);
    conn.close();
    assertTrue(stmt.isClosed());
    assertTrue(conn.getAutoCommit());
}
Also used : XAResource(javax.transaction.xa.XAResource) XidImpl(org.teiid.client.xa.XidImpl) ServerConnection(org.teiid.net.ServerConnection) Connection(java.sql.Connection) ServerConnection(org.teiid.net.ServerConnection) Test(org.junit.Test)

Example 2 with XidImpl

use of org.teiid.client.xa.XidImpl in project teiid by teiid.

the class TestMMXid method testCopyConstructor.

public void testCopyConstructor() {
    XidImpl xidcopy = new XidImpl(XID1);
    assertEquals(XID1Copy, xidcopy);
    assertNotSame(XID1Copy, xidcopy);
}
Also used : XidImpl(org.teiid.client.xa.XidImpl)

Aggregations

XidImpl (org.teiid.client.xa.XidImpl)2 Connection (java.sql.Connection)1 XAResource (javax.transaction.xa.XAResource)1 Test (org.junit.Test)1 ServerConnection (org.teiid.net.ServerConnection)1