public override void TestFixtureSetUp()
        {
#if !__MonoCS__
            EventStore.Common.Utils.Helper.EatException(() => _dumpResponse  = CreateDumpResponse());
            EventStore.Common.Utils.Helper.EatException(() => _dumpResponse2 = CreateDumpResponse2());
            EventStore.Common.Utils.Helper.EatException(() => _dumpRequest   = CreateDumpRequest());
            EventStore.Common.Utils.Helper.EatException(() => _dumpRequest2  = CreateDumpRequest2());
#endif

            base.TestFixtureSetUp();

            if (SetUpFixture._connection != null && SetUpFixture._node != null)
            {
                _tag        = "_" + (++SetUpFixture._counter).ToString();
                _node       = SetUpFixture._node;
                _connection = SetUpFixture._connection;
            }
            else
            {
                _tag  = "_1";
                _node = CreateMiniNode();
                _node.Start();

                _connection = TestConnection.Create(_node.TcpEndPoint);
                _connection.Connect();
            }
            _lastResponse      = null;
            _lastResponseBody  = null;
            _lastJsonException = null;

            Given();
            When();
        }
Example #2
0
        public PostImporter()
        {
            _checkpoint = new FileCheckpoint("postsLoaded");

            _logger = new EventStore.ClientAPI.Common.Log.ConsoleLogger();

            var _connectionSettings =
                ConnectionSettings.Create()
                                  .UseConsoleLogger()
                                  .KeepReconnecting()
                                  .KeepRetrying()
                                  .OnConnected(_ => _logger.Info("Event Store Connected"))
                                  .OnDisconnected(_ => _logger.Error("Event Store Disconnected"))
                                  .OnReconnecting(_ => _logger.Info("Event Store Reconnecting"))
                                  .OnErrorOccurred((c, e) => _logger.Error(e, "Event Store Error :("));

            _connection = EventStoreConnection.Create(_connectionSettings, new IPEndPoint(IPAddress.Parse("192.81.222.61"), 1113));
            _connection.Connect();

            ThreadPool.SetMaxThreads(20, 20);
            ThreadPool.SetMinThreads(20, 20);
            //ServicePointManager.DefaultConnectionLimit = 1000;
            ServicePointManager.Expect100Continue = false;
            ServicePointManager.ServerCertificateValidationCallback = Validator;
            //ServicePointManager.EnableDnsRoundRobin = false;
            //ServicePointManager.DnsRefreshTimeout = Int32.MaxValue;
        }
Example #3
0
        public void Start()
        {
            if (EmbeddedEventStoreConfiguration.RunWithLogging)
            {
                if (!Directory.Exists(EmbeddedEventStoreConfiguration.LogPath))
                {
                    Directory.CreateDirectory(EmbeddedEventStoreConfiguration.LogPath);
                }
                LogManager.Init(string.Format("as-embed-es-{0}", DateTime.Now.Ticks), EmbeddedEventStoreConfiguration.LogPath);
            }

            var db       = CreateTFChunkDb(EmbeddedEventStoreConfiguration.StoragePath);
            var settings = CreateSingleVNodeSettings();

            _node = new SingleVNode(db, settings, false, 0xf4240, new ISubsystem[0]);
            var waitHandle = new ManualResetEvent(false);

            _node.MainBus.Subscribe(new AdHocHandler <SystemMessage.BecomeMaster>(m => waitHandle.Set()));
            _node.Start();
            waitHandle.WaitOne();
            _credentials = new UserCredentials("admin", "changeit");
            _connection  = EventStoreConnection.Create(
                ConnectionSettings.Create().
                EnableVerboseLogging().
                SetDefaultUserCredentials(_credentials).
                UseConsoleLogger(),
                TcpEndPoint);
            _connection.Connect();
        }
