瀏覽代碼

Removed Directory sources (they now have their own repository at https://github.com/Abc-Arbitrage/Zebus.Directory)

Kevin Lovato 11 年之前
父節點
當前提交
03c7c8a2ee
共有 60 個文件被更改,包括 2 次插入4475 次删除
  1. 0 2
      build/Zebus.build
  2. 1 16
      build/nuget/BuildNuget.ps1
  3. 0 29
      build/nuget/nuspecs/Abc.Zebus.Directory.Cassandra.nuspec
  4. 0 25
      build/nuget/nuspecs/Abc.Zebus.Directory.Standalone.nuspec
  5. 0 26
      build/nuget/nuspecs/Abc.Zebus.Directory.nuspec
  6. 1 1
      build/nuget/nuspecs/Abc.Zebus.Testing.nuspec
  7. 0 114
      src/Abc.Zebus.Directory.Cassandra.Tests/Abc.Zebus.Directory.Cassandra.Tests.csproj
  8. 0 18
      src/Abc.Zebus.Directory.Cassandra.Tests/Cql/CassandraConfigurationMock.cs
  9. 0 93
      src/Abc.Zebus.Directory.Cassandra.Tests/Cql/CqlTestFixture.cs
  10. 0 6
      src/Abc.Zebus.Directory.Cassandra.Tests/FakeCommand.cs
  11. 0 24
      src/Abc.Zebus.Directory.Cassandra.Tests/FakeRoutableCommand.cs
  12. 0 6
      src/Abc.Zebus.Directory.Cassandra.Tests/Properties/AssemblyInfo.cs
  13. 0 294
      src/Abc.Zebus.Directory.Cassandra.Tests/Storage/CqlPeerRepositoryTests.DynamicSubscriptions.cs
  14. 0 173
      src/Abc.Zebus.Directory.Cassandra.Tests/Storage/CqlPeerRepositoryTests.cs
  15. 0 32
      src/Abc.Zebus.Directory.Cassandra.Tests/Storage/StorageConvertionExtensionsTests.cs
  16. 0 6
      src/Abc.Zebus.Directory.Cassandra.Tests/packages.config
  17. 0 105
      src/Abc.Zebus.Directory.Cassandra/Abc.Zebus.Directory.Cassandra.csproj
  18. 0 68
      src/Abc.Zebus.Directory.Cassandra/Cql/CassandraCqlSessionManager.cs
  19. 0 27
      src/Abc.Zebus.Directory.Cassandra/Cql/CqlDataContext.cs
  20. 0 29
      src/Abc.Zebus.Directory.Cassandra/Cql/ICassandraConfiguration.cs
  21. 0 7
      src/Abc.Zebus.Directory.Cassandra/Properties/AssemblyInfo.cs
  22. 0 148
      src/Abc.Zebus.Directory.Cassandra/Storage/CqlPeerRepository.cs
  23. 0 20
      src/Abc.Zebus.Directory.Cassandra/Storage/DirectoryDataContext.cs
  24. 0 14
      src/Abc.Zebus.Directory.Cassandra/Storage/ExtendContextTable.cs
  25. 0 115
      src/Abc.Zebus.Directory.Cassandra/Storage/StorageConvertionExtensions.cs
  26. 0 41
      src/Abc.Zebus.Directory.Cassandra/Storage/StoragePeer.cs
  27. 0 22
      src/Abc.Zebus.Directory.Cassandra/Storage/StorageSubscription.cs
  28. 0 6
      src/Abc.Zebus.Directory.Cassandra/packages.config
  29. 0 22
      src/Abc.Zebus.Directory.Cassandra/schema_creation.cql
  30. 0 95
      src/Abc.Zebus.Directory.Tests/Abc.Zebus.Directory.Tests.csproj
  31. 0 71
      src/Abc.Zebus.Directory.Tests/Configuration/ConfigurationTests.cs
  32. 0 122
      src/Abc.Zebus.Directory.Tests/DeadPeerDetection/DeadPeerDetectorEntryTests.cs
  33. 0 503
      src/Abc.Zebus.Directory.Tests/DeadPeerDetection/DeadPeerDetectorTests.cs
  34. 0 6
      src/Abc.Zebus.Directory.Tests/FakeCommand.cs
  35. 0 24
      src/Abc.Zebus.Directory.Tests/FakeRoutableCommand.cs
  36. 0 357
      src/Abc.Zebus.Directory.Tests/Handlers/DirectoryCommandsHandlerTests.cs
  37. 0 18
      src/Abc.Zebus.Directory.Tests/Log4netConfigurator.cs
  38. 0 247
      src/Abc.Zebus.Directory.Tests/PeerDirectoryServerTests.cs
  39. 0 6
      src/Abc.Zebus.Directory.Tests/Properties/AssemblyInfo.cs
  40. 0 323
      src/Abc.Zebus.Directory.Tests/Storage/MemoryPeerRepositoryTests.cs
  41. 0 31
      src/Abc.Zebus.Directory.Tests/TestDataBuilder.cs
  42. 0 97
      src/Abc.Zebus.Directory/Abc.Zebus.Directory.csproj
  43. 0 13
      src/Abc.Zebus.Directory/App.config
  44. 0 45
      src/Abc.Zebus.Directory/Configuration/AppSettings.cs
  45. 0 22
      src/Abc.Zebus.Directory/Configuration/AppSettingsBusConfiguration.cs
  46. 0 25
      src/Abc.Zebus.Directory/Configuration/AppSettingsDirectoryConfiguration.cs
  47. 0 46
      src/Abc.Zebus.Directory/Configuration/IDirectoryConfiguration.cs
  48. 0 164
      src/Abc.Zebus.Directory/DeadPeerDetection/DeadPeerDetector.cs
  49. 0 171
      src/Abc.Zebus.Directory/DeadPeerDetection/DeadPeerDetectorEntry.cs
  50. 0 8
      src/Abc.Zebus.Directory/DeadPeerDetection/DeadPeerStatus.cs
  51. 0 17
      src/Abc.Zebus.Directory/DeadPeerDetection/IDeadPeerDetector.cs
  52. 0 112
      src/Abc.Zebus.Directory/Handlers/DirectoryCommandsHandler.cs
  53. 0 127
      src/Abc.Zebus.Directory/PeerDirectoryServer.cs
  54. 0 77
      src/Abc.Zebus.Directory/Program.cs
  55. 0 9
      src/Abc.Zebus.Directory/Properties/AssemblyInfo.cs
  56. 0 50
      src/Abc.Zebus.Directory/Storage/ExtendPeerRepository.cs
  57. 0 19
      src/Abc.Zebus.Directory/Storage/IPeerRepository.cs
  58. 0 105
      src/Abc.Zebus.Directory/Storage/MemoryPeerRepository.cs
  59. 0 11
      src/Abc.Zebus.Directory/log4net.config
  60. 0 65
      src/Abc.Zebus.sln

+ 0 - 2
build/Zebus.build

@@ -60,8 +60,6 @@
 	<target name="init-tests">
 		<fileset id="testsToBuild" basedir="${src.dir}">
 			<include name="Abc.Zebus.Tests\Abc.Zebus.Tests.csproj" />
-			<include name="Abc.Zebus.Directory.Tests\Abc.Zebus.Directory.Tests.csproj" />
-			<include name="Abc.Zebus.Directory.Cassandra.Tests\Abc.Zebus.Directory.Cassandra.Tests.csproj" />
 		</fileset>
 	</target>
 	

+ 1 - 16
build/nuget/BuildNuget.ps1

@@ -36,19 +36,4 @@ Write-Host "############# Building Zebus package #############" -ForegroundColor
 # Build nuget for Zebus.Testing
 Write-Host
 Write-Host "############# Building Zebus.Testing package #############" -ForegroundColor Green
-& '.\tools\nuget\NuGet.exe' pack .\build\nuget\nuspecs\Abc.Zebus.Testing.nuspec -BasePath $location -OutputDirectory $outputLocation -Properties $properties -sym;
-
-# Build nuget for Zebus.Directory.Standalone
-Write-Host
-Write-Host "############# Building Zebus.Directory.Standalone package #############" -ForegroundColor Green
-& '.\tools\nuget\NuGet.exe' pack .\build\nuget\nuspecs\Abc.Zebus.Directory.Standalone.nuspec -BasePath $location -OutputDirectory $outputLocation -Properties $properties -NoPackageAnalysis;
-
-# Build nuget for Zebus.Directory
-# Compile Zebus.Directory in release and as a class library
-& $msbuild .\src\Abc.Zebus.Directory\Abc.Zebus.Directory.csproj /p:Configuration=Release`;OverrideOutputType=Library
-& '.\tools\nuget\NuGet.exe' pack .\build\nuget\nuspecs\Abc.Zebus.Directory.nuspec -BasePath $location -OutputDirectory $outputLocation -Properties $properties -sym;
-
-# Build nuget for Zebus.Directory.Cassandra
-Write-Host
-Write-Host "############# Building Zebus.Directory.Cassandra package #############" -ForegroundColor Green
-& '.\tools\nuget\NuGet.exe' pack .\build\nuget\nuspecs\Abc.Zebus.Directory.Cassandra.nuspec -BasePath $location -OutputDirectory $outputLocation -Properties $properties -NoPackageAnalysis -sym;
+& '.\tools\nuget\NuGet.exe' pack .\build\nuget\nuspecs\Abc.Zebus.Testing.nuspec -BasePath $location -OutputDirectory $outputLocation -Properties $properties -sym;

+ 0 - 29
build/nuget/nuspecs/Abc.Zebus.Directory.Cassandra.nuspec

@@ -1,29 +0,0 @@
-<?xml version="1.0"?>
-<package >
-	<metadata>
-		<id>Zebus.Directory.Cassandra</id>
-		<version>$version$</version>
-		<title>Zebus.Directory.Cassandra</title>
-		<authors>$author$</authors>
-		<owners>$author$</owners>
-		<licenseUrl>https://github.com/Abc-Arbitrage/Zebus/blob/master/LICENSE.txt</licenseUrl>
-		<projectUrl>https://github.com/Abc-Arbitrage/Zebus</projectUrl>
-		<requireLicenseAcceptance>false</requireLicenseAcceptance>
-		<description>An implementation of the Directory backed out by Cassandra</description>
-		<releaseNotes></releaseNotes>
-		<copyright>$copyright$</copyright>
-		<tags></tags>
-    <dependencies>
-      <dependency id="Zebus" version="$version$" />
-      <dependency id="Zebus.Directory" version="$version$" />
-      <dependency id="CassandraCSharpDriver" version="[2.0.3,2.1)" />
-      <dependency id="CassandraEntityContext" version="[2.0.3,2.1)" />
-    </dependencies>
-	</metadata>
-	<files>
-		<file src="src\Abc.Zebus.Directory.Cassandra\bin\$configuration$\Abc.Zebus.Directory.Cassandra.dll" target="lib\net45\" />
-		<file src="src\Abc.Zebus.Directory.Cassandra\bin\$configuration$\Abc.Zebus.Directory.Cassandra.pdb" target="lib\net45\" />
-    
-		<file src="src\Abc.Zebus.Directory.Cassandra\**\*.cs" target="src" />
-	</files>
-</package>

+ 0 - 25
build/nuget/nuspecs/Abc.Zebus.Directory.Standalone.nuspec

@@ -1,25 +0,0 @@
-<?xml version="1.0"?>
-<package >
-	<metadata>
-		<id>Zebus.Directory.Standalone</id>
-		<version>$version$</version>
-		<title>Zebus.Directory.Standalone</title>
-		<authors>$author$</authors>
-		<owners>$author$</owners>
-		<licenseUrl>https://github.com/Abc-Arbitrage/Zebus/blob/master/LICENSE.txt</licenseUrl>
-		<projectUrl>https://github.com/Abc-Arbitrage/Zebus</projectUrl>
-		<requireLicenseAcceptance>false</requireLicenseAcceptance>
-		<description>$description$</description>
-		<releaseNotes></releaseNotes>
-		<copyright>$copyright$</copyright>
-		<tags></tags>
-	</metadata>
-	<files>
-		<file src="src\Abc.Zebus.Directory\bin\$configuration$\Abc.Zebus.Directory.exe" target="tools" />
-		<file src="src\Abc.Zebus.Directory\bin\$configuration$\Abc.Zebus.Directory.exe.config" target="tools" />
-		<file src="src\Abc.Zebus.Directory\bin\$configuration$\*.dll" target="tools" />
-		<file src="src\Abc.Zebus.Directory\bin\$configuration$\log4net.config" target="tools" />
-    
-		<file src="build\nuget\tools\Zebus.Directory\readme.txt" target="" />
-	</files>
-</package>

+ 0 - 26
build/nuget/nuspecs/Abc.Zebus.Directory.nuspec

@@ -1,26 +0,0 @@
-<?xml version="1.0"?>
-<package >
-	<metadata>
-		<id>Zebus.Directory</id>
-		<version>$version$</version>
-		<title>Zebus.Directory</title>
-		<authors>$author$</authors>
-		<owners>$author$</owners>
-		<licenseUrl>https://github.com/Abc-Arbitrage/Zebus/blob/master/LICENSE.txt</licenseUrl>
-		<projectUrl>https://github.com/Abc-Arbitrage/Zebus</projectUrl>
-		<requireLicenseAcceptance>false</requireLicenseAcceptance>
-		<description>$description$</description>
-		<releaseNotes></releaseNotes>
-		<copyright>$copyright$</copyright>
-		<tags></tags>
-    <dependencies>
-      <dependency id="Zebus" version="$version$" />
-    </dependencies>
-	</metadata>
-	<files>
-		<file src="src\Abc.Zebus.Directory\bin\$configuration$\Abc.Zebus.Directory.dll" target="lib\net45\" />
-		<file src="src\Abc.Zebus.Directory\bin\$configuration$\Abc.Zebus.Directory.pdb" target="lib\net45\" />
-    
-    <file src="src\Abc.Zebus.Directory\**\*.cs" target="src" />
-	</files>
-</package>

+ 1 - 1
build/nuget/nuspecs/Abc.Zebus.Testing.nuspec

@@ -6,7 +6,7 @@
 		<title>Zebus.Testing</title>
 		<authors>$author$</authors>
 		<owners>$author$</owners>
-		<licenseUrl>https://github.com/Abc-Arbitrage/Zebus/blob/master/LICENSE.txt</licenseUrl>
+		<licenseUrl>https://github.com/Abc-Arbitrage/Zebus/blob/master/LICENSE.md</licenseUrl>
 		<projectUrl>https://github.com/Abc-Arbitrage/Zebus</projectUrl>
 		<requireLicenseAcceptance>false</requireLicenseAcceptance>
 		<description>$description$</description>

+ 0 - 114
src/Abc.Zebus.Directory.Cassandra.Tests/Abc.Zebus.Directory.Cassandra.Tests.csproj

@@ -1,114 +0,0 @@
-<?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>{549C137C-9CE4-4765-9E1D-E348E96A08D6}</ProjectGuid>
-    <OutputType>Library</OutputType>
-    <AppDesignerFolder>Properties</AppDesignerFolder>
-    <RootNamespace>Abc.Zebus.Directory.Cassandra.Tests</RootNamespace>
-    <AssemblyName>Abc.Zebus.Directory.Cassandra.Tests</AssemblyName>
-    <TargetFrameworkVersion>v4.5</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="Cassandra, Version=2.0.3.0, Culture=neutral, processorArchitecture=MSIL">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\packages\CassandraCSharpDriver.2.0.3\lib\net40\Cassandra.dll</HintPath>
-    </Reference>
-    <Reference Include="Cassandra.Data, Version=1.0.4.0, Culture=neutral, processorArchitecture=MSIL">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\packages\CassandraCSharpDriver.2.0.3\lib\net40\Cassandra.Data.dll</HintPath>
-    </Reference>
-    <Reference Include="Cassandra.Data.EntityContext">
-      <HintPath>..\packages\CassandraEntityContext.2.0.3\lib\net40\Cassandra.Data.EntityContext.dll</HintPath>
-    </Reference>
-    <Reference Include="Cassandra.Data.Linq">
-      <HintPath>..\packages\CassandraCSharpDriver.2.0.3\lib\net40\Cassandra.Data.Linq.dll</HintPath>
-    </Reference>
-    <Reference Include="LZ4">
-      <HintPath>..\packages\lz4net.1.0.3.93\lib\net40-client\LZ4.dll</HintPath>
-    </Reference>
-    <Reference Include="Moq, Version=4.0.10827.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\..\lib\moq\Moq.dll</HintPath>
-    </Reference>
-    <Reference Include="nunit.framework">
-      <HintPath>..\..\lib\nunit\nunit.framework.dll</HintPath>
-    </Reference>
-    <Reference Include="protobuf-net, Version=2.0.0.622, Culture=neutral, PublicKeyToken=257b51d87d2e4d67, processorArchitecture=MSIL">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\..\lib\protobuf\protobuf-net.dll</HintPath>
-    </Reference>
-    <Reference Include="StructureMap">
-      <HintPath>..\..\lib\structuremap\StructureMap.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="Cql\CassandraConfigurationMock.cs" />
-    <Compile Include="Cql\CqlTestFixture.cs" />
-    <Compile Include="FakeCommand.cs" />
-    <Compile Include="FakeRoutableCommand.cs" />
-    <Compile Include="Properties\AssemblyInfo.cs" />
-    <Compile Include="Storage\CqlPeerRepositoryPerformanceTests.cs" />
-    <Compile Include="Storage\CqlPeerRepositoryTests.cs" />
-    <Compile Include="Storage\StorageConvertionExtensionsTests.cs" />
-  </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\Abc.Zebus.Directory.Cassandra\Abc.Zebus.Directory.Cassandra.csproj">
-      <Project>{8f786f88-cb54-43dc-927f-65b75795ec60}</Project>
-      <Name>Abc.Zebus.Directory.Cassandra</Name>
-    </ProjectReference>
-    <ProjectReference Include="..\Abc.Zebus.Directory\Abc.Zebus.Directory.csproj">
-      <Project>{ee6730d9-6a21-46a5-ae3f-af78060b6ea3}</Project>
-      <Name>Abc.Zebus.Directory</Name>
-    </ProjectReference>
-    <ProjectReference Include="..\Abc.Zebus.Testing\Abc.Zebus.Testing.csproj">
-      <Project>{4ce123df-8021-411c-929b-53e5c5fc1e04}</Project>
-      <Name>Abc.Zebus.Testing</Name>
-    </ProjectReference>
-    <ProjectReference Include="..\Abc.Zebus\Abc.Zebus.csproj">
-      <Project>{1f4c6307-6113-40d5-bf42-4b6bf5df13b2}</Project>
-      <Name>Abc.Zebus</Name>
-    </ProjectReference>
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="Storage\CqlPeerRepositoryTests.DynamicSubscriptions.cs" />
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="packages.config" />
-  </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>

+ 0 - 18
src/Abc.Zebus.Directory.Cassandra.Tests/Cql/CassandraConfigurationMock.cs

@@ -1,18 +0,0 @@
-using System;
-using Abc.Zebus.Directory.Cassandra.Cql;
-using Moq;
-
-namespace Abc.Zebus.Directory.Cassandra.Tests.Cql
-{
-    // TODO: This entire namespace belongs in Zebus.Testing but it would require the creation of a Zebus.Shared, and we are not ready for that just yet
-    public class CassandraConfigurationMock<TConfig> : Mock<TConfig> where TConfig : class, ICassandraConfiguration
-    {
-        public CassandraConfigurationMock(string host, string keySpace, string localDataCenter, TimeSpan queryTimeout)
-        {
-            As<ICassandraConfiguration>().SetupGet(config => config.Hosts).Returns(host);
-            As<ICassandraConfiguration>().SetupGet(config => config.KeySpace).Returns(keySpace);
-            As<ICassandraConfiguration>().SetupGet(config => config.QueryTimeout).Returns(queryTimeout);
-            As<ICassandraConfiguration>().SetupGet(config => config.LocalDataCenter).Returns(localDataCenter);
-        }
-    }
-}

+ 0 - 93
src/Abc.Zebus.Directory.Cassandra.Tests/Cql/CqlTestFixture.cs

@@ -1,93 +0,0 @@
-using Abc.Zebus.Directory.Cassandra.Cql;
-using Abc.Zebus.Util;
-using Cassandra;
-using Cassandra.Data.EntityContext;
-using Cassandra.Data.Linq;
-using Moq;
-using NUnit.Framework;
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Reflection;
-
-namespace Abc.Zebus.Directory.Cassandra.Tests.Cql
-{
-    // TODO: This entire namespace belongs in Zebus.Testing but it would require the creation of a Zebus.Shared, and we are not ready for that just yet
-    public abstract class CqlTestFixture<TDataContext, TConfig>
-        where TDataContext : CqlDataContext<TConfig>
-        where TConfig : class, ICassandraConfiguration
-    {
-        private readonly string _keySpace = "UnitTestingKeyspace_" + Guid.NewGuid().ToString().Substring(0, 8);
-
-        private readonly CassandraCqlSessionManager _sessionManager = new CassandraCqlSessionManager();
-
-        protected Cluster Cluster { get; private set; }
-
-        public TDataContext DataContext { get; private set; }
-
-        protected ISession Session { get; private set; }
-
-        public Mock<TConfig> ConfigurationMock { get; private set; }
-
-        protected abstract string Hosts { get; }
-
-        protected abstract string LocalDataCenter { get; }
-
-        [TestFixtureSetUp]
-        public void CreateSchema()
-        {
-            Diagnostics.CassandraTraceSwitch.Level = TraceLevel.Verbose;
-            Diagnostics.CassandraStackTraceIncluded = true;
-
-            ConfigurationMock = CreateConfigurationMock();
-
-            var strategyReplicationProperty = ReplicationStrategies.CreateNetworkTopologyStrategyReplicationProperty(new Dictionary<string, int> { { LocalDataCenter, 1 } });
-            Cluster = _sessionManager.GetCluster(ConfigurationMock.Object);
-            Cluster.ConnectAndCreateDefaultKeyspaceIfNotExists(strategyReplicationProperty).Dispose();
-
-            Session = _sessionManager.GetSession(ConfigurationMock.Object);
-
-            DataContext = CreateDataContext();
-            DataContext.CreateTablesIfNotExist();
-        }
-
-        private TDataContext CreateDataContext()
-        {
-            // To enhance if needed
-            return (TDataContext)Activator.CreateInstance(typeof(TDataContext), _sessionManager, ConfigurationMock.Object);
-        }
-
-        private Mock<TConfig> CreateConfigurationMock()
-        {
-            return new CassandraConfigurationMock<TConfig>(Hosts, _keySpace, LocalDataCenter, 5.Seconds());
-        }
-
-        [TestFixtureTearDown]
-        public void DropSchema()
-        {
-            Session.Execute(new SimpleStatement(string.Format("drop keyspace \"{0}\";", _keySpace)));
-            _sessionManager.Dispose();
-        }
-
-        [TearDown]
-        public void TruncateAllColumnFamilies()
-        {
-            var tableNames = GetTableNames();
-            foreach (var name in tableNames)
-                Session.Execute(new SimpleStatement(string.Format("truncate {0};", name)));
-        }
-
-        private IEnumerable<string> GetTableNames()
-        {
-            var fieldInfo = typeof(Context).GetField("_tables", BindingFlags.Instance | BindingFlags.NonPublic);
-            if (fieldInfo == null)
-                yield break;
-
-            dynamic tableDictionary = fieldInfo.GetValue(DataContext);
-            foreach (var tableName in tableDictionary.Keys)
-            {
-                yield return tableName;
-            }
-        }
-    }
-}

+ 0 - 6
src/Abc.Zebus.Directory.Cassandra.Tests/FakeCommand.cs

@@ -1,6 +0,0 @@
-namespace Abc.Zebus.Directory.Tests
-{
-    public class FakeCommand : ICommand
-    {
-    }
-}

+ 0 - 24
src/Abc.Zebus.Directory.Cassandra.Tests/FakeRoutableCommand.cs

@@ -1,24 +0,0 @@
-using Abc.Zebus.Routing;
-
-namespace Abc.Zebus.Directory.Tests
-{
-    [Routable]
-    public class FakeRoutableCommand : ICommand
-    {
-        [RoutingPosition(1)]
-        public readonly int Id;
-
-        [RoutingPosition(2)]
-        public readonly string Name;
-        
-        FakeRoutableCommand()
-        {
-        }
-
-        public FakeRoutableCommand(int id, string name)
-        {
-            Id = id;
-            Name = name;
-        }
-    }
-}

+ 0 - 6
src/Abc.Zebus.Directory.Cassandra.Tests/Properties/AssemblyInfo.cs

@@ -1,6 +0,0 @@
-using System.Reflection;
-using System.Runtime.InteropServices;
-
-[assembly: AssemblyTitle("Abc.Zebus.Directory.Cassandra.Tests")]
-[assembly: ComVisible(false)]
-[assembly: Guid("6bbd0694-ef93-43d0-875f-04bdedc3f4c3")]

+ 0 - 294
src/Abc.Zebus.Directory.Cassandra.Tests/Storage/CqlPeerRepositoryTests.DynamicSubscriptions.cs

@@ -1,294 +0,0 @@
-using System.Linq;
-using Abc.Zebus.Directory.Tests;
-using Abc.Zebus.Routing;
-using Abc.Zebus.Testing;
-using Abc.Zebus.Testing.Extensions;
-using Abc.Zebus.Util;
-using Cassandra;
-using Cassandra.Data.Linq;
-using NUnit.Framework;
-using System;
-
-namespace Abc.Zebus.Directory.Cassandra.Tests.Storage
-{
-    public partial class CqlPeerRepositoryTests
-    {
-        [Test]
-        public void should_add_dynamic_subscriptions()
-        {
-            var peerDescriptor = _peer1.ToPeerDescriptorWithRoundedTime(true, typeof(FakeCommand));
-            _repository.AddOrUpdatePeer(peerDescriptor);
-
-            _repository.AddDynamicSubscriptionsForTypes(peerDescriptor.PeerId, peerDescriptor.TimestampUtc.Value, new[] { CreateSubscriptionsForType<int>() });
-
-            var fetched = _repository.Get(peerDescriptor.Peer.Id);
-            fetched.Subscriptions.ShouldEqual(new[]
-            {
-                CreateSubscriptionFor<FakeCommand>(),
-                CreateSubscriptionFor<int>()
-            });
-        }
-        
-        private Subscription CreateSubscriptionFor<TMessage>(params string[] bindingKeyParts)
-        {
-            return new Subscription(MessageUtil.GetTypeId(typeof(TMessage)), new BindingKey(bindingKeyParts));
-        }
-
-        private SubscriptionsForType CreateSubscriptionsForType<TMessage>(params BindingKey[] bindings)
-        {
-            return new SubscriptionsForType(MessageUtil.GetTypeId(typeof(TMessage)), bindings.Any() ? bindings : new[] { BindingKey.Empty });
-        }
-
-        [Test]
-        public void should_not_crash_when_passing_null_subscriptions_array_to_AddDynamicSubscriptions()
-        {
-            var peerDescriptor = _peer1.ToPeerDescriptorWithRoundedTime(true, typeof(FakeCommand));
-
-            Assert.DoesNotThrow(() => _repository.AddDynamicSubscriptionsForTypes(peerDescriptor.PeerId, peerDescriptor.TimestampUtc.Value, null));
-        }
-
-        [Test]
-        public void should_not_crash_when_passing_null_subscriptions_array_to_RemoveDynamicSubscriptions()
-        {
-            var peerDescriptor = _peer1.ToPeerDescriptorWithRoundedTime(true, typeof(FakeCommand));
-
-            Assert.DoesNotThrow(() => _repository.RemoveDynamicSubscriptionsForTypes(peerDescriptor.PeerId, peerDescriptor.TimestampUtc.Value, null));
-        }
-
-        [Test]
-        public void should_remove_dynamic_subscriptions()
-        {
-            var peerDescriptor = _peer1.ToPeerDescriptorWithRoundedTime(true, typeof(FakeCommand));
-            _repository.AddOrUpdatePeer(peerDescriptor);
-            _repository.AddDynamicSubscriptionsForTypes(peerDescriptor.PeerId, peerDescriptor.TimestampUtc.Value, new[] { CreateSubscriptionsForType<int>() });
-
-            _repository.RemoveDynamicSubscriptionsForTypes(peerDescriptor.PeerId, peerDescriptor.TimestampUtc.Value, new[] { MessageUtil.GetTypeId(typeof(int)) });
-
-            var fetched = _repository.Get(peerDescriptor.Peer.Id);
-            fetched.ShouldHaveSamePropertiesAs(peerDescriptor);
-        }
-
-        [Test]
-        public void should_remove_the_dynamic_subscriptions_of_a_peer_when_removing_it()
-        {
-            var peerDescriptor = _peer1.ToPeerDescriptorWithRoundedTime(true, typeof(FakeCommand));
-            _repository.AddOrUpdatePeer(peerDescriptor);
-            _repository.AddDynamicSubscriptionsForTypes(peerDescriptor.PeerId, peerDescriptor.TimestampUtc.Value, new[] { CreateSubscriptionsForType<int>() });
-
-			_repository.RemovePeer(peerDescriptor.PeerId);
-
-            _repository.Get(peerDescriptor.PeerId).ShouldBeNull();
-            var retrievedSubscriptions = DataContext.DynamicSubscriptions
-                                                    .SetConsistencyLevel(ConsistencyLevel.LocalQuorum)
-                                                    .Where(sub => sub.UselessKey == false && sub.PeerId == peerDescriptor.PeerId.ToString())
-                                                    .Execute();
-			retrievedSubscriptions.ShouldBeEmpty();
-        }
-
-        [Test]
-		public void should_not_add_dynamic_subscriptions_using_outdated_add_command()
-        {
-            var pastPeerDescriptor = _peer1.ToPeerDescriptorWithRoundedTime(true, typeof(FakeCommand));
-			pastPeerDescriptor.TimestampUtc = SystemDateTime.UtcNow.AddMinutes(-1).RoundToMillisecond();
-            var presentPeerDescriptor = _peer1.ToPeerDescriptorWithRoundedTime(true, typeof(FakeCommand));
-			_repository.AddOrUpdatePeer(presentPeerDescriptor);
-
-            _repository.RemoveDynamicSubscriptionsForTypes(presentPeerDescriptor.PeerId, presentPeerDescriptor.TimestampUtc.Value, new[] { MessageUtil.GetTypeId(typeof(int)) });
-            _repository.AddDynamicSubscriptionsForTypes(pastPeerDescriptor.PeerId, pastPeerDescriptor.TimestampUtc.Value, new[] { CreateSubscriptionsForType<int>() });
-
-            var fetched = _repository.Get(presentPeerDescriptor.Peer.Id);
-            fetched.Subscriptions.ShouldEqual(new[] { CreateSubscriptionFor<FakeCommand>() });
-        }
-
-        [Test]
-        public void should_not_remove_dynamic_subscriptions_using_outdated_delete_command()
-        {
-            var pastPeerDescriptor = _peer1.ToPeerDescriptorWithRoundedTime(true, typeof(FakeCommand));
-            pastPeerDescriptor.TimestampUtc = SystemDateTime.UtcNow.AddMinutes(-1).RoundToMillisecond();
-            var presentPeerDescriptor = _peer1.ToPeerDescriptorWithRoundedTime(true, typeof(FakeCommand));
-            _repository.AddOrUpdatePeer(presentPeerDescriptor);
-            _repository.AddDynamicSubscriptionsForTypes(presentPeerDescriptor.PeerId, presentPeerDescriptor.TimestampUtc.Value, new[] { CreateSubscriptionsForType<int>() });
-
-            _repository.AddDynamicSubscriptionsForTypes(presentPeerDescriptor.PeerId, presentPeerDescriptor.TimestampUtc.Value, new[] { CreateSubscriptionsForType<int>() });
-            _repository.RemoveDynamicSubscriptionsForTypes(pastPeerDescriptor.PeerId, pastPeerDescriptor.TimestampUtc.Value, new[] { MessageUtil.GetTypeId(typeof(int)) });
-            
-
-            var fetched = _repository.Get(presentPeerDescriptor.Peer.Id);
-            fetched.Subscriptions.ShouldEqual(new[]
-            {
-                CreateSubscriptionFor<FakeCommand>(),
-                CreateSubscriptionFor<int>()
-            });
-        }
-
-        [Test]
-        public void should_get_a_peer_with_no_subscriptions_using_GetPeers()
-        {
-            var peerDescriptor = _peer1.ToPeerDescriptorWithRoundedTime(true);
-
-            _repository.AddOrUpdatePeer(peerDescriptor);
-
-            var peerFetched = _repository.GetPeers().ExpectedSingle();
-            peerFetched.ShouldHaveSamePropertiesAs(peerDescriptor);
-        }
-
-        [Test]
-        public void parts_should_stay_in_order()
-        {
-            var peerDescriptor = _peer1.ToPeerDescriptorWithRoundedTime(true);
-            var random = new Random();
-            var bindingKeyTokens = Enumerable.Range(1, 100).Select(i => random.Next().ToString()).ToArray();
-            _repository.AddOrUpdatePeer(peerDescriptor);
-
-            _repository.AddDynamicSubscriptionsForTypes(peerDescriptor.PeerId, peerDescriptor.TimestampUtc.Value, new[] { CreateSubscriptionsForType<int>(new BindingKey(bindingKeyTokens)) });
-
-            var fetched = _repository.Get(peerDescriptor.Peer.Id);
-            fetched.Subscriptions.ShouldEqual(new[] { CreateSubscriptionFor<int>(bindingKeyTokens) });
-        }
-
-        [Test]
-        public void removing_a_dynamic_subscription_doesnt_remove_static_subscription()
-        {
-            var peerDescriptor = _peer1.ToPeerDescriptorWithRoundedTime(true, typeof(FakeCommand));
-            _repository.AddOrUpdatePeer(peerDescriptor);
-
-            _repository.RemoveDynamicSubscriptionsForTypes(peerDescriptor.PeerId, peerDescriptor.TimestampUtc.Value, new[] { MessageUtil.GetTypeId(typeof(FakeCommand)) });
-
-            var fetched = _repository.Get(peerDescriptor.Peer.Id);
-            fetched.ShouldHaveSamePropertiesAs(peerDescriptor);
-        }
-
-        [Test]
-        public void should_deduplicate_dynamic_subscriptions_and_static_subscriptions()
-        {
-            var peerDescriptor = _peer1.ToPeerDescriptorWithRoundedTime(true, typeof(FakeCommand));
-            _repository.AddOrUpdatePeer(peerDescriptor);
-
-            _repository.AddDynamicSubscriptionsForTypes(peerDescriptor.PeerId, peerDescriptor.TimestampUtc.Value, new[] { CreateSubscriptionsForType<FakeCommand>(), CreateSubscriptionsForType<FakeCommand>() });
-
-            var fetched = _repository.Get(peerDescriptor.Peer.Id);
-            fetched.Subscriptions.ShouldEqual(new[] { CreateSubscriptionFor<FakeCommand>() });
-        }
-
-		[Test]
-        public void should_not_mixup_subscriptions_to_same_type_with_different_tokens()
-        {
-            var peerDescriptor = _peer1.ToPeerDescriptorWithRoundedTime(true, typeof(FakeCommand));
-            _repository.AddOrUpdatePeer(peerDescriptor);
-
-            _repository.AddDynamicSubscriptionsForTypes(peerDescriptor.PeerId, peerDescriptor.TimestampUtc.Value, new[] { CreateSubscriptionsForType<FakeCommand>(new BindingKey("bli"), new BindingKey("bla")) });
-
-            var fetched = _repository.Get(peerDescriptor.Peer.Id);
-            fetched.Subscriptions.ShouldEqual(new[]
-            {
-                CreateSubscriptionFor<FakeCommand>(),
-                CreateSubscriptionFor<FakeCommand>("bli"),
-                CreateSubscriptionFor<FakeCommand>("bla")
-            });
-        }
-
-        [Test]
-        public void should_not_erase_the_dynamic_subscriptions_of_a_peer_on_update()
-        {
-            var peerDescriptor = _peer1.ToPeerDescriptorWithRoundedTime(true, typeof(FakeCommand));
-            _repository.AddDynamicSubscriptionsForTypes(peerDescriptor.PeerId, peerDescriptor.TimestampUtc.Value, new[] { CreateSubscriptionsForType<int>() });
-
-            _repository.AddOrUpdatePeer(peerDescriptor);
-
-            var expectedPeerDescriptor = new PeerDescriptor(peerDescriptor);
-            expectedPeerDescriptor.Subscriptions = new[] { CreateSubscriptionFor<FakeCommand>(), CreateSubscriptionFor<int>() };
-            var peerFetched = _repository.Get(peerDescriptor.Peer.Id);
-            peerFetched.ShouldHaveSamePropertiesAs(expectedPeerDescriptor);
-        }
-
-        [Test]
-        public void should_get_dynamic_subscriptions_in_GetPeers()
-        {
-            var peerDescriptor = _peer1.ToPeerDescriptorWithRoundedTime(true, typeof(FakeCommand));
-            _repository.AddOrUpdatePeer(peerDescriptor);
-
-            _repository.AddDynamicSubscriptionsForTypes(peerDescriptor.PeerId, peerDescriptor.TimestampUtc.Value, new[] { CreateSubscriptionsForType<int>() });
-
-            var fetched = _repository.GetPeers().ExpectedSingle();
-            fetched.Subscriptions.ShouldEqual(new[]
-            {
-                CreateSubscriptionFor<FakeCommand>(),
-                CreateSubscriptionFor<int>()
-            });
-        }
-
-        [Test]
-        public void should_not_get_dynamic_subscriptions_in_GetPeers_if_called_with_proper_flag()
-        {
-            var peerDescriptor = _peer1.ToPeerDescriptorWithRoundedTime(true, typeof(FakeCommand));
-            _repository.AddOrUpdatePeer(peerDescriptor);
-
-            _repository.AddDynamicSubscriptionsForTypes(peerDescriptor.PeerId, peerDescriptor.TimestampUtc.Value, new[] { CreateSubscriptionsForType<int>() });
-
-            var fetched = _repository.GetPeers(loadDynamicSubscriptions: false).ExpectedSingle();
-            fetched.Subscriptions.ShouldEqual(new[]
-            {
-                CreateSubscriptionFor<FakeCommand>()
-            });   
-        }
-
-        [Test]
-        public void should_handle_dynamic_subscriptions_with_empty_binding_key_aside_static_one()
-        {
-            var peerDescriptor = _peer1.ToPeerDescriptor(true, typeof(FakeCommand));
-            _repository.AddOrUpdatePeer(peerDescriptor);
-
-            _repository.AddDynamicSubscriptionsForTypes(peerDescriptor.PeerId, peerDescriptor.TimestampUtc.Value, new[] { CreateSubscriptionsForType<FakeCommand>() });
-
-            var fetched = _repository.Get(peerDescriptor.Peer.Id);
-            fetched.Subscriptions.ShouldEqual(new[]
-            {
-                CreateSubscriptionFor<FakeCommand>(),
-            });
-        }
-
-        [Test]
-        public void should_handle_dynamic_subscriptions_with_empty_binding_key_aside_specific_one()
-        {
-            var peerDescriptor = _peer1.ToPeerDescriptor(true, typeof(FakeCommand));
-            _repository.AddOrUpdatePeer(peerDescriptor);
-
-            _repository.AddDynamicSubscriptionsForTypes(peerDescriptor.PeerId, peerDescriptor.TimestampUtc.Value, new[] { CreateSubscriptionsForType<FakeCommand>(BindingKey.Empty, new BindingKey("toto")) });
-
-            var fetched = _repository.Get(peerDescriptor.Peer.Id);
-            fetched.Subscriptions.ShouldEqual(new[]
-            {
-                CreateSubscriptionFor<FakeCommand>(),
-                CreateSubscriptionFor<FakeCommand>("toto"),
-            });
-        }
-
-        [Test]
-        public void should_remove_dynamic_subscriptions_for_peer()
-        {
-            var firstPeer = _peer1.ToPeerDescriptor(true, typeof(FakeCommand));
-            var secondPeer = _peer2.ToPeerDescriptor(true, typeof(FakeCommand));
-            _repository.AddOrUpdatePeer(firstPeer);
-            _repository.AddOrUpdatePeer(secondPeer);
-            _repository.AddDynamicSubscriptionsForTypes(firstPeer.PeerId, DateTime.UtcNow, new[] { CreateSubscriptionsForType<FakeCommand>(new BindingKey("toto")) });
-            _repository.AddDynamicSubscriptionsForTypes(secondPeer.PeerId, DateTime.UtcNow, new[] { CreateSubscriptionsForType<FakeCommand>(new BindingKey("toto")) });
-
-            _repository.RemoveAllDynamicSubscriptionsForPeer(secondPeer.PeerId);
-
-            var fetched = _repository.GetPeers().ToList();
-            fetched.Count.ShouldEqual(2);
-            var untouchedPeer = fetched.Single(peer => peer.PeerId == firstPeer.PeerId);
-            var peerWithTruncatedSubscriptions = fetched.Single(peer => peer.PeerId == secondPeer.PeerId);
-            untouchedPeer.Subscriptions.ShouldEqual(new[]
-            {
-                CreateSubscriptionFor<FakeCommand>(),
-                CreateSubscriptionFor<FakeCommand>("toto")
-            });
-            peerWithTruncatedSubscriptions.Subscriptions.ShouldEqual(new[]
-            {
-                CreateSubscriptionFor<FakeCommand>()
-            });
-        }
-    }
-}
-

+ 0 - 173
src/Abc.Zebus.Directory.Cassandra.Tests/Storage/CqlPeerRepositoryTests.cs

@@ -1,173 +0,0 @@
-using Abc.Zebus.Directory.Cassandra.Cql;
-using Abc.Zebus.Directory.Cassandra.Storage;
-using Abc.Zebus.Directory.Cassandra.Tests.Cql;
-using Abc.Zebus.Directory.Tests;
-using Abc.Zebus.Testing;
-using Abc.Zebus.Testing.Extensions;
-using Abc.Zebus.Util;
-using NUnit.Framework;
-using System;
-using System.Linq;
-using System.Threading;
-
-namespace Abc.Zebus.Directory.Cassandra.Tests.Storage
-{
-    [TestFixture]
-    public partial class CqlPeerRepositoryTests : CqlTestFixture<DirectoryDataContext, ICassandraConfiguration>
-    {
-        private CqlPeerRepository _repository;
-        private Peer _peer1;
-        private Peer _peer2;
-
-        protected override string Hosts { get { return "cassandra-test-host"; } }
-
-        protected override string LocalDataCenter { get { return "Paris-CEN"; } }
-        
-        [SetUp]
-        protected void Setup()
-        {
-            _repository = new CqlPeerRepository(DataContext);
-            _peer1 = new Peer(new PeerId("Abc.Peer.1"), "tcp://endpoint:123");
-            _peer2 = new Peer(new PeerId("Abc.Peer.2"), "tcp://endpoint:456");
-        }
-
-        [Test]
-        public void should_insert_and_get_peer()
-        {
-            var peerDescriptor = _peer1.ToPeerDescriptorWithRoundedTime(true, typeof(FakeCommand));
-            peerDescriptor.HasDebuggerAttached = true;
-            var otherDescriptor = _peer2.ToPeerDescriptorWithRoundedTime(false, typeof(FakeCommand), typeof(FakeRoutableCommand));
-
-            _repository.AddOrUpdatePeer(peerDescriptor);
-            _repository.AddOrUpdatePeer(otherDescriptor);
-
-            var peerFetched = _repository.Get(peerDescriptor.Peer.Id);
-            var otherPeerFetched = _repository.Get(otherDescriptor.Peer.Id);
-            peerFetched.ShouldHaveSamePropertiesAs(peerDescriptor);
-            otherPeerFetched.ShouldHaveSamePropertiesAs(otherDescriptor);
-        }
-
-        [Test]
-        public void should_return_null_when_peer_does_not_exists()
-        {
-            var fetched = _repository.Get(new PeerId("PeerId"));
-            
-            fetched.ShouldBeNull();
-        }
-
-        [Test]
-        public void should_get_all_peers()
-        {
-            var peerDescriptor1 = _peer1.ToPeerDescriptorWithRoundedTime(true, typeof(string));
-            peerDescriptor1.HasDebuggerAttached = true;
-            _repository.AddOrUpdatePeer(peerDescriptor1);
-
-            var peerDescriptor2 = _peer2.ToPeerDescriptorWithRoundedTime(true, typeof(int));
-            _repository.AddOrUpdatePeer(peerDescriptor2);
-
-            var fetchedPeers = _repository.GetPeers().ToList();
-
-            var fetchedPeer1 = fetchedPeers.Single(x => x.Peer.Id == peerDescriptor1.Peer.Id);
-            fetchedPeer1.ShouldHaveSamePropertiesAs(peerDescriptor1);
-            var fetchedPeer2 = fetchedPeers.Single(x => x.Peer.Id == peerDescriptor2.Peer.Id);
-            fetchedPeer2.ShouldHaveSamePropertiesAs(peerDescriptor2);
-        }
-
-        [Test]
-        public void should_update_peer()
-        {
-            var peerDescriptor = _peer1.ToPeerDescriptorWithRoundedTime(true, typeof(string));
-            _repository.AddOrUpdatePeer(peerDescriptor);
-
-            var updatedPeer = _peer1.ToPeerDescriptorWithRoundedTime(false, typeof(int));
-            updatedPeer.TimestampUtc = updatedPeer.TimestampUtc.Value.AddMilliseconds(1); // Ensures that the timestamps are different to prevent a conflict in Cassandra
-            _repository.AddOrUpdatePeer(updatedPeer);
-
-            var fetchedPeers = _repository.GetPeers();
-            var fetchedPeer = fetchedPeers.Single();
-            fetchedPeer.ShouldHaveSamePropertiesAs(updatedPeer);
-        }
-
-        [Test]
-        public void should_not_override_peer_with_old_version()
-        {
-            var descriptor1 = _peer1.ToPeerDescriptorWithRoundedTime(true, typeof(FakeCommand));
-            descriptor1.TimestampUtc = SystemDateTime.UtcNow.AddMinutes(1).RoundToMillisecond();
-            _repository.AddOrUpdatePeer(descriptor1);
-
-            var descriptor2 = _peer1.ToPeerDescriptorWithRoundedTime(true);
-            _repository.AddOrUpdatePeer(descriptor2);
-
-            var fetched = _repository.Get(_peer1.Id);
-            fetched.TimestampUtc.ShouldEqual(descriptor1.TimestampUtc);
-            fetched.Subscriptions.ShouldBeEquivalentTo(descriptor1.Subscriptions);
-        }
-
-        [Test]
-        public void should_remove_peer()
-        {
-            var peerDescriptor = _peer1.ToPeerDescriptorWithRoundedTime(true, typeof(string));
-
-            _repository.AddOrUpdatePeer(peerDescriptor);
-            _repository.RemovePeer(peerDescriptor.Peer.Id);
-
-            var fetched = _repository.Get(peerDescriptor.Peer.Id);
-            fetched.ShouldBeNull();
-        }
-
-        [Test]
-        public void should_readd_peer_after_removing_it()
-        {
-            var peerDescriptor = _peer1.ToPeerDescriptorWithRoundedTime(true, typeof(string));
-            peerDescriptor.TimestampUtc = GetUnspecifiedKindUtcNow();
-
-            _repository.AddOrUpdatePeer(peerDescriptor);
-            _repository.RemovePeer(peerDescriptor.Peer.Id);
-            peerDescriptor.TimestampUtc = peerDescriptor.TimestampUtc.Value.Add(1.Second());
-            _repository.AddOrUpdatePeer(peerDescriptor);
-
-            var fetched = _repository.Get(peerDescriptor.Peer.Id);
-            fetched.ShouldNotBeNull();
-        }
-
-        private static DateTime GetUnspecifiedKindUtcNow()
-        {
-            return new DateTime(SystemDateTime.UtcNow.RoundToMillisecond().Ticks, DateTimeKind.Unspecified);
-        }
-
-        [Test]
-        public void should_insert_a_peer_with_no_timestamp_that_was_previously_deleted()
-        {
-            var descriptor = _peer1.ToPeerDescriptorWithRoundedTime(true);
-            descriptor.TimestampUtc = DateTime.UtcNow;
-            _repository.AddOrUpdatePeer(descriptor);
-            _repository.RemovePeer(descriptor.PeerId);
-
-            Thread.Sleep(1);
-
-            descriptor = _peer1.ToPeerDescriptorWithRoundedTime(true);
-            descriptor.TimestampUtc = null;
-
-            _repository.AddOrUpdatePeer(descriptor);
-
-            var fetched = _repository.Get(_peer1.Id);
-            fetched.ShouldNotBeNull();
-        }
-
-        [Test]
-        public void should_mark_peer_as_responding()
-        {
-            var descriptor = _peer1.ToPeerDescriptorWithRoundedTime(true);
-            descriptor.TimestampUtc = DateTime.UtcNow;
-            _repository.AddOrUpdatePeer(descriptor);
-
-            _repository.SetPeerResponding(_peer1.Id, false);
-            _repository.Get(_peer1.Id).Peer.IsResponding.ShouldBeFalse();
-            _repository.GetPeers().ExpectedSingle().Peer.IsResponding.ShouldBeFalse();
-
-            _repository.SetPeerResponding(_peer1.Id, true);
-            _repository.Get(_peer1.Id).Peer.IsResponding.ShouldBeTrue();
-            _repository.GetPeers().ExpectedSingle().Peer.IsResponding.ShouldBeTrue();
-        }
-    }
-}

+ 0 - 32
src/Abc.Zebus.Directory.Cassandra.Tests/Storage/StorageConvertionExtensionsTests.cs

@@ -1,32 +0,0 @@
-using System;
-using Abc.Zebus.Directory.Cassandra.Storage;
-using Abc.Zebus.Testing.Extensions;
-using NUnit.Framework;
-
-namespace Abc.Zebus.Directory.Cassandra.Tests.Storage
-{
-    public class StorageConvertionExtensionsTests
-    {
-        [Test]
-        public void should_return_a_storage_peer_with_its_timestamp_kind_set_to_utc()
-        {
-            var unspecifiedKindUtcNow = new DateTime(DateTime.UtcNow.Ticks, DateTimeKind.Unspecified);
-            var peerDescriptor = new PeerDescriptor(new PeerId("Abc.Titi.0"), "tcp://toto:123", false, true, true, unspecifiedKindUtcNow);
-
-            var storagePeer = peerDescriptor.ToStoragePeer();
-
-            storagePeer.TimestampUtc.Kind.ShouldEqual(DateTimeKind.Utc);
-        }
-
-        [Test]
-        public void should_return_a_peer_descriptor_with_its_timestamp_kind_set_to_utc()
-        {
-            var unspecifiedKindUtcNow = new DateTime(DateTime.UtcNow.Ticks, DateTimeKind.Unspecified);
-            var storagePeer = new StoragePeer { TimestampUtc = unspecifiedKindUtcNow, StaticSubscriptionsBytes = new byte[0]};
-
-            var peerDescriptor = storagePeer.ToPeerDescriptor(new Subscription[0]);
-
-            peerDescriptor.TimestampUtc.Value.Kind.ShouldEqual(DateTimeKind.Utc);
-        }
-    }
-}

+ 0 - 6
src/Abc.Zebus.Directory.Cassandra.Tests/packages.config

@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
-  <package id="CassandraCSharpDriver" version="2.0.3" targetFramework="net45" />
-  <package id="CassandraEntityContext" version="2.0.3" targetFramework="net45" />
-  <package id="lz4net" version="1.0.3.93" targetFramework="net45" />
-</packages>

+ 0 - 105
src/Abc.Zebus.Directory.Cassandra/Abc.Zebus.Directory.Cassandra.csproj

@@ -1,105 +0,0 @@
-<?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>{8F786F88-CB54-43DC-927F-65B75795EC60}</ProjectGuid>
-    <OutputType>Library</OutputType>
-    <AppDesignerFolder>Properties</AppDesignerFolder>
-    <RootNamespace>Abc.Zebus.Directory.Cassandra</RootNamespace>
-    <AssemblyName>Abc.Zebus.Directory.Cassandra</AssemblyName>
-    <TargetFrameworkVersion>v4.5</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="Cassandra, Version=2.0.3.0, Culture=neutral, processorArchitecture=MSIL">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\packages\CassandraCSharpDriver.2.0.3\lib\net40\Cassandra.dll</HintPath>
-    </Reference>
-    <Reference Include="Cassandra.Data, Version=2.0.3.0, Culture=neutral, processorArchitecture=MSIL">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\packages\CassandraCSharpDriver.2.0.3\lib\net40\Cassandra.Data.dll</HintPath>
-    </Reference>
-    <Reference Include="Cassandra.Data.EntityContext">
-      <HintPath>..\packages\CassandraEntityContext.2.0.3\lib\net40\Cassandra.Data.EntityContext.dll</HintPath>
-    </Reference>
-    <Reference Include="Cassandra.Data.Linq">
-      <HintPath>..\packages\CassandraCSharpDriver.2.0.3\lib\net40\Cassandra.Data.Linq.dll</HintPath>
-      <Private>True</Private>
-    </Reference>
-    <Reference Include="LZ4">
-      <HintPath>..\packages\lz4net.1.0.3.93\lib\net40-client\LZ4.dll</HintPath>
-    </Reference>
-    <Reference Include="protobuf-net, Version=2.0.0.622, Culture=neutral, PublicKeyToken=257b51d87d2e4d67, processorArchitecture=MSIL">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\..\lib\protobuf\protobuf-net.dll</HintPath>
-    </Reference>
-    <Reference Include="StructureMap">
-      <HintPath>..\..\lib\structuremap\StructureMap.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="..\SharedAssemblyInfo.cs">
-      <Link>Properties\SharedAssemblyInfo.cs</Link>
-    </Compile>
-    <Compile Include="..\SharedVersionInfo.cs">
-      <Link>Properties\SharedVersionInfo.cs</Link>
-    </Compile>
-    <Compile Include="Cql\CassandraCqlSessionManager.cs" />
-    <Compile Include="Cql\CqlDataContext.cs" />
-    <Compile Include="Cql\ICassandraConfiguration.cs" />
-    <Compile Include="Properties\AssemblyInfo.cs" />
-    <Compile Include="Storage\CqlPeerRepository.cs" />
-    <Compile Include="Storage\DirectoryDataContext.cs" />
-    <Compile Include="Storage\ExtendContextTable.cs" />
-    <Compile Include="Storage\StorageConvertionExtensions.cs" />
-    <Compile Include="Storage\StoragePeer.cs" />
-    <Compile Include="Storage\StorageSubscription.cs" />
-  </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\Abc.Zebus.Directory\Abc.Zebus.Directory.csproj">
-      <Project>{ee6730d9-6a21-46a5-ae3f-af78060b6ea3}</Project>
-      <Name>Abc.Zebus.Directory</Name>
-    </ProjectReference>
-    <ProjectReference Include="..\Abc.Zebus\Abc.Zebus.csproj">
-      <Project>{1f4c6307-6113-40d5-bf42-4b6bf5df13b2}</Project>
-      <Name>Abc.Zebus</Name>
-    </ProjectReference>
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="packages.config" />
-  </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>

+ 0 - 68
src/Abc.Zebus.Directory.Cassandra/Cql/CassandraCqlSessionManager.cs

@@ -1,68 +0,0 @@
-using System;
-using System.Collections.Concurrent;
-using System.Linq;
-using Cassandra;
-using StructureMap;
-
-namespace Abc.Zebus.Directory.Cassandra.Cql
-{
-    [PluginFamily(IsSingleton = true)]
-    public class CassandraCqlSessionManager : IDisposable
-    {
-        private readonly ConcurrentDictionary<string, Cluster> _clusters = new ConcurrentDictionary<string, Cluster>();
-
-        private readonly ConcurrentDictionary<Cluster, ISession> _sessions = new ConcurrentDictionary<Cluster, ISession>();
-
-        private ISession GetOrCreateSession(Cluster cluster, string keySpace)
-        {
-            ISession session;
-            if (!_sessions.TryGetValue(cluster, out session))
-            {
-                session = cluster.Connect(keySpace);
-                _sessions.TryAdd(cluster, session);
-            }
-            return session;
-        }
-
-        private Cluster GetOrCreateCluster(string hosts, string defaultKeySpace, TimeSpan queryTimeout, string localDataCenter)
-        {
-            Cluster cluster;
-            if (!_clusters.TryGetValue(hosts, out cluster))
-            {
-                var contactPoints = hosts.Split(' ').ToArray();
-
-                cluster = Cluster
-                    .Builder()
-                    .WithDefaultKeyspace(defaultKeySpace)
-                    .WithQueryTimeout((int)queryTimeout.TotalMilliseconds)
-                    .AddContactPoints(contactPoints)
-                    .WithLoadBalancingPolicy(new DCAwareRoundRobinPolicy(localDataCenter))
-                    .Build();
-
-                _clusters.TryAdd(hosts, cluster);
-            }
-            return cluster;
-        }
-
-        public void Dispose()
-        {
-            foreach (var session in _sessions.Values)
-                session.Dispose();
-
-            foreach (var cluster in _clusters.Values)
-                cluster.Dispose();
-        }
-
-        public ISession GetSession(ICassandraConfiguration configuration)
-        {
-            var cluster = GetOrCreateCluster(configuration.Hosts, configuration.KeySpace, configuration.QueryTimeout, configuration.LocalDataCenter);
-
-            return GetOrCreateSession(cluster, configuration.KeySpace);
-        }
-
-        public Cluster GetCluster(ICassandraConfiguration configuration)
-        {
-            return GetOrCreateCluster(configuration.Hosts, configuration.KeySpace, configuration.QueryTimeout, configuration.LocalDataCenter);
-        }
-    }
-}

+ 0 - 27
src/Abc.Zebus.Directory.Cassandra/Cql/CqlDataContext.cs

@@ -1,27 +0,0 @@
-using Cassandra;
-using Cassandra.Data.EntityContext;
-using Cassandra.Data.Linq;
-
-namespace Abc.Zebus.Directory.Cassandra.Cql
-{
-    public abstract class CqlDataContext<TConfig> : Context where TConfig : ICassandraConfiguration
-    {
-        public CqlDataContext(CassandraCqlSessionManager sessionManager, TConfig cassandraConfiguration)
-            : this(CreateSession(sessionManager, cassandraConfiguration))
-        {
-        }
-
-        private CqlDataContext(ISession session)
-            : base(session)
-        {
-            Session = session;
-        }
-
-        public ISession Session { get; private set; }
-
-        protected static ISession CreateSession(CassandraCqlSessionManager sessionManager, ICassandraConfiguration cassandraConfiguration)
-        {
-            return sessionManager.GetSession(cassandraConfiguration);
-        }
-    }
-}

+ 0 - 29
src/Abc.Zebus.Directory.Cassandra/Cql/ICassandraConfiguration.cs

@@ -1,29 +0,0 @@
-using System;
-
-namespace Abc.Zebus.Directory.Cassandra.Cql
-{
-    public interface ICassandraConfiguration
-    {
-        /// <summary>
-        /// The space separated list of hosts to connect to
-        /// </summary>
-        string Hosts { get; }
-
-        /// <summary>
-        /// The Keyspace where the Directory schema is stored
-        /// </summary>
-        string KeySpace { get; }
-
-        /// <summary>
-        /// Time after which a query will be retried on another node
-        /// </summary>
-        TimeSpan QueryTimeout { get; }
-
-        /// <summary>
-        /// Name of the local datacenter, this allows the CQL driver to favor local nodes
-        /// (since the nodes provides in Hosts are only contact nodes and that the driver
-        /// will discover the rest of the cluster)
-        /// </summary>
-        string LocalDataCenter { get; }
-    }
-}

+ 0 - 7
src/Abc.Zebus.Directory.Cassandra/Properties/AssemblyInfo.cs

@@ -1,7 +0,0 @@
-using System.Reflection;
-using System.Runtime.InteropServices;
-
-
-[assembly: AssemblyTitle("Abc.Zebus.Directory.Cassandra")]
-[assembly: ComVisible(false)]
-[assembly: Guid("e6b5f9c8-96c9-4260-b79b-9a54808647af")]

+ 0 - 148
src/Abc.Zebus.Directory.Cassandra/Storage/CqlPeerRepository.cs

@@ -1,148 +0,0 @@
-using Abc.Zebus.Directory.Cassandra.Cql;
-using Abc.Zebus.Directory.Storage;
-using Cassandra;
-using Cassandra.Data.Linq;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace Abc.Zebus.Directory.Cassandra.Storage
-{
-    public class CqlPeerRepository : IPeerRepository
-    {
-        private readonly DirectoryDataContext _dataContext;
-
-        public CqlPeerRepository(DirectoryDataContext dataContext)
-        {
-            _dataContext = dataContext;
-        }
-
-        public PeerDescriptor Get(PeerId peerId)
-        {
-            var peerDynamicSubscriptions = _dataContext.DynamicSubscriptions
-                                                       .SetConsistencyLevel(ConsistencyLevel.LocalQuorum)
-                                                       .Where(sub => sub.UselessKey == false && sub.PeerId == peerId.ToString())
-                                                       .Execute()
-                                                       .SelectMany(sub => sub.ToSubscriptionsForType().ToSubscriptions());
-
-            return _dataContext.StoragePeers
-                               .SetConsistencyLevel(ConsistencyLevel.LocalQuorum)
-                               .Where(peer => peer.UselessKey == false && peer.PeerId == peerId.ToString())
-                               .Execute()
-                               .FirstOrDefault()
-                               .ToPeerDescriptor(peerDynamicSubscriptions);
-        }
-
-        public IEnumerable<PeerDescriptor> GetPeers(bool loadDynamicSubscriptions = true)
-        {
-            if (!loadDynamicSubscriptions)
-            {
-                return _dataContext.StoragePeers
-                   .SetConsistencyLevel(ConsistencyLevel.LocalQuorum)
-                   .Where(peer => peer.UselessKey == false)
-                   .Execute()
-                   .Select(peer => peer.ToPeerDescriptor())
-                   .ToList();
-            }
-
-            var dynamicSubscriptionsByPeer = _dataContext.DynamicSubscriptions
-                                                         .SetConsistencyLevel(ConsistencyLevel.LocalQuorum)
-                                                         .Where(sub => sub.UselessKey == false)
-                                                         .Execute()
-                                                         .SelectMany(sub => sub.ToSubscriptionsForType().ToSubscriptions().Select(s => new { sub.PeerId, Subscription = s }))
-                                                         .ToLookup(peerSub => peerSub.PeerId, peerSub=> peerSub.Subscription);
-                                                         
-
-            return _dataContext.StoragePeers
-                               .SetConsistencyLevel(ConsistencyLevel.LocalQuorum)
-                               .Where(peer => peer.UselessKey == false)
-                               .Execute()
-                               .Select(peer => peer.ToPeerDescriptor(dynamicSubscriptionsByPeer[peer.PeerId]))
-                               .ToList();
-        }
-
-        public void AddOrUpdatePeer(PeerDescriptor peerDescriptor)
-        {
-            var storagePeer = peerDescriptor.ToStoragePeer();
-            _dataContext.StoragePeers
-                        .CreateInsert(storagePeer)
-                        .SetConsistencyLevel(ConsistencyLevel.LocalQuorum)
-                        .SetTimestamp(storagePeer.TimestampUtc)
-                        .Execute();
-        }
-
-        public void RemovePeer(PeerId peerId)
-        {
-            var now = DateTime.UtcNow;
-            _dataContext.StoragePeers
-                        .SetConsistencyLevel(ConsistencyLevel.LocalQuorum)
-                        .Where(peer => peer.UselessKey == false && peer.PeerId == peerId.ToString())
-                        .Delete()
-                        .SetTimestamp(now)
-                        .Execute();
-            _dataContext.DynamicSubscriptions
-                        .SetConsistencyLevel(ConsistencyLevel.LocalQuorum)
-                        .Where(sub => sub.UselessKey == false && sub.PeerId == peerId.ToString())
-                        .Delete()
-                        .SetTimestamp(now)
-                        .Execute();
-        }
-
-        public void SetPeerResponding(PeerId peerId, bool isResponding)
-        {
-            _dataContext.StoragePeers
-                        .SetConsistencyLevel(ConsistencyLevel.LocalQuorum)
-                        .Where(peer => peer.UselessKey == false && peer.PeerId == peerId.ToString())
-                        .Select(peer => new StoragePeer { IsResponding = isResponding })
-                        .Update()
-                        .SetTimestamp(DateTime.UtcNow)
-                        .Execute();
-
-        }
-
-        public void AddDynamicSubscriptionsForTypes(PeerId peerId, DateTime timestampUtc, SubscriptionsForType[] subscriptionsForTypes)
-        {
-            if (subscriptionsForTypes == null)
-                return;
-            var batch = _dataContext.Session.CreateBatch();
-            batch.SetConsistencyLevel(ConsistencyLevel.LocalQuorum);
-
-            foreach (var subscription in subscriptionsForTypes)
-            {
-                batch.Append(_dataContext.DynamicSubscriptions
-                                         .CreateInsert(subscription.ToStorageSubscription(peerId))
-                                         .SetTimestamp(timestampUtc));
-            }
-            batch.Execute();
-        }
-
-        public void RemoveDynamicSubscriptionsForTypes(PeerId peerId, DateTime timestampUtc, MessageTypeId[] messageTypeIds)
-        {
-            if (messageTypeIds == null)
-                return;
-            var batch = _dataContext.Session.CreateBatch();
-            batch.SetConsistencyLevel(ConsistencyLevel.LocalQuorum);
-
-            foreach (var messageTypeId in messageTypeIds)
-            {
-                var deleteQuery = _dataContext.DynamicSubscriptions
-                                              .Where(sub => sub.UselessKey == false && sub.PeerId == peerId.ToString() && sub.MessageTypeId == messageTypeId.FullName)
-                                              .Delete()
-                                              .SetTimestamp(timestampUtc);
-                batch.Append(deleteQuery);
-            }
-            
-            batch.Execute();
-        }
-
-        public void RemoveAllDynamicSubscriptionsForPeer(PeerId peerId)
-        {
-            _dataContext.DynamicSubscriptions
-                        .SetConsistencyLevel(ConsistencyLevel.LocalQuorum)
-                        .Where(sub => sub.UselessKey == false && sub.PeerId == peerId.ToString())
-                        .Delete()
-                        .SetTimestamp(DateTime.UtcNow)
-                        .Execute();
-        }
-    }
-}

+ 0 - 20
src/Abc.Zebus.Directory.Cassandra/Storage/DirectoryDataContext.cs

@@ -1,20 +0,0 @@
-using Abc.Zebus.Directory.Cassandra.Cql;
-using Cassandra.Data.EntityContext;
-using Cassandra.Data.Linq;
-
-namespace Abc.Zebus.Directory.Cassandra.Storage
-{
-    public class DirectoryDataContext : CqlDataContext<ICassandraConfiguration>
-    {
-        public DirectoryDataContext(CassandraCqlSessionManager sessionManager, ICassandraConfiguration cassandraConfiguration)
-            : base(sessionManager, cassandraConfiguration)
-        {
-            StoragePeers = AddTable<StoragePeer>();
-            DynamicSubscriptions = AddTable<StorageSubscription>();
-        }
-
-        public ContextTable<StorageSubscription> DynamicSubscriptions { get; set; }
-
-        public ContextTable<StoragePeer> StoragePeers { get; set; }
-    }
-}

+ 0 - 14
src/Abc.Zebus.Directory.Cassandra/Storage/ExtendContextTable.cs

@@ -1,14 +0,0 @@
-using Cassandra.Data.EntityContext;
-using Cassandra.Data.Linq;
-
-namespace Abc.Zebus.Directory.Cassandra.Storage
-{
-    // Is necessary because Insert from ContextTable hides Insert from Table (https://datastax-oss.atlassian.net/browse/CSHARP-137)
-    public static class ExtendContextTable
-    {
-        public static CqlInsert<TEntity> CreateInsert<TEntity>(this ContextTable<TEntity> table, TEntity entity)
-        {
-            return ((Table<TEntity>)table).Insert(entity);
-        }
-    }
-}

+ 0 - 115
src/Abc.Zebus.Directory.Cassandra/Storage/StorageConvertionExtensions.cs

@@ -1,115 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using Abc.Zebus.Routing;
-using ProtoBuf;
-
-namespace Abc.Zebus.Directory.Cassandra.Storage
-{
-    public static class StorageConvertionExtensions
-    {
-        public static StoragePeer ToStoragePeer(this PeerDescriptor peerDescriptor)
-        {
-            var timestamp = peerDescriptor.TimestampUtc.HasValue ? new DateTime(peerDescriptor.TimestampUtc.Value.Ticks, DateTimeKind.Utc) : DateTime.UtcNow;
-            return new StoragePeer
-            {
-                PeerId = peerDescriptor.PeerId.ToString(),
-                EndPoint = peerDescriptor.Peer.EndPoint,
-                HasDebuggerAttached = peerDescriptor.HasDebuggerAttached,
-                IsPersistent = peerDescriptor.IsPersistent,
-                IsUp = peerDescriptor.Peer.IsUp,
-                IsResponding = peerDescriptor.Peer.IsResponding,
-                TimestampUtc = timestamp,
-                StaticSubscriptionsBytes = SerializeSubscriptions(peerDescriptor.Subscriptions)
-            };
-        }
-
-        public static StorageSubscription ToStorageSubscription(this SubscriptionsForType subscriptionFortype, PeerId peerId)
-        {
-            return new StorageSubscription
-            {
-                PeerId = peerId.ToString(),
-                MessageTypeId = subscriptionFortype.MessageTypeId.FullName,
-                SubscriptionBindings = SerializeBindingKeys(subscriptionFortype.BindingKeys)
-            };
-        }
-
-        public static SubscriptionsForType ToSubscriptionsForType(this StorageSubscription storageSubscription)
-        {
-            return new SubscriptionsForType(new MessageTypeId(storageSubscription.MessageTypeId), DeserializeBindingKeys(storageSubscription.SubscriptionBindings));
-        }
-
-        public static PeerDescriptor ToPeerDescriptor(this StoragePeer storagePeer, IEnumerable<Subscription> peerDynamicSubscriptions)
-        {
-            if (storagePeer == null)
-                return null;
-            var staticSubscriptions = DeserializeSubscriptions(storagePeer.StaticSubscriptionsBytes);
-            var allSubscriptions = staticSubscriptions.Concat(peerDynamicSubscriptions).Distinct().ToArray();
-            return new PeerDescriptor(new PeerId(storagePeer.PeerId), storagePeer.EndPoint, storagePeer.IsPersistent, storagePeer.IsUp,
-                                      storagePeer.IsResponding, new DateTime(storagePeer.TimestampUtc.Ticks, DateTimeKind.Utc), allSubscriptions) { HasDebuggerAttached = storagePeer.HasDebuggerAttached };
-        }
-
-        public static PeerDescriptor ToPeerDescriptor(this StoragePeer storagePeer)
-        {
-            if (storagePeer == null)
-                return null;
-            var staticSubscriptions = DeserializeSubscriptions(storagePeer.StaticSubscriptionsBytes);
-            return new PeerDescriptor(new PeerId(storagePeer.PeerId), storagePeer.EndPoint, storagePeer.IsPersistent, storagePeer.IsUp,
-                                      storagePeer.IsResponding, new DateTime(storagePeer.TimestampUtc.Ticks, DateTimeKind.Utc), staticSubscriptions) { HasDebuggerAttached = storagePeer.HasDebuggerAttached };
-        }
-
-        private static byte[] SerializeSubscriptions(Subscription[] subscriptions)
-        {
-            using (var stream = new MemoryStream())
-            {
-                Serializer.Serialize(stream, subscriptions);
-                return stream.ToArray();
-            }
-        }
-
-        private static Subscription[] DeserializeSubscriptions(byte[] subscriptionsBytes)
-        {
-            return Serializer.Deserialize<Subscription[]>(new MemoryStream(subscriptionsBytes));
-        }
-
-        private static byte[] SerializeBindingKeys(BindingKey[] bindingKeys)
-        {
-            using (var memoryStream = new MemoryStream())
-            using (var binaryWriter = new BinaryWriter(memoryStream))
-            {
-                binaryWriter.Write(bindingKeys.Length);
-                for (var keyIndex = 0; keyIndex < bindingKeys.Length; keyIndex++)
-                {
-                    var bindingKey = bindingKeys[keyIndex];
-                    binaryWriter.Write(bindingKey.PartCount);
-
-                    for (var partIndex = 0; partIndex < bindingKey.PartCount; partIndex++)
-                        binaryWriter.Write(bindingKey.GetPart(partIndex));
-                }
-                return memoryStream.ToArray();
-            }
-        }
-
-        private static BindingKey[] DeserializeBindingKeys(byte[] bindingKeysBytes)
-        {
-            using (var memoryStream = new MemoryStream(bindingKeysBytes))
-            using (var binaryReader = new BinaryReader(memoryStream))
-            {
-                var bindingKeyCount = binaryReader.ReadInt32();
-                var bindingKeys = new BindingKey[bindingKeyCount];
-                for (var keyIndex = 0; keyIndex < bindingKeyCount; keyIndex++)
-                {
-                    var partsCount = binaryReader.ReadInt32();
-                    var parts = new string[partsCount];
-                    
-                    for (var partIndex = 0; partIndex < partsCount; partIndex++)
-                        parts[partIndex] = binaryReader.ReadString();
-                    
-                    bindingKeys[keyIndex] = new BindingKey(parts);
-                }
-                return bindingKeys;
-            }
-        }
-    }
-}

+ 0 - 41
src/Abc.Zebus.Directory.Cassandra/Storage/StoragePeer.cs

@@ -1,41 +0,0 @@
-using System;
-using Cassandra.Data.Linq;
-
-namespace Abc.Zebus.Directory.Cassandra.Storage
-{
-    [Table("Peers")]
-    public class StoragePeer
-    {
-        [PartitionKey]
-        public bool UselessKey { get; set; }
-
-        [ClusteringKey(0)]
-        [Column("PeerId")]
-        public string PeerId { get; set; }
-
-        [Column("EndPoint")]
-        public string EndPoint { get; set; }
-            
-        [Column("IsUp")]
-        public bool IsUp { get; set; }
-
-        [Column("IsResponding")]
-        public bool IsResponding { get; set; }
-
-        [Column("IsPersistent")]
-        public bool IsPersistent { get; set; }
-
-        [Column("TimestampUtc")]
-        public DateTime TimestampUtc { get; set; }
-
-        [Column("HasDebuggerAttached")]
-        public bool HasDebuggerAttached { get; set; }
-
-        [Column("StaticSubscriptions")]
-        public byte[] StaticSubscriptionsBytes { get; set; }
-            
-        public StoragePeer()
-        {
-        }
-    }
-}

+ 0 - 22
src/Abc.Zebus.Directory.Cassandra/Storage/StorageSubscription.cs

@@ -1,22 +0,0 @@
-using Cassandra.Data.Linq;
-
-namespace Abc.Zebus.Directory.Cassandra.Storage
-{
-    [Table("DynamicSubscriptions")]
-    public class StorageSubscription
-    {
-        [PartitionKey]
-        public bool UselessKey { get; set; }
-
-        [ClusteringKey(0)]
-        [Column("PeerId")]
-        public string PeerId { get; set; }
-
-        [ClusteringKey(1)]
-        [Column("MessageTypeId")]
-        public string MessageTypeId { get; set; }
-
-        [Column("SubscriptionBindings")]
-        public byte[] SubscriptionBindings { get; set; }
-    }
-}

+ 0 - 6
src/Abc.Zebus.Directory.Cassandra/packages.config

@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
-  <package id="CassandraCSharpDriver" version="2.0.3" targetFramework="net45" />
-  <package id="CassandraEntityContext" version="2.0.3" targetFramework="net45" />
-  <package id="lz4net" version="1.0.3.93" targetFramework="net45" />
-</packages>

+ 0 - 22
src/Abc.Zebus.Directory.Cassandra/schema_creation.cql

@@ -1,22 +0,0 @@
--- First create your Keyspace with the replication factor you want
-
-create table IF NOT EXISTS "Peers" (
-	"UselessKey" boolean,
-	"PeerId" text,
-	"EndPoint" text,
-	"IsUp" boolean,
-	"IsResponding" boolean,
-	"IsPersistent" boolean,
-	"TimestampUtc" timestamp,
-	"HasDebuggerAttached" boolean,
-	"StaticSubscriptions" blob,
-	PRIMARY KEY("UselessKey", "PeerId")
-);
-
-create table IF NOT EXISTS "DynamicSubscriptions" (
-	"UselessKey" boolean,
-	"PeerId" text,
-	"MessageTypeId" text,	
-	"SubscriptionBindings" blob,
-	PRIMARY KEY("UselessKey", "PeerId", "MessageTypeId")
-);

+ 0 - 95
src/Abc.Zebus.Directory.Tests/Abc.Zebus.Directory.Tests.csproj

@@ -1,95 +0,0 @@
-<?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>{7C004E59-3B24-4359-8E45-1CD93F03FD80}</ProjectGuid>
-    <OutputType>Library</OutputType>
-    <AppDesignerFolder>Properties</AppDesignerFolder>
-    <RootNamespace>Abc.Zebus.Directory.Tests</RootNamespace>
-    <AssemblyName>Abc.Zebus.Directory.Tests</AssemblyName>
-    <TargetFrameworkVersion>v4.5</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="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\..\lib\log4net\log4net.dll</HintPath>
-    </Reference>
-    <Reference Include="Moq, Version=4.0.10827.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\..\lib\moq\Moq.dll</HintPath>
-    </Reference>
-    <Reference Include="nunit.framework, Version=2.6.2.12296, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\..\lib\nunit\nunit.framework.dll</HintPath>
-    </Reference>
-    <Reference Include="System" />
-    <Reference Include="System.Configuration" />
-    <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="..\SharedAssemblyInfo.cs">
-      <Link>Properties\SharedAssemblyInfo.cs</Link>
-    </Compile>
-    <Compile Include="..\SharedVersionInfo.cs">
-      <Link>Properties\SharedVersionInfo.cs</Link>
-    </Compile>
-    <Compile Include="Configuration\ConfigurationTests.cs" />
-    <Compile Include="DeadPeerDetection\DeadPeerDetectorEntryTests.cs" />
-    <Compile Include="DeadPeerDetection\DeadPeerDetectorTests.cs" />
-    <Compile Include="PeerDirectoryServerTests.cs" />
-    <Compile Include="FakeCommand.cs" />
-    <Compile Include="FakeRoutableCommand.cs" />
-    <Compile Include="Handlers\DirectoryCommandsHandlerTests.cs" />
-    <Compile Include="Log4netConfigurator.cs" />
-    <Compile Include="Properties\AssemblyInfo.cs" />
-    <Compile Include="Storage\MemoryPeerRepositoryTests.cs" />
-    <Compile Include="TestDataBuilder.cs" />
-  </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\Abc.Zebus.Directory\Abc.Zebus.Directory.csproj">
-      <Project>{ee6730d9-6a21-46a5-ae3f-af78060b6ea3}</Project>
-      <Name>Abc.Zebus.Directory</Name>
-    </ProjectReference>
-    <ProjectReference Include="..\Abc.Zebus.Testing\Abc.Zebus.Testing.csproj">
-      <Project>{4CE123DF-8021-411C-929B-53E5C5FC1E04}</Project>
-      <Name>Abc.Zebus.Testing</Name>
-    </ProjectReference>
-    <ProjectReference Include="..\Abc.Zebus\Abc.Zebus.csproj">
-      <Project>{1f4c6307-6113-40d5-bf42-4b6bf5df13b2}</Project>
-      <Name>Abc.Zebus</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>

+ 0 - 71
src/Abc.Zebus.Directory.Tests/Configuration/ConfigurationTests.cs

@@ -1,71 +0,0 @@
-using System.Configuration;
-using Abc.Zebus.Directory.Configuration;
-using Abc.Zebus.Testing.Extensions;
-using Abc.Zebus.Util;
-using NUnit.Framework;
-
-namespace Abc.Zebus.Directory.Tests.Configuration
-{
-    [TestFixture]
-    public class ConfigurationTests
-    {
-        [Test]
-        public void should_read_registration_timeout()
-        {
-            SetAppSettingsKey("Bus.Directory.RegistrationTimeout", "00:00:42");
-
-            var configuration = new AppSettingsBusConfiguration();
-            configuration.RegistrationTimeout.ShouldEqual(42.Seconds());
-        }
-
-        [Test]
-        public void should_read_default_registration_timeout()
-        {
-            RemoveAppSettingsKey("Bus.Directory.RegistrationTimeout");
-
-            var configuration = new AppSettingsBusConfiguration();
-            configuration.RegistrationTimeout.ShouldEqual(30.Seconds());
-        }
-        
-        [Test]
-        public void should_read_peer_ping_interval()
-        {
-            SetAppSettingsKey("Directory.PingPeers.Interval", "00:02");
-
-            var configuration = new AppSettingsDirectoryConfiguration();
-            configuration.PeerPingInterval.ShouldEqual(2.Minutes());
-        }
-
-        [Test]
-        public void should_read_default_peer_ping_interval()
-        {
-            RemoveAppSettingsKey("Directory.PingPeers.Interval");
-
-            var configuration = new AppSettingsDirectoryConfiguration();
-            configuration.PeerPingInterval.ShouldEqual(1.Minute());
-        }
-
-        private static void SetAppSettingsKey(string key, string value)
-        {
-            var appConfig = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
-            var element = appConfig.AppSettings.Settings[key];
-            if (element == null)
-                appConfig.AppSettings.Settings.Add(key, value);
-            else
-                element.Value = value;
-
-            appConfig.Save();
-
-            ConfigurationManager.RefreshSection("appSettings");
-        }
-
-        private static void RemoveAppSettingsKey(string key)
-        {
-            var appConfig = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
-            appConfig.AppSettings.Settings.Remove(key);
-            appConfig.Save();
-
-            ConfigurationManager.RefreshSection("appSettings");
-        }
-    }
-}

+ 0 - 122
src/Abc.Zebus.Directory.Tests/DeadPeerDetection/DeadPeerDetectorEntryTests.cs

@@ -1,122 +0,0 @@
-using System.Threading;
-using System.Threading.Tasks;
-using Abc.Zebus.Directory.Configuration;
-using Abc.Zebus.Directory.DeadPeerDetection;
-using Abc.Zebus.Testing;
-using Abc.Zebus.Testing.Extensions;
-using Abc.Zebus.Util;
-using Moq;
-using NUnit.Framework;
-
-namespace Abc.Zebus.Directory.Tests.DeadPeerDetection
-{
-    [TestFixture]
-    public class DeadPeerDetectorEntryTests
-    {
-        private DeadPeerDetectorEntry _entry;
-        private Mock<IDirectoryConfiguration> _configurationMock;
-        private TestBus _bus;
-
-        [SetUp]
-        public void Setup()
-        {
-            _configurationMock = new Mock<IDirectoryConfiguration>();
-            _bus = new TestBus();
-
-            var peer = new Peer(new PeerId("Abc.Testing.0"), "tcp://abctest:12300");
-            var peerDescriptor = peer.ToPeerDescriptor(true);
-            _entry = new DeadPeerDetectorEntry(peerDescriptor, _configurationMock.Object, _bus, new CurrentThreadTaskScheduler());
-        }
-
-        [Test]
-        public void should_use_debug_timeout()
-        {
-            _configurationMock.SetupGet(x => x.PersistentPeerPingTimeout).Returns(5.Seconds());
-            _configurationMock.SetupGet(x => x.DebugPeerPingTimeout).Returns(500.Seconds());
-
-            _bus.HandlerExecutor = new TestBus.DoNotReplyHandlerExecutor();
-            _entry.Descriptor.HasDebuggerAttached = true;
-
-            var pingTimestamp = SystemDateTime.UtcNow;
-            _entry.Ping(pingTimestamp);
-
-            using (SystemDateTime.Set(pingTimestamp.AddSeconds(15)))
-            {
-                _entry.HasReachedTimeout().ShouldBeFalse();
-            }
-            using (SystemDateTime.Set(pingTimestamp.AddSeconds(501)))
-            {
-                _entry.HasReachedTimeout().ShouldBeTrue();
-            }
-        }
-
-        [Test]
-        public void should_use_persistent_timeout()
-        {
-            _configurationMock.SetupGet(x => x.TransientPeerPingTimeout).Returns(5.Seconds());
-            _configurationMock.SetupGet(x => x.PersistentPeerPingTimeout).Returns(500.Seconds());
-
-            _bus.HandlerExecutor = new TestBus.DoNotReplyHandlerExecutor();
-            _entry.Descriptor.IsPersistent = true;
-
-            var pingTimestamp = SystemDateTime.UtcNow;
-            _entry.Ping(pingTimestamp);
-
-            using (SystemDateTime.Set(pingTimestamp.AddSeconds(15)))
-            {
-                _entry.HasReachedTimeout().ShouldBeFalse();
-            }
-            using (SystemDateTime.Set(pingTimestamp.AddSeconds(501)))
-            {
-                _entry.HasReachedTimeout().ShouldBeTrue();
-            }
-        }
-
-        [Test]
-        public void should_use_transcient_timeout()
-        {
-            _configurationMock.SetupGet(x => x.TransientPeerPingTimeout).Returns(5.Seconds());
-
-            _bus.HandlerExecutor = new TestBus.DoNotReplyHandlerExecutor();
-            _entry.Descriptor.IsPersistent = false;
-
-            var pingTimestamp = SystemDateTime.UtcNow;
-            _entry.Ping(pingTimestamp);
-
-            using (SystemDateTime.Set(pingTimestamp.AddSeconds(4)))
-            {
-                _entry.HasReachedTimeout().ShouldBeFalse();
-            }
-            using (SystemDateTime.Set(pingTimestamp.AddSeconds(6)))
-            {
-                _entry.HasReachedTimeout().ShouldBeTrue();
-            }
-        }
-
-        [Test]
-        public void should_not_detect_responding_peer_twice()
-        {
-            var pingTimestampUtc = SystemDateTime.UtcNow;
-
-            _entry.Descriptor.Peer.IsResponding = false;
-
-            var manualResetEvent = new ManualResetEventSlim();
-            var peerRespondingCount = 0;
-            _entry.PeerRespondingDetected += (e, o) =>
-            {
-                manualResetEvent.Wait();
-                peerRespondingCount++;
-            };
-
-            var ackTask1 = Task.Run(() => _entry.OnPingCommandAck(Task.FromResult(new CommandResult(0, null)), pingTimestampUtc));
-            var ackTask2 = Task.Run(() => _entry.OnPingCommandAck(Task.FromResult(new CommandResult(0, null)), pingTimestampUtc));
-
-            Thread.Sleep(10);
-            manualResetEvent.Set();
-
-            Task.WaitAll(ackTask1, ackTask2);
-
-            peerRespondingCount.ShouldEqual(1);
-        }
-    }
-}

+ 0 - 503
src/Abc.Zebus.Directory.Tests/DeadPeerDetection/DeadPeerDetectorTests.cs

@@ -1,503 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using Abc.Zebus.Directory.Configuration;
-using Abc.Zebus.Directory.DeadPeerDetection;
-using Abc.Zebus.Directory.Storage;
-using Abc.Zebus.Testing;
-using Abc.Zebus.Testing.Extensions;
-using Abc.Zebus.Util;
-using Moq;
-using NUnit.Framework;
-
-namespace Abc.Zebus.Directory.Tests.DeadPeerDetection
-{
-    [TestFixture]
-    public class DeadPeerDetectorTests
-    {
-        private const int _transientPeerTimeout = 60 * 10;
-        private const int _persistentPeerTimeout = 60 * 30;
-        private const int _debugPeerTimeout = 60 * 60;
-
-        private readonly TimeSpan _pingInterval = 5.Minutes();
-        private PeerDescriptor _transientAlivePeer0;
-        private PeerDescriptor _transientAlivePeer1;
-        private PeerDescriptor _transientDeadPeer;
-        private PeerDescriptor _persistentAlivePeer;
-        private PeerDescriptor _persistentDeadPeer;
-        private PeerDescriptor _debugPersistentAlivePeer;
-        private PeerDescriptor _debugTransientAlivePeer;
-        private Mock<IPeerRepository> _peerRepositoryMock;
-        private TestBus _bus;
-        private DeadPeerDetector _detector;
-        private Mock<IDirectoryConfiguration> _configurationMock;
-        private PeerDescriptor _persistencePeer;
-        private PeerDescriptor _directoryPeer;
-
-        [SetUp]
-        public void Setup()
-        {
-            _transientAlivePeer0 = CreatePeerDescriptor("Abc.TransientAlive.0", isUp: true, isPersistent: false, hasDebuggerAttached:false);
-            _transientAlivePeer1 = CreatePeerDescriptor("Abc.TransientAlive.1", isUp: true, isPersistent: false, hasDebuggerAttached: false);
-            _transientDeadPeer = CreatePeerDescriptor("Abc.TransientDead.0", isUp: false, isPersistent: false, hasDebuggerAttached: false);
-            _persistentAlivePeer = CreatePeerDescriptor("Abc.PersistentAlive.0", isUp: true, isPersistent: true, hasDebuggerAttached: false);
-            _persistentDeadPeer = CreatePeerDescriptor("Abc.PersistentDead.0", isUp: false, isPersistent: true, hasDebuggerAttached: false);
-            _debugPersistentAlivePeer = CreatePeerDescriptor("Abc.DebugPersistentAlive.0", isUp: true, isPersistent: true, hasDebuggerAttached: true);
-            _debugTransientAlivePeer = CreatePeerDescriptor("Abc.DebugTransientAlive.0", isUp: true, isPersistent: false, hasDebuggerAttached: true);
-            _persistencePeer = CreatePeerDescriptor("Abc.Zebus.PersistenceService.0", isUp: true, isPersistent: false, hasDebuggerAttached: false);
-            _directoryPeer = CreatePeerDescriptor("NonStandardDirectoryName", isUp: true, isPersistent: false, hasDebuggerAttached: false);
-            _directoryPeer.Subscriptions = new[] { new Subscription(new MessageTypeId(typeof(RegisterPeerCommand))) };
-
-            _peerRepositoryMock = new Mock<IPeerRepository>();
-            var peerDescriptors = new List<PeerDescriptor>
-            {
-                _transientAlivePeer0,
-                _transientAlivePeer1,
-                _transientDeadPeer,
-                _persistentAlivePeer,
-                _persistentDeadPeer,
-                _debugPersistentAlivePeer,
-                _debugTransientAlivePeer,
-                _persistencePeer
-            };
-            _peerRepositoryMock.Setup(repo => repo.GetPeers(It.IsAny<bool>())).Returns(peerDescriptors);
-            _peerRepositoryMock.Setup(repo => repo.Get(It.IsAny<PeerId>())).Returns<PeerId>(peerId => peerDescriptors.FirstOrDefault(x => x.Peer.Id == peerId));
-
-            _bus = new TestBus();
-
-            _configurationMock = new Mock<IDirectoryConfiguration>();
-            _configurationMock.As<IDirectoryConfiguration>().SetupGet(conf => conf.TransientPeerPingTimeout).Returns(_transientPeerTimeout.Seconds());
-            _configurationMock.As<IDirectoryConfiguration>().SetupGet(conf => conf.PersistentPeerPingTimeout).Returns(_persistentPeerTimeout.Seconds());
-            _configurationMock.As<IDirectoryConfiguration>().SetupGet(conf => conf.DebugPeerPingTimeout).Returns(_debugPeerTimeout.Seconds());
-            _configurationMock.As<IDirectoryConfiguration>().SetupGet(conf => conf.PeerPingInterval).Returns(_pingInterval);
-
-            _detector = new DeadPeerDetector(_bus, _peerRepositoryMock.Object, _configurationMock.Object);
-            _detector.TaskScheduler = new CurrentThreadTaskScheduler();
-
-            _bus.HandlerExecutor = new HangOnThrowHandlerExecutor();
-        }
-
-        [Test]
-        public void should_ping_peers()
-        {
-            _detector.DetectDeadPeers();
-
-            _bus.ExpectExactly(_transientAlivePeer0.PeerId, new PingPeerCommand());
-            _bus.ExpectExactly(_transientAlivePeer1.PeerId, new PingPeerCommand());
-            _bus.ExpectExactly(_persistentAlivePeer.PeerId, new PingPeerCommand());
-            _bus.ExpectExactly(_debugPersistentAlivePeer.PeerId, new PingPeerCommand());
-            _bus.ExpectExactly(_debugTransientAlivePeer.PeerId, new PingPeerCommand());
-        }
-        
-        [Test]
-        public void should_not_ping_until_the_ping_interval_elapsed()
-        {
-            var startTime = SystemDateTime.UtcNow;
-            using (SystemDateTime.Set(utcNow: startTime))
-            {
-                _detector.DetectDeadPeers();
-            }
-
-            using (SystemDateTime.Set(startTime + _pingInterval - 1.Second()))
-            {
-                _detector.DetectDeadPeers();
-            }
-
-            _bus.ExpectExactly(_transientAlivePeer0.PeerId, new PingPeerCommand());
-            _bus.ExpectExactly(_transientAlivePeer1.PeerId, new PingPeerCommand());
-            _bus.ExpectExactly(_persistentAlivePeer.PeerId, new PingPeerCommand());
-            _bus.ExpectExactly(_debugPersistentAlivePeer.PeerId, new PingPeerCommand());
-            _bus.ExpectExactly(_debugTransientAlivePeer.PeerId, new PingPeerCommand());
-        }
-
-        [Test]
-        public void should_not_timeout_if_a_transient_service_responds_to_the_second_ping()
-        {
-            SetupPeerRepository(_transientAlivePeer0);
-            SetupPeerResponse(_transientAlivePeer0.PeerId, false, true);
-
-            using (SystemDateTime.PauseTime())
-            {
-                var startTime = SystemDateTime.UtcNow;
-
-                _detector.DetectDeadPeers();
-                _bus.ExpectExactly(new PingPeerCommand());
-
-                SystemDateTime.Set(startTime.AddSeconds(_transientPeerTimeout - 1));
-                _detector.DetectDeadPeers();
-                _bus.ExpectExactly(new PingPeerCommand(), new PingPeerCommand());
-
-                SystemDateTime.Set(startTime.AddSeconds(_transientPeerTimeout + 1));
-                _detector.DetectDeadPeers();
-                _bus.ExpectExactly(new PingPeerCommand(), new PingPeerCommand());
-            }
-        }
-
-        [Test]
-        public void should_not_timeout_if_a_persistent_service_responds_to_the_second_ping()
-        {
-            SetupPeerRepository(_persistentAlivePeer, _transientAlivePeer0);
-            SetupPeerResponse(_transientAlivePeer0.PeerId, true, true);
-            SetupPeerResponse(_persistentAlivePeer.PeerId, false, true);
-
-            using (SystemDateTime.PauseTime())
-            {
-                var startTime = SystemDateTime.UtcNow;
-
-                _detector.DetectDeadPeers();
-                _bus.ExpectExactly(new PingPeerCommand(), new PingPeerCommand());
-                _bus.ClearMessages();
-
-                SystemDateTime.Set(startTime.AddSeconds(_transientPeerTimeout - 1));
-                _detector.DetectDeadPeers();
-                _bus.ExpectExactly(new PingPeerCommand(), new PingPeerCommand());
-                _bus.ClearMessages();
-
-                SystemDateTime.Set(startTime.AddSeconds(_persistentPeerTimeout - 1));
-                _detector.DetectDeadPeers();
-                _bus.ExpectExactly(new PingPeerCommand(), new PingPeerCommand());
-                _bus.ClearMessages();
-
-                SystemDateTime.Set(startTime.AddSeconds(_persistentPeerTimeout + 1));
-                _detector.DetectDeadPeers();
-                _bus.ExpectNothing();;
-            }
-        }
-
-        [Test]
-        public void should_not_timeout_if_a_debug_service_responds_to_the_second_ping()
-        {
-            SetupPeerRepository(_debugPersistentAlivePeer, _debugTransientAlivePeer);
-            SetupPeerResponse(_debugPersistentAlivePeer.PeerId, false, true);
-            SetupPeerResponse(_debugTransientAlivePeer.PeerId, false, true);
-            
-            using (SystemDateTime.PauseTime())
-            {
-                var startTime = SystemDateTime.UtcNow;
-
-                _detector.DetectDeadPeers();
-                _bus.ExpectExactly(new PingPeerCommand(), new PingPeerCommand());
-                _bus.ClearMessages();
-
-                SystemDateTime.Set(startTime.AddSeconds(_debugPeerTimeout - 1));
-                _detector.DetectDeadPeers();
-                _bus.ExpectExactly(new PingPeerCommand(), new PingPeerCommand());
-                _bus.ClearMessages();
-
-                SystemDateTime.Set(startTime.AddSeconds(_debugPeerTimeout + 1));
-                _detector.DetectDeadPeers();
-                _bus.ExpectNothing();
-            }
-        }
-
-        [Test]
-        public void should_timeout_if_a_transient_service_does_not_respond_in_time()
-        {
-            SetupPeerRepository(_transientAlivePeer0);
-            SetupPeerResponse(_transientAlivePeer0.PeerId, false, false);
-           
-            using (SystemDateTime.PauseTime())
-            {
-                var startTime = SystemDateTime.UtcNow;
-                var firstPingTimestampUtc = startTime;
-
-                _detector.DetectDeadPeers();
-                _bus.ExpectExactly(new PingPeerCommand());
-
-                SystemDateTime.Set(startTime.AddSeconds(_transientPeerTimeout - 1));
-                _detector.DetectDeadPeers();
-                _bus.ExpectExactly(new PingPeerCommand(), new PingPeerCommand());
-
-                SystemDateTime.Set(startTime.AddSeconds(_transientPeerTimeout + 1));
-                _detector.DetectDeadPeers();
-                _bus.Expect(new UnregisterPeerCommand(_transientAlivePeer0.Peer, firstPingTimestampUtc));
-            }
-        }
-
-        [Test]
-        public void should_not_decommission_directory_peer()
-        {
-            SetupPeerRepository(_directoryPeer, _transientAlivePeer0);
-            SetupPeerResponse(_transientAlivePeer0.PeerId, false, false);
-            SetupPeerResponse(_directoryPeer.PeerId, false, false);
-           
-            using (SystemDateTime.PauseTime())
-            {
-                var startTime = SystemDateTime.UtcNow;
-                var firstPingTimestampUtc = startTime;
-
-                _detector.DetectDeadPeers();
-                _bus.ExpectExactly(new PingPeerCommand());
-                _bus.ClearMessages();
-
-                SystemDateTime.Set(startTime.AddSeconds(_transientPeerTimeout - 1));
-                _detector.DetectDeadPeers();
-                _bus.ExpectExactly(new PingPeerCommand());
-                _bus.ClearMessages();
-
-                SystemDateTime.Set(startTime.AddSeconds(_transientPeerTimeout + 1));
-                _detector.DetectDeadPeers();
-                _bus.ExpectExactly(new UnregisterPeerCommand(_transientAlivePeer0.Peer, firstPingTimestampUtc));
-            }
-        }
-        
-        [Test]
-        public void should_not_decommission_the_persistence()
-        {
-            SetupPeerRepository(_persistencePeer);
-            SetupPeerResponse(_persistencePeer.PeerId, false, false);
-
-            using (SystemDateTime.PauseTime())
-            {
-                var startTime = SystemDateTime.UtcNow;
-
-                var persistenceDownDetectedCount = 0;
-                _detector.PersistenceDownDetected += () => persistenceDownDetectedCount++;
-
-                _detector.DetectDeadPeers();
-                _bus.ExpectExactly(new PingPeerCommand());
-
-                SystemDateTime.Set(startTime.AddSeconds(_transientPeerTimeout - 1));
-                _detector.DetectDeadPeers();
-                _bus.ExpectExactly(new PingPeerCommand(), new PingPeerCommand());
-
-                SystemDateTime.Set(startTime.AddSeconds(_transientPeerTimeout + 1));
-                _detector.DetectDeadPeers();
-
-                _bus.ExpectExactly(new PingPeerCommand(), new PingPeerCommand());
-                persistenceDownDetectedCount.ShouldEqual(1);
-            }
-        }
-
-        [Test]
-        public void should_timeout_if_a_persistent_service_does_not_respond_in_time()
-        {
-            SetupPeerRepository(_persistentAlivePeer, _transientAlivePeer0);
-            SetupPeerResponse(_transientAlivePeer0.PeerId, true, true);
-            SetupPeerResponse(_persistentAlivePeer.PeerId, false, false);
-            
-            using (SystemDateTime.PauseTime())
-            {
-                var startTime = SystemDateTime.UtcNow;
-                var firstPingTimestampUtc = startTime;
-
-                var peerDownDetectedCount = 0;
-                var lastPeerDown = new PeerId(string.Empty);
-                var lastPeerDownTimestamp = DateTime.MinValue;
-                _detector.PeerDownDetected += (peer, timestamp) =>
-                {
-                    peerDownDetectedCount++;
-                    lastPeerDown = peer;
-                    lastPeerDownTimestamp = timestamp;
-                };
-
-                _detector.DetectDeadPeers();
-                _bus.ExpectExactly(new PingPeerCommand(), new PingPeerCommand());
-                _bus.ClearMessages();
-            
-                SystemDateTime.Set(startTime.AddSeconds(_transientPeerTimeout - 1));
-                _detector.DetectDeadPeers();
-                _bus.ExpectExactly(new PingPeerCommand(), new PingPeerCommand());
-                _bus.ClearMessages();
-
-                var retryTimestamp = startTime.AddSeconds(_persistentPeerTimeout - 1);
-                SystemDateTime.Set(retryTimestamp);
-                _detector.DetectDeadPeers();
-                _bus.ExpectExactly(new PingPeerCommand(), new PingPeerCommand());
-                _bus.ClearMessages();
-            
-                SystemDateTime.Set(startTime.AddSeconds(_persistentPeerTimeout + 1));
-                _detector.DetectDeadPeers();
-                peerDownDetectedCount.ShouldEqual(1);
-                lastPeerDown.ShouldEqualDeeply(_persistentAlivePeer.Peer.Id);
-                lastPeerDownTimestamp.ShouldEqual(firstPingTimestampUtc);
-            }
-        }
-
-        private class PeerEvent
-        {
-            public PeerId PeerId { get; private set; }
-            public DateTime Timestamp { get; private set; }
-
-            public PeerEvent(PeerId peerId, DateTime timestamp)
-            {
-                PeerId = peerId;
-                Timestamp = timestamp;
-            }
-        }
-
-        [Test]
-        public void should_raise_PingMissed_before_a_peer_is_marked_as_timed_out()
-        {
-            SetupPeerRepository(_persistentAlivePeer, _transientAlivePeer0);
-            SetupPeerResponse(_transientAlivePeer0.PeerId, true, true);
-            SetupPeerResponse(_persistentAlivePeer.PeerId, false, false);
-
-            using (SystemDateTime.PauseTime())
-            {
-                var missedPings = new List<PeerEvent>();
-                _detector.PingMissed += (peer, timestamp) => missedPings.Add(new PeerEvent(peer, timestamp));
-
-                var startTime = SystemDateTime.UtcNow;
-                _detector.DetectDeadPeers();
-
-                SystemDateTime.Set(startTime.Add(_pingInterval - 1.Second()));
-                _detector.DetectDeadPeers();
-                missedPings.Count.ShouldEqual(0);
-
-                SystemDateTime.Set(startTime.Add(_pingInterval + 1.Second()));
-                _detector.DetectDeadPeers();
-                missedPings.Count.ShouldEqual(1);
-                missedPings.First().PeerId.ShouldEqual(_persistentAlivePeer.PeerId);
-
-                SystemDateTime.Set(startTime.Add(_pingInterval + _pingInterval + 1.Second()));
-                _detector.DetectDeadPeers();
-                missedPings.Count.ShouldEqual(2);
-                missedPings.All(evt => evt.PeerId == _persistentAlivePeer.PeerId).ShouldBeTrue();
-            }
-        }
-
-        [Test]
-        public void should_raise_PeerResponding_when_peer_starts_replying_again_to_ping()
-        {
-            SetupPeerRepository(_persistentAlivePeer);
-            SetupPeerResponse(_persistentAlivePeer.PeerId, false, false, false, true);
-
-            using (SystemDateTime.PauseTime())
-            {
-                var startTime = SystemDateTime.UtcNow;
-                var firstPingTimestampUtc = startTime;
-
-                var peerDownDetectedCount = 0;
-                var lastPeerDown = new PeerId(string.Empty);
-                var lastPeerDownTimestamp = DateTime.MinValue;
-                _detector.PeerDownDetected += (peer, timestamp) =>
-                {
-                    peerDownDetectedCount++;
-                    lastPeerDown = peer;
-                    lastPeerDownTimestamp = timestamp;
-                };
-
-                var peerUpDetectedCount = 0;
-                var lastPeerUp = new PeerId(string.Empty);
-                var lastPeerUpTimestamp = DateTime.MinValue;
-                _detector.PeerRespondingDetected += (peer, timestamp) =>
-                {
-                    peerUpDetectedCount++;
-                    lastPeerUp = peer;
-                    lastPeerUpTimestamp = timestamp;
-                };
-
-                _detector.DetectDeadPeers();
-                _bus.ExpectExactly(new PingPeerCommand());
-                _bus.ClearMessages();
-
-                SystemDateTime.Set(startTime.AddSeconds(_persistentPeerTimeout - 1));
-                _detector.DetectDeadPeers();
-                _bus.ExpectExactly(new PingPeerCommand());
-                _bus.ClearMessages();
-
-                SystemDateTime.Set(startTime.AddSeconds(_persistentPeerTimeout + 1));
-                _detector.DetectDeadPeers();
-                peerDownDetectedCount.ShouldEqual(1);
-                lastPeerDown.ShouldEqualDeeply(_persistentAlivePeer.Peer.Id);
-                lastPeerDownTimestamp.ShouldEqual(firstPingTimestampUtc);
-
-                // simulate MarkPeerAsNotRespondingCommand handler
-                _persistentAlivePeer.Peer.IsResponding = false;
-
-                SystemDateTime.Set(SystemDateTime.Now.Add(_pingInterval));
-                _detector.DetectDeadPeers();
-                _bus.ExpectExactly(new PingPeerCommand());
-                _bus.ClearMessages();
-
-                SystemDateTime.Set(SystemDateTime.Now.Add(_pingInterval));
-                _detector.DetectDeadPeers();
-                peerUpDetectedCount.ShouldEqual(1);
-                lastPeerUp.ShouldEqualDeeply(_persistentAlivePeer.Peer.Id);
-                lastPeerUpTimestamp.ShouldEqual(SystemDateTime.UtcNow);
-            }
-        }
-
-        [Test]
-        public void should_timeout_if_any_debug_service_does_not_respond_in_time()
-        {
-            SetupPeerRepository(_debugPersistentAlivePeer, _debugTransientAlivePeer);
-            SetupPeerResponse(_debugPersistentAlivePeer.PeerId, false, false);
-            SetupPeerResponse(_debugTransientAlivePeer.PeerId, false, false);
-
-            using (SystemDateTime.PauseTime())
-            {
-                var startTime = SystemDateTime.UtcNow;
-                var firstPingTimestampUtc = startTime;
-
-                _detector.DetectDeadPeers();
-                _bus.ExpectExactly(new PingPeerCommand(), new PingPeerCommand());
-                _bus.ClearMessages();
-
-                SystemDateTime.Set(startTime.AddSeconds(_debugPeerTimeout - 1));
-                _detector.DetectDeadPeers();
-                _bus.ExpectExactly(new PingPeerCommand(), new PingPeerCommand());
-                _bus.ClearMessages();
-
-                SystemDateTime.Set(startTime.AddSeconds(_debugPeerTimeout + 1));
-                _detector.DetectDeadPeers();
-                _bus.ExpectExactly(
-                    new UnregisterPeerCommand(_debugTransientAlivePeer.Peer, firstPingTimestampUtc),
-                    new UnregisterPeerCommand(_debugPersistentAlivePeer.Peer, firstPingTimestampUtc)
-                    );
-            }
-        }
-
-        private void SetupPeerRepository(params PeerDescriptor[] peer)
-        {
-            _peerRepositoryMock.Setup(repo => repo.GetPeers(It.IsAny<bool>())).Returns(new List<PeerDescriptor>(peer));
-        }
-
-
-        private void SetupPeerResponse(PeerId peerId, params bool[] respondToPing)
-        {
-            var invocationCount = 0;
-            _bus.AddHandlerForPeer<PingPeerCommand>(peerId, cmd =>
-            {
-                var shouldRespond = invocationCount < respondToPing.Length && respondToPing[invocationCount];
-                ++invocationCount;
-                if(shouldRespond)
-                    return true;
-
-                throw new InvalidOperationException();
-            });
-        }
-
-        private static PeerDescriptor CreatePeerDescriptor(string peerId, bool isPersistent, bool isUp, bool hasDebuggerAttached)
-        {
-            var descriptor = new Peer(new PeerId(peerId), "tcp://abcdell348:58920", isUp).ToPeerDescriptor(isPersistent);
-            descriptor.HasDebuggerAttached = hasDebuggerAttached;
-
-            return descriptor;
-        }
-
-        /// <summary>
-        /// Executes handler synchronously but hangs on exceptions
-        /// </summary>
-        public class HangOnThrowHandlerExecutor : TestBus.IHandlerExecutor
-        {
-            public Task<CommandResult> Execute(ICommand command, Func<IMessage, object> handler)
-            {
-                var taskCompletionSource = new TaskCompletionSource<CommandResult>();
-                try
-                {
-                    var result = handler != null ? handler(command) : null;
-                    taskCompletionSource.SetResult(new CommandResult(0, result));
-                }
-                catch (Exception)
-                {
-                    return new TaskCompletionSource<CommandResult>().Task;
-                }
-             
-                return taskCompletionSource.Task;
-            }
-        }
-    }
-}

+ 0 - 6
src/Abc.Zebus.Directory.Tests/FakeCommand.cs

@@ -1,6 +0,0 @@
-namespace Abc.Zebus.Directory.Tests
-{
-    public class FakeCommand : ICommand
-    {
-    }
-}

+ 0 - 24
src/Abc.Zebus.Directory.Tests/FakeRoutableCommand.cs

@@ -1,24 +0,0 @@
-using Abc.Zebus.Routing;
-
-namespace Abc.Zebus.Directory.Tests
-{
-    [Routable]
-    public class FakeRoutableCommand : ICommand
-    {
-        [RoutingPosition(1)]
-        public readonly int Id;
-
-        [RoutingPosition(2)]
-        public readonly string Name;
-        
-        FakeRoutableCommand()
-        {
-        }
-
-        public FakeRoutableCommand(int id, string name)
-        {
-            Id = id;
-            Name = name;
-        }
-    }
-}

+ 0 - 357
src/Abc.Zebus.Directory.Tests/Handlers/DirectoryCommandsHandlerTests.cs

@@ -1,357 +0,0 @@
-using System;
-using System.Linq;
-using Abc.Zebus.Directory.Configuration;
-using Abc.Zebus.Directory.Handlers;
-using Abc.Zebus.Directory.Storage;
-using Abc.Zebus.Routing;
-using Abc.Zebus.Testing;
-using Abc.Zebus.Testing.Extensions;
-using Abc.Zebus.Transport;
-using Abc.Zebus.Util;
-using Moq;
-using NUnit.Framework;
-
-namespace Abc.Zebus.Directory.Tests.Handlers
-{
-    [TestFixture]
-    public class DirectoryCommandsHandlerTests
-    {
-        private readonly Peer _sender = new Peer(new PeerId("Abc.Sender.0"), "tcp://sender:123");
-        private IDisposable _contextScope;
-        private TestBus _bus;
-        private Mock<IPeerRepository> _repositoryMock;
-        private Mock<IDirectoryConfiguration> _configurationMock;
-        private DirectoryCommandsHandler _handler;
-
-        [SetUp]
-        public void Setup()
-        {
-            _contextScope = MessageContext.SetCurrent(MessageContext.CreateTest());
-
-            _configurationMock = new Mock<IDirectoryConfiguration>();
-            _configurationMock.SetupGet(conf => conf.BlacklistedMachines).Returns(new[] { "ANOTHER_BLACKLISTEDMACHINE", "BLACKlistedMACHINE" });
-            _repositoryMock = new Mock<IPeerRepository>();
-            _bus = new TestBus();
-            _handler = new DirectoryCommandsHandler(_bus, _repositoryMock.Object, _configurationMock.Object) { Context = MessageContext.CreateOverride(_sender.Id, _sender.EndPoint) };
-        }
-
-        [TearDown]
-        public virtual void Teardown()
-        {
-            _contextScope.Dispose();
-        }
-
-        [Test]
-        public void should_add_peer_to_repository()
-        {
-            var peerDescriptor = TestDataBuilder.CreatePersistentPeerDescriptor("tcp://abctest:123", typeof(FakeCommand));
-            var registerCommand = new RegisterPeerCommand(peerDescriptor);
-
-            _handler.Handle(registerCommand);
-
-            _repositoryMock.Verify(x => x.AddOrUpdatePeer(registerCommand.Peer));
-        }
-
-        [Test]
-        public void should_set_registering_peer_up_and_responding()
-        {
-            var peerDescriptor = TestDataBuilder.CreatePersistentPeerDescriptor("tcp://abctest:123", typeof(FakeCommand));
-            peerDescriptor.Peer.IsUp = false;
-            peerDescriptor.Peer.IsResponding = false;
-
-            var registerCommand = new RegisterPeerCommand(peerDescriptor);
-
-            _handler.Handle(registerCommand);
-
-            _repositoryMock.Verify(x => x.AddOrUpdatePeer(It.Is<PeerDescriptor>(p => p.Peer.IsUp && p.Peer.IsResponding)));
-        }
-
-        [Test]
-        public void should_remove_existing_dynamic_subscriptions_on_register()
-        {
-            var peerDescriptor = TestDataBuilder.CreatePersistentPeerDescriptor("tcp://abctest:123", typeof(FakeCommand));
-            var registerCommand = new RegisterPeerCommand(peerDescriptor);
-            
-            _handler.Handle(registerCommand);
-
-            _repositoryMock.Verify(x => x.AddOrUpdatePeer(registerCommand.Peer));
-            _repositoryMock.Verify(x => x.RemoveAllDynamicSubscriptionsForPeer(registerCommand.Peer.PeerId));
-        }
-
-        [Test]
-        public void should_reply_with_registred_peers()
-        {
-            var registredPeerDescriptor = TestDataBuilder.CreatePersistentPeerDescriptor("tcp://abctest:456", typeof(FakeCommand));
-            _repositoryMock.Setup(x => x.GetPeers(It.Is<bool>(loadDynamicSubs => loadDynamicSubs))).Returns(new[] { registredPeerDescriptor });
-            var command = new RegisterPeerCommand(TestDataBuilder.CreatePersistentPeerDescriptor("tcp://abctest:123", typeof(FakeCommand)));
-
-            _handler.Handle(command);
-
-            var response = (RegisterPeerResponse)_bus.LastReplyResponse;
-            response.PeerDescriptors.Single().ShouldHaveSamePropertiesAs(registredPeerDescriptor);
-        }
-
-        [Test]
-        public void should_publish_started_event()
-        {
-            var peerDescriptor = TestDataBuilder.CreatePersistentPeerDescriptor("tcp://abctest:123", typeof(FakeCommand));
-            var command = new RegisterPeerCommand(peerDescriptor);
-
-            _handler.Handle(command);
-
-            _bus.ExpectExactly(new PeerStarted(peerDescriptor));
-        }
-
-        [Test]
-        public void should_throw_if_a_blacklisted_peer_tries_to_register()
-        {
-            var blacklistedPeer = TestDataBuilder.CreatePersistentPeerDescriptor("tcp://blacklistedpeer:123", typeof(FakeCommand));
-            var registerCommand = new RegisterPeerCommand(blacklistedPeer);
-            _handler.Context = MessageContext.CreateTest(new OriginatorInfo(blacklistedPeer.Peer.Id, blacklistedPeer.Peer.EndPoint, "BLACKLISTEDMACHINE", "initiator"));
-
-            var exception = typeof(InvalidOperationException).ShouldBeThrownBy(() => _handler.Handle(registerCommand));
-
-            exception.Message.ShouldEqual("Peer BLACKLISTEDMACHINE is not allowed to register on this directory");
-        }
-
-        [Test]
-        public void should_throw_if_an_existing_peer_tries_to_register()
-        {
-            var existingPeer = TestDataBuilder.CreatePersistentPeerDescriptor("tcp://existingpeer:123", typeof(FakeCommand));
-            _repositoryMock.Setup(x => x.Get(existingPeer.PeerId)).Returns(existingPeer);
-            var newPeer = TestDataBuilder.CreatePersistentPeerDescriptor("tcp://newpeer:123", typeof(FakeCommand));
-            var command = new RegisterPeerCommand(newPeer);
-
-            var exception = (DomainException)typeof(DomainException).ShouldBeThrownBy(() => _handler.Handle(command));
-            exception.ErrorCode.ShouldEqual(DirectoryErrorCodes.PeerAlreadyExists);
-        }
-
-        [Test]
-        public void should_not_throw_if_a_not_responding_peer_already_exists()
-        {
-            var existingPeer = TestDataBuilder.CreatePersistentPeerDescriptor("tcp://existingpeer:123", typeof(FakeCommand));
-            existingPeer.Peer.IsResponding = false;
-            _repositoryMock.Setup(x => x.GetPeers(It.IsAny<bool>())).Returns(new[] { existingPeer });
-            var newPeer = TestDataBuilder.CreatePersistentPeerDescriptor("tcp://newpeer:123", typeof(FakeCommand));
-            var command = new RegisterPeerCommand(newPeer);
-
-            _handler.Handle(command);
-
-            _repositoryMock.Verify(x => x.AddOrUpdatePeer(newPeer));
-        }
-
-        [Test]
-        public void should_not_throw_if_an_existing_peer_is_on_the_same_host()
-        {
-            var existingPeer = TestDataBuilder.CreatePersistentPeerDescriptor("tcp://existingpeer:123", typeof(FakeCommand));
-            existingPeer.Peer.IsResponding = false;
-            _repositoryMock.Setup(x => x.GetPeers(It.IsAny<bool>())).Returns(new[] { existingPeer });
-            var newPeer = TestDataBuilder.CreatePersistentPeerDescriptor("tcp://existingpeer:123", typeof(FakeCommand));
-            var command = new RegisterPeerCommand(newPeer);
-
-            _handler.Handle(command);
-
-            _repositoryMock.Verify(x => x.AddOrUpdatePeer(newPeer));
-        }
-
-        [Test]
-        public void should_unregister_persistent_peer_when_unregistering()
-        {
-            var peerDescriptor = TestDataBuilder.CreatePersistentPeerDescriptor("tcp://abctest:123", typeof(FakeCommand));
-            peerDescriptor.TimestampUtc = SystemDateTime.UtcNow.AddSeconds(-30);
-            _repositoryMock.Setup(x => x.Get(peerDescriptor.Peer.Id)).Returns(peerDescriptor);
-
-            var command = new UnregisterPeerCommand(peerDescriptor.Peer);
-            _handler.Handle(command);
-
-            _repositoryMock.Verify(x => x.AddOrUpdatePeer(It.Is<PeerDescriptor>(peer => peer.Peer.Id == peerDescriptor.Peer.Id && peer.Peer.IsUp == false && peer.TimestampUtc == command.TimestampUtc)));
-        }
-
-        [Test]
-        public void should_remove_transient_peer_when_unregistering()
-        {
-            var peerDescriptor = TestDataBuilder.CreateTransientPeerDescriptor("tcp://abctest:123", typeof(FakeCommand));
-            _repositoryMock.Setup(x => x.Get(peerDescriptor.Peer.Id)).Returns(peerDescriptor);
-
-            _handler.Handle(new UnregisterPeerCommand(peerDescriptor.Peer));
-
-            _repositoryMock.Verify(x => x.RemovePeer(It.Is<PeerId>(peerId => peerId == peerDescriptor.Peer.Id)));
-        }
-
-        [Test]
-        public void should_publish_stopped_event_when_unregistering_a_persistent_client()
-        {
-            var peerDescriptor = TestDataBuilder.CreatePersistentPeerDescriptor("tcp://abctest:123", typeof(FakeCommand));
-            peerDescriptor.TimestampUtc = SystemDateTime.UtcNow.AddSeconds(-30);
-            _repositoryMock.Setup(x => x.Get(peerDescriptor.Peer.Id)).Returns(peerDescriptor);
-
-            var command = new UnregisterPeerCommand(peerDescriptor.Peer, SystemDateTime.UtcNow.AddSeconds(-2));
-            _handler.Handle(command);
-
-            _bus.ExpectExactly(new PeerStopped(peerDescriptor.Peer, command.TimestampUtc));
-        }
-
-        [Test]
-        public void should_publish_decommissioned_event_when_unregistering_a_transient_client()
-        {
-            var peerDescriptor = TestDataBuilder.CreateTransientPeerDescriptor("tcp://abctest:123", typeof(FakeCommand));
-            _repositoryMock.Setup(x => x.Get(peerDescriptor.Peer.Id)).Returns(peerDescriptor);
-
-            _handler.Handle(new UnregisterPeerCommand(peerDescriptor.Peer));
-
-            _bus.ExpectExactly(new PeerDecommissioned(peerDescriptor.Peer.Id));
-        }
-
-        [Test]
-        public void should_publish_peer_decommissioned()
-        {
-            var peerId = new PeerId("Abc.Testing.0");
-         
-            _handler.Handle(new DecommissionPeerCommand(peerId));
-
-            _bus.ExpectExactly(new PeerDecommissioned(peerId));
-        }
-
-        [Test]
-        public void should_remove_peer_from_repository()
-        {
-            var peerId = new PeerId("Abc.Testing.0");
-         
-            _handler.Handle(new DecommissionPeerCommand(peerId));
-
-            _repositoryMock.Verify(x => x.RemovePeer(peerId));
-        }
-
-        [Test]
-        public void should_update_peer_handled_message_and_publish_event()
-        {
-            var originalPeerDescriptor = TestDataBuilder.CreatePersistentPeerDescriptor("tcp://abctest:123", typeof(FakeCommand));
-            _repositoryMock.Setup(x => x.Get(originalPeerDescriptor.Peer.Id)).Returns(originalPeerDescriptor);
-
-            PeerDescriptor updatedPeerDescriptor = null;
-            _repositoryMock.Setup(x => x.AddOrUpdatePeer(It.IsAny<PeerDescriptor>())).Callback<PeerDescriptor>(peer => updatedPeerDescriptor = peer);
-
-            var newSubscriptions = new[] { new Subscription(new MessageTypeId("Another.Handled.Type")) };
-            _handler.Handle(new UpdatePeerSubscriptionsCommand(originalPeerDescriptor.Peer.Id, newSubscriptions, DateTime.UtcNow));
-
-            updatedPeerDescriptor.Subscriptions.ShouldBeEquivalentTo(newSubscriptions);
-
-            var handledMessageUpdateds = _bus.Messages.OfType<PeerSubscriptionsUpdated>().ToList();
-            handledMessageUpdateds.Count.ShouldEqual(1);
-            handledMessageUpdateds.Single().PeerDescriptor.ShouldHaveSamePropertiesAs(updatedPeerDescriptor);
-        }
-
-        [Test]
-        public void should_update_peer_subscriptions_by_types_and_publish_event()
-        {
-            var peerDescriptor = TestDataBuilder.CreatePersistentPeerDescriptor("tcp://abctest:123", typeof(FakeCommand));
-            var subscriptionsForTypes = new[]
-            {
-                new SubscriptionsForType(MessageUtil.GetTypeId(typeof(int)), BindingKey.Empty),
-                new SubscriptionsForType(MessageUtil.GetTypeId(typeof(double)), new BindingKey("bla"))
-            };
-            var now = DateTime.UtcNow;
-            
-            _handler.Handle(new UpdatePeerSubscriptionsForTypesCommand(peerDescriptor.PeerId, now, subscriptionsForTypes));
-
-            _repositoryMock.Verify(repo => repo.AddDynamicSubscriptionsForTypes(peerDescriptor.PeerId, now, subscriptionsForTypes));
-            _bus.ExpectExactly(new PeerSubscriptionsForTypesUpdated(peerDescriptor.PeerId, now, subscriptionsForTypes));
-        }
-
-        [Test]
-        public void should_specify_datetime_kind_when_adding_subscriptions_for_a_type()
-        {
-            var peerDescriptor = TestDataBuilder.CreatePersistentPeerDescriptor("tcp://abctest:123", typeof(FakeCommand));
-            var subscriptionsForTypes = new[] { new SubscriptionsForType(MessageUtil.GetTypeId(typeof(int)), BindingKey.Empty) };
-            var unspecifiedNow = DateTime.SpecifyKind(DateTime.UtcNow, DateTimeKind.Unspecified);
-            
-            _handler.Handle(new UpdatePeerSubscriptionsForTypesCommand(peerDescriptor.PeerId, unspecifiedNow, subscriptionsForTypes));
-
-            _repositoryMock.Verify(repo => repo.AddDynamicSubscriptionsForTypes(peerDescriptor.PeerId, It.Is<DateTime>(date => date.Kind == DateTimeKind.Utc), subscriptionsForTypes));
-        }
-
-        [Test]
-        public void should_specify_datetime_kind_when_removing_subscriptions_for_a_type()
-        {
-            var peerDescriptor = TestDataBuilder.CreatePersistentPeerDescriptor("tcp://abctest:123", typeof(FakeCommand));
-            var subscriptionsForTypes = new[] { new SubscriptionsForType(MessageUtil.GetTypeId(typeof(int)), new BindingKey[0]) };
-            var unspecifiedNow = DateTime.SpecifyKind(DateTime.UtcNow, DateTimeKind.Unspecified);
-            
-            _handler.Handle(new UpdatePeerSubscriptionsForTypesCommand(peerDescriptor.PeerId, unspecifiedNow, subscriptionsForTypes));
-
-            _repositoryMock.Verify(repo => repo.RemoveDynamicSubscriptionsForTypes(peerDescriptor.PeerId, It.Is<DateTime>(date => date.Kind == DateTimeKind.Utc), new[] { MessageUtil.GetTypeId(typeof(int)) }));
-        }
-
-        [Test]
-        public void should_handle_null_bindingkeys_array_when_removing_subscriptions()
-        {
-            var peerDescriptor = TestDataBuilder.CreatePersistentPeerDescriptor("tcp://abctest:123", typeof(FakeCommand));
-            var subscriptionsForTypes = new[] { new SubscriptionsForType(MessageUtil.GetTypeId(typeof(int)), null) };
-            var now = DateTime.UtcNow;
-            
-            _handler.Handle(new UpdatePeerSubscriptionsForTypesCommand(peerDescriptor.PeerId, now, subscriptionsForTypes));
-
-            _repositoryMock.Verify(repo => repo.RemoveDynamicSubscriptionsForTypes(peerDescriptor.PeerId, now, new[] { MessageUtil.GetTypeId(typeof(int)) }));
-        }
-
-        [Test]
-        public void should_remove_peer_subscriptions_for_a_type_if_there_are_no_binding_keys()
-        {
-            var now = DateTime.UtcNow;
-            var peerDescriptor = TestDataBuilder.CreatePersistentPeerDescriptor("tcp://abctest:123", typeof(FakeCommand));
-            SubscriptionsForType[] addedSubscriptions = null;
-            MessageTypeId[] removedMessageTypeIds = null;
-            _repositoryMock.Setup(repo => repo.AddDynamicSubscriptionsForTypes(peerDescriptor.PeerId, now, It.IsAny<SubscriptionsForType[]>()))
-                           .Callback((PeerId peerId, DateTime timestampUtc, SubscriptionsForType[] subs) => addedSubscriptions = subs);
-            _repositoryMock.Setup(repo => repo.RemoveDynamicSubscriptionsForTypes(peerDescriptor.PeerId, now, It.IsAny<MessageTypeId[]>()))
-                           .Callback((PeerId peerId, DateTime timestampUtc, MessageTypeId[] ids) => removedMessageTypeIds = ids);
-            var subscriptionsForTypes = new[]
-            {
-                new SubscriptionsForType(MessageUtil.GetTypeId(typeof(int))),
-                new SubscriptionsForType(MessageUtil.GetTypeId(typeof(double)), BindingKey.Empty)
-            };
-            
-            _handler.Handle(new UpdatePeerSubscriptionsForTypesCommand(peerDescriptor.PeerId, now, subscriptionsForTypes));
-
-            var addedSubscription = addedSubscriptions.ExpectedSingle();
-            addedSubscription.ShouldHaveSamePropertiesAs(new SubscriptionsForType(MessageUtil.GetTypeId(typeof(double)), BindingKey.Empty));
-            var removedMessageTypeId = removedMessageTypeIds.ExpectedSingle();
-            removedMessageTypeId.ShouldHaveSamePropertiesAs(MessageUtil.GetTypeId(typeof(int)));
-            _bus.ExpectExactly(new PeerSubscriptionsForTypesUpdated(peerDescriptor.PeerId, now, subscriptionsForTypes));
-        }
-
-        [Test]
-        public void should_throw_an_explicit_exception_when_updating_the_subscriptions_of_a_decommissioned_peer()
-        {
-            Assert.That(() => _handler.Handle(new UpdatePeerSubscriptionsCommand(new PeerId("Abc.NonExistingPeer.0"), new Subscription[0], DateTime.UtcNow)),
-                        Throws.InstanceOf<InvalidOperationException>().With.Property("Message").EqualTo("The specified Peer (Abc.NonExistingPeer.0) does not exist."));
-        }
-
-        [Test]
-        public void should_ignore_old_peer_updates()
-        {
-            var originalPeerDescriptor = TestDataBuilder.CreatePersistentPeerDescriptor("tcp://abctest:123", typeof(FakeCommand));
-            originalPeerDescriptor.TimestampUtc = SystemDateTime.UtcNow.AddMinutes(1);
-            _repositoryMock.Setup(x => x.Get(originalPeerDescriptor.Peer.Id)).Returns(originalPeerDescriptor);
-
-            var newSubscriptions = new[] { new Subscription(new MessageTypeId("Another.Handled.Type")) };
-            _handler.Handle(new UpdatePeerSubscriptionsCommand(originalPeerDescriptor.Peer.Id, newSubscriptions, DateTime.UtcNow));
-
-            _repositoryMock.Verify(x => x.AddOrUpdatePeer(It.IsAny<PeerDescriptor>()), Times.Never());
-            _bus.ExpectNothing();
-        }
-
-        [Test]
-        public void should_not_unregister_a_peer_that_started_after_timestamp()
-        {
-            var peerDescriptor = TestDataBuilder.CreatePersistentPeerDescriptor("tcp://abctest:123", typeof(FakeCommand));
-            _repositoryMock.Setup(x => x.Get(peerDescriptor.PeerId)).Returns(peerDescriptor);
-
-            var command = new UnregisterPeerCommand(peerDescriptor.Peer, peerDescriptor.TimestampUtc.Value.AddSeconds(-2));
-            _handler.Handle(command);
-
-            _repositoryMock.Verify(x => x.AddOrUpdatePeer(It.IsAny<PeerDescriptor>()), Times.Never());
-            _bus.ExpectNothing();
-        }
-    }
-}

+ 0 - 18
src/Abc.Zebus.Directory.Tests/Log4netConfigurator.cs

@@ -1,18 +0,0 @@
-using System;
-using System.IO;
-using log4net.Config;
-using NUnit.Framework;
-
-namespace Abc.Zebus.Directory.Tests
-{
-    [SetUpFixture]
-    public class Log4netConfigurator
-    {
-        [SetUp]
-        public void SetUp()
-        {
-            var configurationFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "log4net.config");
-            XmlConfigurator.Configure(new FileInfo(configurationFile));
-        }
-    }
-}

+ 0 - 247
src/Abc.Zebus.Directory.Tests/PeerDirectoryServerTests.cs

@@ -1,247 +0,0 @@
-using System.Linq;
-using Abc.Zebus.Directory.Configuration;
-using Abc.Zebus.Directory.Storage;
-using Abc.Zebus.Routing;
-using Abc.Zebus.Testing;
-using Abc.Zebus.Testing.Comparison;
-using Abc.Zebus.Testing.Extensions;
-using Abc.Zebus.Util;
-using Moq;
-using NUnit.Framework;
-
-namespace Abc.Zebus.Directory.Tests
-{
-    [TestFixture]
-    public class PeerDirectoryServerTests
-    {
-        private PeerDirectoryServer _peerDirectory;
-        private Mock<IPeerRepository> _repositoryMock;
-        private TestBus _bus;
-        private UpdatedPeer _updatedPeer;
-        private Peer _self;
-        private Peer _otherPeer;
-        private bool _disableDynamicSubscriptionsForDirectoryOutgoingMessages;
-
-        [SetUp]
-        public void Setup()
-        {
-            _repositoryMock = new Mock<IPeerRepository>();
-            var configurationMock = new Mock<IDirectoryConfiguration>();
-            configurationMock.SetupGet(conf => conf.DisableDynamicSubscriptionsForDirectoryOutgoingMessages).Returns(() => _disableDynamicSubscriptionsForDirectoryOutgoingMessages);
-            _peerDirectory = new PeerDirectoryServer(configurationMock.Object, _repositoryMock.Object);
-
-            _updatedPeer = null;
-            _peerDirectory.PeerUpdated += (id, action) => _updatedPeer = new UpdatedPeer(id, action);
-
-            _bus = new TestBus();
-
-            _self = new Peer(new PeerId("Abc.DirectoryService.0"), "tcp://abc:42");
-            _otherPeer = new Peer(new PeerId("Abc.Testing.0"), "tcp://abc:123");
-        }
-
-        [Test]
-        public void register_persist_state_and_advertise()
-        {
-            using (SystemDateTime.PauseTime())
-            using (SystemDateTime.Set(SystemDateTime.Now))
-            {
-                var peerDescriptor = _self.ToPeerDescriptor(false, typeof(FakeCommand));
-
-                _peerDirectory.Register(_bus, peerDescriptor.Peer, peerDescriptor.Subscriptions);
-
-                _bus.ExpectExactly(new PeerStarted(peerDescriptor));
-                _repositoryMock.Verify(x => x.AddOrUpdatePeer(It.Is<PeerDescriptor>(descriptor => peerDescriptor.DeepCompare(descriptor))));
-            }
-        }
-
-        [Test]
-        public void should_raise_registered_event()
-        {
-            var peerDescriptor = _self.ToPeerDescriptor(true, typeof(FakeCommand));
-
-            var raised = false;
-            _peerDirectory.Registered += () => raised = true;
-
-            _peerDirectory.Register(_bus, peerDescriptor.Peer, new Subscription[0]);
-
-            raised.ShouldBeTrue();
-        }
-
-        [Test]
-        public void unregister_should_persist_state_and_advertise()
-        {
-            using (SystemDateTime.PauseTime())
-            using (SystemDateTime.Set(SystemDateTime.Now))
-            {
-                var peerDescriptor = _self.ToPeerDescriptor(true, typeof(FakeCommand));
-
-                _repositoryMock.Setup(repo => repo.Get(It.Is<PeerId>(id => peerDescriptor.Peer.Id.Equals(id)))).Returns(peerDescriptor);
-                _peerDirectory.Register(_bus, peerDescriptor.Peer, peerDescriptor.Subscriptions);
-
-                _peerDirectory.Unregister(_bus);
-
-                _bus.Expect(new[] { new PeerStopped(peerDescriptor.Peer) });
-                _repositoryMock.Verify(repo => repo.Get(It.Is<PeerId>(id => peerDescriptor.Peer.Id.Equals(id))));
-                _repositoryMock.Verify(repo => repo.AddOrUpdatePeer(It.Is<PeerDescriptor>(descriptor => peerDescriptor.DeepCompare(descriptor))));
-            }
-        }
-
-        [Test]
-        [TestCase(true)]
-        [TestCase(false)]
-        public void should_retrieve_the_peers_from_the_repository(bool disableDynamicSubscriptions)
-        {
-            _disableDynamicSubscriptionsForDirectoryOutgoingMessages = disableDynamicSubscriptions;
-            _repositoryMock.Setup(repo => repo.GetPeers(It.Is<bool>(loadDynamicSubs => loadDynamicSubs != disableDynamicSubscriptions)))
-                           .Returns(new[]
-                           {
-                               TestDataBuilder.CreatePersistentPeerDescriptor("tcp://goodapple:123", typeof(FakeCommand)),
-                               TestDataBuilder.CreatePersistentPeerDescriptor("tcp://badapple:123", typeof(string))
-                           });
-
-            var peersHandlingFakeCommand = _peerDirectory.GetPeersHandlingMessage(new FakeCommand()).ToList();
-
-            peersHandlingFakeCommand.Count().ShouldEqual(1);
-            peersHandlingFakeCommand.First().EndPoint.ShouldEqual("tcp://goodapple:123");
-        }
-
-        [Test]
-        public void should_get_peer_with_matching_subscrition_binding_key()
-        {
-            var command = new FakeRoutableCommand(10, "u.name");
-
-            var peerDescriptor = TestDataBuilder.CreatePersistentPeerDescriptor("tcp://goodapple:123", new Subscription(command.TypeId(), new BindingKey("10", "#")));
-            _repositoryMock.Setup(x => x.GetPeers(It.IsAny<bool>())).Returns(new[] { peerDescriptor });
-
-            var peer = _peerDirectory.GetPeersHandlingMessage(command).Single();
-            peer.Id.ShouldEqual(peerDescriptor.Peer.Id);
-        }
-
-        [Test]
-        public void should_not_get_peer_with_non_matching_subscrition_binding_key()
-        {
-            var command = new FakeRoutableCommand(10, "u.name");
-
-            var peerDescriptor = TestDataBuilder.CreatePersistentPeerDescriptor("tcp://goodapple:123", new Subscription(command.TypeId(), new BindingKey("12", "#")));
-            _repositoryMock.Setup(x => x.GetPeers(It.IsAny<bool>())).Returns(new[] { peerDescriptor });
-
-            _peerDirectory.GetPeersHandlingMessage(command).ShouldBeEmpty();
-        }
-
-        [Test]
-        public void should_get_peer_by_id()
-        {
-            var peerDescriptor = TestDataBuilder.CreatePersistentPeerDescriptor("tcp://badapple:123", typeof(string));
-            _repositoryMock.Setup(repo => repo.Get(peerDescriptor.Peer.Id)).Returns(peerDescriptor);
-
-            var fetchedPeerDescriptor = _peerDirectory.GetPeerDescriptor(peerDescriptor.Peer.Id);
-
-            fetchedPeerDescriptor.ShouldEqualDeeply(peerDescriptor);
-        }
-
-        [Test]
-        public void should_get_all_peers()
-        {
-            var peerDescriptor = TestDataBuilder.CreatePersistentPeerDescriptor("tcp://badapple:123", typeof(string));
-            _repositoryMock.Setup(repo => repo.GetPeers(It.IsAny<bool>())).Returns(new[] { peerDescriptor });
-
-            var fetchedPeerDescriptor = _peerDirectory.GetPeerDescriptors();
-
-            fetchedPeerDescriptor.Single().ShouldEqualDeeply(peerDescriptor);
-        }
-
-        [Test]
-        public void should_update_subscriptions()
-        {
-            var peerDescriptor = TestDataBuilder.CreatePersistentPeerDescriptor("tcp://lala:123");
-            _peerDirectory.Register(_bus, peerDescriptor.Peer, peerDescriptor.Subscriptions);
-
-            _repositoryMock.Setup(x => x.Get(peerDescriptor.Peer.Id)).Returns(peerDescriptor);
-
-            var subscriptions = new[] { new Subscription(new MessageTypeId(typeof(FakeCommand))) };
-            using (SystemDateTime.PauseTime())
-            using (SystemDateTime.Set(SystemDateTime.Now))
-            {
-                _peerDirectory.Update(_bus, subscriptions);
-
-                var expectedPeerDescriptor = peerDescriptor.Peer.ToPeerDescriptor(peerDescriptor.IsPersistent, subscriptions);
-                _repositoryMock.Verify(x => x.AddOrUpdatePeer(It.Is<PeerDescriptor>(descriptor => descriptor.DeepCompare(expectedPeerDescriptor))));
-
-                var updatedEvent = _bus.Events.OfType<PeerSubscriptionsUpdated>().Single();
-                updatedEvent.PeerDescriptor.ShouldEqualDeeply(expectedPeerDescriptor);
-            }
-        }
-
-        [Test]
-        public void should_raise_peer_updated_after_peer_started()
-        {
-            _peerDirectory.Handle(new PeerStarted(_otherPeer.ToPeerDescriptor(true)));
-
-            _updatedPeer.ShouldNotBeNull();
-            _updatedPeer.PeerId.ShouldEqual(_otherPeer.Id);
-            _updatedPeer.Action.ShouldEqual(PeerUpdateAction.Started);
-        }
-
-        [Test]
-        public void should_raise_peer_updated_after_peer_stopped()
-        {
-            _peerDirectory.Handle(new PeerStopped(_otherPeer));
-
-            _updatedPeer.ShouldNotBeNull();
-            _updatedPeer.PeerId.ShouldEqual(_otherPeer.Id);
-            _updatedPeer.Action.ShouldEqual(PeerUpdateAction.Stopped);
-        }
-        
-        [Test]
-        public void should_raise_peer_updated_after_peer_decommissioned()
-        {
-            _peerDirectory.Handle(new PeerDecommissioned(_otherPeer.Id));
-
-            _updatedPeer.ShouldNotBeNull();
-            _updatedPeer.PeerId.ShouldEqual(_otherPeer.Id);
-            _updatedPeer.Action.ShouldEqual(PeerUpdateAction.Decommissioned);
-        }
-        
-        [Test]
-        public void should_raise_peer_updated_after_peer_subscription_updated()
-        {
-            _peerDirectory.Handle(new PeerSubscriptionsUpdated(_otherPeer.ToPeerDescriptor(true)));
-
-            _updatedPeer.ShouldNotBeNull();
-            _updatedPeer.PeerId.ShouldEqual(_otherPeer.Id);
-            _updatedPeer.Action.ShouldEqual(PeerUpdateAction.Updated);
-        }
-
-        [Test]
-        public void should_raise_peer_updated_after_peer_not_responding()
-        {
-            _peerDirectory.Handle(new PeerNotResponding(_otherPeer.Id));
-
-            _updatedPeer.ShouldNotBeNull();
-            _updatedPeer.PeerId.ShouldEqual(_otherPeer.Id);
-            _updatedPeer.Action.ShouldEqual(PeerUpdateAction.Updated);
-        }
-
-        [Test]
-        public void should_raise_peer_updated_after_peer_responding()
-        {
-            _peerDirectory.Handle(new PeerResponding(_otherPeer.Id));
-
-            _updatedPeer.ShouldNotBeNull();
-            _updatedPeer.PeerId.ShouldEqual(_otherPeer.Id);
-            _updatedPeer.Action.ShouldEqual(PeerUpdateAction.Updated);
-        }
-
-        private class UpdatedPeer
-        {
-            public readonly PeerId PeerId;
-            public readonly PeerUpdateAction Action;
-
-            public UpdatedPeer(PeerId peerId, PeerUpdateAction action)
-            {
-                PeerId = peerId;
-                Action = action;
-            }
-        }
-    }
-}

+ 0 - 6
src/Abc.Zebus.Directory.Tests/Properties/AssemblyInfo.cs

@@ -1,6 +0,0 @@
-using System.Reflection;
-using System.Runtime.InteropServices;
-
-[assembly: AssemblyTitle("Abc.Zebus.Directory.Tests")]
-[assembly: ComVisible(false)]
-[assembly: Guid("f2e57d1b-6d9d-4f9a-8a10-8c0a1a1fb6f6")]

+ 0 - 323
src/Abc.Zebus.Directory.Tests/Storage/MemoryPeerRepositoryTests.cs

@@ -1,323 +0,0 @@
-using System;
-using System.Linq;
-using Abc.Zebus.Directory.Storage;
-using Abc.Zebus.Routing;
-using Abc.Zebus.Testing;
-using Abc.Zebus.Testing.Extensions;
-using Abc.Zebus.Util;
-using NUnit.Framework;
-
-namespace Abc.Zebus.Directory.Tests.Storage
-{
-    [TestFixture]
-    public class MemoryPeerRepositoryTests
-    {
-        private MemoryPeerRepository _repository;
-        private Peer _peer1;
-        private Peer _peer2;
-
-        [SetUp]
-        public void Setup()
-        {
-            _repository = new MemoryPeerRepository();
-            _peer1 = new Peer(new PeerId("Abc.Peer.1"), "tcp://endpoint:123");
-            _peer2 = new Peer(new PeerId("Abc.Peer.2"), "tcp://endpoint:456");
-        }
-
-        [Test]
-        public void should_insert_and_get_peer()
-        {
-            var peerDescriptor = _peer1.ToPeerDescriptor(true, typeof(FakeCommand));
-
-            _repository.AddOrUpdatePeer(peerDescriptor);
-
-            var fetched = _repository.Get(peerDescriptor.Peer.Id);
-            fetched.ShouldHaveSamePropertiesAs(peerDescriptor);
-        }
-
-        [Test]
-        public void should_return_null_when_peer_does_not_exists()
-        {
-            var fetched = _repository.Get(new PeerId("PeerId"));
-
-            fetched.ShouldBeNull();
-        }
-
-        [Test]
-        public void should_get_all_peers()
-        {
-            var peerDescriptor1 = _peer1.ToPeerDescriptor(true, typeof(string));
-            peerDescriptor1.HasDebuggerAttached = true;
-            _repository.AddOrUpdatePeer(peerDescriptor1);
-
-            var peerDescriptor2 = _peer2.ToPeerDescriptor(true, typeof(int));
-            _repository.AddOrUpdatePeer(peerDescriptor2);
-
-            var fetchedPeers = _repository.GetPeers().ToList();
-
-            var fetchedPeer1 = fetchedPeers.Single(x => x.Peer.Id == peerDescriptor1.Peer.Id);
-            fetchedPeer1.ShouldHaveSamePropertiesAs(peerDescriptor1);
-            var fetchedPeer2 = fetchedPeers.Single(x => x.Peer.Id == peerDescriptor2.Peer.Id);
-            fetchedPeer2.ShouldHaveSamePropertiesAs(peerDescriptor2);
-        }
-
-        [Test]
-        public void should_update_peer()
-        {
-            var peerDescriptor = _peer1.ToPeerDescriptor(true, typeof(string));
-            _repository.AddOrUpdatePeer(peerDescriptor);
-
-            var updatedPeer = _peer1.ToPeerDescriptor(false, typeof(int));
-            _repository.AddOrUpdatePeer(updatedPeer);
-
-            var fetchedPeers = _repository.GetPeers();
-            var fetchedPeer = fetchedPeers.Single();
-            fetchedPeer.ShouldHaveSamePropertiesAs(updatedPeer);
-        }
-
-        [Test]
-        public void should_not_override_peer_with_old_version()
-        {
-            var descriptor1 = _peer1.ToPeerDescriptor(true, typeof(FakeCommand));
-            descriptor1.TimestampUtc = SystemDateTime.UtcNow.AddMinutes(1);
-            _repository.AddOrUpdatePeer(descriptor1);
-
-            var descriptor2 = _peer1.ToPeerDescriptor(true);
-            _repository.AddOrUpdatePeer(descriptor2);
-
-            var fetched = _repository.Get(_peer1.Id);
-            fetched.TimestampUtc.ShouldEqual(descriptor1.TimestampUtc);
-            fetched.Subscriptions.ShouldBeEquivalentTo(descriptor1.Subscriptions);
-        }
-
-        [Test]
-        public void should_remove_peer()
-        {
-            var peerDescriptor = _peer1.ToPeerDescriptor(true, typeof(string));
-
-            _repository.AddOrUpdatePeer(peerDescriptor);
-            _repository.RemovePeer(peerDescriptor.Peer.Id);
-
-            var fetched = _repository.Get(peerDescriptor.Peer.Id);
-            fetched.ShouldBeNull();
-        }
-
-        [Test]
-        public void should_insert_a_peer_with_no_timestamp_that_was_previously_deleted()
-        {
-            var descriptor = _peer1.ToPeerDescriptor(true);
-            descriptor.TimestampUtc = null;
-
-            _repository.AddOrUpdatePeer(descriptor);
-
-            var fetched = _repository.Get(_peer1.Id);
-            fetched.ShouldNotBeNull();
-        }
-
-        [Test]
-        public void should_add_dynamic_subscriptions()
-        {
-            var peerDescriptor = _peer1.ToPeerDescriptor(true, typeof(FakeCommand));
-            _repository.AddOrUpdatePeer(peerDescriptor);
-
-            _repository.AddDynamicSubscriptionsForTypes(peerDescriptor.PeerId, peerDescriptor.TimestampUtc.Value, new[] { CreateSubscriptionsForType<int>() });
-
-            var fetched = _repository.Get(peerDescriptor.Peer.Id);
-            fetched.Subscriptions.ShouldEqual(new[]
-            {
-                CreateSubscriptionFor<FakeCommand>(),
-                CreateSubscriptionFor<int>()
-            });
-        }
-
-
-        [Test]
-        public void should_get_dynamic_subscriptions_in_GetPeers()
-        {
-            var peerDescriptor = _peer1.ToPeerDescriptor(true, typeof(FakeCommand));
-            _repository.AddOrUpdatePeer(peerDescriptor);
-
-            _repository.AddDynamicSubscriptionsForTypes(peerDescriptor.PeerId, peerDescriptor.TimestampUtc.Value, new[] { CreateSubscriptionsForType<int>() });
-
-            var fetched = _repository.GetPeers().ExpectedSingle();
-            fetched.Subscriptions.ShouldEqual(new[]
-            {
-                CreateSubscriptionFor<FakeCommand>(),
-                CreateSubscriptionFor<int>()
-            });
-        }
-
-        [Test]
-        public void should_not_get_dynamic_subscriptions_in_GetPeers_if_called_with_proper_flag()
-        {
-            var peerDescriptor = _peer1.ToPeerDescriptorWithRoundedTime(true, typeof(FakeCommand));
-            _repository.AddOrUpdatePeer(peerDescriptor);
-
-            _repository.AddDynamicSubscriptionsForTypes(peerDescriptor.PeerId, peerDescriptor.TimestampUtc.Value, new[] { CreateSubscriptionsForType<int>() });
-
-            var fetched = _repository.GetPeers(loadDynamicSubscriptions: false).ExpectedSingle();
-            fetched.Subscriptions.ShouldEqual(new[]
-            {
-                CreateSubscriptionFor<FakeCommand>()
-            });
-        }
-
-        private Subscription CreateSubscriptionFor<TMessage>(params string[] bindingKeyParts)
-        {
-            return new Subscription(MessageUtil.GetTypeId(typeof(TMessage)), new BindingKey(bindingKeyParts));
-        }
-
-        private SubscriptionsForType CreateSubscriptionsForType<TMessage>(params BindingKey[] bindings)
-        {
-            return new SubscriptionsForType(MessageUtil.GetTypeId(typeof(TMessage)), bindings.Any() ? bindings : new[] { BindingKey.Empty });
-        }
-
-        [Test]
-        public void should_remove_dynamic_subscriptions()
-        {
-            var peerDescriptor = _peer1.ToPeerDescriptor(true, typeof(FakeCommand));
-            _repository.AddOrUpdatePeer(peerDescriptor);
-            _repository.AddDynamicSubscriptionsForTypes(peerDescriptor.PeerId, peerDescriptor.TimestampUtc.Value, new[] { CreateSubscriptionsForType<int>() });
-
-            _repository.RemoveDynamicSubscriptionsForTypes(peerDescriptor.PeerId, peerDescriptor.TimestampUtc.Value, new[] { MessageUtil.GetTypeId(typeof(int)) });
-
-            var fetched = _repository.Get(peerDescriptor.Peer.Id);
-            fetched.ShouldHaveSamePropertiesAs(peerDescriptor);
-        }
-
-        [Test]
-        public void removing_a_dynamic_subscription_doesnt_remove_static_subscription()
-        {
-            var peerDescriptor = _peer1.ToPeerDescriptor(true, typeof(FakeCommand));
-            _repository.AddOrUpdatePeer(peerDescriptor);
-
-            _repository.RemoveDynamicSubscriptionsForTypes(peerDescriptor.PeerId, peerDescriptor.TimestampUtc.Value, new[] { MessageUtil.GetTypeId(typeof(FakeCommand)) });
-
-            var fetched = _repository.Get(peerDescriptor.Peer.Id);
-            fetched.ShouldHaveSamePropertiesAs(peerDescriptor);
-        }
-
-        [Test]
-        public void should_handle_dynamic_subscriptions_with_empty_binding_key_aside_static_one()
-        {
-            var peerDescriptor = _peer1.ToPeerDescriptor(true, typeof(FakeCommand));
-            _repository.AddOrUpdatePeer(peerDescriptor);
-
-            _repository.AddDynamicSubscriptionsForTypes(peerDescriptor.PeerId, peerDescriptor.TimestampUtc.Value, new[] { CreateSubscriptionsForType<FakeCommand>() });
-
-            var fetched = _repository.Get(peerDescriptor.Peer.Id);
-            fetched.Subscriptions.ShouldEqual(new[]
-            {
-                CreateSubscriptionFor<FakeCommand>(),
-            });
-        }
-
-        [Test]
-        public void should_handle_dynamic_subscriptions_with_empty_binding_key_aside_specific_one()
-        {
-            var peerDescriptor = _peer1.ToPeerDescriptor(true, typeof(FakeCommand));
-            _repository.AddOrUpdatePeer(peerDescriptor);
-
-            _repository.AddDynamicSubscriptionsForTypes(peerDescriptor.PeerId, peerDescriptor.TimestampUtc.Value, new[] { CreateSubscriptionsForType<FakeCommand>(BindingKey.Empty, new BindingKey("toto")) });
-
-            var fetched = _repository.Get(peerDescriptor.Peer.Id);
-            fetched.Subscriptions.ShouldEqual(new[]
-            {
-                CreateSubscriptionFor<FakeCommand>(),
-                CreateSubscriptionFor<FakeCommand>("toto"),
-            });
-        }
-        
-        [Test]
-        public void should_deduplicate_dynamic_subscriptions_and_static_subscriptions()
-        {
-            var peerDescriptor = _peer1.ToPeerDescriptor(true, typeof(FakeCommand));
-            _repository.AddOrUpdatePeer(peerDescriptor);
-
-            _repository.AddDynamicSubscriptionsForTypes(peerDescriptor.PeerId, peerDescriptor.TimestampUtc.Value, new[] { CreateSubscriptionsForType<FakeCommand>(), CreateSubscriptionsForType<FakeCommand>() });
-
-            var fetched = _repository.Get(peerDescriptor.Peer.Id);
-            fetched.Subscriptions.ShouldEqual(new[] { CreateSubscriptionFor<FakeCommand>() });
-        }
-
-        [Test]
-        public void should_not_mixup_subscriptions_to_same_type_with_different_tokens()
-        {
-            var peerDescriptor = _peer1.ToPeerDescriptor(true, typeof(FakeCommand));
-            _repository.AddOrUpdatePeer(peerDescriptor);
-
-            _repository.AddDynamicSubscriptionsForTypes(peerDescriptor.PeerId, peerDescriptor.TimestampUtc.Value, new[] { CreateSubscriptionsForType<FakeCommand>(new BindingKey("bli")), CreateSubscriptionsForType<FakeCommand>(new BindingKey("bla")) });
-
-            var fetched = _repository.Get(peerDescriptor.Peer.Id);
-            fetched.Subscriptions.ShouldEqual(new[]
-            {
-                CreateSubscriptionFor<FakeCommand>(),
-                CreateSubscriptionFor<FakeCommand>("bli"),
-                CreateSubscriptionFor<FakeCommand>("bla")
-            });
-        }
-
-        [Test]
-        public void should_not_add_dynamic_subscriptions_using_outdated_add_command()
-        {
-            var pastPeerDescriptor = _peer1.ToPeerDescriptor(true, typeof(FakeCommand));
-            pastPeerDescriptor.TimestampUtc = SystemDateTime.UtcNow.AddMinutes(-1).RoundToMillisecond();
-            var presentPeerDescriptor = _peer1.ToPeerDescriptor(true, typeof(FakeCommand));
-            _repository.AddOrUpdatePeer(presentPeerDescriptor);
-
-            _repository.RemoveDynamicSubscriptionsForTypes(presentPeerDescriptor.PeerId, presentPeerDescriptor.TimestampUtc.Value, new[] { MessageUtil.GetTypeId(typeof(int)) });
-            _repository.AddDynamicSubscriptionsForTypes(pastPeerDescriptor.PeerId, pastPeerDescriptor.TimestampUtc.Value, new[] { CreateSubscriptionsForType<int>() });
-
-            var fetched = _repository.Get(presentPeerDescriptor.Peer.Id);
-            fetched.Subscriptions.ShouldEqual(new[] { CreateSubscriptionFor<FakeCommand>() });
-        }
-
-        [Test]
-        public void should_not_remove_dynamic_subscriptions_using_outdated_delete_command()
-        {
-            var pastPeerDescriptor = _peer1.ToPeerDescriptor(true, typeof(FakeCommand));
-            pastPeerDescriptor.TimestampUtc = SystemDateTime.UtcNow.AddMinutes(-1).RoundToMillisecond();
-            var presentPeerDescriptor = _peer1.ToPeerDescriptor(true, typeof(FakeCommand));
-            _repository.AddOrUpdatePeer(presentPeerDescriptor);
-            _repository.AddDynamicSubscriptionsForTypes(presentPeerDescriptor.PeerId, presentPeerDescriptor.TimestampUtc.Value, new[] { CreateSubscriptionsForType<int>() });
-
-            _repository.AddDynamicSubscriptionsForTypes(presentPeerDescriptor.PeerId, presentPeerDescriptor.TimestampUtc.Value, new[] { CreateSubscriptionsForType<int>() });
-            _repository.RemoveDynamicSubscriptionsForTypes(pastPeerDescriptor.PeerId, pastPeerDescriptor.TimestampUtc.Value, new[] { MessageUtil.GetTypeId(typeof(int)) });
-
-
-            var fetched = _repository.Get(presentPeerDescriptor.Peer.Id);
-            fetched.Subscriptions.ShouldEqual(new[]
-            {
-                CreateSubscriptionFor<FakeCommand>(),
-                CreateSubscriptionFor<int>()
-            });
-        }
-
-        [Test]
-        public void should_remove_dynamic_subscriptions_for_peer()
-        {
-            var firstPeer = _peer1.ToPeerDescriptor(true, typeof(FakeCommand));
-            var secondPeer = _peer2.ToPeerDescriptor(true, typeof(FakeCommand));
-            _repository.AddOrUpdatePeer(firstPeer);
-            _repository.AddOrUpdatePeer(secondPeer);
-            _repository.AddDynamicSubscriptionsForTypes(firstPeer.PeerId, DateTime.UtcNow, new[] { CreateSubscriptionsForType<FakeCommand>(new BindingKey("toto")) });
-            _repository.AddDynamicSubscriptionsForTypes(secondPeer.PeerId, DateTime.UtcNow, new[] { CreateSubscriptionsForType<FakeCommand>(new BindingKey("toto")) });
-
-            _repository.RemoveAllDynamicSubscriptionsForPeer(secondPeer.PeerId);
-
-            var fetched = _repository.GetPeers().ToList();
-            fetched.Count.ShouldEqual(2);
-            var untouchedPeer = fetched.Single(peer => peer.PeerId == firstPeer.PeerId);
-            var peerWithTruncatedSubscriptions = fetched.Single(peer => peer.PeerId == secondPeer.PeerId);
-            untouchedPeer.Subscriptions.ShouldEqual(new[]
-            {
-                CreateSubscriptionFor<FakeCommand>(),
-                CreateSubscriptionFor<FakeCommand>("toto")
-            });
-            peerWithTruncatedSubscriptions.Subscriptions.ShouldEqual(new[]
-            {
-                CreateSubscriptionFor<FakeCommand>()
-            });
-        }
-    }
-}

+ 0 - 31
src/Abc.Zebus.Directory.Tests/TestDataBuilder.cs

@@ -1,31 +0,0 @@
-using System;
-using System.Linq;
-using Abc.Zebus.Util;
-
-namespace Abc.Zebus.Directory.Tests
-{
-    public static class TestDataBuilder
-    {
-        public static PeerDescriptor CreatePersistentPeerDescriptor(string endPoint)
-        {
-            return CreatePersistentPeerDescriptor(endPoint, new Subscription[0]);
-        }
-
-        public static PeerDescriptor CreatePersistentPeerDescriptor(string endPoint, params Type[] types)
-        {
-            var subscriptions = types.Select(x => new Subscription(new MessageTypeId(x))).ToArray();
-            return new PeerDescriptor(new PeerId("Abc.Testing.0"), endPoint, true, true, true, SystemDateTime.UtcNow, subscriptions);
-        }
-
-        public static PeerDescriptor CreatePersistentPeerDescriptor(string endPoint, params Subscription[] subscriptions)
-        {
-            return new PeerDescriptor(new PeerId("Abc.Testing.0"), endPoint, true, true, true, SystemDateTime.UtcNow, subscriptions);
-        }
-
-        public static PeerDescriptor CreateTransientPeerDescriptor(string endPoint, params Type[] types)
-        {
-            var subscriptions = types.Select(x => new Subscription(new MessageTypeId(x))).ToArray();
-            return new PeerDescriptor(new PeerId("Abc.Testing.0"), endPoint, false, true, true, SystemDateTime.UtcNow, subscriptions);
-        }
-    }
-}

+ 0 - 97
src/Abc.Zebus.Directory/Abc.Zebus.Directory.csproj

@@ -1,97 +0,0 @@
-<?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>
-    <OverrideOutputType>Exe</OverrideOutputType>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProjectGuid>{EE6730D9-6A21-46A5-AE3F-AF78060B6EA3}</ProjectGuid>
-    <OutputType>$(OverrideOutputType)</OutputType>
-    <AppDesignerFolder>Properties</AppDesignerFolder>
-    <RootNamespace>Abc.Zebus.Directory</RootNamespace>
-    <AssemblyName>Abc.Zebus.Directory</AssemblyName>
-    <TargetFrameworkVersion>v4.5</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>
-  <PropertyGroup>
-    <StartupObject />
-  </PropertyGroup>
-  <ItemGroup>
-    <Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\..\lib\log4net\log4net.dll</HintPath>
-    </Reference>
-    <Reference Include="StructureMap, Version=2.6.4.0, Culture=neutral, PublicKeyToken=e60ad81abae3c223, processorArchitecture=MSIL">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\..\lib\structuremap\StructureMap.dll</HintPath>
-    </Reference>
-    <Reference Include="System" />
-    <Reference Include="System.Configuration" />
-    <Reference Include="System.Core" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="..\SharedAssemblyInfo.cs">
-      <Link>Properties\SharedAssemblyInfo.cs</Link>
-    </Compile>
-    <Compile Include="..\SharedVersionInfo.cs">
-      <Link>Properties\SharedVersionInfo.cs</Link>
-    </Compile>
-    <Compile Include="Configuration\AppSettings.cs" />
-    <Compile Include="Configuration\AppSettingsBusConfiguration.cs" />
-    <Compile Include="Configuration\AppSettingsDirectoryConfiguration.cs" />
-    <Compile Include="DeadPeerDetection\DeadPeerDetector.cs" />
-    <Compile Include="DeadPeerDetection\DeadPeerDetectorEntry.cs" />
-    <Compile Include="DeadPeerDetection\DeadPeerStatus.cs" />
-    <Compile Include="DeadPeerDetection\IDeadPeerDetector.cs" />
-    <Compile Include="Handlers\DirectoryCommandsHandler.cs" />
-    <Compile Include="Configuration\IDirectoryConfiguration.cs" />
-    <Compile Include="PeerDirectoryServer.cs" />
-    <Compile Include="Program.cs" />
-    <Compile Include="Properties\AssemblyInfo.cs" />
-    <Compile Include="Storage\ExtendPeerRepository.cs" />
-    <Compile Include="Storage\IPeerRepository.cs" />
-    <Compile Include="Storage\MemoryPeerRepository.cs" />
-  </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\Abc.Zebus\Abc.Zebus.csproj">
-      <Project>{1f4c6307-6113-40d5-bf42-4b6bf5df13b2}</Project>
-      <Name>Abc.Zebus</Name>
-    </ProjectReference>
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="App.config" />
-    <None Include="log4net.config">
-      <SubType>Designer</SubType>
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </None>
-  </ItemGroup>
-  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
-  <PropertyGroup>
-    <PreBuildEvent>
-    </PreBuildEvent>
-  </PropertyGroup>
-  <!-- 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>

+ 0 - 13
src/Abc.Zebus.Directory/App.config

@@ -1,13 +0,0 @@
-<?xml version="1.0"?>
-<configuration>
-  <appSettings>
-
-    <add key="Endpoint" value="tcp://*:129"/>
-    <add key="Environment" value="Demo"/>
-    <add key="PeerId" value="Directory.0"/>
-    
-  </appSettings>
-  <startup>
-    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
-  </startup>
-</configuration>

+ 0 - 45
src/Abc.Zebus.Directory/Configuration/AppSettings.cs

@@ -1,45 +0,0 @@
-using System;
-using System.Configuration;
-using System.Globalization;
-
-namespace Abc.Zebus.Directory.Configuration
-{
-    internal static class AppSettings
-    {
-        public static T Get<T>(string key, T defaultValue)
-        {
-            var value = ConfigurationManager.AppSettings[key];
-            if (value == null)
-                return defaultValue;
-
-            return Parser<T>.Parse(value);
-        }
-
-        public static string[] GetArray(string key)
-        {
-            var value = ConfigurationManager.AppSettings[key];
-            if (value == null)
-                return new string[0];
-
-            return value.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
-        }
-
-        private static class Parser<T>
-        {
-            private static readonly Func<string, object> _value;
-
-            public static T Parse(string s)
-            {
-                return (T)_value(s);
-            }
-
-            static Parser()
-            {
-                if (typeof(T) == typeof(TimeSpan))
-                    _value = s => TimeSpan.Parse(s, CultureInfo.InvariantCulture);
-                else
-                    _value = s => Convert.ChangeType(s, typeof(T));
-            }
-        }
-    }
-}

+ 0 - 22
src/Abc.Zebus.Directory/Configuration/AppSettingsBusConfiguration.cs

@@ -1,22 +0,0 @@
-using System;
-using Abc.Zebus.Util;
-
-namespace Abc.Zebus.Directory.Configuration
-{
-    public class AppSettingsBusConfiguration : IBusConfiguration
-    {
-        public AppSettingsBusConfiguration()
-        {
-            RegistrationTimeout = AppSettings.Get("Bus.Directory.RegistrationTimeout", 30.Seconds());
-            StartReplayTimeout = AppSettings.Get("Bus.Persistence.StartReplayTimeout", 30.Seconds());
-            IsDirectoryPickedRandomly = AppSettings.Get("Bus.Directory.PickRandom", true);
-        }
-
-        public string[] DirectoryServiceEndPoints { get { return new string[0]; } }
-        public bool IsPersistent { get { return false; } }
-
-        public TimeSpan RegistrationTimeout { get; private set; }
-        public TimeSpan StartReplayTimeout { get; private set; }
-        public bool IsDirectoryPickedRandomly { get; private set; }
-    }
-}

+ 0 - 25
src/Abc.Zebus.Directory/Configuration/AppSettingsDirectoryConfiguration.cs

@@ -1,25 +0,0 @@
-using System;
-using Abc.Zebus.Util;
-
-namespace Abc.Zebus.Directory.Configuration
-{
-    public class AppSettingsDirectoryConfiguration : IDirectoryConfiguration
-    {
-        public AppSettingsDirectoryConfiguration()
-        {
-            PeerPingInterval = AppSettings.Get("Directory.PingPeers.Interval", 1.Minute());
-            TransientPeerPingTimeout = AppSettings.Get("Directory.TransientPeers.PingTimeout", 5.Minutes());
-            PersistentPeerPingTimeout = AppSettings.Get("Directory.PersistentPeers.PingTimeout", 5.Minutes());
-            DebugPeerPingTimeout = AppSettings.Get("Directory.DebugPeers.PingTimeout", 10.Minutes());
-            BlacklistedMachines = AppSettings.GetArray("Directory.BlacklistedMachines");
-            DisableDynamicSubscriptionsForDirectoryOutgoingMessages = AppSettings.Get("Directory.DisableDynamicSubscriptionsForDirectoryOutgoingMessages", false);
-        }
-
-        public TimeSpan PeerPingInterval { get; private set; }
-        public TimeSpan TransientPeerPingTimeout { get; private set; }
-        public TimeSpan PersistentPeerPingTimeout { get; private set; }
-        public TimeSpan DebugPeerPingTimeout { get; private set; }
-        public string[] BlacklistedMachines { get; private set; }
-        public bool DisableDynamicSubscriptionsForDirectoryOutgoingMessages { get; private set; }
-    }
-}

+ 0 - 46
src/Abc.Zebus.Directory/Configuration/IDirectoryConfiguration.cs

@@ -1,46 +0,0 @@
-using System;
-
-namespace Abc.Zebus.Directory.Configuration
-{
-    public interface IDirectoryConfiguration
-    {
-        /// <summary>
-        /// The interval at which the DeadPeerDetector pings Peers
-        /// </summary>
-        TimeSpan PeerPingInterval { get; }
-
-        /// <summary>
-        /// The amount of time after which a Transient Peer will be decommissionned
-        /// if it fails to respond to ping commands
-        /// </summary>
-        TimeSpan TransientPeerPingTimeout { get; }
-
-        /// <summary>
-        /// The amount of time after which a Persistent Peer will be decommissionned
-        /// if it fails to respond to ping commands
-        /// </summary>
-        TimeSpan PersistentPeerPingTimeout { get; }
-
-        /// <summary>
-        /// The amount of time after which a Peer attached to a debugger will be decommissionned
-        /// if it fails to respond to ping commands (this prevents developers from being disconnected
-        /// when debugging)
-        /// </summary>
-        TimeSpan DebugPeerPingTimeout { get; }
-
-        /// <summary>
-        /// The machine names of hosts that are not allowed to connect to this Directory
-        /// (adding your CI server here might prevent bad surprises)
-        /// </summary>
-        string[] BlacklistedMachines { get; }
-
-        /// <summary>
-        /// USE WITH CAUTION
-        /// This feature prevents the Peers from subscribing dynamically (https://github.com/Abc-Arbitrage/Zebus/wiki/Routing)
-        /// to the events published by the Directory server.
-        /// Its purpose is to dramatically improve the performance when working on a Bus
-        /// with massive (> 50 000) amounts of dynamic subscriptions (which is not recommended anyway)
-        /// </summary>
-        bool DisableDynamicSubscriptionsForDirectoryOutgoingMessages { get; }
-    }
-}

+ 0 - 164
src/Abc.Zebus.Directory/DeadPeerDetection/DeadPeerDetector.cs

@@ -1,164 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading;
-using System.Threading.Tasks;
-using Abc.Zebus.Directory.Configuration;
-using Abc.Zebus.Directory.Storage;
-using Abc.Zebus.Util;
-using Abc.Zebus.Util.Extensions;
-using log4net;
-
-namespace Abc.Zebus.Directory.DeadPeerDetection
-{
-    public class DeadPeerDetector : IDeadPeerDetector
-    {
-        private readonly Dictionary<PeerId, DeadPeerDetectorEntry> _peers = new Dictionary<PeerId, DeadPeerDetectorEntry>();
-        private readonly ILog _logger = LogManager.GetLogger(typeof(DeadPeerDetector));
-        private readonly IBus _bus;
-        private readonly IPeerRepository _peerRepository;
-        private readonly IDirectoryConfiguration _configuration;
-        private readonly TimeSpan _detectionPeriod = 5.Seconds();
-        private Thread _detectionThread;
-        private DateTime? _lastPingTimeUtc;
-        private bool _isRunning;
-
-        public DeadPeerDetector(IBus bus, IPeerRepository peerRepository, IDirectoryConfiguration configuration)
-        {
-            _bus = bus;
-            _peerRepository = peerRepository;
-            _configuration = configuration;
-
-            TaskScheduler = TaskScheduler.Current;
-            ExceptionHandler = ex => _logger.ErrorFormat("MainLoop error: {0}", ex);
-        }
-
-        public event Action PersistenceDownDetected = delegate { };
-        public event Action<PeerId, DateTime> PeerDownDetected = delegate { };
-        public event Action<PeerId, DateTime> PingMissed = delegate { };
-        public event Action<PeerId, DateTime> PeerRespondingDetected = delegate { };
-
-        public TaskScheduler TaskScheduler { get; set; }
-        public Action<Exception> ExceptionHandler { get; set; }
-
-        internal void DetectDeadPeers()
-        {
-            var timestampUtc = SystemDateTime.UtcNow;
-            var entries = _peerRepository.GetPeers(loadDynamicSubscriptions: false)
-                                         .Where(peer => !peer.Subscriptions.Any(sub => sub.MessageTypeId == MessageUtil.TypeId<RegisterPeerCommand>()))
-                                         .Select(ToPeerEntry)
-                                         .ToList();
-            
-            var shouldSendPing = ShouldSendPing(timestampUtc);
-            if (shouldSendPing)
-                _lastPingTimeUtc = timestampUtc;
-
-            foreach (var entry in entries.Where(x => x.IsUp))
-            {
-                entry.Process(timestampUtc, shouldSendPing);
-            }
-        }
-
-        private DeadPeerDetectorEntry ToPeerEntry(PeerDescriptor descriptor)
-        {
-            var peer = _peers.GetValueOrAdd(descriptor.PeerId, () => CreateEntry(descriptor));
-            peer.Descriptor = descriptor;
-
-            return peer;
-        }
-
-        private DeadPeerDetectorEntry CreateEntry(PeerDescriptor descriptor)
-        {
-            var entry = new DeadPeerDetectorEntry(descriptor, _configuration, _bus, TaskScheduler);
-            entry.PeerTimeoutDetected += OnPeerTimeout;
-            entry.PeerRespondingDetected += OnPeerResponding;
-            entry.PingMissed += (detectorEntry, time) => PingMissed(detectorEntry.Descriptor.PeerId, time);
-
-            return entry;
-        }
-
-        private void OnPeerTimeout(DeadPeerDetectorEntry entry, DateTime timeoutTimestampUtc)
-        {
-            var descriptor = entry.Descriptor;
-            if (descriptor.PeerId.IsPersistence())
-            {
-                PersistenceDownDetected();
-                return;
-            }
-
-            var canPeerBeUnregistered = !descriptor.IsPersistent || descriptor.HasDebuggerAttached;
-            if (canPeerBeUnregistered)
-            {
-                _bus.Send(new UnregisterPeerCommand(descriptor.Peer, timeoutTimestampUtc));
-            }
-            else if (descriptor.Peer.IsResponding)
-            {
-                PeerDownDetected(descriptor.PeerId, timeoutTimestampUtc);
-                
-                descriptor.Peer.IsResponding = false;
-            }
-        }
-
-        private void OnPeerResponding(DeadPeerDetectorEntry entry,DateTime timeoutTimestampUtc)
-        {
-            PeerRespondingDetected(entry.Descriptor.PeerId, timeoutTimestampUtc);
-        }
-
-        private bool ShouldSendPing(DateTime timestampUtc)
-        {
-            if (_lastPingTimeUtc == null)
-                return true;
-
-            var elapsedSinceLastPing = timestampUtc - _lastPingTimeUtc.Value;
-            return elapsedSinceLastPing >= _configuration.PeerPingInterval;
-        }
-
-        public void Start()
-        {
-            _isRunning = true;
-            _detectionThread = new Thread(MainLoop) { Name = GetType().Name + "MainLoop" };
-            _detectionThread.Start();
-        }
-
-        public void Stop()
-        {
-            _isRunning = false;
-            if (!_detectionThread.Join(2000))
-                _logger.Warn("Unable to terminate MainLoop");
-        }
-
-        void IDisposable.Dispose()
-        {
-            if (_isRunning)
-                Stop();
-        }
-
-        private void MainLoop()
-        {
-            _logger.InfoFormat("MainLoop started");
-
-            var next = DateTime.UtcNow + _detectionPeriod;
-            while (_isRunning)
-            {
-                var utcNow = DateTime.UtcNow;
-                if (utcNow < next)
-                {
-                    Thread.Sleep(300);
-                    continue;
-                }
-
-                next += _detectionPeriod;
-
-                try
-                {
-                    DetectDeadPeers();
-                }
-                catch (Exception ex)
-                {
-                    ExceptionHandler(ex);
-                }
-            }
-            _logger.Info("MainLoop stopped");
-        }
-    }
-}

+ 0 - 171
src/Abc.Zebus.Directory/DeadPeerDetection/DeadPeerDetectorEntry.cs

@@ -1,171 +0,0 @@
-using System;
-using System.Threading.Tasks;
-using Abc.Zebus.Directory.Configuration;
-using Abc.Zebus.Util;
-using log4net;
-
-namespace Abc.Zebus.Directory.DeadPeerDetection
-{
-    public class DeadPeerDetectorEntry
-    {
-        private readonly ILog _logger = LogManager.GetLogger(typeof(DeadPeerDetectorEntry));
-        private readonly IDirectoryConfiguration _configuration;
-        private readonly IBus _bus;
-        private readonly TaskScheduler _taskScheduler;
-        private readonly object _lock = new object();
-        private DateTime? _oldestUnansweredPingTimeUtc;
-        private DateTime? _timeoutTimestampUtc;
-
-        public DeadPeerDetectorEntry(PeerDescriptor descriptor, IDirectoryConfiguration configuration, IBus bus, TaskScheduler taskScheduler)
-        {
-            Descriptor = descriptor;
-            _configuration = configuration;
-            _bus = bus;
-            _taskScheduler = taskScheduler;
-        }
-
-        public event Action<DeadPeerDetectorEntry, DateTime> PeerTimeoutDetected = delegate { };
-        public event Action<DeadPeerDetectorEntry, DateTime> PeerRespondingDetected = delegate { };
-        public event Action<DeadPeerDetectorEntry, DateTime> PingMissed = delegate { };
-
-        public PeerDescriptor Descriptor { get; set; }
-        public DeadPeerStatus Status { get; private set; }
-
-        public bool IsUp
-        {
-            get { return Descriptor.Peer.IsUp; }
-        }
-
-        public bool WasRestarted
-        {
-            get
-            {
-                lock (_lock)
-                {
-                    return Descriptor.TimestampUtc > _timeoutTimestampUtc;
-                }
-            }
-        }
-
-        public void Process(DateTime timestampUtc, bool shouldSendPing)
-        {
-            if (WasRestarted)
-                Reset();
-
-            var hasReachedTimeout = Status == DeadPeerStatus.Up && HasReachedTimeout();
-            if (hasReachedTimeout)
-                Timeout();
-            else if (shouldSendPing)
-                Ping(timestampUtc);
-        }
-
-        public void Ping(DateTime timestampUtc)
-        {
-            lock (_lock)
-            {
-                if (_oldestUnansweredPingTimeUtc == null)
-                    _oldestUnansweredPingTimeUtc = timestampUtc;
-                var elapsedTimeSinceFirstPing = SystemDateTime.UtcNow - _oldestUnansweredPingTimeUtc;
-                if (elapsedTimeSinceFirstPing > _configuration.PeerPingInterval)
-                    PingMissed(this, timestampUtc);
-            }
-
-            SendPingCommand(timestampUtc);
-        }
-
-        public void Timeout()
-        {
-            DateTime timeoutTimestampUtc;
-
-            lock (_lock)
-            {
-                if (_oldestUnansweredPingTimeUtc == null)
-                    return;
-
-                timeoutTimestampUtc = _oldestUnansweredPingTimeUtc.Value;
-                _timeoutTimestampUtc = timeoutTimestampUtc;
-                Status = DeadPeerStatus.Down;
-            }
-
-            var descriptor = Descriptor;
-
-            _logger.WarnFormat("Peer timeout, PeerId: {0}", descriptor.PeerId);
-
-            PeerTimeoutDetected(this, timeoutTimestampUtc);
-        }
-
-        public void Reset()
-        {
-            bool wasDown;
-
-            lock (_lock)
-            {
-                _oldestUnansweredPingTimeUtc = null;
-                _timeoutTimestampUtc = null;
-
-                wasDown = Status == DeadPeerStatus.Down;
-                Status = DeadPeerStatus.Up;
-            }
-
-            if (wasDown)
-                _logger.InfoFormat("Peer reset, PeerId: {0}", Descriptor.PeerId);
-        }
-
-        public bool HasReachedTimeout()
-        {
-            lock (_lock)
-            {
-                if (_oldestUnansweredPingTimeUtc == null)
-                    return false;
-
-                var elapsed = (SystemDateTime.UtcNow - _oldestUnansweredPingTimeUtc.Value).Duration();
-
-                if (Descriptor.HasDebuggerAttached)
-                    return elapsed >= _configuration.DebugPeerPingTimeout;
-
-                if (Descriptor.IsPersistent)
-                    return elapsed >= _configuration.PersistentPeerPingTimeout;
-
-                return elapsed >= _configuration.TransientPeerPingTimeout;
-            }
-        }
-
-        private void SendPingCommand(DateTime timestampUtc)
-        {
-            _bus.Send(new PingPeerCommand(), Descriptor.Peer).ContinueWith(OnPingCommandAck, timestampUtc, _taskScheduler);
-        }
-
-        public void OnPingCommandAck(Task<CommandResult> pingTask, object state)
-        {
-            if (pingTask.IsFaulted)
-            {
-                _logger.DebugFormat("Ping failed, PeerId: {0}, Exception: {1}", Descriptor.PeerId, pingTask.Exception);
-                return;
-            }
-
-            if (!pingTask.Result.IsSuccess)
-            {
-                _logger.DebugFormat("Ping failed, PeerId: {0}", Descriptor.PeerId);
-                return;
-            }
-
-            var pingTimestampUtc = (DateTime)state;
-            var peerRespondingDetected = false;
-
-            lock (_lock)
-            {
-                var peer = Descriptor.Peer;
-                if (!peer.IsResponding)
-                {
-                    peerRespondingDetected = true;
-                    peer.IsResponding = true;
-                }
-            }
-
-            if (peerRespondingDetected)
-                PeerRespondingDetected(this, pingTimestampUtc);
-
-            Reset();
-        }
-    }
-}

+ 0 - 8
src/Abc.Zebus.Directory/DeadPeerDetection/DeadPeerStatus.cs

@@ -1,8 +0,0 @@
-namespace Abc.Zebus.Directory.DeadPeerDetection
-{
-    public enum DeadPeerStatus
-    {
-        Up,
-        Down,
-    }
-}

+ 0 - 17
src/Abc.Zebus.Directory/DeadPeerDetection/IDeadPeerDetector.cs

@@ -1,17 +0,0 @@
-using System;
-
-namespace Abc.Zebus.Directory.DeadPeerDetection
-{
-    public interface IDeadPeerDetector : IDisposable
-    {
-        event Action PersistenceDownDetected;
-        event Action<PeerId, DateTime> PeerDownDetected;
-        event Action<PeerId, DateTime> PeerRespondingDetected;
-        event Action<PeerId, DateTime> PingMissed;
-        
-        Action<Exception> ExceptionHandler { get; set; }
-        
-        void Start();
-        void Stop();
-    }
-}

+ 0 - 112
src/Abc.Zebus.Directory/Handlers/DirectoryCommandsHandler.cs

@@ -1,112 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Abc.Zebus.Directory.Configuration;
-using Abc.Zebus.Directory.Storage;
-using Abc.Zebus.Util;
-using Abc.Zebus.Util.Extensions;
-
-namespace Abc.Zebus.Directory.Handlers
-{
-    public class DirectoryCommandsHandler : IMessageHandler<RegisterPeerCommand>,
-                                            IMessageHandler<UpdatePeerSubscriptionsCommand>,
-                                            IMessageHandler<UnregisterPeerCommand>,
-                                            IMessageHandler<DecommissionPeerCommand>,
-                                            IMessageHandler<UpdatePeerSubscriptionsForTypesCommand>,
-                                            IMessageContextAware
-    {
-        private readonly HashSet<string> _blacklistedMachines;
-        private readonly IBus _bus;
-        private readonly IPeerRepository _peerRepository;
-
-        public DirectoryCommandsHandler(IBus bus, IPeerRepository peerRepository, IDirectoryConfiguration configuration)
-        {
-            _bus = bus;
-            _peerRepository = peerRepository;
-            _blacklistedMachines = configuration.BlacklistedMachines.ToHashSet(StringComparer.OrdinalIgnoreCase);
-        }
-
-        public MessageContext Context { get; set; }
-
-        public void Handle(DecommissionPeerCommand message)
-        {
-            RemovePeer(message.PeerId);
-        }
-
-        public void Handle(RegisterPeerCommand message)
-        {
-            if (_blacklistedMachines.Contains(Context.Originator.SenderMachineName))
-                throw new InvalidOperationException("Peer " + Context.Originator.SenderMachineName + " is not allowed to register on this directory");
-
-            var peerDescriptor = message.Peer;
-            peerDescriptor.Peer.IsUp = true;
-            peerDescriptor.Peer.IsResponding = true;
-
-            var existingPeer = _peerRepository.Get(peerDescriptor.PeerId);
-            if (IsPeerInConflict(existingPeer, peerDescriptor))
-                throw new DomainException(DirectoryErrorCodes.PeerAlreadyExists, string.Format("Peer {0} already exists (running on {1})", peerDescriptor.PeerId, existingPeer.Peer.EndPoint));
-
-            _peerRepository.RemoveAllDynamicSubscriptionsForPeer(peerDescriptor.PeerId);
-            _peerRepository.AddOrUpdatePeer(peerDescriptor);
-            _bus.Publish(new PeerStarted(peerDescriptor));
-
-            var registredPeerDescriptors = _peerRepository.GetPeers(loadDynamicSubscriptions: true);
-            _bus.Reply(new RegisterPeerResponse(registredPeerDescriptors.ToArray()));
-        }
-
-        public void Handle(UnregisterPeerCommand message)
-        {
-            var peer = _peerRepository.Get(message.PeerId);
-            if (peer == null || peer.TimestampUtc > message.TimestampUtc)
-                return;
-
-            if (peer.IsPersistent)
-                StopPeer(message, peer);
-            else
-                RemovePeer(message.PeerId);
-        }
-
-        public void Handle(UpdatePeerSubscriptionsCommand message)
-        {
-            var peerDescriptor = _peerRepository.UpdatePeerSubscriptions(message.PeerId, message.Subscriptions, message.TimestampUtc);
-            if (peerDescriptor != null)
-                _bus.Publish(new PeerSubscriptionsUpdated(peerDescriptor));
-        }
-
-        private bool IsPeerInConflict(PeerDescriptor existingPeer, PeerDescriptor peerToAdd)
-        {
-            return existingPeer != null &&
-                   existingPeer.Peer.IsResponding &&
-                   existingPeer.PeerId == peerToAdd.PeerId &&
-                   existingPeer.Peer.GetMachineNameFromEndPoint() != peerToAdd.Peer.GetMachineNameFromEndPoint();
-        }
-
-        private void RemovePeer(PeerId peerId)
-        {
-            _peerRepository.RemovePeer(peerId);
-            _bus.Publish(new PeerDecommissioned(peerId));
-        }
-
-        private void StopPeer(UnregisterPeerCommand message, PeerDescriptor peer)
-        {
-            var peerId = message.PeerId;
-            var endPoint = message.PeerEndPoint ?? peer.Peer.EndPoint;
-            var timestampUtc = message.TimestampUtc ?? SystemDateTime.UtcNow;
-
-            if (_peerRepository.SetPeerDown(peerId, timestampUtc))
-                _bus.Publish(new PeerStopped(peerId, endPoint, timestampUtc));
-        }
-
-        public void Handle(UpdatePeerSubscriptionsForTypesCommand message)
-        {
-            var subscriptionsToAdd = message.SubscriptionsForTypes.Where(sub => sub.BindingKeys != null && sub.BindingKeys.Any()).ToArray();
-            var subscriptionsToRemove = message.SubscriptionsForTypes.Where(sub => sub.BindingKeys == null || !sub.BindingKeys.Any()).ToList();
-
-            if (subscriptionsToAdd.Any())
-                _peerRepository.AddDynamicSubscriptionsForTypes(message.PeerId, DateTime.SpecifyKind(message.TimestampUtc, DateTimeKind.Utc), subscriptionsToAdd);
-            if (subscriptionsToRemove.Any())
-                _peerRepository.RemoveDynamicSubscriptionsForTypes(message.PeerId, DateTime.SpecifyKind(message.TimestampUtc, DateTimeKind.Utc), subscriptionsToRemove.Select(sub => sub.MessageTypeId).ToArray());
-            _bus.Publish(new PeerSubscriptionsForTypesUpdated(message.PeerId, message.TimestampUtc, message.SubscriptionsForTypes));
-        }
-    }
-}

+ 0 - 127
src/Abc.Zebus.Directory/PeerDirectoryServer.cs

@@ -1,127 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
-using Abc.Zebus.Directory.Configuration;
-using Abc.Zebus.Directory.Storage;
-using Abc.Zebus.Util;
-
-namespace Abc.Zebus.Directory
-{
-    public class PeerDirectoryServer : IPeerDirectory,
-                                       IMessageHandler<PeerStarted>,
-                                       IMessageHandler<PeerStopped>,
-                                       IMessageHandler<PeerDecommissioned>,
-                                       IMessageHandler<PingPeerCommand>,
-                                       IMessageHandler<PeerSubscriptionsUpdated>,
-                                       IMessageHandler<PeerNotResponding>,
-                                       IMessageHandler<PeerResponding>
-    {
-        private readonly IDirectoryConfiguration _configuration;
-        private readonly IPeerRepository _peerRepository;
-        private Peer _self;
-
-        public PeerDirectoryServer(IDirectoryConfiguration configuration, IPeerRepository peerRepository)
-        {
-            _configuration = configuration;
-            _peerRepository = peerRepository;
-        }
-
-        public event Action Registered = delegate { };
-        public event Action<PeerId, PeerUpdateAction> PeerUpdated = delegate { };
-
-        public IList<Peer> GetPeersHandlingMessage(IMessage message)
-        {
-            return GetPeersHandlingMessage(MessageBinding.FromMessage(message));
-        }
-
-        public IList<Peer> GetPeersHandlingMessage(MessageBinding messageBinding)
-        {
-            return _peerRepository.GetPeers(!_configuration.DisableDynamicSubscriptionsForDirectoryOutgoingMessages)
-                                  .Where(peer => peer.Subscriptions != null && peer.Subscriptions.Any(x => x.MessageTypeId == messageBinding.MessageTypeId && x.Matches(messageBinding.RoutingKey)))
-                                  .Select(peerDesc => peerDesc.Peer)
-                                  .ToList();
-        }
-
-        public bool IsPersistent(PeerId peerId)
-        {
-            // TODO: avoid loading subscriptions
-
-            var peer = _peerRepository.Get(peerId);
-            return peer != null && peer.IsPersistent;
-        }
-
-        public PeerDescriptor GetPeerDescriptor(PeerId peerId)
-        {
-            return _peerRepository.Get(peerId);
-        }
-
-        public IEnumerable<PeerDescriptor> GetPeerDescriptors()
-        {
-            return _peerRepository.GetPeers();
-        }
-
-        public void Register(IBus bus, Peer self, IEnumerable<Subscription> subscriptions)
-        {
-            _self = self;
-
-            var selfDescriptor = new PeerDescriptor(self.Id, self.EndPoint, false, self.IsUp, self.IsResponding, SystemDateTime.UtcNow, subscriptions.ToArray())
-            {
-                HasDebuggerAttached = Debugger.IsAttached
-            };
-
-            _peerRepository.AddOrUpdatePeer(selfDescriptor);
-
-            bus.Publish(new PeerStarted(selfDescriptor));
-
-            Registered();
-        }
-
-        public void Update(IBus bus, IEnumerable<Subscription> subscriptions)
-        {
-            var peerDescriptor = _peerRepository.UpdatePeerSubscriptions(_self.Id, subscriptions.ToArray(), SystemDateTime.UtcNow);
-            if (peerDescriptor != null)
-                bus.Publish(new PeerSubscriptionsUpdated(peerDescriptor));
-        }
-
-        public void Unregister(IBus bus)
-        {
-            _peerRepository.SetPeerDown(_self.Id, SystemDateTime.UtcNow);
-            bus.Publish(new PeerStopped(_self));
-        }
-
-        public void Handle(PeerStarted message)
-        {
-            PeerUpdated(message.PeerDescriptor.PeerId, PeerUpdateAction.Started);
-        }
-
-        public void Handle(PeerStopped message)
-        {
-            PeerUpdated(message.PeerId, PeerUpdateAction.Stopped);
-        }
-
-        public void Handle(PeerDecommissioned message)
-        {
-            PeerUpdated(message.PeerId, PeerUpdateAction.Decommissioned);
-        }
-
-        public void Handle(PingPeerCommand message)
-        {
-        }
-
-        public void Handle(PeerSubscriptionsUpdated message)
-        {
-            PeerUpdated(message.PeerDescriptor.PeerId, PeerUpdateAction.Updated);
-        }
-
-        public void Handle(PeerNotResponding message)
-        {
-            PeerUpdated(message.PeerId, PeerUpdateAction.Updated);
-        }
-
-        public void Handle(PeerResponding message)
-        {
-            PeerUpdated(message.PeerId, PeerUpdateAction.Updated);
-        }
-    }
-}

+ 0 - 77
src/Abc.Zebus.Directory/Program.cs

@@ -1,77 +0,0 @@
-using System;
-using System.Configuration;
-using System.IO;
-using System.Threading;
-using Abc.Zebus.Core;
-using Abc.Zebus.Directory.Configuration;
-using Abc.Zebus.Directory.DeadPeerDetection;
-using Abc.Zebus.Directory.Storage;
-using Abc.Zebus.Dispatch;
-using Abc.Zebus.Util;
-using log4net;
-using log4net.Config;
-
-namespace Abc.Zebus.Directory
-{
-    internal class Program
-    {
-        private static readonly ManualResetEvent _cancelKeySignal = new ManualResetEvent(false);
-        private static readonly ILog _log = LogManager.GetLogger(typeof(Program));
-
-        public static void Main()
-        {
-            Console.CancelKeyPress += (sender, eventArgs) =>
-            {
-                eventArgs.Cancel = true;
-                _cancelKeySignal.Set();
-            };
-
-            XmlConfigurator.ConfigureAndWatch(new FileInfo(PathUtil.InBaseDirectory("log4net.config")));
-            _log.Info("Starting in memory directory");
-
-            var busFactory = new BusFactory();
-            InjectDirectoryServiceSpecificConfiguration(busFactory);
-
-            busFactory
-                .WithConfiguration(new AppSettingsBusConfiguration(), ConfigurationManager.AppSettings["Environment"])
-                .WithScan()
-                .WithEndpoint(ConfigurationManager.AppSettings["Endpoint"])
-                .WithPeerId(ConfigurationManager.AppSettings["PeerId"]);
-
-            using (busFactory.CreateAndStartBus())
-            {
-                _log.Info("In memory directory started");
-
-                _log.Info("Starting dead peer detector");
-                var deadPeerDetector = busFactory.Container.GetInstance<IDeadPeerDetector>();
-                deadPeerDetector.Start();
-
-                _cancelKeySignal.WaitOne();
-
-                _log.Info("Stopping dead peer detector");
-                deadPeerDetector.Stop();
-            }
-        }
-
-        private static void InjectDirectoryServiceSpecificConfiguration(BusFactory busFactory)
-        {
-            busFactory.ConfigureContainer(c =>
-            {
-                c.ForSingletonOf<IDirectoryConfiguration>().Use<AppSettingsDirectoryConfiguration>();
-
-                c.For<IDeadPeerDetector>().Use<DeadPeerDetector>();
-                c.ForSingletonOf<IPeerRepository>().Use<MemoryPeerRepository>();
-                c.ForSingletonOf<PeerDirectoryServer>().Use<PeerDirectoryServer>();
-                c.Forward<PeerDirectoryServer, IPeerDirectory>();
-
-                c.ForSingletonOf<IMessageDispatcher>().Use(ctx =>
-                {
-                    var dispatcher = ctx.GetInstance<MessageDispatcher>();
-                    dispatcher.ConfigureHandlerFilter(x => x != typeof(PeerDirectoryClient));
-
-                    return dispatcher;
-                });
-            });
-        }
-    }
-}

+ 0 - 9
src/Abc.Zebus.Directory/Properties/AssemblyInfo.cs

@@ -1,9 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-[assembly: AssemblyTitle("Abc.Zebus.Directory")]
-[assembly: ComVisible(false)]
-[assembly: Guid("0c080f48-d1bd-4648-b422-3dfb8df399d5")]
-
-[assembly: InternalsVisibleTo("Abc.Zebus.Directory.Tests")]

+ 0 - 50
src/Abc.Zebus.Directory/Storage/ExtendPeerRepository.cs

@@ -1,50 +0,0 @@
-using System;
-
-namespace Abc.Zebus.Directory.Storage
-{
-    public static class ExtendPeerRepository
-    {
-        public static bool SetPeerDown(this IPeerRepository repository, PeerId peerId, DateTime timestampUtc)
-        {
-            var peer = repository.Get(peerId);
-            if (peer == null || peer.TimestampUtc > timestampUtc)
-                return false;
-
-            peer.Peer.IsUp = false;
-            peer.Peer.IsResponding = false;
-            peer.TimestampUtc = timestampUtc;
-            repository.AddOrUpdatePeer(peer);
-
-            return true;
-        }
-
-        public static bool SetPeerRespondingState(this IPeerRepository repository, PeerId peerId, bool isResponding, DateTime timestampUtc)
-        {
-            var peer = repository.Get(peerId);
-            if (peer == null || peer.TimestampUtc > timestampUtc)
-                return false;
-
-            peer.Peer.IsResponding = isResponding;
-            peer.TimestampUtc = timestampUtc;
-            repository.AddOrUpdatePeer(peer);
-
-            return true;
-        }
-
-        public static PeerDescriptor UpdatePeerSubscriptions(this IPeerRepository repository, PeerId peerId, Subscription[] subscriptions, DateTime? timestampUtc)
-        {
-            var peerDescriptor = repository.Get(peerId);
-            if (peerDescriptor == null)
-                throw new InvalidOperationException(string.Format("The specified Peer ({0}) does not exist.", peerId));
-
-            if (peerDescriptor.TimestampUtc > timestampUtc)
-                return null;
-
-            peerDescriptor.TimestampUtc = timestampUtc;
-            peerDescriptor.Subscriptions = subscriptions;
-            repository.AddOrUpdatePeer(peerDescriptor);
-
-            return peerDescriptor;
-        }
-    }
-}

+ 0 - 19
src/Abc.Zebus.Directory/Storage/IPeerRepository.cs

@@ -1,19 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-namespace Abc.Zebus.Directory.Storage
-{
-    public interface IPeerRepository
-    {
-        PeerDescriptor Get(PeerId peerId);
-        IEnumerable<PeerDescriptor> GetPeers(bool loadDynamicSubscriptions = true);
-
-        void AddOrUpdatePeer(PeerDescriptor peerDescriptor);
-        void RemovePeer(PeerId peerId);
-        void SetPeerResponding(PeerId peerId, bool isResponding);
-
-        void AddDynamicSubscriptionsForTypes(PeerId peerId, DateTime timestampUtc, SubscriptionsForType[] subscriptionsForTypes);
-        void RemoveDynamicSubscriptionsForTypes(PeerId peerId, DateTime timestampUtc, MessageTypeId[] messageTypeIds);
-        void RemoveAllDynamicSubscriptionsForPeer(PeerId peerId);
-    }
-}

+ 0 - 105
src/Abc.Zebus.Directory/Storage/MemoryPeerRepository.cs

@@ -1,105 +0,0 @@
-using System;
-using System.Collections.Concurrent;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace Abc.Zebus.Directory.Storage
-{
-    public class MemoryPeerRepository : IPeerRepository
-    {
-        private class PeerEntry
-        {
-            public PeerDescriptor PeerDescriptor { get; set; }
-            public List<Subscription> DynamicSubscriptions { get; set; }
-
-            public PeerEntry(PeerDescriptor peerDescriptor)
-            {
-                PeerDescriptor = new PeerDescriptor(peerDescriptor);
-                DynamicSubscriptions = new List<Subscription>();
-            }
-
-            public PeerDescriptor GetPeerDescriptorWithStaticSubscriptionOnly()
-            {
-                return new PeerDescriptor(PeerDescriptor)
-                {
-                    Subscriptions = PeerDescriptor.Subscriptions.ToArray()
-                };
-            }
-
-            public PeerDescriptor GetMergedPeerDescriptor()
-            {
-                return new PeerDescriptor(PeerDescriptor)
-                {
-                    Subscriptions = PeerDescriptor.Subscriptions.Concat(DynamicSubscriptions).Distinct().ToArray()
-                };
-            }
-        }
-
-        private readonly ConcurrentDictionary<PeerId, PeerEntry> _peers = new ConcurrentDictionary<PeerId, PeerEntry>();
-
-        public void AddOrUpdatePeer(PeerDescriptor peerDescriptor)
-        {
-            var newPeerEntry = new PeerEntry(peerDescriptor);
-            _peers.AddOrUpdate(peerDescriptor.PeerId, newPeerEntry, (peerId, existingPeerEntry) => peerDescriptor.TimestampUtc >= existingPeerEntry.PeerDescriptor.TimestampUtc ? newPeerEntry : existingPeerEntry);
-        }
-
-        public IEnumerable<PeerDescriptor> GetPeers(bool loadDynamicSubscriptions = true)
-        {
-            return _peers.Values.Select(entry => loadDynamicSubscriptions ? entry.GetMergedPeerDescriptor() : entry.GetPeerDescriptorWithStaticSubscriptionOnly());
-        }
-
-        public PeerDescriptor Get(PeerId peerId)
-        {
-            PeerEntry peerEntry;
-            return _peers.TryGetValue(peerId, out peerEntry) ? peerEntry.GetMergedPeerDescriptor() : null;
-        }
-
-        public void RemovePeer(PeerId peerId)
-        {
-            PeerEntry unused;
-            _peers.TryRemove(peerId, out unused);
-        }
-
-        public void SetPeerResponding(PeerId peerId, bool isResponding)
-        {
-            var peerEntry = GetEntry(peerId);
-            if (peerEntry != null)
-                peerEntry.PeerDescriptor.Peer.IsResponding = isResponding;
-        }
-        
-        private PeerEntry GetEntry(PeerId peerId)
-        {
-            PeerEntry peerEntry;
-            return _peers.TryGetValue(peerId, out peerEntry) ? peerEntry : null;
-        }
-
-        public void AddDynamicSubscriptionsForTypes(PeerId peerId, DateTime timestampUtc, SubscriptionsForType[] subscriptionsForTypes)
-        {
-            var peerEntry = GetEntry(peerId);
-            if (peerEntry == null)
-                return;
-            if (!(timestampUtc >= peerEntry.PeerDescriptor.TimestampUtc))
-                return;
-
-            var subscriptions = subscriptionsForTypes.SelectMany(sub => sub.BindingKeys.Select(binding => new Subscription(sub.MessageTypeId, binding))).ToList();
-            peerEntry.DynamicSubscriptions = peerEntry.DynamicSubscriptions.Concat(subscriptions).ToList();
-        }
-
-        public void RemoveDynamicSubscriptionsForTypes(PeerId peerId, DateTime timestampUtc, MessageTypeId[] messageTypeIds)
-        {
-            var peerEntry = GetEntry(peerId);
-            if (peerEntry == null)
-                return;
-            if (timestampUtc >= peerEntry.PeerDescriptor.TimestampUtc)
-                peerEntry.DynamicSubscriptions = peerEntry.DynamicSubscriptions.Where(sub => !messageTypeIds.Contains(sub.MessageTypeId)).ToList();
-        }
-
-        public void RemoveAllDynamicSubscriptionsForPeer(PeerId peerId)
-        {
-            var peerEntry = GetEntry(peerId);
-            if (peerEntry == null)
-                return;
-            peerEntry.DynamicSubscriptions.Clear();
-        }
-    }
-}

+ 0 - 11
src/Abc.Zebus.Directory/log4net.config

@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<log4net>
-	<root>
-		<level value="INFO" />
-    <appender type="log4net.Appender.ColoredConsoleAppender">
-      <layout type="log4net.Layout.PatternLayout">
-        <conversionPattern value="%date{HH:mm:ss.fff} - %-5level - %logger || %message%newline" />
-      </layout>
-    </appender>
-	</root>
-</log4net>

+ 0 - 65
src/Abc.Zebus.sln

@@ -15,12 +15,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "@ Solution Items", "@ Solut
 		SharedVersionInfo.cs = SharedVersionInfo.cs
 	EndProjectSection
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Abc.Zebus.Directory", "Abc.Zebus.Directory\Abc.Zebus.Directory.csproj", "{EE6730D9-6A21-46A5-AE3F-AF78060B6EA3}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Directory", "Directory", "{934FC246-87D6-48C6-AB0C-6B0638E326EC}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Abc.Zebus.Directory.Tests", "Abc.Zebus.Directory.Tests\Abc.Zebus.Directory.Tests.csproj", "{7C004E59-3B24-4359-8E45-1CD93F03FD80}"
-EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{7933BD78-DFD0-4F8E-BFE5-1660B14E7533}"
 	ProjectSection(SolutionItems) = preProject
 		..\build\Zebus.build = ..\build\Zebus.build
@@ -33,9 +27,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "nuget", "nuget", "{041FD6B0
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "nuspecs", "nuspecs", "{CF60551C-BB7F-4053-93BE-3E2B53222DF7}"
 	ProjectSection(SolutionItems) = preProject
-		..\build\nuget\nuspecs\Abc.Zebus.Directory.Cassandra.nuspec = ..\build\nuget\nuspecs\Abc.Zebus.Directory.Cassandra.nuspec
-		..\build\nuget\nuspecs\Abc.Zebus.Directory.nuspec = ..\build\nuget\nuspecs\Abc.Zebus.Directory.nuspec
-		..\build\nuget\nuspecs\Abc.Zebus.Directory.Standalone.nuspec = ..\build\nuget\nuspecs\Abc.Zebus.Directory.Standalone.nuspec
 		..\build\nuget\nuspecs\Abc.Zebus.nuspec = ..\build\nuget\nuspecs\Abc.Zebus.nuspec
 		..\build\nuget\nuspecs\Abc.Zebus.Testing.nuspec = ..\build\nuget\nuspecs\Abc.Zebus.Testing.nuspec
 	EndProjectSection
@@ -47,10 +38,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Zebus.Directory", "Zebus.Di
 		..\build\nuget\tools\Zebus.Directory\readme.txt = ..\build\nuget\tools\Zebus.Directory\readme.txt
 	EndProjectSection
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Abc.Zebus.Directory.Cassandra", "Abc.Zebus.Directory.Cassandra\Abc.Zebus.Directory.Cassandra.csproj", "{8F786F88-CB54-43DC-927F-65B75795EC60}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Abc.Zebus.Directory.Cassandra.Tests", "Abc.Zebus.Directory.Cassandra.Tests\Abc.Zebus.Directory.Cassandra.Tests.csproj", "{549C137C-9CE4-4765-9E1D-E348E96A08D6}"
-EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -102,67 +89,15 @@ Global
 		{4CE123DF-8021-411C-929B-53E5C5FC1E04}.Release|Mixed Platforms.Build.0 = Release|Any CPU
 		{4CE123DF-8021-411C-929B-53E5C5FC1E04}.Release|x64.ActiveCfg = Release|Any CPU
 		{4CE123DF-8021-411C-929B-53E5C5FC1E04}.Release|x86.ActiveCfg = Release|Any CPU
-		{EE6730D9-6A21-46A5-AE3F-AF78060B6EA3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{EE6730D9-6A21-46A5-AE3F-AF78060B6EA3}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{EE6730D9-6A21-46A5-AE3F-AF78060B6EA3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
-		{EE6730D9-6A21-46A5-AE3F-AF78060B6EA3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
-		{EE6730D9-6A21-46A5-AE3F-AF78060B6EA3}.Debug|x64.ActiveCfg = Debug|Any CPU
-		{EE6730D9-6A21-46A5-AE3F-AF78060B6EA3}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{EE6730D9-6A21-46A5-AE3F-AF78060B6EA3}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{EE6730D9-6A21-46A5-AE3F-AF78060B6EA3}.Release|Any CPU.Build.0 = Release|Any CPU
-		{EE6730D9-6A21-46A5-AE3F-AF78060B6EA3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
-		{EE6730D9-6A21-46A5-AE3F-AF78060B6EA3}.Release|Mixed Platforms.Build.0 = Release|Any CPU
-		{EE6730D9-6A21-46A5-AE3F-AF78060B6EA3}.Release|x64.ActiveCfg = Release|Any CPU
-		{EE6730D9-6A21-46A5-AE3F-AF78060B6EA3}.Release|x86.ActiveCfg = Release|Any CPU
-		{7C004E59-3B24-4359-8E45-1CD93F03FD80}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{7C004E59-3B24-4359-8E45-1CD93F03FD80}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{7C004E59-3B24-4359-8E45-1CD93F03FD80}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
-		{7C004E59-3B24-4359-8E45-1CD93F03FD80}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
-		{7C004E59-3B24-4359-8E45-1CD93F03FD80}.Debug|x64.ActiveCfg = Debug|Any CPU
-		{7C004E59-3B24-4359-8E45-1CD93F03FD80}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{7C004E59-3B24-4359-8E45-1CD93F03FD80}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{7C004E59-3B24-4359-8E45-1CD93F03FD80}.Release|Any CPU.Build.0 = Release|Any CPU
-		{7C004E59-3B24-4359-8E45-1CD93F03FD80}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
-		{7C004E59-3B24-4359-8E45-1CD93F03FD80}.Release|Mixed Platforms.Build.0 = Release|Any CPU
-		{7C004E59-3B24-4359-8E45-1CD93F03FD80}.Release|x64.ActiveCfg = Release|Any CPU
-		{7C004E59-3B24-4359-8E45-1CD93F03FD80}.Release|x86.ActiveCfg = Release|Any CPU
-		{8F786F88-CB54-43DC-927F-65B75795EC60}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{8F786F88-CB54-43DC-927F-65B75795EC60}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{8F786F88-CB54-43DC-927F-65B75795EC60}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
-		{8F786F88-CB54-43DC-927F-65B75795EC60}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
-		{8F786F88-CB54-43DC-927F-65B75795EC60}.Debug|x64.ActiveCfg = Debug|Any CPU
-		{8F786F88-CB54-43DC-927F-65B75795EC60}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{8F786F88-CB54-43DC-927F-65B75795EC60}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{8F786F88-CB54-43DC-927F-65B75795EC60}.Release|Any CPU.Build.0 = Release|Any CPU
-		{8F786F88-CB54-43DC-927F-65B75795EC60}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
-		{8F786F88-CB54-43DC-927F-65B75795EC60}.Release|Mixed Platforms.Build.0 = Release|Any CPU
-		{8F786F88-CB54-43DC-927F-65B75795EC60}.Release|x64.ActiveCfg = Release|Any CPU
-		{8F786F88-CB54-43DC-927F-65B75795EC60}.Release|x86.ActiveCfg = Release|Any CPU
-		{549C137C-9CE4-4765-9E1D-E348E96A08D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{549C137C-9CE4-4765-9E1D-E348E96A08D6}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{549C137C-9CE4-4765-9E1D-E348E96A08D6}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
-		{549C137C-9CE4-4765-9E1D-E348E96A08D6}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
-		{549C137C-9CE4-4765-9E1D-E348E96A08D6}.Debug|x64.ActiveCfg = Debug|Any CPU
-		{549C137C-9CE4-4765-9E1D-E348E96A08D6}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{549C137C-9CE4-4765-9E1D-E348E96A08D6}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{549C137C-9CE4-4765-9E1D-E348E96A08D6}.Release|Any CPU.Build.0 = Release|Any CPU
-		{549C137C-9CE4-4765-9E1D-E348E96A08D6}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
-		{549C137C-9CE4-4765-9E1D-E348E96A08D6}.Release|Mixed Platforms.Build.0 = Release|Any CPU
-		{549C137C-9CE4-4765-9E1D-E348E96A08D6}.Release|x64.ActiveCfg = Release|Any CPU
-		{549C137C-9CE4-4765-9E1D-E348E96A08D6}.Release|x86.ActiveCfg = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
 	EndGlobalSection
 	GlobalSection(NestedProjects) = preSolution
-		{EE6730D9-6A21-46A5-AE3F-AF78060B6EA3} = {934FC246-87D6-48C6-AB0C-6B0638E326EC}
-		{7C004E59-3B24-4359-8E45-1CD93F03FD80} = {934FC246-87D6-48C6-AB0C-6B0638E326EC}
 		{7933BD78-DFD0-4F8E-BFE5-1660B14E7533} = {A85342C3-7BA4-4A6B-B690-B1D0ACE14C76}
 		{041FD6B0-49C1-4C7B-B6CC-6BA106FE734B} = {7933BD78-DFD0-4F8E-BFE5-1660B14E7533}
 		{CF60551C-BB7F-4053-93BE-3E2B53222DF7} = {041FD6B0-49C1-4C7B-B6CC-6BA106FE734B}
 		{7218C17B-72FC-4BED-AD81-F4BC6196D3AA} = {041FD6B0-49C1-4C7B-B6CC-6BA106FE734B}
 		{0232BC2F-5907-4957-8B7D-0DD1CCC6428F} = {7218C17B-72FC-4BED-AD81-F4BC6196D3AA}
-		{8F786F88-CB54-43DC-927F-65B75795EC60} = {934FC246-87D6-48C6-AB0C-6B0638E326EC}
-		{549C137C-9CE4-4765-9E1D-E348E96A08D6} = {934FC246-87D6-48C6-AB0C-6B0638E326EC}
 	EndGlobalSection
 EndGlobal