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(waitForNonEmptyTf: true); _conn = EventStoreConnection.Create(_nodes[0].ExternalTcpEndPoint); _conn.ConnectAsync().Wait(); _manager = new ProjectionsManager( new ConsoleLogger(), _nodes[0].ExternalHttpEndPoint, TimeSpan.FromMilliseconds(10000)); if (GivenStandardProjectionsRunning()) { EnableStandardProjections(); } QueueStatsCollector.WaitIdle(); Given(); When(); }
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 }
protected override void When() { base.When(); var r1 = _conn.AppendToStream( "cat-1", ExpectedVersion.NoStream, _admin, new EventData(Guid.NewGuid(), "type1", true, Encoding.UTF8.GetBytes("{}"), null)); var r2 = _conn.AppendToStream( "cat-1", r1.NextExpectedVersion, _admin, new EventData(Guid.NewGuid(), "type1", true, Encoding.UTF8.GetBytes("{}"), null)); _conn.DeleteStream("cat-1", r2.NextExpectedVersion, false, _admin); QueueStatsCollector.WaitIdle(); }
public override void TestFixtureSetUp() { base.TestFixtureSetUp(); #if DEBUG QueueStatsCollector.InitializeIdleDetection(); #endif _nodeEndpoints[0] = new Endpoints( GetFreePort(IPAddress.Loopback), GetFreePort(IPAddress.Loopback), GetFreePort(IPAddress.Loopback), GetFreePort(IPAddress.Loopback), GetFreePort(IPAddress.Loopback), GetFreePort(IPAddress.Loopback)); _nodeEndpoints[1] = new Endpoints( GetFreePort(IPAddress.Loopback), GetFreePort(IPAddress.Loopback), GetFreePort(IPAddress.Loopback), GetFreePort(IPAddress.Loopback), GetFreePort(IPAddress.Loopback), GetFreePort(IPAddress.Loopback)); _nodeEndpoints[2] = new Endpoints( GetFreePort(IPAddress.Loopback), GetFreePort(IPAddress.Loopback), GetFreePort(IPAddress.Loopback), GetFreePort(IPAddress.Loopback), GetFreePort(IPAddress.Loopback), GetFreePort(IPAddress.Loopback)); _nodeCreationFactory.Add(0, (wait) => CreateNode(0, _nodeEndpoints[0], new IPEndPoint[] { _nodeEndpoints[1].InternalHttp, _nodeEndpoints[2].InternalHttp }, wait)); _nodeCreationFactory.Add(1, (wait) => CreateNode(1, _nodeEndpoints[1], new IPEndPoint[] { _nodeEndpoints[0].InternalHttp, _nodeEndpoints[2].InternalHttp }, wait)); _nodeCreationFactory.Add(2, (wait) => CreateNode(2, _nodeEndpoints[2], new IPEndPoint[] { _nodeEndpoints[0].InternalHttp, _nodeEndpoints[1].InternalHttp }, wait)); _nodes[0] = _nodeCreationFactory[0](true); _nodes[1] = _nodeCreationFactory[1](true); _nodes[2] = _nodeCreationFactory[2](true); BeforeNodesStart(); _nodes[0].Start(); _nodes[1].Start(); _nodes[2].Start(); WaitHandle.WaitAll(new[] { _nodes[0].StartedEvent, _nodes[1].StartedEvent, _nodes[2].StartedEvent }); QueueStatsCollector.WaitIdle(waitForNonEmptyTf: true); _conn = EventStoreConnection.Create(_nodes[0].ExternalTcpEndPoint); _conn.ConnectAsync().Wait(); QueueStatsCollector.WaitIdle(); Given(); }
protected override void When() { base.When(); var r1 = _conn.AppendToStreamAsync( "cat-1", ExpectedVersion.NoStream, _admin, new EventData(Guid.NewGuid(), "type1", true, Encoding.UTF8.GetBytes("{}"), null)) .Result; var r2 = _conn.AppendToStreamAsync( "cat-1", r1.NextExpectedVersion, _admin, new EventData(Guid.NewGuid(), "type1", true, Encoding.UTF8.GetBytes("{}"), null)) .Result; _conn.DeleteStreamAsync("cat-1", r2.NextExpectedVersion, GivenDeleteHardDeleteStreamMode(), _admin) .Wait(); QueueStatsCollector.WaitIdle(); if (!GivenStandardProjectionsRunning()) { EnableStandardProjections(); WaitIdle(); } }
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(); }
protected static void WaitIdle() { QueueStatsCollector.WaitIdle(); }
protected static void WaitIdle(int multiplier = 1) { QueueStatsCollector.WaitIdle(multiplier: multiplier); }