void DoNotificationWithDeltaLRU() { try { Serializable.RegisterTypeGeneric(DeltaEx.create); } catch (IllegalStateException) { //do nothig. } string cKey1 = "key1"; string cKey2 = "key2"; string cKey3 = "key3"; string cKey4 = "key4"; string cKey5 = "key5"; string cKey6 = "key6"; DeltaEx val1 = new DeltaEx(); DeltaEx val2 = new DeltaEx(); IRegion <object, object> reg = CacheHelper.GetRegion <object, object>("DistRegionAck"); reg[cKey1] = val1; reg[cKey2] = val1; reg[cKey3] = val1; reg[cKey4] = val1; reg[cKey5] = val1; reg[cKey6] = val1; val2.SetDelta(true); reg[cKey1] = val2; DeltaEx.ToDeltaCount = 0; DeltaEx.ToDataCount = 0; }
void DoNotificationWithDelta() { try { Serializable.RegisterTypeGeneric(DeltaEx.create); } catch (IllegalStateException) { //do nothig. } string cKey = m_keys[0]; DeltaEx val = new DeltaEx(); IRegion <object, object> reg = CacheHelper.GetRegion <object, object>("DistRegionAck"); reg[cKey] = val; val.SetDelta(true); reg[cKey] = val; string cKey1 = m_keys[1]; DeltaEx val1 = new DeltaEx(); reg[cKey1] = val1; val1.SetDelta(true); reg[cKey1] = val1; DeltaEx.ToDeltaCount = 0; DeltaEx.ToDataCount = 0; }
void DoPutWithDelta() { try { CacheHelper.DCache.TypeRegistry.RegisterTypeGeneric(DeltaEx.create); } catch (IllegalStateException) { //do nothng } string cKey = m_keys[0]; DeltaEx val = new DeltaEx(); IRegion<object, object> reg = CacheHelper.GetRegion<object, object>("DistRegionAck"); reg[cKey] = (object)val; val.SetDelta(true); reg[cKey] = (object)val; DeltaEx val1 = new DeltaEx(0); // In this case JAVA side will throw invalid DeltaException reg[cKey] = (object)val1; val1.SetDelta(true); reg[cKey] = (object)val1; if (DeltaEx.ToDeltaCount != 2) { Util.Log("DeltaEx.ToDataCount = " + DeltaEx.ToDataCount); Assert.Fail(" Delta count should have been 2, is " + DeltaEx.ToDeltaCount); } if (DeltaEx.ToDataCount != 3) Assert.Fail("Data count should have been 3, is " + DeltaEx.ToDataCount); DeltaEx.ToDeltaCount = 0; DeltaEx.ToDataCount = 0; DeltaEx.FromDataCount = 0; DeltaEx.FromDeltaCount = 0; }
void Do_Put_Contains_Remove_WithDelta() { try { CacheHelper.DCache.TypeRegistry.RegisterType(DeltaEx.create, 1); } catch (IllegalStateException) { //do nothng } string cKey = m_keys[0]; DeltaEx val = new DeltaEx(); IRegion <object, object> reg = CacheHelper.GetRegion <object, object>("DistRegionAck"); reg[cKey] = (object)val; val.SetDelta(true); reg[cKey] = (object)val; DeltaEx val1 = new DeltaEx(0); // In this case JAVA side will throw invalid DeltaException reg[cKey] = (object)val1; val1.SetDelta(true); reg[cKey] = (object)val1; if (DeltaEx.ToDeltaCount != 2) { Util.Log("DeltaEx.ToDataCount = " + DeltaEx.ToDataCount); Assert.Fail(" Delta count should have been 2, is " + DeltaEx.ToDeltaCount); } if (DeltaEx.ToDataCount != 3) { Assert.Fail("Data count should have been 3, is " + DeltaEx.ToDataCount); } DeltaEx.ToDeltaCount = 0; DeltaEx.ToDataCount = 0; DeltaEx.FromDataCount = 0; DeltaEx.FromDeltaCount = 0; // Try Contains with key & value that are present. Result should be true. KeyValuePair <object, object> myentry = new KeyValuePair <object, object>(cKey, val1); bool containsOpflag = reg.Contains(myentry); Assert.IsTrue(containsOpflag, "Result should be true as key & value are present"); // Try Remove with key & value that are present. Result should be true. bool removeOpflag = reg.Remove(cKey); Assert.IsTrue(removeOpflag, "Result should be true as key & value are present"); //Check Contains with removed entry. Result should be false. bool updatedcontainsOpflag = reg.Contains(myentry); Assert.IsFalse(updatedcontainsOpflag, "Result should be false as key & value are removed"); }
void DoExpirationWithDelta() { try { CacheHelper.DCache.TypeRegistry.RegisterTypeGeneric(DeltaEx.create); } catch (IllegalStateException) { //do nothig. } DeltaEx val1 = new DeltaEx(); IRegion<object, object> reg = CacheHelper.GetRegion<object, object>("DistRegionAck"); reg[1] = val1; // Sleep 10 seconds to allow expiration of entry in client 2 Thread.Sleep(10000); val1.SetDelta(true); reg[1] = val1; DeltaEx.ToDeltaCount = 0; DeltaEx.ToDataCount = 0; }