Example #1
0
        public void TestAllKeys(ClientBase client1, ClientBase client2, string regionName, long dtTime)
        {
            ICollection <UInt32> registeredKeyTypeIds =
                CacheableWrapperFactory.GetRegisteredKeyTypeIds();
            ICollection <UInt32> registeredValueTypeIds =
                CacheableWrapperFactory.GetRegisteredValueTypeIds();

            client1.Call(CacheableHelper.RegisterBuiltinsJavaHashCode, dtTime);
            client2.Call(CacheableHelper.RegisterBuiltinsJavaHashCode, dtTime);

            foreach (UInt32 keyTypeId in registeredKeyTypeIds)
            {
                int numKeys;
                client1.Call(InitKeys, out numKeys, keyTypeId, NumKeys, KeySize);
                client2.Call(InitKeys, out numKeys, keyTypeId, NumKeys, KeySize);
                Type keyType = CacheableWrapperFactory.GetTypeForId(keyTypeId);
                StartTimer();
                Util.Log("Running warmup task which verifies the puts.");
                DoHashCodePuts(client1, client2, regionName);
            }
        }
Example #2
0
        public void TestAllKeyValuePairs(ClientBase client1, ClientBase client2,
                                         string regionName, bool runQuery, long dtTicks)
        {
            ICollection <UInt32> registeredKeyTypeIds =
                CacheableWrapperFactory.GetRegisteredKeyTypeIds();
            ICollection <UInt32> registeredValueTypeIds =
                CacheableWrapperFactory.GetRegisteredValueTypeIds();

            client1.Call(CacheableHelper.RegisterBuiltins, dtTicks);
            client2.Call(CacheableHelper.RegisterBuiltins, dtTicks);

            foreach (UInt32 keyTypeId in registeredKeyTypeIds)
            {
                int numKeys;
                client1.Call(InitKeys, out numKeys, keyTypeId, NumKeys, KeySize);
                client2.Call(InitKeys, out numKeys, keyTypeId, NumKeys, KeySize);

                Type keyType = CacheableWrapperFactory.GetTypeForId(keyTypeId);
                foreach (UInt32 valueTypeId in registeredValueTypeIds)
                {
                    client1.Call(InitValues, valueTypeId, numKeys, ValueSize);
                    client2.Call(InitValues, valueTypeId, numKeys, ValueSize);
                    Type valueType = CacheableWrapperFactory.GetTypeForId(valueTypeId);

                    Util.Log("Starting gets/puts with keyType '{0}' and valueType '{1}'",
                             keyType.Name, valueType.Name);
                    StartTimer();
                    Util.Log("Running warmup task which verifies the puts.");
                    PutGetSteps(client1, client2, regionName, true, runQuery);
                    Util.Log("End warmup task.");
                    LogTaskTiming(client1,
                                  string.Format("IRegion<object, object>:{0},Key:{1},Value:{2},KeySize:{3},ValueSize:{4},NumOps:{5}",
                                                regionName, keyType.Name, valueType.Name, KeySize, ValueSize, 4 * numKeys),
                                  4 * numKeys);

                    InvalidateRegion(regionName, client1, client2);
                }
            }
        }
Example #3
0
 public void PutGetSteps(ClientBase client1, ClientBase client2,
                         string regionName, bool verifyGets, bool runQuery)
 {
     if (verifyGets)
     {
         client1.Call(DoPuts);
         client1.Call(DoKeyChecksumPuts);
         client1.Call(DoValChecksumPuts);
         client2.Call(DoGetsVerify);
         InvalidateRegion(regionName, client1);
         if (runQuery)
         {
             // run a query for ThinClient regions to check for deserialization
             // compability on server
             client1.Call(DoRunQuery);
         }
         client2.Call(DoPuts);
         client2.Call(DoKeyChecksumPuts);
         client2.Call(DoValChecksumPuts);
         client1.Call(DoGetsVerify);
     }
     else
     {
         client1.Call(DoPuts);
         client2.Call(DoGets);
         InvalidateRegion(regionName, client1);
         client2.Call(DoPuts);
         client1.Call(DoGets);
     }
     // this query invocation is primarily to delete the entries that cannot
     // be deserialized by the server
     if (runQuery)
     {
         client1.Call(DoRunQuery);
     }
 }
Example #4
0
 public void DoHashCodePuts(ClientBase client1, ClientBase client2, string regionName)
 {
     client1.Call(DoHashPuts);
     client2.Call(DoHashPuts);
 }
