1 4 package com.tc.object.tx; 5 6 import com.tc.exception.ImplementMe; 7 import com.tc.logging.TCLogger; 8 import com.tc.logging.TCLogging; 9 import com.tc.net.protocol.tcm.ChannelIDProvider; 10 import com.tc.object.ObjectID; 11 import com.tc.object.TCObject; 12 import com.tc.object.dmi.DmiDescriptor; 13 import com.tc.object.lockmanager.api.LockID; 14 import com.tc.object.session.SessionID; 15 16 import java.util.ArrayList ; 17 import java.util.Collection ; 18 import java.util.List ; 19 import java.util.Map ; 20 import java.util.Set ; 21 22 25 public class MockTransactionManager implements ClientTransactionManager { 26 27 private static final TCLogger logger = TCLogging.getLogger(MockTransactionManager.class); 28 29 private int commitCount; 30 private List begins = new ArrayList (); 31 32 public void clearBegins() { 33 begins.clear(); 34 } 35 36 public List getBegins() { 37 List rv = new ArrayList (); 38 rv.addAll(begins); 39 return rv; 40 } 41 42 public void begin(String lock, int type) { 43 45 begins.add(new Begin(lock, type)); 46 } 47 48 public void clearCommitCount() { 49 this.commitCount = 0; 50 } 51 52 public int getCommitCount() { 53 return this.commitCount; 54 } 55 56 public void createObject(TCObject source) { 57 throw new ImplementMe(); 58 } 59 60 public void createRoot(String name, ObjectID id) { 61 throw new ImplementMe(); 62 } 63 64 public void fieldChanged(TCObject source, String classname, String fieldname, Object newValue, int index) { 65 throw new ImplementMe(); 66 } 67 68 public void logicalInvoke(TCObject source, int name, String methodName, Object [] parameters) { 69 throw new ImplementMe(); 70 } 71 72 public static class Begin { 73 public String lockName; 74 public int lockType; 75 76 Begin(String name, int type) { 77 this.lockName = name; 78 this.lockType = type; 79 } 80 } 81 82 public void wait(WaitInvocation call, Object object) { 83 throw new ImplementMe(); 84 } 85 86 public void notify(String lockName, boolean all, Object object) throws UnlockedSharedObjectException { 87 throw new ImplementMe(); 88 } 89 90 public void receivedBatchAcknowledgement(TxnBatchID batchID) { 91 throw new ImplementMe(); 92 } 93 94 public void apply(TxnType txType, LockID[] lockIDs, Collection objectChanges, Set lookupObjectIDs, Map newRoots) { 95 throw new ImplementMe(); 96 } 97 98 public void checkWriteAccess(Object context) { 99 } 101 102 public void receivedAcknowledgement(SessionID sessionID, TransactionID requestID) { 103 throw new ImplementMe(); 104 } 105 106 public void addReference(TCObject tco) { 107 throw new ImplementMe(); 108 } 109 110 public ChannelIDProvider getChannelIDProvider() { 111 return null; 112 } 113 114 public boolean isLocked(String lockName) { 115 throw new ImplementMe(); 116 } 117 118 public void commit(String lockName) throws UnlockedSharedObjectException { 119 if (logger.isDebugEnabled()) { 120 logger.debug("commit(lockName)"); 121 } 122 this.commitCount++; 123 } 124 125 public void wait(String lockName, WaitInvocation call, Object object) throws UnlockedSharedObjectException { 126 throw new ImplementMe(); 127 } 128 129 public void lock(String lockName, int lockLevel) { 130 throw new ImplementMe(); 131 } 132 133 public void unlock(String lockName) { 134 throw new ImplementMe(); 135 } 136 137 public int queueLength(String lockName) { 138 throw new ImplementMe(); 139 } 140 141 public int waitLength(String lockName) { 142 throw new ImplementMe(); 143 } 144 145 public ClientTransaction getTransaction() { 146 throw new ImplementMe(); 147 } 148 149 public void disableTransactionLogging() { 150 return; 151 } 152 153 public void enableTransactionLogging() { 154 return; 155 } 156 157 public boolean isTransactionLoggingDisabled() { 158 throw new ImplementMe(); 159 } 160 161 public boolean isHeldByCurrentThread(String lockName, int lockLevel) { 162 throw new ImplementMe(); 163 } 164 165 public boolean tryBegin(String lock, int lockLevel) { 166 throw new ImplementMe(); 167 } 168 169 public void literalValueChanged(TCObject source, Object newValue, Object oldValue) { 170 throw new ImplementMe(); 171 } 172 173 public void arrayChanged(TCObject src, int startPos, Object array, int length) { 174 throw new ImplementMe(); 175 } 176 177 public void addDmiDescriptor(DmiDescriptor d) { 178 throw new ImplementMe(); 179 } 180 } 181 | Popular Tags |