Skip to content

Commit cc8610b

Browse files
HofmeisterAnrafek1241WakaToa
authored
feat: Add EventHubs module (#1373)
Co-authored-by: rafek1241 <[email protected]> Co-authored-by: WakaToa <[email protected]>
1 parent fa256c6 commit cc8610b

17 files changed

+559
-11
lines changed

.github/workflows/cicd.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ jobs:
5252
{ name: "Testcontainers.DynamoDb", runs-on: "ubuntu-22.04" },
5353
{ name: "Testcontainers.Elasticsearch", runs-on: "ubuntu-22.04" },
5454
{ name: "Testcontainers.EventStoreDb", runs-on: "ubuntu-22.04" },
55+
{ name: "Testcontainers.EventHubs", runs-on: "ubuntu-22.04" },
5556
{ name: "Testcontainers.FakeGcsServer", runs-on: "ubuntu-22.04" },
5657
{ name: "Testcontainers.FirebirdSql", runs-on: "ubuntu-22.04" },
5758
{ name: "Testcontainers.Firestore", runs-on: "ubuntu-22.04" },

Directory.Packages.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
<PackageVersion Include="AWSSDK.SimpleNotificationService" Version="3.7.101.7"/>
3333
<PackageVersion Include="AWSSDK.SQS" Version="3.7.100.71"/>
3434
<PackageVersion Include="Azure.Data.Tables" Version="12.8.0"/>
35+
<PackageVersion Include="Azure.Messaging.EventHubs" Version="5.11.3"/>
3536
<PackageVersion Include="Azure.Messaging.ServiceBus" Version="7.18.2"/>
3637
<PackageVersion Include="Azure.Storage.Blobs" Version="12.17.0"/>
3738
<PackageVersion Include="Azure.Storage.Queues" Version="12.15.0"/>

Testcontainers.sln

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.DynamoDb", "
4141
EndProject
4242
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.Elasticsearch", "src\Testcontainers.Elasticsearch\Testcontainers.Elasticsearch.csproj", "{641DDEA5-B6E0-41E6-BA11-7A28C0913127}"
4343
EndProject
44+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.EventHubs", "src\Testcontainers.EventHubs\Testcontainers.EventHubs.csproj", "{0EF885E9-E973-47DC-AA9C-3A5E9175B0F3}"
45+
EndProject
4446
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.EventStoreDb", "src\Testcontainers.EventStoreDb\Testcontainers.EventStoreDb.csproj", "{84D707E0-C9FA-4327-85DC-0AFEBEA73572}"
4547
EndProject
4648
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.FakeGcsServer", "src\Testcontainers.FakeGcsServer\Testcontainers.FakeGcsServer.csproj", "{FF86B509-2F9E-4269-ABC2-912B3339DE29}"
@@ -143,6 +145,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.DynamoDb.Tes
143145
EndProject
144146
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.Elasticsearch.Tests", "tests\Testcontainers.Elasticsearch.Tests\Testcontainers.Elasticsearch.Tests.csproj", "{DD5B3678-468F-4D73-AECE-705E3D66CD43}"
145147
EndProject
148+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.EventHubs.Tests", "tests\Testcontainers.EventHubs.Tests\Testcontainers.EventHubs.Tests.csproj", "{4A0C5523-CEB2-49C9-AE62-9187A01B016B}"
149+
EndProject
146150
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.EventStoreDb.Tests", "tests\Testcontainers.EventStoreDb.Tests\Testcontainers.EventStoreDb.Tests.csproj", "{64F8E9B9-78FD-4E13-BDDF-0340E2D4E1D0}"
147151
EndProject
148152
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.FakeGcsServer.Tests", "tests\Testcontainers.FakeGcsServer.Tests\Testcontainers.FakeGcsServer.Tests.csproj", "{9F27AA1B-C25D-400C-BCB0-6B0BF1A1DCEA}"
@@ -282,6 +286,10 @@ Global
282286
{641DDEA5-B6E0-41E6-BA11-7A28C0913127}.Debug|Any CPU.Build.0 = Debug|Any CPU
283287
{641DDEA5-B6E0-41E6-BA11-7A28C0913127}.Release|Any CPU.ActiveCfg = Release|Any CPU
284288
{641DDEA5-B6E0-41E6-BA11-7A28C0913127}.Release|Any CPU.Build.0 = Release|Any CPU
289+
{0EF885E9-E973-47DC-AA9C-3A5E9175B0F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
290+
{0EF885E9-E973-47DC-AA9C-3A5E9175B0F3}.Debug|Any CPU.Build.0 = Debug|Any CPU
291+
{0EF885E9-E973-47DC-AA9C-3A5E9175B0F3}.Release|Any CPU.ActiveCfg = Release|Any CPU
292+
{0EF885E9-E973-47DC-AA9C-3A5E9175B0F3}.Release|Any CPU.Build.0 = Release|Any CPU
285293
{84D707E0-C9FA-4327-85DC-0AFEBEA73572}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
286294
{84D707E0-C9FA-4327-85DC-0AFEBEA73572}.Debug|Any CPU.Build.0 = Debug|Any CPU
287295
{84D707E0-C9FA-4327-85DC-0AFEBEA73572}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -486,6 +494,10 @@ Global
486494
{DD5B3678-468F-4D73-AECE-705E3D66CD43}.Debug|Any CPU.Build.0 = Debug|Any CPU
487495
{DD5B3678-468F-4D73-AECE-705E3D66CD43}.Release|Any CPU.ActiveCfg = Release|Any CPU
488496
{DD5B3678-468F-4D73-AECE-705E3D66CD43}.Release|Any CPU.Build.0 = Release|Any CPU
497+
{4A0C5523-CEB2-49C9-AE62-9187A01B016B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
498+
{4A0C5523-CEB2-49C9-AE62-9187A01B016B}.Debug|Any CPU.Build.0 = Debug|Any CPU
499+
{4A0C5523-CEB2-49C9-AE62-9187A01B016B}.Release|Any CPU.ActiveCfg = Release|Any CPU
500+
{4A0C5523-CEB2-49C9-AE62-9187A01B016B}.Release|Any CPU.Build.0 = Release|Any CPU
489501
{64F8E9B9-78FD-4E13-BDDF-0340E2D4E1D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
490502
{64F8E9B9-78FD-4E13-BDDF-0340E2D4E1D0}.Debug|Any CPU.Build.0 = Debug|Any CPU
491503
{64F8E9B9-78FD-4E13-BDDF-0340E2D4E1D0}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -650,6 +662,7 @@ Global
650662
{ED3C611F-DFE2-4AB7-A323-B500E95B4FF9} = {673F23AE-7694-4BB9-ABD4-136D6C13634E}
651663
{2EAFA567-9F68-4C52-9DBC-8F3EC11BB2CE} = {673F23AE-7694-4BB9-ABD4-136D6C13634E}
652664
{641DDEA5-B6E0-41E6-BA11-7A28C0913127} = {673F23AE-7694-4BB9-ABD4-136D6C13634E}
665+
{0EF885E9-E973-47DC-AA9C-3A5E9175B0F3} = {673F23AE-7694-4BB9-ABD4-136D6C13634E}
653666
{84D707E0-C9FA-4327-85DC-0AFEBEA73572} = {673F23AE-7694-4BB9-ABD4-136D6C13634E}
654667
{FF86B509-2F9E-4269-ABC2-912B3339DE29} = {673F23AE-7694-4BB9-ABD4-136D6C13634E}
655668
{31BAF2C4-0608-4C0F-845A-14FE7C0A1670} = {673F23AE-7694-4BB9-ABD4-136D6C13634E}
@@ -701,6 +714,7 @@ Global
701714
{AF9853AB-86E7-49DE-8DF8-454838E90D6F} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF}
702715
{101515E6-74C1-40F9-85C8-871F742A378D} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF}
703716
{DD5B3678-468F-4D73-AECE-705E3D66CD43} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF}
717+
{4A0C5523-CEB2-49C9-AE62-9187A01B016B} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF}
704718
{64F8E9B9-78FD-4E13-BDDF-0340E2D4E1D0} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF}
705719
{9F27AA1B-C25D-400C-BCB0-6B0BF1A1DCEA} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF}
706720
{E39095AC-9B34-4178-A486-04C902B6FD33} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF}