Example #4
0
        void EnsureConnected()
        {
            if (_isConnected)
            {
                return;
            }

            try
            {
                _eventStoreConnection.Connect();
            }
            catch (AggregateException ae)
            {
                //OfType<EventStore.ClientAPI.Exceptions.EventStoreConnectionException>()
                var ex = ae.InnerExceptions.SingleOrDefault();
                if (ex != null && ex.Message.Contains("is already active"))
                {
                }
                else
                {
                    throw;
                }
            }
            _isConnected = true;
        }
        public void Start()
        {
            if (EmbeddedEventStoreConfiguration.RunWithLogging)
            {
                if (!Directory.Exists(EmbeddedEventStoreConfiguration.LogPath))
                    Directory.CreateDirectory(EmbeddedEventStoreConfiguration.LogPath);
                LogManager.Init(string.Format("as-embed-es-{0}", DateTime.Now.Ticks), EmbeddedEventStoreConfiguration.LogPath);
            }

            var db = CreateTFChunkDb(EmbeddedEventStoreConfiguration.StoragePath);
            var settings = CreateSingleVNodeSettings();
            _node = new SingleVNode(db, settings, false, 0xf4240, new ISubsystem[0]);
            var waitHandle = new ManualResetEvent(false);
            _node.MainBus.Subscribe(new AdHocHandler<SystemMessage.BecomeMaster>(m => waitHandle.Set()));
            _node.Start();
            waitHandle.WaitOne();
            _credentials = new UserCredentials("admin", "changeit");
            _connection = EventStoreConnection.Create(
                ConnectionSettings.Create().
                                   EnableVerboseLogging().
                                   SetDefaultUserCredentials(_credentials).
                                   UseConsoleLogger(),
                TcpEndPoint);
            _connection.Connect();
        }
Example #6
0
        public MainForm()
        {
            InitializeComponent();
            var settings = ConnectionSettings.Create();

            settings.SetDefaultUserCredentials(userCredentials);

            connection = EventStoreConnection.Create(settings, new IPEndPoint(new IPAddress(new byte[] { 127, 0, 0, 1 }), 1113));

            connection.Connect();

            Thread.Sleep(3000);


            pm = new ProjectionsManager(
                new ConsoleLogger(),
                new IPEndPoint(new IPAddress(new byte[] { 127, 0, 0, 1 }), 2113));



            pm.Enable("$by_category", userCredentials);
            pm.Enable("$by_event_type", userCredentials);
            pm.Enable("$stream_by_category", userCredentials);
            pm.Enable("$streams", userCredentials);

            ac = new AlarmClock(connection);
            ac.Start();
        }
Example #7
0
        public EventStore(IPEndPoint endpoint, UserCredentials credentials, IAdaptEvents adapter)
        {
            _endpoint    = endpoint;
            _credentials = credentials;
            _adapter     = adapter;

            _con = EventStoreConnection.Create(endpoint);
            _con.Connect();
        }
 public override void TestFixtureSetUp()
 {
     base.TestFixtureSetUp();
     _node = new MiniNode(PathName, skipInitializeStandardUsersCheck: false);
     _node.Start();
     _conn = TestConnection.Create(_node.TcpEndPoint);
     _conn.Connect();
     When();
 }
Example #9
0
        public EventStore(IPEndPoint endpoint, UserCredentials credentials, IAdaptEvents adapter)
        {
            _endpoint = endpoint;
            _credentials = credentials;
            _adapter = adapter;

            _con = EventStoreConnection.Create(endpoint);
            _con.Connect();
        }
        public override void TestFixtureSetUp()
        {
            base.TestFixtureSetUp();
            _node = new MiniNode(PathName);
            _node.Start();

            _connection = TestConnection.Create(_node.TcpEndPoint);
            _connection.Connect();
        }
        public override void TestFixtureSetUp()
        {
            base.TestFixtureSetUp();
            _node = new MiniNode(PathName);
            _node.Start();

            _connection = TestConnection.Create(_node.TcpEndPoint);
            _connection.Connect();
        }
        public override void TestFixtureSetUp()
        {
            base.TestFixtureSetUp();
            _node = new MiniNode(PathName);
            _node.Start();

            _connection = TestConnection.Create(_node.TcpEndPoint);
            _connection.Connect();

            _testEvents = Enumerable.Range(0, 5).Select(x => TestEvent.NewTestEvent(data: x.ToString())).ToArray();
        }
        public override void TestFixtureSetUp()
        {
            base.TestFixtureSetUp();
            _node = new MiniNode(PathName);
            _node.Start();

            _connection = TestConnection.Create(_node.TcpEndPoint);
            _connection.Connect();

            _testEvents = Enumerable.Range(0, 5).Select(x => TestEvent.NewTestEvent(data: x.ToString())).ToArray();
        }
