NO-JIRA Trying to fix intermittent failure on ShutdownOnCriticalIOErrorMoveNextTest

This commit is contained in:
Clebert Suconic 2023-03-27 15:11:31 -04:00
parent 15d39a14ea
commit 40e9d4ebf7
1 changed files with 17 additions and 23 deletions

View File

@ -50,32 +50,26 @@ public class ShutdownOnCriticalIOErrorMoveNextTest extends ActiveMQTestBase {
deleteDirectory(new File("./target/server"));
ActiveMQServer server = createServer("./target/server");
server.start();
ConnectionFactory factory = new ActiveMQConnectionFactory();
Connection connection = factory.createConnection();
Session session = connection.createSession();
MessageProducer producer = session.createProducer(session.createQueue("queue"));
try {
server.start();
ConnectionFactory factory = new ActiveMQConnectionFactory();
Connection connection = factory.createConnection();
Session session = connection.createSession();
MessageProducer producer = session.createProducer(session.createQueue("queue"));
try {
for (int i = 0; i < 500; i++) {
producer.send(session.createTextMessage("text"));
}
} catch (JMSException expected) {
for (int i = 0; i < 500; i++) {
producer.send(session.createTextMessage("text"));
}
Wait.waitFor(() -> !server.isStarted());
Assert.assertFalse(server.isStarted());
} finally {
server.stop();
} catch (JMSException expected) {
}
Wait.waitFor(() -> !server.isStarted());
Assert.assertFalse(server.isStarted());
}
ActiveMQServer createServer(String folder) throws Exception {
@ -121,7 +115,7 @@ public class ShutdownOnCriticalIOErrorMoveNextTest extends ActiveMQTestBase {
};
return server;
return addServer(server);
}
Configuration createConfig(String folder) throws Exception {