ARTEMIS-2074 Fixing RA properties

This commit is contained in:
Clebert Suconic 2018-09-12 16:22:20 -04:00
parent a7b9551f74
commit 5d69e3594f
5 changed files with 32 additions and 3 deletions

View File

@ -67,11 +67,11 @@ public class ActiveMQConnectionFactory extends JNDIStorable implements Connectio
private static final long serialVersionUID = 6730844785641767519L;
public ServerLocator setUseTopologyForLoadBalancing(boolean useTopologyForLoadBalancing) {
return serverLocator.setUseTopologyForLoadBalancing(useTopologyForLoadBalancing);
public void setUseTopologyForLoadBalancing(boolean useTopologyForLoadBalancing) {
serverLocator.setUseTopologyForLoadBalancing(useTopologyForLoadBalancing);
}
public boolean getUseTopologyForLoadBalancing() {
public boolean isUseTopologyForLoadBalancing() {
return serverLocator.getUseTopologyForLoadBalancing();
}

View File

@ -20,6 +20,7 @@ import java.io.Serializable;
import java.util.Hashtable;
import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
import org.apache.activemq.artemis.utils.PasswordMaskingUtil;
/**
@ -37,6 +38,8 @@ public class ActiveMQRAProperties extends ConnectionFactoryProperties implements
private static boolean trace = ActiveMQRALogger.LOGGER.isTraceEnabled();
protected boolean allowLocalTransactions;
protected boolean useTopologyForLoadBalancing = ActiveMQClient.DEFAULT_USE_TOPOLOGY_FOR_LOADBALANCING;
/**
* The user name
*/
@ -250,6 +253,14 @@ public class ActiveMQRAProperties extends ConnectionFactoryProperties implements
initialized = true;
}
public void setUseTopologyForLoadBalancing(boolean useTopologyForLoadBalancing) {
this.useTopologyForLoadBalancing = useTopologyForLoadBalancing;
}
public boolean isUseTopologyForLoadBalancing() {
return useTopologyForLoadBalancing;
}
public String getCodec() {
return passwordCodec;
}

View File

@ -908,6 +908,14 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable {
raProperties.setProducerMaxRate(producerMaxRate);
}
public void setUseTopologyForLoadBalancing(boolean useTopologyForLoadBalancing) {
raProperties.setUseTopologyForLoadBalancing(useTopologyForLoadBalancing);
}
public boolean isUseTopologyForLoadBalancing() {
return raProperties.isUseTopologyForLoadBalancing();
}
/**
* Get producer window size
*
@ -1792,6 +1800,8 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable {
throw new IllegalArgumentException("must provide either TransportType or DiscoveryGroupAddress and DiscoveryGroupPort for ResourceAdapter Connection Factory");
}
cf.setUseTopologyForLoadBalancing(raProperties.isUseTopologyForLoadBalancing());
cf.setEnableSharedClientID(true);
cf.setEnable1xPrefixes(raProperties.isEnable1xPrefixes() == null ? false : raProperties.isEnable1xPrefixes());
setParams(cf, overrideProperties);

View File

@ -420,6 +420,12 @@ public class ActiveMQResourceAdapterConfigTest extends ActiveMQTestBase {
" <config-property-name>Enable1xPrefixes</config-property-name>" +
" <config-property-type>boolean</config-property-type>" +
" <config-property-value></config-property-value>" +
" </config-property>" +
" <config-property>" +
" <description>***add***</description>" +
" <config-property-name>UseTopologyForLoadBalancing</config-property-name>" +
" <config-property-type>boolean</config-property-type>" +
" <config-property-value></config-property-value>" +
" </config-property>";
private static String rootConfig = "<root>" + config + commentedOutConfigs + "</root>";

View File

@ -29,6 +29,7 @@ import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
import org.apache.activemq.artemis.ra.ActiveMQResourceAdapter;
import org.apache.activemq.artemis.ra.ConnectionFactoryProperties;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.Assert;
import org.junit.Test;
import static java.beans.Introspector.getBeanInfo;
@ -80,6 +81,7 @@ public class ConnectionFactoryPropertiesTest extends ActiveMQTestBase {
@Test
public void testCompareConnectionFactoryAndResourceAdapterProperties() throws Exception {
SortedSet<String> connectionFactoryProperties = findAllPropertyNames(ActiveMQConnectionFactory.class);
Assert.assertTrue(connectionFactoryProperties.contains("useTopologyForLoadBalancing"));
connectionFactoryProperties.removeAll(UNSUPPORTED_CF_PROPERTIES);
SortedSet<String> raProperties = findAllPropertyNames(ActiveMQResourceAdapter.class);
raProperties.removeAll(UNSUPPORTED_RA_PROPERTIES);