KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > cache > optimistic > OptimisticReplicationInterceptorTest


1 /*
2  * Created on 17-Feb-2005
3  *
4  *
5  *
6  */

7 package org.jboss.cache.optimistic;
8
9 import org.jboss.cache.CacheImpl;
10 import org.jboss.cache.GlobalTransaction;
11 import org.jboss.cache.OptimisticTransactionEntry;
12 import org.jboss.cache.TransactionTable;
13 import org.jboss.cache.config.Configuration;
14 import org.jboss.cache.loader.SamplePojo;
15 import org.jboss.cache.marshall.MethodCall;
16 import org.jboss.cache.marshall.MethodCallFactory;
17 import org.jboss.cache.marshall.MethodDeclarations;
18 import org.jboss.cache.transaction.DummyTransactionManager;
19 import org.jgroups.Address;
20
21 import javax.transaction.RollbackException JavaDoc;
22 import javax.transaction.Transaction JavaDoc;
23 import java.io.DataInputStream JavaDoc;
24 import java.io.DataOutputStream JavaDoc;
25 import java.io.ObjectInput JavaDoc;
26 import java.io.ObjectOutput JavaDoc;
27 import java.util.ArrayList JavaDoc;
28 import java.util.List JavaDoc;
29
30 /**
31  * @author xenephon
32  */

