????????????????poptest????????а???????????????л????????????????????????????????????????????????????????????????????????????????????????????????????loadrunner??????????????????????????javavuser??????Щ??????????java???????????????????????????
???????????loadrunner????java_vuser??? ??
???????????????????Create/Edit Script-->New Script-->???javaЭ??-->java_vuser ?????????
???????????????loadrunner???????
??????run-time-setting ????classpath??
???????????????????????java????
??????java????????? ?????import com.lr_class.*????????????com????У???com?????lr_class????У????????????????????С?
???????????????javavuser??????????gzip????????????????????
?????????httpЭ????? web_custom_request?????е? BodyBinary??????????????????????ɡ?
import lrapi.lr;
import com.lr_class.*;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.InputStreamEntity;
import org.apache.http.impl.client.DefaultHttpClient;
public class Actions
{
public int init() throws Throwable {
return 0;
}
public int action() throws Throwable {
String url ="http://xx.xx.xx.xx/stats/uploadData";
int code;
byte[] dataBytes= Fdata.putData("<testing>"??"<user>"??"<id>"??"<age>"??"<time>"??1??1??5??1??1348042886??4??13432909036L??1234567890123455L??1??1);
System.out.println(dataBytes);
byte[] b = UnGZIP.compressToByte(dataBytes);
b = XXXXXRC4.code(b);
System.out.println(b);
lr.start_transaction("????");
ByteArrayInputStream bs = null ;
bs = new ByteArrayInputStream(b?? 0?? b.length);
HttpPost httpPost = new HttpPost(url);
httpPost.addHeader("Content-Type"?? "application/octet-stream");
HttpEntity he = new InputStreamEntity(bs?? b.length);
httpPost.setEntity(he);
HttpResponse httpResponse = new  DefaultHttpClient().execute(httpPost);
code = httpResponse.getStatusLine().getStatusCode();
if (code == 901) {
lr.output_message("???  code:"+code);
lr.end_transaction("????"?? lr.PASS);
}
else{
lr.error_message("???   code:"+code);
lr.end_transaction("????"?? lr.FAIL);
}
return 0;
}
public int end() throws Throwable {
return 0;
}
}