-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sqlexpress based test database working SqlServerJournal, intializes SqlServerSnapshotStore initial impl of SqlServer snapshot store fixed rest of broken sql server snapshot store specs Akka.Persistence.SqlServer comments for public API final notest and docs for Akka.Persistence.SqlServer safe escape of SQL string formats + mdf based tests fixed sln file
- Loading branch information
Showing
32 changed files
with
1,743 additions
and
14 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
135 changes: 135 additions & 0 deletions
135
...trib/persistence/Akka.Persistence.SqlServer.Tests/Akka.Persistence.SqlServer.Tests.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,135 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="12.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>{5A3C24D7-0D1C-4974-BBB4-22AC792666DE}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>Akka.Persistence.SqlServer.Tests</RootNamespace> | ||
<AssemblyName>Akka.Persistence.SqlServer.Tests</AssemblyName> | ||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<IsWebBootstrapper>false</IsWebBootstrapper> | ||
<PublishUrl>publish\</PublishUrl> | ||
<Install>true</Install> | ||
<InstallFrom>Disk</InstallFrom> | ||
<UpdateEnabled>false</UpdateEnabled> | ||
<UpdateMode>Foreground</UpdateMode> | ||
<UpdateInterval>7</UpdateInterval> | ||
<UpdateIntervalUnits>Days</UpdateIntervalUnits> | ||
<UpdatePeriodically>false</UpdatePeriodically> | ||
<UpdateRequired>false</UpdateRequired> | ||
<MapFileExtensions>true</MapFileExtensions> | ||
<ApplicationRevision>0</ApplicationRevision> | ||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion> | ||
<UseApplicationTrust>false</UseApplicationTrust> | ||
<BootstrapperEnabled>true</BootstrapperEnabled> | ||
</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="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="DbCleanup.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
<Compile Include="Properties\Settings.Designer.cs"> | ||
<AutoGen>True</AutoGen> | ||
<DesignTimeSharedInput>True</DesignTimeSharedInput> | ||
<DependentUpon>Settings.settings</DependentUpon> | ||
</Compile> | ||
<Compile Include="SqlServerJournalSpec.cs" /> | ||
<Compile Include="SqlServerSnapshotStoreSpec.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\..\..\core\Akka.Persistence.TestKit\Akka.Persistence.TestKit.csproj"> | ||
<Project>{ad9418b6-c452-4169-94fb-d43de0bfa966}</Project> | ||
<Name>Akka.Persistence.TestKit</Name> | ||
</ProjectReference> | ||
<ProjectReference Include="..\..\..\core\Akka.Persistence\Akka.Persistence.csproj"> | ||
<Project>{fca84dea-c118-424b-9eb8-34375dfef18a}</Project> | ||
<Name>Akka.Persistence</Name> | ||
</ProjectReference> | ||
<ProjectReference Include="..\..\..\core\Akka.TestKit\Akka.TestKit.csproj"> | ||
<Project>{0d3cbad0-bbdb-43e5-afc4-ed1d3ecdc224}</Project> | ||
<Name>Akka.TestKit</Name> | ||
</ProjectReference> | ||
<ProjectReference Include="..\..\..\core\Akka\Akka.csproj"> | ||
<Project>{5deddf90-37f0-48d3-a0b0-a5cbd8a7e377}</Project> | ||
<Name>Akka</Name> | ||
</ProjectReference> | ||
<ProjectReference Include="..\..\testkits\Akka.TestKit.Xunit\Akka.TestKit.Xunit.csproj"> | ||
<Project>{11f4d4b8-7e07-4457-abf2-609b3e7b2649}</Project> | ||
<Name>Akka.TestKit.Xunit</Name> | ||
</ProjectReference> | ||
<ProjectReference Include="..\Akka.Persistence.SqlServer\Akka.Persistence.SqlServer.csproj"> | ||
<Project>{bac85686-afc4-413e-98dc-5ed8f468bc63}</Project> | ||
<Name>Akka.Persistence.SqlServer</Name> | ||
</ProjectReference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<BootstrapperPackage Include=".NETFramework,Version=v4.5"> | ||
<Visible>False</Visible> | ||
<ProductName>Microsoft .NET Framework 4.5 %28x86 and x64%29</ProductName> | ||
<Install>true</Install> | ||
</BootstrapperPackage> | ||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5"> | ||
<Visible>False</Visible> | ||
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName> | ||
<Install>false</Install> | ||
</BootstrapperPackage> | ||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1"> | ||
<Visible>False</Visible> | ||
<ProductName>.NET Framework 3.5 SP1</ProductName> | ||
<Install>false</Install> | ||
</BootstrapperPackage> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="app.config" /> | ||
<None Include="Properties\Settings.settings"> | ||
<Generator>SettingsSingleFileGenerator</Generator> | ||
<LastGenOutput>Settings.Designer.cs</LastGenOutput> | ||
</None> | ||
</ItemGroup> | ||
<ItemGroup /> | ||
<ItemGroup> | ||
<Content Include="Resources\AkkaPersistenceSqlServerSpecDb.mdf"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</Content> | ||
<Content Include="Resources\AkkaPersistenceSqlServerSpecDb_log.ldf"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
<DependentUpon>AkkaPersistenceSqlServerSpecDb.mdf</DependentUpon> | ||
</Content> | ||
</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> |
29 changes: 29 additions & 0 deletions
29
src/contrib/persistence/Akka.Persistence.SqlServer.Tests/DbCleanup.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,29 @@ | ||
using System; | ||
using System.Data.SqlClient; | ||
|
||
namespace Akka.Persistence.SqlServer.Tests | ||
{ | ||
public static class DbCleanup | ||
{ | ||
private static readonly string ConnectionString = @"Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\Resources\AkkaPersistenceSqlServerSpecDb.mdf;Integrated Security=True"; | ||
|
||
static DbCleanup() | ||
{ | ||
AppDomain.CurrentDomain.SetData("DataDirectory", AppDomain.CurrentDomain.BaseDirectory); | ||
} | ||
|
||
public static void Clean() | ||
{ | ||
using (var conn = new SqlConnection(ConnectionString)) | ||
using (var cmd = new SqlCommand()) | ||
{ | ||
conn.Open(); | ||
cmd.CommandText = @" | ||
IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'dbo' AND TABLE_NAME = 'EventJournal') BEGIN DELETE FROM dbo.EventJournal END; | ||
IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'dbo' AND TABLE_NAME = 'SnapshotStore') BEGIN DELETE FROM dbo.SnapshotStore END"; | ||
cmd.Connection = conn; | ||
cmd.ExecuteNonQuery(); | ||
} | ||
} | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
src/contrib/persistence/Akka.Persistence.SqlServer.Tests/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("Akka.Persistence.SqlServer.Tests")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("Akka.Persistence.SqlServer.Tests")] | ||
[assembly: AssemblyCopyright("Copyright © 2015")] | ||
[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("343a20b5-0aa8-4c22-baea-de78162b1c94")] | ||
|
||
// 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")] |
37 changes: 37 additions & 0 deletions
37
src/contrib/persistence/Akka.Persistence.SqlServer.Tests/Properties/Settings.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
14 changes: 14 additions & 0 deletions
14
src/contrib/persistence/Akka.Persistence.SqlServer.Tests/Properties/Settings.settings
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,14 @@ | ||
<?xml version='1.0' encoding='utf-8'?> | ||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Akka.Persistence.SqlServer.Tests.Properties" GeneratedClassName="Settings"> | ||
<Profiles /> | ||
<Settings> | ||
<Setting Name="SqlServerJournalSpecDbConnectionString" Type="(Connection string)" Scope="Application"> | ||
<DesignTimeValue Profile="(Default)"><?xml version="1.0" encoding="utf-16"?> | ||
<SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> | ||
<ConnectionString>Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\SqlServerJournalSpecDb.mdf;Integrated Security=True;Connect Timeout=30</ConnectionString> | ||
<ProviderName>System.Data.SqlClient</ProviderName> | ||
</SerializableConnectionString></DesignTimeValue> | ||
<Value Profile="(Default)">Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\SqlServerJournalSpecDb.mdf;Integrated Security=True;Connect Timeout=30</Value> | ||
</Setting> | ||
</Settings> | ||
</SettingsFile> |
Binary file added
BIN
+3.06 MB
...persistence/Akka.Persistence.SqlServer.Tests/Resources/AkkaPersistenceSqlServerSpecDb.mdf
Binary file not shown.
37 changes: 37 additions & 0 deletions
37
src/contrib/persistence/Akka.Persistence.SqlServer.Tests/SqlServerJournalSpec.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,37 @@ | ||
using Akka.Configuration; | ||
using Akka.Persistence.TestKit.Journal; | ||
|
||
namespace Akka.Persistence.SqlServer.Tests | ||
{ | ||
public class SqlServerJournalSpec : JournalSpec | ||
{ | ||
private static readonly Config SpecConfig = ConfigurationFactory.ParseString(@" | ||
akka.persistence { | ||
publish-plugin-commands = on | ||
journal { | ||
plugin = ""akka.persistence.journal.sql-server"" | ||
sql-server { | ||
class = ""Akka.Persistence.SqlServer.Journal.SqlServerJournal, Akka.Persistence.SqlServer"" | ||
plugin-dispatcher = ""akka.actor.default-dispatcher"" | ||
table-name = EventJournal | ||
schema-name = dbo | ||
auto-initialize = on | ||
connection-string = ""Data Source=(LocalDB)\\v11.0;AttachDbFilename=|DataDirectory|\\Resources\\AkkaPersistenceSqlServerSpecDb.mdf;Integrated Security=True"" | ||
} | ||
} | ||
}"); | ||
|
||
public SqlServerJournalSpec() | ||
: base(SpecConfig, "SqlServerJournalSpec") | ||
{ | ||
DbCleanup.Clean(); | ||
Initialize(); | ||
} | ||
|
||
protected override void Dispose(bool disposing) | ||
{ | ||
base.Dispose(disposing); | ||
DbCleanup.Clean(); | ||
} | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
src/contrib/persistence/Akka.Persistence.SqlServer.Tests/SqlServerSnapshotStoreSpec.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,37 @@ | ||
using Akka.Configuration; | ||
using Akka.Persistence.TestKit.Snapshot; | ||
|
||
namespace Akka.Persistence.SqlServer.Tests | ||
{ | ||
public class SqlServerSnapshotStoreSpec : SnapshotStoreSpec | ||
{ | ||
private static readonly Config SpecConfig = ConfigurationFactory.ParseString(@" | ||
akka.persistence { | ||
publish-plugin-commands = on | ||
snapshot-store { | ||
plugin = ""akka.persistence.snapshot-store.sql-server"" | ||
sql-server { | ||
class = ""Akka.Persistence.SqlServer.Snapshot.SqlServerSnapshotStore, Akka.Persistence.SqlServer"" | ||
plugin-dispatcher = ""akka.actor.default-dispatcher"" | ||
table-name = SnapshotStore | ||
schema-name = dbo | ||
auto-initialize = on | ||
connection-string = ""Data Source=(LocalDB)\\v11.0;AttachDbFilename=|DataDirectory|\\Resources\\AkkaPersistenceSqlServerSpecDb.mdf;Integrated Security=True"" | ||
} | ||
} | ||
}"); | ||
|
||
public SqlServerSnapshotStoreSpec() | ||
: base(SpecConfig, "SqlServerSnapshotStoreSpec") | ||
{ | ||
DbCleanup.Clean(); | ||
Initialize(); | ||
} | ||
|
||
protected override void Dispose(bool disposing) | ||
{ | ||
base.Dispose(disposing); | ||
DbCleanup.Clean(); | ||
} | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
src/contrib/persistence/Akka.Persistence.SqlServer.Tests/app.config
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,3 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
</configuration> |
Oops, something went wrong.