Exemple #1
0
        public void ActorSbPartitionMapTestWithNodes(int elementsPerPartition, int totalElements, int numOfPartitions, string[] nodes)
        {
            var nodeList = new List <string>();

            if (nodes != null)
            {
                nodeList.AddRange(nodes);
            }

            var map = ActorSbDistributedDictionaryBase <Column> .CreatePartitionMap(totalElements, elementsPerPartition, numOfPartitions, nodeList);

            int lastMax    = -1;
            int elementCnt = 0;

            foreach (var item in map)
            {
                Assert.IsTrue(item.MinKey == lastMax + 1);
                Assert.IsTrue(item.MaxKey > item.MinKey);

                elementCnt += item.MaxKey - item.MinKey + 1;

                lastMax = item.MaxKey;
            }

            Assert.IsTrue(elementCnt == totalElements);
        }
Exemple #2
0
        public void ActorSbPartitionMapTest(int elementsPerPartition, int totalElements)
        {
            var map = ActorSbDistributedDictionaryBase <Column> .CreatePartitionMap(totalElements, elementsPerPartition);

            int lastMax    = -1;
            int elementCnt = 0;

            foreach (var item in map)
            {
                Assert.IsTrue(item.MinKey == lastMax + 1);
                Assert.IsTrue(item.MaxKey > item.MinKey);

                elementCnt += item.MaxKey - item.MinKey + 1;

                lastMax = item.MaxKey;
            }

            Assert.IsTrue(elementCnt == totalElements);
        }