public async Task <SubscriptionEntry> GetSubscriptionEntryAsync(string subscriptionId)
        {
            SubscriptionEntry value = null;

            _map.TryGetValue(subscriptionId, out value);
            return(value);
        }
Ejemplo n.º 2
0
        public void CreateFeedEntryTest()
        {
            Uri               uriBase  = null;                                    // TODO: Initialize to an appropriate value
            IService          iService = null;                                    // TODO: Initialize to an appropriate value
            SubscriptionFeed  target   = new SubscriptionFeed(uriBase, iService); // TODO: Initialize to an appropriate value
            SubscriptionEntry expected = target.CreateFeedEntry() as SubscriptionEntry;

            Assert.IsNotNull(expected);
        }
Ejemplo n.º 3
0
        public void SubscriptionEntryConstructorTest()
        {
            SubscriptionEntry target = new SubscriptionEntry();

            Assert.IsNotNull(target);
            Assert.IsNull(target.UserName);
            Assert.AreEqual(target.Type, SubscriptionEntry.SubscriptionType.unknown);
            Assert.IsNull(target.QueryString);
        }
Ejemplo n.º 4
0
        public void QueryStringTest()
        {
            SubscriptionEntry target   = new SubscriptionEntry(); // TODO: Initialize to an appropriate value
            string            expected = "secret text string";    // TODO: Initialize to an appropriate value
            string            actual;

            target.QueryString = expected;
            actual             = target.QueryString;
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 5
0
        public void TypeTest()
        {
            SubscriptionEntry target = new SubscriptionEntry(); // TODO: Initialize to an appropriate value

            SubscriptionEntry.SubscriptionType expected = SubscriptionEntry.SubscriptionType.favorites;
            SubscriptionEntry.SubscriptionType actual;
            target.Type = expected;
            actual      = target.Type;
            Assert.AreEqual(expected, actual);
        }
 public async Task SaveSubscriptionEntryAsync(Subscription subscription, string userId)
 {
     var entry = new SubscriptionEntry
     {
         Subscription = subscription,
         UserId       = userId,
     };
     var subPath    = this.GetSubscriptionPath(subscription);
     var jsonString = JsonConvert.SerializeObject(entry);
     await _fileLock.PerformWriteIOAsync(subPath, () => File.WriteAllText(subPath, jsonString));
 }
Ejemplo n.º 7
0
        public IHttpActionResult Getdata(List <Subscribe> subsmodel)
        {
            SubscriptionEntry se = new SubscriptionEntry();

            string    UserId    = "";
            string    ResultMsg = "";
            DataTable dt        = new DataTable();

            dt.Columns.AddRange(new DataColumn[14] {
                new DataColumn("ModelId", typeof(string))
                , new DataColumn("ModelName", typeof(string))
                , new DataColumn("EmployeeUser", typeof(string))
                , new DataColumn("CustomerUser", typeof(string))
                , new DataColumn("InfluencerUser", typeof(string))
                , new DataColumn("VendorUser", typeof(string))
                , new DataColumn("OtherUser", typeof(string))
                , new DataColumn("EmpUserCost", typeof(string))
                , new DataColumn("CustUserCost", typeof(string))
                , new DataColumn("InfluencerCost", typeof(string))
                , new DataColumn("VendorUserCost", typeof(string))
                , new DataColumn("OthrUserCost", typeof(string))
                , new DataColumn("EffectiveDate", typeof(DateTime))
                , new DataColumn("Active", typeof(string))
            });
            foreach (var item in subsmodel)
            {
                UserId = item.UserId;
                foreach (var t in item.SubscribeDAta)
                {
                    dt.Rows.Add(t.ModelId, t.ModelName, t.EmployeeUser, t.CustomerUser, t.InfluencerUser, t.VendorUser, t.OtherUser, t.EmpUserCost, t.CustUserCost, t.InfluencerCost, t.VendorUserCost, t.OthrUserCost, t.EffectiveDate, t.Active);
                }
            }
            string userId = UserId;
            var    ds     = se.SubscriptionEntryData(userId, dt);

            //if (ds.ToString() == "200")
            //{
            //    ResultMsg = "Data Insert Successful";
            //}
            //else
            //{
            //    ResultMsg = "Data not Insert";
            //}
            ResultMsg = ds.ToString();
            dt.Clear();
            return(Ok(ResultMsg));
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Subscribe all GameObject's components that annotate with MessageHandlerAttribute to the messages
        /// </summary>
        /// <param name="messagesHub">Hub on which subscription will be occur. If null then defaul hub (MessagesUtils.Hub) will be used. </param>
        public void Subscribe(MessagesHub messagesHub = null)
        {
            Unsubscribe();

#if !NETFX_CORE
            var engineAssembly = typeof(UnityEngine.Application).Assembly;
#else
            var engineAssembly = typeof(UnityEngine.Application).GetTypeInfo().Assembly;
#endif

            m_subscriptions = new List <SubscriptionEntry>();

            foreach (Component component in GetComponents <Component>())
            {
                if (component == null)
                {
                    Debug.LogWarningFormat("There is null component while attempt to auto subscribe. GameObject = [{0}]", gameObject.name);
                    continue;
                }

                var componentType = component.GetType();

                if (componentType == typeof(MessageAutoSubscriber) ||
#if !NETFX_CORE
                    component.GetType().Assembly == engineAssembly)
#else
                    componentType.GetTypeInfo().Assembly == engineAssembly
#endif
                {
                    continue;
                }

                var subscriptions = MessagesUtils.AutoSubscribe(component, messagesHub);
                if (subscriptions != null && subscriptions.Count > 0)
                {
                    var entry = new SubscriptionEntry()
                    {
                        ComponentName = componentType.Name, MethodSubscriptions = subscriptions
                    };

                    m_subscriptions.Add(entry);
                }
            }
        }
        public static CrawledSubscriptionList CreateDefault()
        {
            var result = new CrawledSubscriptionList();

            foreach (var entry in SubscriptionEntry.Load())
            {
                if (entry.Repos is null)
                {
                    result.Add(entry.Org);
                }
                else
                {
                    foreach (var repo in entry.Repos)
                    {
                        result.Add(entry.Org, repo);
                    }
                }
            }

            return(result);
        }
Ejemplo n.º 10
0
    static int Main(string[] args)
    {
        if (args.Length < 1)
        {
            Console.WriteLine("Usage: configfile <filename>");
            return(-1);
        }

        try
        {
            InitializeLogging();

            // load configuration file
            ConfigFile cfgFile     = new ConfigFile();
            String     cfgFilename = args[0];
            cfgFile.Load(cfgFilename);

            // retrieve config objects from the Config file
            Config c1 = cfgFile.LookupConfig("config1");
            Config c2 = cfgFile.LookupConfig("config2");

            // Display log of XML representation of Config objects
            Log.Info("Config 1:\n" + c1.ToXML());
            Log.Info("Config 2:\n" + c2.ToXML());


            // lookup subscription topic from configuration file, including excluded topics
            try
            {
                SubscriptionEntry subEntry = cfgFile.LookupSubscriptionEntry("events");

                Log.Info("Subscription pattern: " + subEntry.GetPattern());

                while (subEntry.HasNextExcludedPattern())
                {
                    Log.Info("Subscription excluded pattern: " + subEntry.NextExcludedPattern());
                }
            }
            catch (GmsecException e)
            {
                Log.Error("Failed to acquire 'events' subscription entry; reason: " + e.ToString());
            }


            // lookup a Message from the configuration file
            Message message = cfgFile.LookupMessage("msg1");

            // Display XML representation of the message
            Log.Info("Message:\n" + message.ToXML());

            // Obtain ConfigFile Iterator to examine all of the various
            // entries defined in the ConfigFile
            ConfigFileIterator iter = cfgFile.GetIterator();

            // Acquire and display all Config entries
            while (iter.HasNextConfig())
            {
                ConfigEntry entry = iter.NextConfig();

                Log.Info("\nConfig Name: " + entry.GetName() +
                         "\nConfig     :\n" + entry.GetConfig().ToXML());
            }

            // Acquire and display all Message entries
            while (iter.HasNextMessage())
            {
                MessageEntry entry = iter.NextMessage();

                Log.Info("\nMessage Name: " + entry.GetName() +
                         "\nMessage     :\n" + entry.GetMessage().ToXML());
            }

            // Acquire and display all Message entries
            while (iter.HasNextSubscription())
            {
                SubscriptionEntry entry = iter.NextSubscription();

                Log.Info("\nSubscription Name : " + entry.GetName() +
                         "\nSubscription Topic: " + entry.GetPattern());

                while (entry.HasNextExcludedPattern())
                {
                    Log.Info("\nExcluded Pattern: " + entry.NextExcludedPattern());
                }
            }

            while (iter.HasNextCustomElement())
            {
                String element = iter.NextCustomElement();

                Log.Info("\nCustom XML Element:\n" + element);
            }
        }
        catch (GmsecException e)
        {
            Log.Error(e.ToString());
            return(-1);
        }

        return(0);
    }