docs/modules/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ await moduleNameContainer.StartAsync();
2424
| ActiveMQ Artemis | `apache/activemq-artemis:2.31.2` | [NuGet](https://www.nuget.org/packages/Testcontainers.ActiveMq) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.ActiveMq) |
2525
| ArangoDB | `arangodb:3.11.5` | [NuGet](https://www.nuget.org/packages/Testcontainers.ArangoDb) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.ArangoDb) |
2626
| Azure Cosmos DB | `mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator:latest` | [NuGet](https://www.nuget.org/packages/Testcontainers.CosmosDb) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.CosmosDb) |
27+
| Azure Event Hubs | `mcr.microsoft.com/azure-messaging/eventhubs-emulator:latest` | [NuGet](https://www.nuget.org/packages/Testcontainers.EventHubs) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.EventHubs) |
2728
| Azure Service Bus | `mcr.microsoft.com/azure-messaging/servicebus-emulator:latest` | [NuGet](https://www.nuget.org/packages/Testcontainers.ServiceBus) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.ServiceBus) |
2829
| Azurite | `mcr.microsoft.com/azure-storage/azurite:3.24.0` | [NuGet](https://www.nuget.org/packages/Testcontainers.Azurite) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.Azurite) |
2930
| BigQuery | `ghcr.io/goccy/bigquery-emulator:0.4` | [NuGet](https://www.nuget.org/packages/Testcontainers.BigQuery) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.BigQuery) |

src/Testcontainers.Azurite/AzuriteContainer.cs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,30 +32,27 @@ public string GetConnectionString()
3232
/// <summary>
3333
/// Gets the blob endpoint
3434
/// </summary>
35-
/// <returns>The azurite blob endpoint</returns>
35+
/// <returns>The Azurite blob endpoint</returns>
3636
public string GetBlobEndpoint()
3737
{
38-
return new UriBuilder(Uri.UriSchemeHttp, Hostname, GetMappedPublicPort(AzuriteBuilder.BlobPort),
39-
AzuriteBuilder.AccountName).ToString();
38+
return new UriBuilder(Uri.UriSchemeHttp, Hostname, GetMappedPublicPort(AzuriteBuilder.BlobPort), AzuriteBuilder.AccountName).ToString();
4039
}
4140

4241
/// <summary>
4342
/// Gets the queue endpoint
4443
/// </summary>
45-
/// <returns>The azurite queue endpoint</returns>
44+
/// <returns>The Azurite queue endpoint</returns>
4645
public string GetQueueEndpoint()
4746
{
48-
return new UriBuilder(Uri.UriSchemeHttp, Hostname, GetMappedPublicPort(AzuriteBuilder.QueuePort),
49-
AzuriteBuilder.AccountName).ToString();
47+
return new UriBuilder(Uri.UriSchemeHttp, Hostname, GetMappedPublicPort(AzuriteBuilder.QueuePort), AzuriteBuilder.AccountName).ToString();
5048
}
5149

5250
/// <summary>
5351
/// Gets the table endpoint
5452
/// </summary>
55-
/// <returns>The azurite table endpoint</returns>
53+
/// <returns>The Azurite table endpoint</returns>
5654
public string GetTableEndpoint()
5755
{
58-
return new UriBuilder(Uri.UriSchemeHttp, Hostname, GetMappedPublicPort(AzuriteBuilder.TablePort),
59-
AzuriteBuilder.AccountName).ToString();
56+
return new UriBuilder(Uri.UriSchemeHttp, Hostname, GetMappedPublicPort(AzuriteBuilder.TablePort), AzuriteBuilder.AccountName).ToString();
6057
}
6158
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
root = true
Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
namespace Testcontainers.EventHubs;
2+
3+
/// <inheritdoc cref="ContainerBuilder{TBuilderEntity, TContainerEntity, TConfigurationEntity}" />
4+
[PublicAPI]
5+
public sealed class EventHubsBuilder : ContainerBuilder<EventHubsBuilder, EventHubsContainer, EventHubsConfiguration>
6+
{
7+
public const string EventHubsNetworkAlias = "eventhubs-container";
8+
9+
public const string AzuriteNetworkAlias = "azurite-container";
10+
11+
public const string EventHubsImage = "mcr.microsoft.com/azure-messaging/eventhubs-emulator:latest";
12+
13+
public const ushort EventHubsPort = 5672;
14+
15+
/// <summary>
16+
/// Initializes a new instance of the <see cref="EventHubsBuilder" /> class.
17+
/// </summary>
18+
public EventHubsBuilder()
19+
: this(new EventHubsConfiguration())
20+
{
21+
DockerResourceConfiguration = Init().DockerResourceConfiguration;
22+
}
23+
24+
/// <summary>
25+
/// Initializes a new instance of the <see cref="EventHubsBuilder" /> class.
26+
/// </summary>
27+
/// <param name="resourceConfiguration">The Docker resource configuration.</param>
28+
private EventHubsBuilder(EventHubsConfiguration resourceConfiguration)
29+
: base(resourceConfiguration)
30+
{
31+
DockerResourceConfiguration = resourceConfiguration;
32+
}
33+
34+
/// <inheritdoc />
35+
protected override EventHubsConfiguration DockerResourceConfiguration { get; }
36+
37+
/// <inheritdoc />
38+
protected override string AcceptLicenseAgreementEnvVar { get; } = "ACCEPT_EULA";
39+
40+
/// <inheritdoc />
41+
protected override string AcceptLicenseAgreement { get; } = "Y";
42+
43+
/// <inheritdoc />
44+
protected override string DeclineLicenseAgreement { get; } = "N";
45+
46+
/// <summary>
47+
/// Accepts the license agreement.
48+
/// </summary>
49+
/// <remarks>
50+
/// When <paramref name="acceptLicenseAgreement" /> is set to <c>true</c>, the Azure Event Hubs Emulator <see href="https://github.com/Azure/azure-event-hubs-emulator-installer/blob/main/EMULATOR_EULA.md">license</see> is accepted.
51+
/// </remarks>
52+
/// <param name="acceptLicenseAgreement">A boolean value indicating whether the Azure Event Hubs Emulator license agreement is accepted.</param>
53+
/// <returns>A configured instance of <see cref="EventHubsBuilder" />.</returns>
54+
public override EventHubsBuilder WithAcceptLicenseAgreement(bool acceptLicenseAgreement)
55+
{
56+
var licenseAgreement = acceptLicenseAgreement ? AcceptLicenseAgreement : DeclineLicenseAgreement;
57+
return WithEnvironment(AcceptLicenseAgreementEnvVar, licenseAgreement);
58+
}
59+
60+
/// <summary>
61+
/// Sets the dependent Azurite container for the Azure Event Hubs Emulator.
62+
/// </summary>
63+
/// <remarks>
64+
/// This method allows an existing Azurite container to be attached to the Azure Event
65+
/// Hubs Emulator. The containers must be on the same network to enable communication
66+
/// between them.
67+
/// </remarks>
68+
/// <param name="network">The network to connect the container to.</param>
69+
/// <param name="container">The Azurite container.</param>
70+
/// <param name="networkAlias">The Azurite container network alias.</param>
71+
/// <returns>A configured instance of <see cref="EventHubsBuilder" />.</returns>
72+
public EventHubsBuilder WithAzuriteContainer(
73+
INetwork network,
74+
AzuriteContainer container,
75+
string networkAlias)
76+
{
77+
return Merge(DockerResourceConfiguration, new EventHubsConfiguration(azuriteContainer: container))
78+
.DependsOn(container)
79+
.WithNetwork(network)
80+
.WithNetworkAliases(EventHubsNetworkAlias)
81+
.WithEnvironment("BLOB_SERVER", networkAlias)
82+
.WithEnvironment("METADATA_SERVER", networkAlias);
83+
}
84+
85+
/// <summary>
86+
/// Sets the Azure Event Hubs Emulator configuration.
87+
/// </summary>
88+
/// <param name="serviceConfiguration">The service configuration.</param>
89+
/// <returns>A configured instance of <see cref="EventHubsBuilder" />.</returns>
90+
public EventHubsBuilder WithConfigurationBuilder(EventHubsServiceConfiguration serviceConfiguration)
91+
{
92+
var resourceContent = Encoding.Default.GetBytes(serviceConfiguration.Build());
93+
return Merge(DockerResourceConfiguration, new EventHubsConfiguration(serviceConfiguration: serviceConfiguration))
94+
.WithResourceMapping(resourceContent, "Eventhubs_Emulator/ConfigFiles/Config.json");
95+
}
96+
97+
/// <inheritdoc />
98+
public override EventHubsContainer Build()
99+
{
100+
Validate();
101+
ValidateLicenseAgreement();
102+
103+
if (DockerResourceConfiguration.AzuriteContainer != null)
104+
{
105+
return new EventHubsContainer(DockerResourceConfiguration);
106+
}
107+
108+
// If the user has not provided an existing Azurite container instance,
109+
// we configure one.
110+
var network = new NetworkBuilder()
111+
.Build();
112+
113+
var container = new AzuriteBuilder()
114+
.WithNetwork(network)
115+
.WithNetworkAliases(AzuriteNetworkAlias)
116+
.Build();
117+
118+
var eventHubsContainer = WithAzuriteContainer(network, container, AzuriteNetworkAlias);
119+
return new EventHubsContainer(eventHubsContainer.DockerResourceConfiguration);
120+
}
121+
122+
/// <inheritdoc />
123+
protected override void Validate()
124+
{
125+
base.Validate();
126+
127+
_ = Guard.Argument(DockerResourceConfiguration.ServiceConfiguration, nameof(DockerResourceConfiguration.ServiceConfiguration))
128+
.NotNull()
129+
.ThrowIf(argument => !argument.Value.Validate(), _ => throw new ArgumentException("The service configuration of the Azure Event Hubs Emulator is invalid."));
130+
}
131+
132+
/// <inheritdoc />
133+
protected override EventHubsBuilder Init()
134+
{
135+
return base.Init()
136+
.WithImage(EventHubsImage)
137+
.WithPortBinding(EventHubsPort, true)
138+
.WithWaitStrategy(Wait.ForUnixContainer()
139+
.UntilMessageIsLogged("Emulator Service is Successfully Up!")
140+
.AddCustomWaitStrategy(new WaitTwoSeconds()));
141+
}
142+
143+
/// <inheritdoc />
144+
protected override EventHubsBuilder Clone(IResourceConfiguration<CreateContainerParameters> resourceConfiguration)
145+
{
146+
return Merge(DockerResourceConfiguration, new EventHubsConfiguration(resourceConfiguration));
147+
}
148+
149+
/// <inheritdoc />
150+
protected override EventHubsBuilder Clone(IContainerConfiguration resourceConfiguration)
151+
{
152+
return Merge(DockerResourceConfiguration, new EventHubsConfiguration(resourceConfiguration));
153+
}
154+
155+
/// <inheritdoc />
156+
protected override EventHubsBuilder Merge(EventHubsConfiguration oldValue, EventHubsConfiguration newValue)
157+
{
158+
return new EventHubsBuilder(new EventHubsConfiguration(oldValue, newValue));
159+
}
160+
161+
/// <inheritdoc cref="IWaitUntil" />
162+
/// <remarks>
163+
/// This is a workaround to ensure that the wait strategy does not indicate
164+
/// readiness too early:
165+
/// https://github.com/Azure/azure-service-bus-emulator-installer/issues/35#issuecomment-2497164533.
166+
/// </remarks>
167+
private sealed class WaitTwoSeconds : IWaitUntil
168+
{
169+
/// <inheritdoc />
170+
public async Task<bool> UntilAsync(IContainer container)
171+
{
172+
await Task.Delay(TimeSpan.FromSeconds(2))
173+
.ConfigureAwait(false);
174+
175+
return true;
176+
}
177+
}
178+
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
namespace Testcontainers.EventHubs;
2+
3+
/// <inheritdoc cref="ContainerConfiguration" />
4+
[PublicAPI]
5+
public sealed class EventHubsConfiguration : ContainerConfiguration
6+
{
7+
/// <summary>
8+
/// Initializes a new instance of the <see cref="EventHubsConfiguration" /> class.
9+
/// </summary>
10+
/// <param name="azuriteContainer">The Azurite container.</param>
11+
/// <param name="serviceConfiguration">The service configuration.</param>
12+
public EventHubsConfiguration(AzuriteContainer azuriteContainer = null,
13+
EventHubsServiceConfiguration serviceConfiguration = null)
14+
{
15+
AzuriteContainer = azuriteContainer;
16+
ServiceConfiguration = serviceConfiguration;
17+
}
18+
19+
/// <summary>
20+
/// Initializes a new instance of the <see cref="EventHubsConfiguration" /> class.
21+
/// </summary>
22+
/// <param name="resourceConfiguration">The Docker resource configuration.</param>
23+
public EventHubsConfiguration(IResourceConfiguration<CreateContainerParameters> resourceConfiguration)
24+
: base(resourceConfiguration)
25+
{
26+
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
27+
}
28+
29+
/// <summary>
30+
/// Initializes a new instance of the <see cref="EventHubsConfiguration" /> class.
31+
/// </summary>
32+
/// <param name="resourceConfiguration">The Docker resource configuration.</param>
33+
public EventHubsConfiguration(IContainerConfiguration resourceConfiguration)
34+
: base(resourceConfiguration)
35+
{
36+
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
37+
}
38+
39+
/// <summary>
40+
/// Initializes a new instance of the <see cref="EventHubsConfiguration" /> class.
41+
/// </summary>
42+
/// <param name="resourceConfiguration">The Docker resource configuration.</param>
43+
public EventHubsConfiguration(EventHubsConfiguration resourceConfiguration)
44+
: this(new EventHubsConfiguration(), resourceConfiguration)
45+
{
46+
// Passes the configuration upwards to the base implementations to create an updated immutable copy.
47+
}
48+
49+
/// <summary>
50+
/// Initializes a new instance of the <see cref="EventHubsConfiguration" /> class.
51+
/// </summary>
52+
/// <param name="oldValue">The old Docker resource configuration.</param>
53+
/// <param name="newValue">The new Docker resource configuration.</param>
54+
public EventHubsConfiguration(EventHubsConfiguration oldValue, EventHubsConfiguration newValue)
55+
: base(oldValue, newValue)
56+
{
57+
AzuriteContainer = BuildConfiguration.Combine(oldValue.AzuriteContainer, newValue.AzuriteContainer);
58+
ServiceConfiguration = BuildConfiguration.Combine(oldValue.ServiceConfiguration, newValue.ServiceConfiguration);
59+
}
60+
61+
/// <summary>
62+
/// Gets the Azurite container.
63+
/// </summary>
64+
public AzuriteContainer AzuriteContainer { get; }
65+
66+
/// <summary>
67+
/// Gets the service configuration.
68+
/// </summary>
69+
public EventHubsServiceConfiguration ServiceConfiguration { get; }
70+
}

0 commit comments

Comments
 (0)