ARTEMIS-3414 Disable OpenWire advisory support as default created configuration on CLI

This commit is contained in:
franz1981 2021-08-06 10:01:35 +02:00
parent e72e7e74e9
commit f54c9156fa
3 changed files with 55 additions and 1 deletions

View File

@ -283,6 +283,12 @@ public class Create extends InputAbstract {
@Option(name = "--staticCluster", description = "Cluster node connectors list, separated by comma: Example \"tcp://server:61616,tcp://server2:61616,tcp://server3:61616\"")
String staticNode;
@Option(name = "--support-advisory", description = "If set, the generated configuration will allow advisories for the openwire protocol")
boolean supportAdvisory = false;
@Option(name = "--suppress-internal-management-objects", description = "If set, the generated configuration will register any advisory addresses/queues to management services for the openwire protocol")
boolean suppressInternalManagementObjects = false;
public String[] getStaticNodes() {
if (staticNode == null) {
return new String[0];
@ -626,6 +632,8 @@ public class Create extends InputAbstract {
}
filters.put("${fsync}", String.valueOf(!noJournalSync));
filters.put("${default.port}", String.valueOf(defaultPort + portOffset));
filters.put("${support-advisory}", Boolean.toString(supportAdvisory));
filters.put("${suppress-internal-management-objects}", Boolean.toString(suppressInternalManagementObjects));
filters.put("${amqp.port}", String.valueOf(AMQP_PORT + portOffset));
filters.put("${stomp.port}", String.valueOf(STOMP_PORT + portOffset));
filters.put("${hq.port}", String.valueOf(HQ_PORT + portOffset));

View File

@ -102,7 +102,7 @@ ${jdbc}
<!-- Acceptor for every supported protocol -->
<acceptor name="artemis">tcp://${host}:${default.port}?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;amqpMinLargeMessageSize=102400;protocols=CORE,AMQP,STOMP,HORNETQ,MQTT,OPENWIRE;useEpoll=true;amqpCredits=1000;amqpLowCredits=300;amqpDuplicateDetection=true</acceptor>
<acceptor name="artemis">tcp://${host}:${default.port}?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;amqpMinLargeMessageSize=102400;protocols=CORE,AMQP,STOMP,HORNETQ,MQTT,OPENWIRE;useEpoll=true;amqpCredits=1000;amqpLowCredits=300;amqpDuplicateDetection=true;supportAdvisory=${support-advisory};suppressInternalManagementObjects=${suppress-internal-management-objects}</acceptor>
${amqp-acceptor}${stomp-acceptor}${hornetq-acceptor}${mqtt-acceptor}
</acceptors>

View File

@ -41,6 +41,7 @@ import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
import org.apache.activemq.artemis.api.core.ActiveMQIllegalStateException;
@ -179,6 +180,51 @@ public class ArtemisTest extends CliTestBase {
}
}
@Test
public void testOpenwireSupportAdvisoryDisabledByDefault() throws Exception {
FileConfiguration configuration = createFileConfiguration("supportAdvisory",
"--force", "--silent", "--no-web", "--no-autotune");
Map<String, Object> params = configuration.getAcceptorConfigurations()
.stream().filter(tc -> tc.getName().equals("artemis")).findFirst().get().getExtraParams();
Assert.assertFalse(Boolean.parseBoolean(params.get("supportAdvisory").toString()));
Assert.assertFalse(Boolean.parseBoolean(params.get("suppressInternalManagementObjects").toString()));
}
@Test
public void testOpenwireEnabledSupportAdvisory() throws Exception {
FileConfiguration configuration = createFileConfiguration("supportAdvisory",
"--force", "--silent", "--no-web", "--no-autotune",
"--support-advisory", "--suppress-internal-management-objects");
Map<String, Object> params = configuration.getAcceptorConfigurations()
.stream().filter(tc -> tc.getName().equals("artemis")).findFirst().get().getExtraParams();
Assert.assertTrue(Boolean.parseBoolean(params.get("supportAdvisory").toString()));
Assert.assertTrue(Boolean.parseBoolean(params.get("suppressInternalManagementObjects").toString()));
}
private FileConfiguration createFileConfiguration(String folder, String... createAdditionalArg) throws Exception {
File instanceFolder = temporaryFolder.newFolder(folder);
setupAuth(instanceFolder);
// This is usually set when run from the command line via artemis.profile
Run.setEmbedded(true);
final String[] createArgs = new String[2 + (createAdditionalArg == null ? 0 : createAdditionalArg.length)];
createArgs[0] = "create";
createArgs[1] = instanceFolder.getAbsolutePath();
if (createAdditionalArg != null) {
System.arraycopy(createAdditionalArg, 0, createArgs, 2, createAdditionalArg.length);
}
Artemis.main(createArgs);
System.setProperty("artemis.instance", instanceFolder.getAbsolutePath());
FileConfiguration fc = new FileConfiguration();
FileDeploymentManager deploymentManager = new FileDeploymentManager(new File(instanceFolder, "./etc/broker.xml").toURI().toString());
deploymentManager.addDeployable(fc);
deploymentManager.readConfiguration();
return fc;
}
@Test
public void testWebConfig() throws Exception {
setupAuth();