//ORIGINAL LINE: @Test public void testInvokeContextCustomSerializer_FUTURE() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: public virtual void testInvokeContextCustomSerializer_FUTURE() { NormalRequestBodyCustomSerializer_InvokeContext s1 = new NormalRequestBodyCustomSerializer_InvokeContext(); NormalStringCustomSerializer_InvokeContext s2 = new NormalStringCustomSerializer_InvokeContext(); //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method: CustomSerializerManager.registerCustomSerializer(typeof(RequestBody), s1); //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method: CustomSerializerManager.registerCustomSerializer(typeof(string), s2); RequestBody body = new RequestBody(1, "hello world!"); InvokeContext invokeContext = new InvokeContext(); invokeContext.putIfAbsent(NormalRequestBodyCustomSerializer_InvokeContext.SERIALTYPE_KEY, NormalRequestBodyCustomSerializer_InvokeContext.SERIALTYPE1_value); RpcResponseFuture future = client.invokeWithFuture(addr, body, invokeContext, 1000); string ret = (string)future.get(1000); Assert.Equal(RequestBody.DEFAULT_SERVER_RETURN_STR + "RANDOM", ret); Assert.True(s1.Serialized); Assert.True(s1.Deserialized); invokeContext.clear(); invokeContext.putIfAbsent(NormalRequestBodyCustomSerializer_InvokeContext.SERIALTYPE_KEY, NormalRequestBodyCustomSerializer_InvokeContext.SERIALTYPE2_value); future = client.invokeWithFuture(addr, body, invokeContext, 1000); ret = (string)future.get(1000); Assert.Equal(NormalStringCustomSerializer_InvokeContext.UNIVERSAL_RESP, ret); Assert.True(s1.Serialized); Assert.True(s1.Deserialized); }
//ORIGINAL LINE: @Test public void testInvokeContextCustomSerializer_CALLBACK() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: public virtual void testInvokeContextCustomSerializer_CALLBACK() { NormalRequestBodyCustomSerializer_InvokeContext s1 = new NormalRequestBodyCustomSerializer_InvokeContext(); NormalStringCustomSerializer_InvokeContext s2 = new NormalStringCustomSerializer_InvokeContext(); //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method: CustomSerializerManager.registerCustomSerializer(typeof(RequestBody), s1); //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method: CustomSerializerManager.registerCustomSerializer(typeof(string), s2); RequestBody body = new RequestBody(1, "hello world!"); InvokeContext invokeContext = new InvokeContext(); invokeContext.putIfAbsent(NormalRequestBodyCustomSerializer_InvokeContext.SERIALTYPE_KEY, NormalRequestBodyCustomSerializer_InvokeContext.SERIALTYPE1_value); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final java.util.List<Object> rets = new java.util.ArrayList<Object>(); IList <object> rets = new List <object>(); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final java.util.concurrent.CountdownEvent latch = new java.util.concurrent.CountdownEvent(1); CountdownEvent latch = new CountdownEvent(1); client.invokeWithCallback(addr, body, invokeContext, new InvokeCallbackAnonymousInnerClass(this, rets, latch), 1000); latch.Wait(); string ret = (string)rets[0]; Assert.Equal(RequestBody.DEFAULT_SERVER_RETURN_STR + "RANDOM", ret); Assert.True(s1.Serialized); Assert.True(s1.Deserialized); invokeContext.clear(); invokeContext.putIfAbsent(NormalRequestBodyCustomSerializer_InvokeContext.SERIALTYPE_KEY, NormalRequestBodyCustomSerializer_InvokeContext.SERIALTYPE2_value); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final java.util.concurrent.CountdownEvent latch1 = new java.util.concurrent.CountdownEvent(1); CountdownEvent latch1 = new CountdownEvent(1); client.invokeWithCallback(addr, body, invokeContext, new InvokeCallbackAnonymousInnerClass2(this, rets, latch1), 1000); latch1.Wait(); ret = (string)rets[0]; Assert.Equal(NormalStringCustomSerializer_InvokeContext.UNIVERSAL_RESP, ret); Assert.True(s1.Serialized); Assert.True(s1.Deserialized); }