NO-JIRA Fixing Test only

no feature or semantic changes on this commit, hence no JIRA
This commit is contained in:
Clebert Suconic 2018-04-26 21:16:38 -04:00
parent 07f00e8ddc
commit e937c9903f
2 changed files with 27 additions and 9 deletions

View File

@ -66,11 +66,11 @@ public class BasicOpenWireTest extends OpenWireTestBase {
System.setProperty("org.apache.activemq.transport.AbstractInactivityMonitor.keepAliveTime", "5");
createFactories();
SimpleString coreQueue = new SimpleString(queueName);
this.server.createQueue(coreQueue, RoutingType.ANYCAST, coreQueue, null, false, false, -1, false, true);
this.server.createQueue(coreQueue, RoutingType.ANYCAST, coreQueue, null, true, false, -1, false, true);
testQueues.put(queueName, coreQueue);
SimpleString coreQueue2 = new SimpleString(queueName2);
this.server.createQueue(coreQueue2, RoutingType.ANYCAST, coreQueue2, null, false, false, -1, false, true);
this.server.createQueue(coreQueue2, RoutingType.ANYCAST, coreQueue2, null, true, false, -1, false, true);
testQueues.put(queueName2, coreQueue2);
SimpleString durableQueue = new SimpleString(durableQueueName);
@ -151,7 +151,7 @@ public class BasicOpenWireTest extends OpenWireTestBase {
SimpleString coreQ = testQueues.get(qname);
if (coreQ == null) {
coreQ = new SimpleString(qname);
this.server.createQueue(coreQ, RoutingType.ANYCAST, coreQ, null, false, false, -1, false, true);
this.server.createQueue(coreQ, RoutingType.ANYCAST, coreQ, null, true, false, -1, false, true);
testQueues.put(qname, coreQ);
}
}

View File

@ -16,6 +16,9 @@
*/
package org.apache.activemq.artemis.tests.integration.openwire.amq;
import javax.jms.DeliveryMode;
import javax.jms.Destination;
import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
import javax.jms.Session;
@ -34,6 +37,13 @@ import org.junit.Test;
*/
public class RedeliveryPolicyTest extends BasicOpenWireTest {
@Override
public void setUp() throws Exception {
// making data persistent makes it easier to debug it with print-data
this.realStore = true;
super.setUp();
}
@Test
public void testGetNext() throws Exception {
@ -506,6 +516,12 @@ public class RedeliveryPolicyTest extends BasicOpenWireTest {
session.commit();
}
private void send(Session session, MessageProducer producer, Destination destination, String text) throws Exception {
Message message = session.createTextMessage(text);
message.setStringProperty("texto", text);
producer.send(destination, message);
}
@Test
public void testRedeliveryPolicyPerDestination() throws Exception {
RedeliveryPolicy queuePolicy = new RedeliveryPolicy();
@ -525,22 +541,24 @@ public class RedeliveryPolicyTest extends BasicOpenWireTest {
map.put(new ActiveMQTopic(">"), topicPolicy);
map.put(new ActiveMQQueue(">"), queuePolicy);
connection.setClientID("id1");
connection.start();
Session session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE);
ActiveMQQueue queue = new ActiveMQQueue("TEST");
ActiveMQTopic topic = new ActiveMQTopic("TEST");
ActiveMQTopic topic = new ActiveMQTopic("TESTTOPIC");
this.makeSureCoreQueueExist("TEST");
MessageProducer producer = session.createProducer(null);
producer.setDeliveryMode(DeliveryMode.PERSISTENT);
MessageConsumer queueConsumer = session.createConsumer(queue);
MessageConsumer topicConsumer = session.createConsumer(topic);
MessageConsumer topicConsumer = session.createDurableSubscriber(topic, "tp1");
// Send the messages
producer.send(queue, session.createTextMessage("1st"));
producer.send(queue, session.createTextMessage("2nd"));
producer.send(topic, session.createTextMessage("1st"));
producer.send(topic, session.createTextMessage("2nd"));
send(session, producer, queue,"1st");
send(session, producer, queue,"2nd");
send(session, producer, topic,"1st");
send(session, producer, topic,"2nd");
session.commit();