Inheritance: IDisposable
 protected static void Establish_context()
 {
     entity = CurveData.CreateBasicEntity();
     var notAMapping = new Contracts.Curve();
     content = HttpContentExtensions.CreateDataContract(notAMapping);
     client = new HttpClient();
 }
        protected static void Establish_context()
        {
            partyrole = PartyRoleData.CreateContractForEntityCreation();

            content = HttpContentExtensions.CreateDataContract(partyrole);
            client = new HttpClient();
        }
        protected static void Establish_context()
        {
            sourcesystem = Script.SourceSystemData.CreateContractForEntityCreation();

            content = HttpContentExtensions.CreateDataContract(sourcesystem);
            client = new HttpClient();
        }
        protected static void Establish_context()
        {
            person = Script.PersonData.CreateContractForEntityCreation();

            content = HttpContentExtensions.CreateDataContract(person);
            client = new HttpClient();
        }
 protected static void Establish_context()
 {
     entity = Script.SourceSystemData.CreateBasicEntity();
     var notAMapping = new EnergyTrading.Mdm.Contracts.SourceSystem();
     content = HttpContentExtensions.CreateDataContract(notAMapping);
     client = new HttpClient();
 }
Exemple #6
0
        public SyndicationItem AddMediaResource(Uri mediaCollectionUri, string contentType, string description, HttpContent mediaContent)
        {
            if (mediaCollectionUri == null)
            {
                throw new ArgumentNullException("mediaCollectionUri");
            }
            if (mediaContent == null)
            {
                throw new ArgumentNullException("mediaContent");
            }
            HttpRequestMessage request = new HttpRequestMessage()
                {
                    Content = mediaContent,
                    Method = "POST",
                    Uri = mediaCollectionUri
                };
            if (!string.IsNullOrEmpty(description))
            {
                request.Headers["Slug"] = description;
            }
            if (!string.IsNullOrEmpty(contentType))
            {
                request.Headers.ContentType = contentType;
            }
            return this.Send(request).EnsureStatusIs(HttpStatusCode.Created).Content.ReadAsDataContract<Atom10ItemFormatter>().Item;

        }
        protected static void Establish_context()
        {
            broker = BrokerData.CreateContractForEntityCreation();

            content = HttpContentExtensions.CreateDataContract(broker);
            client = new HttpClient();
        }
        protected static void Establish_context()
        {
            curve = CurveData.CreateContractForEntityCreation();

            content = HttpContentExtensions.CreateDataContract(curve);
            client = new HttpClient();
        }
        protected static void Establish_context()
        {
            exchange = ExchangeData.CreateContractForEntityCreation();

            content = HttpContentExtensions.CreateDataContract(exchange);
            client = new HttpClient();
        }
 protected static void Establish_context()
 {
     entity = BrokerData.CreateBasicEntity();
     var notAMapping = new EnergyTrading.MDM.Contracts.Sample.Broker();
     content = HttpContentExtensions.CreateDataContract(notAMapping);
     client = new HttpClient();
 }
        protected static void Establish_context()
        {
            counterparty = CounterpartyData.CreateContractForEntityCreation();

            content = HttpContentExtensions.CreateDataContract(counterparty);
            client = new HttpClient();
        }
        protected static void Establish_context()
        {
            legalentity = LegalEntityData.CreateContractForEntityCreation();

            content = HttpContentExtensions.CreateDataContract(legalentity);
            client = new HttpClient();
        }
 protected static void Establish_context()
 {
     entity = PartyRoleData.CreateBasicEntity();
     var notAMapping = new OpenNexus.MDM.Contracts.PartyRole();
     content = HttpContentExtensions.CreateDataContract(notAMapping);
     client = new HttpClient();
 }
 protected static void Establish_context()
 {
     entity = Script.PersonData.CreateBasicEntityWithOneMapping();
     client = new HttpClient();
     var notAMapping = new MDM.Person();
     content = HttpContentExtensions.CreateDataContract(notAMapping);
     startVersion = CurrentEntityVersion();
 }
        protected static void Establish_context()
        {
            client = new HttpClient();
            entity = Script.PersonData.CreateBasicEntity();

            content = HttpContentExtensions.CreateDataContract(new EnergyTrading.MDM.Contracts.Sample.Person());
            startVersion = CurrentEntityVersion();
        }
        public DataPackets.HttpResponseMessage Send(string method, Uri uri, byte[] postData, string contentType)
        {
            var content  = HttpContent.Create(postData, contentType);
            var request  = new HttpRequestMessage(method, uri, content);
            var response = _httpClient.Send(request);

            return(ToNativeResponse(response));
        }
        protected static void Establish_context()
        {
            client = new HttpClient();
            entity = CurveData.CreateBasicEntity();

            content = HttpContentExtensions.CreateDataContract(new MDM.Contracts.Curve());
            startVersion = CurrentEntityVersion();
        }
        protected static void Establish_context()
        {
            client = new HttpClient();
            entity = Script.SourceSystemData.CreateBasicEntity();
            var getResponse = client.Get(ServiceUrl["SourceSystem"] + entity.Id);

            updatedContract = getResponse.Content.ReadAsDataContract<EnergyTrading.Mdm.Contracts.SourceSystem>();
            content = HttpContentExtensions.CreateDataContract(Script.SourceSystemData.MakeChangeToContract(updatedContract));
        }
        protected static void Establish_context()
        {
            client = new HttpClient();
            entity = PartyRoleData.CreateBasicEntity();
            var getResponse = client.Get(ServiceUrl["PartyRole"] + entity.Id);

            updatedContract = getResponse.Content.ReadAsDataContract<OpenNexus.MDM.Contracts.PartyRole>();
            content = HttpContentExtensions.CreateDataContract(PartyRoleData.MakeChangeToContract(updatedContract));
        }
        protected static void Establish_context()
        {
            client = new HttpClient();
            entity = BrokerData.CreateBasicEntity();
            var getResponse = client.Get(ServiceUrl["Broker"] + entity.Id);

            updatedContract = getResponse.Content.ReadAsDataContract<EnergyTrading.MDM.Contracts.Sample.Broker>();
            content = HttpContentExtensions.CreateDataContract(BrokerData.MakeChangeToContract(updatedContract));
        }
        protected static void Establish_context()
        {
            client = new HttpClient();

            Search search = SearchBuilder.CreateSearch();
            search.AddSearchCriteria(SearchCombinator.Or).AddCriteria(
                "InvalidField", SearchCondition.Equals, Guid.NewGuid().ToString());

            content = HttpContentExtensions.CreateDataContract(search);
        }
        public void SendAsync(string method, Uri uri, byte[] postData, string contentType, Action <DataPackets.HttpResponseMessage> httpClientCallback)
        {
            var content        = HttpContent.Create(postData, contentType);
            var request        = new HttpRequestMessage(method, uri, content);
            var rawRequestData = new AsyncRequest {
                RawPostData = postData, RawPostDataContentType = contentType, HttpClientCallback = httpClientCallback
            };

            _httpClient.BeginSend(request, SendAsyncEnd, rawRequestData);
        }
        protected static void Establish_context()
        {
            client = new HttpClient();
            entity = Script.PartyData.CreateBasicEntity();
            var getResponse = client.Get(ServiceUrl["Party"] + entity.Id);

            updatedContract = getResponse.Content.ReadAsDataContract<EnergyTrading.MDM.Contracts.Sample.Party>();
            updatedContract.Details.Name = "Bob";
            updatedContract.Identifiers.Remove(updatedContract.Identifiers.Where(id => id.IsMdmId).First());
            content = HttpContentExtensions.CreateDataContract(updatedContract);
        }
        public DataPackets.HttpResponseMessage Send(string method, Uri uri, DataPackets.HttpContent postData)
        {
            System.Diagnostics.Debug.WriteLine("Request: " + uri.ToString() + " (" + method + ")");
            var httpRequestMessage = new HttpRequestMessage(method, uri, HttpContent.Create(postData.Content, postData.ContentType))
            {
                Headers = { ContentType = postData.ContentType }
            };
            var response = _httpClient.Send(httpRequestMessage);

            return(ToNativeResponse(response));
        }
