コード例 #1
0
        public IActionResult Check()
        {
            JsonResult result = null;

            using (HealthCheckHandler handler = new HealthCheckHandler(_settings, _eventHub, _preingestCollection))
            {
                handler.Execute();

                System.Reflection.Assembly         assembly = System.Reflection.Assembly.GetExecutingAssembly();
                System.Diagnostics.FileVersionInfo fvi      = System.Diagnostics.FileVersionInfo.GetVersionInfo(assembly.Location);
                DateTime buildDate = LinkerHelper.GetLinkerTimestampUtc(assembly);

                result = new JsonResult(new
                {
                    ProductName       = fvi.ProductName,
                    ProductVersion    = fvi.ProductVersion,
                    BuildDateTime     = DateTimeOffset.FromFileTime(buildDate.ToFileTime()),
                    Title             = "Underlying services health check.",
                    CreationTimestamp = DateTimeOffset.Now,
                    ActionName        = typeof(HealthCheckHandler).Name,
                    Messages          = new string[] {
                        "preingest: available",
                        String.Format("clamav: {0}", handler.IsAliveClamAv ? "available" : "not available"),
                        String.Format("xslweb: {0}", handler.IsAliveXslWeb ? "available" : "not available"),
                        String.Format("droid: {0}", handler.IsAliveDroid ? "available" : "not available"),
                        String.Format("database: {0}", handler.IsAliveDatabase ? "available" : "not available")
                    }
                });
            }
            return(result);
        }
コード例 #2
0
        public void given_fast_execution_I_expect_to_increase_settings()
        {
            // Set up
            var sut = new LinkerHelper();

            // Act
            var result = sut.OptimizeSettings(100, PerfTuneSettings.Default);

            // Verify
            Assert.IsTrue(PerfTuneSettings.Default.MaxBufferSize < result.MaxBufferSize);
        }