Package com.taobao.metamorphosis.transaction

Examples of com.taobao.metamorphosis.transaction.TransactionInfo


        final String serverUrl = "meta://localhost:8123";
        this.mockIsConnected(serverUrl, true);
        this.context.setServerUrl(serverUrl);

        final XATransactionId id = XIDGenerator.createXID(1);
        this.mockInvokeSuccess(serverUrl, new TransactionInfo(id, this.sessionId, TransactionType.BEGIN), null);

        OpaqueGenerator.resetOpaque();
        this.replay();
        this.context.start(id, XAResource.TMNOFLAGS);
        assertTrue(this.context.isInXATransaction());
View Full Code Here


        final String serverUrl = "meta://localhost:8123";
        this.mockIsConnected(serverUrl, true);
        this.context.setServerUrl(serverUrl);

        final XATransactionId id = XIDGenerator.createXID(1);
        this.mockInvokeSuccess(serverUrl, new TransactionInfo(id, this.sessionId, TransactionType.BEGIN), null);

        OpaqueGenerator.resetOpaque();
        this.replay();
        this.context.start(id, XAResource.TMNOFLAGS);
        assertTrue(this.context.isInXATransaction());
View Full Code Here

        final String serverUrl = "meta://localhost:8123";
        this.mockIsConnected(serverUrl, true);
        this.context.setServerUrl(serverUrl);

        final XATransactionId id = XIDGenerator.createXID(1);
        this.mockInvokeSuccess(serverUrl, new TransactionInfo(id, this.sessionId, TransactionType.BEGIN), null);
        this.mockInvokeSuccess(serverUrl, new TransactionInfo(id, this.sessionId, TransactionType.ROLLBACK), null);

        OpaqueGenerator.resetOpaque();
        this.replay();
        this.context.start(id, XAResource.TMNOFLAGS);
        assertFalse(this.session.removeCtx);
View Full Code Here

        final String serverUrl = "meta://localhost:8123";
        this.mockIsConnected(serverUrl, true);
        this.context.setServerUrl(serverUrl);

        final XATransactionId id = XIDGenerator.createXID(1);
        this.mockInvokeSuccess(serverUrl, new TransactionInfo(id, this.sessionId, TransactionType.BEGIN), null);
        this.mockSend(serverUrl, new TransactionInfo(id, this.sessionId, TransactionType.END));
        this.mockInvokeSuccess(serverUrl, new TransactionInfo(id, this.sessionId, TransactionType.PREPARE),
            String.valueOf(XAResource.XA_OK));
        this.mockInvokeSuccess(serverUrl, new TransactionInfo(id, this.sessionId, TransactionType.ROLLBACK), null);

        OpaqueGenerator.resetOpaque();
        this.replay();
        this.context.start(id, XAResource.TMNOFLAGS);
        assertFalse(this.session.removeCtx);
View Full Code Here

        // ��������ģ�������recover����������
        final String serverUrl = "meta://localhost:8123";
        this.mockIsConnected(serverUrl, true);
        this.context.setServerUrl(serverUrl);
        final XATransactionId id = XIDGenerator.createXID(1);
        this.mockInvokeSuccess(serverUrl, new TransactionInfo(id, this.sessionId, TransactionType.COMMIT_TWO_PHASE),
            null);
        OpaqueGenerator.resetOpaque();
        this.replay();
        this.context.commit(id, false);
View Full Code Here

        // ��������ģ�������recover����������
        final String serverUrl = "meta://localhost:8123";
        this.mockIsConnected(serverUrl, true);
        this.context.setServerUrl(serverUrl);
        final XATransactionId id = XIDGenerator.createXID(1);
        this.mockInvokeSuccess(serverUrl, new TransactionInfo(id, this.sessionId, TransactionType.PREPARE),
            String.valueOf(XAResource.XA_OK));
        OpaqueGenerator.resetOpaque();
        this.replay();
        this.context.prepare(id);
View Full Code Here

        final XATransactionId id1 = XIDGenerator.createXID(1);
        final XATransactionId id2 = XIDGenerator.createXID(2);
        final XATransactionId id3 = XIDGenerator.createXID(3);
        final XATransactionId id4 = XIDGenerator.createXID(4);

        this.mockInvokeSuccess(serverURL1, new TransactionInfo(null, this.sessionId, TransactionType.RECOVER),
            id2.getTransactionKey() + "\r\n" + id3.getTransactionKey());
        this.mockInvokeSuccess(serverURL2, new TransactionInfo(null, this.sessionId, TransactionType.RECOVER),
            id1.getTransactionKey() + "\r\n" + id4.getTransactionKey());
        this.replay();
        OpaqueGenerator.resetOpaque();
        this.context.setXareresourceURLs(new String[] { serverURL1, serverURL2 });
        final Xid[] xids = this.context.recover(XAResource.TMNOFLAGS);
View Full Code Here

    public void testRecoverBlank() throws Exception {
        final String serverUrl = "meta://localhost:8123";
        this.mockIsConnected(serverUrl, true);
        this.context.setXareresourceURLs(new String[] { serverUrl });

        this.mockInvokeSuccess(serverUrl, new TransactionInfo(null, this.sessionId, TransactionType.RECOVER), null);
        this.replay();
        OpaqueGenerator.resetOpaque();
        final Xid[] xids = this.context.recover(XAResource.TMNOFLAGS);
        assertEquals(0, xids.length);
    }
View Full Code Here

        final IoBuffer buf = IoBuffer.wrap("transaction TX:sessionId:99 sessionId COMMIT_ONE_PHASE 100\r\n".getBytes());
        final TransactionCommand cmd = (TransactionCommand) this.decoder.decode(buf, null);
        assertNotNull(cmd);
        assertEquals(100, (int) cmd.getOpaque());
        assertEquals(0, cmd.getTransactionInfo().getTimeout());
        final TransactionInfo info = cmd.getTransactionInfo();
        assertNotNull(info);
        assertNotNull(info.getTransactionId());
        assertTrue(info.getTransactionId().isLocalTransaction());
        final LocalTransactionId id = (LocalTransactionId) info.getTransactionId();
        assertEquals("sessionId", id.getSessionId());
        assertEquals(99, id.getValue());
    }
View Full Code Here

                IoBuffer.wrap("transaction TX:sessionId:99 sessionId COMMIT_ONE_PHASE 3 100\r\n".getBytes());
        final TransactionCommand cmd = (TransactionCommand) this.decoder.decode(buf, null);
        assertNotNull(cmd);
        assertEquals(100, (int) cmd.getOpaque());
        assertEquals(3, cmd.getTransactionInfo().getTimeout());
        final TransactionInfo info = cmd.getTransactionInfo();
        assertNotNull(info);
        assertNotNull(info.getTransactionId());
        assertTrue(info.getTransactionId().isLocalTransaction());
        final LocalTransactionId id = (LocalTransactionId) info.getTransactionId();
        assertEquals("sessionId", id.getSessionId());
        assertEquals(99, id.getValue());
    }
View Full Code Here

TOP

Related Classes of com.taobao.metamorphosis.transaction.TransactionInfo

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.