コード例 #1
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Name.Length != 0)
            {
                hash ^= Name.GetHashCode();
            }
            if (payloadTypeCase_ == PayloadTypeOneofCase.AppEngineHttpRequest)
            {
                hash ^= AppEngineHttpRequest.GetHashCode();
            }
            if (payloadTypeCase_ == PayloadTypeOneofCase.HttpRequest)
            {
                hash ^= HttpRequest.GetHashCode();
            }
            if (scheduleTime_ != null)
            {
                hash ^= ScheduleTime.GetHashCode();
            }
            if (createTime_ != null)
            {
                hash ^= CreateTime.GetHashCode();
            }
            if (dispatchDeadline_ != null)
            {
                hash ^= DispatchDeadline.GetHashCode();
            }
            if (DispatchCount != 0)
            {
                hash ^= DispatchCount.GetHashCode();
            }
            if (ResponseCount != 0)
            {
                hash ^= ResponseCount.GetHashCode();
            }
            if (firstAttempt_ != null)
            {
                hash ^= FirstAttempt.GetHashCode();
            }
            if (lastAttempt_ != null)
            {
                hash ^= LastAttempt.GetHashCode();
            }
            if (View != 0)
            {
                hash ^= View.GetHashCode();
            }
            hash ^= (int)payloadTypeCase_;
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
コード例 #2
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Name.Length != 0)
            {
                hash ^= Name.GetHashCode();
            }
            if (messageTypeCase_ == MessageTypeOneofCase.AppEngineHttpRequest)
            {
                hash ^= AppEngineHttpRequest.GetHashCode();
            }
            if (messageTypeCase_ == MessageTypeOneofCase.HttpRequest)
            {
                hash ^= HttpRequest.GetHashCode();
            }
            if (scheduleTime_ != null)
            {
                hash ^= ScheduleTime.GetHashCode();
            }
            if (createTime_ != null)
            {
                hash ^= CreateTime.GetHashCode();
            }
            if (dispatchDeadline_ != null)
            {
                hash ^= DispatchDeadline.GetHashCode();
            }
            if (DispatchCount != 0)
            {
                hash ^= DispatchCount.GetHashCode();
            }
            if (ResponseCount != 0)
            {
                hash ^= ResponseCount.GetHashCode();
            }
            if (firstAttempt_ != null)
            {
                hash ^= FirstAttempt.GetHashCode();
            }
            if (lastAttempt_ != null)
            {
                hash ^= LastAttempt.GetHashCode();
            }
            if (View != global::Google.Cloud.Tasks.V2.Task.Types.View.Unspecified)
            {
                hash ^= View.GetHashCode();
            }
            hash ^= (int)messageTypeCase_;
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
コード例 #3
0
 protected string CalculateIconFromResponseCounts(ResponseCount rc)
 {
     if (rc.Last24HourResponseCount >= 10)
     {
         return("IconDiscussionsHotTopic");
     }
     if (rc.TotalResponseCount == 0)
     {
         return("IconDiscussionsNoResponses");
     }
     return("IconDiscussionsResponses");
 }
コード例 #4
0
        //@Headers({ "Content-Type: application/json"})
        //@POST("api/v1/scripts")
        //Call<ResponseCodes> sendScriptTask(@Body RequestSendScriptTask requestSendScriptTask);
        public async Task <ResponseCount> SendScriptTaskAsync(RequestSendScriptTask requestSendScriptTask)
        {
            var uri = new Uri(baseUri + @"api/v1/scripts");
            // Сформировать JSON данные
            string jsonContent = JsonConvert.SerializeObject(requestSendScriptTask);
            HttpResponseMessage httpResponse = await cmd.PostAsync(uri, jsonContent);

            ResponseCount responseCount = new ResponseCount();

            if (httpResponse.IsSuccessStatusCode)
            {
                responseCount = JsonConvert.DeserializeObject <ResponseCount>(httpResponse.Content.ToString());
            }
            else
            {
                responseCount.Error   = true;
                responseCount.ErrCode = "";
                responseCount.ErrMsg  = "Ошибка HttpClient.";
            }
            return(responseCount);
        }
コード例 #5
0
        public AccessSafely AfterCompleting(int happenings)
        {
            _access = AccessSafely.AfterCompleting(happenings);

            _access.WritingWith <Response>("response", response => {
                var testId = response.HeaderValueOr(Client.ClientIdCustomHeader, "");

                _logger.WriteLine("{0:MM/dd/yyyy hh:mm:ss.fff} ID: {1}", DateTimeOffset.Now, testId);

                if (string.IsNullOrEmpty(testId))
                {
                    _logger.WriteLine("Expected header missing: {0}", Client.ClientIdCustomHeader);
                }

                if (_clientCounts.ContainsKey(testId))
                {
                    _clientCounts[testId] += 1;
                }
                else
                {
                    _clientCounts.Add(testId, 1);
                }

                ResponseHolder.Set(response);

                ResponseCount.IncrementAndGet();
            });
            _access.ReadingWith("response", () => ResponseHolder.Get());
            _access.ReadingWith("responseCount", () => ResponseCount.Get());
            _access.ReadingWith("responseClientCounts", () => _clientCounts);

            _access.WritingWith <int>("unknownResponseCount", increment => UnknownResponseCount.IncrementAndGet());
            _access.ReadingWith("unknownResponseCount", () => UnknownResponseCount.Get());

            _access.ReadingWith("totalAllResponseCount", () => ResponseCount.Get() + UnknownResponseCount.Get());

            return(_access);
        }
コード例 #6
0
        public AccessSafely AfterCompleting(int happenings)
        {
            _access = AccessSafely.AfterCompleting(happenings);

            _access.WritingWith <Response>("response", response => {
                var testId = response.HeaderValueOr(Client.ClientIdCustomHeader, "");

                _logger.WriteLine("ID: {0}", testId);

                if (string.IsNullOrEmpty(testId))
                {
                    _logger.WriteLine("Expected header missing: {0}", Client.ClientIdCustomHeader);
                    //throw new IllegalStateException("Expected header missing: " + Client.ClientIdCustomHeader);
                }

                int existingCount = 0;
                if (_clientCounts.ContainsKey(testId))
                {
                    existingCount = _clientCounts[testId];
                }

                ResponseHolder.Set(response);

                _clientCounts.Add(testId, existingCount + 1);

                ResponseCount.IncrementAndGet();
            });
            _access.ReadingWith("response", () => ResponseHolder.Get());
            _access.ReadingWith("responseCount", () => ResponseCount.Get());
            _access.ReadingWith("responseClientCounts", () => _clientCounts);

            _access.WritingWith <int>("unknownResponseCount", increment => UnknownResponseCount.IncrementAndGet());
            _access.ReadingWith("unknownResponseCount", () => UnknownResponseCount.Get());

            _access.ReadingWith("totalAllResponseCount", () => ResponseCount.Get() + UnknownResponseCount.Get());

            return(_access);
        }