Example #1
0
        public void Enabling_performance_counters_should_result_in_performance_counters_being_created()
        {
            //This will delete an recreate the categories.
            PerformanceCategoryCreator.CreateCategories();

            var outboundIntances = new PerformanceCounterCategory(OutboundPerfomanceCounters.CATEGORY).GetInstanceNames();
            var inboundIntances  = new PerformanceCounterCategory(InboundPerfomanceCounters.CATEGORY).GetInstanceNames();

            Assert.Empty(outboundIntances);
            Assert.Empty(inboundIntances);

            var hostConfiguration = new HostConfiguration()
                                    .EnablePerformanceCounters()
                                    .Bus("rhino.queues://localhost/test_queue2", "test");

            container = new WindsorContainer();
            new RhinoServiceBusConfiguration()
            .UseConfiguration(hostConfiguration.ToBusConfiguration())
            .UseCastleWindsor(container)
            .Configure();
            bus = container.Resolve <IStartableServiceBus>();
            bus.Start();

            using (var tx = new TransactionScope())
            {
                bus.Send(bus.Endpoint, "test message.");
                tx.Complete();
            }

            outboundIntances = new PerformanceCounterCategory(OutboundPerfomanceCounters.CATEGORY).GetInstanceNames();
            inboundIntances  = new PerformanceCounterCategory(InboundPerfomanceCounters.CATEGORY).GetInstanceNames();

            Assert.NotEmpty(outboundIntances.Where(name => name.Contains("test_queue2")));
            Assert.NotEmpty(inboundIntances.Where(name => name.Contains("test_queue2")));
        }
Example #2
0
        public void Create_performance_counters_categories()
        {
            DeletePerformanceCounters();

            PerformanceCategoryCreator.CreateCategories();

            Assert.True(PerformanceCounterCategory.Exists(OutboundPerfomanceCounters.CATEGORY));
            Assert.True(PerformanceCounterCategory.Exists(InboundPerfomanceCounters.CATEGORY));
        }
Example #3
0
        public void Setup()
        {
            if (Directory.Exists(TEST_QUEUE_1))
            {
                Directory.Delete(TEST_QUEUE_1, true);
            }

            PerformanceCategoryCreator.CreateCategories();
        }
Example #4
0
        public void Recreate_existing_categories()
        {
            DeletePerformanceCounters();

            var preExistingCounters = new CounterCreationDataCollection(new[]
            {
                new CounterCreationData("DeleteMe", "",
                                        PerformanceCounterType.NumberOfItems32)
            });

            PerformanceCounterCategory.Create(OutboundPerfomanceCounters.CATEGORY, "",
                                              PerformanceCounterCategoryType.MultiInstance, preExistingCounters);

            PerformanceCounterCategory.Create(InboundPerfomanceCounters.CATEGORY, "",
                                              PerformanceCounterCategoryType.MultiInstance, preExistingCounters);

            PerformanceCategoryCreator.CreateCategories();

            Assert.False(PerformanceCounterCategory.CounterExists("DeleteMe", OutboundPerfomanceCounters.CATEGORY));
            Assert.False(PerformanceCounterCategory.CounterExists("DeleteMe", InboundPerfomanceCounters.CATEGORY));
        }