public void TestAffinity() { IIgnite g = Ignition.GetIgnite("grid-0"); ICacheAffinity aff = g.GetAffinity("default"); 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); } }
public void TestAffinityBinary() { IIgnite g = Ignition.GetIgnite("grid-0"); ICacheAffinity aff = g.GetAffinity("default"); IBinaryObject affKey = g.GetBinary().ToBinary <IBinaryObject>(new AffinityTestKey(0, 1)); IClusterNode node = aff.MapKeyToNode(affKey); for (int i = 0; i < 10; i++) { IBinaryObject otherAffKey = g.GetBinary().ToBinary <IBinaryObject>(new AffinityTestKey(i, 1)); Assert.AreEqual(node.Id, aff.MapKeyToNode(otherAffKey).Id); } }
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); } }