diff options
| author | Martin Ritchie <ritchiem@apache.org> | 2010-05-20 15:18:14 +0000 |
|---|---|---|
| committer | Martin Ritchie <ritchiem@apache.org> | 2010-05-20 15:18:14 +0000 |
| commit | 4f641bd0c0deb1eda0524d8b73bc295b160817c4 (patch) | |
| tree | 431a5b621cf4239cedd9748febf7a814d8fae3ac /java/broker/src/test | |
| parent | f708d8b6f4e703802313ef536e8f77547bd9d737 (diff) | |
| download | qpid-python-4f641bd0c0deb1eda0524d8b73bc295b160817c4.tar.gz | |
QPID-1447 : Full test the TopicDeletePolicy, udpate MockAMQQueue and InternalTestProtocolSession to allow:
- Queue- Setting of AutoDelete
- ProtocolSession - Closing
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@946665 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/broker/src/test')
| -rw-r--r-- | java/broker/src/test/java/org/apache/qpid/server/protocol/InternalTestProtocolSession.java | 14 | ||||
| -rw-r--r-- | java/broker/src/test/java/org/apache/qpid/server/queue/MockAMQQueue.java | 35 |
2 files changed, 32 insertions, 17 deletions
diff --git a/java/broker/src/test/java/org/apache/qpid/server/protocol/InternalTestProtocolSession.java b/java/broker/src/test/java/org/apache/qpid/server/protocol/InternalTestProtocolSession.java index 681e513ecb..3b6cd37ea9 100644 --- a/java/broker/src/test/java/org/apache/qpid/server/protocol/InternalTestProtocolSession.java +++ b/java/broker/src/test/java/org/apache/qpid/server/protocol/InternalTestProtocolSession.java @@ -28,10 +28,13 @@ import org.apache.qpid.AMQException; import org.apache.qpid.framing.AMQShortString; import org.apache.qpid.framing.ContentHeaderBody; import org.apache.qpid.framing.abstraction.MessagePublishInfo; +import org.apache.qpid.protocol.AMQConstant; +import org.apache.qpid.server.AMQChannel; import org.apache.qpid.server.output.ProtocolOutputConverter; import org.apache.qpid.server.message.AMQMessage; import org.apache.qpid.server.queue.QueueEntry; import org.apache.qpid.server.registry.ApplicationRegistry; +import org.apache.qpid.server.state.AMQState; import org.apache.qpid.server.virtualhost.VirtualHost; import org.apache.qpid.server.message.MessageContentSource; import org.apache.qpid.transport.TestNetworkDriver; @@ -196,4 +199,15 @@ public class InternalTestProtocolSession extends AMQProtocolEngine implements Pr // The alternative is to fully implement the TestIOSession to return a CloseFuture from close(); // Then the AMQMinaProtocolSession can join on the returning future without a NPE. } + + public void closeSession(AMQSessionModel session, AMQConstant cause, String message) throws AMQException + { + super.closeSession(session, cause, message); + + //Simulate the Client responding with a CloseOK + // should really update the StateManger but we don't have access here + // changeState(AMQState.CONNECTION_CLOSED); + ((AMQChannel)session).getProtocolSession().closeSession(); + + } } diff --git a/java/broker/src/test/java/org/apache/qpid/server/queue/MockAMQQueue.java b/java/broker/src/test/java/org/apache/qpid/server/queue/MockAMQQueue.java index 1314a6e9d3..df92879b2e 100644 --- a/java/broker/src/test/java/org/apache/qpid/server/queue/MockAMQQueue.java +++ b/java/broker/src/test/java/org/apache/qpid/server/queue/MockAMQQueue.java @@ -35,10 +35,12 @@ import org.apache.qpid.server.binding.Binding; import org.apache.qpid.server.txn.ServerTransaction; import org.apache.qpid.AMQException; +import javax.swing.*; import java.util.List; import java.util.Set; import java.util.Map; import java.util.UUID; +import java.util.concurrent.CopyOnWriteArrayList; public class MockAMQQueue implements AMQQueue { @@ -49,6 +51,9 @@ public class MockAMQQueue implements AMQQueue private PrincipalHolder _principalHolder; private AMQSessionModel _exclusiveOwner; + private AMQShortString _owner; + private List<Binding> _bindings = new CopyOnWriteArrayList<Binding>(); + private boolean _autoDelete; public MockAMQQueue(String name) { @@ -66,17 +71,17 @@ public class MockAMQQueue implements AMQQueue public void addBinding(final Binding binding) { - + _bindings.add(binding); } public void removeBinding(final Binding binding) { - + _bindings.remove(binding); } public List<Binding> getBindings() { - return null; + return _bindings; } public int getBindingCount() @@ -171,9 +176,15 @@ public class MockAMQQueue implements AMQQueue public boolean isAutoDelete() { - return false; //To change body of implemented methods use File | Settings | File Templates. + return _autoDelete; } + public void setAutoDelete(boolean autodelete) + { + _autoDelete = autodelete; + } + + public AMQShortString getOwner() { return null; //To change body of implemented methods use File | Settings | File Templates. @@ -194,17 +205,6 @@ public class MockAMQQueue implements AMQQueue return null; //To change body of implemented methods use File | Settings | File Templates. } - public void bind(Exchange exchange, AMQShortString routingKey, FieldTable arguments) throws AMQException - { - //To change body of implemented methods use File | Settings | File Templates. - } - - public void unBind(Exchange exchange, AMQShortString routingKey, FieldTable arguments) throws AMQException - { - //To change body of implemented methods use File | Settings | File Templates. - } - - public void registerSubscription(Subscription subscription, boolean exclusive) throws AMQException { //To change body of implemented methods use File | Settings | File Templates. @@ -271,8 +271,9 @@ public class MockAMQQueue implements AMQQueue } public int delete() throws AMQException - { - return 0; //To change body of implemented methods use File | Settings | File Templates. + { + _deleted = true; + return getMessageCount(); } public void enqueue(ServerMessage message) throws AMQException |
