public void SupportsValidation_NoDQE() { IServerDefaults defaults = CatalogueRepository.GetServerDefaults(); var before = defaults.GetDefaultFor(PermissableDefaults.DQE); //cannot run test because it didn't have a value to clear! Assert.IsNotNull(before); //clear the default value defaults.ClearDefault(PermissableDefaults.DQE); try { CatalogueConstraintReport report = new CatalogueConstraintReport(_catalogue, SpecialFieldNames.DataLoadRunID); var e = Assert.Throws <Exception>(() => report.Check(new ThrowImmediatelyCheckNotifier())); Assert.IsTrue( e.Message.StartsWith( "Failed to create DQE Repository, possibly there is no DataQualityEngine Reporting Server (ExternalDatabaseServer). You will need to create/set one in CatalogueManager") ); } finally { defaults.SetDefault(PermissableDefaults.DQE, before); } }
public void SupportsValidation_NoLoggingServer() { IServerDefaults defaults = CatalogueRepository.GetServerDefaults(); var before = defaults.GetDefaultFor(PermissableDefaults.LiveLoggingServer_ID); //cannot run test because it didn't have a value to clear! Assert.IsNotNull(before); //clear the default value defaults.ClearDefault(PermissableDefaults.LiveLoggingServer_ID); try { CatalogueConstraintReport report = new CatalogueConstraintReport(_catalogue, SpecialFieldNames.DataLoadRunID); var e = Assert.Throws <Exception>(() => report.Check(new ThrowImmediatelyCheckNotifier())); Assert.IsTrue( e.Message.StartsWith( "Failed to setup logging of DQE runs") ); } finally { defaults.SetDefault(PermissableDefaults.LiveLoggingServer_ID, before); } }
private void RefreshUIFromDatabase() { try { defaults = Activator.RepositoryLocator.CatalogueRepository.GetServerDefaults(); var allServers = Activator.RepositoryLocator.CatalogueRepository.GetAllObjects <ExternalDatabaseServer>().ToArray(); InitializeServerDropdown(ddDefaultLoggingServer, PermissableDefaults.LiveLoggingServer_ID, allServers); InitializeServerDropdown(ddDQEServer, PermissableDefaults.DQE, allServers); InitializeServerDropdown(ddWebServiceQueryCacheServer, PermissableDefaults.WebServiceQueryCachingServer_ID, allServers); InitializeServerDropdown(ddCohortIdentificationQueryCacheServer, PermissableDefaults.CohortIdentificationQueryCachingServer_ID, allServers); InitializeServerDropdown(ddDefaultIdentifierDump, PermissableDefaults.IdentifierDumpServer_ID, allServers); InitializeServerDropdown(ddOverrideRawServer, PermissableDefaults.RAWDataLoadServer, allServers); InitializeServerDropdown(ddDefaultANOStore, PermissableDefaults.ANOStore, allServers); btnCreateNewDQEServer.Enabled = ddDQEServer.SelectedItem == null; btnClearDQEServer.Enabled = ddDQEServer.SelectedItem != null; btnCreateNewWebServiceQueryCache.Enabled = ddWebServiceQueryCacheServer.SelectedItem == null; btnClearWebServiceQueryCache.Enabled = ddWebServiceQueryCacheServer.SelectedItem != null; btnCreateNewCohortIdentificationQueryCache.Enabled = ddCohortIdentificationQueryCacheServer.SelectedItem == null; btnClearCohortIdentificationQueryCache.Enabled = ddCohortIdentificationQueryCacheServer.SelectedItem != null; } catch (Exception ex) { ExceptionViewer.Show(ex); } }
private SqlConnectionStringBuilder CreateServerPointerInCatalogue(IServerDefaults defaults, string prefix, string databaseName, PermissableDefaults defaultToSet, IPatcher patcher) { var opts = new PlatformDatabaseCreationOptions() { ServerName = TestDatabaseSettings.ServerName, Prefix = prefix, Username = TestDatabaseSettings.Username, Password = TestDatabaseSettings.Password, ValidateCertificate = false }; var builder = opts.GetBuilder(databaseName); if (string.IsNullOrWhiteSpace(databaseName)) { builder.InitialCatalog = ""; } //create a new pointer var externalServerPointer = new ExternalDatabaseServer(CatalogueRepository, databaseName ?? "RAW", patcher) { Server = builder.DataSource, Database = builder.InitialCatalog, Password = builder.Password, Username = builder.UserID }; externalServerPointer.SaveToDatabase(); //now make it the default DQE defaults.SetDefault(defaultToSet, externalServerPointer); return(builder); }
/// <summary> /// Constructor for use in tests, if possible use the LoadMetadata constructor instead /// </summary> /// <param name="liveServer">The live server where the data is held, IMPORTANT: this must contain InitialCatalog parameter</param> /// <param name="namer">optionally lets you specify how to pick database names for the temporary bubbles STAGING and RAW</param> /// <param name="defaults">optionally specifies the location to get RAW default server from</param> /// <param name="overrideRAWServer">optionally specifies an explicit server to use for RAW</param> public HICDatabaseConfiguration(DiscoveredServer liveServer, INameDatabasesAndTablesDuringLoads namer = null, IServerDefaults defaults = null, IExternalDatabaseServer overrideRAWServer = null) { //respects the override of LIVE server var liveDatabase = liveServer.GetCurrentDatabase(); if (liveDatabase == null) { throw new Exception("Cannot load live without having a unique live named database"); } // Default namer if (namer == null) { if (liveServer.DatabaseType == DatabaseType.PostgreSql) { //create the DLE tables on the live database because postgres can't handle cross database references namer = new FixedStagingDatabaseNamer(liveDatabase.GetRuntimeName(), liveDatabase.GetRuntimeName()); } else { namer = new FixedStagingDatabaseNamer(liveDatabase.GetRuntimeName()); } } //if there are defaults if (overrideRAWServer == null && defaults != null) { overrideRAWServer = defaults.GetDefaultFor(PermissableDefaults.RAWDataLoadServer);//get the raw default if there is one } DiscoveredServer rawServer; //if there was defaults and a raw default server if (overrideRAWServer != null) { rawServer = DataAccessPortal.GetInstance().ExpectServer(overrideRAWServer, DataAccessContext.DataLoad, false); //get the raw server connection } else { rawServer = liveServer; //there is no raw override so we will have to use the live server for RAW too. } //populates the servers -- note that an empty rawServer value passed to this method makes it the localhost DeployInfo = new StandardDatabaseHelper(liveServer.GetCurrentDatabase(), namer, rawServer); RequiresStagingTableCreation = true; }