Skip to content

Commit

Permalink
Merge pull request apache#1811, fix unstable hessian protocol unit te…
Browse files Browse the repository at this point in the history
…st by adding overload.

Fixed apache#1667, fixed apache#1727
  • Loading branch information
ralf0131 authored and chickenlj committed May 17, 2018
1 parent 3d8eaba commit 06e5e67
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import com.alibaba.dubbo.rpc.RpcException;
import com.alibaba.dubbo.rpc.protocol.hessian.HessianServiceImpl.MyException;

import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;

import static org.junit.Assert.fail;
Expand All @@ -41,7 +41,7 @@ public void testHessianProtocol() {
Assert.assertFalse(server.isCalled());
ProxyFactory proxyFactory = ExtensionLoader.getExtensionLoader(ProxyFactory.class).getAdaptiveExtension();
Protocol protocol = ExtensionLoader.getExtensionLoader(Protocol.class).getAdaptiveExtension();
URL url = URL.valueOf("hessian://127.0.0.1:5342/" + HessianService.class.getName() + "?version=1.0.0");
URL url = URL.valueOf("hessian://127.0.0.1:5342/" + HessianService.class.getName() + "?version=1.0.0&hessian.overload.method=true");
Exporter<HessianService> exporter = protocol.export(proxyFactory.getInvoker(server, HessianService.class, url));
Invoker<HessianService> invoker = protocol.refer(HessianService.class, url);
HessianService client = proxyFactory.getProxy(invoker);
Expand Down Expand Up @@ -76,7 +76,7 @@ public void testHttpClient() {
Assert.assertFalse(server.isCalled());
ProxyFactory proxyFactory = ExtensionLoader.getExtensionLoader(ProxyFactory.class).getAdaptiveExtension();
Protocol protocol = ExtensionLoader.getExtensionLoader(Protocol.class).getAdaptiveExtension();
URL url = URL.valueOf("hessian://127.0.0.1:5342/" + HessianService.class.getName() + "?version=1.0.0&client=httpclient");
URL url = URL.valueOf("hessian://127.0.0.1:5342/" + HessianService.class.getName() + "?version=1.0.0&client=httpclient&hessian.overload.method=true");
Exporter<HessianService> exporter = protocol.export(proxyFactory.getInvoker(server, HessianService.class, url));
Invoker<HessianService> invoker = protocol.refer(HessianService.class, url);
HessianService client = proxyFactory.getProxy(invoker);
Expand All @@ -100,7 +100,7 @@ public void testTimeOut() {
client.timeOut(6000);
fail();
} catch (RpcException expected) {
Assert.assertEquals(true, expected.isTimeout());
Assert.assertTrue(expected.isTimeout());
} finally {
invoker.destroy();
exporter.unexport();
Expand All @@ -121,6 +121,7 @@ public void testCustomException() {
client.customException();
fail();
} catch (MyException expected) {

}
invoker.destroy();
exporter.unexport();
Expand Down

0 comments on commit 06e5e67

Please sign in to comment.