Exemplo n.º 1
0
            public void WillReplicateToOtherSystems()
            {
                node.Stub(x => x.IsSegmentOwned(0)).Return(true);
                var request = new ExtendedPutRequest
                {
                    Key     = "test",
                    Bytes   = new byte[] { 1, 2, 4 },
                    Segment = 0,
                };

                distributedHashTableStorage.Put(topologyVersion, request);
                node.AssertWasCalled(x => x.SendToAllOtherBackups(0, request));
            }
Exemplo n.º 2
0
            public void WillReplicateToOtherSystems()
            {
                node.Stub(x => x.IsSegmentOwned(0)).Return(true);
                var request = new ExtendedRemoveRequest()
                {
                    Key             = "test",
                    SpecificVersion = version,
                    Segment         = 0,
                };

                distributedHashTableStorage.Remove(topologyVersion, request);
                node.AssertWasCalled(x => x.SendToAllOtherBackups(0, request));
            }
Exemplo n.º 3
0
        public void WillLetNodeKnowAboutAnyEmptySegmentsAssignedToIt()
        {
            replication.Stub(x => x.AssignAllEmptySegments(Arg <NodeEndpoint> .Is.Anything, Arg.Is(ReplicationType.Ownership), Arg <int[]> .Is.Anything))
            .Return(new [] { 0 });
            replication.Stub(x => x.ReplicateNextPage(Arg <NodeEndpoint> .Is.Anything, Arg.Is(ReplicationType.Ownership), Arg <int> .Is.Anything))
            .Return(new ReplicationResult
            {
                PutRequests    = new ExtendedPutRequest[0],
                RemoveRequests = new ExtendedRemoveRequest[0],
                Done           = true
            });
            var success = command.Execute();

            Assert.True(success);

            node.AssertWasCalled(x => x.DoneReplicatingSegments(ReplicationType.Ownership, new int[] { 0 }));
        }