コード例 #1
0
        /// <summary>
        /// Run a query on server for native client to force deserialization
        /// on server and thereby check serialization/deserialization compability
        /// between native clients and java server.
        /// </summary>
        public void DoRunQuery()
        {
            Assert.IsNotNull(m_cKeys, "DoGets: null keys array.");
            Assert.IsNotNull(m_region, "DoGets: null region.");

            // for a type that cannot be handled by server, delete these values
            // before next query that will cause problem
            Type valType = GetValueType();

            if (CacheableHelper.IsUnhandledType(m_cValues[0].TypeId))
            {
                Util.Log("DoRunQuery: deleting entries with value type {0}", valType);
                for (int keyIndex = 0; keyIndex < m_cKeys.Length; keyIndex++)
                {
                    m_region.Remove(m_cKeys[keyIndex].CacheableKey); // Destroy() -> Remove()
                }
            }
            else
            {
                var                     qs      = CacheHelper.DCache.GetPoolManager().Find(m_region.Attributes.PoolName).GetQueryService();
                Query <object>          qry     = qs.NewQuery <object>("SELECT * FROM " + m_region.FullPath);
                ISelectResults <object> results = qry.Execute();
                // not really interested in results but loop through them neverthless
                Util.Log("DoRunQuery: obtained {0} results", results.Size);
                int numResults = 0;
                foreach (object res in results)
                {
                    ++numResults;
                }
                Assert.AreEqual(results.Size, numResults,
                                "Expected the number of results to match the size of ISelectResults");
            }
            Util.Log("DoQuery completed for keyType [{0}], valType [{1}].",
                     m_cKeys[0].CacheableKey.GetType(), valType);
        }
コード例 #2
0
        private void RunCheckPutGet()
        {
            CacheHelper.SetupJavaServers(true, "cacheServer_pdxreadserialized.xml");
            CacheHelper.StartJavaLocator(1, "GFELOC");
            Util.Log("Locator 1 started.");
            CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
            Util.Log("Cacheserver 1 started.");

            var putGetTest = new PutGetTests();

            _client1.Call(CreateTCRegions_Pool, RegionNames,
                          CacheHelper.Locators, "__TESTPOOL1_", false);
            Util.Log("Client 1 (pool locators) regions created");
            _client2.Call(CreateTCRegions_Pool, RegionNames,
                          CacheHelper.Locators, "__TESTPOOL1_", false);
            Util.Log("Client 2 (pool locators) regions created");

            _client1.Call(putGetTest.SetRegion, RegionNames[0]);
            _client2.Call(putGetTest.SetRegion, RegionNames[0]);

            var dtTicks = DateTime.Now.Ticks;

            CacheableHelper.RegisterBuiltins(dtTicks);

            putGetTest.TestAllKeyValuePairs(_client1, _client2,
                                            RegionNames[0], true, dtTicks);

            _client1.Call(Close);
            Util.Log("Client 1 closed");
            _client2.Call(Close);
            Util.Log("Client 2 closed");

            CacheHelper.StopJavaServer(1);
            Util.Log("Cacheserver 1 stopped.");

            CacheHelper.StopJavaLocator(1);
            Util.Log("Locator 1 stopped.");

            CacheHelper.ClearEndpoints();
            CacheHelper.ClearLocators();
        }