コード例 #1
0
        public static void TestDomainMatcher(IDomainMatcher <Rule> tree)
        {
            tree.Update(@"a.b.c.cn", Block);
            tree.Update(@"b.c.cn", Proxy);
            tree.Update(@"cn", Direct);
            tree.Update(@"b.com", Proxy);
            tree.Update(@"ab.com", Block);

            Assert.AreEqual(Unknown, tree.Match(@"com"));
            Assert.AreEqual(Proxy, tree.Match(@"b.com"));
            Assert.AreEqual(Block, tree.Match(@"ab.com"));
            Assert.AreEqual(Proxy, tree.Match(@"d.b.com"));
            Assert.AreEqual(Proxy, tree.Match(@"a.d.b.com"));

            Assert.AreEqual(Direct, tree.Match(@"a.b.cn"));
            Assert.AreEqual(Direct, tree.Match(@"c.cn"));
            Assert.AreEqual(Direct, tree.Match(@"d.cn"));
            Assert.AreEqual(Proxy, tree.Match(@"b.c.cn"));
            Assert.AreEqual(Block, tree.Match(@"a.b.c.cn"));

            Assert.AreEqual(Unknown, tree.Match(@"1234.org"));
        }
コード例 #2
0
        public Site Create(IDomainMatcher domainMatcher, string database)
        {
            Log.Info($"[CustomDomainMatcherSiteFactory] Creating FXM Site {domainMatcher.Name}", this);

            var properties = new StringDictionary
            {
                { "name", domainMatcher.Name },
                { "virtualFolder", "/" },
                { "physicalFolder", "/" },
                { "rootPath", "/sitecore/content" },
                { "startItem", "/home" },
                { "database", database },
                { "domain", "extranet" },
                { "cacheHtml", "true" },
                { "htmlCacheSize", "0MB" },
                { "registryCacheSize", "0MB" },
                { "viewStateCacheSize", "0MB" },
                { "xslCacheSize", "0MB" },
                { "filteredItemsCacheSize", "0MB" },
                { "renderingParametersCacheSize", "0MB" }
            };

            return(new Site(domainMatcher.Name, properties));
        }