mirror of https://github.com/apache/activemq.git
fix test breakage after: https://issues.apache.org/jira/browse/AMQ-3833
The producerAudit is only written out on change so in this test it holds onto log 5 meaning there are two left instead of one. git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1434055 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1b27f95393
commit
59d13ad913
|
@ -17,12 +17,13 @@
|
|||
package org.apache.activemq.usecases;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.HashSet;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.jms.Connection;
|
||||
import javax.jms.JMSException;
|
||||
import javax.jms.Message;
|
||||
|
@ -31,7 +32,9 @@ import javax.jms.MessageListener;
|
|||
import javax.jms.MessageProducer;
|
||||
import javax.jms.Session;
|
||||
import javax.management.ObjectName;
|
||||
|
||||
import junit.framework.Test;
|
||||
|
||||
import org.apache.activemq.ActiveMQConnectionFactory;
|
||||
import org.apache.activemq.broker.BrokerFactory;
|
||||
import org.apache.activemq.broker.BrokerService;
|
||||
|
@ -43,9 +46,9 @@ import org.apache.activemq.command.ActiveMQTopic;
|
|||
import org.apache.activemq.command.MessageId;
|
||||
import org.apache.activemq.store.jdbc.JDBCPersistenceAdapter;
|
||||
import org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter;
|
||||
import org.apache.activemq.util.Wait;
|
||||
import org.apache.activemq.store.kahadb.disk.journal.Journal;
|
||||
import org.apache.activemq.store.kahadb.disk.page.PageFile;
|
||||
import org.apache.activemq.util.Wait;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -57,8 +60,9 @@ public class DurableSubscriptionOfflineTest extends org.apache.activemq.TestSupp
|
|||
public boolean keepDurableSubsActive = true;
|
||||
private BrokerService broker;
|
||||
private ActiveMQTopic topic;
|
||||
private List<Throwable> exceptions = new ArrayList<Throwable>();
|
||||
private final List<Throwable> exceptions = new ArrayList<Throwable>();
|
||||
|
||||
@Override
|
||||
protected ActiveMQConnectionFactory createConnectionFactory() throws Exception {
|
||||
ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("vm://" + getName(true));
|
||||
connectionFactory.setWatchTopicAdvisories(false);
|
||||
|
@ -81,6 +85,7 @@ public class DurableSubscriptionOfflineTest extends org.apache.activemq.TestSupp
|
|||
return suite(DurableSubscriptionOfflineTest.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
exceptions.clear();
|
||||
topic = (ActiveMQTopic) createDestination();
|
||||
|
@ -88,6 +93,7 @@ public class DurableSubscriptionOfflineTest extends org.apache.activemq.TestSupp
|
|||
super.setUp();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
super.tearDown();
|
||||
destroyBroker();
|
||||
|
@ -1491,6 +1497,7 @@ public class DurableSubscriptionOfflineTest extends org.apache.activemq.TestSupp
|
|||
final Listener listener = new Listener();
|
||||
consumer.setMessageListener(listener);
|
||||
assertTrue("got all sent", Wait.waitFor(new Wait.Condition() {
|
||||
@Override
|
||||
public boolean isSatisified() throws Exception {
|
||||
LOG.info("Want: " + toSend + ", current: " + listener.count);
|
||||
return listener.count == toSend;
|
||||
|
@ -1502,7 +1509,7 @@ public class DurableSubscriptionOfflineTest extends org.apache.activemq.TestSupp
|
|||
destroyBroker();
|
||||
createBroker(false);
|
||||
KahaDBPersistenceAdapter pa = (KahaDBPersistenceAdapter) broker.getPersistenceAdapter();
|
||||
assertEquals("only one journal file left after restart", 1, pa.getStore().getJournal().getFileMap().size());
|
||||
assertEquals("only two journal file(s) left after restart", 2, pa.getStore().getJournal().getFileMap().size());
|
||||
}
|
||||
|
||||
// https://issues.apache.org/jira/browse/AMQ-3768
|
||||
|
@ -1674,6 +1681,7 @@ public class DurableSubscriptionOfflineTest extends org.apache.activemq.TestSupp
|
|||
Listener(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
@Override
|
||||
public void onMessage(Message message) {
|
||||
count++;
|
||||
if (id != null) {
|
||||
|
@ -1686,6 +1694,7 @@ public class DurableSubscriptionOfflineTest extends org.apache.activemq.TestSupp
|
|||
|
||||
public class FilterCheckListener extends Listener {
|
||||
|
||||
@Override
|
||||
public void onMessage(Message message) {
|
||||
count++;
|
||||
|
||||
|
|
Loading…
Reference in New Issue