コード例 #1
0
        public void StatusResultsOrganizerPropertiesWorse()
        {
            using (AmbientClock.Pause())
            {
                StatusResultsOrganizer organizer;
                string o;

                organizer = new StatusResultsOrganizer();
                StatusResults source1Root = new StatusResults(null, null, AmbientClock.UtcNow, 0, new StatusProperty[] { new StatusProperty("AvailablePercent", "1.0") }, StatusNatureOfSystem.ChildrenHeterogenous, new StatusResults[] {
                    new StatusResults(null, "/SampleDisk.OperatingSystem", AmbientClock.UtcNow, 0, new StatusProperty[] { new StatusProperty("AvailablePercent", "2.0"), new StatusProperty("AvailablePercent", "2.1") }, StatusNatureOfSystem.ChildrenHeterogenous, new StatusResults[] {
                        new StatusResults(null, "/SampleDisk.Temp", AmbientClock.UtcNow, 0, new StatusProperty[] { new StatusProperty("AvailablePercent", "2.2"), new StatusProperty("AvailableBytes", "1100000000.0") }, new StatusAuditReport(AmbientClock.UtcNow, TimeSpan.FromSeconds(3), AmbientClock.UtcNow.AddSeconds(2), new StatusAuditAlert(StatusRating.Okay - .0001f, "ALERT", "Alert", "AlertDetails"))),
                        new StatusResults(null, "Part1", AmbientClock.UtcNow, 0, new StatusProperty[] { new StatusProperty("Att1", "Val1.0"), new StatusProperty("Att2", "Val2.0") }, StatusNatureOfSystem.Leaf, Array.Empty <StatusResults>()),
                    }),
                    new StatusResults(null, "/Target2", AmbientClock.UtcNow, 0, Array.Empty <StatusProperty>(), StatusNatureOfSystem.ChildrenHeterogenous, new StatusResults[] { new StatusResults(null, "Part1", AmbientClock.UtcNow, 0, new StatusProperty[] { new StatusProperty("Att1", "Val1.0"), new StatusProperty("Att2", "Val2.0") }, StatusNatureOfSystem.Leaf, Array.Empty <StatusResults>()) }),
                });
                StatusResults source2Root = new StatusResults(null, null, AmbientClock.UtcNow.AddSeconds(1), 0, Array.Empty <StatusProperty>(), StatusNatureOfSystem.ChildrenHeterogenous, new StatusResults[] {
                    new StatusResults(null, "/SampleDisk.OperatingSystem", AmbientClock.UtcNow.AddSeconds(1), 0, new StatusProperty[] { new StatusProperty("AvailablePercent", "2.3") }, StatusNatureOfSystem.ChildrenHeterogenous, new StatusResults[] { new StatusResults(null, "Part1", AmbientClock.UtcNow, 0, new StatusProperty[] { new StatusProperty("Att1", "Val1.1"), new StatusProperty("Att2", "Val2.1") }, StatusNatureOfSystem.Leaf, Array.Empty <StatusResults>()) }),
                    new StatusResults(null, "/Target2", AmbientClock.UtcNow, 0, Array.Empty <StatusProperty>(), StatusNatureOfSystem.ChildrenHeterogenous, new StatusResults[] { new StatusResults(null, "Part1", AmbientClock.UtcNow, 0, new StatusProperty[] { new StatusProperty("Att1", "Val1.1"), new StatusProperty("Att2", "Val2.1") }, StatusNatureOfSystem.Leaf, Array.Empty <StatusResults>()) }),
                });
                StatusResults overallRoot = new StatusResults(null, "/", AmbientClock.UtcNow, 0, Array.Empty <StatusProperty>(), StatusNatureOfSystem.ChildrenHomogenous, new StatusResults[] {
                    source1Root,
                    source2Root,
                });
                organizer.Add(organizer, overallRoot);
                organizer.ComputeOverallRatingAndSort();
                StatusPropertyRange worstRange = organizer.Children.First().WorstPropertyRange;
                o = organizer.Children.First().ToString();
            }
        }
