Permalink
Browse files

Started to test node integration test

  • Loading branch information...
1 parent bcb46af commit 20635703072dc5c0aa5d5af53841d0ac28e0e0d8 ayenderahien committed Jun 5, 2009
@@ -1,29 +1,37 @@
using System;
+using Rhino.DistributedHashTable.Client;
using Rhino.DistributedHashTable.Hosting;
using Xunit;
+using System.Linq;
namespace Rhino.DistributedHashTable.IntegrationTests
{
- public class WhenNodeIsStarted : FullIntegrationTest, IDisposable
+ public class NodeOverTheNetwork : FullIntegrationTest, IDisposable
{
private readonly DistributedHashTableMasterHost masterHost;
- private readonly Uri masterUri = new Uri("net.tcp://" + Environment.MachineName + ":2200/master");
+ private readonly DistributedHashTableStorageHost storageHost;
+ private readonly Uri masterUri = new Uri("rhino.dht://" + Environment.MachineName + ":2200/master");
- public WhenNodeIsStarted()
+ public NodeOverTheNetwork()
{
masterHost = new DistributedHashTableMasterHost();
+ storageHost = new DistributedHashTableStorageHost(masterUri);
masterHost.Start();
+ storageHost.Start();
}
- [Fact(Skip = "not impl yet")]
+ [Fact]
public void WillJoinMaster()
{
- Assert.True(false);
+ var masterProxy = new DistributedHashTableMasterClient(masterUri);
+ var topology = masterProxy.GetTopology();
+ Assert.True(topology.Segments.All(x => x.AssignedEndpoint == storageHost.Endpoint));
}
public void Dispose()
{
+ storageHost.Dispose();
masterHost.Dispose();
}
}
@@ -4,6 +4,7 @@
using System.Net.Sockets;
using Google.ProtocolBuffers;
using log4net;
+using Rhino.DistributedHashTable.Client;
using Rhino.DistributedHashTable.Internal;
using Rhino.DistributedHashTable.Parameters;
using Rhino.DistributedHashTable.Protocol;
@@ -19,7 +20,6 @@ public class DistributedHashTableStorageHost : IDisposable
private readonly TcpListener listener;
private readonly IDistributedHashTableNode node;
private readonly QueueManager queueManager;
- private readonly IDistributedHashTableMaster masterChannel;
private readonly IDistributedHashTableStorage storage;
public DistributedHashTableStorageHost(Uri master)
@@ -40,7 +40,7 @@ public DistributedHashTableStorageHost(Uri master)
queueManager = new QueueManager(new IPEndPoint(IPAddress.Any, port + 1), name + ".queue.esent");
node = new DistributedHashTableNode(
- masterChannel,
+ new DistributedHashTableMasterClient(master),
new ThreadPoolExecuter(),
new BinaryMessageSerializer(),
Endpoint,

0 comments on commit 2063570

Please sign in to comment.