示例#1
0
        public void RemoteMapReduceWithStreamsTest()
        {
            ConfigurationBuilder conf = new ConfigurationBuilder();

            conf.AddServer().Host("127.0.0.1").Port(11222);
            conf.ConnectionTimeout(90000).SocketTimeout(6000);
            marshaller = new JBasicMarshaller();
            conf.Marshaller(marshaller);
            remoteManager = new RemoteCacheManager(conf.Build(), true);
            IRemoteCache <string, string> scriptCache = remoteManager.GetCache <string, string>(PROTOBUF_SCRIPT_CACHE_NAME);
            IRemoteCache <string, string> testCache   = remoteManager.GetCache <string, string>();

            try
            {
                const string scriptName = "wordCountStream.js";
                ScriptUtils.LoadTestCache(testCache, "macbeth.txt");
                ScriptUtils.LoadScriptCache(scriptCache, scriptName, scriptName);

                Dictionary <string, object> scriptArgs = new Dictionary <string, object>();

                var       result = (System.Int64)testCache.Execute(scriptName, scriptArgs);
                const int expectedMacbethCount = 287;
                Assert.AreEqual(expectedMacbethCount, result);
            }
            finally
            {
                testCache.Clear();
            }
        }