-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
608 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<package> | ||
<metadata> | ||
<id>OrigoDB.EventStore</id> | ||
<title>OrigoDB EventStore storage module</title> | ||
<version>0.1.0</version> | ||
<authors>Robert Friberg</authors> | ||
<copyright>Copyright Devrex Labs</copyright> | ||
<summary>OrigoDB command journaling to the EventStore</summary> | ||
<description> OrigoDB command journaling to the EventStore</description> | ||
<projectUrl>https://github.com/devrexlabs/modules.eventstore</projectUrl> | ||
<licenseUrl>https://github.com/devrexlabs/origodb#license</licenseUrl> | ||
<requireLicenseAcceptance>false</requireLicenseAcceptance> | ||
<releaseNotes>https://github.com/devrexlabs/modules.eventstore/releases</releaseNotes> | ||
<tags>in-memory imdb nosql odbms database imc</tags> | ||
<dependencies> | ||
<dependency id="origodb.core" version="0.15.0"/> | ||
<dependency id="eventstore.client" version="2.0.2"/> | ||
</dependencies> | ||
</metadata> | ||
<files> | ||
<file src="build\OrigoDB.Modules.EventStore.dll" target="lib\net40" /> | ||
<file src="src\OrigoDB.Modules.EventStore\**\*.cs" target="src" /> | ||
</files> | ||
</package> |
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,18 @@ | ||
@echo off | ||
|
||
:Build | ||
cls | ||
|
||
if not exist tools\Cake\Cake.exe ( | ||
echo Installing Cake... | ||
nuget.exe install Cake -OutputDirectory tools -ExcludeVersion -NonInteractive | ||
echo. | ||
) | ||
|
||
SET BUILDMODE="Release" | ||
IF NOT [%1]==[] (set BUILDMODE="%1") | ||
|
||
echo Starting Cake... | ||
"tools\Cake\Cake.exe" "build.csx" "-verbosity=verbose" "-config=%BUILDMODE%" | ||
|
||
exit /b %errorlevel% |
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,93 @@ | ||
using System.Text.RegularExpressions; | ||
|
||
var target = Argument("target", "NuGet"); | ||
var config = Argument("config", "Release"); | ||
var output = "./build"; | ||
var version = ParseVersion("./src/OrigoDB.Modules.EventStore/Properties/AssemblyInfo.cs"); | ||
|
||
if(version == null) | ||
{ | ||
// We make sure the version is set. | ||
throw new InvalidOperationException("Could not parse version."); | ||
} | ||
|
||
//////////////////////////////////////////////// | ||
// TASKS | ||
//////////////////////////////////////////////// | ||
|
||
Task("Clean") | ||
.Does(() => | ||
{ | ||
CleanDirectory(output); | ||
}); | ||
|
||
Task("Restore-NuGet-Packages") | ||
.IsDependentOn("Clean") | ||
.Does(() => | ||
{ | ||
NuGetRestore("./src/OrigoDB.Modules.EventStore.sln"); | ||
}); | ||
|
||
Task("Build") | ||
.IsDependentOn("Clean") | ||
.Does(() => | ||
{ | ||
MSBuild("./src/OrigoDB.Modules.EventStore/OrigoDB.Modules.EventStore.csproj", settings => | ||
settings.SetConfiguration(config) | ||
.UseToolVersion(MSBuildToolVersion.VS2012) | ||
.WithTarget("clean") | ||
.WithTarget("build")); | ||
}); | ||
|
||
|
||
Task("Copy") | ||
.IsDependentOn("Build") | ||
.Does(() => | ||
{ | ||
var pattern = "src/OrigoDB.*/bin/" + config + "/OrigoDB.*.dll"; | ||
CopyFiles(pattern, output); | ||
}); | ||
|
||
Task("Zip") | ||
.IsDependentOn("Copy") | ||
.Does(() => | ||
{ | ||
var root = "./build/"; | ||
var output = "./build/OrigoDB.Modules.EventStore.binaries." + version + "-" + config + ".zip"; | ||
var files = root + "/*"; | ||
|
||
// Package the bin folder. | ||
Zip(root, output); | ||
}); | ||
|
||
Task("NuGet") | ||
.IsDependentOn("Zip") | ||
.Does(() => | ||
{ | ||
NuGetPack("./OrigoDB.EventStore.nuspec", new NuGetPackSettings { | ||
Version = version, | ||
OutputDirectory = "./build", | ||
Symbols = true | ||
}); | ||
}); | ||
|
||
//////////////////////////////////////////////// | ||
// RUN TASKS | ||
//////////////////////////////////////////////// | ||
|
||
RunTarget(target); | ||
|
||
//////////////////////////////////////////////// | ||
// UTILITIES | ||
//////////////////////////////////////////////// | ||
|
||
private string ParseVersion(string filename) | ||
{ | ||
var file = FileSystem.GetFile(filename); | ||
using(var reader = new StreamReader(file.OpenRead())) | ||
{ | ||
var text = reader.ReadToEnd(); | ||
Regex regex = new Regex(@"AssemblyVersion\(""(?<theversionnumber>\d+\.\d+\.\d+)""\)"); | ||
return regex.Match(text).Groups["theversionnumber"].Value; | ||
} | ||
} |
65 changes: 65 additions & 0 deletions
65
src/OrigoDB.Modules.EventStore.Test/ESCommandStoreTests.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,65 @@ | ||
using System; | ||
using System.Net; | ||
using NUnit.Framework; | ||
using OrigoDB.Core; | ||
using OrigoDB.Core.Proxy; | ||
using OrigoDB.Core.Test; | ||
|
||
namespace OrigoDB.Modules.EventStore.Test | ||
{ | ||
[TestFixture] | ||
public class ESCommandStoreTests | ||
{ | ||
|
||
[Test] | ||
public void SmokeTest2() | ||
{ | ||
var config = new EngineConfiguration().ForIsolatedTest(); | ||
var endPoint = new IPEndPoint(IPAddress.Loopback, 1113); | ||
var streamName = "origodb.SmokeTest2---" + Guid.NewGuid(); | ||
config.SetCommandStoreFactory(cfg => new ESCommandStore(cfg, endPoint, streamName)); | ||
var engine = Engine.Create<TestModel>(config); | ||
engine.Execute(new TestCommand()); | ||
engine.Execute(new TestCommand()); | ||
engine.Close(); | ||
|
||
engine = Engine.Load<TestModel>(config); | ||
var db = engine.GetProxy(); | ||
Assert.AreEqual(db.GetState(),2); | ||
var state = engine.Execute(m => m.State); | ||
Assert.AreEqual(2, state); | ||
engine.Close(); | ||
} | ||
|
||
|
||
[Test] | ||
public void SmokeTest() | ||
{ | ||
var config = new EngineConfiguration().ForIsolatedTest(); | ||
var endPoint = new IPEndPoint(IPAddress.Loopback, 1113); | ||
var store = new ESCommandStore(config, endPoint, "origodb.SmokeTest-" + Guid.NewGuid().ToString()); | ||
store.Initialize(); | ||
var timeStamp = new DateTime(2000,1,1); | ||
|
||
var appender = JournalAppender.Create(1, store); | ||
|
||
//write 100 entries | ||
for (ulong i = 0; i < 100; i++) | ||
{ | ||
appender.Append(new ProxyCommand<TestModel>("fish", null){Timestamp = timeStamp.AddMinutes(i)}); | ||
} | ||
|
||
//read from beginning | ||
int numRead = 0; | ||
foreach (var journalEntry in store.GetJournalEntriesFrom(0)) | ||
{ | ||
Assert.IsInstanceOf<JournalEntry<Command>>(journalEntry); | ||
Assert.AreEqual(journalEntry.Created, timeStamp.AddMinutes(numRead)); | ||
numRead++; | ||
Assert.AreEqual(journalEntry.Id, numRead); | ||
Console.WriteLine(journalEntry.Id); | ||
} | ||
Assert.AreEqual(100, numRead); | ||
} | ||
} | ||
} |
71 changes: 71 additions & 0 deletions
71
src/OrigoDB.Modules.EventStore.Test/OrigoDB.Modules.EventStore.Test.csproj
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,71 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{BE04EFB2-BA58-42CC-BB0D-028F4E70490C}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>OrigoDB.Modules.EventStore.Test</RootNamespace> | ||
<AssemblyName>OrigoDB.Modules.EventStore.Test</AssemblyName> | ||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="nunit.framework"> | ||
<HintPath>..\OrigoDB.Modules.EventStore\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath> | ||
</Reference> | ||
<Reference Include="OrigoDB.Core, Version=0.15.0.0, Culture=neutral, processorArchitecture=MSIL"> | ||
<SpecificVersion>False</SpecificVersion> | ||
<HintPath>..\OrigoDB.Modules.EventStore\packages\OrigoDB.Core.0.15.0\lib\net40\OrigoDB.Core.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Xml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="ESCommandStoreTests.cs" /> | ||
<Compile Include="TestCommand.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
<Compile Include="TestModel.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="packages.config" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\OrigoDB.Modules.EventStore\OrigoDB.Modules.EventStore.csproj"> | ||
<Project>{8BDD533B-0E1A-4BC5-A70C-9DA8D7BEBDFC}</Project> | ||
<Name>OrigoDB.Modules.EventStore</Name> | ||
</ProjectReference> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
Other similar extension points exist, see Microsoft.Common.targets. | ||
<Target Name="BeforeBuild"> | ||
</Target> | ||
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
</Project> |
36 changes: 36 additions & 0 deletions
36
src/OrigoDB.Modules.EventStore.Test/Properties/AssemblyInfo.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,36 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
[assembly: AssemblyTitle("OrigoDB.Modules.EventStore.Test")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("OrigoDB.Modules.EventStore.Test")] | ||
[assembly: AssemblyCopyright("Copyright © 2014")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// Setting ComVisible to false makes the types in this assembly not visible | ||
// to COM components. If you need to access a type in this assembly from | ||
// COM, set the ComVisible attribute to true on that type. | ||
[assembly: ComVisible(false)] | ||
|
||
// The following GUID is for the ID of the typelib if this project is exposed to COM | ||
[assembly: Guid("bfdb1969-349d-4028-a609-a1eaf327fe51")] | ||
|
||
// Version information for an assembly consists of the following four values: | ||
// | ||
// Major Version | ||
// Minor Version | ||
// Build Number | ||
// Revision | ||
// | ||
// You can specify all the values or you can default the Build and Revision Numbers | ||
// by using the '*' as shown below: | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |
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,15 @@ | ||
using System; | ||
using OrigoDB.Core; | ||
|
||
namespace OrigoDB.Modules.EventStore.Test | ||
{ | ||
[Serializable] | ||
public class TestCommand : Command<TestModel> | ||
{ | ||
|
||
public override void Execute(TestModel model) | ||
{ | ||
model.State++; | ||
} | ||
} | ||
} |
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,21 @@ | ||
using System; | ||
using OrigoDB.Core; | ||
|
||
namespace OrigoDB.Modules.EventStore.Test | ||
{ | ||
[Serializable] | ||
public class TestModel : Model | ||
{ | ||
public int State { get; set; } | ||
|
||
public int GetState() | ||
{ | ||
return State; | ||
} | ||
|
||
public void SetState(int state) | ||
{ | ||
State = state; | ||
} | ||
} | ||
} |
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,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="NUnit" version="2.6.3" targetFramework="net40" /> | ||
<package id="OrigoDB.Core" version="0.15.0" targetFramework="net40" /> | ||
</packages> |
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,26 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 2012 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OrigoDB.Modules.EventStore", "OrigoDB.Modules.EventStore\OrigoDB.Modules.EventStore.csproj", "{8BDD533B-0E1A-4BC5-A70C-9DA8D7BEBDFC}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OrigoDB.Modules.EventStore.Test", "OrigoDB.Modules.EventStore.Test\OrigoDB.Modules.EventStore.Test.csproj", "{BE04EFB2-BA58-42CC-BB0D-028F4E70490C}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{8BDD533B-0E1A-4BC5-A70C-9DA8D7BEBDFC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{8BDD533B-0E1A-4BC5-A70C-9DA8D7BEBDFC}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{8BDD533B-0E1A-4BC5-A70C-9DA8D7BEBDFC}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{8BDD533B-0E1A-4BC5-A70C-9DA8D7BEBDFC}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{BE04EFB2-BA58-42CC-BB0D-028F4E70490C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{BE04EFB2-BA58-42CC-BB0D-028F4E70490C}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{BE04EFB2-BA58-42CC-BB0D-028F4E70490C}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{BE04EFB2-BA58-42CC-BB0D-028F4E70490C}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
Oops, something went wrong.