|
5 | 5 |
|
6 | 6 | import com.azure.core.amqp.AmqpTransportType; |
7 | 7 | import com.azure.messaging.servicebus.ServiceBusClientBuilder; |
| 8 | +import com.azure.messaging.servicebus.ServiceBusProcessorClient; |
| 9 | +import com.azure.messaging.servicebus.ServiceBusReceiverClient; |
8 | 10 | import com.azure.messaging.servicebus.ServiceBusSenderClient; |
9 | 11 | import com.azure.messaging.servicebus.models.ServiceBusReceiveMode; |
10 | 12 | import com.azure.spring.cloud.autoconfigure.implementation.AbstractAzureServiceConfigurationTests; |
@@ -174,6 +176,55 @@ void producerDedicatedConnectionStringShouldConfigureWithoutTopLevelConnectionIn |
174 | 176 | }); |
175 | 177 | } |
176 | 178 |
|
| 179 | + @Test |
| 180 | + void producerDedicatedNamespaceShouldConfigureWithoutTopLevelConnectionInfo() { |
| 181 | + this.contextRunner |
| 182 | + .withPropertyValues( |
| 183 | + "spring.cloud.azure.servicebus.producer.namespace=producer-namespace", |
| 184 | + "spring.cloud.azure.servicebus.producer.entity-name=test-queue", |
| 185 | + "spring.cloud.azure.servicebus.producer.entity-type=queue" |
| 186 | + ) |
| 187 | + .withBean(AzureGlobalProperties.class, AzureGlobalProperties::new) |
| 188 | + .run(context -> { |
| 189 | + assertThat(context).hasSingleBean(AzureServiceBusProperties.class); |
| 190 | + assertThat(context).hasSingleBean(ServiceBusSenderClient.class); |
| 191 | + }); |
| 192 | + } |
| 193 | + |
| 194 | + @Test |
| 195 | + void consumerDedicatedConnectionDetailsShouldConfigureWithoutTopLevelConnectionInfo() { |
| 196 | + this.contextRunner |
| 197 | + .withPropertyValues( |
| 198 | + "spring.cloud.azure.servicebus.consumer.connection-string=" + String.format(CONNECTION_STRING_FORMAT, "consumer-namespace"), |
| 199 | + "spring.cloud.azure.servicebus.consumer.namespace=consumer-namespace", |
| 200 | + "spring.cloud.azure.servicebus.consumer.entity-name=test-queue", |
| 201 | + "spring.cloud.azure.servicebus.consumer.entity-type=queue" |
| 202 | + ) |
| 203 | + .withBean(AzureGlobalProperties.class, AzureGlobalProperties::new) |
| 204 | + .run(context -> { |
| 205 | + assertThat(context).hasSingleBean(AzureServiceBusProperties.class); |
| 206 | + assertThat(context).hasSingleBean(ServiceBusReceiverClient.class); |
| 207 | + }); |
| 208 | + } |
| 209 | + |
| 210 | + @Test |
| 211 | + void processorDedicatedConnectionDetailsShouldConfigureWithoutTopLevelConnectionInfo() { |
| 212 | + this.contextRunner |
| 213 | + .withPropertyValues( |
| 214 | + "spring.cloud.azure.servicebus.processor.connection-string=" + String.format(CONNECTION_STRING_FORMAT, "processor-namespace"), |
| 215 | + "spring.cloud.azure.servicebus.processor.namespace=processor-namespace", |
| 216 | + "spring.cloud.azure.servicebus.processor.entity-name=test-queue", |
| 217 | + "spring.cloud.azure.servicebus.processor.entity-type=queue" |
| 218 | + ) |
| 219 | + .withBean(AzureGlobalProperties.class, AzureGlobalProperties::new) |
| 220 | + .withBean(ServiceBusRecordMessageListener.class, () -> messageContext -> { }) |
| 221 | + .withBean(ServiceBusErrorHandler.class, () -> errorContext -> { }) |
| 222 | + .run(context -> { |
| 223 | + assertThat(context).hasSingleBean(AzureServiceBusProperties.class); |
| 224 | + assertThat(context).hasSingleBean(ServiceBusProcessorClient.class); |
| 225 | + }); |
| 226 | + } |
| 227 | + |
177 | 228 | @Test |
178 | 229 | void configurationPropertiesShouldBind() { |
179 | 230 | String connectionString = String.format(CONNECTION_STRING_FORMAT, "fake-namespace"); |
|
0 commit comments