1 22 package org.jboss.test.jbossmq.support; 23 24 import java.util.ArrayList ; 25 26 import org.jboss.mq.ReceiveRequest; 27 import org.jboss.mq.SpyDestination; 28 import org.jboss.mq.il.ClientIL; 29 30 import EDU.oswego.cs.dl.util.concurrent.SynchronizedBoolean; 31 32 38 public class MockClientIL implements ClientIL 39 { 40 public SynchronizedBoolean closed = new SynchronizedBoolean(false); 41 42 public ArrayList deletedDestinations = new ArrayList (); 43 44 public ArrayList pongs = new ArrayList (); 45 46 public ArrayList received = new ArrayList (); 47 48 public void close() throws Exception 49 { 50 closed.set(true); 51 } 52 53 public void deleteTemporaryDestination(SpyDestination dest) throws Exception 54 { 55 deletedDestinations.add(dest); 56 } 57 58 public void pong(long serverTime) throws Exception 59 { 60 pongs.add(new Long (serverTime)); 61 } 62 63 public void receive(ReceiveRequest[] messages) throws Exception 64 { 65 for (int i = 0; i < messages.length; ++i) 66 received.add(messages); 67 } 68 69 public ArrayList getReceivedMessages() 70 { 71 ArrayList result = new ArrayList (); 72 for (int i = 0; i < received.size(); ++i) 73 { 74 ReceiveRequest request = (ReceiveRequest) received.get(i); 75 result.add(request.message); 76 } 77 return result; 78 } 79 } 80 | Popular Tags |