示例#1
0
        public void Verify_empty_result_returned_when_snapshot_null()
        {
            BrokerConnectivitySnapshot snapshot = null;

            var result = new BrokerConnectivityScanner(_probes)
                         .Scan(snapshot);

            Assert.IsEmpty(result);
        }
        public void Verify_analyzers_fired()
        {
            BrokerConnectivitySnapshot snapshot = new FakeBrokerConnectivitySnapshot1();

            var result = new BrokerConnectivityScanner(_probes)
                         .Scan(snapshot);

            result.Count.ShouldBe(6);
            result.Count(x => x.Id == typeof(HighConnectionCreationRateProbe).GetIdentifier()).ShouldBe(1);
            result.Count(x => x.Id == typeof(HighConnectionClosureRateProbe).GetIdentifier()).ShouldBe(1);
            result.Count(x => x.Id == typeof(UnlimitedPrefetchCountProbe).GetIdentifier()).ShouldBe(1);
            result.Count(x => x.Id == typeof(ChannelThrottlingProbe).GetIdentifier()).ShouldBe(1);
            result.Count(x => x.Id == typeof(ChannelLimitReachedProbe).GetIdentifier()).ShouldBe(1);
            result.Count(x => x.Id == typeof(BlockedConnectionProbe).GetIdentifier()).ShouldBe(1);
        }
示例#3
0
        public void Verify_analyzers_fired()
        {
            BrokerConnectivitySnapshot snapshot = new ()
            {
                ConnectionsCreated = new () { Total = 100000, Rate = 102 },
                ConnectionsClosed  = new () { Total = 174000, Rate = 100 },
                Connections        = new List <ConnectionSnapshot>
                {
                    new ()
                    {
                        Identifier        = "Connection1",
                        OpenChannelsLimit = 2,
                        Channels          = new List <ChannelSnapshot>
                        {
                            new ()
                            {
                                PrefetchCount = 4,
                                UncommittedAcknowledgements = 2,
                                UncommittedMessages         = 5,
                                UnconfirmedMessages         = 8,
                                UnacknowledgedMessages      = 5,
                                Consumers  = 1,
                                Identifier = "Channel1"
                            }
                        },
                        State = BrokerConnectionState.Blocked
                    }
                }
            };

            var result = new BrokerConnectivityScanner(_probes)
                         .Scan(snapshot);

            Assert.Multiple(() =>
            {
                Assert.AreEqual(6, result.Count);
                Assert.AreEqual(1, result.Count(x => x.Id == typeof(HighConnectionCreationRateProbe).GetIdentifier()));
                Assert.AreEqual(1, result.Count(x => x.Id == typeof(HighConnectionClosureRateProbe).GetIdentifier()));
                Assert.AreEqual(1, result.Count(x => x.Id == typeof(UnlimitedPrefetchCountProbe).GetIdentifier()));
                Assert.AreEqual(1, result.Count(x => x.Id == typeof(ChannelThrottlingProbe).GetIdentifier()));
                Assert.AreEqual(1, result.Count(x => x.Id == typeof(ChannelLimitReachedProbe).GetIdentifier()));
                Assert.AreEqual(1, result.Count(x => x.Id == typeof(BlockedConnectionProbe).GetIdentifier()));
            });
        }