001: /*
002: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright
003: * notice. All rights reserved.
004: */
005: package com.tc.object.bytecode;
006:
007: import com.tc.exception.ImplementMe;
008: import com.tc.exception.TCNonPortableObjectError;
009: import com.tc.net.protocol.tcm.ChannelIDProvider;
010: import com.tc.object.BaseDSOTestCase;
011: import com.tc.object.ClientObjectManager;
012: import com.tc.object.ObjectID;
013: import com.tc.object.TCClass;
014: import com.tc.object.TCObject;
015: import com.tc.object.appevent.ApplicationEvent;
016: import com.tc.object.appevent.ApplicationEventContext;
017: import com.tc.object.dmi.DmiDescriptor;
018: import com.tc.object.dna.api.DNA;
019: import com.tc.object.loaders.StandardClassProvider;
020: import com.tc.object.session.SessionID;
021: import com.tc.object.tx.ClientTransaction;
022: import com.tc.object.tx.ClientTransactionManager;
023: import com.tc.object.tx.TransactionID;
024: import com.tc.object.tx.TxnBatchID;
025: import com.tc.object.tx.TxnType;
026: import com.tc.object.tx.UnlockedSharedObjectException;
027: import com.tc.object.tx.WaitInvocation;
028: import com.tc.object.tx.optimistic.OptimisticTransactionManager;
029:
030: import java.lang.ref.ReferenceQueue;
031: import java.lang.ref.WeakReference;
032: import java.util.Collection;
033: import java.util.List;
034: import java.util.Map;
035: import java.util.Set;
036:
037: public class ManagerImplTest extends BaseDSOTestCase {
038:
039: public void testClassAutolocksIgnored() throws Exception {
040: ClientObjectManager objMgr = new ObjMgr();
041: ClientTransactionManager txnMgr = new TxnMgr();
042:
043: Manager manager = new ManagerImpl(false, objMgr, txnMgr, this
044: .configHelper(), new StandardClassProvider(), null);
045:
046: manager.monitorEnter(getClass(), Manager.LOCK_TYPE_WRITE);
047:
048: manager.monitorExit(getClass());
049: }
050:
051: private static class TxnMgr implements ClientTransactionManager {
052:
053: public boolean begin(String lock, int lockLevel) {
054: throw new AssertionError("should not be called");
055: }
056:
057: public void apply(TxnType txType, List lockIDs,
058: Collection objectChanges, Set lookupObjectIDs,
059: Map newRoots) {
060: throw new ImplementMe();
061: }
062:
063: public void createObject(TCObject source) {
064: throw new ImplementMe();
065: }
066:
067: public void createRoot(String name, ObjectID id) {
068: throw new ImplementMe();
069: }
070:
071: public void fieldChanged(TCObject source, String classname,
072: String fieldname, Object newValue, int index) {
073: throw new ImplementMe();
074: }
075:
076: public void logicalInvoke(TCObject source, int method,
077: String methodName, Object[] parameters) {
078: throw new ImplementMe();
079: }
080:
081: public void wait(WaitInvocation call, Object object)
082: throws UnlockedSharedObjectException {
083: throw new ImplementMe();
084: }
085:
086: public void notify(String lockName, boolean all, Object object)
087: throws UnlockedSharedObjectException {
088: throw new ImplementMe();
089: }
090:
091: public void receivedAcknowledgement(SessionID sessionID,
092: TransactionID requestID) {
093: throw new ImplementMe();
094: }
095:
096: public void receivedBatchAcknowledgement(TxnBatchID batchID) {
097: throw new ImplementMe();
098: }
099:
100: public void checkReadAccess(Object context) {
101: throw new ImplementMe();
102: }
103:
104: public void checkWriteAccess(Object context) {
105: throw new ImplementMe();
106: }
107:
108: public void addReference(TCObject tco) {
109: throw new ImplementMe();
110: }
111:
112: public ChannelIDProvider getChannelIDProvider() {
113: throw new ImplementMe();
114: }
115:
116: public boolean isLocked(String lockName, int lockLevel) {
117: throw new ImplementMe();
118: }
119:
120: public void commit(String lockName)
121: throws UnlockedSharedObjectException {
122: throw new AssertionError("should not be called");
123: }
124:
125: public void wait(String lockName, WaitInvocation call,
126: Object object) throws UnlockedSharedObjectException {
127: throw new ImplementMe();
128:
129: }
130:
131: public void lock(String lockName, int lockLevel) {
132: throw new ImplementMe();
133: }
134:
135: public void unlock(String lockName) {
136: throw new ImplementMe();
137: }
138:
139: public int queueLength(String lockName) {
140: throw new ImplementMe();
141: }
142:
143: public int waitLength(String lockName) {
144: throw new ImplementMe();
145: }
146:
147: public ClientTransaction getTransaction() {
148: throw new ImplementMe();
149: }
150:
151: public void disableTransactionLogging() {
152: throw new ImplementMe();
153: }
154:
155: public void enableTransactionLogging() {
156: throw new ImplementMe();
157: }
158:
159: public boolean isTransactionLoggingDisabled() {
160: throw new ImplementMe();
161: }
162:
163: public boolean isHeldByCurrentThread(String lockName,
164: int lockLevel) {
165: throw new ImplementMe();
166: }
167:
168: public boolean tryBegin(String lock, WaitInvocation timeout,
169: int lockLevel) {
170: throw new ImplementMe();
171: }
172:
173: public void arrayChanged(TCObject src, int startPos,
174: Object array, int length) {
175: throw new ImplementMe();
176: }
177:
178: public void literalValueChanged(TCObject source,
179: Object newValue, Object oldValue) {
180: throw new ImplementMe();
181: }
182:
183: public void addDmiDescriptor(DmiDescriptor d) {
184: throw new ImplementMe();
185: }
186:
187: public int localHeldCount(String lockName, int lockLevel) {
188: throw new ImplementMe();
189: }
190:
191: public boolean isLockOnTopStack(String lockName) {
192: return false;
193: }
194: }
195:
196: private static class ObjMgr implements ClientObjectManager {
197:
198: public Class getClassFor(String className, String loaderDesc) {
199: throw new ImplementMe();
200: }
201:
202: public boolean isManaged(Object pojo) {
203: return false;
204: }
205:
206: public void markReferenced(TCObject tcobj) {
207: throw new ImplementMe();
208: }
209:
210: public boolean isPortableInstance(Object pojo) {
211: throw new ImplementMe();
212: }
213:
214: public boolean isPortableClass(Class clazz) {
215: throw new ImplementMe();
216: }
217:
218: public void checkPortabilityOfField(Object value,
219: String fieldName, Object pojo)
220: throws TCNonPortableObjectError {
221: throw new ImplementMe();
222: }
223:
224: public void checkPortabilityOfLogicalAction(Object[] params,
225: int index, String methodName, Object pojo)
226: throws TCNonPortableObjectError {
227: throw new ImplementMe();
228: }
229:
230: public Object lookupObject(ObjectID id) {
231: throw new ImplementMe();
232: }
233:
234: public Object lookupObject(ObjectID id, ObjectID parentContext) {
235: throw new ImplementMe();
236: }
237:
238: public TCObject lookupOrCreate(Object obj) {
239: throw new ImplementMe();
240: }
241:
242: public ObjectID lookupExistingObjectID(Object obj) {
243: throw new ImplementMe();
244: }
245:
246: public Object lookupRoot(String name) {
247: throw new ImplementMe();
248: }
249:
250: public Object lookupOrCreateRoot(String name, Object obj) {
251: throw new ImplementMe();
252: }
253:
254: public TCObject lookupIfLocal(ObjectID id) {
255: throw new ImplementMe();
256: }
257:
258: public TCObject lookup(ObjectID id) {
259: throw new ImplementMe();
260: }
261:
262: public TCObject lookupExistingOrNull(Object pojo) {
263: return null;
264: }
265:
266: public Collection getAllObjectIDsAndClear(Collection c) {
267: throw new ImplementMe();
268: }
269:
270: public WeakReference createNewPeer(TCClass clazz, DNA dna) {
271: throw new ImplementMe();
272: }
273:
274: public WeakReference createNewPeer(TCClass clazz, int size,
275: ObjectID id, ObjectID parentID) {
276: throw new ImplementMe();
277: }
278:
279: public TCClass getOrCreateClass(Class clazz) {
280: throw new ImplementMe();
281: }
282:
283: public void setTransactionManager(
284: ClientTransactionManager txManager) {
285: throw new ImplementMe();
286: }
287:
288: public ClientTransactionManager getTransactionManager() {
289: throw new ImplementMe();
290: }
291:
292: public ReferenceQueue getReferenceQueue() {
293: throw new ImplementMe();
294: }
295:
296: public void shutdown() {
297: throw new ImplementMe();
298: }
299:
300: public void unpause() {
301: throw new ImplementMe();
302: }
303:
304: public void pause() {
305: throw new ImplementMe();
306: }
307:
308: public void starting() {
309: throw new ImplementMe();
310: }
311:
312: public Object deepCopy(Object source,
313: OptimisticTransactionManager optimisticTxManager) {
314: throw new ImplementMe();
315: }
316:
317: public Object createNewCopyInstance(Object source, Object parent) {
318: throw new ImplementMe();
319: }
320:
321: public Object createParentCopyInstanceIfNecessary(Map visited,
322: Map cloned, Object v) {
323: throw new ImplementMe();
324: }
325:
326: public void replaceRootIDIfNecessary(String rootName,
327: ObjectID newRootID) {
328: throw new ImplementMe();
329:
330: }
331:
332: public Object lookupOrCreateRoot(String name, Object obj,
333: boolean dsoFinal) {
334: throw new ImplementMe();
335: }
336:
337: public TCObject lookupOrShare(Object pojo) {
338: throw new ImplementMe();
339: }
340:
341: public boolean isCreationInProgress() {
342: throw new ImplementMe();
343: }
344:
345: public void addPendingCreateObjectsToTransaction() {
346: throw new ImplementMe();
347:
348: }
349:
350: public boolean hasPendingCreateObjects() {
351: throw new ImplementMe();
352: }
353:
354: public Object lookupObjectNoDepth(ObjectID id) {
355: throw new ImplementMe();
356: }
357:
358: public Object lookupOrCreateRootNoDepth(String rootName,
359: Object object) {
360: throw new ImplementMe();
361: }
362:
363: public Object createOrReplaceRoot(String rootName, Object root) {
364: throw new ImplementMe();
365: }
366:
367: public void storeObjectHierarchy(Object pojo,
368: ApplicationEventContext context) {
369: throw new ImplementMe();
370: }
371:
372: public void sendApplicationEvent(Object pojo,
373: ApplicationEvent event) {
374: throw new ImplementMe();
375: }
376:
377: public Object cloneAndInvokeLogicalOperation(Object pojo,
378: String methodName, Object[] parameters) {
379: throw new ImplementMe();
380: }
381:
382: }
383:
384: }
|