NO-JIRA fixing intermittent test failure
This commit is contained in:
parent
6e888be70a
commit
e86acc977b
|
@ -52,11 +52,10 @@ public class AutoCreateExpiryResourcesTest extends ActiveMQTestBase {
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
server = createServer(false);
|
server = createServer(false);
|
||||||
server.getConfiguration().setAddressQueueScanPeriod(100);
|
server.getConfiguration().setAddressQueueScanPeriod(50L).setMessageExpiryScanPeriod(50L);
|
||||||
|
|
||||||
// set common address settings needed for all tests; make sure to use getMatch instead of addMatch in invidual tests or these will be overwritten
|
// set common address settings needed for all tests; make sure to use getMatch instead of addMatch in invidual tests or these will be overwritten
|
||||||
server.getAddressSettingsRepository().addMatch("#", new AddressSettings().setAutoCreateExpiryResources(true).setExpiryAddress(expiryAddress).setExpiryDelay(EXPIRY_DELAY));
|
server.getAddressSettingsRepository().addMatch("#", new AddressSettings().setAutoCreateExpiryResources(true).setExpiryAddress(expiryAddress).setExpiryDelay(EXPIRY_DELAY));
|
||||||
server.getConfiguration().setMessageExpiryScanPeriod(50L);
|
|
||||||
|
|
||||||
server.start();
|
server.start();
|
||||||
}
|
}
|
||||||
|
@ -164,9 +163,11 @@ public class AutoCreateExpiryResourcesTest extends ActiveMQTestBase {
|
||||||
ClientSessionFactory sessionFactory = createSessionFactory(locator);
|
ClientSessionFactory sessionFactory = createSessionFactory(locator);
|
||||||
ClientSession session = addClientSession(sessionFactory.createSession(true, true));
|
ClientSession session = addClientSession(sessionFactory.createSession(true, true));
|
||||||
Wait.assertTrue(() -> server.locateQueue(expiryQueueName) != null, 2000, 100);
|
Wait.assertTrue(() -> server.locateQueue(expiryQueueName) != null, 2000, 100);
|
||||||
|
Wait.assertEquals(1, server.locateQueue(expiryQueueName) :: getMessageCount);
|
||||||
|
|
||||||
ClientConsumer consumer = session.createConsumer(expiryQueueName);
|
ClientConsumer consumer = session.createConsumer(expiryQueueName);
|
||||||
session.start();
|
session.start();
|
||||||
ClientMessage message = consumer.receive();
|
ClientMessage message = consumer.receive(5_000);
|
||||||
assertNotNull(message);
|
assertNotNull(message);
|
||||||
message.acknowledge();
|
message.acknowledge();
|
||||||
consumer.close();
|
consumer.close();
|
||||||
|
@ -227,6 +228,7 @@ public class AutoCreateExpiryResourcesTest extends ActiveMQTestBase {
|
||||||
ClientSession session = addClientSession(sessionFactory.createSession(true, false));
|
ClientSession session = addClientSession(sessionFactory.createSession(true, false));
|
||||||
ClientProducer producer = addClientProducer(session.createProducer(addressA));
|
ClientProducer producer = addClientProducer(session.createProducer(addressA));
|
||||||
ClientMessage message = session.createMessage(true);
|
ClientMessage message = session.createMessage(true);
|
||||||
|
message.setExpiration(System.currentTimeMillis());
|
||||||
producer.send(message);
|
producer.send(message);
|
||||||
producer.close();
|
producer.close();
|
||||||
session.close();
|
session.close();
|
||||||
|
|
Loading…
Reference in New Issue