public override void TestFixtureSetUp()
        {
            Helper.EatException(() => _dumpResponse  = CreateDumpResponse());
            Helper.EatException(() => _dumpResponse2 = CreateDumpResponse2());
            Helper.EatException(() => _dumpRequest   = CreateDumpRequest());
            Helper.EatException(() => _dumpRequest2  = CreateDumpRequest2());

            base.TestFixtureSetUp();

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

                _connection = TestConnection.Create(_node.TcpEndPoint);
                _connection.ConnectAsync().Wait();
            }

            _lastResponse      = null;
            _lastResponseBody  = null;
            _lastResponseBytes = null;
            _lastJsonException = null;
            try {
                Given();
                When();
            } catch {
                if (_createdMiniNode)
                {
                    if (_connection != null)
                    {
                        try {
                            _connection.Close();
                        } catch {
                        }
                    }

                    if (_node != null)
                    {
                        try {
                            _node.Shutdown();
                        } catch {
                        }
                    }
                }

                throw;
            }
        }
 public async Task Start()
 {
     _connection?.Close();
     _connection                = _buildConnection();
     _connection.Connected     += _connection_Connected;
     _connection.ErrorOccurred += _connection_ErrorOccurred;
     _connection.Disconnected  += _connection_Disconnected;
     await _connection.ConnectAsync();
 }
示例#3
0
        public override void TestFixtureSetUp()
        {
            base.TestFixtureSetUp();
            _credentials = new UserCredentials(SystemUsers.Admin, SystemUsers.DefaultAdminPassword);
            var createdMiniNode = false;

            _timeout = TimeSpan.FromSeconds(10);
            // Check if a node is running in ProjectionsManagerTestSuiteMarkerBase
            if (SetUpFixture.Connection != null && SetUpFixture.Node != null)
            {
                _tag        = "_" + (++SetUpFixture.Counter);
                _node       = SetUpFixture.Node;
                _connection = SetUpFixture.Connection;
            }
            else
            {
                createdMiniNode = true;
                _tag            = "_1";

                _node = CreateNode();
                _node.Start();

                _connection = TestConnection.Create(_node.TcpEndPoint);
                _connection.ConnectAsync().Wait();
            }

            try
            {
                _projManager = new ProjectionsManager(new ConsoleLogger(), _node.ExtHttpEndPoint, _timeout);
                Given();
                When();
            }
            catch
            {
                if (createdMiniNode)
                {
                    if (_connection != null)
                    {
                        try {
                            _connection.Close();
                        } catch {
                        }
                    }
                    if (_node != null)
                    {
                        try {
                            _node.Shutdown();
                        } catch {
                        }
                    }
                }
                throw;
            }
        }
示例#4
0
 public bool Start()
 {
     _subscriber?.Close();
     _subscriber                       = _subscriberBuilder.Build(false);
     _subscriber.Connected            += _connection_Connected;
     _subscriber.Disconnected         += _connection_Disconnected;
     _subscriber.ErrorOccurred        += _connection_ErrorOccurred;
     _subscriber.Closed               += _connection_Closed;
     _subscriber.Reconnecting         += _connection_Reconnecting;
     _subscriber.AuthenticationFailed += _connection_AuthenticationFailed;
     _subscriber.ConnectAsync().Wait();
     Subscribe().Wait();
     return(true);
 }
        public override async Task TestFixtureTearDown()
        {
            _connection.Close();
            await _node.Shutdown();

            await base.TestFixtureTearDown();
        }
示例#6
0
 public Task StopAsync(CancellationToken cancellationToken)
 {
     //關閉訂閱功能,再關閉連線
     _subscription.Stop();
     _connection.Close();
     return(Task.CompletedTask);
 }
示例#7
0
        public async Task <IEnumerable <Event> > LoadEvents(string stream, TypeMap types)
        {
            await connection.ConnectAsync();

            var version = 0L;
            var events  = new List <Event>();

            while (true)
            {
                // todo, the contents of this loop should be put into a dependency
                if (!(await proxy.ReadEventAsync(connection, stream, version) is LoadedEvent eventFromStream))
                {
                    break;
                }

                var evt = converter.ConvertReadToDomain(types, eventFromStream);

                events.Add(evt);

                version++;
            }

            connection.Close();

            return(events);
        }
 public void TearDown()
 {
     _conn.SetStreamMetadataAsync("$all", ExpectedVersion.Any,
                                  StreamMetadata.Build(),
                                  new UserCredentials(SystemUsers.Admin, SystemUsers.DefaultAdminPassword)).Wait();
     _conn.Close();
 }
示例#9
0
        public Task StopAsync(CancellationToken cancellationToken)
        {
            _projectionManager.Stop();
            _esConnection.Close();

            return(Task.CompletedTask);
        }
示例#10
0
 public Task StopAsync(CancellationToken cancellationToken)
 {
     _pid.Poison();
     _supervisor.Shutdown();
     _esConnection.Close();
     return(Task.CompletedTask);
 }
示例#11
0
 private static void StopEventStoreConnection()
 {
     _log.Information("Stopping event store connection");
     _eventStoreConnection.Close();
     _eventStoreConnection.Dispose();
     _log.Information("Event store connection stopped");
 }
示例#12
0
        public async Task Teardown()
        {
            await _conn.DeletePersistentSubscriptionAsync(_streamName, _groupName, DefaultData.AdminCredentials);

            _conn.Close();
            _conn.Dispose();
        }
示例#13
0
 public void Close()
 {
     if (_connection != null)
     {
         _connection.Close();
     }
 }
        public override async Task TearDown()
        {
            _conn.Close();
            await _node.Shutdown();

            await base.TearDown();
        }
 public void Dispose()
 {
     //Log.DebugFormat("Disposing {0}", GetHashCode());
     eventRepository.Dispose();
     connection.Close();
     connection.Dispose();
 }
