public void TestJsonWebPoller()
        {
            IWebPoller webPoller = new JsonWebPoller();
            string url = "http://localhost:8124/names";
            List<Dictionary<string, string>> results = (List<Dictionary<string, string>>) webPoller.PollURL(url);

            Assert.IsNotNull(results);
        }
 public void TestJsonWebPollerFail()
 {
     try
     {
         IWebPoller webPoller = new JsonWebPoller();
         string url = "http://google.com";
         List<Dictionary<string, string>> results = (List<Dictionary<string, string>>)webPoller.PollURL(url);
     }
     catch (InvalidOperationException e)
     {
         Assert.IsTrue(true);
     }
 }
예제 #3
0
        //Function to update the cache of all of the data from the web service.  This just
        //saves the complete objects by record identifier.
        public bool UpdateFullCache(string routeName, string searchString = null)
        {
            bool success = false;

            Configuration config;
            using (IRedisTypedClient<Configuration> redis = GetRedisClientForConfigurations())
            {
                config = redis.GetValue(routeName);
            }

            if (config != null)
            {
                IWebPoller webPoller = new JsonWebPoller();
                string url = "";
                if (searchString == null)
                {
                    url = config.UpdateURL;
                }else
                {
                    url = config.UpdateURL + "/" + searchString;
                }

                List<Dictionary<string, string>> results = (List<Dictionary<string, string>>) webPoller.PollURL(url);
                if (searchString == null)
                {
                    updateAllRouteObjectsCache(routeName, config.RecordIndentifier, results);
                }
                else
                {
                    updateRouteObjectsCache(routeName, config.RecordIndentifier, results);
                }
                success = true;
            }

            return success;
        }