Example #14
0
        public void SetUp()
        {
            WebRequest.DefaultWebProxy = new WebProxy();
            _counter   = 0;
            _directory = new SpecificationWithDirectoryPerTestFixture();
            _directory.TestFixtureSetUp();
            _node = new MiniNode(_directory.PathName, skipInitializeStandardUsersCheck: false, enableTrustedAuth: true);
            _node.Start();

            _connection = TestConnection.Create(_node.TcpEndPoint);
            _connection.Connect();
        }
        public void SetUp()
        {
            WebRequest.DefaultWebProxy = new WebProxy();
            _counter = 0;
            _directory = new SpecificationWithDirectoryPerTestFixture();
            _directory.TestFixtureSetUp();
            _node = new MiniNode(_directory.PathName, skipInitializeStandardUsersCheck: false, enableTrustedAuth: true);
            _node.Start();

            _connection = TestConnection.Create(_node.TcpEndPoint);
            _connection.Connect();
        }
        public override void SetUp()
        {
            base.SetUp();
            _node = new MiniNode(PathName, skipInitializeStandardUsersCheck: false);
            _node.Start();

            _conn = TestConnection.Create(_node.TcpEndPoint);
            _conn.Connect();
            _conn.SetStreamMetadata("$all", -1,
                                    StreamMetadata.Build().SetReadRole(SystemRoles.All),
                                    new UserCredentials(SystemUsers.Admin, SystemUsers.DefaultAdminPassword));
        }
 public EventStoreUnitOfWorkHandler()
 {
     var credentials = new UserCredentials("admin", "changeit");
     _connection = EventStoreConnection.Create(
         ConnectionSettings.Create().
             UseConsoleLogger().
             SetDefaultUserCredentials(
                 credentials),
         new IPEndPoint(IPAddress.Loopback, 1113),
         "UserServiceConnection");
     _connection.Connect();
 }
        public override void SetUp()
        {
            base.SetUp();
            _node = new MiniNode(PathName, skipInitializeStandardUsersCheck: false);
            _node.Start();

            _conn = TestConnection.Create(_node.TcpEndPoint);
            _conn.Connect();
            _conn.SetStreamMetadata("$all", -1,
                                    StreamMetadata.Build().SetReadRole(SystemRoles.All),
                                    new UserCredentials(SystemUsers.Admin, SystemUsers.DefaultAdminPassword));
        }
 public static IEventStoreConnection Connect()
 {
     ConnectionSettings settings =
         ConnectionSettings.Create()
             .UseConsoleLogger()
             .KeepReconnecting()
             .SetDefaultUserCredentials(new UserCredentials("admin", "changeit"));
     var endPoint = new IPEndPoint(IPAddress.Loopback, 1113);
     _connection = EventStoreConnection.Create(settings, endPoint, null);
     _connection.Connect();
     return _connection;
 }
        public EventStoreUnitOfWorkHandler()
        {
            var credentials = new UserCredentials("admin", "changeit");

            _connection = EventStoreConnection.Create(
                ConnectionSettings.Create().
                UseConsoleLogger().
                SetDefaultUserCredentials(
                    credentials),
                new IPEndPoint(IPAddress.Loopback, 1113),
                "UserServiceConnection");
            _connection.Connect();
        }
