QPID-7546: [System Tests] Fix MultipleAuthenticationManagersTest, PersistentStoreTest, SplitStoreTest and ClientAcknowledgeTest on AMQP 1.0 persistent profiles
diff --git a/systests/src/test/java/org/apache/qpid/server/store/PersistentStoreTest.java b/systests/src/test/java/org/apache/qpid/server/store/PersistentStoreTest.java
index bc8212a..dd29955 100644
--- a/systests/src/test/java/org/apache/qpid/server/store/PersistentStoreTest.java
+++ b/systests/src/test/java/org/apache/qpid/server/store/PersistentStoreTest.java
@@ -33,7 +33,6 @@
import javax.jms.MessageProducer;
import javax.jms.Session;
-import org.apache.qpid.client.AMQSession;
import org.apache.qpid.test.utils.QpidBrokerTestCase;
public class PersistentStoreTest extends QpidBrokerTestCase
@@ -43,6 +42,7 @@
private Session _session;
private Destination _destination;
+ @Override
public void setUp() throws Exception
{
super.setUp();
@@ -94,10 +94,12 @@
public void testHeaderPersistence() throws Exception
{
+ String testQueueName = getTestQueueName();
+ String replyToQueue = testQueueName + "_reply";
_con.start();
_session = _con.createSession(true, Session.SESSION_TRANSACTED);
- _destination = _session.createQueue(getTestQueueName());
- Destination replyTo = _session.createQueue(getTestQueueName() + "_reply");
+ _destination = createTestQueue(_session, testQueueName);
+ Destination replyTo = createTestQueue(_session, replyToQueue);
MessageConsumer consumer = _session.createConsumer(_destination);
MessageProducer producer = _session.createProducer(_destination);
@@ -116,7 +118,7 @@
final String sentMessageId = msg.getJMSMessageID();
- Message receivedMessage = consumer.receive(1000);
+ Message receivedMessage = consumer.receive(getReceiveTimeout());
long receivedJmsExpiration = receivedMessage.getJMSExpiration();
assertEquals("Unexpected JMS message id", sentMessageId, receivedMessage.getJMSMessageID());
assertEquals("Unexpected JMS replyto", replyTo, receivedMessage.getJMSReplyTo());
@@ -134,7 +136,7 @@
_session = _con.createSession(true, Session.SESSION_TRANSACTED);
consumer = _session.createConsumer(_destination);
- Message rereceivedMessage = consumer.receive(1000);
+ Message rereceivedMessage = consumer.receive(getReceiveTimeout());
assertEquals("Unexpected JMS message id", sentMessageId, rereceivedMessage.getJMSMessageID());
assertEquals("Unexpected JMS replyto", replyTo, rereceivedMessage.getJMSReplyTo());
assertEquals("Unexpected JMS priority", priority, rereceivedMessage.getJMSPriority());
@@ -147,9 +149,7 @@
private void sendAndCommitMessages() throws Exception
{
_session = _con.createSession(true, Session.SESSION_TRANSACTED);
- _destination = _session.createQueue(getTestQueueName());
- // Create queue by consumer side-effect
- _session.createConsumer(_destination).close();
+ _destination = createTestQueue(_session);
sendMessage(_session, _destination, NUM_MESSAGES);
_session.commit();
@@ -157,9 +157,7 @@
private void sendMoreMessagesWithoutCommitting() throws Exception
{
- sendMessage(_session, _destination, 5);
- // sync to ensure that messages have reached the broker
- ((AMQSession<?,?>) _session).sync();
+ sendMessage(_session, _destination, NUM_MESSAGES);
}
private void confirmBrokerStillHasCommittedMessages() throws Exception
@@ -171,12 +169,12 @@
MessageConsumer consumer = session.createConsumer(destination);
for (int i = 1; i <= NUM_MESSAGES; i++)
{
- Message msg = consumer.receive(RECEIVE_TIMEOUT);
+ Message msg = consumer.receive(getReceiveTimeout());
assertNotNull("Message " + i + " not received", msg);
assertEquals("Did not receive the expected message", i, msg.getIntProperty(INDEX));
}
- Message msg = consumer.receive(100);
+ Message msg = consumer.receive(getShortReceiveTimeout());
if(msg != null)
{
fail("No more messages should be received, but received additional message with index: " + msg.getIntProperty(INDEX));
@@ -199,11 +197,11 @@
public List<Message> sendMessage(Session session, Destination destination,
int count) throws Exception
{
- List<Message> messages = new ArrayList<Message>(count);
+ List<Message> messages = new ArrayList<>(count);
MessageProducer producer = session.createProducer(destination);
- for (int i = 1;i <= (count); i++)
+ for (int i = 1; i <= count; i++)
{
Message next = createNextMessage(session, i);
diff --git a/systests/src/test/java/org/apache/qpid/server/store/SplitStoreTest.java b/systests/src/test/java/org/apache/qpid/server/store/SplitStoreTest.java
index a2250c8..9217ccd 100644
--- a/systests/src/test/java/org/apache/qpid/server/store/SplitStoreTest.java
+++ b/systests/src/test/java/org/apache/qpid/server/store/SplitStoreTest.java
@@ -89,8 +89,7 @@
Connection connection = getConnection();
Session session = connection.createSession(true, Session.SESSION_TRANSACTED);
- Queue queue = session.createQueue(getTestQueueName());
- session.createConsumer(queue).close(); // Create durable queue by side effect
+ Queue queue = createTestQueue(session);
sendMessage(session, queue, 1);
connection.close();
diff --git a/systests/src/test/java/org/apache/qpid/test/unit/ack/ClientAcknowledgeTest.java b/systests/src/test/java/org/apache/qpid/test/unit/ack/ClientAcknowledgeTest.java
index b8c2350..f796973 100644
--- a/systests/src/test/java/org/apache/qpid/test/unit/ack/ClientAcknowledgeTest.java
+++ b/systests/src/test/java/org/apache/qpid/test/unit/ack/ClientAcknowledgeTest.java
@@ -31,7 +31,6 @@
{
private static final long ONE_DAY_MS = 1000l * 60 * 60 * 24;
private Connection _connection;
- private Queue _queue;
private Session _consumerSession;
private MessageConsumer _consumer;
private MessageProducer _producer;
@@ -40,7 +39,6 @@
protected void setUp() throws Exception
{
super.setUp();
- _queue = getTestQueue();
_connection = getConnection();
}
@@ -52,30 +50,36 @@
*/
public void testClientAckWithLargeFlusherPeriod() throws Exception
{
- setTestClientSystemProperty("qpid.session.max_ack_delay", Long.toString(ONE_DAY_MS));
+ if (isBroker010())
+ {
+ setTestClientSystemProperty("qpid.session.max_ack_delay", Long.toString(ONE_DAY_MS));
+ }
+
_consumerSession = _connection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
- _consumer = _consumerSession.createConsumer(_queue);
+ Queue queue = createTestQueue(_consumerSession);
+ _consumer = _consumerSession.createConsumer(queue);
_connection.start();
- _producer = _consumerSession.createProducer(_queue);
+ _producer = _consumerSession.createProducer(queue);
_producer.send(createNextMessage(_consumerSession, 1));
_producer.send(createNextMessage(_consumerSession, 2));
- Message message = _consumer.receive(1000l);
+ Message message = _consumer.receive(getReceiveTimeout());
assertNotNull("Message has not been received", message);
assertEquals("Unexpected message is received", 1, message.getIntProperty(INDEX));
message.acknowledge();
//restart broker to allow verification of the acks
//without explicitly closing connection (which acks)
+ //Seems to be contrary to the JMS spec " Closing a connection does NOT force an acknowledgment of client-acknowledged sessions."
restartDefaultBroker();
// try to receive the message again, which should fail (as it was ackd)
_connection = getConnection();
_connection.start();
_consumerSession = _connection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
- _consumer = _consumerSession.createConsumer(_queue);
- message = _consumer.receive(1000l);
+ _consumer = _consumerSession.createConsumer(queue);
+ message = _consumer.receive(getReceiveTimeout());
assertNotNull("Message has not been received", message);
assertEquals("Unexpected message is received", 2, message.getIntProperty(INDEX));
}
diff --git a/test-profiles/CPPTransientExcludes b/test-profiles/CPPTransientExcludes
index a214cf5..e309786 100644
--- a/test-profiles/CPPTransientExcludes
+++ b/test-profiles/CPPTransientExcludes
@@ -29,4 +29,4 @@
org.apache.qpid.test.unit.xa.QueueTest#testSendAndRecover
// test requires a persistent store
-org.apache.qpid.test.unit.ack.ClientAcknowledgeTest#testClientAckWithLargeFlusherPeriod
+org.apache.qpid.test.unit.ack.ClientAcknowledgeTest#testClientAckWithRestart
diff --git a/test-profiles/Java10Excludes b/test-profiles/Java10Excludes
index 135fa63..bbbfd0f 100644
--- a/test-profiles/Java10Excludes
+++ b/test-profiles/Java10Excludes
@@ -184,6 +184,7 @@
org.apache.qpid.client.ssl.SSLTest#testCreateSSLConnectionUsingSystemProperties
org.apache.qpid.client.ssl.SSLTest#testSslConnectionOption
org.apache.qpid.client.ssl.SSLTest#testVerifyLocalHost
+org.apache.qpid.server.security.auth.manager.MultipleAuthenticationManagersTest#testMultipleAuthenticationManagers
// Test framework does not allow us to override hostname
org.apache.qpid.client.ssl.SSLTest#testHostVerificationIsOnByDefault
org.apache.qpid.client.ssl.SSLTest#testVerifyHostNameWithIncorrectHostname
diff --git a/test-profiles/JavaTransientExcludes b/test-profiles/JavaTransientExcludes
index 683a034..ccb250e 100644
--- a/test-profiles/JavaTransientExcludes
+++ b/test-profiles/JavaTransientExcludes
@@ -23,7 +23,7 @@
org.apache.qpid.server.store.SplitStoreTest#*
org.apache.qpid.server.logging.AlertingTest#testAlertingReallyWorksWithRestart
org.apache.qpid.server.logging.AlertingTest#testAlertingReallyWorksWithChanges
-org.apache.qpid.test.unit.ack.ClientAcknowledgeTest#testClientAckWithLargeFlusherPeriod
+org.apache.qpid.test.unit.ack.ClientAcknowledgeTest#testClientAckWithRestart
org.apache.qpid.test.unit.ct.DurableSubscriberTest#*