Skip to content

Commit e04840b

Browse files
neildsouthwoodheadio
authored andcommitted
fix for where hl7Config plugin is blank
Signed-off-by: Neil South <[email protected]>
1 parent b146513 commit e04840b

File tree

5 files changed

+54
-10
lines changed

5 files changed

+54
-10
lines changed

src/Api/packages.lock.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@
4141
},
4242
"Microsoft.NET.ILLink.Tasks": {
4343
"type": "Direct",
44-
"requested": "[8.0.2, )",
45-
"resolved": "8.0.2",
46-
"contentHash": "hKTrehpfVzOhAz0mreaTAZgbz0DrMEbWq4n3hAo8Ks6WdxdqQhNPvzOqn9VygKuWf1bmxPdraqzTaXriO/sn0A=="
44+
"requested": "[8.0.3, )",
45+
"resolved": "8.0.3",
46+
"contentHash": "0kwNg0LBIvVTx9A2mo9Mnw4wLGtaeQgjSz5P13bOOwdWPPLe9HzI+XTkwiMhS7iQCM6X4LAbFR76xScaMw0MrA=="
4747
},
4848
"Monai.Deploy.Messaging": {
4949
"type": "Direct",

src/CLI/packages.lock.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@
3535
},
3636
"Microsoft.NET.ILLink.Tasks": {
3737
"type": "Direct",
38-
"requested": "[8.0.2, )",
39-
"resolved": "8.0.2",
40-
"contentHash": "hKTrehpfVzOhAz0mreaTAZgbz0DrMEbWq4n3hAo8Ks6WdxdqQhNPvzOqn9VygKuWf1bmxPdraqzTaXriO/sn0A=="
38+
"requested": "[8.0.3, )",
39+
"resolved": "8.0.3",
40+
"contentHash": "0kwNg0LBIvVTx9A2mo9Mnw4wLGtaeQgjSz5P13bOOwdWPPLe9HzI+XTkwiMhS7iQCM6X4LAbFR76xScaMw0MrA=="
4141
},
4242
"System.CommandLine.Hosting": {
4343
"type": "Direct",

src/Configuration/packages.lock.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
"net8.0": {
55
"Microsoft.NET.ILLink.Tasks": {
66
"type": "Direct",
7-
"requested": "[8.0.2, )",
8-
"resolved": "8.0.2",
9-
"contentHash": "hKTrehpfVzOhAz0mreaTAZgbz0DrMEbWq4n3hAo8Ks6WdxdqQhNPvzOqn9VygKuWf1bmxPdraqzTaXriO/sn0A=="
7+
"requested": "[8.0.3, )",
8+
"resolved": "8.0.3",
9+
"contentHash": "0kwNg0LBIvVTx9A2mo9Mnw4wLGtaeQgjSz5P13bOOwdWPPLe9HzI+XTkwiMhS7iQCM6X4LAbFR76xScaMw0MrA=="
1010
},
1111
"Ardalis.GuardClauses": {
1212
"type": "Transitive",

src/InformaticsGateway/Services/HealthLevel7/MllpService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ private async Task ConfigurePlugInEngine()
220220
{
221221
try
222222
{
223-
pluginAssemblies.AddRange(config.PlugInAssemblies.Where(p => pluginAssemblies.Contains(p) is false));
223+
pluginAssemblies.AddRange(config.PlugInAssemblies.Where(p => string.IsNullOrWhiteSpace(p) is false && pluginAssemblies.Contains(p) is false));
224224
}
225225
catch (Exception ex)
226226
{

src/InformaticsGateway/Test/Services/HealthLevel7/MllpServiceTest.cs

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,5 +366,49 @@ public async Task GivenATcpClientWithHl7Messages_WhenDisconnected_ExpectMessageT
366366

367367
_mIIpExtract.Verify(p => p.ExtractInfo(It.IsAny<Hl7FileStorageMetadata>(), It.IsAny<Message>(), It.IsAny<Hl7ApplicationConfigEntity>()), Times.Exactly(3));
368368
}
369+
370+
[RetryFact(10, 250)]
371+
public async Task GivenATcpClientWithHl7Messages_ShouldntAdddBlankPlugin()
372+
{
373+
var checkEvent = new ManualResetEventSlim();
374+
var client = new Mock<IMllpClient>();
375+
_mIIpExtract.Setup(e => e.ExtractInfo(It.IsAny<Hl7FileStorageMetadata>(), It.IsAny<Message>(), It.IsAny<Hl7ApplicationConfigEntity>()))
376+
.ReturnsAsync((Hl7FileStorageMetadata meta, Message Msg, Hl7ApplicationConfigEntity configItem) => Msg);
377+
378+
_hl7ApplicationConfigRepository.Setup(p => p.GetAllAsync(It.IsAny<CancellationToken>()))
379+
.ReturnsAsync(new List<Hl7ApplicationConfigEntity> { new Hl7ApplicationConfigEntity {
380+
PlugInAssemblies = [""]
381+
} });
382+
383+
_mllpClientFactory.Setup(p => p.CreateClient(It.IsAny<ITcpClientAdapter>(), It.IsAny<Hl7Configuration>(), It.IsAny<ILogger<MllpClient>>()))
384+
.Returns(() =>
385+
{
386+
client.Setup(p => p.Start(It.IsAny<Func<IMllpClient, MllpClientResult, Task>>(), It.IsAny<CancellationToken>()))
387+
.Callback<Func<IMllpClient, MllpClientResult, Task>, CancellationToken>((action, cancellationToken) =>
388+
{
389+
var results = new MllpClientResult(
390+
new List<HL7.Dotnetcore.Message>
391+
{
392+
new("")
393+
}, null);
394+
action(client.Object, results);
395+
checkEvent.Set();
396+
_cancellationTokenSource.Cancel();
397+
});
398+
client.Setup(p => p.Dispose());
399+
client.SetupGet(p => p.ClientId).Returns(Guid.NewGuid());
400+
return client.Object;
401+
});
402+
403+
_tcpListener.Setup(p => p.AcceptTcpClientAsync(It.IsAny<CancellationToken>()))
404+
.Returns(ValueTask.FromResult((new Mock<ITcpClientAdapter>()).Object));
405+
406+
var service = new MllpService(_serviceScopeFactory.Object, _options);
407+
_ = service.StartAsync(_cancellationTokenSource.Token);
408+
409+
Assert.True(checkEvent.Wait(3000));
410+
await Task.Delay(500).ConfigureAwait(ConfigureAwaitOptions.ContinueOnCapturedContext);
411+
_hl7DataPlugInEngine.Verify(p => p.Configure(It.IsAny<IReadOnlyList<string>>()), Times.Never());
412+
}
369413
}
370414
}

0 commit comments

Comments
 (0)