Example #21
0
        private void Connect()
        {
            var settings = ConnectionSettings.Create();
            var ip       = new IPEndPoint(_ipAddress, _port);

            Log("Connecting to {0}:{1}...", _ipAddress, _port);
            _connection = EventStoreConnection.Create(settings, ip);
            _connection.Connect();
            _connection.AppendToStream("hello", ExpectedVersion.Any, new EventData(Guid.NewGuid(), "Hello", false, new byte[0], new byte[0]));
            Log("Connected.");
            Log("Username to be used is: {0}", _userName);
            _credentials = new UserCredentials(_userName, _password);
        }
        public static IEventStoreConnection Connect()
        {
            ConnectionSettings settings =
                ConnectionSettings.Create()
                .UseConsoleLogger()
                .KeepReconnecting()
                .SetDefaultUserCredentials(new UserCredentials("admin", "changeit"));
            var endPoint = new IPEndPoint(IPAddress.Loopback, 1113);

            _connection = EventStoreConnection.Create(settings, endPoint, null);
            _connection.Connect();
            return(_connection);
        }
        public override void TestFixtureSetUp()
        {
            base.TestFixtureSetUp();
#if DEBUG
            QueueStatsCollector.InitializeIdleDetection();
#else
            throw new NotSupportedException("These tests require DEBUG conditional");
#endif

            _nodeEndpoints[0] = new Endpoints(
                PortsHelper.GetAvailablePort(IPAddress.Loopback), PortsHelper.GetAvailablePort(IPAddress.Loopback),
                PortsHelper.GetAvailablePort(IPAddress.Loopback), PortsHelper.GetAvailablePort(IPAddress.Loopback),
                PortsHelper.GetAvailablePort(IPAddress.Loopback), PortsHelper.GetAvailablePort(IPAddress.Loopback));
            _nodeEndpoints[1] = new Endpoints(
                PortsHelper.GetAvailablePort(IPAddress.Loopback), PortsHelper.GetAvailablePort(IPAddress.Loopback),
                PortsHelper.GetAvailablePort(IPAddress.Loopback), PortsHelper.GetAvailablePort(IPAddress.Loopback),
                PortsHelper.GetAvailablePort(IPAddress.Loopback), PortsHelper.GetAvailablePort(IPAddress.Loopback));
            _nodeEndpoints[2] = new Endpoints(
                PortsHelper.GetAvailablePort(IPAddress.Loopback), PortsHelper.GetAvailablePort(IPAddress.Loopback),
                PortsHelper.GetAvailablePort(IPAddress.Loopback), PortsHelper.GetAvailablePort(IPAddress.Loopback),
                PortsHelper.GetAvailablePort(IPAddress.Loopback), PortsHelper.GetAvailablePort(IPAddress.Loopback));

            PortsHelper.GetAvailablePort(IPAddress.Loopback);

            _nodes[0] = CreateNode(0,
                                   _nodeEndpoints[0], new IPEndPoint[] { _nodeEndpoints[1].InternalHttp, _nodeEndpoints[2].InternalHttp });
            _nodes[1] = CreateNode(1,
                                   _nodeEndpoints[1], new IPEndPoint[] { _nodeEndpoints[0].InternalHttp, _nodeEndpoints[2].InternalHttp });

            _nodes[2] = CreateNode(2,
                                   _nodeEndpoints[2], new IPEndPoint[] { _nodeEndpoints[0].InternalHttp, _nodeEndpoints[1].InternalHttp });


            _nodes[0].Start();
            _nodes[1].Start();
            _nodes[2].Start();

            WaitHandle.WaitAll(new[] { _nodes[0].StartedEvent, _nodes[1].StartedEvent, _nodes[2].StartedEvent });
            QueueStatsCollector.WaitIdle();
            _conn = EventStoreConnection.Create(_nodes[0].ExternalTcpEndPoint);
            _conn.Connect();

            _manager = new ProjectionsManager(new ConsoleLogger(), _nodes[0].ExternalHttpEndPoint);
            if (GivenStandardProjectionsRunning())
            {
                EnableStandardProjections();
            }
            QueueStatsCollector.WaitIdle();
            Given();
            When();
        }
        public override void SetUp()
        {
            base.SetUp();
            _node = new MiniNode(PathName);
            _node.Start();

            _connection = TestConnection.Create(_node.TcpEndPoint);
            _connection.Connect();

            _connection.SetStreamMetadata(Stream, ExpectedVersion.EmptyStream, StreamMetadata.Build().SetMaxCount(3));

            _testEvents = Enumerable.Range(0, 5).Select(x => TestEvent.NewTestEvent(data: x.ToString())).ToArray();
            _connection.AppendToStream(Stream, ExpectedVersion.EmptyStream, _testEvents);
        }
Example #25
0
        public override void SetUp()
        {
            base.SetUp();
            _node = new MiniNode(PathName);
            _node.Start();

            _connection = TestConnection.Create(_node.TcpEndPoint);
            _connection.Connect();

            _connection.SetStreamMetadata(Stream, ExpectedVersion.EmptyStream, StreamMetadata.Build().SetMaxCount(3));

            _testEvents = Enumerable.Range(0, 5).Select(x => TestEvent.NewTestEvent(data: x.ToString())).ToArray();
            _connection.AppendToStream(Stream, ExpectedVersion.EmptyStream, _testEvents);
        }
Example #26
0
        public override void TestFixtureSetUp()
        {
            base.TestFixtureSetUp();
            _node = new MiniNode(PathName, skipInitializeStandardUsersCheck: false);
            _node.Start();
            _conn = TestConnection.Create(_node.TcpEndPoint);
            _conn.Connect();
            _conn.SetStreamMetadata("$all", -1,
                                    StreamMetadata.Build().SetReadRole(SystemRoles.All),
                                    new UserCredentials(SystemUsers.Admin, SystemUsers.DefaultAdminPassword));

            _testEvents = Enumerable.Range(0, 20).Select(x => TestEvent.NewTestEvent(x.ToString())).ToArray();
            _conn.AppendToStream("stream", ExpectedVersion.EmptyStream, _testEvents);
        }
        public override void TestFixtureSetUp()
        {
            base.TestFixtureSetUp();
            _node = new MiniNode(PathName, skipInitializeStandardUsersCheck: false);
            _node.Start();
            _conn = TestConnection.Create(_node.TcpEndPoint);
            _conn.Connect();
            _conn.SetStreamMetadata("$all", -1,
                                    StreamMetadata.Build().SetReadRole(SystemRoles.All),
                                    new UserCredentials(SystemUsers.Admin, SystemUsers.DefaultAdminPassword));

            _testEvents = Enumerable.Range(0, 20).Select(x => TestEvent.NewTestEvent(x.ToString())).ToArray();
            _conn.AppendToStream("stream", ExpectedVersion.EmptyStream, _testEvents);
        }
Example #28
0
        public override void TestFixtureSetUp()
        {
            base.TestFixtureSetUp();
            _node = new MiniNode(PathName);
            _node.Start();

            _conn = TestConnection.Create(_node.TcpEndPoint);
            _conn.Connect();

            _eventId0 = Guid.NewGuid();
            _eventId1 = Guid.NewGuid();

            _conn.AppendToStream("test-stream",
                                 -1, 
                                 new EventData(_eventId0, "event0", false, new byte[3], new byte[2]),
                                 new EventData(_eventId1, "event1", false, new byte[7], new byte[10]));
            _conn.DeleteStream("deleted-stream", -1, hardDelete: true);
        }
