public StreamStoreConnectionFixture()
        {
            AdminCredentials = new UserCredentials("admin", "changeit");
#if LIVE_ES_CONNECTION
            //Connection = new EventStoreConnectionWrapper(
            //                  EventStoreConnection.Create("ConnectTo=tcp://admin:changeit@localhost:1113; HeartBeatTimeout=500"));
            string esUser      = "******";
            string esPwd       = "changeit";
            var    creds       = new ES.SystemData.UserCredentials(esUser, esPwd);
            string esIpAddress = "127.0.0.1";
            int    esPort      = 1113;
            var    tcpEndpoint = new IPEndPoint(IPAddress.Parse(esIpAddress), esPort);

            var settings = ES.ConnectionSettings.Create()
                           .SetDefaultUserCredentials(creds)
                           .KeepReconnecting()
                           .KeepRetrying()
                           .UseConsoleLogger()
                           .DisableTls()
                           .DisableServerCertificateValidation()
                           .WithConnectionTimeoutOf(TimeSpan.FromSeconds(15))
                           .Build();
            Connection = new EventStoreConnectionWrapper(ES.EventStoreConnection.Create(settings, tcpEndpoint, Guid.NewGuid().ToString()));
            Connection.Connect();
#else
            Connection = new ReactiveDomain.Testing.EventStore.MockStreamStoreConnection("Test Fixture");
            Connection.Connect();
#endif
        }
Example #2
0
        public StreamStoreConnectionFixture()
        {
            AdminCredentials = new UserCredentials("admin", "changeit");
#if LIVE_ES_CONNECTION
            Connection = new EventStoreConnectionWrapper(
                EventStoreConnection.Create("ConnectTo=tcp://admin:changeit@localhost:1113; HeartBeatTimeout=500"));

            return;
#endif

#if NETCOREAPP2_0 || NETSTANDARD2_0 || NET452
            Connection = new ReactiveDomain.Testing.EventStore.MockStreamStoreConnection("Test Fixture");
            Connection.Connect();
#else
            var node = EmbeddedVNodeBuilder
                       .AsSingleNode()
                       .OnDefaultEndpoints()
                       .RunInMemory()
                       .DisableDnsDiscovery()
                       .DisableHTTPCaching()
                       //.DisableScavengeMerging()
                       .DoNotVerifyDbHashes()
                       .RunProjections(ProjectionType.System)
                       .StartStandardProjections()
                       .Build();

            node.StartAndWaitUntilReady().Wait();
            Connection = new EventStoreConnectionWrapper(EmbeddedEventStoreConnection.Create(node));

            _node = new Disposer(() => {
                if (!node.Stop(TimeToStop, true, true))
                {
                    Trace.WriteLine(
                        $"Failed to gracefully shut down the embedded Eventstore within {TimeToStop.TotalMilliseconds}ms.");
                }
                return(Unit.Default);
            });
#endif
        }