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 ServerLocator locator;
|
||||||
|
|
||||||
|
private int numMsgs = 500;
|
||||||
|
|
||||||
protected boolean isNetty() {
|
protected boolean isNetty() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -48,11 +50,20 @@ public class PagingReceiveTest extends ActiveMQTestBase {
|
||||||
@Test
|
@Test
|
||||||
public void testReceive() throws Exception {
|
public void testReceive() throws Exception {
|
||||||
ClientMessage message = receiveMessage();
|
ClientMessage message = receiveMessage();
|
||||||
System.out.println("message received:" + message);
|
|
||||||
|
|
||||||
assertNotNull("Message not found.", 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
|
@Override
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
|
@ -85,7 +96,7 @@ public class PagingReceiveTest extends ActiveMQTestBase {
|
||||||
|
|
||||||
server.stop();
|
server.stop();
|
||||||
|
|
||||||
internalCreateServer();
|
server = internalCreateServer();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,6 +111,22 @@ public class PagingReceiveTest extends ActiveMQTestBase {
|
||||||
return server;
|
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 {
|
private ClientMessage receiveMessage() throws Exception {
|
||||||
final ClientSessionFactory sf = createSessionFactory(locator);
|
final ClientSessionFactory sf = createSessionFactory(locator);
|
||||||
ClientSession session = sf.createSession(null, null, false, true, true, false, 0);
|
ClientSession session = sf.createSession(null, null, false, true, true, false, 0);
|
||||||
|
|
Loading…
Reference in New Issue