Example #29
0
        public override void TestFixtureSetUp()
        {
            base.TestFixtureSetUp();
            _node = new MiniNode(PathName);
            _node.Start();

            _conn = TestConnection.Create(_node.TcpEndPoint);
            _conn.Connect();

            _eventId0 = Guid.NewGuid();
            _eventId1 = Guid.NewGuid();

            _conn.AppendToStream("test-stream",
                                 -1,
                                 new EventData(_eventId0, "event0", false, new byte[3], new byte[2]),
                                 new EventData(_eventId1, "event1", false, new byte[7], new byte[10]));
            _conn.DeleteStream("deleted-stream", -1);
        }
        public override void TestFixtureSetUp()
        {
            base.TestFixtureSetUp();
#if DEBUG
            QueueStatsCollector.InitializeIdleDetection();
#else 
            throw new NotSupportedException("These tests require DEBUG conditional");
#endif
            CreateNode();

            _conn = EventStoreConnection.Create(_node.TcpEndPoint);
            _conn.Connect();

            _manager = new ProjectionsManager(new ConsoleLogger(), _node.HttpEndPoint);
            if (GivenStandardProjectionsRunning())
                EnableStandardProjections();
            QueueStatsCollector.WaitIdle();
            Given();
            When();
        }
        public override void SetUp()
        {
            base.SetUp();
            _node = new MiniNode(PathName);
            _node.Start();

            _firstEvent = TestEvent.NewTestEvent();

            _connection = TestConnection.Create(_node.TcpEndPoint);
            _connection.Connect();

            Assert.AreEqual(2, _connection.AppendToStream("test-stream",
                                                          ExpectedVersion.NoStream,
                                                          _firstEvent,
                                                          TestEvent.NewTestEvent(),
                                                          TestEvent.NewTestEvent()).NextExpectedVersion);

            using (var transaction = _connection.StartTransaction("test-stream", 2))
            {
                Assert.AreEqual(2, transaction.Commit().NextExpectedVersion);
            }
        }
        public override void TestFixtureSetUp()
        {
            base.TestFixtureSetUp();
#if DEBUG
            QueueStatsCollector.InitializeIdleDetection();
#else
            throw new NotSupportedException("These tests require DEBUG conditional");
#endif
            CreateNode();

            _conn = EventStoreConnection.Create(_node.TcpEndPoint);
            _conn.Connect();

            _manager = new ProjectionsManager(new ConsoleLogger(), _node.HttpEndPoint);
            if (GivenStandardProjectionsRunning())
            {
                EnableStandardProjections();
            }
            QueueStatsCollector.WaitIdle();
            Given();
            When();
        }
        public override void SetUp()
        {
            base.SetUp();
            _node = new MiniNode(PathName);
            _node.Start();

            _firstEvent = TestEvent.NewTestEvent();

            _connection = TestConnection.Create(_node.TcpEndPoint);
            _connection.Connect();

            Assert.AreEqual(2, _connection.AppendToStream("test-stream",
                                                          ExpectedVersion.NoStream,
                                                          _firstEvent,
                                                          TestEvent.NewTestEvent(),
                                                          TestEvent.NewTestEvent()).NextExpectedVersion);

            using (var transaction = _connection.StartTransaction("test-stream", 2))
            {
                Assert.AreEqual(2, transaction.Commit().NextExpectedVersion);
            }
        }
        public override void TestFixtureSetUp()
        {
            base.TestFixtureSetUp();
#if DEBUG
            QueueStatsCollector.InitializeIdleDetection();
#else 
            throw new NotSupportedException("These tests require DEBUG conditional");
#endif
            _projections = new ProjectionsSubsystem(1, runProjections: RunProjections.All);
            _node = new MiniNode(
                PathName, inMemDb: true, skipInitializeStandardUsersCheck: false,
                subsystems: new ISubsystem[] {_projections});
            _node.Start();

            _conn = EventStoreConnection.Create(_node.TcpEndPoint);
            _conn.Connect();

            _manager = new ProjectionsManager(new ConsoleLogger(), _node.HttpEndPoint);
            if (GivenStandardProjectionsRunning())
                EnableStandardProjections();
            QueueStatsCollector.WaitIdle();
            Given();
            When();
        }
 public EventStoreRpositoryBase()
 {
     connection = EventStoreConnection.Create(new IPEndPoint(IPAddress.Loopback, 1113));
     connection.Connect();
 }
        public override void TestFixtureSetUp()
        {
            base.TestFixtureSetUp();
            _node = new MiniNode(PathName, enableTrustedAuth: true);
            _node.Start();

            var userCreateEvent1 = new ManualResetEventSlim();

            _node.Node.MainQueue.Publish(
                new UserManagementMessage.Create(
                    new CallbackEnvelope(
                        m =>
            {
                Assert.IsTrue(m is UserManagementMessage.UpdateResult);
                var msg = (UserManagementMessage.UpdateResult)m;
                Assert.IsTrue(msg.Success);

                userCreateEvent1.Set();
            }), SystemAccount.Principal, "user1", "Test User 1", new string[0], "pa$$1"));

            var userCreateEvent2 = new ManualResetEventSlim();

            _node.Node.MainQueue.Publish(
                new UserManagementMessage.Create(
                    new CallbackEnvelope(
                        m =>
            {
                Assert.IsTrue(m is UserManagementMessage.UpdateResult);
                var msg = (UserManagementMessage.UpdateResult)m;
                Assert.IsTrue(msg.Success);

                userCreateEvent2.Set();
            }), SystemAccount.Principal, "user2", "Test User 2", new string[0], "pa$$2"));

            var adminCreateEvent2 = new ManualResetEventSlim();

            _node.Node.MainQueue.Publish(
                new UserManagementMessage.Create(
                    new CallbackEnvelope(
                        m =>
            {
                Assert.IsTrue(m is UserManagementMessage.UpdateResult);
                var msg = (UserManagementMessage.UpdateResult)m;
                Assert.IsTrue(msg.Success);

                adminCreateEvent2.Set();
            }), SystemAccount.Principal, "adm", "Administrator User", new[] { SystemRoles.Admins }, "admpa$$"));

            Assert.IsTrue(userCreateEvent1.Wait(120000), "User 1 creation failed");
            Assert.IsTrue(userCreateEvent2.Wait(120000), "User 2 creation failed");
            Assert.IsTrue(adminCreateEvent2.Wait(120000), "Administrator User creation failed");

            Connection = TestConnection.Create(_node.TcpEndPoint, TcpType.Normal, _userCredentials);
            Connection.Connect();

            Connection.SetStreamMetadata("noacl-stream", ExpectedVersion.NoStream, StreamMetadata.Build());
            Connection.SetStreamMetadata("read-stream", ExpectedVersion.NoStream, StreamMetadata.Build().SetReadRole("user1"));
            Connection.SetStreamMetadata("write-stream", ExpectedVersion.NoStream, StreamMetadata.Build().SetWriteRole("user1"));
            Connection.SetStreamMetadata("metaread-stream", ExpectedVersion.NoStream, StreamMetadata.Build().SetMetadataReadRole("user1"));
            Connection.SetStreamMetadata("metawrite-stream", ExpectedVersion.NoStream, StreamMetadata.Build().SetMetadataWriteRole("user1"));

            Connection.SetStreamMetadata("$all", ExpectedVersion.Any, StreamMetadata.Build().SetReadRole("user1"), new UserCredentials("adm", "admpa$$"));

            Connection.SetStreamMetadata("$system-acl", ExpectedVersion.NoStream,
                                         StreamMetadata.Build()
                                         .SetReadRole("user1")
                                         .SetWriteRole("user1")
                                         .SetMetadataReadRole("user1")
                                         .SetMetadataWriteRole("user1"), new UserCredentials("adm", "admpa$$"));
            Connection.SetStreamMetadata("$system-adm", ExpectedVersion.NoStream,
                                         StreamMetadata.Build()
                                         .SetReadRole(SystemRoles.Admins)
                                         .SetWriteRole(SystemRoles.Admins)
                                         .SetMetadataReadRole(SystemRoles.Admins)
                                         .SetMetadataWriteRole(SystemRoles.Admins), new UserCredentials("adm", "admpa$$"));

            Connection.SetStreamMetadata("normal-all", ExpectedVersion.NoStream,
                                         StreamMetadata.Build()
                                         .SetReadRole(SystemRoles.All)
                                         .SetWriteRole(SystemRoles.All)
                                         .SetMetadataReadRole(SystemRoles.All)
                                         .SetMetadataWriteRole(SystemRoles.All));
            Connection.SetStreamMetadata("$system-all", ExpectedVersion.NoStream,
                                         StreamMetadata.Build()
                                         .SetReadRole(SystemRoles.All)
                                         .SetWriteRole(SystemRoles.All)
                                         .SetMetadataReadRole(SystemRoles.All)
                                         .SetMetadataWriteRole(SystemRoles.All), new UserCredentials("adm", "admpa$$"));
        }
 private void Connect()
 {
     var settings = ConnectionSettings.Create();
     var ip = new IPEndPoint(_ipAddress, _port);
     Log("Connecting to {0}:{1}...", _ipAddress, _port);
     _connection = EventStoreConnection.Create(settings, ip);
     _connection.Connect();
     _connection.AppendToStream("hello", ExpectedVersion.Any, new EventData(Guid.NewGuid(), "Hello", false, new byte[0], new byte[0]));
     Log("Connected.");
     Log("Username to be used is: {0}", _userName);
     _credentials = new UserCredentials(_userName, _password);
 }
 public void SetUp()
 {
     _connection = EventStoreConnection.Create(IntegrationTestTcpEndPoint);
     _connection.Connect();
     _repo = new GetEventStoreRepository(_connection);
 }
 public void SetUp()
 {
     _connection = EventStoreConnection.Create(IntegrationTestTcpEndPoint);
     _connection.Connect();
     _repo = new GetEventStoreRepository(_connection);
 }