コード例 #2
0
        public void StatusResultsOrganizerTime()
        {
            using (AmbientClock.Pause())
            {
                StatusResultsOrganizer organizer;
                string o;

                organizer = new StatusResultsOrganizer();
                StatusResults source1Root = new StatusResults(null, null, AmbientClock.UtcNow, 0, Array.Empty <StatusProperty>(), StatusNatureOfSystem.ChildrenHeterogenous, new StatusResults[] {
                    new StatusResults(null, "/Target1", AmbientClock.UtcNow.AddSeconds(2), 0, Array.Empty <StatusProperty>(), StatusNatureOfSystem.ChildrenHomogenous, new StatusResults[] { new StatusResults(null, "Part1", AmbientClock.UtcNow.AddSeconds(2), 0, new StatusProperty[] { new StatusProperty("Att1", "Val1.0"), new StatusProperty("Att2", "Val2.0") }, StatusNatureOfSystem.Leaf, Array.Empty <StatusResults>()) }),
                    new StatusResults(null, "/Target2", AmbientClock.UtcNow.AddSeconds(3), 0, Array.Empty <StatusProperty>(), StatusNatureOfSystem.ChildrenHomogenous, new StatusResults[] { new StatusResults(null, "Part2", AmbientClock.UtcNow.AddSeconds(3), 0, new StatusProperty[] { new StatusProperty("Att1", "Val1.0"), new StatusProperty("Att2", "Val2.0") }, StatusNatureOfSystem.Leaf, Array.Empty <StatusResults>()) }),
                    new StatusResults(null, "/Target3", AmbientClock.UtcNow.AddSeconds(1), 0, Array.Empty <StatusProperty>(), StatusNatureOfSystem.ChildrenHomogenous, new StatusResults[] { new StatusResults(null, "Part3", AmbientClock.UtcNow.AddSeconds(1), 0, new StatusProperty[] { new StatusProperty("Att1", "Val1.0"), new StatusProperty("Att2", "Val2.0") }, StatusNatureOfSystem.Leaf, Array.Empty <StatusResults>()) }),
                });
                AmbientClock.SkipAhead(TimeSpan.FromSeconds(10));
                StatusResults source2Root = new StatusResults(null, null, AmbientClock.UtcNow.AddSeconds(5), 0, Array.Empty <StatusProperty>(), StatusNatureOfSystem.ChildrenHeterogenous, new StatusResults[] {
                    new StatusResults(null, "/Target1", AmbientClock.UtcNow.AddSeconds(2), 0, Array.Empty <StatusProperty>(), StatusNatureOfSystem.ChildrenHomogenous, new StatusResults[] { new StatusResults(null, "Part1", AmbientClock.UtcNow.AddSeconds(2), 0, new StatusProperty[] { new StatusProperty("Att1", "Val1.0"), new StatusProperty("Att2", "Val2.0") }, StatusNatureOfSystem.Leaf, Array.Empty <StatusResults>()) }),
                    new StatusResults(null, "/Target2", AmbientClock.UtcNow.AddSeconds(3), 0, Array.Empty <StatusProperty>(), StatusNatureOfSystem.ChildrenHomogenous, new StatusResults[] { new StatusResults(null, "Part2", AmbientClock.UtcNow.AddSeconds(3), 0, new StatusProperty[] { new StatusProperty("Att1", "Val1.0"), new StatusProperty("Att2", "Val2.0") }, StatusNatureOfSystem.Leaf, Array.Empty <StatusResults>()) }),
                    new StatusResults(null, "/Target3", AmbientClock.UtcNow.AddSeconds(1), 0, Array.Empty <StatusProperty>(), StatusNatureOfSystem.ChildrenHomogenous, new StatusResults[] { new StatusResults(null, "Part3", AmbientClock.UtcNow.AddSeconds(1), 0, new StatusProperty[] { new StatusProperty("Att1", "Val1.0"), new StatusProperty("Att2", "Val2.0") }, StatusNatureOfSystem.Leaf, Array.Empty <StatusResults>()) }),
                });
                AmbientClock.SkipAhead(TimeSpan.FromSeconds(10));
                StatusResults source3Root = new StatusResults(null, null, AmbientClock.UtcNow, 0, Array.Empty <StatusProperty>(), StatusNatureOfSystem.ChildrenHeterogenous, new StatusResults[] {
                    new StatusResults(null, "/Target1", AmbientClock.UtcNow.AddSeconds(1), 0, Array.Empty <StatusProperty>(), StatusNatureOfSystem.ChildrenHomogenous, new StatusResults[] { new StatusResults(null, "Part1", AmbientClock.UtcNow.AddSeconds(1), 0, new StatusProperty[] { new StatusProperty("Att1", "Val1.0"), new StatusProperty("Att2", "Val2.0") }, StatusNatureOfSystem.Leaf, Array.Empty <StatusResults>()) }),
                    new StatusResults(null, "/Target2", AmbientClock.UtcNow.AddSeconds(3), 0, Array.Empty <StatusProperty>(), StatusNatureOfSystem.ChildrenHomogenous, new StatusResults[] { new StatusResults(null, "Part2", AmbientClock.UtcNow.AddSeconds(3), 0, new StatusProperty[] { new StatusProperty("Att1", "Val1.0"), new StatusProperty("Att2", "Val2.0") }, StatusNatureOfSystem.Leaf, Array.Empty <StatusResults>()) }),
                    new StatusResults(null, "/Target3", AmbientClock.UtcNow.AddSeconds(2), 0, Array.Empty <StatusProperty>(), StatusNatureOfSystem.ChildrenHomogenous, new StatusResults[] { new StatusResults(null, "Part3", AmbientClock.UtcNow.AddSeconds(2), 0, new StatusProperty[] { new StatusProperty("Att1", "Val1.0"), new StatusProperty("Att2", "Val2.0") }, StatusNatureOfSystem.Leaf, Array.Empty <StatusResults>()) }),
                });
                organizer.Add(organizer, source1Root);
                organizer.Add(organizer, source2Root);
                organizer.Add(organizer, source3Root);
                organizer.ComputeOverallRatingAndSort();
                StatusPropertyRange worstRange = organizer.Children.First().WorstPropertyRange;
                o = organizer.Children.First().ToString();
            }
        }