Example #5
0
 public void DoPRSHPartitionResolverTasks(ClientBase client1, ClientBase client2, string regionName)
 {
     client1.Call(DoPRSHPartitionResolverPuts, regionName);
     client2.Call(DoPRSHPartitionResolverPuts, regionName);
 }
Example #6
0
 public void DoPRSHFixedPartitionResolverTasks(ClientBase client1, string regionName)
 {
     client1.Call(DoPRSHFixedPartitionResolverTests, regionName);
 }
Example #7
0
        protected void ExecuteOpBlock(List <OperationWithAction> opBlock,
                                      string authInit, Properties <string, string> extraAuthProps, Properties <string, string> extraAuthzProps,
                                      TestCredentialGenerator gen, Random rnd, bool isMultiuser, bool ssl, bool withPassword)
        {
            foreach (OperationWithAction currentOp in opBlock)
            {
                // Start client with valid credentials as specified in
                // OperationWithAction
                OperationCode opCode    = currentOp.OpCode;
                OpFlags       opFlags   = currentOp.Flags;
                int           clientNum = currentOp.ClientNum;
                if (clientNum > m_clients.Length)
                {
                    Assert.Fail("ExecuteOpBlock: Unknown client number " + clientNum);
                }
                ClientBase client = m_clients[clientNum - 1];
                Util.Log("ExecuteOpBlock: performing operation number [" +
                         currentOp.OpNum + "]: " + currentOp);
                Properties <string, string> clientProps = null;
                if (!CheckFlags(opFlags, OpFlags.UseOldConn))
                {
                    Properties <string, string> opCredentials;
                    int    newRnd            = rnd.Next(100) + 1;
                    string currentRegionName = '/' + RegionName;
                    if (CheckFlags(opFlags, OpFlags.UseSubRegion))
                    {
                        currentRegionName += ('/' + SubregionName);
                    }
                    string                      credentialsTypeStr;
                    OperationCode               authOpCode = currentOp.AuthzOperationCode;
                    int[]                       indices    = currentOp.Indices;
                    CredentialGenerator         cGen       = gen.GetCredentialGenerator();
                    Properties <string, string> javaProps  = null;
                    if (CheckFlags(opFlags, OpFlags.CheckNotAuthz) ||
                        CheckFlags(opFlags, OpFlags.UseNotAuthz))
                    {
                        opCredentials = gen.GetDisallowedCredentials(
                            new OperationCode[] { authOpCode },
                            new string[] { currentRegionName }, indices, newRnd);
                        credentialsTypeStr = " unauthorized " + authOpCode;
                    }
                    else
                    {
                        opCredentials = gen.GetAllowedCredentials(new OperationCode[] {
                            opCode, authOpCode
                        }, new string[] { currentRegionName },
                                                                  indices, newRnd);
                        credentialsTypeStr = " authorized " + authOpCode;
                    }
                    if (cGen != null)
                    {
                        javaProps = cGen.JavaProperties;
                    }
                    clientProps = SecurityTestUtil.ConcatProperties(
                        opCredentials, extraAuthProps, extraAuthzProps);
                    // Start the client with valid credentials but allowed or disallowed to
                    // perform an operation
                    Util.Log("ExecuteOpBlock: For client" + clientNum +
                             credentialsTypeStr + " credentials: " + opCredentials);

                    if (!isMultiuser)
                    {
                        client.Call(SecurityTestUtil.CreateClientSSL, RegionName,
                                    CacheHelper.Locators, authInit, clientProps, ssl, withPassword);
                    }
                    else
                    {
                        client.Call(SecurityTestUtil.CreateClientMU, RegionName,
                                    CacheHelper.Locators, authInit, (Properties <string, string>)null, true);
                    }
                }
                ExpectedResult expectedResult;
                if (CheckFlags(opFlags, OpFlags.CheckNotAuthz))
                {
                    expectedResult = ExpectedResult.NotAuthorizedException;
                }
                else if (CheckFlags(opFlags, OpFlags.CheckException))
                {
                    expectedResult = ExpectedResult.OtherException;
                }
                else
                {
                    expectedResult = ExpectedResult.Success;
                }

                // Perform the operation from selected client
                if (!isMultiuser)
                {
                    client.Call(DoOp, opCode, currentOp.Indices, opFlags, expectedResult);
                }
                else
                {
                    client.Call(DoOp, opCode, currentOp.Indices, opFlags, expectedResult, clientProps, true);
                }
            }
        }