Exemplo n.º 1
0
        /// <summary>
        /// Used to retrieve the method
        /// </summary>
        /// <typeparam name="V">Value</typeparam>
        /// <param name="key">Key</param>
        /// <returns>Retrieved Value</returns>
        public V get <V>(Object key)
        {
            byte[]       keyBytes = serializer.serialize(key);
            GetOperation op       = operationsFactory.newGetKeyOperation(keyBytes);

            byte[] bytes  = (byte[])op.executeOperation(transport);
            V      result = (V)serializer.deserialize(bytes);

            return(result);
        }
Exemplo n.º 2
0
        public void executeOperationTest()
        {
            TCPTransport trans = new TCPTransport(System.Net.IPAddress.Loopback, 11222);
            Codec codec = new Codec();
            Serializer s = new DefaultSerializer();

            // byte[] key = s.serialize("11");

            byte[] key = s.serialize("key10");
            //byte[] key= UTF8Encoding.UTF8.GetBytes("key10");

            GetOperation target = new GetOperation(codec, key, null, 0, null);
            Transport transport = trans;
            string expected = "hexachlorocyclohexane 777";
            byte[] actual;
            actual = target.executeOperation(transport);
            string res = (string)(s.deserialize(actual));

            Assert.AreEqual(expected, res);
        }
Exemplo n.º 3
0
        public void executeOperationTest()
        {
            TCPTransport trans = new TCPTransport(System.Net.IPAddress.Loopback, 11222);
            Codec        codec = new Codec();
            Serializer   s     = new DefaultSerializer();

            // byte[] key = s.serialize("11");

            byte[] key = s.serialize("key10");
            //byte[] key= UTF8Encoding.UTF8.GetBytes("key10");

            GetOperation target    = new GetOperation(codec, key, null, 0, null);
            Transport    transport = trans;
            string       expected  = "hexachlorocyclohexane 777";

            byte[] actual;
            actual = target.executeOperation(transport);
            string res = (string)(s.deserialize(actual));


            Assert.AreEqual(expected, res);
        }