mirror of https://github.com/apache/activemq.git
fixed up test cases after they broker with the MessageList refactor
git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@359830 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b49256b2e5
commit
312f2489a3
|
@ -21,6 +21,7 @@ import org.apache.activemq.broker.TopicSubscriptionTest;
|
||||||
import org.apache.activemq.broker.region.policy.PolicyEntry;
|
import org.apache.activemq.broker.region.policy.PolicyEntry;
|
||||||
import org.apache.activemq.broker.region.policy.PolicyMap;
|
import org.apache.activemq.broker.region.policy.PolicyMap;
|
||||||
import org.apache.activemq.broker.region.policy.StrictOrderDispatchPolicy;
|
import org.apache.activemq.broker.region.policy.StrictOrderDispatchPolicy;
|
||||||
|
import org.apache.activemq.util.MessageList;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
@ -97,10 +98,10 @@ public class StrictOrderDispatchPolicyTest extends TopicSubscriptionTest {
|
||||||
|
|
||||||
// Get basis of order
|
// Get basis of order
|
||||||
Iterator i = consumers.keySet().iterator();
|
Iterator i = consumers.keySet().iterator();
|
||||||
List messageOrder = (List)consumers.get(i.next());
|
MessageList messageOrder = (MessageList)consumers.get(i.next());
|
||||||
|
|
||||||
for (;i.hasNext();) {
|
for (;i.hasNext();) {
|
||||||
List messageList = (List)consumers.get(i.next());
|
MessageList messageList = (MessageList)consumers.get(i.next());
|
||||||
assertTrue("Messages are not ordered.", messageOrder.equals(messageList));
|
assertTrue("Messages are not ordered.", messageOrder.equals(messageList));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,14 +16,14 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.activemq.util;
|
package org.apache.activemq.util;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.jms.Message;
|
import javax.jms.Message;
|
||||||
import javax.jms.MessageListener;
|
import javax.jms.MessageListener;
|
||||||
import javax.jms.TextMessage;
|
import javax.jms.TextMessage;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import junit.framework.Assert;
|
import junit.framework.Assert;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -45,6 +45,26 @@ public class MessageList extends Assert implements MessageListener {
|
||||||
this.semaphore = semaphore;
|
this.semaphore = semaphore;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean equals(Object that) {
|
||||||
|
if (that instanceof MessageList) {
|
||||||
|
MessageList thatList = (MessageList) that;
|
||||||
|
return getMessages().equals(thatList.getMessages());
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int hashCode() {
|
||||||
|
synchronized (semaphore) {
|
||||||
|
return messages.hashCode() + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
synchronized (semaphore) {
|
||||||
|
return messages.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return all the messages on the list so far, clearing the buffer
|
* @return all the messages on the list so far, clearing the buffer
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue