第一步,新建LR的脚本,选择Java Vuser协议:

第二步,编写hessian测试脚本,如下:

import lrapi.lr;
import java.net.MalformedURLException;
import kf.ats.gvnsvr.common.service.base.IBaseTimeService;
import com.caucho.hessian.client.HessianProxyFactory;

public class Actions
{
private static final String postUrl = "http://192.168.2.161:18081/test/HS/";
private static final String serverName="BaseTimeService";

public int init() throws Throwable {

return 0;
}//end of init
 
 
public int action() throws Throwable {

lr.start_transaction("deal");

HessianProxyFactory factory = new HessianProxyFactory();
     IBaseTimeService service;
     String result=null;
     try {
      service = (IBaseTimeService) factory.create(IBaseTimeService.class, postUrl + serverName);
      result=service.getCurrentTime().toString();
      System.out.println(result);
    } catch (MalformedURLException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
        }

if (result!=null) {
  lr.end_transaction("deal", lr.PASS);
     } else {
  lr.end_transaction("deal", lr.FAIL);
     }
     return 0;
}//end of action

public int end() throws Throwable {

return 0;
}//end of end
}

第三步,导入必要的jar类(这步很关键):

最新文章

  1. jQuery.eq() 函数
  2. nodejs在Liunx上的部署生产方式-PM2
  3. 服务器知识----IIS架设问题
  4. 菜菜CPP日记
  5. Dos
  6. druid简介
  7. bmp格式解析
  8. java createSQLQuery().list()返回日期格式没有时分秒的解决方法
  9. SQL技术内幕三
  10. 【elasticsearch】(4)centos7 超简单安装elasticsearch 的 jdbc
  11. 使用wireshark抓本机之间的包(转)
  12. Windows as a Service(3)——使用SCCM管理Windows10更新
  13. SDP(3):ScalikeJDBC- JDBC-Engine:Fetching
  14. 如何查看ubuntu系统版本信息
  15. git 学习(3) ----- 代码共享和多人协作
  16. Git push提交时报错Permission denied(publickey)...Please make sure you have the correct access rights and the repository exists.
  17. php 开启 opcache 之后 require、include 还会每次都重新加载文件吗?
  18. spring动态创建数据源
  19. POJ 1751 Highways 【最小生成树 Kruskal】
  20. nginx安装扩展 sub_filter&http_ssl_module

热门文章

  1. 《你不知道的javascript》一、函数作用域和块作用域
  2. BLOCK的应用
  3. ok6410 android driver(5)
  4. SQL Server数据库ROW_NUMBER()函数使用详解
  5. C# LLSQL快速查询框架
  6. csharp: Speech
  7. FreeBSD的新一代包管理工具Pkg 1.3.0 发布
  8. Protocol Buffers动态消息解析
  9. JMS学习(四) Selector详解
  10. pbfunc外部函数扩展应用-在Powerbuilder中进行Http的GET、POST操作