public void DoGets(int numOps, bool useNewVal, ExpectedResult expect, Client.Properties <string, string> credential, bool isMultiuser)
        {
            string valPrefix = (useNewVal ? NValuePrefix : ValuePrefix);
            IRegion <object, object> region;

            CacheHelper.DCache.TypeRegistry.RegisterPdxType(PdxTests.PdxTypes1.CreateDeserializable);
            CacheHelper.DCache.TypeRegistry.RegisterPdxType(PdxTests.PdxTypes8.CreateDeserializable);
            if (isMultiuser)
            {
                region = CacheHelper.GetVerifyRegion <object, object>(RegionName, credential);
            }
            else
            {
                region = CacheHelper.GetVerifyRegion <object, object>(RegionName);
            }

            for (int index = 1; index <= numOps; ++index)
            {
                try
                {
                    region.GetLocalView().Invalidate(index + "_pdxputall81");
                    region.GetLocalView().Invalidate(index + "_pdxputall82");
                }
                catch (Exception)
                { }
            }

            if (expect == ExpectedResult.Success)
            {
                for (int index = 1; index <= numOps; ++index)
                {
                    object ret1 = region[index + "_pdxputall81"];
                    object ret2 = region[index + "_pdxputall82"];

                    Assert.IsTrue(ret1 != null && ret1 is PdxTests.PdxTypes8);
                    Assert.IsTrue(ret1 != null && ret2 is PdxTests.PdxTypes8);
                }
            }

            for (int index = 1; index <= numOps; ++index)
            {
                try
                {
                    region.GetLocalView().Invalidate(index + "_pdxputall81");
                    region.GetLocalView().Invalidate(index + "_pdxputall82");
                }
                catch (Exception)
                { }
            }

            if (expect == ExpectedResult.Success)
            {
                for (int index = 1; index <= numOps; ++index)
                {
                    ICollection <object> pdxKeys = new List <object>();
                    pdxKeys.Add(index + "_pdxputall81");
                    pdxKeys.Add(index + "_pdxputall82");
                    IDictionary <object, object> getall = new Dictionary <object, object>();
                    region.GetAll(pdxKeys, getall, null);

                    Assert.AreEqual(2, getall.Count);
                }
            }

            for (int index = 1; index <= numOps; ++index)
            {
                string key = KeyPrefix + index;
                try
                {
                    region.GetLocalView().Invalidate(key);
                }
                catch (Exception)
                {
                    // ignore exception if key is not found in the region
                }
                Object value = null;
                try
                {
                    value = region[key];
                    Object retPdx = region[index];

                    Assert.IsTrue(retPdx != null && retPdx is PdxTests.PdxTypes8);
                    if (expect != ExpectedResult.Success)
                    {
                        Assert.Fail("DoGets: Expected an exception in get");
                    }
                }
                catch (AssertionException)
                {
                    throw;
                }
                catch (NotAuthorizedException ex)
                {
                    if (expect == ExpectedResult.NotAuthorizedException)
                    {
                        Util.Log("DoGets: got expected unauthorized exception: " +
                                 ex.GetType() + "::" + ex.Message);
                        continue;
                    }
                    else
                    {
                        Assert.Fail("DoGets: unexpected unauthorized exception caught: " +
                                    ex);
                    }
                }
                catch (AuthenticationFailedException ex)
                {
                    if (expect == ExpectedResult.AuthFailedException)
                    {
                        Util.Log("DoPuts: got expected authentication Failed exception: " +
                                 ex.GetType() + "::" + ex.Message);
                    }
                    else
                    {
                        Assert.Fail("DoPuts: unexpected exception caught: " + ex);
                    }
                }
                catch (Exception ex)
                {
                    if (expect == ExpectedResult.OtherException)
                    {
                        Util.Log("DoGets: got expected exception: " +
                                 ex.GetType() + "::" + ex.Message);
                        continue;
                    }
                    else
                    {
                        Assert.Fail("DoGets: unexpected exception caught: " + ex);
                    }
                }
                Assert.IsNotNull(value);
                Assert.AreEqual(valPrefix + index, value.ToString());
            }
        }
        public void DoPutsTx(int numOps, bool useNewVal, ExpectedResult expect, Client.Properties <string, string> credentials, bool multiuserMode)
        {
            Util.Log("DoPutsTx starts");
            CacheHelper.CSTXManager.Begin();
            string valPrefix = (useNewVal ? NValuePrefix : ValuePrefix);
            IRegion <object, object> region;

            if (multiuserMode)
            {
                region = CacheHelper.GetVerifyRegion <object, object>(RegionName, credentials);
            }
            else
            {
                region = CacheHelper.GetVerifyRegion <object, object>(RegionName);
            }
            CacheHelper.DCache.TypeRegistry.RegisterPdxType(PdxTests.PdxTypes1.CreateDeserializable);
            CacheHelper.DCache.TypeRegistry.RegisterPdxType(PdxTests.PdxTypes8.CreateDeserializable);
            for (int opNum = 1; opNum <= numOps; ++opNum)
            {
                try
                {
                    region[KeyPrefix + opNum] = valPrefix + opNum;
                    region.Invalidate(KeyPrefix + opNum);
                    region[KeyPrefix + opNum] = valPrefix + opNum;
                    Util.Log("Pdx ops starts");
                    region[opNum]            = new PdxTests.PdxTypes8();
                    region[opNum + "_pdx1"]  = new PdxTests.PdxTypes1();
                    region[opNum + "_pdx_8"] = new PdxTests.PdxTypes8();
                    IDictionary <object, object> putall = new Dictionary <object, object>();
                    putall.Add(opNum + "_pdxputall81", new PdxTests.PdxTypes8());
                    putall.Add(opNum + "_pdxputall82", new PdxTests.PdxTypes8());
                    region.PutAll(putall);
                    Util.Log("Pdx ops ends");
                    if (expect != ExpectedResult.Success)
                    {
                        Assert.Fail("DoPuts: Expected an exception in put");
                    }
                }
                catch (AssertionException)
                {
                    throw;
                }
                catch (NotAuthorizedException ex)
                {
                    if (expect == ExpectedResult.NotAuthorizedException)
                    {
                        Util.Log("DoPuts: got expected unauthorized exception: " +
                                 ex.GetType() + "::" + ex.Message);
                    }
                    else
                    {
                        Assert.Fail("DoPuts: unexpected exception caught: " + ex);
                    }
                }
                catch (AuthenticationFailedException ex)
                {
                    if (expect == ExpectedResult.AuthFailedException)
                    {
                        Util.Log("DoPuts: got expected authentication Failed exception: " +
                                 ex.GetType() + "::" + ex.Message);
                    }
                    else
                    {
                        Assert.Fail("DoPuts: unexpected exception caught: " + ex);
                    }
                }
                catch (Exception ex)
                {
                    if (expect == ExpectedResult.OtherException)
                    {
                        Util.Log("DoPuts: got expected exception: " +
                                 ex.GetType() + "::" + ex.Message);
                    }
                    else
                    {
                        Assert.Fail("DoPuts: unexpected exception caught: " + ex);
                    }
                }
            }
            CacheHelper.CSTXManager.Commit();
            Util.Log("DoPutsTx Done");
        }
 public void DoGetsMU(int numOps, Client.Properties <string, string> credential, bool isMultiuser)
 {
     DoGets(numOps, false, ExpectedResult.Success, credential, isMultiuser);
 }
 public void DoPutsMU(int numOps, Client.Properties <string, string> credentials, bool multiuserMode)
 {
     DoPuts(numOps, false, ExpectedResult.Success, credentials, multiuserMode);
 }