public int GetHashCode(object obj) { int hashCode = (ClientRequestId.GetHashCode() + FileUri.GetHashCode() + RelativeUri.GetHashCode() + Started.GetHashCode()) / 4; Log.Debug($"hashCode {hashCode}"); return(hashCode); }
public override int GetHashCode() { int hash = 1; if (HttpMethod != 0) { hash ^= HttpMethod.GetHashCode(); } if (appEngineRouting_ != null) { hash ^= AppEngineRouting.GetHashCode(); } if (RelativeUri.Length != 0) { hash ^= RelativeUri.GetHashCode(); } hash ^= Headers.GetHashCode(); if (Body.Length != 0) { hash ^= Body.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public static Response Execute(RelativeUri url, Func <ISchedulerWrapper> getScheduler) { var scheduler = getScheduler(); var p = GetMethodParameters(url.ParseQueryString()); p.method.Invoke(scheduler, p.parameters.ToArray()); return(new Response.RedirectResponse(p.redirect)); }
public static Response Execute(RelativeUri url) { var querystring = url.ParseQueryString(); var resource = querystring["r"]; resource = string.Format("{0}.Resources.{1}", assembly.FullName.Split(',')[0], resource); var content = ReadResource(resource); return(new Response.ContentResponse(content: content, contentType: querystring["t"])); }
public static Response Execute(RelativeUri url, Func <ISchedulerWrapper> getScheduler) { var scheduler = getScheduler(); var qs = url.ParseQueryString(); var highlight = qs["highlight"]; var group = qs["group"]; var triggers = GetTriggers(scheduler, group); var paused = scheduler.IsTriggerGroupPaused(group); var v = Views.Views.TriggerGroup(group, paused, url.PathAndQuery, highlight, triggers); return(new Response.XDocumentResponse(Helpers.XHTML(v))); }
public void RelativeUri_Unhappy(string path, string expectedMessage) { if (expectedMessage == null) { var ex = Assert.Throws <ArgumentNullException>(() => { RelativeUri target = path; }); ex.Message.Should().Be("Value cannot be null. (Parameter 'value')"); } else { var ex = Assert.Throws <ArgumentException>(() => { RelativeUri target = path; }); ex.Message.Should().Be(expectedMessage); } }
public static Response Execute(RelativeUri url, Func <ISchedulerWrapper> getScheduler) { var scheduler = getScheduler(); var querystring = url.ParseQueryString(); var highlight = querystring["highlight"]; var group = querystring["group"]; var job = querystring["job"]; var jobKey = new JobKey(job, group); var triggers = GetTriggers(scheduler, jobKey); var m = new TriggersByJobModel(triggers, url.PathAndQuery, group, job, highlight); return(new Response.XDocumentResponse(Helpers.XHTML(Views.Views.TriggersByJob(m)))); }
public void RelativeUri_Happy() { var url = "stub/here"; RelativeUri uri1 = url; RelativeUri uri2 = "/" + url; RelativeUri uri3 = url + "/"; using (new AssertionScope()) { uri1.ToString().Should().Be(url); uri2.ToString().Should().Be(url); uri3.ToString().Should().Be(url); } }
public void ctor_SerializationInfo_StreamingContext() { var expected = new RelativeUri("/"); RelativeUri actual; using (Stream stream = new MemoryStream()) { var formatter = new BinaryFormatter(); formatter.Serialize(stream, new RelativeUri("/")); stream.Position = 0; actual = (RelativeUri)formatter.Deserialize(stream); } Assert.Equal(expected, actual); }
public static Response Execute(RelativeUri url) { var thisUrl = url.PathAndQuery.Split('?')[0]; var qs = url.ParseQueryString(); var pageSize = GetPageSize(qs); var pagination = new PaginationInfo( firstItemIndex: GetStartIndex(qs), pageSize: pageSize, totalItemCount: logsQ.Count(), pageUrl: "log.ashx?start=!0&max=" + pageSize); var logs = logsQ.Skip(pagination.FirstItemIndex).Take(pagination.PageSize).ToList(); var v = GetView(qs.AllKeys); var view = v.Value(logs, pagination, thisUrl); return(new Response.XDocumentResponse(view, v.Key)); }
public static Response Execute(RelativeUri uri, Func <ISchedulerWrapper> getScheduler) { var scheduler = getScheduler(); var querystring = QueryStringParser.ParseQueryString(uri.Query); var group = querystring["group"]; var jobNames = scheduler.GetJobKeys(GroupMatcher <JobKey> .GroupEquals(group)); var runningJobs = scheduler.GetCurrentlyExecutingJobs(); var jobs = jobNames.Select(j => { var job = scheduler.GetJobDetail(j); var interruptible = typeof(IInterruptableJob).IsAssignableFrom(job.JobType); var jobContext = runningJobs.FirstOrDefault(r => r.JobDetail.Key.ToString() == job.Key.ToString()); return(new JobWithContext(job, jobContext, interruptible)); }); var paused = scheduler.IsJobGroupPaused(group); var highlight = querystring["highlight"]; var view = Views.Views.JobGroup(group, paused, highlight, uri.PathAndQuery, jobs); return(new Response.XDocumentResponse(Helpers.XHTML(view))); }
public void op_Equals_object() { var obj = new RelativeUri("/"); var comparand = new RelativeUri("/"); Assert.True(obj.Equals(comparand as object)); }
public void opImplicit_string_RelativeUri() { const string expected = "/"; string actual = new RelativeUri(expected); Assert.Equal(expected, actual); }
public void opGreaterThan_RelativeUriNull_RelativeUri() { var comparand = new RelativeUri("/"); Assert.False(null > comparand); }
public void prop_Length_get() { const int expected = 4; var actual = new RelativeUri("/234").Length; Assert.Equal(expected, actual); }
public void opEquality_RelativeUri_RelativeUri() { var obj = new RelativeUri("/"); var comparand = new RelativeUri("/"); Assert.True(obj == comparand); }
public void opLesserThan_RelativeUri_RelativeUriNull() { var obj = new RelativeUri("/"); Assert.False(obj < null); }
public void op_GetHashCode() { var obj = new RelativeUri("/"); var expected = obj.ToString().GetHashCode(); var actual = obj.GetHashCode(); Assert.Equal(expected, actual); }
public void opLesserThan_RelativeUriNull_RelativeUri() { var comparand = new RelativeUri("/"); Assert.True(null < comparand); }
public void opLesserThan_RelativeUri_RelativeUriLesser() { var obj = new RelativeUri("/xyz"); var comparand = new RelativeUri("/abc"); Assert.False(obj < comparand); }
public void opInequality_RelativeUri_RelativeUriSame() { var obj = new RelativeUri("/"); var comparand = obj; Assert.False(obj != comparand); }
public void opInequality_RelativeUri_RelativeUriDiffers() { var obj = new RelativeUri("/abc"); var comparand = new RelativeUri("/xyz"); Assert.True(obj != comparand); }
public void opImplicit_RelativeUri_stringEmpty() { var expected = new RelativeUri(string.Empty); RelativeUri actual = string.Empty; Assert.Equal(expected, actual); }
public void op_Equals_objectDiffer() { var obj = new RelativeUri("/abc"); var comparand = new RelativeUri("/xyz"); Assert.False(obj.Equals(comparand as object)); }
public void op_CompareTo_RelativeUriEqual() { var obj = new RelativeUri("/"); var comparand = new RelativeUri("/"); const int expected = 0; var actual = obj.CompareTo(comparand); Assert.Equal(expected, actual); }
public void op_Equals_objectSame() { var obj = new RelativeUri("/"); Assert.True(obj.Equals(obj as object)); }
public void op_CompareTo_object() { const int expected = 1; var actual = new RelativeUri("/").CompareTo(null as object); Assert.Equal(expected, actual); }
public void op_ToString() { const string expected = "/"; var actual = new RelativeUri(expected).ToString(); Assert.Equal(expected, actual); }
private Uri GetAbsoluteUri() { return(new Uri(_baseUri + RelativeUri.TrimStart('/'))); }
public void prop_Length_getEmpty() { const int expected = 0; var actual = new RelativeUri(string.Empty).Length; Assert.Equal(expected, actual); }
public void opImplicit_RelativeUri_string() { var expected = new RelativeUri("/"); RelativeUri actual = "/"; Assert.Equal(expected, actual); }
public void opEquality_RelativeUri_RelativeUriDiffers() { var obj = new RelativeUri("/abc"); var comparand = new RelativeUri("/xyz"); Assert.False(obj == comparand); }
public void opGreaterThan_RelativeUri_RelativeUriNull() { var obj = new RelativeUri("/"); Assert.True(obj > null); }
public void opGreaterThan_RelativeUriGreater_RelativeUri() { var obj = new RelativeUri("/xyz"); var comparand = new RelativeUri("/abc"); Assert.True(obj > comparand); }
public void EnsurePathTrailingSlash_Relative() { RelativeUri .Invoking(u => u.EnsurePathTrailingSlash()) .Should().Throw <ArgumentException>(); }
public void opExplicit_RelativeUri_UriRelative() { var expected = new RelativeUri("/"); RelativeUri actual = new Uri("/", UriKind.Relative); Assert.Equal(expected, actual); }
public void opImplicit_Uri_RelativeUri() { var expected = new Uri("/", UriKind.Relative); Uri actual = new RelativeUri(expected); Assert.Equal(expected, actual); }
public bool InterpretHeaders() { // // when all the headers are parsed, this method will // interpret the values of the "special" headers and set // the corresponding properties to the correct values. // if (Headers == null) { var exception = new Exception("Don't have headers yet"); #if DEBUG if (HttpTraceHelper.ExceptionThrown.TraceVerbose) { HttpTraceHelper.WriteLine("HttpListenerWebRequest#" + HttpTraceHelper.HashString(this) + "::InterpretHeaders() throwing: " + exception); } #endif throw exception; } if (_interpretHeadersCalled) { return(false); } _interpretHeadersCalled = true; // // Connection && KeepAlive // Connection = Headers["Connection"]; KeepAlive = Connection == null || Connection.ToLower(CultureInfo.InvariantCulture).IndexOf("close") == -1; // // RequestUri // Host = Headers["Host"]; RequestUri = null; // we should try this only if this is a fully qualified Uri if (RelativeUri.StartsWith("http://") || RelativeUri.StartsWith("https://")) { try { RequestUri = new Uri(RelativeUri); } catch (Exception exception) { #if DEBUG if (HttpTraceHelper.ExceptionCaught.TraceVerbose) { HttpTraceHelper.WriteLine("HttpListenerWebRequest#" + HttpTraceHelper.HashString(this) + "::InterpretHeaders() caught exception in Uri..ctor(): " + exception); } #endif } } if (RequestUri == null || !(RequestUri.Scheme.Equals("http") || RequestUri.Scheme.Equals("https"))) { try { RequestUri = RelativeUri[0] != '/' ? new Uri("http://" + Host + "/" + RelativeUri) : new Uri("http://" + Host + RelativeUri); } catch (Exception exception) { #if DEBUG if (HttpTraceHelper.ExceptionCaught.TraceVerbose) { HttpTraceHelper.WriteLine("HttpListenerWebRequest#" + HttpTraceHelper.HashString(this) + "::InterpretHeaders() caught exception in Uri..ctor(): " + exception); } #endif } } // // Chunked // var value = Headers["Transfer-Encoding"]; Chunked = value != null && value.ToLower(CultureInfo.InvariantCulture).IndexOf("chunked") >= 0; // // ContentLength // if (Chunked) { // // if the client is chunking we ignore Content-Length // ContentLength = -1; } else { ContentLength = 0; value = Headers["Content-Length"]; if (value != null) { try { ContentLength = Int64.Parse(value); } catch (Exception exception) { #if DEBUG if (HttpTraceHelper.ExceptionCaught.TraceVerbose) { HttpTraceHelper.WriteLine("HttpListenerWebRequest#" + HttpTraceHelper.HashString(this) + "::InterpretHeaders() caught exception in Int64.Parse(): " + exception); } #endif } } } #if DEBUG if (HttpTraceHelper.InternalLog.TraceVerbose) { HttpTraceHelper.WriteLine("HttpListenerWebRequest#" + HttpTraceHelper.HashString(this) + "::InterpretHeaders() ContentLength:" + ContentLength + " Chunked:" + Chunked); } #endif // check validity of request delimiters // i.e.: will we be able to tell when the request is over? // if not, return a bad request and close the connection if ((string.Compare(Method, "post", true, CultureInfo.InvariantCulture) == 0 || string.Compare(Method, "put", true, CultureInfo.InvariantCulture) == 0) && !Uploading) { // // connection Keep Alive, neither Chunking nor Content Length // sorry, can't do it: will not be able to tell the end of the body // #if DEBUG if (HttpTraceHelper.InternalLog.TraceVerbose) { HttpTraceHelper.WriteLine("HttpListenerWebRequest#" + HttpTraceHelper.HashString(this) + "::InterpretHeaders() Client's not chunking, didn't set Content-Length and wants to do Keep-Alive... what a fool!"); } #endif return(false); } if (!Uploading) { // // we can already start receiving the next request // #if DEBUG if (HttpTraceHelper.InternalLog.TraceVerbose) { HttpTraceHelper.WriteLine("HttpListenerWebRequest#" + HttpTraceHelper.HashString(this) + "::InterpretHeaders() Client's not uploading calling Close()"); } #endif Close(); } return(true); }
public void opGreaterThan_RelativeUri_RelativeUri() { var obj = new RelativeUri("/"); var comparand = new RelativeUri("/"); Assert.False(obj > comparand); }
public void op_CompareTo_objectLesser() { var obj = new RelativeUri("/xyz"); object comparand = new RelativeUri("/abc"); const int expected = 23; var actual = obj.CompareTo(comparand); Assert.Equal(expected, actual); }
public ContentBEndpoint(RelativeUri relativeUri) : base(relativeUri) { }
public override int GetHashCode() { return(RelativeUri.GetHashCode()); }
public void op_CompareTo_objectSame() { var obj = new RelativeUri("/"); const int expected = 0; var actual = obj.CompareTo(obj as object); Assert.Equal(expected, actual); }
public void op_Equals_RelativeUriSame() { var obj = new RelativeUri("/"); var comparand = obj; Assert.True(obj.Equals(comparand)); }
public void op_Equals_RelativeUriUnequal() { var obj = new RelativeUri("/abc"); var comparand = new RelativeUri("/xyz"); Assert.False(obj.Equals(comparand)); }
public Endpoint(RelativeUri relativeUri) { this.relativeUri = relativeUri; }
public void ChangeBase_RelativeNewBaseUri() { RelativeUri .Invoking(u => AnyUri.ChangeBase(AnyUri, u)) .Should().Throw <ArgumentException>(); }