示例#1
0
        public void TestAffinity()
        {
            IIgnite g = Ignition.GetIgnite("grid-0");

            ICacheAffinity aff = g.Affinity(null);

            IClusterNode node = aff.MapKeyToNode(new AffinityTestKey(0, 1));

            for (int i = 0; i < 10; i++)
            {
                Assert.AreEqual(node.Id, aff.MapKeyToNode(new AffinityTestKey(i, 1)).Id);
            }
        }
示例#2
0
        public void TestAffinityPortable()
        {
            IIgnite g = Ignition.GetIgnite("grid-0");

            ICacheAffinity aff = g.Affinity(null);

            IPortableObject affKey = g.Portables().ToPortable <IPortableObject>(new AffinityTestKey(0, 1));

            IClusterNode node = aff.MapKeyToNode(affKey);

            for (int i = 0; i < 10; i++)
            {
                IPortableObject otherAffKey =
                    g.Portables().ToPortable <IPortableObject>(new AffinityTestKey(i, 1));

                Assert.AreEqual(node.Id, aff.MapKeyToNode(otherAffKey).Id);
            }
        }
示例#3
0
 /** <inheritdoc /> */
 public ICacheAffinity Affinity(string name)
 {
     return(_ignite.Affinity(name));
 }