public void WhenSegmentsAssignedToNodeStateWillBeStarted()
            {
                master.Stub(x => x.Join(Arg.Is(endPoint)))
                .Return(new[]
                {
                    new Segment {
                        AssignedEndpoint = endPoint
                    },
                });

                node.Start();

                Assert.Equal(NodeState.Started, node.State);
            }
Exemple #2
0
            public WhenReplicatingRequestToOwner()
            {
                master   = MockRepository.GenerateStub <IDistributedHashTableMaster>();
                endPoint = NodeEndpoint.ForTest(1);
                backup1  = NodeEndpoint.ForTest(2);
                backup2  = NodeEndpoint.ForTest(3);
                topology = new Topology(new[]
                {
                    new Segment
                    {
                        Index            = 0,
                        AssignedEndpoint = endPoint,
                        PendingBackups   =
                        {
                            backup1,
                            backup2,
                        }
                    },
                    new Segment
                    {
                        Index            = 1,
                        AssignedEndpoint = backup1,
                        PendingBackups   =
                        {
                            endPoint,
                            backup2,
                        }
                    },
                }, 1);
                master.Stub(x => x.GetTopology()).Return(topology);
                executer = MockRepository.GenerateStub <IExecuter>();
                master.Stub(x => x.Join(Arg.Is(endPoint)))
                .Return(new Segment[0]);
                queueManager = MockRepository.GenerateStub <IQueueManager>();

                node = new DistributedHashTableNode(master, executer, new BinaryMessageSerializer(), endPoint,
                                                    queueManager, MockRepository.GenerateStub <IDistributedHashTableNodeReplicationFactory>());
                node.Start();
            }
 public void ShouldJoinMasterOnStart()
 {
     node.Start();
     master.AssertWasCalled(x => x.Join(node.Endpoint));
 }