1 22 package org.objectweb.petals.jbi.transport.mock; 23 24 import javax.jbi.JBIException; 25 import javax.jms.JMSException ; 26 import javax.jms.MessageListener ; 27 import javax.naming.InitialContext ; 28 29 import org.easymock.classextension.EasyMock; 30 import org.objectweb.petals.jbi.transport.JoramConnection; 31 32 37 public class MockJoramQueue extends JoramConnection { 38 39 protected boolean startListening; 40 41 protected boolean stopListening; 42 43 protected boolean throwException; 44 45 protected boolean unbindQueue; 46 47 public MockJoramQueue() { 48 super(0, 0, "foo", "bar", "127.0.0.1", EasyMock 49 .createMock(InitialContext .class)); 50 } 51 52 public boolean isStartListening() { 53 return startListening; 54 } 55 56 public boolean isStopListening() { 57 return stopListening; 58 } 59 60 public boolean isThrowException() { 61 return throwException; 62 } 63 64 public boolean isUnbindQueue() { 65 return unbindQueue; 66 } 67 68 public void setStartListening(boolean startListening) { 69 this.startListening = startListening; 70 } 71 72 public void setStopListening(boolean stopListening) { 73 this.stopListening = stopListening; 74 } 75 76 public void setThrowException(boolean throwException) { 77 this.throwException = throwException; 78 } 79 80 public void setUnbindQueue(boolean unbindQueue) { 81 this.unbindQueue = unbindQueue; 82 } 83 84 public void startListening(MessageListener aML) throws JMSException { 85 if (throwException) { 86 throw new JMSException ("error"); 87 } 88 startListening = true; 89 } 90 91 public void stopListening() throws JMSException { 92 stopListening = true; 93 } 94 95 public void unbindQueue() throws JBIException { 96 unbindQueue = true; 97 } 98 99 } 100 | Popular Tags |