remove hard coded wait time, use condition, resolve failure

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1076283 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary Tully 2011-03-02 16:40:22 +00:00
parent 93e2bd355b
commit b98047ed8c
1 changed files with 6 additions and 1 deletions

View File

@ -16,6 +16,7 @@
*/
package org.apache.activemq.spring;
import org.apache.activemq.util.Wait;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.junit.Assert;
@ -60,7 +61,11 @@ public class ListenerTest {
public void testComposite() throws Exception {
sendMessages("TEST.1,TEST.2,TEST.3,TEST.4,TEST.5,TEST.6", msgNum);
Thread.sleep(3000);
Wait.waitFor(new Wait.Condition() {
public boolean isSatisified() throws Exception {
return (6 * msgNum) <= listener.messages.size();
}
});
LOG.info("messages received= " + listener.messages.size());
Assert.assertEquals(6 * msgNum, listener.messages.size());