Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
rasmus committed Nov 2, 2017
2 parents d518e36 + fe56dab commit 411ccf6
Show file tree
Hide file tree
Showing 11 changed files with 418 additions and 33 deletions.
15 changes: 13 additions & 2 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
### New in 0.51 (not released yet)
### New in 0.52 (not released yet)

* Fixed: `.UseFilesEventStore` now uses a thread safe singleton instance for
file system persistence, making it suitable for use in multi-threaded unit
tests. Please don't use the files event store in production scenarios
* New: Support for unicode characters in type names. This simplifies using an
[ubiquitous language](http://www.jamesshore.com/Agile-Book/ubiquitous_language.html)
in non-english domains
* Fixed: Include hyphen in prefix validation for identity values. This fixes a bug
where invalid identities could be created (e.g. `ThingyId.With("thingyINVALID-a41e...")`)

### New in 0.51.3155 (released 2017-10-25)

* New: Removed the `new()` requirement for read models
* New: If `ISagaLocator.LocateSagaAsync` cannot identify the saga for a given
event, it may now return `Task.FromResult(null)` in order to short-circuit
the dispatching process. This might be useful in cases where some instances
of an event belong to a saga process while others don't
* Fixed: `StringExtensions.ToSha256()` can now be safely used from
concurrent threads.
concurrent threads

### New in 0.50.3124 (released 2017-10-21)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace EventFlow.Owin.Middlewares
public class CommandPublishMiddleware : OwinMiddleware
{
private static readonly Regex CommandPath = new Regex(
@"/*commands/(?<name>[a-z]+)/(?<version>\d+)/{0,1}",
@"/*commands/(?<name>[\p{Ll}\p{Lm}\p{Lo}]+)/(?<version>\d+)/{0,1}",
RegexOptions.Compiled | RegexOptions.IgnoreCase);

private readonly ILog _log;
Expand Down
152 changes: 152 additions & 0 deletions Source/EventFlow.Tests/IntegrationTests/UnicodeTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
// The MIT License (MIT)
//
// Copyright (c) 2015-2017 Rasmus Mikkelsen
// Copyright (c) 2015-2017 eBay Software Foundation
// https://github.com/eventflow/EventFlow
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

using System;
using System.Threading;
using System.Threading.Tasks;
using EventFlow.Aggregates;
using EventFlow.Commands;
using EventFlow.Core;
using EventFlow.EventStores;
using EventFlow.Extensions;
using EventFlow.Logs;
using EventFlow.TestHelpers;
using FluentAssertions;
using NUnit.Framework;

namespace EventFlow.Tests.IntegrationTests
{
[Category(Categories.Integration)]
public class UnicodeTests
{
[Test]
public void UpperCaseIdentityThrows()
{
// Arrange + Act
Action action = () => new Identität1("Identität1-00000000-0000-0000-0000-000000000000");

// Assert
action.ShouldThrow<ArgumentException>();
}

[Test]
public void LowerCaseIdentityWorks()
{
// Arrange + Act
var id = new Identität1("identität1-00000000-0000-0000-0000-000000000000");

// Assert
id.GetGuid().Should().BeEmpty();
}

[Test]
public void UnicodeIdentities()
{
// Arrange + Act
var identität = Identität1.New.Value;

// Assert
identität.Should().StartWith("identität1-");
}

[Test]
public void UnicodeCommands()
{
// Arrange
var commandDefinitions = new CommandDefinitionService(new NullLog());

// Act
Action action = () => commandDefinitions.Load(typeof(Cömmand));

// Assert
action.ShouldNotThrow();
}

[Test]
public void UnicodeEvents()
{
// Arrange
var eventDefinitionService = new EventDefinitionService(new NullLog());

// Act
Action action = () => eventDefinitionService.Load(typeof(Püng1Event));

// Assert
action.ShouldNotThrow();
}

[Test]
public void UnicodeIntegration()
{
var resolver = EventFlowOptions.New
.AddEvents(typeof(Püng1Event))
.AddCommands(typeof(Cömmand))
.AddCommandHandlers(typeof(CömmandHändler))
.CreateResolver();

var bus = resolver.Resolve<ICommandBus>();
bus.Publish(new Cömmand());
}

private class Identität1 : Identity<Identität1>
{
public Identität1(string value) : base(value)
{
}
}

private class Püng1Event : AggregateEvent<Aggregät, Identität1>
{
}

private class Aggregät : AggregateRoot<Aggregät, Identität1>
{
public Aggregät(Identität1 id) : base(id)
{
}

public void Püng()
{
this.Emit(new Püng1Event());
}

public void Apply(Püng1Event e) { }
}

private class Cömmand : Command<Aggregät, Identität1>
{
public Cömmand() : base(Identität1.New)
{
}
}

private class CömmandHändler : CommandHandler<Aggregät, Identität1, Cömmand>
{
public override Task ExecuteAsync(Aggregät aggregate, Cömmand command, CancellationToken cancellationToken)
{
aggregate.Püng();
return Task.FromResult(true);
}
}
}
}
1 change: 1 addition & 0 deletions Source/EventFlow.Tests/UnitTests/Core/IdentityTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ public void NewDeterministic_IsValid()
}

[TestCase("da7ab6b1-c513-581f-a1a0-7cdf17109deb")]
[TestCase("thingyid-da7ab6b1-c513-581f-a1a0-7cdf17109deb")]
[TestCase("thingy-769077C6-F84D-46E3-AD2E-828A576AAAF3")]
[TestCase("thingy-pppppppp-pppp-pppp-pppp-pppppppppppp")]
[TestCase("funny-da7ab6b1-c513-581f-a1a0-7cdf17109deb")]
Expand Down
Loading

0 comments on commit 411ccf6

Please sign in to comment.