Exemplo n.º 1
0
 public void SubscribeTargetToSourceChanges(CloudBlob subscriber)
 {
     if (subscriber.CanContainExternalMetadata() == false)
     {
         throw new InvalidDataException("Subscriber candidate cannot contain metadata: " + subscriber.Name);
     }
     foreach (var source in CollectionContent.Where(src => src.IsInformationObjectSource))
     {
         SubscribeSupport.AddSubscriptionToObject(source.SourceLocation, subscriber.Name,
                                                  SubscribeSupport.SubscribeType_WebPageToSource);
     }
 }
Exemplo n.º 2
0
        public void SetDefaultSource(InformationSource defaultSource)
        {
            InformationSource currentDefaultSource = GetDefaultSource(defaultSource.SourceInformationObjectType);

            if (currentDefaultSource != null)
            {
                CollectionContent.Remove(currentDefaultSource);
            }
            CollectionContent.Add(defaultSource);
            currentDefaultSource = GetDefaultSource(defaultSource.SourceInformationObjectType);
            if (defaultSource != currentDefaultSource)
            {
                throw new InvalidDataException("Invalid default source given to add (not maching the GetDefaultSource conditions)");
            }
        }
Exemplo n.º 3
0
        private CollectionContentModel CreateCollectionModel(string collectionName = null, string id = null, string method = null, string requestName = null)
        {
            var header = new List <Header>
            {
                new Header {
                    key = "X-Api-Key", value = Key.key
                },
                new Header {
                    key = "Content-Type", value = "application/json"
                }
            };

            var url = new Url
            {
                raw      = Constants.baseUri,
                protocol = "https",
                host     = new List <string>
                {
                    "api",
                    "getpostman",
                    "com"
                },
                path = new List <string>
                {
                    "collections"
                }
            };

            var request = new Request
            {
                url    = url,
                method = method ?? "GET",
                header = header
            };

            var item = new List <Item>
            {
                new Item
                {
                    name    = requestName ?? "Test",
                    request = request
                }
            };

            var info = new Info
            {
                _postman_id = id ?? Guid.NewGuid().ToString(),
                name        = collectionName ?? "vsTest",
                schema      = Constants.CollectionSchema
            };

            var collection = new CollectionContent
            {
                info = info,
                item = item
            };

            return(new CollectionContentModel {
                collection = collection
            });
        }
Exemplo n.º 4
0
 public bool HasAnySourceChanged()
 {
     return(CollectionContent.Any(source => source.HasSourceChanged()));
 }
Exemplo n.º 5
0
 public InformationSource GetDefaultSource(string informationObjectTypeName)
 {
     return
         (CollectionContent.FirstOrDefault(
              source => source.IsInformationObjectSource && String.IsNullOrEmpty(source.SourceName) && source.SourceInformationObjectType == informationObjectTypeName));
 }
Exemplo n.º 6
0
 public IInformationObject[] FetchAllInformationObjects()
 {
     return(CollectionContent.Where(source => source.IsInformationObjectSource).Select(
                source => source.RetrieveInformationObject()).ToArray());
 }