Exemple #25
0
 public SyndicationItem AddMediaResource(SyndicationFeed feed, string contentType, string description, HttpContent mediaContent)
 {
     if (feed == null)
     {
         throw new ArgumentNullException("feed");
     }
     if (mediaContent == null)
     {
         throw new ArgumentNullException("mediaContent");
     }
     return AddMediaResource(feed.GetSelfLink(true).Uri, contentType, description, mediaContent);
 }
        protected static void Establish_context()
        {
            entity1 = CounterpartyData.CreateBasicEntity();
            entity2 = CounterpartyData.CreateBasicEntity();

            client = new HttpClient();

            var search = new Search();
            CounterpartyData.CreateSearch(search, entity1, entity2);

            content = HttpContentExtensions.CreateDataContract(search);
        }
        protected static void Establish_context()
        {
            var entity1 = Script.PersonData.CreateBasicEntity();
            var entity2 = Script.PersonData.CreateBasicEntity();

            client = new HttpClient();

            var search = new Search();
            Script.PersonData.CreateSearch(search, entity1, entity2);

            content = HttpContentExtensions.CreateDataContract(search);
        }
        public void SendAsync(string method, Uri uri, DataPackets.HttpContent postData, Action <DataPackets.HttpResponseMessage> httpClientCallback)
        {
            var httpRequestMessage = new HttpRequestMessage(method, uri, HttpContent.Create(postData.Content, postData.ContentType))
            {
                Headers = { ContentType = postData.ContentType }
            };
            var rawRequestData = new AsyncRequest {
                PostData = postData, HttpClientCallback = httpClientCallback
            };

            _httpClient.BeginSend(httpRequestMessage, SendAsyncEnd, rawRequestData);
        }
        protected static void Establish_context()
        {
            entity1 = Script.PersonData.CreateBasicEntityWithOneMapping();

            client = new HttpClient();

            Search search = SearchBuilder.CreateSearch(isMappingSearch: true);
            search.AddSearchCriteria(SearchCombinator.And).AddCriteria(
                "MappingValue", SearchCondition.Equals, entity1.Mappings[0].MappingValue).AddCriteria(
                    "System.Name", SearchCondition.Equals, "Endur");

            content = HttpContentExtensions.CreateDataContract(search);
        }
        public void Add(string name, string fileName, HttpContent content)
        {
            if (string.IsNullOrEmpty(content.ContentType))
            {
                throw new ArgumentOutOfRangeException("content", "content.ContentType is null or empty");
            }

            this.Files.Add(new HttpFormFile()
                {
                    Name = name,
                    FileName = fileName,
                    Content = content
                });
        }
        protected static void Establish_context()
        {
            repository = new DbSetRepository(new DbContextProvider(() => new NexusMappingContext()));

            foreach (var rd in repository.Queryable<MDM.ReferenceData>())
            {
                repository.Delete(rd);
            }

            referenceDataList = new List<EnergyTrading.Mdm.Contracts.ReferenceData>() { new EnergyTrading.Mdm.Contracts.ReferenceData() { Value = "test1"}, new EnergyTrading.Mdm.Contracts.ReferenceData() { Value = "test2"}};

            content = HttpContentExtensions.CreateDataContract(referenceDataList);
            client = new HttpClient();
        }
        protected static void Establish_context()
        {
            entity = Script.SourceSystemData.CreateBasicEntity();
            mapping = new EnergyTrading.Mdm.Contracts.Mapping{
                    SystemName = "Endur",
                    Identifier = Guid.NewGuid().ToString(),
                    SourceSystemOriginated = false,
                    DefaultReverseInd = false,
                    StartDate = Script.baseDate,
                    EndDate = Script.baseDate.AddDays(2)
                };

            content = HttpContentExtensions.CreateDataContract(mapping);
            client = new HttpClient();
        }
        public HttpResult Put(string urlPath, HttpContent content)
        {
            // Setup initial conditions.
            if (urlPath.IsNullOrEmpty(true)) return null;
            urlPath = FormatPath(urlPath);

            // Pass PUT call to the target server.
            using (var client = new HttpClient(GetBaseUrl()))
            {
                using (var response = client.Put(urlPath, content))
                {
                    return ProcessResponse(response);
                }
            }
        }
        protected static void Establish_context()
        {
            entity = CurveData.CreateBasicEntity();
            mapping = new Mapping {
                    SystemName = "Endur",
                    Identifier = "Test",
                    SourceSystemOriginated = false,
                    DefaultReverseInd = true,
                    StartDate = Script.baseDate,
                    EndDate = Script.baseDate.AddDays(2)
                };

            content = HttpContentExtensions.CreateDataContract(mapping);
            content2 = HttpContentExtensions.CreateDataContract(mapping);
            client = new HttpClient();
        }
        private static HttpRequestMessage ToMicrosoftHttpRequest(DataPackets.HttpRequestMessage httpRequestMessage)
        {
            if (httpRequestMessage.Content == null || httpRequestMessage.Content.Content.Length == 0)
            {
                return(new HttpRequestMessage(httpRequestMessage.Method, httpRequestMessage.Uri)
                       .WithAcceptHeader(httpRequestMessage));
            }

            return(new HttpRequestMessage(httpRequestMessage.Method, httpRequestMessage.Uri, HttpContent.Create(httpRequestMessage.Content.Content, httpRequestMessage.Content.ContentType))
                   .WithAcceptHeader(httpRequestMessage));
        }