public override void SetUp()
        {
            _messageLogger =
                new StorytellerMessageLogger(new LoggerFactory(), new NulloMetrics(), new JasperOptions());

            _messageLogger.Start(Context);

            _senderWatcher = new SenderLatchDetected(new LoggerFactory());

            _receiverStore = DocumentStore.For(_ =>
            {
                _.PLV8Enabled = false;
                _.Connection(Servers.PostgresConnectionString);
                _.DatabaseSchemaName = "receiver";


                _.Schema.For <TraceDoc>();
            });

            _receiverStore.Advanced.Clean.CompletelyRemoveAll();
            _receiverStore.Schema.ApplyAllConfiguredChangesToDatabase();


            _sendingStore = DocumentStore.For(_ =>
            {
                _.PLV8Enabled = false;
                _.Connection(Servers.PostgresConnectionString);
                _.DatabaseSchemaName = "sender";
            });

            new PostgresqlEnvelopeStorageAdmin(new PostgresqlSettings
            {
                ConnectionString = Servers.PostgresConnectionString, SchemaName = "receiver"
            }).RecreateAll();
            new PostgresqlEnvelopeStorageAdmin(new PostgresqlSettings
            {
                ConnectionString = Servers.PostgresConnectionString, SchemaName = "sender"
            }).RecreateAll();

            _sendingStore.Advanced.Clean.CompletelyRemoveAll();
            _sendingStore.Schema.ApplyAllConfiguredChangesToDatabase();

            _receivers = new LightweightCache <string, IHost>(key =>
            {
                var registry = new ReceiverApp();
                registry.Services.AddSingleton <IMessageLogger>(_messageLogger);

                var logger = new StorytellerAspNetCoreLogger(key);

                // Tell Storyteller about the new logger so that it'll be
                // rendered as part of Storyteller's results
                Context.Reporting.Log(logger);

                // This is bootstrapping a Jasper application through the
                // normal ASP.Net Core IWebHostBuilder
                return(Host
                       .CreateDefaultBuilder()
                       .ConfigureLogging(x =>
                {
                    x.SetMinimumLevel(LogLevel.Debug);

                    // Add the logger to the new Jasper app
                    // being built up
                    x.AddProvider(logger);
                })
                       .UseJasper(registry)
                       .Start());
            });

            _senders = new LightweightCache <string, IHost>(key =>
            {
                var logger = new StorytellerAspNetCoreLogger(key);

                // Tell Storyteller about the new logger so that it'll be
                // rendered as part of Storyteller's results
                Context.Reporting.Log(logger);

                var registry = new SenderApp();
                registry.Services.AddSingleton <IMessageLogger>(_messageLogger);

                registry.Services.For <ITransportLogger>().Use(_senderWatcher);


                return(Host.CreateDefaultBuilder()
                       .ConfigureLogging(x =>
                {
                    x.SetMinimumLevel(LogLevel.Debug);

                    // Add the logger to the new Jasper app
                    // being built up
                    x.AddProvider(logger);
                })
                       .UseJasper(registry)
                       .Start());
            });
        }
예제 #2
0
        public override void SetUp()
        {
            _messageLogger =
                new StorytellerMessageLogger(new MessageHistory(), new LoggerFactory(), new NulloMetrics());

            _messageLogger.Start(Context);

            _senderWatcher = new SenderLatchDetected(new LoggerFactory());

            _receiverStore = DocumentStore.For(_ =>
            {
                _.PLV8Enabled = false;
                _.Connection(Servers.PostgresConnectionString);
                _.DatabaseSchemaName = "receiver";
                _.Storage.Add <PostgresqlEnvelopeStorage>();


                _.Schema.For <TraceDoc>();
            });

            _receiverStore.Advanced.Clean.CompletelyRemoveAll();
            _receiverStore.Schema.ApplyAllConfiguredChangesToDatabase();


            _sendingStore = DocumentStore.For(_ =>
            {
                _.PLV8Enabled = false;
                _.Connection(Servers.PostgresConnectionString);
                _.DatabaseSchemaName = "sender";

                _.Storage.Add <PostgresqlEnvelopeStorage>();
            });

            _sendingStore.Advanced.Clean.CompletelyRemoveAll();
            _sendingStore.Schema.ApplyAllConfiguredChangesToDatabase();

            _receivers = new LightweightCache <string, JasperRuntime>(key =>
            {
                var registry = new ReceiverApp();
                registry.Services.AddSingleton <IMessageLogger>(_messageLogger);

                registry.Hosting.ConfigureLogging(x =>
                {
                    x.AddConsole();
                    x.AddDebug();
                });

                return(JasperRuntime.For(registry));
            });

            _senders = new LightweightCache <string, JasperRuntime>(key =>
            {
                var registry = new SenderApp();
                registry.Services.AddSingleton <IMessageLogger>(_messageLogger);

                registry.Services.For <ITransportLogger>().Use(_senderWatcher);


                registry.Hosting.ConfigureLogging(x =>
                {
                    x.AddConsole();
                    x.AddDebug();
                });

                return(JasperRuntime.For(registry));
            });
        }