コード例 #3
0
        public void StatusPropertyRange()
        {
            using (AmbientClock.Pause())
            {
                // first test with a single property value
                StatusPropertyRange range = new StatusPropertyRange(new StatusProperty("property", "5"));

                Assert.IsTrue(range.ToString().Contains("5"));

                // now add another property value
                range.Merge("10");

                Assert.IsTrue(range.ToString().Contains("5"));
                Assert.IsTrue(range.ToString().Contains("10"));

                // now add another property value in the middle
                range.Merge("7");

                Assert.IsTrue(range.ToString().Contains("5"));
                Assert.IsTrue(range.ToString().Contains("10"));
                Assert.IsFalse(range.ToString().Contains("7"));

                // now add another property value
                range.Merge("2");

                Assert.IsTrue(range.ToString().Contains("2"));
                Assert.IsTrue(range.ToString().Contains("10"));
                Assert.IsFalse(range.ToString().Contains("7"));
                Assert.IsFalse(range.ToString().Contains("5"));
            }
        }
コード例 #4
0
        public void StatusResultsOrganizer()
        {
            using (AmbientClock.Pause())
            {
                StatusResultsOrganizer organizer;
                string o;

                organizer = new StatusResultsOrganizer();
                organizer.Add(organizer, new StatusResults(null, "/Target1", AmbientClock.UtcNow, 0, Array.Empty <StatusProperty>(), new StatusAuditReport(AmbientClock.UtcNow, TimeSpan.FromMilliseconds(10), DateTime.UtcNow.AddMinutes(1), new StatusAuditAlert(StatusRating.Fail, "Fail", "Terse", "Details"))), "Source1");
                organizer.Add(organizer, new StatusResults(null, "/Target1", AmbientClock.UtcNow, 0, Array.Empty <StatusProperty>(), new StatusAuditReport(AmbientClock.UtcNow, TimeSpan.FromMilliseconds(10), DateTime.UtcNow.AddMinutes(1), new StatusAuditAlert(StatusRating.Fail, "Fail", "Terse", "Details"))), "Source2");
                organizer.Add(organizer, new StatusResults(null, "/SampleDisk.SystemTemp", AmbientClock.UtcNow, 0, Array.Empty <StatusProperty>(), null), "Source1");
                organizer.Add(organizer, new StatusResults(null, "/SampleDisk.SystemTemp", AmbientClock.UtcNow, 0, new StatusProperty[] { new StatusProperty("AvailablePercent", "1.0") }, null), "Source1");
                organizer.Add(organizer, new StatusResults(null, "/SampleDisk.SystemTemp", AmbientClock.UtcNow, 0, new StatusProperty[] { new StatusProperty("AvailablePercent", "1.5") }, null), "Source1");
                organizer.Add(organizer, new StatusResults("Source2", "/SampleDisk.SystemTemp", AmbientClock.UtcNow, 0, new StatusProperty[] { new StatusProperty("AvailablePercent", "2.3") }, null), "Source1");
                organizer.Add(organizer, new StatusResults(null, "/SampleDisk.Temp", AmbientClock.UtcNow, 0, new StatusProperty[] { new StatusProperty("AvailablePercent", "4.0") }, null), "Source1");
                organizer.Add(organizer, new StatusResults(null, "/SampleDisk.OperatingSystem", AmbientClock.UtcNow, 0, new StatusProperty[] { new StatusProperty("AvailablePercent", "10.0") }, new StatusAuditReport(AmbientClock.UtcNow, TimeSpan.FromMilliseconds(10), DateTime.UtcNow.AddMinutes(1))), "Source2");
                organizer.Add(organizer, new StatusResults("Source1", "Target2", AmbientClock.UtcNow, 0, Array.Empty <StatusProperty>(), StatusNatureOfSystem.ChildrenHeterogenous, Array.Empty <StatusResults>()));
                organizer.Add(organizer, new StatusResults("Source2", "Target2", AmbientClock.UtcNow, 0, Array.Empty <StatusProperty>(), StatusNatureOfSystem.ChildrenHeterogenous, Array.Empty <StatusResults>()));
                organizer.Add(organizer, new StatusResults("Source3", "Pending", AmbientClock.UtcNow, 0, Array.Empty <StatusProperty>(), StatusNatureOfSystem.Leaf, new StatusResults[] { StatusResults.GetPendingResults("Leaf", "PendingTarget") }));
                organizer.Add(organizer.Children.First(), new StatusResults(null, null, AmbientClock.UtcNow, 0, Array.Empty <StatusProperty>(), StatusNatureOfSystem.ChildrenHeterogenous, Array.Empty <StatusResults>()));
                organizer.Add(organizer.Children.First(), new StatusResults(null, "/", AmbientClock.UtcNow, 0, Array.Empty <StatusProperty>(), StatusNatureOfSystem.ChildrenHeterogenous, Array.Empty <StatusResults>()));
                organizer.Add(organizer.Children.Skip(1).First(), new StatusResults(null, "/", AmbientClock.UtcNow, 0, Array.Empty <StatusProperty>(), StatusNatureOfSystem.ChildrenHeterogenous, Array.Empty <StatusResults>()));
                organizer.Add(organizer.Children.Skip(2).First(), new StatusResults(null, "/", AmbientClock.UtcNow, 0, Array.Empty <StatusProperty>(), StatusNatureOfSystem.ChildrenHeterogenous, Array.Empty <StatusResults>()));
                organizer.ComputeOverallRatingAndSort();
                o = organizer.ToString();
                Assert.IsTrue(o.Contains("Overall:"));
                o = organizer.Children.First().ToString();
                Assert.IsTrue(o.Contains("Source1->"));
                Assert.IsTrue(o.Contains("/Target1:"));

                organizer = new StatusResultsOrganizer();
                StatusResults source1Root = new StatusResults(null, null, AmbientClock.UtcNow, 0, Array.Empty <StatusProperty>(), StatusNatureOfSystem.ChildrenHeterogenous, new StatusResults[] {
                    new StatusResults(null, "/SampleDisk.OperatingSystem", AmbientClock.UtcNow, 0, new StatusProperty[] { new StatusProperty("AvailablePercent", "1.0") }, StatusNatureOfSystem.ChildrenHeterogenous, new StatusResults[] { new StatusResults(null, "Part1", AmbientClock.UtcNow, 0, new StatusProperty[] { new StatusProperty("Att1", "Val1.0"), new StatusProperty("Att2", "Val2.0") }, StatusNatureOfSystem.Leaf, Array.Empty <StatusResults>()) }),
                    new StatusResults(null, "/Target2", AmbientClock.UtcNow, 0, Array.Empty <StatusProperty>(), StatusNatureOfSystem.ChildrenHeterogenous, new StatusResults[] { new StatusResults(null, "Part1", AmbientClock.UtcNow, 0, new StatusProperty[] { new StatusProperty("Att1", "Val1.0"), new StatusProperty("Att2", "Val2.0") }, StatusNatureOfSystem.Leaf, Array.Empty <StatusResults>()) }),
                });
                StatusResults source2Root = new StatusResults(null, null, AmbientClock.UtcNow, 0, Array.Empty <StatusProperty>(), StatusNatureOfSystem.ChildrenHeterogenous, new StatusResults[] {
                    new StatusResults(null, "/SampleDisk.OperatingSystem", AmbientClock.UtcNow, 0, new StatusProperty[] { new StatusProperty("AvailablePercent", "2.3") }, StatusNatureOfSystem.ChildrenHeterogenous, new StatusResults[] { new StatusResults(null, "Part1", AmbientClock.UtcNow, 0, new StatusProperty[] { new StatusProperty("Att1", "Val1.1"), new StatusProperty("Att2", "Val2.1") }, StatusNatureOfSystem.Leaf, Array.Empty <StatusResults>()) }),
                    new StatusResults(null, "/Target2", AmbientClock.UtcNow, 0, Array.Empty <StatusProperty>(), StatusNatureOfSystem.ChildrenHeterogenous, new StatusResults[] { new StatusResults(null, "Part1", AmbientClock.UtcNow, 0, new StatusProperty[] { new StatusProperty("Att1", "Val1.1"), new StatusProperty("Att2", "Val2.1") }, StatusNatureOfSystem.Leaf, Array.Empty <StatusResults>()) }),
                });
                StatusResults overallRoot = new StatusResults(null, "/", AmbientClock.UtcNow, 0, Array.Empty <StatusProperty>(), StatusNatureOfSystem.ChildrenHomogenous, new StatusResults[] {
                    source1Root,
                    source2Root,
                });
                organizer.Add(organizer, overallRoot);
                organizer.ComputeOverallRatingAndSort();
                StatusPropertyRange worstRange = organizer.Children.First().WorstPropertyRange;
                o = organizer.Children.First().ToString();
            }
        }