33 public class OptimisticReplicationInterceptorTest extends AbstractOptimisticTestCase
34 {
35    private CacheImpl cache;
36
37    /**
38     * @param name
39     */

40    public OptimisticReplicationInterceptorTest(String JavaDoc name)
41    {
42       super(name);
43    }
44
45    protected void setUp() throws Exception JavaDoc
46    {
47       super.setUp();
48       cache = createCache();
49    }
50
51    protected void tearDown()
52    {
53       super.tearDown();
54       destroyCache(cache);
55    }
56
57    public void testLocalTransaction() throws Exception JavaDoc
58    {
59       MockInterceptor dummy = new MockInterceptor();
60       dummy.setCache(cache);
61
62       cache.setInterceptorChain(getAlteredInterceptorChain(dummy, cache, true));
63
64       DummyTransactionManager mgr = DummyTransactionManager.getInstance();
65       assertNull(mgr.getTransaction());
66
67       mgr.begin();
68
69       assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
70       assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
71
72       SamplePojo pojo = new SamplePojo(21, "test");
73
74       cache.put("/one/two", "key1", pojo);
75
76       mgr.commit();
77
78       assertNull(mgr.getTransaction());
79       assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
80       assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
81
82       //make sure all calls were done in right order
83

84       List JavaDoc calls = dummy.getAllCalled();
85
86       assertEquals(MethodDeclarations.optimisticPrepareMethod, calls.get(0));
87       assertEquals(MethodDeclarations.commitMethod, calls.get(1));
88    }
89
90    public void testRollbackTransaction() throws Exception JavaDoc
91    {
92       MockInterceptor dummy = new MockInterceptor();
93       dummy.setCache(cache);
94
95       cache.setInterceptorChain(getAlteredInterceptorChain(dummy, cache, true));
96
97       DummyTransactionManager mgr = DummyTransactionManager.getInstance();
98       assertNull(mgr.getTransaction());
99       assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
100       assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
101
102       SamplePojo pojo = new SamplePojo(21, "test");
103       mgr.begin();
104       cache.put("/one/two", "key1", pojo);
105       mgr.rollback();
106       assertNull(mgr.getTransaction());
107       assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
108       assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
109
110       //make sure all calls were done in right order
111

112       List JavaDoc calls = dummy.getAllCalled();
113
114       assertEquals(1, calls.size());
115       assertEquals(MethodDeclarations.rollbackMethod, calls.get(0));
116    }
117
118    public void testRemotePrepareTransaction() throws Exception JavaDoc
119    {
120       MockInterceptor dummy = new MockInterceptor();
121       dummy.setCache(cache);
122
123       cache.setInterceptorChain(getAlteredInterceptorChain(dummy, cache, true));
124
125       DummyTransactionManager mgr = DummyTransactionManager.getInstance();
126
127       //start local transaction
128
mgr.begin();
129       Transaction tx = mgr.getTransaction();
130
131       //this sets
132
cache.getCurrentTransaction(tx);
133
134       SamplePojo pojo = new SamplePojo(21, "test");
135
136       cache.put("/one/two", "key1", pojo);
137
138       GlobalTransaction gtx = cache.getCurrentTransaction(tx);
139       TransactionTable table = cache.getTransactionTable();
140       OptimisticTransactionEntry entry = (OptimisticTransactionEntry) table.get(gtx);
141       assertNotNull(mgr.getTransaction());
142       mgr.commit();
143
144
145       GlobalTransaction remoteGtx = new GlobalTransaction();
146
147       remoteGtx.setAddress(new TestAddress());
148       //hack the method call to make it have the remote gtx
149
MethodCall meth = entry.getModifications().get(0);
150
151       meth.getArgs()[0] = remoteGtx;
152       //call our remote method
153
MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod, remoteGtx, injectDataVersion(entry.getModifications()), null, remoteGtx.getAddress(), false);
154       try
155       {
156          cache._replicate(prepareMethod);
157       }
158       catch (Throwable JavaDoc t)
159       {
160          fail();
161       }
162
163       //our thread should be null
164
assertNull(mgr.getTransaction());
165
166       // there should be a registration for the remote gtx
167
assertNotNull(table.get(remoteGtx));
168       assertNotNull(table.getLocalTransaction(remoteGtx));
169       //assert that this is populated
170
assertEquals(1, table.get(remoteGtx).getModifications().size());
171
172       //assert that the remote prepare has populated the local workspace
173
OptimisticTransactionEntry opEntry = (OptimisticTransactionEntry) table.get(gtx);
174
175       assertEquals(3, entry.getTransactionWorkSpace().getNodes().size());
176       assertEquals(1, entry.getModifications().size());
177       List JavaDoc calls = dummy.getAllCalled();
178       assertEquals(MethodDeclarations.optimisticPrepareMethod, calls.get(2));
179
180
181       assertEquals(1, cache.getTransactionTable().getNumGlobalTransactions());
182       assertEquals(1, cache.getTransactionTable().getNumLocalTransactions());
183
184    }
185
186
187    public void testRemoteRollbackTransaction() throws Exception JavaDoc
188    {
189       MockInterceptor dummy = new MockInterceptor();
190       dummy.setCache(cache);
191
192       cache.setInterceptorChain(getAlteredInterceptorChain(dummy, cache, true));
193
194       DummyTransactionManager mgr = DummyTransactionManager.getInstance();
195
196       //start local transaction
197
mgr.begin();
198       Transaction tx = mgr.getTransaction();
199
200       //this sets
201
cache.getCurrentTransaction(tx);
202
203       SamplePojo pojo = new SamplePojo(21, "test");
204
205       cache.put("/one/two", "key1", pojo);
206
207       GlobalTransaction gtx = cache.getCurrentTransaction(tx);
208       TransactionTable table = cache.getTransactionTable();
209       OptimisticTransactionEntry entry = (OptimisticTransactionEntry) table.get(gtx);
210       assertNotNull(mgr.getTransaction());
211       mgr.commit();
212
213
214       GlobalTransaction remoteGtx = new GlobalTransaction();
215
216       remoteGtx.setAddress(new TestAddress());
217       //hack the method call to make it have the remote gtx
218
MethodCall meth = entry.getModifications().get(0);
219
220       meth.getArgs()[0] = remoteGtx;
221       //call our remote method
222
MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod, remoteGtx, injectDataVersion(entry.getModifications()), null, remoteGtx.getAddress(), false);
223       try
224       {
225          cache._replicate(prepareMethod);
226       }
227       catch (Throwable JavaDoc t)
228       {
229          fail();
230       }
231
232       //our thread should be null
233
assertNull(mgr.getTransaction());
234
235       // there should be a registration for the remote gtx
236
assertNotNull(table.get(remoteGtx));
237       assertNotNull(table.getLocalTransaction(remoteGtx));
238       //assert that this is populated
239
assertEquals(1, table.get(remoteGtx).getModifications().size());
240
241       //assert that the remote prepare has populated the local workspace
242
OptimisticTransactionEntry opEntry = (OptimisticTransactionEntry) table.get(gtx);
243
244       assertEquals(3, entry.getTransactionWorkSpace().getNodes().size());
245       assertEquals(1, entry.getModifications().size());
246       List JavaDoc calls = dummy.getAllCalled();
247       assertEquals(MethodDeclarations.optimisticPrepareMethod, calls.get(2));
248
249
250       assertEquals(1, cache.getTransactionTable().getNumGlobalTransactions());
251       assertEquals(1, cache.getTransactionTable().getNumLocalTransactions());
252
253       // call our remote method
254
MethodCall rollbackMethod = MethodCallFactory.create(MethodDeclarations.rollbackMethod, remoteGtx);
255       try
256       {
257          cache._replicate(rollbackMethod);
258       }
259       catch (Throwable JavaDoc t)
260       {
261          fail();
262       }
263       //we should have the commit as well now
264
assertNull(mgr.getTransaction());
265       assertEquals(MethodDeclarations.rollbackMethod, calls.get(3));
266       assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
267       assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
268    }
269
270
271    public void testRemoteCommitNoPrepareTransaction() throws Exception JavaDoc
272    {
273       MockInterceptor dummy = new MockInterceptor();
274       dummy.setCache(cache);
275
276       cache.setInterceptorChain(getAlteredInterceptorChain(dummy, cache, true));
277
278       DummyTransactionManager mgr = DummyTransactionManager.getInstance();
279
280       //start local transaction
281
mgr.begin();
282       Transaction tx = mgr.getTransaction();
283
284       //this sets
285
cache.getCurrentTransaction(tx);
286
287       SamplePojo pojo = new SamplePojo(21, "test");
288
289       cache.put("/one/two", "key1", pojo);
290
291       GlobalTransaction gtx = cache.getCurrentTransaction(tx);
292       TransactionTable table = cache.getTransactionTable();
293       OptimisticTransactionEntry entry = (OptimisticTransactionEntry) table.get(gtx);
294       assertNotNull(mgr.getTransaction());
295       mgr.commit();
296
297
298       GlobalTransaction remoteGtx = new GlobalTransaction();
299
300       remoteGtx.setAddress(new TestAddress());
301       //hack the method call to make it have the remote gtx
302
MethodCall meth = entry.getModifications().get(0);
303
304       meth.getArgs()[0] = remoteGtx;
305
306
307       List JavaDoc calls = dummy.getAllCalled();
308       assertEquals(2, calls.size());
309
310
311       assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
312       assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
313
314       // call our remote method
315
MethodCall commitMethod = MethodCallFactory.create(MethodDeclarations.commitMethod, remoteGtx);
316       try
317       {
318          cache._replicate(commitMethod);
319          fail();
320       }
321       catch (Throwable JavaDoc t)
322       {
323          assertTrue(t instanceof RuntimeException JavaDoc);
324          //t.printStackTrace();
325
}
326       //we should have the commit as well now
327
assertNull(mgr.getTransaction());
328       assertEquals(2, calls.size());
329       assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
330       assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
331    }
332
333
334    public void testRemoteRollbackNoPrepareTransaction() throws Throwable JavaDoc
335    {
336       MockInterceptor dummy = new MockInterceptor();
337       dummy.setCache(cache);
338
339       cache.setInterceptorChain(getAlteredInterceptorChain(dummy, cache, true));
340
341       DummyTransactionManager mgr = DummyTransactionManager.getInstance();
342
343       //start local transaction
344
mgr.begin();
345       Transaction tx = mgr.getTransaction();
346
347       //this sets
348
cache.getCurrentTransaction(tx);
349
350       SamplePojo pojo = new SamplePojo(21, "test");
351
352       cache.put("/one/two", "key1", pojo);
353
354       GlobalTransaction gtx = cache.getCurrentTransaction(tx);
355       TransactionTable table = cache.getTransactionTable();
356       OptimisticTransactionEntry entry = (OptimisticTransactionEntry) table.get(gtx);
357       assertNotNull(mgr.getTransaction());
358       mgr.commit();
359
360
361       GlobalTransaction remoteGtx = new GlobalTransaction();
362
363       remoteGtx.setAddress(new TestAddress());
364       //hack the method call to make it have the remote gtx
365
MethodCall meth = entry.getModifications().get(0);
366
367       meth.getArgs()[0] = remoteGtx;
368
369
370       List JavaDoc calls = dummy.getAllCalled();
371       assertEquals(2, calls.size());
372
373
374       assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
375       assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
376
377       // call our remote method
378
MethodCall rollbackMethod = MethodCallFactory.create(MethodDeclarations.rollbackMethod, remoteGtx);
379
380       cache._replicate(rollbackMethod);
381       assertTrue("Should be handled on the remote end without barfing, in the event of a rollback without a prepare", true);
382
383       //we should have the commit as well now
384
assertNull(mgr.getTransaction());
385       assertEquals(2, calls.size());
386       assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
387       assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
388    }
389
390
391    public void testRemoteCommitTransaction() throws Exception JavaDoc
392    {
393       MockInterceptor dummy = new MockInterceptor();
394       dummy.setCache(cache);
395
396       cache.setInterceptorChain(getAlteredInterceptorChain(dummy, cache, true));
397
398       DummyTransactionManager mgr = DummyTransactionManager.getInstance();
399
400       //start local transaction
401
mgr.begin();
402       Transaction tx = mgr.getTransaction();
403
404       //this sets
405
cache.getCurrentTransaction(tx);
406
407       SamplePojo pojo = new SamplePojo(21, "test");
408
409       cache.put("/one/two", "key1", pojo);
410
411       GlobalTransaction gtx = cache.getCurrentTransaction(tx);
412       TransactionTable table = cache.getTransactionTable();
413       OptimisticTransactionEntry entry = (OptimisticTransactionEntry) table.get(gtx);
414       assertNotNull(mgr.getTransaction());
415       mgr.commit();
416
417
418       GlobalTransaction remoteGtx = new GlobalTransaction();
419
420       remoteGtx.setAddress(new TestAddress());
421       //hack the method call to make it have the remote gtx
422
MethodCall meth = entry.getModifications().get(0);
423
424       meth.getArgs()[0] = remoteGtx;
425       //call our remote method
426
MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod, remoteGtx, injectDataVersion(entry.getModifications()), null, remoteGtx.getAddress(), false);
427       try
428       {
429          cache._replicate(prepareMethod);
430       }
431       catch (Throwable JavaDoc t)
432       {
433          fail();
434       }
435
436       //our thread should be null
437
assertNull(mgr.getTransaction());
438
439       // there should be a registration for the remote gtx
440
assertNotNull(table.get(remoteGtx));
441       assertNotNull(table.getLocalTransaction(remoteGtx));
442       //assert that this is populated
443
assertEquals(1, table.get(remoteGtx).getModifications().size());
444
445       //assert that the remote prepare has populated the local workspace
446
OptimisticTransactionEntry opEntry = (OptimisticTransactionEntry) table.get(gtx);
447
448       assertEquals(3, entry.getTransactionWorkSpace().getNodes().size());
449       assertEquals(1, entry.getModifications().size());
450       List JavaDoc calls = dummy.getAllCalled();
451       assertEquals(MethodDeclarations.optimisticPrepareMethod, calls.get(2));
452
453
454       assertEquals(1, cache.getTransactionTable().getNumGlobalTransactions());
455       assertEquals(1, cache.getTransactionTable().getNumLocalTransactions());
456
457       // call our remote method
458
MethodCall commitMethod = MethodCallFactory.create(MethodDeclarations.commitMethod, remoteGtx);
459       try
460       {
461          cache._replicate(commitMethod);
462       }
463       catch (Throwable JavaDoc t)
464       {
465          fail();
466       }
467       //we should have the commit as well now
468
assertNull(mgr.getTransaction());
469       assertEquals(MethodDeclarations.commitMethod, calls.get(3));
470       assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
471       assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
472    }
473
474
475    public void testTwoWayRemoteCacheBroadcast() throws Exception JavaDoc
476    {
477       destroyCache(cache);
478       cache = createReplicatedCache(Configuration.CacheMode.REPL_SYNC);
479
480       MockInterceptor dummy = new MockInterceptor();
481       dummy.setCache(cache);
482
483       cache.setInterceptorChain(getAlteredInterceptorChain(dummy, cache, true));
484
485       CacheImpl cache2 = createReplicatedCache(Configuration.CacheMode.REPL_SYNC);
486       MockInterceptor dummy2 = new MockInterceptor();
487       dummy.setCache(cache2);
488
489       cache2.setInterceptorChain(getAlteredInterceptorChain(dummy2, cache2, true));
490
491       DummyTransactionManager mgr = DummyTransactionManager.getInstance();
492
493       //start local transaction
494
mgr.begin();
495       Transaction tx = mgr.getTransaction();
496
497       //this sets
498
cache.getCurrentTransaction(tx);
499
500       SamplePojo pojo = new SamplePojo(21, "test");
501
502       cache.put("/one/two", "key1", pojo);
503
504       GlobalTransaction gtx = cache.getCurrentTransaction(tx);
505       TransactionTable table = cache.getTransactionTable();
506       OptimisticTransactionEntry entry = (OptimisticTransactionEntry) table.get(gtx);
507       assertNotNull(mgr.getTransaction());
508       mgr.commit();
509
510
511       assertNull(mgr.getTransaction());
512
513       //assert that the local cache is in the right state
514
assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
515       assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
516
517
518       assertEquals(0, cache2.getTransactionTable().getNumGlobalTransactions());
519       assertEquals(0, cache2.getTransactionTable().getNumLocalTransactions());
520
521
522       List JavaDoc calls = dummy.getAllCalled();
523       assertEquals(MethodDeclarations.optimisticPrepareMethod, calls.get(0));
524       assertEquals(MethodDeclarations.commitMethod, calls.get(1));
525
526       List JavaDoc calls2 = dummy2.getAllCalled();
527       assertEquals(MethodDeclarations.optimisticPrepareMethod, calls2.get(0));
528       assertEquals(MethodDeclarations.commitMethod, calls2.get(1));
529
530       destroyCache(cache2);
531    }
532
533
534    public void testFailurePrepareRemoteCacheBroadcast() throws Exception JavaDoc
535    {
536       destroyCache(cache);
537       cache = createReplicatedCache(Configuration.CacheMode.REPL_SYNC);
538
539       MockInterceptor dummy = new MockInterceptor();
540       dummy.setCache(cache);
541
542       cache.setInterceptorChain(getAlteredInterceptorChain(dummy, cache, true));
543
544       CacheImpl cache2 = createReplicatedCache(Configuration.CacheMode.REPL_SYNC);
545       MockFailureInterceptor dummy2 = new MockFailureInterceptor();
546       List JavaDoc failures = new ArrayList JavaDoc();
547       failures.add(MethodDeclarations.optimisticPrepareMethod);
548       dummy2.setFailurelist(failures);
549       dummy.setCache(cache2);
550
551       cache2.setInterceptorChain(getAlteredInterceptorChain(dummy2, cache2, true));
552
553       DummyTransactionManager mgr = DummyTransactionManager.getInstance();
554
555       //start local transaction
556
mgr.begin();
557       Transaction tx = mgr.getTransaction();
558
559       //this sets
560
cache.getCurrentTransaction(tx);
561
562       SamplePojo pojo = new SamplePojo(21, "test");
563
564       cache.put("/one/two", "key1", pojo);
565
566       GlobalTransaction gtx = cache.getCurrentTransaction(tx);
567       TransactionTable table = cache.getTransactionTable();
568       OptimisticTransactionEntry entry = (OptimisticTransactionEntry) table.get(gtx);
569       assertNotNull(mgr.getTransaction());
570       try
571       {
572          mgr.commit();
573       }
574       catch (Exception JavaDoc e)
575       {
576          assertTrue(e instanceof RollbackException JavaDoc);
577       }
578
579
580       assertNull(mgr.getTransaction());
581
582       //assert that the local cache is in the right state
583
assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
584       assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
585
586
587       assertEquals(0, cache2.getTransactionTable().getNumGlobalTransactions());
588       assertEquals(0, cache2.getTransactionTable().getNumLocalTransactions());
589
590
591       List JavaDoc calls = dummy.getAllCalled();
592       assertEquals(MethodDeclarations.optimisticPrepareMethod, calls.get(0));
593       assertEquals(MethodDeclarations.rollbackMethod, calls.get(1));
594
595       //we have no prepare - as it failed - but we have a commit
596
List JavaDoc calls2 = dummy2.getAllCalled();
597       assertEquals(MethodDeclarations.rollbackMethod, calls2.get(0));
598
599       destroyCache(cache2);
600    }
601
602
603    public void testFailurePrepareLocalCacheBroadcast() throws Exception JavaDoc
604    {
605
606       destroyCache(cache);
607       cache = createReplicatedCache(Configuration.CacheMode.REPL_SYNC);
608
609       MockFailureInterceptor dummy = new MockFailureInterceptor();
610       dummy.setCache(cache);
611
612       cache.setInterceptorChain(getAlteredInterceptorChain(dummy, cache, true));
613
614       CacheImpl cache2 = createReplicatedCache(Configuration.CacheMode.REPL_SYNC);
615       MockInterceptor dummy2 = new MockInterceptor();
616       dummy.setCache(cache2);
617
618       cache2.setInterceptorChain(getAlteredInterceptorChain(dummy2, cache2, true));
619
620       List JavaDoc failures = new ArrayList JavaDoc();
621       failures.add(MethodDeclarations.optimisticPrepareMethod);
622       dummy.setFailurelist(failures);
623
624       DummyTransactionManager mgr = DummyTransactionManager.getInstance();
625
626       //start local transaction
627
mgr.begin();
628       Transaction tx = mgr.getTransaction();
629
630       //this sets
631
cache.getCurrentTransaction(tx);
632
633       SamplePojo pojo = new SamplePojo(21, "test");
634
635       cache.put("/one/two", "key1", pojo);
636
637       GlobalTransaction gtx = cache.getCurrentTransaction(tx);
638       TransactionTable table = cache.getTransactionTable();
639       OptimisticTransactionEntry entry = (OptimisticTransactionEntry) table.get(gtx);
640       assertNotNull(mgr.getTransaction());
641       try
642       {
643          mgr.commit();
644       }
645       catch (Exception JavaDoc e)
646       {
647          assertTrue(e instanceof RollbackException JavaDoc);
648       }
649
650
651       assertNull(mgr.getTransaction());
652
653       //assert that the local cache is in the right state
654
assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
655       assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
656
657
658       assertEquals(0, cache2.getTransactionTable().getNumGlobalTransactions());
659       assertEquals(0, cache2.getTransactionTable().getNumLocalTransactions());
660
661
662       List JavaDoc calls = dummy.getAllCalled();
663       assertEquals(MethodDeclarations.rollbackMethod, calls.get(0));
664
665       //we have no prepare - as it failed - but we have a commit
666
List JavaDoc calls2 = dummy2.getAllCalled();
667       assertEquals(0, calls2.size());
668
669       destroyCache(cache2);
670    }
671
672    static class TestAddress implements Address
673    {
674       public boolean isMulticastAddress()
675       {
676          return false;
677       }
678
679       public void readExternal(ObjectInput JavaDoc arg0)
680       {
681       }
682
683       public int size()
684       {
685          return 0;
686       }
687
688       public void writeExternal(ObjectOutput JavaDoc arg0)
689       {
690       }
691
692       public void writeTo(DataOutputStream JavaDoc arg0)
693       {
694       }
695
696       public void readFrom(DataInputStream JavaDoc arg0)
697       {
698       }
699
700       public int compareTo(Object JavaDoc arg0)
701       {
702          return 0;
703       }
704    }
705
706 }
707
Popular Tags