use of org.apache.dubbo.rpc.support.Type in project dubbo by alibaba.
the class CompatibleFilterFilterTest method testInvokerJsonPojoSerialization.
@Test
public void testInvokerJsonPojoSerialization() throws Exception {
invocation = mock(Invocation.class);
given(invocation.getMethodName()).willReturn("enumlength");
given(invocation.getParameterTypes()).willReturn(new Class<?>[] { Type[].class });
given(invocation.getArguments()).willReturn(new Object[] { "hello" });
invoker = mock(Invoker.class);
given(invoker.isAvailable()).willReturn(true);
given(invoker.getInterface()).willReturn(DemoService.class);
AppResponse result = new AppResponse();
result.setValue("High");
given(invoker.invoke(invocation)).willReturn(AsyncRpcResult.newDefaultAsyncResult(result, invocation));
URL url = URL.valueOf("test://test:11/test?group=dubbo&version=1.1&serialization=json");
given(invoker.getUrl()).willReturn(url);
Result asyncResult = compatibleFilter.invoke(invoker, invocation);
AppResponse appResponse = (AppResponse) asyncResult.get();
compatibleFilter.onResponse(appResponse, invoker, invocation);
assertEquals(Type.High, appResponse.getValue());
}
use of org.apache.dubbo.rpc.support.Type in project dubbo by alibaba.
the class CompatibleFilterFilterTest method testInvokerNonJsonEnumSerialization.
@Test
public void testInvokerNonJsonEnumSerialization() throws Exception {
invocation = mock(Invocation.class);
given(invocation.getMethodName()).willReturn("enumlength");
given(invocation.getParameterTypes()).willReturn(new Class<?>[] { Type[].class });
given(invocation.getArguments()).willReturn(new Object[] { "hello" });
invoker = mock(Invoker.class);
given(invoker.isAvailable()).willReturn(true);
given(invoker.getInterface()).willReturn(DemoService.class);
AppResponse result = new AppResponse();
result.setValue("High");
given(invoker.invoke(invocation)).willReturn(AsyncRpcResult.newDefaultAsyncResult(result, invocation));
URL url = URL.valueOf("test://test:11/test?group=dubbo&version=1.1");
given(invoker.getUrl()).willReturn(url);
Result asyncResult = compatibleFilter.invoke(invoker, invocation);
AppResponse appResponse = (AppResponse) asyncResult.get();
compatibleFilter.onResponse(appResponse, invoker, invocation);
assertEquals(Type.High, appResponse.getValue());
}
Aggregations