Exemple #1
0
    void DoDeltaAD_C1_afterC2Put()
    {
      Thread.Sleep(15000);
      DeltaTestAD val = null;
      IRegion<object, object> reg = CacheHelper.GetRegion<object, object>("DistRegionAck");
      Util.Log("client fetching entry from local cache");
      val = (DeltaTestAD)reg.GetEntry(1).Value;
      Assert.IsNotNull(val);
      Assert.AreEqual(3, val.DeltaUpdate);
      Util.Log("done");

      System.Threading.Thread.Sleep(5000);
      //Assert.Greater(javaobject.PdxDelta.GotDelta, 7, "this should have recieve delta");
      javaobject.PdxDelta pd = (javaobject.PdxDelta)(reg.GetLocalView()["pdxdelta"]);
      Assert.Greater(pd.Delta, 7, "this should have recieve delta");
    }
Exemple #2
0
        private void TestGetOp(IRegion <object, object> region, int num)
        {
            DoNput(region, num);

            ICollection <object> cKeys = region.GetLocalView().Keys;
            object cVal;

            Assert.AreEqual(num, cKeys.Count, "Number of keys does not match.");
            foreach (object cKey in cKeys)
            {
                RegionEntry <object, object> entry = region.GetEntry(cKey);
                cVal = entry.Value;
                if (IsOverflowed(cVal))
                {
                    cVal = region[cKey];
                    Assert.IsFalse(IsOverflowed(cVal), "Overflow token even after a Region.Get");
                }
            }
        }
Exemple #3
0
        private void CheckOverflowToken(IRegion <object, object> region, int num, int lruLimit)
        {
            //IGeodeSerializable cVal;
            //ICacheableKey[] cKeys = region.GetKeys();

            object cVal;
            ICollection <object> cKeys = region.GetLocalView().Keys;

            Assert.AreEqual(num, cKeys.Count, "Number of keys does not match.");
            int count = 0;

            foreach (object cKey in cKeys)
            {
                RegionEntry <object, object> entry = region.GetEntry(cKey);
                cVal = entry.Value;
                if (IsOverflowed(cVal))
                {
                    count++;
                }
            }
            Assert.AreEqual(0, count, "Number of overflowed entries should be zero");
        }
Exemple #4
0
        public void VerifyUnicodeKeys(string regionName, bool updates)
        {
            IRegion <object, object> region = CacheHelper.GetVerifyRegion <object, object>(regionName);
            string key;
            object expectedVal;

            for (int index = 0; index < m_numUnicodeStrings; ++index)
            {
                key = GetUnicodeString(index);
                if (updates)
                {
                    expectedVal = index + 100;
                    Assert.AreEqual(expectedVal, region.GetEntry(key).Value,
                                    "Got unexpected value");
                }
                else
                {
                    expectedVal = (float)index + 20.0F;
                    Assert.AreEqual(expectedVal, region[key],
                                    "Got unexpected value");
                }
            }
        }
Exemple #5
0
        public void DoGetsVerify()
        {
            Util.Log("DoGetsVerify: m_cKeys " + m_cKeys.Length);
            Assert.IsNotNull(m_cKeys, "DoGetsVerify: null keys array.");
            Assert.IsNotNull(m_cValues, "DoGetsVerify: null values array.");
            Assert.IsNotNull(m_region, "DoGetsVerify: null region.");

            for (int keyIndex = 0; keyIndex < m_cKeys.Length; keyIndex++)
            {
                Util.Log("DoGetsVerify key type " + m_cKeys[keyIndex].CacheableKey.GetType());
                Object actualValue = m_region[m_cKeys[keyIndex].CacheableKey];

                if (actualValue == null)
                {
                    Util.Log("DoGetsVerify value is null");
                }
                else
                {
                    Util.Log("DoGetsVerify value is not null ");
                }
                uint cksum = m_cKeys[keyIndex].GetChecksum();
                //Util.Log("DoGetsVerify  key clasid " + m_region[(KeyChecksumPrefix + keyIndex).ClassId]);
                //Util.Log("DoGetsVerify  key clasid " + m_region[(KeyChecksumPrefix + keyIndex).ClassId]);
                //Util.Log("DoGetsVerify  key type " + m_region.Get(KeyChecksumPrefix + keyIndex).GetType().ToString());
                //CacheableInt32 putCksum = m_region[KeyChecksumPrefix + keyIndex] as CacheableInt32;
                Util.Log("DoGetsVerify  key type " + m_region[KeyChecksumPrefix + keyIndex].GetType().ToString());
                int putCksum = (int)m_region[KeyChecksumPrefix + keyIndex];
                Assert.IsNotNull(putCksum,
                                 "DoGetsVerify: Could not find checksum for key at index {0}.",
                                 keyIndex);
                Assert.AreEqual(cksum, (uint)putCksum,
                                "DoGetsVerify: Checksums of the keys at index {0} differ.",
                                keyIndex);
                Util.Log("actualValue Type = {0}", actualValue.GetType());
                cksum    = m_cValues[keyIndex].GetChecksum((object)actualValue);
                putCksum = (int)m_region[ValChecksumPrefix + keyIndex];
                Assert.IsNotNull(putCksum, "DoGetsVerify: Could not find checksum for value at index {0}.", keyIndex);
                Assert.AreEqual(cksum, (uint)putCksum, "DoGetsVerify: Checksums of the values at index {0} differ.", keyIndex);

                // Also check in local cache using GetEntry
                Util.Log("DoGetsVerify() key hashcode " + m_cKeys[keyIndex].CacheableKey.GetHashCode());
                RegionEntry <object, object> entry = m_region.GetEntry(m_cKeys[keyIndex].CacheableKey);

                if (entry != null)
                {
                    try
                    {
                        cksum = m_cValues[keyIndex].GetChecksum(entry.Value);
                    }
                    catch (Exception ex)
                    {
                        Util.Log("DoGetsVerify()  got exception " + ex.Message);
                        Util.Log("DoGetsVerify()  get stacktrace " + ex.StackTrace);
                        throw ex;
                    }
                }
                else
                {
                    cksum = 0;
                }
                Assert.AreEqual(cksum, (uint)putCksum, "DoGetsVerify: " +
                                "Checksums of the values at index {0} differ using GetEntry.",
                                keyIndex);
            }
            Util.Log("DoGetsVerify completed for keyType [{0}], valType [{1}].",
                     m_cKeys[0].CacheableKey.GetType(), GetValueType());
        }