Author: timfox
Date: 2010-05-12 03:52:19 -0400 (Wed, 12 May 2010)
New Revision: 9229
Modified:
trunk/tests/src/org/hornetq/tests/integration/client/ConsumerWindowSizeTest.java
Log:
https://jira.jboss.org/jira/browse/HORNETQ-385
Modified:
trunk/tests/src/org/hornetq/tests/integration/client/ConsumerWindowSizeTest.java
===================================================================
---
trunk/tests/src/org/hornetq/tests/integration/client/ConsumerWindowSizeTest.java 2010-05-11
23:40:00 UTC (rev 9228)
+++
trunk/tests/src/org/hornetq/tests/integration/client/ConsumerWindowSizeTest.java 2010-05-12
07:52:19 UTC (rev 9229)
@@ -73,7 +73,7 @@
//
https://jira.jboss.org/jira/browse/HORNETQ-385
- public void disabled_testNoCacheWithReceiveImmediate() throws Exception
+ public void disabled_testReceiveImmediateWithZeroWindow() throws Exception
{
HornetQServer server = createServer(false, isNetty());
try
@@ -137,7 +137,7 @@
}
//
https://jira.jboss.org/jira/browse/HORNETQ-385
- public void disabled_testNoCacheWithReceiveImmediate2() throws Exception
+ public void disabled_testReceiveImmediateWithZeroWindow2() throws Exception
{
HornetQServer server = createServer(true);
@@ -190,7 +190,134 @@
}
}
+ //
https://jira.jboss.org/jira/browse/HORNETQ-385
+ public void disabled_testReceiveImmediateWithZeroWindow3() throws Exception
+ {
+ HornetQServer server = createServer(false, isNetty());
+ try
+ {
+ server.start();
+
+ ClientSessionFactory sf = createFactory(isNetty());
+
+ sf.setConsumerWindowSize(0);
+
+ ClientSession session = sf.createSession(false, false, false);
+ session.createQueue("testWindow", "testWindow", true);
+ session.close();
+
+ int numConsumers = 5;
+
+ ArrayList<ClientConsumer> consumers = new
ArrayList<ClientConsumer>();
+ ArrayList<ClientSession> sessions = new ArrayList<ClientSession>();
+ for (int i = 0; i < numConsumers; i++)
+ {
+ System.out.println("created: " + i);
+ ClientSession session1 = sf.createSession();
+ ClientConsumer consumer = session1.createConsumer("testWindow");
+ consumers.add(consumer);
+ session1.start();
+ sessions.add(session1);
+ consumer.receive(10);
+
+ }
+
+ ClientSession senderSession = sf.createSession(false, false);
+
+ ClientProducer producer = senderSession.createProducer("testWindow");
+
+ ClientMessage sent = senderSession.createMessage(true);
+ sent.putStringProperty("hello", "world");
+
+ producer.send(sent);
+
+ senderSession.commit();
+
+ senderSession.start();
+
+ ClientConsumer consumer = consumers.get(2);
+ ClientMessage received = consumer.receive(1000);
+ assertNotNull(received);
+
+ for (ClientSession tmpSess : sessions)
+ {
+ tmpSess.close();
+ }
+
+ senderSession.close();
+
+ }
+ finally
+ {
+ server.stop();
+ }
+
+ }
+ public void disabled_testReceiveImmediateWithZeroWindow4() throws Exception
+ {
+ HornetQServer server = createServer(false, isNetty());
+ try
+ {
+ server.start();
+
+ ClientSessionFactory sf = createFactory(isNetty());
+
+ sf.setConsumerWindowSize(0);
+
+ ClientSession session = sf.createSession(false, false, false);
+ session.createQueue("testWindow", "testWindow", true);
+ session.close();
+
+ int numConsumers = 5;
+
+ ArrayList<ClientConsumer> consumers = new
ArrayList<ClientConsumer>();
+ ArrayList<ClientSession> sessions = new ArrayList<ClientSession>();
+ for (int i = 0; i < numConsumers; i++)
+ {
+ System.out.println("created: " + i);
+ ClientSession session1 = sf.createSession();
+ ClientConsumer consumer = session1.createConsumer("testWindow");
+ consumers.add(consumer);
+ session1.start();
+ sessions.add(session1);
+ consumer.receive(10);
+
+ }
+
+ ClientSession senderSession = sf.createSession(false, false);
+
+ ClientProducer producer = senderSession.createProducer("testWindow");
+
+ ClientMessage sent = senderSession.createMessage(true);
+ sent.putStringProperty("hello", "world");
+
+ producer.send(sent);
+
+ senderSession.commit();
+
+ senderSession.start();
+
+ ClientConsumer consumer = consumers.get(2);
+ ClientMessage received = consumer.receiveImmediate();
+ assertNotNull(received);
+
+ for (ClientSession tmpSess : sessions)
+ {
+ tmpSess.close();
+ }
+
+ senderSession.close();
+
+ }
+ finally
+ {
+ server.stop();
+ }
+
+ }
+
+
/*
* tests send window size. we do this by having 2 receivers on the q. since we
roundrobin the consumer for delivery we
* know if consumer 1 has received n messages then consumer 2 must have also have
received n messages or at least up