Merge branch 'master' of https://github.com/lostcharlie/Bench4Q
This commit is contained in:
commit
3672d3d101
|
@ -129,6 +129,16 @@ public abstract class TestBase {
|
||||||
final Scenario scenario, int poolSize, PluginManager pluginManager) {
|
final Scenario scenario, int poolSize, PluginManager pluginManager) {
|
||||||
ScenarioContext scenarioContext = ScenarioContext.buildScenarioContextWithoutScenario(
|
ScenarioContext scenarioContext = ScenarioContext.buildScenarioContextWithoutScenario(
|
||||||
testId, poolSize, pluginManager);
|
testId, poolSize, pluginManager);
|
||||||
return scenarioContext.addScenrio(scenario, Schedule.build(new ScheduleModel()), new Date().getTime());
|
return scenarioContext.addScenrio(scenario, Schedule.build(buildScheduleModel()), new Date().getTime());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ScheduleModel buildScheduleModel(){
|
||||||
|
ScheduleModel scheduleModel = new ScheduleModel();
|
||||||
|
List<PointModel> points = new LinkedList<ScheduleModel.PointModel>();
|
||||||
|
points.add(new PointModel(0, 0));
|
||||||
|
points.add(new PointModel(20 * 1000, 20));
|
||||||
|
points.add(new PointModel(60 * 1000, 20));
|
||||||
|
scheduleModel.setPoints(points);
|
||||||
|
return scheduleModel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -21,6 +21,7 @@ import javax.net.ssl.SSLContext;
|
||||||
import javax.net.ssl.SSLSocketFactory;
|
import javax.net.ssl.SSLSocketFactory;
|
||||||
import javax.net.ssl.TrustManager;
|
import javax.net.ssl.TrustManager;
|
||||||
|
|
||||||
|
import org.apache.commons.httpclient.ChunkedOutputStream;
|
||||||
import org.apache.commons.httpclient.HttpMethod;
|
import org.apache.commons.httpclient.HttpMethod;
|
||||||
import org.apache.commons.httpclient.methods.GetMethod;
|
import org.apache.commons.httpclient.methods.GetMethod;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
@ -115,12 +116,12 @@ public class RequestHandler implements Runnable {
|
||||||
int BUF_SIZE = rs < ss ? ss : rs;
|
int BUF_SIZE = rs < ss ? ss : rs;
|
||||||
|
|
||||||
byte[] buf = new byte[BUF_SIZE];
|
byte[] buf = new byte[BUF_SIZE];
|
||||||
try{
|
try {
|
||||||
initClientServerConnections(this.clientSocket);
|
initClientServerConnections(this.clientSocket);
|
||||||
}catch(SilentException e){
|
} catch (SilentException e) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.header.buildRequestHeader(serverConnection);
|
this.header.buildRequestHeader(serverConnection);
|
||||||
log.trace("set request header");
|
log.trace("set request header");
|
||||||
byte[] requestBody;
|
byte[] requestBody;
|
||||||
|
@ -149,9 +150,9 @@ public class RequestHandler implements Runnable {
|
||||||
log.trace("wrote " + Integer.toString(len) + " bytes");
|
log.trace("wrote " + Integer.toString(len) + " bytes");
|
||||||
num += len;
|
num += len;
|
||||||
}
|
}
|
||||||
//close send request to remote server
|
// close send request to remote server
|
||||||
serverOut.flush();
|
serverOut.flush();
|
||||||
serverOut.close();
|
serverOut.close();
|
||||||
requestBody = this.buffer.toByteArray();
|
requestBody = this.buffer.toByteArray();
|
||||||
log.trace("transferred rest of request body");
|
log.trace("transferred rest of request body");
|
||||||
} else {
|
} else {
|
||||||
|
@ -160,11 +161,12 @@ public class RequestHandler implements Runnable {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.clientSocket.shutdownInput();
|
this.clientSocket.shutdownInput();
|
||||||
|
|
||||||
this.serverIn = serverConnection.getInputStream();
|
this.serverIn = serverConnection.getInputStream();
|
||||||
synchronized (mutex) {
|
synchronized (mutex) {
|
||||||
// this.proxyServer.processRequest(this.header, requestBody);
|
// this.proxyServer.processRequest(this.header,
|
||||||
// log.trace("processed request");
|
// requestBody);
|
||||||
|
// log.trace("processed request");
|
||||||
|
|
||||||
this.buffer.reset();
|
this.buffer.reset();
|
||||||
int len;
|
int len;
|
||||||
|
@ -182,7 +184,7 @@ public class RequestHandler implements Runnable {
|
||||||
try {
|
try {
|
||||||
this.clientOut.write(changeHeaderToByte(
|
this.clientOut.write(changeHeaderToByte(
|
||||||
serverConnection.getHeaderFields(),
|
serverConnection.getHeaderFields(),
|
||||||
responseModel.getResponse().length));
|
responseModel));
|
||||||
|
|
||||||
this.clientOut.write(responseModel.getResponse());
|
this.clientOut.write(responseModel.getResponse());
|
||||||
} catch (SocketException e) {
|
} catch (SocketException e) {
|
||||||
|
@ -208,7 +210,7 @@ public class RequestHandler implements Runnable {
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte[] changeHeaderToByte(Map<String, List<String>> headerMap,
|
private byte[] changeHeaderToByte(Map<String, List<String>> headerMap,
|
||||||
int responseLen) {
|
ResponseModel responseModel) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
for (String key : headerMap.keySet()) {
|
for (String key : headerMap.keySet()) {
|
||||||
|
@ -216,20 +218,45 @@ public class RequestHandler implements Runnable {
|
||||||
sb.append(changeList2String(headerMap.get(key)) + "\r\n");
|
sb.append(changeList2String(headerMap.get(key)) + "\r\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (key.equals("Transfer-Encoding")) {
|
if(key.equals("Content-Length") && headerMap.get(key).get(0).equals("-1")){
|
||||||
|
sb.append("Content-Length: "+responseModel.getResponse().length +"\r\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (key.equals("Transfer-Encoding") && headerMap.get(key).get(0).equals("chunked")) {
|
||||||
|
responseModel.setResponse(buildResponseBodyToChunked(responseModel.getResponse()));
|
||||||
|
}
|
||||||
sb.append(key + ": " + changeList2String(headerMap.get(key))
|
sb.append(key + ": " + changeList2String(headerMap.get(key))
|
||||||
+ "\r\n");
|
+ "\r\n");
|
||||||
}
|
}
|
||||||
// change response length
|
|
||||||
if (headerMap.get("Content-Length") == null) {
|
|
||||||
sb.append("Content-Length: " + responseLen).append("\r\n");
|
|
||||||
}
|
|
||||||
sb.append("\r\n");
|
sb.append("\r\n");
|
||||||
return sb.toString().getBytes();
|
return sb.toString().getBytes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private byte[] buildResponseBodyToChunked(byte[] responseBytes) {
|
||||||
|
ChunkedOutputStream chunkedOutputStream = null;
|
||||||
|
try {
|
||||||
|
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
||||||
|
chunkedOutputStream = new ChunkedOutputStream(byteArrayOutputStream);
|
||||||
|
chunkedOutputStream.write(responseBytes,0,responseBytes.length);
|
||||||
|
chunkedOutputStream.finish();
|
||||||
|
chunkedOutputStream.flush();
|
||||||
|
|
||||||
|
return byteArrayOutputStream.toByteArray();
|
||||||
|
} catch (IOException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally{
|
||||||
|
if(chunkedOutputStream != null){
|
||||||
|
try {
|
||||||
|
chunkedOutputStream.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return responseBytes;
|
||||||
|
}
|
||||||
private String changeList2String(List<String> headers) {
|
private String changeList2String(List<String> headers) {
|
||||||
if (headers == null)
|
if (headers == null)
|
||||||
return "";
|
return "";
|
||||||
|
|
|
@ -8,6 +8,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.commons.httpclient.ChunkedInputStream;
|
import org.apache.commons.httpclient.ChunkedInputStream;
|
||||||
|
import org.apache.commons.httpclient.ChunkedOutputStream;
|
||||||
import org.apache.commons.io.output.ByteArrayOutputStream;
|
import org.apache.commons.io.output.ByteArrayOutputStream;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.bench4q.recorder.httpcapture.ResponseModel;
|
import org.bench4q.recorder.httpcapture.ResponseModel;
|
||||||
|
@ -71,29 +72,6 @@ public class ResponseParser {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String preprocess(String respString) {
|
|
||||||
return respString.toLowerCase();
|
|
||||||
}
|
|
||||||
|
|
||||||
private String parseContentLength(Map<String, List<String>> map) {
|
|
||||||
|
|
||||||
List<String> values = map.get("Content-Length:");
|
|
||||||
if (values != null) {
|
|
||||||
return values.get(0);
|
|
||||||
}
|
|
||||||
return "-1";
|
|
||||||
}
|
|
||||||
|
|
||||||
private String parseContentEncoding(Map<String, List<String>> map) {
|
|
||||||
|
|
||||||
String ret = "";
|
|
||||||
List<String> values = map.get("Content-Encoding:");
|
|
||||||
if (values != null) {
|
|
||||||
return values.get(0);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String parseCharset(HttpURLConnection httpURLConnection) {
|
private String parseCharset(HttpURLConnection httpURLConnection) {
|
||||||
|
|
||||||
String ret = null;
|
String ret = null;
|
||||||
|
@ -129,39 +107,7 @@ public class ResponseParser {
|
||||||
return httpURLConnection.getHeaderField("Transfer-Encoding");
|
return httpURLConnection.getHeaderField("Transfer-Encoding");
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte[] buildResponseBody() {
|
|
||||||
|
|
||||||
ByteArrayInputStream in = new ByteArrayInputStream(this.getResponse(),
|
|
||||||
0, this.getResponse().length);
|
|
||||||
ChunkedInputStream chunkedIS = null;
|
|
||||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
|
||||||
try {
|
|
||||||
|
|
||||||
chunkedIS = new ChunkedInputStream(in);
|
|
||||||
int tempByte;
|
|
||||||
while ((tempByte = chunkedIS.read()) != -1) {
|
|
||||||
out.write(tempByte);
|
|
||||||
}
|
|
||||||
|
|
||||||
return out.toByteArray();
|
|
||||||
} catch (IOException e) {
|
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
|
||||||
} finally {
|
|
||||||
try {
|
|
||||||
if (chunkedIS != null) {
|
|
||||||
chunkedIS.close();
|
|
||||||
}
|
|
||||||
if (out != null) {
|
|
||||||
out.close();
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void parseResponseBody() {
|
private void parseResponseBody() {
|
||||||
ContentDecoder contentDecoder = ContentDecoder.createDecoder(this
|
ContentDecoder contentDecoder = ContentDecoder.createDecoder(this
|
||||||
|
@ -194,6 +140,9 @@ public class ResponseParser {
|
||||||
charset = Charset.forName("utf-8");
|
charset = Charset.forName("utf-8");
|
||||||
logger.error(e, e);
|
logger.error(e, e);
|
||||||
}
|
}
|
||||||
return contentEncoder.encoderContent(responseBody.getBytes(charset));
|
byte[] responseBytes = responseBody.getBytes(charset);
|
||||||
|
responseBytes = contentEncoder.encoderContent(responseBytes);
|
||||||
|
|
||||||
|
return responseBytes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,59 +18,59 @@ import org.junit.Test;
|
||||||
public class Test_RequestHandler {
|
public class Test_RequestHandler {
|
||||||
private static final int PORT = 8910;
|
private static final int PORT = 8910;
|
||||||
|
|
||||||
@Test
|
// @Test
|
||||||
public void test() {
|
// public void test() {
|
||||||
try {
|
// try {
|
||||||
ProxyServer proxyServer = new ProxyServer(PORT);
|
// ProxyServer proxyServer = new ProxyServer(PORT);
|
||||||
Bench4qCodeGenerator observer = new Bench4qCodeGenerator(
|
// Bench4qCodeGenerator observer = new Bench4qCodeGenerator(
|
||||||
new Bench4qTestScriptAdapter(new RunScenarioModel()));
|
// new Bench4qTestScriptAdapter(new RunScenarioModel()));
|
||||||
proxyServer.addObserver(observer);
|
// proxyServer.addObserver(observer);
|
||||||
RequestHandler requestHandler = new RequestHandler(proxyServer,
|
// RequestHandler requestHandler = new RequestHandler(proxyServer,
|
||||||
proxyServer.getServerSocket().accept());
|
// proxyServer.getServerSocket().accept());
|
||||||
requestHandler.run();
|
// requestHandler.run();
|
||||||
} catch (IOException e) {
|
// } catch (IOException e) {
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Test
|
// @Test
|
||||||
public void test2() {
|
// public void test2() {
|
||||||
new SendRequest().run();
|
// new SendRequest().run();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
private static class SendRequest implements Runnable {
|
// private static class SendRequest implements Runnable {
|
||||||
private HttpClient httpClient = new HttpClient();
|
// private HttpClient httpClient = new HttpClient();
|
||||||
|
//
|
||||||
@SuppressWarnings("deprecation")
|
// @SuppressWarnings("deprecation")
|
||||||
public void run() {
|
// public void run() {
|
||||||
HostConfiguration hostConfiguration = new HostConfiguration();
|
// HostConfiguration hostConfiguration = new HostConfiguration();
|
||||||
hostConfiguration.setProxy("127.0.0.1", PORT);
|
// hostConfiguration.setProxy("127.0.0.1", PORT);
|
||||||
httpClient.setHostConfiguration(hostConfiguration);
|
// httpClient.setHostConfiguration(hostConfiguration);
|
||||||
// CustomGetMethod get = new CustomGetMethod("http://www.baidu.com");
|
//// CustomGetMethod get = new CustomGetMethod("http://www.baidu.com");
|
||||||
GetMethod get = new GetMethod("http://www.baidu.com");
|
// GetMethod get = new GetMethod("http://www.baidu.com");
|
||||||
|
//
|
||||||
try {
|
// try {
|
||||||
get.addRequestHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8");
|
// get.addRequestHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8");
|
||||||
get.addRequestHeader("Accept-Language", "zh-CN,zh;q=0.8");
|
// get.addRequestHeader("Accept-Language", "zh-CN,zh;q=0.8");
|
||||||
get.addRequestHeader("Cache-Control", "max-age=0");
|
// get.addRequestHeader("Cache-Control", "max-age=0");
|
||||||
get.addRequestHeader("Accept-Encoding", "gzip,deflate,sdch");
|
// get.addRequestHeader("Accept-Encoding", "gzip,deflate,sdch");
|
||||||
get.addRequestHeader("Cookie","__zpspc=188.1.1409195668.1409195668.1%234%7C%7C%7C%7C%7C; BDUSS=E45eXUtamxkY2JUbS12ZjFUSmJPbWdmUU13Ri1ZVHlzWWx2S1B3YXRxRVNUU1pVQVFBQUFBJCQAAAAAAAAAAAEAAAAOfOsxd29uYW5ndW8xMQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABLA~lMSwP5Tc; cflag=65535%3A1; BD_UPN=123143; BD_HOME=1; BAIDUID=12B697CB05FD662D2CA4416FF118FCD8:FG=1; BDRCVFR[feWj1Vr5u3D]=I67x6TjHwwYf0; BD_CK_SAM=1; H_PS_PSSID=8307_5228_1466_7800_8235_8488_8057_6506_6017_8251_7607_7799_8483_8457_8167_8509_8435_8382_8114; BD_HOME=1");
|
// get.addRequestHeader("Cookie","__zpspc=188.1.1409195668.1409195668.1%234%7C%7C%7C%7C%7C; BDUSS=E45eXUtamxkY2JUbS12ZjFUSmJPbWdmUU13Ri1ZVHlzWWx2S1B3YXRxRVNUU1pVQVFBQUFBJCQAAAAAAAAAAAEAAAAOfOsxd29uYW5ndW8xMQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABLA~lMSwP5Tc; cflag=65535%3A1; BD_UPN=123143; BD_HOME=1; BAIDUID=12B697CB05FD662D2CA4416FF118FCD8:FG=1; BDRCVFR[feWj1Vr5u3D]=I67x6TjHwwYf0; BD_CK_SAM=1; H_PS_PSSID=8307_5228_1466_7800_8235_8488_8057_6506_6017_8251_7607_7799_8483_8457_8167_8509_8435_8382_8114; BD_HOME=1");
|
||||||
|
//
|
||||||
int statusCode = this.httpClient.executeMethod(get);
|
// int statusCode = this.httpClient.executeMethod(get);
|
||||||
System.out.println(statusCode);
|
// System.out.println(statusCode);
|
||||||
System.out.println(new String(get.getResponseBody(),Charset.forName("utf-8")));
|
// System.out.println(new String(get.getResponseBody(),Charset.forName("utf-8")));
|
||||||
} catch (URIException e) {
|
// } catch (URIException e) {
|
||||||
// TODO Auto-generated catch block
|
// // TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
} catch (HttpException e) {
|
// } catch (HttpException e) {
|
||||||
// TODO Auto-generated catch block
|
// // TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
} catch (IOException e) {
|
// } catch (IOException e) {
|
||||||
// TODO Auto-generated catch block
|
// // TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,6 +117,7 @@ addIp=Add IP
|
||||||
testPlanName=Test Plan Name
|
testPlanName=Test Plan Name
|
||||||
plugin_jsp_addNewPlugin=Add a new plug-in
|
plugin_jsp_addNewPlugin=Add a new plug-in
|
||||||
plugin_jsp_chooseBehaviors=Choose the behaviors of plug-in
|
plugin_jsp_chooseBehaviors=Choose the behaviors of plug-in
|
||||||
|
plugin_jsp_chooseFilter=Choose the filter of behaviors
|
||||||
plugin_jsp_removeAll=Remove All
|
plugin_jsp_removeAll=Remove All
|
||||||
plugin_jsp_remove=Remove
|
plugin_jsp_remove=Remove
|
||||||
plugin_jsp_cancel=Cancel
|
plugin_jsp_cancel=Cancel
|
||||||
|
@ -132,6 +133,7 @@ plugin_jsp_scriptName=Script Name:
|
||||||
plugin_jsp_insertBefore=Insert Before
|
plugin_jsp_insertBefore=Insert Before
|
||||||
plugin_jsp_insertAfter=Insert After
|
plugin_jsp_insertAfter=Insert After
|
||||||
plugin_jsp_clear=Clear
|
plugin_jsp_clear=Clear
|
||||||
|
plugin_jsp_filter=Filter
|
||||||
plugin_jsp_insertChild=Insert Child
|
plugin_jsp_insertChild=Insert Child
|
||||||
plugin_jsp_addPage=Add Page
|
plugin_jsp_addPage=Add Page
|
||||||
script_jsp_makeScript=ScriptEdit
|
script_jsp_makeScript=ScriptEdit
|
||||||
|
@ -207,4 +209,6 @@ testExecuteTime=Execute Time
|
||||||
startServerFail=Fail to start record server:
|
startServerFail=Fail to start record server:
|
||||||
stopTestPlan=Stop Test
|
stopTestPlan=Stop Test
|
||||||
stop=Stop
|
stop=Stop
|
||||||
testProxySettings=testProxySettings
|
testProxySettings=testProxySettings
|
||||||
|
startRecording=startRecording
|
||||||
|
startrecording=start recording to generate a script or upload a script to server
|
|
@ -118,6 +118,7 @@ startTest=\u5F00\u59CB\u6D4B\u8BD5
|
||||||
testPlanName=\u6D4B\u8BD5\u540D\u79F0
|
testPlanName=\u6D4B\u8BD5\u540D\u79F0
|
||||||
plugin_jsp_addNewPlugin=\u6DFB\u52A0\u4E00\u4E2A\u65B0\u7684\u63D2\u4EF6
|
plugin_jsp_addNewPlugin=\u6DFB\u52A0\u4E00\u4E2A\u65B0\u7684\u63D2\u4EF6
|
||||||
plugin_jsp_chooseBehaviors=\u9009\u62E9\u63D2\u4EF6\u7684\u52A8\u4F5C
|
plugin_jsp_chooseBehaviors=\u9009\u62E9\u63D2\u4EF6\u7684\u52A8\u4F5C
|
||||||
|
plugin_jsp_chooseFilter=\u9009\u62e9\u8981\u8fc7\u6ee4\u7684\u884c\u4e3a
|
||||||
plugin_jsp_removeAll=\u5168\u90E8\u79FB\u9664
|
plugin_jsp_removeAll=\u5168\u90E8\u79FB\u9664
|
||||||
plugin_jsp_remove=\u79FB\u9664
|
plugin_jsp_remove=\u79FB\u9664
|
||||||
plugin_jsp_cancel=\u53D6\u6D88
|
plugin_jsp_cancel=\u53D6\u6D88
|
||||||
|
@ -134,6 +135,7 @@ plugin_jsp_insertBefore=\u524D\u5BFC\u5165
|
||||||
plugin_jsp_insertAfter=\u540E\u5BFC\u5165
|
plugin_jsp_insertAfter=\u540E\u5BFC\u5165
|
||||||
plugin_jsp_insertChild=\u63D2\u5165
|
plugin_jsp_insertChild=\u63D2\u5165
|
||||||
plugin_jsp_clear=\u6E05\u7A7A
|
plugin_jsp_clear=\u6E05\u7A7A
|
||||||
|
plugin_jsp_filter=\u8fc7\u6ee4
|
||||||
plugin_jsp_addPage=\u52A0\u9875
|
plugin_jsp_addPage=\u52A0\u9875
|
||||||
script_jsp_makeScript=\u811A\u672C\u7F16\u8F91
|
script_jsp_makeScript=\u811A\u672C\u7F16\u8F91
|
||||||
script_jsp_recordScript=\u5F55\u5236\u811A\u672C
|
script_jsp_recordScript=\u5F55\u5236\u811A\u672C
|
||||||
|
@ -208,4 +210,6 @@ startServer=\u70B9\u51FB\u542F\u52A8\u670D\u52A1\u5F55\u5236\u811A\u672C\u6216\u
|
||||||
testExecuteTime=\u6267\u884C\u65F6\u95F4
|
testExecuteTime=\u6267\u884C\u65F6\u95F4
|
||||||
stopTestPlan=\u505C\u6B62\u6D4B\u8BD5
|
stopTestPlan=\u505C\u6B62\u6D4B\u8BD5
|
||||||
stop=\u505C\u6B62
|
stop=\u505C\u6B62
|
||||||
testProxySettings=\u6d4b\u8bd5Proxy\u8bbe\u7f6e
|
testProxySettings=\u6d4b\u8bd5Proxy\u8bbe\u7f6e
|
||||||
|
startRecording=\u5f00\u59cb\u5f55\u5236
|
||||||
|
startrecording=\u70b9\u51fb\u5f00\u59cb\u5f55\u5236\u5f55\u5236\u811a\u672c
|
|
@ -45,4 +45,6 @@ stopRecord=The script recording has been stopped, please input the script name a
|
||||||
saveScriptSuccess=Save successfully.
|
saveScriptSuccess=Save successfully.
|
||||||
saveScriptFail=Fail to save script.
|
saveScriptFail=Fail to save script.
|
||||||
plugin_jsp_addPage=Add Page
|
plugin_jsp_addPage=Add Page
|
||||||
stopTestPlan_fail=Stop running test plan fail
|
stopTestPlan_fail=Stop running test plan fail
|
||||||
|
RecordingScript=Recording Script
|
||||||
|
stopRecord=click stop server to stop recording script
|
|
@ -41,4 +41,6 @@ stopRecord=\u505C\u6B62\u811A\u672C\u5F55\u5236\uFF0C\u8BF7\u8F93\u5165\u811A\u6
|
||||||
saveScriptSuccess=\u4FDD\u5B58\u6210\u529F\u3002
|
saveScriptSuccess=\u4FDD\u5B58\u6210\u529F\u3002
|
||||||
saveScriptFail=\u4FDD\u5B58\u811A\u672C\u5931\u8D25
|
saveScriptFail=\u4FDD\u5B58\u811A\u672C\u5931\u8D25
|
||||||
plugin_jsp_addPage=\u52A0\u9875
|
plugin_jsp_addPage=\u52A0\u9875
|
||||||
stopTestPlan_fail=\u505C\u6B62\u8FD0\u884C\u6D4B\u8BD5\u8BA1\u5212\u5931\u8D25
|
stopTestPlan_fail=\u505C\u6B62\u8FD0\u884C\u6D4B\u8BD5\u8BA1\u5212\u5931\u8D25
|
||||||
|
RecordingScript=\u6b63\u5728\u5f55\u5236\u811a\u672c
|
||||||
|
stopRecord=\u70b9\u51fb\u505c\u6b62\u670d\u52a1\u5668\u505c\u6b62\u5f55\u5236\u811a\u672c
|
|
@ -155,13 +155,6 @@ body {
|
||||||
<fmt:message key="uploadScript" />
|
<fmt:message key="uploadScript" />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div id="fileName" style="display: none" class="modal-footer">
|
|
||||||
<input class="input-mini" name="scriptname"></input>
|
|
||||||
<button type="button" class="btn btn-primary"
|
|
||||||
onClick="saveScript()">
|
|
||||||
<fmt:message key="savefile" />
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="modal hide fade" id="mySecondModal">
|
<div class="modal hide fade" id="mySecondModal">
|
||||||
|
@ -185,13 +178,6 @@ body {
|
||||||
<fmt:message key="plugin_jsp_cancel" />
|
<fmt:message key="plugin_jsp_cancel" />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div id="fileName" style="display: none" class="modal-footer">
|
|
||||||
<input class="input-mini" name="scriptname"></input>
|
|
||||||
<button type="button" class="btn btn-primary"
|
|
||||||
onClick="saveScript()">
|
|
||||||
<fmt:message key="savefile" />
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="modal hide fade" id="myThirdModal">
|
<div class="modal hide fade" id="myThirdModal">
|
||||||
|
|
|
@ -70,6 +70,7 @@ function stopServer() {
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
|
$('#stopServer').attr('disabled', false);
|
||||||
$('#fileName').show();
|
$('#fileName').show();
|
||||||
$('#scriptInfo3').text(
|
$('#scriptInfo3').text(
|
||||||
$.i18n.prop("stopRecord")
|
$.i18n.prop("stopRecord")
|
||||||
|
@ -136,7 +137,7 @@ function testRecordProxy() {
|
||||||
$('#scriptInfo3').text(
|
$('#scriptInfo3').text(
|
||||||
$.i18n.prop("RecordingScript"));
|
$.i18n.prop("RecordingScript"));
|
||||||
//$('#startServer').attr('disabled', true);
|
//$('#startServer').attr('disabled', true);
|
||||||
$('#stopServer').attr('disabled', true);
|
//$('#stopServer').attr('disabled', true);
|
||||||
} else {
|
} else {
|
||||||
$('#scriptInfo2').html(
|
$('#scriptInfo2').html(
|
||||||
$.i18n.prop("ProxySettingError") + data.failedMessage);
|
$.i18n.prop("ProxySettingError") + data.failedMessage);
|
||||||
|
@ -157,7 +158,11 @@ function startRecording() {
|
||||||
$('#startRecording').attr('disabled', true);
|
$('#startRecording').attr('disabled', true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
window.open('http://www.baidu.com/')
|
$('#scriptInfo3').text($.i18n.prop("stopRecord"));
|
||||||
|
var url = $('#target-url').val();
|
||||||
|
window.open(url);
|
||||||
|
$('#stopServer').attr('disabled', false);
|
||||||
|
$('#startRecording').attr('disabled', true);
|
||||||
}
|
}
|
||||||
}, "json");
|
}, "json");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
var script = new Array();
|
var script = new Array();
|
||||||
|
var filter = new Array();
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$.post("loadScripts", {}, function(data) {
|
$.post("loadScripts", {}, function(data) {
|
||||||
if (!data.success) {
|
if (!data.success) {
|
||||||
|
@ -23,6 +24,53 @@ $(document).ready(function() {
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
loadSchedulePlot();
|
loadSchedulePlot();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
function createFilter(){
|
||||||
|
$.post("loadFilterTypeList", {}, function(data) {
|
||||||
|
if(!data.success){
|
||||||
|
information(data.failedMessage);
|
||||||
|
return;
|
||||||
|
}else{
|
||||||
|
$('#selectFilter').show();
|
||||||
|
data = data.filterTypeList;
|
||||||
|
for ( var i = 0; i < data.length; i++)
|
||||||
|
filter.push(data[i]);
|
||||||
|
for( var j = 0; j < filter.length; j++){
|
||||||
|
var textNode = document.createTextNode(filter[j]);
|
||||||
|
var checkboxNode = document.createElement("input");
|
||||||
|
checkboxNode.setAttribute("type", "checkbox");
|
||||||
|
checkboxNode.setAttribute("name", "filterList");
|
||||||
|
checkboxNode.setAttribute("id", "filterList"+j);
|
||||||
|
checkboxNode.appendChild(textNode);
|
||||||
|
|
||||||
|
/* var line = $("<div style='cursor:pointer;'>");
|
||||||
|
line.click(function(){
|
||||||
|
document.getElementById(id).checked = true;
|
||||||
|
})
|
||||||
|
var input = $("<input type='radio' name="+name+" id="+id+">");
|
||||||
|
input.attr("value",value);
|
||||||
|
input.attr("text",text);
|
||||||
|
var span = $("<label for="+id+" style='cursor:pointer;'>");
|
||||||
|
span.html(text);
|
||||||
|
line.append(input);
|
||||||
|
line.append(span);
|
||||||
|
line.addClass("line");
|
||||||
|
*/
|
||||||
|
$('#filterList').append(checkboxNode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#selectFilter #ok").click(function() {
|
||||||
|
$("#selectFilter").hide();
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#selectFilter #cancel").click(function() {
|
||||||
|
$("#selectFilter").hide();
|
||||||
|
});
|
||||||
|
|
||||||
function toggleTestExecutionPlan() {
|
function toggleTestExecutionPlan() {
|
||||||
$("#loadTestExecutionPlan").slideToggle();
|
$("#loadTestExecutionPlan").slideToggle();
|
||||||
$('#loadConfigMessage').attr("class", "hide");
|
$('#loadConfigMessage').attr("class", "hide");
|
||||||
|
|
|
@ -151,14 +151,14 @@ body {
|
||||||
|
|
||||||
</select></td>
|
</select></td>
|
||||||
|
|
||||||
<td><input type="checkbox" name="staticResources"
|
<!-- <td><input type="checkbox" name="staticResources"
|
||||||
value="false" data-toggle="tooltip" data-placement="left"
|
value="false" data-toggle="tooltip" data-placement="left"
|
||||||
title=<fmt:message key="staticTip" />> <fmt:message
|
title=<fmt:message key="staticTip" />> <fmt:message
|
||||||
key="filterStatic" /></td>
|
key="filterStatic" /></td>
|
||||||
<td><input type="checkbox" name="timer" value="false"
|
<td><input type="checkbox" name="timer" value="false"
|
||||||
data-toggle="tooltip" data-placement="left"
|
data-toggle="tooltip" data-placement="left"
|
||||||
title=<fmt:message key="timeTip" />> <fmt:message
|
title=<fmt:message key="timeTip" />> <fmt:message
|
||||||
key="filterTime" /><br></td>
|
key="filterTime" /><br></td> -->
|
||||||
<td><a href="#" class="button" onClick="viewScript(this)"><img
|
<td><a href="#" class="button" onClick="viewScript(this)"><img
|
||||||
src="images/script_edit.png" alt="Add"> <fmt:message
|
src="images/script_edit.png" alt="Add"> <fmt:message
|
||||||
key="test-editScript" /></a></td>
|
key="test-editScript" /></a></td>
|
||||||
|
@ -183,7 +183,27 @@ body {
|
||||||
onClick="createNewScript()">
|
onClick="createNewScript()">
|
||||||
<fmt:message key="test_jsp_makeNewScript" />
|
<fmt:message key="test_jsp_makeNewScript" />
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
<button type="submit" class="btn btn-primary" id="createFilter"
|
||||||
|
onClick="createFilter()">
|
||||||
|
<fmt:message key="plugin_jsp_filter" />
|
||||||
|
</button>
|
||||||
|
<div class="modal hide" id="selectFilter">
|
||||||
|
<!-- <div class="modal-header">
|
||||||
|
<h3><fmt:message key="plugin_jsp_addNewPlugin" /></h3>
|
||||||
|
</div> -->
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="inset scroll" id="filterList"></div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-primary btn-width" id="ok">
|
||||||
|
<fmt:message key="plugin_jsp_finish" />
|
||||||
|
</button>
|
||||||
|
<button type="button" class="btn btn-primary btn-width" id="cancel">
|
||||||
|
<fmt:message key="plugin_jsp_cancel" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div id="userConfigMessage" class="hide">all input can not
|
<div id="userConfigMessage" class="hide">all input can not
|
||||||
be empty and must be greater than zero!</div>
|
be empty and must be greater than zero!</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue