Esempio n. 1
0
        public void TestRawApplicationPerformance(int numberOfEvents, int numberOfHydrations)
        {
            const string aggregateRootId = "bim";

            using (var context = TestContext.With().Options(x => x.Asynchronous()).Create())
            {
                Console.WriteLine("Saving {0} to history of '{1}'", numberOfEvents, aggregateRootId);

                using (var printer = new Timer(2000))
                {
                    var inserts = 0;
                    printer.Elapsed += delegate { Console.WriteLine("{0} events saved...", inserts); };
                    printer.Start();

                    foreach (var e in Enumerable.Range(0, numberOfEvents).Select(i => new SomeEvent(string.Format("Event {0}", i))))
                    {
                        context.Save(aggregateRootId, e);
                        inserts++;
                    }
                }

                Console.WriteLine("Hydrating {0} times", numberOfHydrations);
                var stopwatch = Stopwatch.StartNew();
                numberOfHydrations.Times(() =>
                {
                    using (var uow = context.BeginUnitOfWork())
                    {
                        var instance = uow.Load <SomeAggregate>(aggregateRootId);
                    }
                });

                var elapsed = stopwatch.Elapsed;
                Console.WriteLine("Elapsed total: {0}, hydrations/s: {1:0.0}", elapsed, numberOfHydrations / elapsed.TotalSeconds);
            }
        }
Esempio n. 2
0
        protected override void DoSetUp()
        {
            CirqusLoggerFactory.Current = new ConsoleLoggerFactory(minLevel: Logger.Level.Warn);

            _factory     = RegisterForDisposal(new TFactory());
            _viewManager = _factory.GetViewManager <View>();

            //brett v2
            _context = RegisterForDisposal(base.CreateTestContext(config => config
                                                                  .EventDispatcher(x => { x
                                                                                          .UseViewManagerEventDispatcher(_viewManager)
                                                                                          .WithConfiguration(new ViewManagerEventDispatcherConfiguration(10)); })
                                                                  .Options(x => x.Asynchronous())));

            //brett v1
            //_context = base.CreateTestContext(config => config
            //    .EventDispatcher(x => x.UseViewManagerEventDispatcher(_viewManager)) //WithMaxDomainEventsPerBatch(10))
            //    .Options(x => x.Asynchronous()));

            //orig
            //_context = RegisterForDisposal(
            //    TestContext.With()
            //        .EventDispatcher(x => x.UseViewManagerEventDispatcher(_viewManager).WithMaxDomainEventsPerBatch(10))
            //        .Options(x => x.Asynchronous())
            //        .Create());
        }
Esempio n. 3
0
        protected override void DoSetUp()
        {
            base.DoSetUp();

            CirqusLoggerFactory.Current = new ConsoleLoggerFactory(minLevel: Logger.Level.Warn);

            _factory = RegisterForDisposal(new TFactory());



            //_context = RegisterForDisposal(
            //    TestContext.With()
            //        .Options(x => x.Asynchronous())
            //        .Create());

            _viewManager1 = _factory.GetViewManager <ViewThatSubscribesToEvents>();
            _viewManager2 = _factory.GetViewManager <ViewThatSubscribesToAggregateRootEvent>();
            _viewManager3 = _factory.GetViewManager <ViewThatSubscribesToAllEvents>();

            //Brett
            _context = RegisterForDisposal(base.CreateTestContext(config =>
                                                                  config.Options(x => x.Asynchronous()))
                                           .AddViewManager(_viewManager1)
                                           .AddViewManager(_viewManager2)
                                           .AddViewManager(_viewManager3));


            //_context = base.CreateTestContext();
            //_context
            //    .AddViewManager(_viewManager1)
            //    .AddViewManager(_viewManager2)
            //    .AddViewManager(_viewManager3);
        }
Esempio n. 4
0
        protected override void DoSetUp()
        {
            CirqusLoggerFactory.Current = new ConsoleLoggerFactory(minLevel: Logger.Level.Debug);

            _factory = RegisterForDisposal(new TFactory());

            _context = RegisterForDisposal(
                TestContext.With()
                .Options(x => x.Asynchronous())
                .Create());
        }
Esempio n. 5
0
        protected override void DoSetUp()
        {
            _factory = RegisterForDisposal(new TFactory());

            _globalInstanceViewManager           = _factory.GetViewManager <GlobalInstanceViewInstance>();
            _instancePerAggregateRootViewManager = _factory.GetViewManager <InstancePerAggregateRootView>();

            _context = RegisterForDisposal(
                TestContext.With()
                .Options(x => x.Asynchronous())
                .Create());
        }
Esempio n. 6
0
        protected override void DoSetUp()
        {
            CirqusLoggerFactory.Current = new ConsoleLoggerFactory(minLevel: Logger.Level.Warn);

            _factory     = RegisterForDisposal(new TFactory());
            _viewManager = _factory.GetViewManager <View>();

            _context = RegisterForDisposal(
                TestContext.With()
                .EventDispatcher(x => x.UseViewManagerEventDispatcher(_viewManager).WithMaxDomainEventsPerBatch(10))
                .Options(x => x.Asynchronous())
                .Create());
        }
Esempio n. 7
0
        protected override void DoSetUp()
        {
            CirqusLoggerFactory.Current = new ConsoleLoggerFactory(minLevel: Logger.Level.Debug);

            _factory = RegisterForDisposal(new TFactory());

            //brett
            _context = RegisterForDisposal(base.CreateTestContext(config => config.Options(x => x.Asynchronous())));
            //_context = RegisterForDisposal(
            //    TestContext.With()
            //        .Options(x => x.Asynchronous())
            //        .Create());
        }
Esempio n. 8
0
        protected override void DoSetUp()
        {
            CirqusLoggerFactory.Current = new ConsoleLoggerFactory(minLevel: Logger.Level.Warn);

            _factory = RegisterForDisposal(new TFactory());

            _context = RegisterForDisposal(
                TestContext.With()
                .Options(x => x.Asynchronous())
                .Create());

            _viewManager = _factory.GetViewManager <PurgeTestView>();
            _context.AddViewManager(_viewManager);
        }
Esempio n. 9
0
        protected override void DoSetUp()
        {
            _factory = RegisterForDisposal(new TFactory());

            _globalInstanceViewManager           = _factory.GetViewManager <GlobalInstanceViewInstance>();
            _instancePerAggregateRootViewManager = _factory.GetViewManager <InstancePerAggregateRootView>();

            //brett
            _context = RegisterForDisposal(base.CreateTestContext(config => config.Options(x => x.Asynchronous())));
            //_context = RegisterForDisposal(
            //    TestContext.With()
            //        .Options(x => x.Asynchronous())
            //        .Create());
        }
Esempio n. 10
0
        protected override void DoSetUp()
        {
            CirqusLoggerFactory.Current = new ConsoleLoggerFactory(minLevel: Logger.Level.Warn);

            _factory = RegisterForDisposal(new TFactory());

            _context = RegisterForDisposal(
                TestContext.With()
                .Options(x => x.Asynchronous())
                .Create());

            _viewManager1 = _factory.GetViewManager <ViewThatSubscribesToEvents>();
            _viewManager2 = _factory.GetViewManager <ViewThatSubscribesToAggregateRootEvent>();
            _viewManager3 = _factory.GetViewManager <ViewThatSubscribesToAllEvents>();

            _context
            .AddViewManager(_viewManager1)
            .AddViewManager(_viewManager2)
            .AddViewManager(_viewManager3);
        }
 protected override void DoSetUp()
 {
     _context = RegisterForDisposal(CreateTestContext());
 }