...
|
...
|
@@ -221,62 +221,27 @@ |
|
|
</HTTPSamplerProxy>
|
|
|
<hashTree>
|
|
|
</hashTree>
|
|
|
<JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="AJAX" enabled="true">
|
|
|
<stringProp name="cacheKey">b04922f8-efaa-4390-bc5f-df25d02450bb</stringProp>
|
|
|
<stringProp name="filename"></stringProp>
|
|
|
<stringProp name="parameters">GEThttp://www.yohobuy.com/common/suggestfeedback?callback=jQuery112409858715270747556_1505876076710&return_type=jsonp&client_secret=web&code=200&_=1505876076711 GEThttp://www.yohobuy.com/channel/isNewUserAjax GEThttp://www.yohobuy.com/passport/cert/headerTip?callback=jQuery112409858715270747556_1505876076710&_=1505876076712</stringProp>
|
|
|
<stringProp name="script">import org.apache.http.HttpEntity;
|
|
|
import org.apache.http.HttpResponse;
|
|
|
import org.apache.http.client.HttpClient;
|
|
|
import org.apache.http.client.methods.HttpGet;
|
|
|
import org.apache.http.client.methods.HttpPost;
|
|
|
import org.apache.http.entity.StringEntity;
|
|
|
import org.apache.http.impl.client.DefaultHttpClient;
|
|
|
import org.apache.http.util.EntityUtils;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.concurrent.ExecutorService;
|
|
|
import java.util.concurrent.Executors;
|
|
|
List<String> urls = new ArrayList<String>();
|
|
|
Collections.addAll(urls,args);
|
|
|
ExecutorService pool = Executors.newFixedThreadPool(urls.size());
|
|
|
for (String url : urls) {
|
|
|
final String currentURL = url;
|
|
|
pool.submit(new Runnable() {
|
|
|
@Override
|
|
|
public void run() {
|
|
|
try {
|
|
|
if(currentURL.startsWith("GET")){
|
|
|
currentURL=currentURL.substring(3);
|
|
|
HttpClient client = new DefaultHttpClient();
|
|
|
HttpGet get = new HttpGet(currentURL);
|
|
|
HttpResponse response = client.execute(get);
|
|
|
HttpEntity entity = response.getEntity();
|
|
|
EntityUtils.consume(entity);
|
|
|
}
|
|
|
if(currentURL.startsWith("POST")){
|
|
|
String[] splitArr =currentURL.substring(4).split("YptPostData=");
|
|
|
currentURL = splitArr[0];
|
|
|
String postData = splitArr[1];
|
|
|
HttpClient client = new DefaultHttpClient();
|
|
|
HttpPost post = new HttpPost(currentURL);
|
|
|
StringEntity entityStr = new StringEntity(postData, Charset.forName("UTF-8"));
|
|
|
entityStr.setContentEncoding("UTF-8");
|
|
|
post.setEntity(entityStr);
|
|
|
HttpResponse response = client.execute(post);
|
|
|
HttpEntity entity = response.getEntity();
|
|
|
EntityUtils.consume(entity);
|
|
|
}
|
|
|
}catch (Exception ex) {
|
|
|
ex.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
pool.shutdown();</stringProp>
|
|
|
<stringProp name="scriptLanguage">groovy</stringProp>
|
|
|
</JSR223Sampler>
|
|
|
<com.blazemeter.ajax.AJAXRequest guiclass="com.blazemeter.ajax.gui.AJAXRequestGui" testclass="com.blazemeter.ajax.AJAXRequest" testname="AJAX" enabled="true">
|
|
|
<elementProp name="AJAXRequest.arguments" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="用户定义的变量" enabled="true">
|
|
|
<collectionProp name="Arguments.arguments">
|
|
|
<elementProp name="GET" elementType="Argument">
|
|
|
<stringProp name="Argument.name">GET</stringProp>
|
|
|
<stringProp name="Argument.value">http://www.yohobuy.com/common/suggestfeedback?callback=jQuery112409858715270747556_1505876076710&return_type=jsonp&client_secret=web&code=200&_=1505876076711</stringProp>
|
|
|
<stringProp name="Argument.metadata">=</stringProp>
|
|
|
</elementProp>
|
|
|
<elementProp name="GET" elementType="Argument">
|
|
|
<stringProp name="Argument.name">GET</stringProp>
|
|
|
<stringProp name="Argument.value">http://www.yohobuy.com/channel/isNewUserAjax</stringProp>
|
|
|
<stringProp name="Argument.metadata">=</stringProp>
|
|
|
</elementProp>
|
|
|
<elementProp name="GET" elementType="Argument">
|
|
|
<stringProp name="Argument.name">GET</stringProp>
|
|
|
<stringProp name="Argument.value">http://www.yohobuy.com/passport/cert/headerTip?callback=jQuery112409858715270747556_1505876076710&_=1505876076712</stringProp>
|
|
|
<stringProp name="Argument.metadata">=</stringProp>
|
|
|
</elementProp>
|
|
|
</collectionProp>
|
|
|
</elementProp>
|
|
|
</com.blazemeter.ajax.AJAXRequest>
|
|
|
<hashTree/> </hashTree>
|
|
|
<ConstantThroughputTimer guiclass="TestBeanGUI" testclass="ConstantThroughputTimer" testname="固定TPM" enabled="true">
|
|
|
<stringProp name="TestPlan.comments"></stringProp>
|
...
|
...
|
|