Esempio n. 1
0
        public void Add(AstoriaRequest request)
        {
            if (currentBatch == null)
            {
                currentBatch = new BatchRequest(request.Workspace);
            }

            if (request.Verb == RequestVerb.Get)
            {
                currentBatch.Add(request);
            }
            else
            {
                if (currentChangeset == null)
                {
                    currentChangeset = currentBatch.GetChangeset();
                }
                currentChangeset.Add(request);
            }

            if (currentBatch.TotalRequests >= Size && AutoSubmit)
            {
                Finish();
            }
        }
Esempio n. 2
0
        public virtual AstoriaResponse GetResponse()
        {
            LogRequest();

            OnSend(this);

            // NOTHING should come in between this and actually sending the request
#if !ClientSKUFramework
            SetupAPICallLog();
#endif
            AstoriaResponse response;
            if (AstoriaTestProperties.BatchAllRequests)
            {
                BatchRequest batchRequest = new BatchRequest(Workspace);
                if (Verb_Internal == RequestVerb.Get)
                {
                    batchRequest.Add(this);
                }
                else
                {
                    BatchChangeset changeset = batchRequest.GetChangeset();
                    changeset.Add(this);
                }
                BatchResponse batchResponse = batchRequest.GetResponse() as BatchResponse;
                response = batchResponse.Responses.FirstOrDefault();
            }
            else
            {
                response = RequestSender.SendRequest(this);
            }

#if !ClientSKUFramework
            // NOTHING should come in between this and actually recieving the response
            RetrieveAPICallLog();
#endif

            OnReceive(this, response);

            return(response);
        }