public void ParsingUriLoaderResponseUriCaching()
        {
            Skip.IfNot(TestConfigManager.GetSettingAsBoolean(TestConfigManager.UseRemoteParsing),
                       "Test Config marks Remote Parsing as unavailable, test cannot be run");

            int defaultTimeout = Options.UriLoaderTimeout;

            try
            {
                Options.UriLoaderTimeout = 45000;
                Uri soton     = new Uri("http://dbpedia.org/resource/Southampton");
                Uri sotonPage = new Uri("http://dbpedia.org/page/Southampton.html");
                Uri sotonData = new Uri("http://dbpedia.org/data/Southampton.xml");

                Graph g = new Graph();
                UriLoader.Load(g, soton);

                Assert.True(UriLoader.IsCached(soton), "Resource URI should have been cached");
                Assert.True(UriLoader.IsCached(sotonData), "Data URI should have been cached");
                Assert.False(UriLoader.IsCached(sotonPage), "Page URI should not have been cached");
            }
            finally
            {
                Options.UriLoaderTimeout = defaultTimeout;
            }
        }
        public void ParsingUriLoaderUriSantisation()
        {
            Uri a = new Uri(ConfigurationLoader.ClassTripleStore);
            Uri b = new Uri(ConfigurationLoader.ClassGraph);

            Console.WriteLine("URI A: " + a.AbsoluteUri + " is equivalent to " + Tools.StripUriFragment(a).AbsoluteUri);
            Console.WriteLine("URI B:" + b.AbsoluteUri + " is equivalent to " + Tools.StripUriFragment(b).AbsoluteUri);

            Assert.Equal(Tools.StripUriFragment(a).AbsoluteUri, Tools.StripUriFragment(b).AbsoluteUri);

            Graph g = new Graph();

            UriLoader.Load(g, a);

            Assert.True(UriLoader.IsCached(a), "Content should have been cached as a result of loading from the URI");

            Graph h = new Graph();

            UriLoader.Load(h, b);

            Assert.Equal(g, h);
        }
Пример #3
0
        public void ParsingUriLoaderResponseUriCaching()
        {
            int defaultTimeout = Options.UriLoaderTimeout;

            try
            {
                Options.UriLoaderTimeout = 45000;
                Uri soton     = new Uri("http://dbpedia.org/resource/Southampton");
                Uri sotonPage = new Uri("http://dbpedia.org/page/Southampton.html");
                Uri sotonData = new Uri("http://dbpedia.org/data/Southampton.xml");

                Graph g = new Graph();
                UriLoader.Load(g, soton);

                Assert.IsTrue(UriLoader.IsCached(soton), "Resource URI should have been cached");
                Assert.IsTrue(UriLoader.IsCached(sotonData), "Data URI should have been cached");
                Assert.IsFalse(UriLoader.IsCached(sotonPage), "Page URI should not have been cached");
            }
            finally
            {
                Options.UriLoaderTimeout = defaultTimeout;
            }
        }