Ejemplo 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));
            }
Ejemplo 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));
            }
Ejemplo n.º 3
0
 public WritingValues()
 {
     node            = MockRepository.GenerateStub <IDistributedHashTableNode>();
     topologyVersion = 2;
     node.Stub(x => x.GetTopologyVersion()).Return(topologyVersion);
     distributedHashTableStorage = new DistributedHashTableStorage("test.esent",
                                                                   node);
 }
 public OnlineSegmentReplicationCommandTest()
 {
     node = MockRepository.GenerateStub<IDistributedHashTableNode>();
     replication = MockRepository.GenerateStub<IDistributedHashTableNodeReplication>();
     endpoint = NodeEndpoint.ForTest(1);
     node.Stub(x => x.Endpoint).Return(NodeEndpoint.ForTest(2));
     storage = MockRepository.GenerateStub<IDistributedHashTableStorage>();
     node.Storage = storage;
     node.Stub(x => x.GetTopologyVersion()).Return(topologyVersion);
     var factory = MockRepository.GenerateStub<IDistributedHashTableNodeReplicationFactory>();
     factory.Stub(x => x.Create(null)).IgnoreArguments().Return(replication);
     command = new OnlineSegmentReplicationCommand(
         endpoint,
         new[] { new Segment { Index = 0 }, new Segment { Index = 1 }, },
         ReplicationType.Ownership,
         node,
         factory);
 }
 public WhenThereAreNoKeysInTable()
 {
     node            = MockRepository.GenerateStub <IDistributedHashTableNode>();
     topologyVersion = 7;
     node.Stub(x => x.GetTopologyVersion()).Return(topologyVersion);
     distributedHashTableStorage = new DistributedHashTableStorage("test.esent",
                                                                   node);
     replication = distributedHashTableStorage.Replication;
 }
Ejemplo n.º 6
0
        public OnlineSegmentReplicationCommandTest()
        {
            node        = MockRepository.GenerateStub <IDistributedHashTableNode>();
            replication = MockRepository.GenerateStub <IDistributedHashTableNodeReplication>();
            endpoint    = NodeEndpoint.ForTest(1);
            node.Stub(x => x.Endpoint).Return(NodeEndpoint.ForTest(2));
            storage      = MockRepository.GenerateStub <IDistributedHashTableStorage>();
            node.Storage = storage;
            node.Stub(x => x.GetTopologyVersion()).Return(topologyVersion);
            var factory = MockRepository.GenerateStub <IDistributedHashTableNodeReplicationFactory>();

            factory.Stub(x => x.Create(null)).IgnoreArguments().Return(replication);
            command = new OnlineSegmentReplicationCommand(
                endpoint,
                new[] { new Segment {
                            Index = 0
                        }, new Segment {
                            Index = 1
                        }, },
                ReplicationType.Ownership,
                node,
                factory);
        }
            public ReadingValues()
            {
                node = MockRepository.GenerateStub<IDistributedHashTableNode>();
                topologyVersion = 1;
                node.Stub(x => x.GetTopologyVersion()).Return(topologyVersion);
                distributedHashTableStorage = new DistributedHashTableStorage("test.esent",
                                                                              node);

                distributedHashTableStorage.Put(topologyVersion, new ExtendedPutRequest
                {
                    Key = "test",
                    Bytes = new byte[]{1,2,4},
                    Segment = 0,
                });
            }
Ejemplo n.º 8
0
            public ReadingValues()
            {
                node            = MockRepository.GenerateStub <IDistributedHashTableNode>();
                topologyVersion = 1;
                node.Stub(x => x.GetTopologyVersion()).Return(topologyVersion);
                distributedHashTableStorage = new DistributedHashTableStorage("test.esent",
                                                                              node);

                distributedHashTableStorage.Put(topologyVersion, new ExtendedPutRequest
                {
                    Key     = "test",
                    Bytes   = new byte[] { 1, 2, 4 },
                    Segment = 0,
                });
            }
 public WhenThereAreKeysInTable()
 {
     node            = MockRepository.GenerateStub <IDistributedHashTableNode>();
     topologyVersion = 9;
     node.Stub(x => x.GetTopologyVersion()).Return(topologyVersion);
     distributedHashTableStorage = new DistributedHashTableStorage("test.esent",
                                                                   node);
     replication = distributedHashTableStorage.Replication;
     putResult   = distributedHashTableStorage.Put(topologyVersion, new ExtendedPutRequest
     {
         Tag     = 0,
         Bytes   = new byte[] { 1 },
         Key     = "test",
         Segment = 0
     })[0];
 }
 public WhenThereAreKeysInTable()
 {
     node = MockRepository.GenerateStub<IDistributedHashTableNode>();
     topologyVersion = 9;
     node.Stub(x => x.GetTopologyVersion()).Return(topologyVersion);
     distributedHashTableStorage = new DistributedHashTableStorage("test.esent",
                                                                   node);
     replication = distributedHashTableStorage.Replication;
     putResult = distributedHashTableStorage.Put(topologyVersion, new ExtendedPutRequest
     {
         Tag = 0,
         Bytes = new byte[] {1},
         Key = "test",
         Segment = 0
     })[0];
 }
 public WritingValues()
 {
     node = MockRepository.GenerateStub<IDistributedHashTableNode>();
     topologyVersion = 2;
     node.Stub(x => x.GetTopologyVersion()).Return(topologyVersion);
     distributedHashTableStorage = new DistributedHashTableStorage("test.esent",
                                                                   node);
 }
 public WhenThereAreNoKeysInTable()
 {
     node = MockRepository.GenerateStub<IDistributedHashTableNode>();
     topologyVersion = 7;
     node.Stub(x => x.GetTopologyVersion()).Return(topologyVersion);
     distributedHashTableStorage = new DistributedHashTableStorage("test.esent",
                                                                   node);
     replication = distributedHashTableStorage.Replication;
 }