public void Should_indicate_not_loupe_url([Values("http://www.test.com/", "http://www.test.com/Gibraltar", "http://www.test.com/Gibraltar/log/things", "http://www.test.com/gibraltar/data")] string url) { HttpRequest.Url.Returns(new Uri(url)); var checker = new UrlCheck(); Assert.That(checker.IsLoupeUrl(HttpContext), Is.False); }
public void Should_detect_loupe_url([Values("http://www.test.com/loupe/log", "http://www.test.com/Loupe/log", "http://www.test.com/loupe/Log", "http://www.test.com/Loupe/Log", "http://www.test.com/loupe/log/")] string url) { HttpRequest.Url.Returns(new Uri(url)); var checker = new UrlCheck(); Assert.That(checker.IsLoupeUrl(HttpContext), Is.True); }
/// <summary> /// Monitor MVC requests using the provided configuration settings /// </summary> /// <param name="configuration"></param> public WebApiRequestMonitorAttribute(MvcAgentElement configuration) { if (configuration == null) { throw new ArgumentNullException(nameof(configuration)); } _configuration = configuration; _urlCheck = new UrlCheck(); }
/// <summary> /// Monitor MVC requests using the provided configuration settings /// </summary> /// <param name="configuration"></param> public MvcRequestMonitorAttribute(MvcAgentElement configuration) { if (configuration == null) { throw new ArgumentNullException(nameof(configuration)); } _configuration = configuration; _urlCheck = new UrlCheck(); Order = 0; //so we run first and last in general }
public async Task <UrlCheck> Post(UrlCheck urlCheck) { if (urlCheck == null) { throw new ArgumentNullException(nameof(urlCheck)); } _logger.LogDebug($"UrlCheckController::Post"); var data = await _service.GetAsync(urlCheck.Url); if (data != null) { return(_mapper.Map <UrlCheck>(data)); } else { return(null); } }
public async Task ShouldPassCheckUrl() { // arrange var recorder = new Mock <IAvailabilityRecorder>(); var check = new UrlCheck(new MemoryCache(new MemoryCacheOptions()), new NullLogger <Check>(), recorder.Object); var cc = new CheckConfiguration { Name = "foo", Type = "url", Required = false, Value = "https://httpstat.us/200", Interval = 30, Timeout = 5 }; check.Initialize(cc); // act var status = await check.ExecuteAsync(); // assert Assert.True(status.Healthy); }
public async Task <UrlCheck> GetAsync(string url) { var retVal = new UrlCheck { Url = url }; foreach (var plugin in _pluginService.GetPlugins()) { if (await plugin.CheckIntegrity()) { var checkResult = new CheckResult { SourceName = plugin.Name, Messages = new List <string>() }; try { var result = await plugin.CheckUrl(url); checkResult.Messages.AddRange(result.Messages); checkResult.Positives = result.Positives; checkResult.CheckCount = result.CheckCount; } catch (Exception ex) { checkResult.Messages.Add(ex.Message); } retVal.Sources = new List <CheckResult> { checkResult }; } } return(retVal); }
public CORSHandler() { _urlCheck = new UrlCheck(); }
public RequestHandler() { _urlCheck = new UrlCheck(); }