示例#16
0
 public void TearDown()
 {
     _connection.Close();
     _node.Shutdown();
     _connection = null;
     _node       = null;
     _directory.TestFixtureTearDown();
 }
        protected async Task CloseConnectionAndWait(IEventStoreConnection conn)
        {
            TaskCompletionSource closed = new TaskCompletionSource();

            conn.Closed += (_, _) => closed.SetResult();
            conn.Close();
            await closed.Task.WithTimeout(Timeout);
        }
示例#18
0
 public override void TestFixtureTearDown()
 {
     _conn.Close();
     _nodes[0].Shutdown();
     _nodes[1].Shutdown();
     _nodes[2].Shutdown();
     base.TestFixtureTearDown();
 }
示例#19
0
        public void TearDown()
        {
            Connection.Close();
            Node.Shutdown();
            Connection = null;
            Node       = null;

            Directory.Delete(PathName, true);
        }
 public override void TestFixtureTearDown()
 {
     if (SetUpFixture._connection == null || SetUpFixture._node == null)
     {
         _connection.Close();
         _node.Shutdown();
     }
     base.TestFixtureTearDown();
 }
        public override void TestFixtureTearDown()
        {
            _conn.Close();
            _node.Shutdown();
            base.TestFixtureTearDown();
#if DEBUG
            QueueStatsCollector.InitializeIdleDetection(false);
#endif
        }
示例#22
0
        public static void CloseConnection()
        {
            if (_connection != null)
            {
                _connection.Close();
                _connection = null;

                LogManager.Log("Closing Connection to EventStore...", LogSeverity.Information);
            }
        }
示例#23
0
 public void Stop()
 {
     foreach (var subscription in _subscriptions)
     {
         subscription.Unsubscribe();
     }
     _subscriptions.Clear();
     _connection?.Close();
     _connection = null;
 }
示例#24
0
        public override async Task TestFixtureTearDown()
        {
            _conn.Close();
            await Task.WhenAll(
                _nodes[0].Shutdown(),
                _nodes[1].Shutdown(),
                _nodes[2].Shutdown());

            await base.TestFixtureTearDown();
        }
        public void TearDown()
        {
            Conventions.SetFindAggregateTypeForEventType(null);

            Resolver.Reset();

            _eventStoreConnection.Close();
            _eventStoreConnection = null;

            _logger = null;
        }
        public override void TestFixtureTearDown()
        {
            _conn.Close();
            _nodes[0].Shutdown();
            _nodes[1].Shutdown();
            _nodes[2].Shutdown();
#if DEBUG
            QueueStatsCollector.DisableIdleDetection();
#endif
            base.TestFixtureTearDown();
        }
示例#27
0
        void WithEventstore(Action <IAggregateEventStore> work)
        {
            var switchboard = new Nuclear.Lazy.Switchboard();
            IEventStoreConnection connection = EventStoreConnection.Create(new IPEndPoint(IPAddress.Loopback, 1113));

            connection.ConnectAsync().Wait();
            IAggregateEventStore eventstore = new EventStoreRepository(connection, switchboard);

            work(eventstore);
            connection.Close();
        }
示例#28
0
 public void Stop()
 {
     if (_connection != null)
     {
         _connection.Close();
     }
     if (_node != null)
     {
         _node.Stop(false);
     }
 }
        public override void TestFixtureSetUp()
        {
            base.TestFixtureSetUp();
#if (!DEBUG)
            Assert.Ignore("These tests require DEBUG conditional");
#else
            QueueStatsCollector.InitializeIdleDetection();
            CreateNode();
            try {
                _conn = EventStoreConnection.Create(_node.TcpEndPoint);
                _conn.ConnectAsync().Wait();

                _manager = new ProjectionsManager(
                    new ConsoleLogger(),
                    _node.ExtHttpEndPoint,
                    TimeSpan.FromMilliseconds(20000));

                _queryManager = new QueryManager(
                    new ConsoleLogger(),
                    _node.ExtHttpEndPoint,
                    TimeSpan.FromMilliseconds(20000),
                    TimeSpan.FromMilliseconds(20000));

                WaitIdle();

                if (GivenStandardProjectionsRunning())
                {
                    EnableStandardProjections();
                }

                QueueStatsCollector.WaitIdle();
                Given();
                When();
            } catch {
                try {
                    if (_conn != null)
                    {
                        _conn.Close();
                    }
                } catch {
                }

                try {
                    if (_node != null)
                    {
                        _node.Shutdown();
                    }
                } catch {
                }

                throw;
            }
#endif
        }
示例#30
0
 public void Dispose()
 {
     try
     {
         _connection.Close();
     }
     catch
     {
         //Äsch
     }
 }
        public override void TestFixtureSetUp()
        {
            base.TestFixtureSetUp();
            #if (!DEBUG)
            Assert.Ignore("These tests require DEBUG conditional");
            #else
            QueueStatsCollector.InitializeIdleDetection();
            CreateNode();
            try
            {
                _conn = EventStoreConnection.Create(_node.TcpEndPoint);
                _conn.ConnectAsync().Wait();

                _manager = new ProjectionsManager(
                    new ConsoleLogger(),
                    _node.HttpEndPoint,
                    TimeSpan.FromMilliseconds(10000));
                WaitIdle();
                if (GivenStandardProjectionsRunning())
                    EnableStandardProjections();
                QueueStatsCollector.WaitIdle();
                Given();
                When();
            }
            catch
            {
                try
                {
                    if (_conn != null)
                        _conn.Close();
                }
                catch
                {
                }
                try
                {
                    if (_node != null)
                        _node.Shutdown();
                }
                catch
                {
                }

                throw;
            }
            #endif
        }