parent
f46342bc9a
commit
e290dce448
@ -0,0 +1,37 @@ |
||||
import core.thrift.MyAsyncMethodCallback; |
||||
import core.thrift.ThriftClientPool; |
||||
import org.apache.logging.log4j.LogManager; |
||||
import org.apache.logging.log4j.Logger; |
||||
import org.junit.Test; |
||||
import org.junit.runner.RunWith; |
||||
import org.springframework.test.context.ContextConfiguration; |
||||
import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; |
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; |
||||
import web.config.SpringConfig; |
||||
|
||||
import java.util.ArrayList; |
||||
|
||||
//让测试运行于Spring环境
|
||||
@RunWith(SpringJUnit4ClassRunner.class) |
||||
@SpringJUnitWebConfig |
||||
@ContextConfiguration(classes = {SpringConfig.class}) |
||||
public class ThriftTest { |
||||
|
||||
private static Logger log = LogManager.getLogger(); |
||||
|
||||
@Test |
||||
public void commentSum() throws Exception { |
||||
MyAsyncMethodCallback<Integer> call = new MyAsyncMethodCallback<>(); |
||||
ThriftClientPool.doExecute(client -> client.commentSum(49052, call)); |
||||
log.info(call.getResult()); |
||||
} |
||||
|
||||
@Test |
||||
public void download() throws Exception { |
||||
MyAsyncMethodCallback<String> call = new MyAsyncMethodCallback<>(); |
||||
ThriftClientPool.doExecute(client ->client.download(new ArrayList<Integer>(){{ |
||||
add(49052); |
||||
}},"test",call)); |
||||
log.info(call.getResult()); |
||||
} |
||||
} |
Loading…
Reference in new issue