Author: ritchiem
Date: Fri Oct 5 03:44:06 2007
New Revision: 582202
URL: http://svn.apache.org/viewvc?rev=582202&view=rev
Log:
QPID-624 : Forgot to commit updates to test along with
BlockingMethodFrameListener
Modified:
incubator/qpid/branches/M2.1/java/client/src/test/java/org/apache/qpid/test/unit/client/channelclose/ChannelCloseTest.java
Modified:
incubator/qpid/branches/M2.1/java/client/src/test/java/org/apache/qpid/test/unit/client/channelclose/ChannelCloseTest.java
URL:
http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/java/client/src/test/java/org/apache/qpid/test/unit/client/channelclose/ChannelCloseTest.java?rev=582202&r1=582201&r2=582202&view=diff
==============================================================================
---
incubator/qpid/branches/M2.1/java/client/src/test/java/org/apache/qpid/test/unit/client/channelclose/ChannelCloseTest.java
(original)
+++
incubator/qpid/branches/M2.1/java/client/src/test/java/org/apache/qpid/test/unit/client/channelclose/ChannelCloseTest.java
Fri Oct 5 03:44:06 2007
@@ -26,7 +26,10 @@
import org.apache.qpid.AMQTimeoutException;
import org.apache.qpid.client.AMQConnection;
import org.apache.qpid.client.failover.FailoverException;
+import org.apache.qpid.client.failover.FailoverProtectedOperation;
+import org.apache.qpid.client.failover.FailoverRetrySupport;
import org.apache.qpid.client.protocol.AMQProtocolSession;
+import org.apache.qpid.client.protocol.AMQProtocolHandler;
import org.apache.qpid.client.state.AMQStateManager;
import org.apache.qpid.client.transport.TransportConnection;
import org.apache.qpid.framing.AMQFrame;
@@ -60,7 +63,7 @@
Connection _connection;
private String _brokerlist = "vm://:1";
private Session _session;
- private static final long SYNC_TIMEOUT = 500;
+ private static final long SYNC_TIMEOUT = 5000;
private int TEST = 0;
protected void setUp() throws Exception
@@ -287,7 +290,7 @@
TEST++;
_logger.info("Test creating producer which will use channel id 1");
- Queue queue = _session.createQueue("CCT_test_validation_queue" + TEST);
+ Queue queue = _session.createTemporaryQueue();
MessageConsumer consumer = _session.createConsumer(queue);
@@ -311,7 +314,7 @@
connection.setConnectionListener(this);
- _session = connection.createSession(false,
Session.CLIENT_ACKNOWLEDGE);
+ _session = connection.createSession(false,
Session.AUTO_ACKNOWLEDGE);
connection.start();
@@ -332,31 +335,42 @@
return connection;
}
- private void declareExchange(int channelId, String _type, String _name,
boolean nowait)
- throws AMQException, FailoverException
+ private void declareExchange(final int channelId, final String _type,
final String _name, final boolean nowait)
+ throws AMQException, FailoverException
{
- AMQFrame exchangeDeclare =
- ExchangeDeclareBody.createAMQFrame(channelId,
- ((AMQConnection)
_connection).getProtocolHandler().getProtocolMajorVersion(),
- ((AMQConnection)
_connection).getProtocolHandler().getProtocolMinorVersion(), null, // arguments
- false, // autoDelete
- false, // durable
- new AMQShortString(_name), // exchange
- false, // internal
- nowait, // nowait
- true, // passive
- 0, // ticket
- new AMQShortString(_type)); // type
+// new FailoverRetrySupport<Object, AMQException>(new
FailoverProtectedOperation<Object, AMQException>()
+// {
+// public Object execute() throws AMQException, FailoverException
+// {
+
+ AMQProtocolHandler protocolHandler = ((AMQConnection)
_connection).getProtocolHandler();
+
+ AMQFrame exchangeDeclare =
+ ExchangeDeclareBody.createAMQFrame(channelId,
+
protocolHandler.getProtocolMajorVersion(),
+
protocolHandler.getProtocolMinorVersion(), null, // arguments
+ false, // autoDelete
+ false, // durable
+ new
AMQShortString(_name), // exchange
+ false, // internal
+ nowait, // nowait
+ true, // passive
+ 0, // ticket
+ new
AMQShortString(_type)); // type
+
+ if (nowait)
+ {
+ protocolHandler.writeFrame(exchangeDeclare);
+ }
+ else
+ {
+ protocolHandler.syncWrite(exchangeDeclare,
ExchangeDeclareOkBody.class, SYNC_TIMEOUT);
+ }
+
+// return null;
+// }
+// }, (AMQConnection)_connection).execute();
- if (nowait)
- {
- ((AMQConnection)
_connection).getProtocolHandler().writeFrame(exchangeDeclare);
- }
- else
- {
- ((AMQConnection)
_connection).getProtocolHandler().syncWrite(exchangeDeclare,
ExchangeDeclareOkBody.class,
- SYNC_TIMEOUT);
- }
}
private void createChannel(int channelId) throws AMQException,
FailoverException
@@ -375,10 +389,12 @@
}
public void bytesSent(long count)
- { }
+ {
+ }
public void bytesReceived(long count)
- { }
+ {
+ }
public boolean preFailover(boolean redirect)
{
@@ -391,5 +407,6 @@
}
public void failoverComplete()
- { }
+ {
+ }
}