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); } }
private void InitializeServerDropdown(ComboBox comboBox, PermissableDefaults permissableDefault, ExternalDatabaseServer[] allServers) { comboBox.Items.Clear(); var currentDefault = defaults.GetDefaultFor(permissableDefault); var patcher = permissableDefault.ToTier2DatabaseType(); var toAdd = allServers; if (patcher != null) //we expect an explicit type e.g. a HIC.Logging.Database { var compatibles = Activator.RepositoryLocator.CatalogueRepository.GetAllObjects <ExternalDatabaseServer>().Where(s => s.WasCreatedBy(patcher)).ToArray(); if (currentDefault == null || compatibles.Contains(currentDefault)) //if there is not yet a default or the existing default is of the correct type { toAdd = compatibles; //then we can go ahead and use the restricted type } //otherwise what we have is a default of the wrong server type! eep. } comboBox.Items.AddRange(toAdd); //select the server if (currentDefault != null) { comboBox.SelectedItem = comboBox.Items.Cast <ExternalDatabaseServer>().Single(s => s.ID == currentDefault.ID); } }
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); } }
/// <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; }