ARTEMIS-887 Fix some OpenWire test failures

This commit is contained in:
Howard Gao 2016-12-13 23:49:11 +08:00 committed by Clebert Suconic
parent 47f46501e3
commit 16f19daa97
4 changed files with 24 additions and 2 deletions

View File

@ -29,8 +29,10 @@ import java.net.URI;
import java.net.URISyntaxException;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.RejectedExecutionHandler;
@ -45,6 +47,7 @@ import org.apache.activemq.thread.TaskRunnerFactory;
import org.apache.activemq.transport.Transport;
import org.apache.activemq.transport.TransportFactory;
import org.apache.activemq.transport.TransportListener;
import org.apache.activemq.util.ClassLoadingAwareObjectInputStream;
import org.apache.activemq.util.IdGenerator;
import org.apache.activemq.util.IntrospectionSupport;
import org.apache.activemq.util.JMSExceptionSupport;
@ -184,6 +187,8 @@ public class ActiveMQConnectionFactory extends JNDIBaseStorable implements Conne
protected int xaAckMode = -1; // ensure default init before setting via brokerUrl introspection in sub class
private boolean rmIdFromConnectionId = false;
private boolean consumerExpiryCheckEnabled = true;
private List<String> trustedPackages = Arrays.asList(ClassLoadingAwareObjectInputStream.serializablePackages);
private boolean trustAllPackages = false;
// /////////////////////////////////////////////
//
@ -393,6 +398,8 @@ public class ActiveMQConnectionFactory extends JNDIBaseStorable implements Conne
connection.setNestedMapAndListEnabled(isNestedMapAndListEnabled());
connection.setRmIdFromConnectionId(isRmIdFromConnectionId());
connection.setConsumerExpiryCheckEnabled(isConsumerExpiryCheckEnabled());
connection.setTrustedPackages(getTrustedPackages());
connection.setTrustAllPackages(isTrustAllPackages());
if (transportListener != null) {
connection.addTransportListener(transportListener);
}
@ -980,4 +987,12 @@ public class ActiveMQConnectionFactory extends JNDIBaseStorable implements Conne
public void setConsumerExpiryCheckEnabled(boolean consumerExpiryCheckEnabled) {
this.consumerExpiryCheckEnabled = consumerExpiryCheckEnabled;
}
public List<String> getTrustedPackages() {
return trustedPackages;
}
public boolean isTrustAllPackages() {
return trustAllPackages;
}
}

View File

@ -89,7 +89,8 @@ public class ArtemisBrokerWrapper extends ArtemisBrokerBase {
}
SimpleString dla = new SimpleString("ActiveMQ.DLQ");
commonSettings.setDeadLetterAddress(dla);
commonSettings.setAutoCreateJmsQueues(true);
commonSettings.setAutoCreateQueues(true);
commonSettings.setAutoCreateAddresses(true);
if (bservice.extraConnectors.size() == 0) {
serverConfig.addAcceptorConfiguration("home", "tcp://localhost:61616");

View File

@ -43,6 +43,7 @@ import junit.framework.Test;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.management.ObjectNameBuilder;
import org.apache.activemq.artemis.api.core.management.QueueControl;
import org.apache.activemq.artemis.core.server.RoutingType;
import org.apache.activemq.broker.artemiswrapper.ArtemisBrokerWrapper;
import org.apache.activemq.command.ActiveMQDestination;
import org.apache.activemq.command.ActiveMQQueue;
@ -909,7 +910,7 @@ public class JMSConsumerTest extends JmsTestSupport {
ArtemisBrokerWrapper wrapper = (ArtemisBrokerWrapper) broker.getBroker();
MBeanServer beanServer = wrapper.getMbeanServer();
SimpleString address = new SimpleString(destName);
ObjectName objName = ObjectNameBuilder.DEFAULT.getQueueObjectName(address, address);
ObjectName objName = ObjectNameBuilder.DEFAULT.getQueueObjectName(address, address, RoutingType.ANYCAST);
return MBeanServerInvocationHandler.newProxyInstance(beanServer, objName, QueueControl.class, false);
}
}

View File

@ -27,6 +27,7 @@ import org.apache.activemq.artemis.api.core.client.ClientSession;
import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl;
import org.apache.activemq.artemiswrapper.ArtemisBrokerHelper;
import org.apache.activemq.command.ActiveMQDestination;
import org.apache.activemq.test.JmsTopicSendReceiveTest;
@ -47,6 +48,10 @@ public class JmsQueueCompositeSendReceiveTest extends JmsTopicSendReceiveTest {
topic = false;
deliveryMode = DeliveryMode.NON_PERSISTENT;
super.setUp();
ActiveMQDestination dest1 = (ActiveMQDestination) session.createQueue("FOO.BAR.HUMBUG2");
ActiveMQDestination dest2 = (ActiveMQDestination) session.createQueue("TEST");
ArtemisBrokerHelper.makeSureDestinationExists(dest1);
ArtemisBrokerHelper.makeSureDestinationExists(dest2);
}
/**