-
Notifications
You must be signed in to change notification settings - Fork 639
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'projections-deleted-stream' into dev
- Loading branch information
Showing
219 changed files
with
6,456 additions
and
796 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
src/EventStore/EventStore.Core.Tests/ClientAPI/SpecificationWithMiniNode.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// Copyright (c) 2012, Event Store LLP | ||
// All rights reserved. | ||
// | ||
// Redistribution and use in source and binary forms, with or without | ||
// modification, are permitted provided that the following conditions are | ||
// met: | ||
// | ||
// Redistributions of source code must retain the above copyright notice, | ||
// this list of conditions and the following disclaimer. | ||
// Redistributions in binary form must reproduce the above copyright | ||
// notice, this list of conditions and the following disclaimer in the | ||
// documentation and/or other materials provided with the distribution. | ||
// Neither the name of the Event Store LLP nor the names of its | ||
// contributors may be used to endorse or promote products derived from | ||
// this software without specific prior written permission | ||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
// | ||
|
||
using EventStore.ClientAPI; | ||
using EventStore.Core.Tests.ClientAPI.Helpers; | ||
using EventStore.Core.Tests.Helpers; | ||
using NUnit.Framework; | ||
|
||
namespace EventStore.Core.Tests.ClientAPI | ||
{ | ||
public abstract class SpecificationWithMiniNode : SpecificationWithDirectoryPerTestFixture | ||
{ | ||
private MiniNode _node; | ||
protected IEventStoreConnection _conn; | ||
|
||
protected abstract void When(); | ||
|
||
[TestFixtureSetUp] | ||
public override void TestFixtureSetUp() | ||
{ | ||
base.TestFixtureSetUp(); | ||
_node = new MiniNode(PathName, skipInitializeStandardUsersCheck: false); | ||
_node.Start(); | ||
_conn = TestConnection.Create(_node.TcpEndPoint); | ||
_conn.Connect(); | ||
When(); | ||
} | ||
|
||
[TestFixtureTearDown] | ||
public override void TestFixtureTearDown() | ||
{ | ||
_conn.Close(); | ||
_node.Shutdown(); | ||
base.TestFixtureTearDown(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
...ventStore.Core.Tests/ClientAPI/read_all_events_forward_with_hard_deleted_stream_should.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
// Copyright (c) 2012, Event Store LLP | ||
// All rights reserved. | ||
// | ||
// Redistribution and use in source and binary forms, with or without | ||
// modification, are permitted provided that the following conditions are | ||
// met: | ||
// | ||
// Redistributions of source code must retain the above copyright notice, | ||
// this list of conditions and the following disclaimer. | ||
// Redistributions in binary form must reproduce the above copyright | ||
// notice, this list of conditions and the following disclaimer in the | ||
// documentation and/or other materials provided with the distribution. | ||
// Neither the name of the Event Store LLP nor the names of its | ||
// contributors may be used to endorse or promote products derived from | ||
// this software without specific prior written permission | ||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
// | ||
|
||
using System.Linq; | ||
using EventStore.ClientAPI; | ||
using EventStore.ClientAPI.SystemData; | ||
using EventStore.Core.Data; | ||
using EventStore.Core.Services; | ||
using EventStore.Core.Tests.ClientAPI.Helpers; | ||
using EventStore.Core.Tests.Helpers; | ||
using NUnit.Framework; | ||
using ExpectedVersion = EventStore.ClientAPI.ExpectedVersion; | ||
using StreamMetadata = EventStore.ClientAPI.StreamMetadata; | ||
|
||
namespace EventStore.Core.Tests.ClientAPI | ||
{ | ||
[TestFixture, Category("LongRunning")] | ||
public class read_all_events_forward_with_hard_deleted_stream_should : SpecificationWithMiniNode | ||
{ | ||
private EventData[] _testEvents; | ||
|
||
protected override void When() | ||
{ | ||
_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); | ||
_conn.DeleteStream("stream", ExpectedVersion.Any, hardDelete: true); | ||
} | ||
|
||
[Test, Category("LongRunning")] | ||
public void ensure_deleted_stream() | ||
{ | ||
var res = _conn.ReadStreamEventsForward("stream", 0, 100, false); | ||
Assert.AreEqual(SliceReadStatus.StreamDeleted, res.Status); | ||
Assert.AreEqual(0, res.Events.Length); | ||
} | ||
|
||
[Test, Category("LongRunning")] | ||
public void returns_all_events_including_tombstone() | ||
{ | ||
AllEventsSlice read = _conn.ReadAllEventsForward(Position.Start, _testEvents.Length + 10, false); | ||
Assert.That( | ||
EventDataComparer.Equal( | ||
_testEvents.ToArray(), | ||
read.Events.Skip(read.Events.Length - _testEvents.Length - 1) | ||
.Take(_testEvents.Length) | ||
.Select(x => x.Event) | ||
.ToArray())); | ||
var lastEvent = read.Events.Last().Event; | ||
Assert.AreEqual("stream", lastEvent.EventStreamId); | ||
Assert.AreEqual(SystemEventTypes.StreamDeleted, lastEvent.EventType); | ||
} | ||
} | ||
} |
Oops, something went wrong.