@Test public void testConvertYarRequest() throws NoSuchMethodException, SecurityException { DefaultRequest request = new DefaultRequest(); request.setRequestId(123); request.setMethodName("hello"); request.setArguments(new Object[] {"param1"}); request.setInterfaceName(YarMessageRouterTest.AnnoService.class.getName()); request.setParamtersDesc(ReflectUtil.getMethodParamDesc(YarMessageRouterTest.AnnoService.class.getMethod("hello", String.class))); YarRequest yarRequest = YarProtocolUtil.convert(request, "JSON"); assertNotNull(yarRequest); Request newRequest = YarProtocolUtil.convert(yarRequest, YarMessageRouterTest.AnnoService.class); assertNotNull(newRequest); assertEquals(request.toString(), newRequest.toString()); }
public static Request convert(YarRequest yarRequest, Class<?> interfaceClass) { DefaultRequest request = new DefaultRequest(); request.setInterfaceName(interfaceClass.getName()); request.setMethodName(yarRequest.getMethodName()); request.setRequestId(yarRequest.getId()); addArguments(request, interfaceClass, yarRequest.getMethodName(), yarRequest.getParameters()); if (yarRequest instanceof AttachmentRequest) { request.setAttachments(((AttachmentRequest) yarRequest).getAttachments()); } return request; }
YarProtocolUtil { public static Request convert(YarRequest yarRequest, Class<?> interfaceClass) { DefaultRequest request = new DefaultRequest(); request.setInterfaceName(interfaceClass.getName()); request.setMethodName(yarRequest.getMethodName()); request.setRequestId(yarRequest.getId()); addArguments(request, interfaceClass, yarRequest.getMethodName(), yarRequest.getParameters()); if (yarRequest instanceof AttachmentRequest) { request.setAttachments(((AttachmentRequest) yarRequest).getAttachments()); } return request; } }
YarProtocolUtil { public static Request convert(YarRequest yarRequest, Class<?> interfaceClass) { DefaultRequest request = new DefaultRequest(); request.setInterfaceName(interfaceClass.getName()); request.setMethodName(yarRequest.getMethodName()); request.setRequestId(yarRequest.getId()); addArguments(request, interfaceClass, yarRequest.getMethodName(), yarRequest.getParameters()); if (yarRequest instanceof AttachmentRequest) { request.setAttachments(((AttachmentRequest) yarRequest).getAttachments()); } return request; }  }
YarProtocolUtil { public static Request convert(YarRequest yarRequest, Class<?> interfaceClass) { DefaultRequest request = new DefaultRequest(); request.setInterfaceName(interfaceClass.getName()); request.setMethodName(yarRequest.getMethodName()); request.setRequestId(yarRequest.getId()); addArguments(request, interfaceClass, yarRequest.getMethodName(), yarRequest.getParameters()); if (yarRequest instanceof AttachmentRequest) { request.setAttachments(((AttachmentRequest) yarRequest).getAttachments()); } return request; }  static String getYarPath(Class<?> interfaceClazz, URL url); static Request convert(YarRequest yarRequest, Class<?> interfaceClass); static YarRequest convert(Request request, String packagerName); static Response convert(YarResponse yarResponse); static YarResponse convert(Response response, String packagerName); static YarResponse buildDefaultErrorResponse(String errMsg, String packagerName); }
YarProtocolUtil { public static Request convert(YarRequest yarRequest, Class<?> interfaceClass) { DefaultRequest request = new DefaultRequest(); request.setInterfaceName(interfaceClass.getName()); request.setMethodName(yarRequest.getMethodName()); request.setRequestId(yarRequest.getId()); addArguments(request, interfaceClass, yarRequest.getMethodName(), yarRequest.getParameters()); if (yarRequest instanceof AttachmentRequest) { request.setAttachments(((AttachmentRequest) yarRequest).getAttachments()); } return request; }  static String getYarPath(Class<?> interfaceClazz, URL url); static Request convert(YarRequest yarRequest, Class<?> interfaceClass); static YarRequest convert(Request request, String packagerName); static Response convert(YarResponse yarResponse); static YarResponse convert(Response response, String packagerName); static YarResponse buildDefaultErrorResponse(String errMsg, String packagerName);  }