Skip to content

Commit 34eda2b

Browse files
committed
gh-41 code cleanup
1 parent 731b058 commit 34eda2b

File tree

8 files changed

+88
-110
lines changed

8 files changed

+88
-110
lines changed

tests/Integration.Test/Common/DicomExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public static string CalculateHash(this DicomFile dicomFile)
4444
using var sha256Hash = SHA256.Create();
4545
var hash = sha256Hash.ComputeHash(bytes.ToArray());
4646
var sb = new StringBuilder();
47-
foreach(var b in hash)
47+
foreach (var b in hash)
4848
{
4949
sb.Append(b.ToString("X2"));
5050
}

tests/Integration.Test/Drivers/DicomInstanceGenerator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public StudyGenerationSpecs Generate(string patientId, int studiesPerPatient, in
136136
var size = _random.NextLong(studySpec.SizeMinBytes, studySpec.SizeMaxBytes);
137137
dicomFile = generator.GenerateNewInstance(size);
138138
files.Add(dicomFile);
139-
if(!uniqueInstances.Add(dicomFile.Dataset.GetString(DicomTag.SOPInstanceUID)))
139+
if (!uniqueInstances.Add(dicomFile.Dataset.GetString(DicomTag.SOPInstanceUID)))
140140
{
141141
throw new Exception("Instance UID already exists, something's wrong here.");
142142
}

tests/Integration.Test/Drivers/DicomScp.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,11 @@
99
// See the License for the specific language governing permissions and
1010
// limitations under the License.
1111

12-
using System.Diagnostics;
13-
using System.Linq;
1412
using System.Text;
1513
using FellowOakDicom;
1614
using FellowOakDicom.Imaging.Codec;
1715
using FellowOakDicom.Log;
1816
using FellowOakDicom.Network;
19-
using FellowOakDicom.Network.Client;
2017
using Monai.Deploy.InformaticsGateway.Integration.Test.Common;
2118
using TechTalk.SpecFlow.Infrastructure;
2219

@@ -26,7 +23,7 @@ public class ServerData
2623
{
2724
public FeatureContext Context { get; set; }
2825
public Dictionary<string, string> Instances { get; set; } = new Dictionary<string, string>();
29-
public ISpecFlowOutputHelper OutputHelper {get;set;}
26+
public ISpecFlowOutputHelper OutputHelper { get; set; }
3027
}
3128

3229
internal class CStoreScp : DicomService, IDicomServiceProvider, IDicomCStoreProvider
@@ -63,7 +60,7 @@ public Task<DicomCStoreResponse> OnCStoreRequestAsync(DicomCStoreRequest request
6360
try
6461
{
6562
var key = request.File.GenerateFileName();
66-
lock(SyncLock)
63+
lock (SyncLock)
6764
{
6865
data.Instances.Add(key, request.File.CalculateHash());
6966
}
@@ -106,6 +103,5 @@ public Task OnReceiveAssociationRequestAsync(DicomAssociation association)
106103

107104
return SendAssociationAcceptAsync(association);
108105
}
109-
110106
}
111107
}

tests/Integration.Test/Hooks/RabbitMqHooks.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
// limitations under the License.
1111

1212
using System.Text;
13-
using FellowOakDicom;
14-
using Monai.Deploy.InformaticsGateway.Api;
1513
using Monai.Deploy.InformaticsGateway.Api.MessageBroker;
1614
using Monai.Deploy.InformaticsGateway.Configuration;
1715
using Monai.Deploy.InformaticsGateway.Integration.Test.Drivers;
@@ -59,7 +57,7 @@ public RabbitMqHooks(ISpecFlowOutputHelper outputHelper, Configurations configur
5957
}
6058

6159
[BeforeScenario("@messaging_export_complete")]
62-
public void BeforeMessagingExportComplete()
60+
public void BeforeMessagingExportComplete()
6361
{
6462
BeforeMessagingSubscribeTo(QueueNameExportQueue, _configurationKeys.ExportComplete);
6563
}
@@ -109,7 +107,6 @@ private void BeforeMessagingSubscribeTo(string queue, string routingKey)
109107
_channel.BasicQos(0, 0, false);
110108
_consumerTag = _channel.BasicConsume(queue, false, consumer);
111109
_outputHelper.WriteLine($"Listening for messages from {_configuration.MessageBrokerOptions.Endpoint}/{_configuration.MessageBrokerOptions.VirtualHost}. Exchange={_configuration.MessageBrokerOptions.Exchange}, Queue={queue}, Routing Key={routingKey}");
112-
113110
}
114111

115112
internal void Publish(string routingKey, Message message)

tests/Integration.Test/Hooks/ScpHooks.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,8 @@
99
// See the License for the specific language governing permissions and
1010
// limitations under the License.
1111

