Skip to content

Commit ef308d7

Browse files
committed
Removed test with default config
1 parent 8f4f95f commit ef308d7

File tree

2 files changed

+15
-27
lines changed

2 files changed

+15
-27
lines changed

docs/modules/azure.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,17 +110,17 @@ Test against the Emulator:
110110
Start Azure service bus Emulator during a test:
111111

112112
<!--codeinclude-->
113-
[Starting a Azure Service bus Emulator container](../../modules/azure/src/test/java/org/testcontainers/azure/AzureServicebusEmulatorContainerTest.java) inside_block:emulatorContainerDefaultConfig
113+
[Starting a Azure Service bus Emulator container with custom config](../../modules/azure/src/test/java/org/testcontainers/azure/AzureServicebusEmulatorContainerTest.java) inside_block:emulatorContainerCustomConfig
114114
<!--/codeinclude-->
115115

116116
!!! note
117-
This starts the service bus emulator with the [default config](https://github.com/Azure/azure-service-bus-emulator-installer/blob/main/ServiceBus-Emulator/Config/Config.json)
118-
119-
Start Azure service bus Emulator with custom config during a test:
117+
This starts the service bus emulator with a custom config.
118+
To use [default config](https://github.com/Azure/azure-service-bus-emulator-installer/blob/main/ServiceBus-Emulator/Config/Config.json)
119+
omit `withConfigFile(...)`.
120120

121-
<!--codeinclude-->
122-
[Starting a Azure Service bus Emulator container with custom config](../../modules/azure/src/test/java/org/testcontainers/azure/AzureServicebusEmulatorContainerTest.java) inside_block:emulatorContainerCustomConfig
123-
<!--/codeinclude-->
121+
!!! note
122+
The service bus emulator requires a database, so a [MSSQLServerContainer](../../modules/mssqlserver/src/main/java/org/testcontainers/containers/MSSQLServerContainer.java)
123+
is started.
124124

125125
Build Azure Service bus sender client:
126126

modules/azure/src/test/java/org/testcontainers/azure/AzureServicebusEmulatorContainerTest.java

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,6 @@
1919

2020
public class AzureServicebusEmulatorContainerTest {
2121

22-
@Test
23-
public void testWithDefaultConfig() {
24-
try(
25-
// emulatorContainerDefaultConfig {
26-
AzureServicebusEmulatorContainer azureServicebusEmulatorContainer = new AzureServicebusEmulatorContainer(
27-
DockerImageName.parse("mcr.microsoft.com/azure-messaging/servicebus-emulator")
28-
)
29-
// }
30-
) {
31-
sendAndReceive(azureServicebusEmulatorContainer, "queue.1");
32-
}
33-
}
34-
3522
@Test
3623
public void testWithCustomConfig() {
3724
try(
@@ -41,27 +28,28 @@ public void testWithCustomConfig() {
4128
).withConfigFile(MountableFile.forClasspathResource("/servicebus-config.json"))
4229
// }
4330
) {
44-
sendAndReceive(azureServicebusEmulatorContainer, "our.queue");
31+
azureServicebusEmulatorContainer.start();
32+
sendAndReceive(azureServicebusEmulatorContainer.getConnectionString(), "our.queue");
4533
}
4634
}
4735

48-
private static void sendAndReceive(AzureServicebusEmulatorContainer azureServicebusEmulatorContainer, String queueName) {
36+
private static void sendAndReceive(String connectionString, String queueName) {
4937
List<String> sentMessages = Arrays.asList("Hello World");
5038
try (
5139
// buildClient {
5240
ServiceBusSenderClient sender = new ServiceBusClientBuilder()
53-
.connectionString(azureServicebusEmulatorContainer.getConnectionString())
54-
.sender()
55-
.queueName(queueName)
56-
.buildClient()
41+
.connectionString(connectionString)
42+
.sender()
43+
.queueName(queueName)
44+
.buildClient()
5745
// }
5846
) {
5947
for (String m : sentMessages) {
6048
sender.sendMessage(new ServiceBusMessage(m));
6149
}
6250
}
6351
try (ServiceBusReceiverClient reciever = new ServiceBusClientBuilder()
64-
.connectionString(azureServicebusEmulatorContainer.getConnectionString())
52+
.connectionString(connectionString)
6553
.receiver()
6654
.queueName(queueName)
6755
.receiveMode(ServiceBusReceiveMode.RECEIVE_AND_DELETE)

0 commit comments

Comments
 (0)