Esempio n. 1
0
        public void Should_be_possible_to_get_the_others_flagged_properties_by_id()
        {
            var metabaseFragment =
                new MetabaseFragment(METABASE_FRAGMENT_WITH_FLAGGED_ATTRIBUTES_SAMPLE_3, MBSchemaSample);

            var authPersistence = metabaseFragment.GetMetabaseSessionByID("6031");
            var filterFlags = metabaseFragment.GetMetabaseSessionByID("2044");
            var serverConfigFlags = metabaseFragment.GetMetabaseSessionByID("1027");
            var aspAppServiceFlags = metabaseFragment.GetMetabaseSessionByID("7044");
            var logEventOnRecycle = metabaseFragment.GetMetabaseSessionByID("9037");

            Assert.AreEqual("", authPersistence.Value);
            Assert.AreEqual("67108865", filterFlags.Value);
            Assert.AreEqual("15", serverConfigFlags.Value);
            Assert.AreEqual("3", aspAppServiceFlags.Value);
            Assert.AreEqual("137", logEventOnRecycle.Value);
        }
Esempio n. 2
0
        public void Should_be_possible_to_get_DirBrowseFlags_and_LogExtFileFlags_and_PasswordChangeFlags_by_id()
        {
            var metabaseFragment =
                new MetabaseFragment(METABASE_FRAGMENT_WITH_FLAGGED_ATTRIBUTES_SAMPLE_2, MBSchemaSample);

            var dirBrowseFlags = metabaseFragment.GetMetabaseSessionByID("6005");
            var logExtFileFlags = metabaseFragment.GetMetabaseSessionByID("4013");
            var passwordChangeFlags = metabaseFragment.GetMetabaseSessionByID("2068");

            Assert.AreEqual("1073741886", dirBrowseFlags.Value);
            Assert.AreEqual("2199519", logExtFileFlags.Value);
            Assert.AreEqual("6", passwordChangeFlags.Value);
        }
Esempio n. 3
0
        public void Should_be_possible_to_find_metabase_fragment_by_id()
        {
            var metabaseFragment =
                new MetabaseFragment(METABASE_FRAGMENT_MAX_CONNECTIONS_SAMPLE, MBSchemaSample);

            var metabaseSession = metabaseFragment.GetMetabaseSessionByID("1014");

            Assert.IsNotNull(metabaseSession);
            Assert.AreEqual("1014", metabaseSession.ID);
            Assert.AreEqual("MaxConnections", metabaseSession.Name);
            Assert.AreEqual("DWORD", metabaseSession.Type);
            Assert.AreEqual("IIS_MD_UT_SERVER", metabaseSession.UserType);
            Assert.AreEqual("1001", metabaseSession.Value);
        }
Esempio n. 4
0
        public void Should_be_possible_to_get_AuthFlags_by_id()
        {
            var metabaseFragment =
                new MetabaseFragment(METABASE_FRAGMENT_WITH_FLAGGED_ATTRIBUTES_SAMPLE, MBSchemaSample);

            var metabaseSession = metabaseFragment.GetMetabaseSessionByID("6000");

            Assert.AreEqual("4", metabaseSession.Value);
        }
Esempio n. 5
0
        private MetabaseSessionConfiguration GetMetabaseProperty(string location, string propertyID)
        {
            var rootLocation = "/LM/W3SVC";
            if (location.Contains("/LM/W3SVC/AppPools"))
                rootLocation = "/LM/W3SVC/AppPools";
            else if (location.Contains("/LM/W3SVC/Filters"))
                rootLocation = "/LM/W3SVC/Filters";
            
            while (true)
            {
                try
                {
                    var xmlFragmentFromMetabase = this.GetXmlFragmentForLocation(location);
                    var metabaseFragment = new MetabaseFragment(xmlFragmentFromMetabase, MetabaseSchemaContent);
                    return metabaseFragment.GetMetabaseSessionByID(propertyID);
                }
                catch (XPathNoResultException)
                {
                    if (location.Equals(rootLocation))
                        throw new MetabaseItemNotFoundException();

                    var locationParts = location.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
                    if (locationParts.Count() < 2)
                        throw new MetabaseItemNotFoundException();

                    location = location.Replace("/" + locationParts.Last(), string.Empty);
                }
            }
        }