public void PeerNewNodeTest() { TestLauncherActor.Test(TestContext, () => { PeerActor <int, string> node1 = new PeerActor <int, string>(); PeerActor <int, string> node2 = new PeerActor <int, string>(); PeerActor <int, string> node3 = new PeerActor <int, string>(); PeerActor <int, string> node4 = new PeerActor <int, string>(); node1.NewPeer(node2, node2.GetHashKey().Result()); node1.NewPeer(node3, node3.GetHashKey().Result()); node1.NewPeer(node4, node4.GetHashKey().Result()); node1.StoreNode(10, "10"); node2.StoreNode(20, "20"); node3.StoreNode(30, "30"); var future = new Future <IPeerActor <int, string> >(); node1.FindPeer(30, future); IPeerActor <int, string> result = future.Result(); Assert.IsNotNull(result); // Assert.AreEqual(node3.Tag.Key(), result.Tag.Key()); future = new Future <IPeerActor <int, string> >(); node1.FindPeer(40, future); result = future.Result(); Assert.IsNotNull(result); // Assert.AreEqual(node1.Tag.Key(), result.Tag.Key()); }); }
public void NewPeer(IPeerActor <TKey, TValue> actor, HashKey hash) { this.SendMessage(PeerOrder.PeerNewPeer, actor, hash); }