Пример #1
0
        public void CanReadDataServices()
        {
            //DbOperations dbTools = new DbOperations(Config.DefaultLocalCacheConnection(), DatabaseTypes.SQLite);

            MetadataCacheManagerSQL manager  = new MetadataCacheManagerSQL(DatabaseTypes.SQLite, TestConfig.DefaultLocalCacheConnection);
            IList <DataServiceInfo> services = manager.GetAllServices();
        }
Пример #2
0
        public static bool CacheHasServiceUrl(string serviceUrl)
        {
            // Trim the query off of the URL
            serviceUrl = serviceUrl.Trim().ToLower();
            int index = serviceUrl.IndexOf("?");

            if (index > -1)
            {
                serviceUrl = serviceUrl.Substring(0, index);
            }

            // Get the services from the metadata cache database
            MetadataCacheManagerSQL cacheManager = GetCacheManager();
            List <DataServiceInfo>  serviceList  = cacheManager.GetAllServices() as List <DataServiceInfo>;

            // Compare service URLs
            foreach (DataServiceInfo serviceInfo in serviceList)
            {
                string existingUrl = serviceInfo.EndpointURL.ToLower().Trim();

                index = existingUrl.IndexOf("?");
                if (index > -1)
                {
                    // Trim the query off of the URL
                    existingUrl = existingUrl.Substring(0, index);
                }

                if (serviceUrl == existingUrl)
                {
                    return(true);
                }
            }

            return(false);
        }
Пример #3
0
        /// <summary>
        /// Builds a list of Service Endpoint URLs from the metadata cache database
        /// </summary>
        /// <param name="trimUrlParameters">true if parameters (e.g., "?WSDL") should be trimmed from the URLs before adding to the output</param>
        /// <returns>List of Service Endpoint URLs from the metadata cache database</returns>
        public static List <string> GetCacheServiceUrls(bool trimUrlParameters)
        {
            List <string> urls = new List <string> ();

            MetadataCacheManagerSQL cacheManager = GetCacheManager();

            List <DataServiceInfo> serviceList = cacheManager.GetAllServices() as List <DataServiceInfo>;

            foreach (DataServiceInfo serviceInfo in serviceList)
            {
                string url = serviceInfo.EndpointURL.Trim();

                if (trimUrlParameters == true)
                {
                    int index = url.IndexOf("?");
                    if (index > -1)
                    {
                        url = url.Substring(0, index);
                    }
                }

                urls.Add(url);
            }

            return(urls);
        }
Пример #4
0
        public void CanDeleteRecordsForService()
        {
            MetadataCacheManagerSQL manager = TestConfig.MetadataCacheManager;

            IList <DataServiceInfo> services = manager.GetAllServices();

            foreach (DataServiceInfo serv in services)
            {
                int numDeleted = manager.DeleteRecordsForService(serv, false);
            }
        }
Пример #5
0
        public static DataServiceInfo GetDataServiceFromCache(string serviceUrl)
        {
            // Trim the query off of the URL
            string trimmedServiceUrl = serviceUrl.Trim().ToLower();
            int    index             = trimmedServiceUrl.IndexOf("?");

            if (index > -1)
            {
                trimmedServiceUrl = trimmedServiceUrl.Substring(0, index);
            }

            // Get the services from the metadata cache database
            MetadataCacheManagerSQL cacheManager = GetCacheManager();
            List <DataServiceInfo>  serviceList  = cacheManager.GetAllServices() as List <DataServiceInfo>;

            // Compare service URLs
            foreach (DataServiceInfo serviceInfo in serviceList)
            {
                string existingUrl = serviceInfo.EndpointURL.ToLower().Trim();

                // Trim the query off of the URL
                index = existingUrl.IndexOf("?");
                if (index > -1)
                {
                    existingUrl = existingUrl.Substring(0, index);
                }

                if (trimmedServiceUrl == existingUrl)
                {
                    return(serviceInfo);
                }
            }

            // If we made it this far, a matching service wasn't found
            throw new Exception("Matching data service record not found for given service URL: " + serviceUrl);
        }
 /// <summary>
 /// Get a list of all web services registered in the metadata cache database
 /// </summary>
 public IEnumerable <DataServiceInfo> GetWebServices()
 {
     return(_db.GetAllServices());
 }