public override void Put(byte[] key, byte[] value, int ttl)
 {
     try {
         bool succ = (bool)_dht.localproxy("DhtClient.Put", key, value, ttl);
         if (!succ)
         {
             throw new DictionaryServiceException("Put operation returned unsuccessful.")
                   {
                       DictionaryKey = key
                   };
         }
     } catch (XmlRpcException ex) {
         throw new DictionaryServiceException("Put operation failed.", ex)
               {
                   DictionaryKey = key
               };
     }
 }
示例#2
0
        public void LocalProxyPassAndReturnStructs()
        {
            Hashtable tb = new Hashtable();

            tb.Add("key1", "value1");
            tb.Add("key2", "value2");
            XmlRpcStruct tb1 = new XmlRpcStruct();

            tb1.Add("key1", "value1");
            tb1.Add("key2", "value2");
            _mrm.CurrentInvokeState.RetValues = new object[] { tb };
            Hashtable actual = _rpc.localproxy("Foo", tb1) as Hashtable;

            Assert.AreEqual(tb["key1"], actual["key1"]);
            Assert.AreEqual(tb["key2"], actual["key2"]);
            actual = _rpc.localproxy("Foo", "arg1", tb1) as Hashtable;
            Assert.AreEqual(tb["key1"], actual["key1"]);
            Assert.AreEqual(tb["key2"], actual["key2"]);
        }