Source code: org/activemq/service/impl/XATransactionTest.java
1 /**
2 *
3 * Copyright 2004 Protique Ltd
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 **/
18 package org.activemq.service.impl;
19
20 import org.activemq.test.SerializationTestSupport;
21
22 /**
23 * @version $Revision: 1.1.1.1 $
24 */
25 public class XATransactionTest extends SerializationTestSupport {
26 /*
27 public void testXATransactionSerialization() throws Exception {
28 XATransactionCommand txn = createXATranasction();
29
30 byte[] data = serialize(txn);
31 Object value = deserialize(data);
32
33 assertTrue("Should have returned an XATransactionCommend: " + value, value instanceof XATransactionCommand);
34 }
35
36 public void testXidSerialization() throws Exception {
37 XidStub xidStub = new XidStub(new byte[]{1, 2, 3, 4, 5});
38 ActiveMQXid xid = new ActiveMQXid(xidStub);
39
40 byte[] data = serialize(xid);
41 Object value = deserialize(data);
42
43 assertEquals("deserialized object is not equal", xid, value);
44 }
45
46 public void testXidEquals() throws Exception {
47 XidStub xidStub = new XidStub(new byte[]{1, 2, 3, 4, 5});
48 ActiveMQXid xid1 = new ActiveMQXid(xidStub);
49 ActiveMQXid xid2 = new ActiveMQXid(xidStub);
50
51 assertEquals("object hashes are not equal", xid1.hashCode(), xid2.hashCode());
52 assertEquals("objects are not equal", xid1, xid2);
53 }
54
55 protected XATransactionCommand createXATranasction() throws JMSException {
56 ActiveMQXid xid = new ActiveMQXid("01:23:45");
57 XATransactionCommand answer = new XATransactionCommand(null, xid, null, null);
58 answer.addPostCommitTask(new SendMessageTransactionTask(null, createMessage()));
59 return answer;
60 }
61
62 protected ActiveMQMessage createMessage() throws JMSException {
63 ActiveMQTextMessage answer = new ActiveMQTextMessage();
64 answer.setJMSMessageID("abc:123");
65 answer.setText("I'm a test message!");
66 return answer;
67 }
68 */
69 public void testX() {}
70 }