1313 */
1414package org .apache .karaf .camel .itest ;
1515
16+ import java .time .Duration ;
17+
1618import org .apache .karaf .camel .itests .AbstractCamelSingleFeatureResultMockBasedRouteITest ;
1719import org .apache .karaf .camel .itests .CamelKarafTestHint ;
1820import org .apache .karaf .camel .itests .GenericContainerResource ;
2527import org .testcontainers .containers .Network ;
2628import org .testcontainers .azure .AzuriteContainer ;
2729import org .testcontainers .containers .wait .strategy .Wait ;
30+ import org .testcontainers .images .builder .Transferable ;
2831
2932@ CamelKarafTestHint (externalResourceProvider = CamelAzureEventhubsITest .ExternalResourceProviders .class )
3033@ RunWith (PaxExamWithExternalResource .class )
@@ -38,12 +41,45 @@ public void testResultMock() throws Exception {
3841 assertMockEndpointsSatisfied ();
3942 }
4043
44+ @ Override
45+ public void assertMockEndpointsSatisfied () throws InterruptedException {
46+ getMockEndpoint ().setResultWaitTime (60_000 );
47+ getMockEndpoint ().assertIsSatisfied ();
48+ }
49+
4150 public static final class ExternalResourceProviders {
4251 private static final String DEFAULT_ACCOUNT_NAME = "devstoreaccount1" ;
4352 private static final String DEFAULT_ACCOUNT_KEY
4453 = "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==" ;
4554 private static final int AZURITE_ORIGINAL_PORT = 10000 ;
4655
56+ private static final String EVENTHUBS_CONFIG = """
57+ {
58+ "UserConfig": {
59+ "NamespaceConfig": [
60+ {
61+ "Type": "EventHub",
62+ "Name": "emulatorNs1",
63+ "Entities": [
64+ {
65+ "Name": "eh1",
66+ "PartitionCount": "2",
67+ "ConsumerGroups": [
68+ {
69+ "Name": "$Default"
70+ }
71+ ]
72+ }
73+ ]
74+ }
75+ ],
76+ "LoggingConfig": {
77+ "Type": "File"
78+ }
79+ }
80+ }
81+ """ ;
82+
4783 private static final Network network = Network .newNetwork ();
4884 private static final AzuriteContainer azuriteContainer =
4985 new AzuriteContainer ("mcr.microsoft.com/azure-storage/azurite:3.33.0" )
@@ -65,9 +101,13 @@ public static GenericContainerResource<AzuriteContainer> createAzureStorageConta
65101 public static GenericContainerResource <EventHubsEmulatorContainer > createAzureEventHubsContainer () {
66102 EventHubsEmulatorContainer eventHubContainer =
67103 new EventHubsEmulatorContainer ("mcr.microsoft.com/azure-messaging/eventhubs-emulator:2.0.1" )
68- .withNetwork (network ).withNetworkAliases ("eventhubs-emulator" ).withAzuriteContainer (azuriteContainer )
69- .withExposedPorts (EVENTHUBS_EMULATOR_PORT )
70- .withEnv ("ACCEPT_EULA" , "Y" );
104+ .withNetwork (network )
105+ .withNetworkAliases ("eventhubs-emulator" )
106+ .withAzuriteContainer (azuriteContainer )
107+ .acceptLicense ()
108+ .withConfig (Transferable .of (EVENTHUBS_CONFIG ))
109+ .waitingFor (Wait .forLogMessage (".*Emulator Service is Successfully Up!.*" , 1 )
110+ .withStartupTimeout (Duration .ofMinutes (3 )));
71111
72112 return new GenericContainerResource <>(eventHubContainer , resource -> {
73113 resource .setProperty ("azure.connectionString" , eventHubContainer .getConnectionString ());
0 commit comments