001: /*
002: * JBoss, Home of Professional Open Source
003: * Copyright 2006, JBoss Inc., and individual contributors as indicated
004: * by the @authors tag. See the copyright.txt in the distribution for a
005: * full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package org.jboss.test.jbossmq.support;
023:
024: import java.io.IOException;
025:
026: import javax.jms.Destination;
027: import javax.jms.Queue;
028: import javax.jms.TemporaryQueue;
029: import javax.jms.TemporaryTopic;
030: import javax.jms.Topic;
031:
032: import org.jboss.mq.AcknowledgementRequest;
033: import org.jboss.mq.ConnectionToken;
034: import org.jboss.mq.DurableSubscriptionID;
035: import org.jboss.mq.SpyDestination;
036: import org.jboss.mq.SpyMessage;
037: import org.jboss.mq.Subscription;
038: import org.jboss.mq.TransactionRequest;
039: import org.jboss.mq.il.ClientIL;
040: import org.jboss.mq.il.ServerIL;
041: import org.jboss.util.id.UID;
042:
043: /**
044: * DummyServerIL.
045: *
046: * @author <a href="adrian@jboss.com">Adrian Brock</a>
047: * @version $Revision: 1.1 $
048: */
049: public class DummyServerIL implements ServerIL {
050: private ClientIL clientIL;
051:
052: private String when = "";
053:
054: public void setThrowError(String when) {
055: this .when = when;
056: }
057:
058: public void setClientIL(ClientIL clientIL) {
059: this .clientIL = clientIL;
060: }
061:
062: public void acknowledge(ConnectionToken dc,
063: AcknowledgementRequest item) throws Exception {
064: throw new org.jboss.util.NotImplementedException("acknowledge");
065: }
066:
067: public void addMessage(ConnectionToken dc, SpyMessage message)
068: throws Exception {
069: throw new org.jboss.util.NotImplementedException("addMessage");
070: }
071:
072: public String authenticate(String userName, String password)
073: throws Exception {
074: return UID.asString();
075: }
076:
077: public SpyMessage[] browse(ConnectionToken dc, Destination dest,
078: String selector) throws Exception {
079: throw new org.jboss.util.NotImplementedException("browse");
080: }
081:
082: public void checkID(String ID) throws Exception {
083: throw new org.jboss.util.NotImplementedException("checkID");
084: }
085:
086: public String checkUser(String userName, String password)
087: throws Exception {
088: throw new org.jboss.util.NotImplementedException("checkUser");
089: }
090:
091: public ServerIL cloneServerIL() throws Exception {
092: return this ;
093: }
094:
095: public void connectionClosing(ConnectionToken dc) throws Exception {
096: throw new org.jboss.util.NotImplementedException(
097: "connectionClosing");
098: }
099:
100: public Queue createQueue(ConnectionToken dc, String dest)
101: throws Exception {
102: throw new org.jboss.util.NotImplementedException("createQueue");
103: }
104:
105: public Topic createTopic(ConnectionToken dc, String dest)
106: throws Exception {
107: throw new org.jboss.util.NotImplementedException("createTopic");
108: }
109:
110: public void deleteTemporaryDestination(ConnectionToken dc,
111: SpyDestination dest) throws Exception {
112: throw new org.jboss.util.NotImplementedException(
113: "deleteTemporaryDestination");
114: }
115:
116: public void destroySubscription(ConnectionToken dc,
117: DurableSubscriptionID id) throws Exception {
118: throw new org.jboss.util.NotImplementedException(
119: "destroySubscription");
120: }
121:
122: public String getID() throws Exception {
123: return UID.asString();
124: }
125:
126: public TemporaryQueue getTemporaryQueue(ConnectionToken dc)
127: throws Exception {
128: throw new org.jboss.util.NotImplementedException(
129: "getTemporaryQueue");
130: }
131:
132: public TemporaryTopic getTemporaryTopic(ConnectionToken dc)
133: throws Exception {
134: throw new org.jboss.util.NotImplementedException(
135: "getTemporaryTopic");
136: }
137:
138: public void ping(ConnectionToken dc, long clientTime)
139: throws Exception {
140: clientIL.pong(clientTime);
141: }
142:
143: public SpyMessage receive(ConnectionToken dc, int subscriberId,
144: long wait) throws Exception {
145: if ("receive".equals(when))
146: throw new IOException("Error in receive");
147: return null;
148: }
149:
150: public void setConnectionToken(ConnectionToken newConnectionToken)
151: throws Exception {
152: // Nothing
153: }
154:
155: public void setEnabled(ConnectionToken dc, boolean enabled)
156: throws Exception {
157: // Nothing
158: }
159:
160: public void subscribe(ConnectionToken dc, Subscription s)
161: throws Exception {
162: // Nothing
163: }
164:
165: public void transact(ConnectionToken dc, TransactionRequest t)
166: throws Exception {
167: throw new org.jboss.util.NotImplementedException("transact");
168:
169: }
170:
171: public void unsubscribe(ConnectionToken dc, int subscriptionId)
172: throws Exception {
173: throw new org.jboss.util.NotImplementedException("unsubscribe");
174: }
175: }
|