NO-JIRA: just adding a test to avoid future issues
This commit is contained in:
parent
fb75df0c01
commit
9fb28e5651
|
@ -41,6 +41,8 @@ public class PagingReceiveTest extends ActiveMQTestBase {
|
|||
|
||||
private ServerLocator locator;
|
||||
|
||||
private int numMsgs = 500;
|
||||
|
||||
protected boolean isNetty() {
|
||||
return false;
|
||||
}
|
||||
|
@ -48,11 +50,20 @@ public class PagingReceiveTest extends ActiveMQTestBase {
|
|||
@Test
|
||||
public void testReceive() throws Exception {
|
||||
ClientMessage message = receiveMessage();
|
||||
System.out.println("message received:" + message);
|
||||
|
||||
assertNotNull("Message not found.", message);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReceiveThenCheckCounter() throws Exception {
|
||||
|
||||
Queue queue = server.locateQueue(ADDRESS);
|
||||
assertEquals(numMsgs, queue.getMessagesAdded());
|
||||
receiveAllMessages();
|
||||
queue.getPageSubscription().cleanupEntries(true);
|
||||
assertEquals(numMsgs, queue.getMessagesAdded());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
|
@ -85,7 +96,7 @@ public class PagingReceiveTest extends ActiveMQTestBase {
|
|||
|
||||
server.stop();
|
||||
|
||||
internalCreateServer();
|
||||
server = internalCreateServer();
|
||||
|
||||
}
|
||||
|
||||
|
@ -100,6 +111,22 @@ public class PagingReceiveTest extends ActiveMQTestBase {
|
|||
return server;
|
||||
}
|
||||
|
||||
private void receiveAllMessages() throws Exception {
|
||||
final ClientSessionFactory sf = createSessionFactory(locator);
|
||||
ClientSession session = sf.createSession(null, null, false, true, true, false, 0);
|
||||
|
||||
session.start();
|
||||
ClientConsumer consumer = session.createConsumer(ADDRESS);
|
||||
for (int i = 0; i < numMsgs; i++) {
|
||||
ClientMessage message = consumer.receive(2000);
|
||||
assertNotNull(message);
|
||||
message.acknowledge();
|
||||
}
|
||||
|
||||
session.commit();
|
||||
session.close();
|
||||
}
|
||||
|
||||
private ClientMessage receiveMessage() throws Exception {
|
||||
final ClientSessionFactory sf = createSessionFactory(locator);
|
||||
ClientSession session = sf.createSession(null, null, false, true, true, false, 0);
|
||||
|
|
Loading…
Reference in New Issue