KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > petals > jbi > transport > mock > MockJoramQueue


1 /**
2  * PETALS - PETALS Services Platform.
3  * Copyright (c) 2005 EBM Websourcing, http://www.ebmwebsourcing.com/
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * -------------------------------------------------------------------------
19  * $Id: MockJoramQueue.java 2:19:23 PM ddesjardins $
20  * -------------------------------------------------------------------------
21  */

22 package org.objectweb.petals.jbi.transport.mock;
23
24 import javax.jbi.JBIException;
25 import javax.jms.JMSException JavaDoc;
26 import javax.jms.MessageListener JavaDoc;
27 import javax.naming.InitialContext JavaDoc;
28
29 import org.easymock.classextension.EasyMock;
30 import org.objectweb.petals.jbi.transport.JoramConnection;
31
32 /**
33  * Mock object of the JoramConnection
34  *
35  * @author ddesjardins - eBMWebsourcing
36  */

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 JavaDoc.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 JavaDoc aML) throws JMSException JavaDoc {
85         if (throwException) {
86             throw new JMSException JavaDoc("error");
87         }
88         startListening = true;
89     }
90
91     public void stopListening() throws JMSException JavaDoc {
92         stopListening = true;
93     }
94
95     public void unbindQueue() throws JBIException {
96         unbindQueue = true;
97     }
98
99 }
100
Popular Tags