git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1352984 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Timothy A. Bish 2012-06-22 18:03:33 +00:00
parent bd31548920
commit 11497e9e98
1 changed files with 13 additions and 12 deletions

View File

@ -16,6 +16,13 @@
*/ */
package org.apache.activemq.bugs; package org.apache.activemq.bugs;
import static org.junit.Assert.fail;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.activemq.broker.BrokerService; import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.broker.region.policy.FilePendingSubscriberMessageStoragePolicy; import org.apache.activemq.broker.region.policy.FilePendingSubscriberMessageStoragePolicy;
import org.apache.activemq.broker.region.policy.LastImageSubscriptionRecoveryPolicy; import org.apache.activemq.broker.region.policy.LastImageSubscriptionRecoveryPolicy;
@ -31,15 +38,8 @@ import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import static org.junit.Assert.fail;
public class AMQ3622Test { public class AMQ3622Test {
protected BrokerService broker; protected BrokerService broker;
protected AtomicBoolean failed = new AtomicBoolean(false); protected AtomicBoolean failed = new AtomicBoolean(false);
protected String connectionUri; protected String connectionUri;
@ -72,7 +72,7 @@ public class AMQ3622Test {
policy.setSubscriptionRecoveryPolicy(new LastImageSubscriptionRecoveryPolicy()); policy.setSubscriptionRecoveryPolicy(new LastImageSubscriptionRecoveryPolicy());
policy.setExpireMessagesPeriod(500); policy.setExpireMessagesPeriod(500);
List<PolicyEntry> entries = new ArrayList<PolicyEntry>(); List<PolicyEntry> entries = new ArrayList<PolicyEntry>();
entries.add(policy); entries.add(policy);
PolicyMap pMap = new PolicyMap(); PolicyMap pMap = new PolicyMap();
pMap.setPolicyEntries(entries); pMap.setPolicyEntries(entries);
@ -90,16 +90,17 @@ public class AMQ3622Test {
broker.waitUntilStopped(); broker.waitUntilStopped();
Logger.getRootLogger().removeAppender(appender); Logger.getRootLogger().removeAppender(appender);
} }
@Test @Test
public void go() throws Exception { public void go() throws Exception {
StompConnection connection = new StompConnection(); StompConnection connection = new StompConnection();
connection.open("localhost", Integer.parseInt(connectionUri.replace("stomp://localhost:", ""))); Integer port = Integer.parseInt(connectionUri.split(":")[2]);
connection.open("localhost", port);
connection.connect("", ""); connection.connect("", "");
connection.subscribe("/topic/foobar", Stomp.Headers.Subscribe.AckModeValues.CLIENT); connection.subscribe("/topic/foobar", Stomp.Headers.Subscribe.AckModeValues.CLIENT);
connection.disconnect(); connection.disconnect();
Thread.sleep(1000); Thread.sleep(1000);
if (failed.get()) { if (failed.get()) {
fail("Received NullPointerException"); fail("Received NullPointerException");
} }