Search in sources :

Example 36 with DefaultRequest

use of com.weibo.api.motan.rpc.DefaultRequest in project motan by weibocom.

the class DefaultRpcCodecTest method testHalfNullRequest1.

@Test
public void testHalfNullRequest1() throws Exception {
    DefaultRequest request = getRequest("com.weibo.api.motan.protocol.example.Model[]", new Object[] { new Model[] { null, new Model("world", 12, Model.class) } });
    testCodecRequest(request);
}
Also used : DefaultRequest(com.weibo.api.motan.rpc.DefaultRequest) Model(com.weibo.api.motan.protocol.example.Model) Test(org.junit.Test)

Example 37 with DefaultRequest

use of com.weibo.api.motan.rpc.DefaultRequest in project motan by weibocom.

the class DefaultRpcCodecTest method testHalfNullRequest.

@Test
public void testHalfNullRequest() throws Exception {
    DefaultRequest request = getRequest("com.weibo.api.motan.protocol.example.Model,com.weibo.api.motan.protocol.example.Model", new Object[] { null, new Model("world", 12, Model.class) });
    testCodecRequest(request);
}
Also used : DefaultRequest(com.weibo.api.motan.rpc.DefaultRequest) Model(com.weibo.api.motan.protocol.example.Model) Test(org.junit.Test)

Example 38 with DefaultRequest

use of com.weibo.api.motan.rpc.DefaultRequest in project motan by weibocom.

the class DefaultRpcCodecTest method testVoidTypeRequest.

@Test
public void testVoidTypeRequest() throws Exception {
    DefaultRequest request = getRequest("void", null);
    testCodecRequest(request);
}
Also used : DefaultRequest(com.weibo.api.motan.rpc.DefaultRequest) Test(org.junit.Test)

Example 39 with DefaultRequest

use of com.weibo.api.motan.rpc.DefaultRequest in project motan by weibocom.

the class DefaultRpcCodecTest method testStringTypeRequest.

@Test
public void testStringTypeRequest() throws Exception {
    DefaultRequest request = getRequest("java.lang.String", new Object[] { "hello" });
    testCodecRequest(request);
}
Also used : DefaultRequest(com.weibo.api.motan.rpc.DefaultRequest) Test(org.junit.Test)

Example 40 with DefaultRequest

use of com.weibo.api.motan.rpc.DefaultRequest in project motan by weibocom.

the class CompressRpcCodecTest method testCompatibility.

// 测试server端对旧版本的兼容性
@Test
public void testCompatibility() throws IOException {
    DefaultRequest request = getRequest("int[]", new Object[] { new int[] { 1, 2 } });
    Codec v1Codec = new DefaultRpcCodec();
    byte[] bytes = v1Codec.encode(channel, request);
    assertTrue(isV1Version(bytes));
    Request result = (Request) rpcCodec.decode(channel, "", bytes);
    Assert.assertTrue(equals(request, result));
}
Also used : Codec(com.weibo.api.motan.codec.Codec) DefaultRequest(com.weibo.api.motan.rpc.DefaultRequest) Request(com.weibo.api.motan.rpc.Request) DefaultRequest(com.weibo.api.motan.rpc.DefaultRequest) Test(org.junit.Test)

Aggregations

DefaultRequest (com.weibo.api.motan.rpc.DefaultRequest)45 Test (org.junit.Test)26 DefaultResponse (com.weibo.api.motan.rpc.DefaultResponse)8 Request (com.weibo.api.motan.rpc.Request)7 Model (com.weibo.api.motan.protocol.example.Model)5 Response (com.weibo.api.motan.rpc.Response)5 MotanServiceException (com.weibo.api.motan.exception.MotanServiceException)4 Channel (com.weibo.api.motan.transport.Channel)4 MotanFrameworkException (com.weibo.api.motan.exception.MotanFrameworkException)3 IHello (com.weibo.api.motan.protocol.example.IHello)3 URL (com.weibo.api.motan.rpc.URL)3 MessageHandler (com.weibo.api.motan.transport.MessageHandler)3 HashMap (java.util.HashMap)3 MockChannel (com.weibo.api.motan.mock.MockChannel)2 MockReferer (com.weibo.api.motan.mock.MockReferer)2 Referer (com.weibo.api.motan.rpc.Referer)2 Listener (io.grpc.ServerCall.Listener)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 Codec (com.weibo.api.motan.codec.Codec)1 Serialization (com.weibo.api.motan.codec.Serialization)1