public SearchResult() { HasDuplicates = false; _serverGroupName = ""; _isLocalServer = false; _numberOfChildServers = 1; _hiddenItems = new List<StudyTableItem>(); _studyTable = new StudyTable(); _setChangedStudies = new Dictionary<string, string>(); }
public void SetupSuite(DiscoveredDatabase databaseToCreateInto, IRDMPPlatformRepositoryServiceLocator repositoryLocator, GlobalOptions globalOptions, Type pipelineDicomSourceType, string root = null, ImageTableTemplateCollection template = null, bool persistentRaw = false, string modalityPrefix = null) { ImageTable = databaseToCreateInto.ExpectTable(modalityPrefix + "ImageTable"); SeriesTable = databaseToCreateInto.ExpectTable(modalityPrefix + "SeriesTable"); StudyTable = databaseToCreateInto.ExpectTable(modalityPrefix + "StudyTable"); try { File.Copy(typeof(InvalidDataHandling).Assembly.Location, Path.Combine(TestContext.CurrentContext.TestDirectory, "Rdmp.Dicom.dll"), true); } catch (System.IO.IOException) { //nevermind, it's probably locked } //The Rdmp.Dicom assembly should be loaded as a plugin, this simulates it. foreach (var type in typeof(InvalidDataHandling).Assembly.GetTypes()) { repositoryLocator.CatalogueRepository.MEF.AddTypeToCatalogForTesting(type); } ICatalogueRepository catalogueRepository = repositoryLocator.CatalogueRepository; IDataExportRepository dataExportRepository = repositoryLocator.DataExportRepository; foreach (var t in new[] { ImageTable, SeriesTable, StudyTable }) { if (t.Exists()) { t.Drop(); } } var suite = new ExecuteCommandCreateNewImagingDatasetSuite(repositoryLocator, databaseToCreateInto, new DirectoryInfo(TestContext.CurrentContext.TestDirectory)); suite.Template = template ?? GetDefaultTemplate(databaseToCreateInto.Server.DatabaseType); suite.PersistentRaw = persistentRaw; suite.TablePrefix = modalityPrefix; suite.DicomSourceType = pipelineDicomSourceType; suite.CreateCoalescer = true; suite.Execute(); DicomSourcePipelineComponent = suite.DicomSourcePipelineComponent; //store the component created so we can inject/adjust the arguments e.g. adding ElevationRequests to it LoadMetadata = suite.NewLoadMetadata; var tableInfos = LoadMetadata.GetAllCatalogues().SelectMany(c => c.GetTableInfoList(false)).Distinct().ToArray(); ImageTableInfo = (TableInfo)tableInfos.Single(t => t.GetRuntimeName().Equals(ImageTable.GetRuntimeName())); SeriesTableInfo = (TableInfo)tableInfos.Single(t => t.GetRuntimeName().Equals(SeriesTable.GetRuntimeName())); StudyTableInfo = (TableInfo)tableInfos.Single(t => t.GetRuntimeName().Equals(StudyTable.GetRuntimeName())); // Override the options with stuff coming from Core RDMP DatabaseTests (TestDatabases.txt) globalOptions.FileSystemOptions.FileSystemRoot = root ?? TestContext.CurrentContext.TestDirectory; globalOptions.RDMPOptions.CatalogueConnectionString = ((TableRepository)catalogueRepository).DiscoveredServer.Builder.ConnectionString; globalOptions.RDMPOptions.DataExportConnectionString = ((TableRepository)dataExportRepository).DiscoveredServer.Builder.ConnectionString; globalOptions.DicomRelationalMapperOptions.LoadMetadataId = LoadMetadata.ID; globalOptions.DicomRelationalMapperOptions.MinimumBatchSize = 1; globalOptions.DicomRelationalMapperOptions.UseInsertIntoForRAWMigration = true; //Image table now needs all the UIDs in order to be extractable var adder = new TagColumnAdder("StudyInstanceUID", "varchar(100)", ImageTableInfo, new AcceptAllCheckNotifier()); adder.Execute(); }