mirror of https://github.com/apache/activemq.git
renamed to follow Test naming convention
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@903487 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8eeedce809
commit
8b1e16de48
|
@ -27,7 +27,7 @@ import org.apache.activemq.ActiveMQConnectionFactory;
|
||||||
import org.apache.activemq.EmbeddedBrokerTestSupport;
|
import org.apache.activemq.EmbeddedBrokerTestSupport;
|
||||||
import org.apache.activemq.broker.BrokerService;
|
import org.apache.activemq.broker.BrokerService;
|
||||||
|
|
||||||
public class AMQ2571 extends EmbeddedBrokerTestSupport {
|
public class AMQ2571Test extends EmbeddedBrokerTestSupport {
|
||||||
|
|
||||||
public void testTempQueueClosing() {
|
public void testTempQueueClosing() {
|
||||||
try {
|
try {
|
|
@ -50,14 +50,14 @@ import org.apache.activemq.CombinationTestSupport;
|
||||||
import org.apache.activemq.broker.BrokerService;
|
import org.apache.activemq.broker.BrokerService;
|
||||||
import org.apache.activemq.command.ActiveMQTopic;
|
import org.apache.activemq.command.ActiveMQTopic;
|
||||||
import org.apache.activemq.store.amq.AMQPersistenceAdapterFactory;
|
import org.apache.activemq.store.amq.AMQPersistenceAdapterFactory;
|
||||||
import org.apache.activemq.util.ThreadTracker;
|
import org.apache.activemq.store.kahadb.KahaDBStore;
|
||||||
|
import org.apache.activemq.util.IOHelper;
|
||||||
import org.apache.activemq.util.Wait;
|
import org.apache.activemq.util.Wait;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @version $Revision: 1.5 $
|
* @version $Revision: 1.5 $ A Test case for AMQ-1479
|
||||||
* A Test case for AMQ-1479
|
|
||||||
*/
|
*/
|
||||||
public class DurableConsumerTest extends CombinationTestSupport{
|
public class DurableConsumerTest extends CombinationTestSupport{
|
||||||
private static final Log LOG = LogFactory.getLog(DurableConsumerTest.class);
|
private static final Log LOG = LogFactory.getLog(DurableConsumerTest.class);
|
||||||
|
@ -86,7 +86,6 @@ public class DurableConsumerTest extends CombinationTestSupport {
|
||||||
Topic topic = null;
|
Topic topic = null;
|
||||||
TopicSubscriber topicSubscriber = null;
|
TopicSubscriber topicSubscriber = null;
|
||||||
|
|
||||||
|
|
||||||
topicConnectionFactory = new ActiveMQConnectionFactory(connectionURL);
|
topicConnectionFactory = new ActiveMQConnectionFactory(connectionURL);
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
@ -132,7 +131,6 @@ public class DurableConsumerTest extends CombinationTestSupport {
|
||||||
TopicPublisher topicPublisher = null;
|
TopicPublisher topicPublisher = null;
|
||||||
Message message = null;
|
Message message = null;
|
||||||
|
|
||||||
|
|
||||||
topicConnectionFactory = new ActiveMQConnectionFactory(CONNECTION_URL);
|
topicConnectionFactory = new ActiveMQConnectionFactory(CONNECTION_URL);
|
||||||
try {
|
try {
|
||||||
topic = new ActiveMQTopic(TOPIC_NAME);
|
topic = new ActiveMQTopic(TOPIC_NAME);
|
||||||
|
@ -207,7 +205,7 @@ public class DurableConsumerTest extends CombinationTestSupport {
|
||||||
factory = createConnectionFactory();
|
factory = createConnectionFactory();
|
||||||
final String topicName = getName();
|
final String topicName = getName();
|
||||||
final int numMessages = 500;
|
final int numMessages = 500;
|
||||||
int numConsumers = 20;
|
int numConsumers = 1;
|
||||||
final CountDownLatch counsumerStarted = new CountDownLatch(0);
|
final CountDownLatch counsumerStarted = new CountDownLatch(0);
|
||||||
final AtomicInteger receivedCount = new AtomicInteger();
|
final AtomicInteger receivedCount = new AtomicInteger();
|
||||||
Runnable consumer = new Runnable(){
|
Runnable consumer = new Runnable(){
|
||||||
|
@ -216,20 +214,17 @@ public class DurableConsumerTest extends CombinationTestSupport {
|
||||||
int acked = 0;
|
int acked = 0;
|
||||||
int received = 0;
|
int received = 0;
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
while (acked < numMessages / 2) {
|
while (acked < numMessages / 2) {
|
||||||
// take one message and close, ack on occasion
|
// take one message and close, ack on occasion
|
||||||
Connection consumerConnection = factory.createConnection();
|
Connection consumerConnection = factory.createConnection();
|
||||||
((ActiveMQConnection) consumerConnection).setWatchTopicAdvisories(false);
|
((ActiveMQConnection) consumerConnection).setWatchTopicAdvisories(false);
|
||||||
consumerConnection.setClientID(consumerName);
|
consumerConnection.setClientID(consumerName);
|
||||||
Session consumerSession = consumerConnection.createSession(false,
|
Session consumerSession = consumerConnection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
|
||||||
Session.CLIENT_ACKNOWLEDGE);
|
|
||||||
Topic topic = consumerSession.createTopic(topicName);
|
Topic topic = consumerSession.createTopic(topicName);
|
||||||
consumerConnection.start();
|
consumerConnection.start();
|
||||||
|
|
||||||
MessageConsumer consumer = consumerSession
|
MessageConsumer consumer = consumerSession.createDurableSubscriber(topic, consumerName);
|
||||||
.createDurableSubscriber(topic, consumerName);
|
|
||||||
|
|
||||||
counsumerStarted.countDown();
|
counsumerStarted.countDown();
|
||||||
Message msg = null;
|
Message msg = null;
|
||||||
|
@ -357,7 +352,6 @@ public class DurableConsumerTest extends CombinationTestSupport {
|
||||||
}
|
}
|
||||||
consumerConnection.close();
|
consumerConnection.close();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setUp() throws Exception{
|
protected void setUp() throws Exception{
|
||||||
|
@ -391,9 +385,16 @@ public class DurableConsumerTest extends CombinationTestSupport {
|
||||||
return answer;
|
return answer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void configureBroker(BrokerService answer,boolean deleteStore) throws Exception{
|
protected void configureBroker(BrokerService answer,boolean deleteStore) throws Exception{
|
||||||
answer.setDeleteAllMessagesOnStartup(deleteStore);
|
answer.setDeleteAllMessagesOnStartup(deleteStore);
|
||||||
|
KahaDBStore kaha = new KahaDBStore();
|
||||||
|
File directory = new File("target/activemq-data/kahadb");
|
||||||
|
if (deleteStore) {
|
||||||
|
IOHelper.deleteChildren(directory);
|
||||||
|
}
|
||||||
|
kaha.setDirectory(directory);
|
||||||
|
|
||||||
|
answer.setPersistenceAdapter(kaha);
|
||||||
answer.addConnector(bindAddress);
|
answer.addConnector(bindAddress);
|
||||||
answer.setUseShutdownHook(false);
|
answer.setUseShutdownHook(false);
|
||||||
answer.setUseJmx(false);
|
answer.setUseJmx(false);
|
||||||
|
|
Loading…
Reference in New Issue