Esempio n. 1
0
        public override void SetUp()
        {
            _messageLogger =
                new StorytellerMessageLogger(new LoggerFactory(), new NulloMetrics(), new JasperOptions());

            _messageLogger.Start(Context);

            _senderWatcher = new SenderLatchDetected(new LoggerFactory());

            new SqlServerEnvelopeStorageAdmin(new SqlServerSettings
            {
                ConnectionString = Servers.SqlServerConnectionString, SchemaName = "receiver"
            }).RecreateAll();
            new SqlServerEnvelopeStorageAdmin(new SqlServerSettings
            {
                ConnectionString = Servers.SqlServerConnectionString, SchemaName = "sender"
            }).RecreateAll();

            using (var conn = new SqlConnection(Servers.SqlServerConnectionString))
            {
                conn.Open();

                conn.CreateCommand(@"
IF OBJECT_ID('receiver.trace_doc', 'U') IS NOT NULL
  drop table receiver.trace_doc;

").ExecuteNonQuery();

                conn.CreateCommand(@"
create table receiver.trace_doc
(
	id uniqueidentifier not null
		primary key,
	name varchar(100) not null
);

").ExecuteNonQuery();
            }

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

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

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

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

                return(JasperHost.For(registry));
            });
        }
Esempio n. 2
0
        public override void SetUp()
        {
            _busLogger       = new StorytellerBusLogger();
            _transportLogger = new StorytellerTransportLogger();

            _busLogger.Start(Context);
            _transportLogger.Start(Context, _busLogger.Errors);

            _senderWatcher = new SenderLatchDetected();

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


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

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


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

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

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

            _receivers = new LightweightCache <string, JasperRuntime>(key =>
            {
                var registry = new ReceiverApp();
                registry.Logging.LogBusEventsWith(_busLogger);
                registry.Logging.LogTransportEventsWith(_transportLogger);

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

            _senders = new LightweightCache <string, JasperRuntime>(key =>
            {
                var registry = new SenderApp();
                registry.Logging.LogBusEventsWith(_busLogger);
                registry.Logging.LogTransportEventsWith(_transportLogger);

                registry.Logging.LogTransportEventsWith(_senderWatcher);

                return(JasperRuntime.For(registry));
            });
        }
Esempio n. 3
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(ConnectionSource.ConnectionString);
                _.DatabaseSchemaName = "receiver";
                _.Storage.Add <PostgresqlEnvelopeStorage>();


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

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


            _sendingStore = DocumentStore.For(_ =>
            {
                _.PLV8Enabled = false;
                _.Connection(ConnectionSource.ConnectionString);
                _.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);

                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);

                return(JasperRuntime.For(registry));
            });
        }
        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());
            });
        }