KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > objectserver > tx > GlobalTransactionDescriptorTest


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.objectserver.tx;
5
6 import com.tc.net.protocol.tcm.ChannelID;
7 import com.tc.object.tx.ServerTransactionID;
8 import com.tc.object.tx.TransactionID;
9 import com.tc.objectserver.gtx.GlobalTransactionDescriptor;
10 import com.tc.test.TCTestCase;
11
12 public class GlobalTransactionDescriptorTest extends TCTestCase {
13   public void tests() throws Exception JavaDoc {
14     ChannelID channel1 = new ChannelID(1);
15     TransactionID tx1 = new TransactionID(1);
16     ServerTransactionID stx1 = new ServerTransactionID(channel1, tx1);
17     
18     GlobalTransactionDescriptor d1 = new GlobalTransactionDescriptor(stx1);
19     GlobalTransactionDescriptor d2 = new GlobalTransactionDescriptor(new ServerTransactionID(channel1, tx1));
20     GlobalTransactionDescriptor x = new GlobalTransactionDescriptor(new ServerTransactionID(new ChannelID(4), tx1));
21     
22     assertEquals(d1, d2);
23     assertEquals(d1.hashCode(), d2.hashCode());
24     assertFalse(d1.equals(new Object JavaDoc()));
25     assertFalse(d1.equals(null));
26     assertFalse(d1.equals(x));
27   }
28 }
29
Popular Tags