public ScuExportService( ILogger <ScuExportService> logger, IPayloads payloadsApi, IResultsService resultsService, IServiceScopeFactory serviceScopeFactory, IOptions <DicomAdapterConfiguration> dicomAdapterConfiguration, IStorageInfoProvider storageInfoProvider) : base(logger, dicomAdapterConfiguration, serviceScopeFactory, storageInfoProvider) { if (dicomAdapterConfiguration is null) { throw new ArgumentNullException(nameof(dicomAdapterConfiguration)); } _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _serviceScopeFactory = serviceScopeFactory ?? throw new ArgumentNullException(nameof(serviceScopeFactory)); _scuConfiguration = dicomAdapterConfiguration.Value.Dicom.Scu; Agent = _scuConfiguration.AeTitle; Concurrentcy = _scuConfiguration.MaximumNumberOfAssociations; }
public ExportTaskWatcherTest() { _mockLogger = new Mock <ILogger <ScuService> >(); _mockResultsService = new Mock <IResultsService>(); _cancellationSource = new CancellationTokenSource(); _outputJobQueue = new ActionBlock <OutputJob>( job => { Console.WriteLine("\tProcessing job in queue..."); Interlocked.Increment(ref _queuedTasks); }, new ExecutionDataflowBlockOptions { MaxDegreeOfParallelism = 2, MaxMessagesPerTask = 1, CancellationToken = _cancellationSource.Token }); _scuConfiguration = new ScuConfiguration(); _scuConfiguration.Destinations.Add(new DestinationApplicationEntity { Name = "dest1", Port = 104, AeTitle = "dest", HostIp = "1.2.3.4" }); _scuConfiguration.Destinations.Add(new DestinationApplicationEntity { Name = "dest2", Port = 104, AeTitle = "dest", HostIp = "1.2.3.4" }); _tasks = new List <TaskResponse>() { new TaskResponse { TaskId = Guid.NewGuid(), JobId = "job1", PipelineId = "pipeline1", PayloadId = "payload1", Agent = "good", Parameters = JsonConvert.SerializeObject("dest1"), State = State.Pending, Retries = 0, Uris = new string[] { "uri1", "uri1" } }, new TaskResponse { TaskId = Guid.NewGuid(), JobId = "job2", PipelineId = "pipeline2", PayloadId = "payload2", Agent = "good", Parameters = JsonConvert.SerializeObject("dest2"), State = State.Pending, Retries = 0, Uris = new string[] { "uri1", "uri1" } }, new TaskResponse { TaskId = Guid.NewGuid(), JobId = "job3", PipelineId = "pipeline3", PayloadId = "payload3", Agent = "bad", Parameters = JsonConvert.SerializeObject("dest3"), State = State.Pending, Retries = 0, Uris = new string[] { "uri1", "uri1" } }, new TaskResponse { TaskId = Guid.NewGuid(), JobId = "job4", PipelineId = "pipeline4", PayloadId = "payload4", Agent = "bad", Parameters = JsonConvert.SerializeObject(""), State = State.Pending, Retries = 0, Uris = new string[] { "uri1", "uri1" } }, new TaskResponse { TaskId = Guid.NewGuid(), JobId = "job5", PipelineId = "pipeline5", PayloadId = "payload5", Agent = "bad", Parameters = JsonConvert.SerializeObject(""), State = State.Pending, Retries = 0, Uris = new string[] { "uri1", "uri1" } } }; _queuedTasks = 0; }
public ExportTaskWatcher(ILogger <ScuService> logger, IResultsService iResultsService, ScuConfiguration scuConfiguration) { _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _resultsService = iResultsService ?? throw new ArgumentNullException(nameof(iResultsService)); _scuConfiguration = scuConfiguration; }