ARTEMIS-3999 Fix setting extraParams for new acceptors via broker properties
This commit is contained in:
parent
faef3edd78
commit
93a5f3b596
|
@ -92,6 +92,7 @@ public class TransportConfiguration implements Serializable {
|
|||
*/
|
||||
public TransportConfiguration() {
|
||||
this.params = new HashMap<>();
|
||||
this.extraProps = new HashMap<>();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -103,7 +104,7 @@ public class TransportConfiguration implements Serializable {
|
|||
* @param name The name of this TransportConfiguration
|
||||
*/
|
||||
public TransportConfiguration(final String className, final Map<String, Object> params, final String name) {
|
||||
this(className, params, name, null);
|
||||
this(className, params, name, new HashMap<>());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -40,6 +40,7 @@ import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration;
|
|||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.TransportConfiguration;
|
||||
import org.apache.activemq.artemis.core.config.Configuration;
|
||||
import org.apache.activemq.artemis.core.config.ConfigurationUtils;
|
||||
import org.apache.activemq.artemis.core.config.amqpBrokerConnectivity.AMQPBrokerConnectConfiguration;
|
||||
import org.apache.activemq.artemis.core.config.amqpBrokerConnectivity.AMQPBrokerConnectionAddressType;
|
||||
import org.apache.activemq.artemis.core.config.amqpBrokerConnectivity.AMQPBrokerConnectionElement;
|
||||
|
@ -922,6 +923,38 @@ public class ConfigurationImplTest extends ActiveMQTestBase {
|
|||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testAcceptorViaProperties() throws Throwable {
|
||||
ConfigurationImpl configuration = new ConfigurationImpl();
|
||||
|
||||
configuration.getAcceptorConfigurations().add(ConfigurationUtils.parseAcceptorURI(
|
||||
"artemis", "tcp://0.0.0.0:61616?protocols=CORE,AMQP,STOMP,HORNETQ,MQTT,OPENWIRE;supportAdvisory=false;suppressInternalManagementObjects=false").get(0));
|
||||
|
||||
Properties properties = new Properties();
|
||||
|
||||
properties.put("acceptorConfigurations.artemis.extraParams.supportAdvisory", "true");
|
||||
properties.put("acceptorConfigurations.new.extraParams.supportAdvisory", "true");
|
||||
|
||||
configuration.parsePrefixedProperties(properties, null);
|
||||
|
||||
Assert.assertEquals(2, configuration.getAcceptorConfigurations().size());
|
||||
|
||||
TransportConfiguration artemisTransportConfiguration = configuration.getAcceptorConfigurations().stream().filter(
|
||||
transportConfiguration -> transportConfiguration.getName().equals("artemis")).findFirst().get();
|
||||
Assert.assertTrue(artemisTransportConfiguration.getParams().containsKey("protocols"));
|
||||
Assert.assertEquals("CORE,AMQP,STOMP,HORNETQ,MQTT,OPENWIRE", artemisTransportConfiguration.getParams().get("protocols"));
|
||||
Assert.assertTrue(artemisTransportConfiguration.getExtraParams().containsKey("supportAdvisory"));
|
||||
Assert.assertEquals("true", artemisTransportConfiguration.getExtraParams().get("supportAdvisory"));
|
||||
Assert.assertTrue(artemisTransportConfiguration.getExtraParams().containsKey("suppressInternalManagementObjects"));
|
||||
Assert.assertEquals("false", artemisTransportConfiguration.getExtraParams().get("suppressInternalManagementObjects"));
|
||||
|
||||
TransportConfiguration newTransportConfiguration = configuration.getAcceptorConfigurations().stream().filter(
|
||||
transportConfiguration -> transportConfiguration.getName().equals("new")).findFirst().get();
|
||||
Assert.assertTrue(newTransportConfiguration.getExtraParams().containsKey("supportAdvisory"));
|
||||
Assert.assertEquals("true", newTransportConfiguration.getExtraParams().get("supportAdvisory"));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testAddressSettingsViaProperties() throws Throwable {
|
||||
ConfigurationImpl configuration = new ConfigurationImpl();
|
||||
|
|
Loading…
Reference in New Issue