12-
using System.Text;
13-
using FellowOakDicom;
1412
using FellowOakDicom.Network;
15-
using Monai.Deploy.InformaticsGateway.Api;
16-
using Monai.Deploy.InformaticsGateway.Api.MessageBroker;
17-
using Monai.Deploy.InformaticsGateway.Configuration;
18-
using Monai.Deploy.InformaticsGateway.Integration.Test.Common;
1913
using Monai.Deploy.InformaticsGateway.Integration.Test.Drivers;
20-
using RabbitMQ.Client;
21-
using RabbitMQ.Client.Events;
2214
using TechTalk.SpecFlow.Infrastructure;
2315

2416
namespace Monai.Deploy.InformaticsGateway.Integration.Test.Hooks

tests/Integration.Test/StepDefinitions/DicomDimseScpServicesStepDefinitions.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
using System.Text;
1414
using Ardalis.GuardClauses;
1515
using FellowOakDicom;
16-
using FellowOakDicom.Imaging;
1716
using FellowOakDicom.Network;
1817
using FellowOakDicom.Serialization;
1918
using FluentAssertions.Execution;

tests/Integration.Test/StepDefinitions/DicomDimseScuServicesStepDefinitions.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,8 @@
99
// See the License for the specific language governing permissions and
1010
// limitations under the License.
1111

12-
using System;
1312
using System.Net;
14-
using System.Threading.Tasks;
1513
using Ardalis.GuardClauses;
16-
using FellowOakDicom;
17-
using FellowOakDicom.Network;
1814
using Minio;
1915
using Monai.Deploy.InformaticsGateway.Api;
2016
using Monai.Deploy.InformaticsGateway.Api.MessageBroker;
@@ -23,7 +19,6 @@
2319
using Monai.Deploy.InformaticsGateway.Integration.Test.Common;
2420
using Monai.Deploy.InformaticsGateway.Integration.Test.Drivers;
2521
using Monai.Deploy.InformaticsGateway.Integration.Test.Hooks;
26-
using TechTalk.SpecFlow;
2722
using TechTalk.SpecFlow.Infrastructure;
2823

2924
namespace Monai.Deploy.InformaticsGateway.Integration.Test.StepDefinitions
@@ -152,7 +147,6 @@ public void WhenAExportRequestIsReceivedDesignatedFor(string routingKey)
152147
_scenarioContext[KeyExportRequestMessage] = exportRequestMessage;
153148
}
154149

