Examples of XidStub


Examples of org.codehaus.activemq.message.XidStub

            session.createTextMessage("First Message"),
            session.createTextMessage("Second Message")
        };


        XidStub xid1 = new XidStub(new byte[]{1, 2, 3, 4, 5});
        resource.start(xid1, XAResource.TMNOFLAGS);
        producer.send(outbound[0]);
        resource.end(xid1, XAResource.TMSUCCESS);
        resource.commit(xid1, true);

        XidStub xid2 = new XidStub(new byte[]{2, 2, 3, 4, 5});
        resource.start(xid2, XAResource.TMNOFLAGS);
        producer.send(session.createTextMessage("I'm going to get rolled back."));
        resource.end(xid2, XAResource.TMSUCCESS);
        resource.rollback(xid2);

        XidStub xid3 = new XidStub(new byte[]{3, 2, 3, 4, 5});
        resource.start(xid3, XAResource.TMNOFLAGS);
        producer.send(outbound[1]);
        resource.end(xid3, XAResource.TMSUCCESS);
        if (resource.prepare(xid3) == XAResource.XA_OK) {
            resource.commit(xid3, false);
        }

        ArrayList messages = new ArrayList();
        XidStub xid4 = new XidStub(new byte[]{4, 2, 3, 4, 5});
        resource.start(xid4, XAResource.TMNOFLAGS);
        messages.add(consumer.receive(1000));
        messages.add(consumer.receive(1000));
        resource.end(xid4, XAResource.TMSUCCESS);
        resource.commit(xid4, true);
View Full Code Here

Examples of org.codehaus.activemq.message.XidStub

        Message[] outbound = new Message[]{
            session.createTextMessage("First Message"),
            session.createTextMessage("Second Message")
        };

        XidStub xid2 = new XidStub(new byte[]{1, 2, 3, 4, 6});
        resource.start(xid2, XAResource.TMNOFLAGS);
        producer.send(session.createTextMessage("I'm going to get rolled back."));
        resource.end(xid2, XAResource.TMSUCCESS);
        assertEquals(XAResource.XA_OK, resource.prepare(xid2));


        XidStub xid3 = new XidStub(new byte[]{2, 2, 3, 4, 6});
        resource.start(xid3, XAResource.TMNOFLAGS);
        producer.send(outbound[1]);
        resource.end(xid3, XAResource.TMSUCCESS);

        assertEquals(XAResource.XA_OK, resource.prepare(xid3));
View Full Code Here

Examples of org.codehaus.activemq.message.XidStub

        assertTrue("Should have returned an XATransactionCommend: " + value, value instanceof XATransactionCommand);
    }

    public void testXidSerialization() throws Exception {
        XidStub xidStub = new XidStub(new byte[]{1, 2, 3, 4, 5});
        ActiveMQXid xid = new ActiveMQXid(xidStub);

        byte[] data = serialize(xid);
        Object value = deserialize(data);
View Full Code Here

Examples of org.codehaus.activemq.message.XidStub

        assertEquals("deserialized object is not equal", xid, value);
    }

    public void testXidEquals() throws Exception {
        XidStub xidStub = new XidStub(new byte[]{1, 2, 3, 4, 5});
        ActiveMQXid xid1 = new ActiveMQXid(xidStub);
        ActiveMQXid xid2 = new ActiveMQXid(xidStub);

        assertEquals("object hashes are not equal", xid1.hashCode(), xid2.hashCode());
        assertEquals("objects are not equal", xid1, xid2);
View Full Code Here

Examples of org.codehaus.activemq.test.XidStub

        assertTrue("Should have returned an XATransactionCommend: " + value, value instanceof XATransactionCommand);
    }

    public void testXidSerialization() throws Exception {
        XidStub xidStub = new XidStub(new byte[]{1, 2, 3, 4, 5});
        ActiveMQXid xid = new ActiveMQXid(xidStub);

        byte[] data = serialize(xid);
        Object value = deserialize(data);
View Full Code Here

Examples of org.codehaus.activemq.test.XidStub

        assertEquals("deserialized object is not equal", xid, value);
    }

    public void testXidEquals() throws Exception {
        XidStub xidStub = new XidStub(new byte[]{1, 2, 3, 4, 5});
        ActiveMQXid xid1 = new ActiveMQXid(xidStub);
        ActiveMQXid xid2 = new ActiveMQXid(xidStub);

        assertEquals("object hashes are not equal", xid1.hashCode(), xid2.hashCode());
        assertEquals("objects are not equal", xid1, xid2);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.