1 5 package com.tc.object.msg; 6 7 import com.tc.exception.ImplementMe; 8 import com.tc.net.protocol.tcm.ChannelID; 9 import com.tc.net.protocol.tcm.MessageChannel; 10 import com.tc.net.protocol.tcm.TCMessageType; 11 import com.tc.net.protocol.tcm.TestMessageChannel; 12 import com.tc.object.ObjectID; 13 import com.tc.object.lockmanager.api.LockContext; 14 import com.tc.object.lockmanager.api.WaitContext; 15 import com.tc.util.concurrent.NoExceptionLinkedQueue; 16 17 import java.util.ArrayList ; 18 import java.util.Collection ; 19 import java.util.HashSet ; 20 import java.util.List ; 21 import java.util.Set ; 22 23 public class TestClientHandshakeMessage implements ClientHandshakeMessage { 24 public Set clientObjectIds = new HashSet (); 25 public Set waitContexts = new HashSet (); 26 public NoExceptionLinkedQueue sendCalls = new NoExceptionLinkedQueue(); 27 public ChannelID channelID; 28 public List lockContexts = new ArrayList (); 29 public List pendingLockContexts = new ArrayList (); 30 public boolean isChangeListener; 31 public boolean requestedObjectIDs; 32 public NoExceptionLinkedQueue setTransactionSequenceIDsCalls = new NoExceptionLinkedQueue(); 33 public NoExceptionLinkedQueue setTransactionIDsCalls = new NoExceptionLinkedQueue(); 34 public Collection transactionSequenceIDs = new ArrayList (); 35 public Collection transactionIDs = new ArrayList (); 36 private TestMessageChannel channel; 37 38 public void addObjectID(ObjectID id) { 39 clientObjectIds.add(id); 40 } 41 42 public void send() { 43 sendCalls.put(new Object ()); 44 } 45 46 public MessageChannel getChannel() { 47 synchronized (this) { 48 if (channel == null) { 49 channel = new TestMessageChannel(); 50 channel.channelID = channelID; 51 } 52 53 return channel; 54 } 55 } 56 57 public ChannelID getChannelID() { 58 return this.channelID; 59 } 60 61 public Set getObjectIDs() { 62 return clientObjectIds; 63 } 64 65 public int getCorrelationId(boolean initialize) { 66 throw new ImplementMe(); 67 } 68 69 public void setCorrelationId(int id) { 70 throw new ImplementMe(); 71 } 72 73 public TCMessageType getMessageType() { 74 throw new ImplementMe(); 75 } 76 77 public void hydrate() { 78 } 80 81 public void dehydrate() { 82 } 84 85 public int getTotalLength() { 86 return 0; 88 } 89 90 public void addLockContext(LockContext ctxt) { 91 this.lockContexts.add(ctxt); 92 } 93 94 public Collection getLockContexts() { 95 return this.lockContexts; 96 } 97 98 public Collection getWaitContexts() { 99 return this.waitContexts; 100 } 101 102 public void addWaitContext(WaitContext ctxt) { 103 this.waitContexts.add(ctxt); 104 } 105 106 public void resend() { 107 throw new ImplementMe(); 108 109 } 110 111 public void addPendingLockContext(LockContext ctxt) { 112 this.pendingLockContexts.add(ctxt); 113 } 114 115 public Collection getPendingLockContexts() { 116 return pendingLockContexts; 117 } 118 119 public Collection getTransactionSequenceIDs() { 120 return this.transactionSequenceIDs; 121 } 122 123 public void setTransactionSequenceIDs(Collection transactionSequenceIDs) { 124 this.transactionSequenceIDs = transactionSequenceIDs; 125 this.setTransactionSequenceIDsCalls.put(transactionSequenceIDs); 126 } 127 128 public void setResentTransactionIDs(Collection resentTransactionIDs) { 129 this.transactionIDs = resentTransactionIDs; 130 this.setTransactionIDsCalls.put(resentTransactionIDs); 131 132 } 133 134 public Collection getResentTransactionIDs() { 135 return transactionIDs; 136 } 137 138 public void setIsObjectIDsRequested(boolean request) { 139 this.requestedObjectIDs = request; 140 } 141 142 public boolean isObjectIDsRequested() { 143 return requestedObjectIDs; 144 } 145 } 146 | Popular Tags |