public void TestLoadGatewayReceiveConfig() { var configurationDirectory = CreateTemporaryDirectory().FullName; var random = new Random(); var expectedGatewayReceiveConfig = RandomGatewayReceiveConfig(random); Serialise(expectedGatewayReceiveConfig, configurationDirectory, GatewayReceiveConfigProvider.GatewayReceiveConfigFileName); var gatewayReceiveConfigProvider = new GatewayReceiveConfigProvider(_baseTestLogger, configurationDirectory); var actualGatewayReceiveConfig = gatewayReceiveConfigProvider.GatewayReceiveConfig(); Assert.AreEqual(expectedGatewayReceiveConfig, actualGatewayReceiveConfig); }
/// <summary> /// Initializes a new instance of the <see cref="BaseTestClass"/> class. /// </summary> public BaseTestClass() { ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true; _loggerFactory = LoggerFactory.Create(builder => builder.AddConsole()); _baseTestLogger = _loggerFactory.CreateLogger("BaseTest"); // Set a logger for fo-dicom network operations so that they show up in VS output when debugging Dicom.Log.LogManager.SetImplementation(new Dicom.Log.TextWriterLogManager(new DataProviderTests.DebugTextWriter())); _testAETConfigProvider = new AETConfigProvider(_loggerFactory.CreateLogger("ModelSettings"), _basePathConfigs); TestGatewayProcessorConfigProvider = new GatewayProcessorConfigProvider(_loggerFactory.CreateLogger("ProcessorSettings"), _basePathConfigs); _testGatewayReceiveConfigProvider = new GatewayReceiveConfigProvider(_loggerFactory.CreateLogger("ProcessorSettings"), _basePathConfigs); }
public static ActionResult ValidateProductKey(Session session) { #if DEBUG Debugger.Launch(); #endif // Make sure that the applications are run as services. using (var gatewayProcessorConfigProvider = new GatewayProcessorConfigProvider(null, ConfigInstallDirectory)) { gatewayProcessorConfigProvider.SetRunAsConsole(false); using (var gatewayReceiveConfigProvider = new GatewayReceiveConfigProvider( null, ConfigInstallDirectory)) { gatewayReceiveConfigProvider.SetRunAsConsole(false); } // Check if the installer is running unattended - lets skip the UI if true if (session.CustomActionData[UILevelCustomActionKey] == "2") { return(ActionResult.Success); } // In the context of the installer, this may have a different SecurityProtocol to the application. // In testing it was: SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls // but it may vary. In order to value the uri and license key, we need TLS 1.2 ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12; // First time install so lets display a form to grab the license key. using (var form = new LicenseKeyForm(gatewayProcessorConfigProvider)) { var licenseKeyDialogResult = form.ShowDialog(); switch (licenseKeyDialogResult) { case DialogResult.Cancel: return(ActionResult.UserExit); case DialogResult.No: return(ActionResult.NotExecuted); default: return(ActionResult.Success); } } } }
/// <summary> /// The main entry point for the application. /// </summary> public static void Main() { // Create the loggerFactory as Console + Log4Net. using (var loggerFactory = LoggerFactory.Create(builder => { builder.AddConsole(); builder.SetMinimumLevel(LogLevel.Trace); builder.AddLog4Net(); })) { var relativePaths = new[] { "../Config", "../../../../../SampleConfigurations" }; var configurationsPathRoot = ConfigurationService.FindRelativeDirectory(relativePaths, loggerFactory.CreateLogger("Main")); using (var gatewayReceiveConfigProvider = new GatewayReceiveConfigProvider( loggerFactory.CreateLogger("ProcessorSettings"), configurationsPathRoot)) { // The ProjectInstaller.cs uses the service name to install the service. // If you change it please update the ProjectInstaller.cs ServiceHelpers.RunServices( ServiceName, gatewayReceiveConfigProvider.ServiceSettings(), new ConfigurationService( null, gatewayReceiveConfigProvider.ConfigurationServiceConfig, loggerFactory.CreateLogger("ConfigurationService"), new ReceiveService( gatewayReceiveConfigProvider.ReceiveServiceConfig, GatewayMessageQueue.UploadQueuePath, loggerFactory.CreateLogger("ReceiveService")))); } } }