Example #41
0
 public ESEventStore()
 {
     conn.Connect();
 }
        public override void TestFixtureSetUp()
        {
            base.TestFixtureSetUp();
#if DEBUG
            QueueStatsCollector.InitializeIdleDetection();
#else 
            throw new NotSupportedException("These tests require DEBUG conditional");
#endif

            _nodeEndpoints[0] = new Endpoints(
                PortsHelper.GetAvailablePort(IPAddress.Loopback), PortsHelper.GetAvailablePort(IPAddress.Loopback),
                PortsHelper.GetAvailablePort(IPAddress.Loopback), PortsHelper.GetAvailablePort(IPAddress.Loopback),
                PortsHelper.GetAvailablePort(IPAddress.Loopback), PortsHelper.GetAvailablePort(IPAddress.Loopback));
            _nodeEndpoints[1] = new Endpoints(
                PortsHelper.GetAvailablePort(IPAddress.Loopback), PortsHelper.GetAvailablePort(IPAddress.Loopback),
                PortsHelper.GetAvailablePort(IPAddress.Loopback), PortsHelper.GetAvailablePort(IPAddress.Loopback),
                PortsHelper.GetAvailablePort(IPAddress.Loopback), PortsHelper.GetAvailablePort(IPAddress.Loopback));
            _nodeEndpoints[2] = new Endpoints(
                PortsHelper.GetAvailablePort(IPAddress.Loopback), PortsHelper.GetAvailablePort(IPAddress.Loopback),
                PortsHelper.GetAvailablePort(IPAddress.Loopback), PortsHelper.GetAvailablePort(IPAddress.Loopback),
                PortsHelper.GetAvailablePort(IPAddress.Loopback), PortsHelper.GetAvailablePort(IPAddress.Loopback));

            PortsHelper.GetAvailablePort(IPAddress.Loopback);

            _nodes[0] = CreateNode(0, 
                _nodeEndpoints[0], new IPEndPoint[] {_nodeEndpoints[1].InternalHttp, _nodeEndpoints[2].InternalHttp});
            _nodes[1] = CreateNode(1, 
                _nodeEndpoints[1], new IPEndPoint[] { _nodeEndpoints[0].InternalHttp, _nodeEndpoints[2].InternalHttp });
            
            _nodes[2] = CreateNode(2, 
                _nodeEndpoints[2], new IPEndPoint[] { _nodeEndpoints[0].InternalHttp, _nodeEndpoints[1].InternalHttp });
            

            _nodes[0].Start();
            _nodes[1].Start();
            _nodes[2].Start();

            WaitHandle.WaitAll(new[] { _nodes[0].StartedEvent, _nodes[1].StartedEvent, _nodes[2].StartedEvent });
            QueueStatsCollector.WaitIdle();
            _conn = EventStoreConnection.Create(_nodes[0].ExternalTcpEndPoint);
            _conn.Connect();

            _manager = new ProjectionsManager(new ConsoleLogger(), _nodes[0].ExternalHttpEndPoint);
            if (GivenStandardProjectionsRunning())
                EnableStandardProjections();
            QueueStatsCollector.WaitIdle();
            Given();
            When();
        }