155-
156150
[Then(@"Informatics Gateway exports the studies to the DICOM SCP")]
157151
public async Task ThenExportTheInstancesToTheDicomScp()
158152
{
Lines changed: 83 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,100 +1,100 @@
11
{
22
"ConnectionStrings": {
3-
"InformaticsGatewayDatabase": "Data Source=/database/mig.db"
3+
"InformaticsGatewayDatabase": "Data Source=/database/mig.db"
44
},
55
"InformaticsGateway": {
6-
"dicom": {
7-
"scp": {
8-
"port": 104,
9-
"logDimseDatasets": false,
10-
"rejectUnknownSources": true
6+
"dicom": {
7+
"scp": {
8+
"port": 104,
9+
"logDimseDatasets": false,
10+
"rejectUnknownSources": true
11+
},
12+
"scu": {
13+
"aeTitle": "MonaiSCU",
14+
"logDimseDatasets": false,
15+
"logDataPDUs": false
16+
}
1117
},
12-
"scu": {
13-
"aeTitle": "MonaiSCU",
14-
"logDimseDatasets": false,
15-
"logDataPDUs": false
16-
}
17-
},
18-
"messaging": {
19-
"publisherSettings": {
20-
"endpoint": "rabbitmq",
21-
"username": "rabbitmq",
22-
"password": "qmtibbar",
23-
"virtualHost": "/",
24-
"exchange": "monaideploy"
18+
"messaging": {
19+
"publisherSettings": {
20+
"endpoint": "rabbitmq",
21+
"username": "rabbitmq",
22+
"password": "qmtibbar",
23+
"virtualHost": "/",
24+
"exchange": "monaideploy"
25+
},
26+
"subscriberSettings": {
27+
"endpoint": "rabbitmq",
28+
"username": "rabbitmq",
29+
"password": "qmtibbar",
30+
"virtualHost": "/",
31+
"exchange": "monaideploy",
32+
"exportRequestQueue": "export_tasks"
33+
}
2534
},
26-
"subscriberSettings": {
27-
"endpoint": "rabbitmq",
28-
"username": "rabbitmq",
29-
"password": "qmtibbar",
30-
"virtualHost": "/",
31-
"exchange": "monaideploy",
32-
"exportRequestQueue": "export_tasks"
35+
"storage": {
36+
"temporary": "/payloads",
37+
"storageServiceCredentials": {
38+
"endpoint": "minio:9000",
39+
"accessKey": "minioadmin",
40+
"accessToken": "minioadmin"
41+
},
42+
"securedConnection": false,
43+
"storageServiceBucketName": "monai"
3344
}
34-
},
35-
"storage": {
36-
"temporary": "/payloads",
37-
"storageServiceCredentials": {
38-
"endpoint": "minio:9000",
39-
"accessKey": "minioadmin",
40-
"accessToken": "minioadmin"
41-
},
42-
"securedConnection": false,
43-
"storageServiceBucketName": "monai"
44-
}
4545
},
4646
"Logging": {
47-
"LogLevel": {
48-
"Default": "Information",
49-
"FellowOakDicom": "Warning",
50-
"System": "Warning",
51-
"Microsoft": "Warning",
52-
"Microsoft.EntityFrameworkCore": "Warning",
53-
"Microsoft.Hosting.Lifetime": "Warning",
54-
"Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker": "Error",
55-
"Monai": "Information",
56-
"Monai.Deploy.InformaticsGateway.Services.Export": "Trace"
57-
},
58-
"Console": {
59-
"FormatterName": "Simple",
60-
"FormatterOptions": {
61-
"ColorBehavior": "Disabled",
62-
"IncludeScopes": true,
63-
"SingleLine": false,
64-
"TimestampFormat": " HH:mm:ss ",
65-
"UseUtcTimestamp": true
47+
"LogLevel": {
48+
"Default": "Information",
49+
"FellowOakDicom": "Warning",
50+
"System": "Warning",
51+
"Microsoft": "Warning",
52+
"Microsoft.EntityFrameworkCore": "Warning",
53+
"Microsoft.Hosting.Lifetime": "Warning",
54+
"Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker": "Error",
55+
"Monai": "Information",
56+
"Monai.Deploy.InformaticsGateway.Services.Export": "Trace"
57+
},
58+
"Console": {
59+
"FormatterName": "Simple",
60+
"FormatterOptions": {
61+
"ColorBehavior": "Disabled",
62+
"IncludeScopes": true,
63+
"SingleLine": false,
64+
"TimestampFormat": " HH:mm:ss ",
65+
"UseUtcTimestamp": true
66+
}
67+
},
68+
"File": {
69+
"BasePath": "logs",
70+
"FileEncodingName": "utf-8",
71+
"DateFormat": "yyyyMMdd",
72+
"CounterFormat": "000",
73+
"MaxFileSize": 10485760,
74+
"IncludeScopes": true,
75+
"MaxQueueSize": 100,
76+
"TextBuilderType": "Monai.Deploy.InformaticsGateway.Logging.FileLoggingTextFormatter, Monai.Deploy.InformaticsGateway",
77+
"Files": [
78+
{
79+
"Path": "MIG-<date>-<counter>.log"
80+
}
81+
]
6682
}
67-
},
68-
"File": {
69-
"BasePath": "logs",
70-
"FileEncodingName": "utf-8",
71-
"DateFormat": "yyyyMMdd",
72-
"CounterFormat": "000",
73-
"MaxFileSize": 10485760,
74-
"IncludeScopes": true,
75-
"MaxQueueSize": 100,
76-
"TextBuilderType": "Monai.Deploy.InformaticsGateway.Logging.FileLoggingTextFormatter, Monai.Deploy.InformaticsGateway",
77-
"Files": [
78-
{
79-
"Path": "MIG-<date>-<counter>.log"
80-
}
81-
]
82-
}
8383
},
8484
"Kestrel": {
85-
"EndPoints": {
86-
"Http": {
87-
"Url": "http://+:5000"
85+
"EndPoints": {
86+
"Http": {
87+
"Url": "http://+:5000"
88+
}
8889
}
89-
}
9090
},
9191
"AllowedHosts": "*",
9292
"Cli": {
93-
"Runner": "Docker",
94-
"HostDataStorageMount": "~/.mig/data",
95-
"HostDatabaseStorageMount": "~/.mig/database",
96-
"HostLogsStorageMount": "~/.mig/logs",
97-
"InformaticsGatewayServerEndpoint": "http://localhost:5000",
98-
"DockerImagePrefix": "ghcr.io/project-monai/monai-deploy-informatics-gateway"
93+
"Runner": "Docker",
94+
"HostDataStorageMount": "~/.mig/data",
95+
"HostDatabaseStorageMount": "~/.mig/database",
96+
"HostLogsStorageMount": "~/.mig/logs",
97+
"InformaticsGatewayServerEndpoint": "http://localhost:5000",
98+
"DockerImagePrefix": "ghcr.io/project-monai/monai-deploy-informatics-gateway"
9999
}
100-
}
100+
}

0 commit comments

Comments
 (0)