Search in sources :

Example 1 with RpcBindingConverter

use of com.alipay.sofa.rpc.boot.runtime.converter.RpcBindingConverter in project sofa-boot by alipay.

the class RpcBindingConverterTest method parseSofaMethods.

@Test
public void parseSofaMethods() {
    RpcBindingConverter rpcBindingConverter = new BoltBindingConverter();
    SofaReference reference = null;
    try {
        reference = RpcBindingConverterTest.class.getDeclaredField("testAnnotation").getAnnotation(SofaReference.class);
    } catch (NoSuchFieldException e) {
        e.printStackTrace();
    }
    List<RpcBindingMethodInfo> result = rpcBindingConverter.parseSofaMethods(reference.binding().methodInfos());
    Assert.assertEquals(1, result.size());
    final RpcBindingMethodInfo rpcBindingMethodInfo = result.get(0);
    Assert.assertEquals("test", rpcBindingMethodInfo.getName());
    Assert.assertEquals(1, rpcBindingMethodInfo.getRetries().intValue());
    Assert.assertEquals("callback", rpcBindingMethodInfo.getType());
    Assert.assertEquals("class", rpcBindingMethodInfo.getCallbackClass());
    Assert.assertEquals("ref", rpcBindingMethodInfo.getCallbackRef());
    Assert.assertEquals(2000, rpcBindingMethodInfo.getTimeout().intValue());
}
Also used : RpcBindingConverter(com.alipay.sofa.rpc.boot.runtime.converter.RpcBindingConverter) SofaReference(com.alipay.sofa.runtime.api.annotation.SofaReference) BoltBindingConverter(com.alipay.sofa.rpc.boot.runtime.converter.BoltBindingConverter) RpcBindingMethodInfo(com.alipay.sofa.rpc.boot.runtime.binding.RpcBindingMethodInfo) Test(org.junit.Test)

Example 2 with RpcBindingConverter

use of com.alipay.sofa.rpc.boot.runtime.converter.RpcBindingConverter in project sofa-boot by sofastack.

the class RpcBindingConverterTest method parseSofaMethods.

@Test
public void parseSofaMethods() {
    RpcBindingConverter rpcBindingConverter = new BoltBindingConverter();
    SofaReference reference = null;
    try {
        reference = RpcBindingConverterTest.class.getDeclaredField("testAnnotation").getAnnotation(SofaReference.class);
    } catch (NoSuchFieldException e) {
        e.printStackTrace();
    }
    List<RpcBindingMethodInfo> result = rpcBindingConverter.parseSofaMethods(reference.binding().methodInfos());
    Assert.assertEquals(1, result.size());
    final RpcBindingMethodInfo rpcBindingMethodInfo = result.get(0);
    Assert.assertEquals("test", rpcBindingMethodInfo.getName());
    Assert.assertEquals(1, rpcBindingMethodInfo.getRetries().intValue());
    Assert.assertEquals("callback", rpcBindingMethodInfo.getType());
    Assert.assertEquals("class", rpcBindingMethodInfo.getCallbackClass());
    Assert.assertEquals("ref", rpcBindingMethodInfo.getCallbackRef());
    Assert.assertEquals(2000, rpcBindingMethodInfo.getTimeout().intValue());
}
Also used : RpcBindingConverter(com.alipay.sofa.rpc.boot.runtime.converter.RpcBindingConverter) SofaReference(com.alipay.sofa.runtime.api.annotation.SofaReference) BoltBindingConverter(com.alipay.sofa.rpc.boot.runtime.converter.BoltBindingConverter) RpcBindingMethodInfo(com.alipay.sofa.rpc.boot.runtime.binding.RpcBindingMethodInfo) Test(org.junit.Test)

Aggregations

RpcBindingMethodInfo (com.alipay.sofa.rpc.boot.runtime.binding.RpcBindingMethodInfo)2 BoltBindingConverter (com.alipay.sofa.rpc.boot.runtime.converter.BoltBindingConverter)2 RpcBindingConverter (com.alipay.sofa.rpc.boot.runtime.converter.RpcBindingConverter)2 SofaReference (com.alipay.sofa.runtime.api.annotation.SofaReference)2 Test (org.junit.Test)2