diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisEmbeddedConfigurationFactory.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisEmbeddedConfigurationFactory.java index f81f11e50b9..ea12be48b28 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisEmbeddedConfigurationFactory.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisEmbeddedConfigurationFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -70,29 +70,22 @@ class ArtemisEmbeddedConfigurationFactory { + this.properties.getClusterPassword()); } configuration.setClusterPassword(this.properties.getClusterPassword()); + configuration.addAddressConfiguration(createAddressConfiguration("DLQ")); + configuration.addAddressConfiguration(createAddressConfiguration("ExpiryQueue")); configuration.addAddressesSetting("#", - new AddressSettings() - .setDeadLetterAddress(SimpleString.toSimpleString("DLQ")) - .setExpiryAddress(SimpleString.toSimpleString("ExpiryQueue"))); - configuration.addAddressConfiguration( - new CoreAddressConfiguration() - .setName("DLQ") - .addRoutingType(RoutingType.ANYCAST) - .addQueueConfiguration( - new CoreQueueConfiguration() - .setName("DLQ") - .setRoutingType(RoutingType.ANYCAST))); - configuration.addAddressConfiguration( - new CoreAddressConfiguration() - .setName("ExpiryQueue") - .addRoutingType(RoutingType.ANYCAST) - .addQueueConfiguration( - new CoreQueueConfiguration() - .setName("ExpiryQueue") - .setRoutingType(RoutingType.ANYCAST))); + new AddressSettings() + .setDeadLetterAddress(SimpleString.toSimpleString("DLQ")) + .setExpiryAddress(SimpleString.toSimpleString("ExpiryQueue"))); return configuration; } + private CoreAddressConfiguration createAddressConfiguration(String name) { + return new CoreAddressConfiguration().setName(name) + .addRoutingType(RoutingType.ANYCAST) + .addQueueConfiguration(new CoreQueueConfiguration().setName(name) + .setRoutingType(RoutingType.ANYCAST)); + } + private String getDataDir() { if (this.properties.getDataDirectory() != null) { return this.properties.getDataDirectory(); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisEmbeddedConfigurationFactoryTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisEmbeddedConfigurationFactoryTests.java index 0712721f33b..7054715d10a 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisEmbeddedConfigurationFactoryTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisEmbeddedConfigurationFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -78,18 +78,22 @@ public class ArtemisEmbeddedConfigurationFactoryTests { public void hasDlqExpiryQueueAddressSettingsConfigured() { ArtemisProperties properties = new ArtemisProperties(); Configuration configuration = new ArtemisEmbeddedConfigurationFactory(properties) - .createConfiguration(); - Map addressesSettings = configuration.getAddressesSettings(); - assertThat((CharSequence) addressesSettings.get("#").getDeadLetterAddress()).isEqualTo(SimpleString.toSimpleString("DLQ")); - assertThat((CharSequence) addressesSettings.get("#").getExpiryAddress()).isEqualTo(SimpleString.toSimpleString("ExpiryQueue")); + .createConfiguration(); + Map addressesSettings = configuration + .getAddressesSettings(); + assertThat((Object) addressesSettings.get("#").getDeadLetterAddress()) + .isEqualTo(SimpleString.toSimpleString("DLQ")); + assertThat((Object) addressesSettings.get("#").getExpiryAddress()) + .isEqualTo(SimpleString.toSimpleString("ExpiryQueue")); } @Test public void hasDlqExpiryQueueConfigured() { ArtemisProperties properties = new ArtemisProperties(); Configuration configuration = new ArtemisEmbeddedConfigurationFactory(properties) - .createConfiguration(); - List addressConfigurations = configuration.getAddressConfigurations(); + .createConfiguration(); + List addressConfigurations = configuration + .getAddressConfigurations(); assertThat(addressConfigurations).hasSize(2); } }