Exemple #1
0
        //---------------------------------------------------------------------
        // Constructs AstoriaRequest and sets.
        //---------------------------------------------------------------------
        private BlobsRequest(Workspace w, SerializationFormatKind format, RequestVerb verb, string uri, HttpStatusCode expectedStatusCode) : base(w)
        {
            // Common settings for MLEs and MRs.
            base.IsBlobRequest      = true;
            base.Verb               = verb;
            base.ExpectedStatusCode = expectedStatusCode;

            // Construct request URI.
            if (uri.Contains("(*)"))
            {
                // Replace (*) with random key.
                string            relativeURI = uri.Remove(0, w.ServiceUri.Length + 1);
                ResourceContainer container   = w.ServiceContainer.ResourceContainers[relativeURI.Substring(0, relativeURI.IndexOf("(*)"))];
                KeyExpression     key         = null;
                try { key = w.GetRandomExistingKey(container, container.BaseType); } catch (Exception e) { AstoriaTestLog.Skip("Unable to get random key"); }
                base.Query = ContainmentUtil.BuildCanonicalQuery(key);
                base.URI  += relativeURI.Substring(relativeURI.IndexOf("(*)") + 3);
            }
            else
            {
                // Deterministic URI.
                base.URI = uri;
            }

            LastURI = base.URI;
        }