Ejemplo n.º 1
0
            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);
            }
Ejemplo n.º 2
0
 public WhenFinishedReplicatingSegment()
 {
     master   = MockRepository.GenerateStub <IDistributedHashTableMaster>();
     executer = MockRepository.GenerateStub <IExecuter>();
     endPoint = NodeEndpoint.ForTest(1);
     master.Stub(x => x.Join(Arg.Is(endPoint)))
     .Return(new Segment[0]);
     node = new DistributedHashTableNode(master, executer, new BinaryMessageSerializer(), endPoint, MockRepository.GenerateStub <IQueueManager>(),
                                         MockRepository.GenerateStub <IDistributedHashTableNodeReplicationFactory>());
 }
Ejemplo n.º 3
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();
            }
Ejemplo n.º 4
0
 public JoiningMaster()
 {
     master = MockRepository.GenerateStub<IDistributedHashTableMaster>();
     executer = MockRepository.GenerateStub<IExecuter>();
     endPoint = NodeEndpoint.ForTest(1);
     master.Stub(x => x.Join(Arg.Is(endPoint)))
         .Return(new Segment[0]);
     node = new DistributedHashTableNode(master, executer, new BinaryMessageSerializer(), endPoint, MockRepository.GenerateStub<IQueueManager>(),
         MockRepository.GenerateStub<IDistributedHashTableNodeReplicationFactory>());
 }