Merge branch 'master' of https://github.com/lostcharlie/Bench4Q
This commit is contained in:
commit
6a8e50cf6f
|
@ -4,6 +4,7 @@ import java.lang.reflect.Field;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -166,8 +167,7 @@ public class TestPlanFactory {
|
||||||
private Script createAScriptWithFilter(
|
private Script createAScriptWithFilter(
|
||||||
ScriptFilterOptionsModel scriptFilterOptionsModel, Script script) {
|
ScriptFilterOptionsModel scriptFilterOptionsModel, Script script) {
|
||||||
RunScenarioModel runScenarioModel = (RunScenarioModel) MarshalHelper
|
RunScenarioModel runScenarioModel = (RunScenarioModel) MarshalHelper
|
||||||
.tryUnmarshal(RunScenarioModel.class,
|
.tryUnmarshal(RunScenarioModel.class, script.getScriptContent());
|
||||||
script.getFilteredScriptCnt());
|
|
||||||
List<String> filterPluginId = new ArrayList<String>();
|
List<String> filterPluginId = new ArrayList<String>();
|
||||||
if (scriptFilterOptionsModel.isFilterTimer()) {
|
if (scriptFilterOptionsModel.isFilterTimer()) {
|
||||||
for (UsePluginModel pluginModel : runScenarioModel.getUsePlugins()) {
|
for (UsePluginModel pluginModel : runScenarioModel.getUsePlugins()) {
|
||||||
|
@ -180,20 +180,23 @@ public class TestPlanFactory {
|
||||||
&& !scriptFilterOptionsModel.getFilterTypeMatches().equals("")) {
|
&& !scriptFilterOptionsModel.getFilterTypeMatches().equals("")) {
|
||||||
for (PageModel pageModel : runScenarioModel.getPages()) {
|
for (PageModel pageModel : runScenarioModel.getPages()) {
|
||||||
for (BatchModel batchModel : pageModel.getBatches()) {
|
for (BatchModel batchModel : pageModel.getBatches()) {
|
||||||
for (BehaviorModel behaviorModel : batchModel
|
Iterator<BehaviorModel> behaviIterator = batchModel
|
||||||
.getBehaviors()) {
|
.getBehaviors().iterator();
|
||||||
|
while (behaviIterator.hasNext()) {
|
||||||
|
BehaviorModel behaviorModel = behaviIterator.next();
|
||||||
if (filterPluginId.contains(behaviorModel.getUse())
|
if (filterPluginId.contains(behaviorModel.getUse())
|
||||||
|| isFilterType(
|
|| isFilterType(
|
||||||
scriptFilterOptionsModel
|
scriptFilterOptionsModel
|
||||||
.getFilterTypeMatches(),
|
.getFilterTypeMatches(),
|
||||||
behaviorModel)) {
|
behaviorModel)) {
|
||||||
batchModel.getBehaviors().remove(behaviorModel);
|
behaviIterator.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String contentString = MarshalHelper.tryMarshal(runScenarioModel);
|
String contentString = MarshalHelper.tryMarshal(runScenarioModel);
|
||||||
|
System.out.println(contentString);
|
||||||
script.setFilteredScriptCnt(contentString);
|
script.setFilteredScriptCnt(contentString);
|
||||||
return script;
|
return script;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import org.hibernate.Criteria;
|
||||||
import org.hibernate.Session;
|
import org.hibernate.Session;
|
||||||
import org.hibernate.Transaction;
|
import org.hibernate.Transaction;
|
||||||
import org.hibernate.criterion.Criterion;
|
import org.hibernate.criterion.Criterion;
|
||||||
|
import org.hibernate.criterion.Order;
|
||||||
import org.hibernate.criterion.Restrictions;
|
import org.hibernate.criterion.Restrictions;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@ -116,7 +117,7 @@ public class ScriptRepositoty extends AbstractRepositoty {
|
||||||
Session session = this.getSessionHelper().openSession();
|
Session session = this.getSessionHelper().openSession();
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
List<Script> scripts = session.createCriteria(Script.class)
|
List<Script> scripts = session.createCriteria(Script.class)
|
||||||
.add(Restrictions.eq("user", user))
|
.add(Restrictions.eq("user", user)).addOrder(Order.desc("createDateTime"))
|
||||||
.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY).list();
|
.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY).list();
|
||||||
releaseSession(session);
|
releaseSession(session);
|
||||||
return scripts;
|
return scripts;
|
||||||
|
|
|
@ -121,7 +121,7 @@ public class TestPlanRepository extends AbstractRepositoty {
|
||||||
try {
|
try {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
List<TestPlan> ret = session.createCriteria(TestPlan.class)
|
List<TestPlan> ret = session.createCriteria(TestPlan.class)
|
||||||
.add(Restrictions.eq("user", user))
|
.add(Restrictions.eq("user", user)).addOrder(Order.desc("lastRunningTime"))
|
||||||
.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY).list();
|
.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY).list();
|
||||||
return ret;
|
return ret;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
filter.type.list=text/css,text/html,text/plain,image/*,*javascript,application/json,application/xml,think-time
|
filter.type.list=text/css,text/html,text/plain,image/.*,.*javascript,application/json,application/xml,think-time
|
File diff suppressed because one or more lines are too long
|
@ -6,24 +6,13 @@ import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.MalformedURLException;
|
|
||||||
import java.net.ProtocolException;
|
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
import java.net.SocketException;
|
import java.net.SocketException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.net.ssl.HostnameVerifier;
|
|
||||||
import javax.net.ssl.HttpsURLConnection;
|
|
||||||
import javax.net.ssl.SSLContext;
|
|
||||||
import javax.net.ssl.SSLSocketFactory;
|
|
||||||
import javax.net.ssl.TrustManager;
|
|
||||||
|
|
||||||
import org.apache.commons.httpclient.ChunkedOutputStream;
|
import org.apache.commons.httpclient.ChunkedOutputStream;
|
||||||
import org.apache.commons.httpclient.HttpMethod;
|
|
||||||
import org.apache.commons.httpclient.methods.GetMethod;
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.bench4q.recorder.httpcapture.Utils.SilentException;
|
import org.bench4q.recorder.httpcapture.Utils.SilentException;
|
||||||
|
|
||||||
|
@ -96,17 +85,17 @@ public class RequestHandler implements Runnable {
|
||||||
serverConnection.addRequestProperty("host", host);
|
serverConnection.addRequestProperty("host", host);
|
||||||
serverConnection.addRequestProperty("port", Integer.toString(port));
|
serverConnection.addRequestProperty("port", Integer.toString(port));
|
||||||
}
|
}
|
||||||
|
//
|
||||||
private String stripProxyInfoFromRequestHeader()
|
// private String stripProxyInfoFromRequestHeader()
|
||||||
throws MalformedURLException {
|
// throws MalformedURLException {
|
||||||
String res = "";
|
// String res = "";
|
||||||
String origUrl = this.header.url;
|
// String origUrl = this.header.url;
|
||||||
URL url = new URL("https://" + origUrl);
|
// URL url = new URL("https://" + origUrl);
|
||||||
this.header.url = url.getFile();
|
// this.header.url = url.getFile();
|
||||||
res = this.header.toString();
|
// res = this.header.toString();
|
||||||
this.header.url = origUrl;
|
// this.header.url = origUrl;
|
||||||
return res;
|
// return res;
|
||||||
}
|
// }
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -2,7 +2,6 @@ package org.bench4q.recorder.httpcapture.generator;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.charset.Charset;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.util.zip.GZIPInputStream;
|
import java.util.zip.GZIPInputStream;
|
||||||
import java.util.zip.GZIPOutputStream;
|
|
||||||
|
|
||||||
public class GzipDecoder extends ContentDecoder {
|
public class GzipDecoder extends ContentDecoder {
|
||||||
|
|
||||||
|
|
|
@ -4,12 +4,7 @@ import java.io.ByteArrayInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.apache.commons.httpclient.ChunkedInputStream;
|
|
||||||
import org.apache.commons.httpclient.ChunkedOutputStream;
|
|
||||||
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;
|
||||||
|
|
||||||
|
|
|
@ -16,21 +16,27 @@ import org.bench4q.share.models.agent.RunScenarioModel;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class Test_RequestHandler {
|
public class Test_RequestHandler {
|
||||||
private static final int PORT = 8910;
|
// private static final int PORT = 8910;
|
||||||
|
// private static ScriptCapturer scriptCapturer;
|
||||||
// @Test
|
// @Test
|
||||||
// public void test() {
|
// public void test() {
|
||||||
// try {
|
// scriptCapturer = new ScriptCapturer();
|
||||||
// ProxyServer proxyServer = new ProxyServer(PORT);
|
// scriptCapturer.startRecordServer(PORT, "test_hemeimei", "hemeimei");
|
||||||
// Bench4qCodeGenerator observer = new Bench4qCodeGenerator(
|
// scriptCapturer.startRecording(PORT);
|
||||||
// new Bench4qTestScriptAdapter(new RunScenarioModel()));
|
//
|
||||||
// proxyServer.addObserver(observer);
|
//// ProxyServer proxyServer = new ProxyServer(PORT);
|
||||||
// RequestHandler requestHandler = new RequestHandler(proxyServer,
|
//// Bench4qCodeGenerator observer = new Bench4qCodeGenerator(
|
||||||
// proxyServer.getServerSocket().accept());
|
//// new Bench4qTestScriptAdapter(new RunScenarioModel()));
|
||||||
// requestHandler.run();
|
//// proxyServer.addObserver(observer);
|
||||||
// } catch (IOException e) {
|
//// RequestHandler requestHandler = new RequestHandler(proxyServer,
|
||||||
// e.printStackTrace();
|
//// proxyServer.getServerSocket().accept());
|
||||||
// }
|
//// requestHandler.run();
|
||||||
|
//// proxyServer.
|
||||||
|
// }
|
||||||
|
// @Test
|
||||||
|
// public void testStop(){
|
||||||
|
// scriptCapturer.stopRecording(PORT);
|
||||||
|
// scriptCapturer.stopProxyServer(PORT);
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// @Test
|
// @Test
|
||||||
|
|
|
@ -233,6 +233,7 @@ public class TestPlanMessager extends MasterMessager {
|
||||||
handleInvalidatedResponse(url);
|
handleInvalidatedResponse(url);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
System.out.println("getLatestScriptBriefResult:\r\n"+httpResponse.getContent());
|
||||||
return (ScriptBriefResultModel) MarshalHelper.tryUnmarshal(
|
return (ScriptBriefResultModel) MarshalHelper.tryUnmarshal(
|
||||||
ScriptBriefResultModel.class, httpResponse.getContent());
|
ScriptBriefResultModel.class, httpResponse.getContent());
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,6 @@ agentManage_jsp_addAgent=Add Agent
|
||||||
portManage_jsp_addPort=Add Port
|
portManage_jsp_addPort=Add Port
|
||||||
configuredmessage=Here settings can be configured
|
configuredmessage=Here settings can be configured
|
||||||
startserver=Start Server
|
startserver=Start Server
|
||||||
stopserver=Stop Server
|
|
||||||
savefile=Save File
|
savefile=Save File
|
||||||
editscript=Edit Script
|
editscript=Edit Script
|
||||||
savechanges=Save
|
savechanges=Save
|
||||||
|
@ -200,9 +199,7 @@ edit=Edit
|
||||||
script-submitScript=Submit Script
|
script-submitScript=Submit Script
|
||||||
test-editScript=Edit Script
|
test-editScript=Edit Script
|
||||||
test-iptip=Please input right ip address
|
test-iptip=Please input right ip address
|
||||||
filterStatic=Filter Static Resources
|
|
||||||
filterTime=Filter Think Time
|
filterTime=Filter Think Time
|
||||||
staticTip=The static resources contains:js,css,jpeg,gif,png files.
|
|
||||||
timeTipe=The Think time refers the time between tow behaviors.
|
timeTipe=The Think time refers the time between tow behaviors.
|
||||||
startServer=start server to generate a script or upload a script to server
|
startServer=start server to generate a script or upload a script to server
|
||||||
testExecuteTime=Execute Time
|
testExecuteTime=Execute Time
|
||||||
|
@ -211,4 +208,4 @@ stopTestPlan=Stop Test
|
||||||
stop=Stop
|
stop=Stop
|
||||||
testProxySettings=testProxySettings
|
testProxySettings=testProxySettings
|
||||||
startRecording=startRecording
|
startRecording=startRecording
|
||||||
startrecording=start recording to generate a script or upload a script to server
|
stopRecording=Stop Recording
|
|
@ -39,7 +39,6 @@ agentManage_jsp_addAgent=\u6DFB\u52A0\u4EE3\u7406
|
||||||
portManage_jsp_addPort=\u6DFB\u52A0\u7AEF\u53E3
|
portManage_jsp_addPort=\u6DFB\u52A0\u7AEF\u53E3
|
||||||
configuredmessage=\u5728\u8FD9\u91CC\u53EF\u4EE5\u914D\u7F6E
|
configuredmessage=\u5728\u8FD9\u91CC\u53EF\u4EE5\u914D\u7F6E
|
||||||
startserver=\u542F\u52A8\u670D\u52A1\u5668
|
startserver=\u542F\u52A8\u670D\u52A1\u5668
|
||||||
stopserver=\u505C\u6B62\u670D\u52A1\u5668
|
|
||||||
savefile=\u4FDD\u5B58\u6587\u4EF6
|
savefile=\u4FDD\u5B58\u6587\u4EF6
|
||||||
editscript=\u7F16\u8F91\u811A\u672C
|
editscript=\u7F16\u8F91\u811A\u672C
|
||||||
savechanges=\u4FDD\u5B58
|
savechanges=\u4FDD\u5B58
|
||||||
|
@ -202,9 +201,7 @@ edit=\u7F16\u8F91
|
||||||
script-submitScript=\u4FDD\u5B58\u811A\u672C
|
script-submitScript=\u4FDD\u5B58\u811A\u672C
|
||||||
test-editScript=\u7F16\u8F91\u811A\u672C
|
test-editScript=\u7F16\u8F91\u811A\u672C
|
||||||
test-iptip=\u8BF7\u8F93\u5165\u6B63\u786E\u7684IP\u5730\u5740
|
test-iptip=\u8BF7\u8F93\u5165\u6B63\u786E\u7684IP\u5730\u5740
|
||||||
filterStatic=\u8FC7\u6EE4\u9759\u6001\u8D44\u6E90
|
|
||||||
filterTime=\u8FC7\u6EE4\u601D\u8003\u65F6\u95F4
|
filterTime=\u8FC7\u6EE4\u601D\u8003\u65F6\u95F4
|
||||||
staticTip=\u9759\u6001\u8D44\u6E90\u4E3B\u8981\u662F\u6307:js,css,jpeg,gif,png\u6587\u4EF6\u3002
|
|
||||||
timeTip=\u601D\u8003\u65F6\u95F4\u6307\u7684\u662F\u7528\u6237\u4E24\u4E2A\u8FDE\u7EED\u884C\u4E3A\u4E4B\u95F4\u7684\u95F4\u9694\u65F6\u95F4
|
timeTip=\u601D\u8003\u65F6\u95F4\u6307\u7684\u662F\u7528\u6237\u4E24\u4E2A\u8FDE\u7EED\u884C\u4E3A\u4E4B\u95F4\u7684\u95F4\u9694\u65F6\u95F4
|
||||||
startServer=\u70B9\u51FB\u542F\u52A8\u670D\u52A1\u5F55\u5236\u811A\u672C\u6216\u8005\u4E0A\u4F20\u811A\u672C\u6587\u4EF6
|
startServer=\u70B9\u51FB\u542F\u52A8\u670D\u52A1\u5F55\u5236\u811A\u672C\u6216\u8005\u4E0A\u4F20\u811A\u672C\u6587\u4EF6
|
||||||
testExecuteTime=\u6267\u884C\u65F6\u95F4
|
testExecuteTime=\u6267\u884C\u65F6\u95F4
|
||||||
|
@ -212,4 +209,4 @@ 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=\u5f00\u59cb\u5f55\u5236
|
||||||
startrecording=\u70b9\u51fb\u5f00\u59cb\u5f55\u5236\u5f55\u5236\u811a\u672c
|
stopRecording=\u505C\u6B62\u5f55\u5236
|
|
@ -18,6 +18,7 @@
|
||||||
}
|
}
|
||||||
.title-frame{
|
.title-frame{
|
||||||
margin-top:30px;
|
margin-top:30px;
|
||||||
|
cursor:pointer;
|
||||||
}
|
}
|
||||||
i{
|
i{
|
||||||
float:left;
|
float:left;
|
||||||
|
|
|
@ -46,5 +46,5 @@ 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
|
startRecordingMessage=Please click start recording
|
||||||
stopRecord=click stop server to stop recording script
|
stopRecordingMessage=Please click stop recording
|
|
@ -37,10 +37,10 @@ recordScript=\u5F55\u5236\u811A\u672C
|
||||||
startServerFail=\u542F\u52A8\u670D\u52A1\u5668\u5931\u8D25:
|
startServerFail=\u542F\u52A8\u670D\u52A1\u5668\u5931\u8D25:
|
||||||
setProxy=\u8BF7\u8BBE\u7F6E\u4EE3\u7406:
|
setProxy=\u8BF7\u8BBE\u7F6E\u4EE3\u7406:
|
||||||
recordScript=\u5F55\u5236\u811A\u672C
|
recordScript=\u5F55\u5236\u811A\u672C
|
||||||
stopRecord=\u505C\u6B62\u811A\u672C\u5F55\u5236\uFF0C\u8BF7\u8F93\u5165\u811A\u672C\u540D\u79F0\uFF0C\u4FDD\u5B58\u811A\u672C
|
stopRecord=\u505C\u6B62\u811A\u672C\u5F55\u5236\uFF0C\u8BF7\u5148\u66f4\u6539\u6d4f\u89c8\u5668\u4ee3\u7406\u8bbe\u7f6e\uff0c\u518d\u8F93\u5165\u811A\u672C\u540D\u79F0\uFF0C\u4FDD\u5B58\u811A\u672C
|
||||||
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
|
startRecordingMessage=\u8bf7\u70b9\u51fb\u5f00\u59cb\u5f55\u5236
|
||||||
stopRecord=\u70b9\u51fb\u505c\u6b62\u670d\u52a1\u5668\u505c\u6b62\u5f55\u5236\u811a\u672c
|
stopRecordingMessage=\u8bf7\u70b9\u51fb\u505c\u6b62\u5f55\u5236
|
Binary file not shown.
After Width: | Height: | Size: 655 B |
|
@ -27,6 +27,15 @@ body {
|
||||||
.sidebar-nav {
|
.sidebar-nav {
|
||||||
padding: 9px 0;
|
padding: 9px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.show{
|
||||||
|
display:block;
|
||||||
|
color:red;
|
||||||
|
}
|
||||||
|
|
||||||
|
.none-div{
|
||||||
|
display:none;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
@ -109,7 +118,7 @@ body {
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<button id="createNewScript"
|
<button id="createNewScript"
|
||||||
class="btn btn-primary btn-setting" onclick="" type="submit">
|
class="btn btn-primary" onclick="startServer()" type="submit">
|
||||||
<fmt:message key="script_jsp_recordScript" />
|
<fmt:message key="script_jsp_recordScript" />
|
||||||
</button> <a href="createScript.jsp"><button id="createScript"
|
</button> <a href="createScript.jsp"><button id="createScript"
|
||||||
class="btn btn-primary" onclick="#" type="submit">
|
class="btn btn-primary" onclick="#" type="submit">
|
||||||
|
@ -160,33 +169,31 @@ body {
|
||||||
<div class="modal hide fade" id="mySecondModal">
|
<div class="modal hide fade" id="mySecondModal">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<button type="button" id="myModal-close" class="close"
|
<button type="button" id="myModal-close" class="close"
|
||||||
data-dismiss="modal">×</button>
|
onclick="dismiss(mySecondModal)">×</button>
|
||||||
<h3>
|
<h3>
|
||||||
<fmt:message key="settings" />
|
<fmt:message key="settings" />
|
||||||
</h3>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<p id="scriptInfo2"></p>
|
<p id="scriptInfo2"></p>
|
||||||
|
<input class="input" id="target-url2" name="target-url" type="url" value="http://">
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
|
|
||||||
<button type="button" class="btn btn-primary"
|
<button type="button" class="btn btn-primary"
|
||||||
onClick="testRecordProxy()" id="testRecordProxy">
|
onClick="testRecordProxy()" id="testRecordProxy">
|
||||||
<fmt:message key="testProxySettings" />
|
<fmt:message key="testProxySettings" />
|
||||||
</button>
|
</button>
|
||||||
<button type="button" id="cancel" class="btn btn-primary">
|
<button type="button" id="cancel" class="btn btn-primary" onclick="dismiss(mySecondModal)">
|
||||||
<fmt:message key="plugin_jsp_cancel" />
|
<fmt:message key="plugin_jsp_cancel" />
|
||||||
</button>
|
</button>
|
||||||
|
<span id="ProxySettingMessage" class="hide"><img src="/images/cross.png" alt="Invalid">Invalid browser settings!</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="modal hide fade" id="myThirdModal">
|
<div class="modal hide fade" id="myThirdModal">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<button type="button" id="myModal-close" class="close"
|
<button type="button" id="myModal-close" class="close" onclick="dismiss(myThirdModal)">×</button>
|
||||||
data-dismiss="modal">×</button>
|
<h3><fmt:message key="settings" /></h3>
|
||||||
<h3>
|
|
||||||
<fmt:message key="settings" />
|
|
||||||
</h3>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<p id="scriptInfo3"></p>
|
<p id="scriptInfo3"></p>
|
||||||
|
@ -197,11 +204,11 @@ body {
|
||||||
<fmt:message key="startRecording" />
|
<fmt:message key="startRecording" />
|
||||||
</button>
|
</button>
|
||||||
<button type="button" class="btn btn-primary"
|
<button type="button" class="btn btn-primary"
|
||||||
onClick="stopServer()" id="stopServer">
|
onClick="stopRecording()" id=stopRecording>
|
||||||
<fmt:message key="stopserver" />
|
<fmt:message key="stopRecording" />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div id="fileName" style="display: none" class="modal-footer">
|
<div id="fileName" class="modal-footer none-div">
|
||||||
<input class="input-mini" name="scriptname"></input>
|
<input class="input-mini" name="scriptname"></input>
|
||||||
<button type="button" class="btn btn-primary"
|
<button type="button" class="btn btn-primary"
|
||||||
onClick="saveScript()">
|
onClick="saveScript()">
|
||||||
|
@ -228,8 +235,9 @@ body {
|
||||||
<script src="lib/dataTable/js/jquery.dataTables.js"></script>
|
<script src="lib/dataTable/js/jquery.dataTables.js"></script>
|
||||||
<script src="lib/chrisma/js/theme.js"></script>
|
<script src="lib/chrisma/js/theme.js"></script>
|
||||||
<script src="script/base.js"></script>
|
<script src="script/base.js"></script>
|
||||||
<script src="script/scriptListManage.js"></script>
|
<script src="script/RecordScript/ScriptListManage.js"></script>
|
||||||
<script src="script/script.js"></script>
|
<script src="script/RecordScript/RecordScriptUI.js"></script>
|
||||||
|
<script src="script/RecordScript/RecordScriptServer.js"></script>
|
||||||
<script src="lib/other/jquery.noty.packaged.min.js"></script>
|
<script src="lib/other/jquery.noty.packaged.min.js"></script>
|
||||||
<script src="script/scriptManager/uiFactory.js"></script>
|
<script src="script/scriptManager/uiFactory.js"></script>
|
||||||
</fmt:bundle>
|
</fmt:bundle>
|
||||||
|
|
|
@ -0,0 +1,138 @@
|
||||||
|
var server = null;
|
||||||
|
var table = $("#scriptTab").DataTable();
|
||||||
|
var startRecordingSuccess = false;
|
||||||
|
var startServerSuccess = false;
|
||||||
|
var stopServerSuccess = false;
|
||||||
|
|
||||||
|
function startServer() {
|
||||||
|
$.post("startRecordServer", {}, function(data) {
|
||||||
|
if (data.success) {
|
||||||
|
server = data.server;
|
||||||
|
$('#myModal').modal('hide');
|
||||||
|
$('#mySecondModal').modal('show');
|
||||||
|
$("#ProxySettingMessage").attr("class","hide");
|
||||||
|
$("#target-url2").val($("#target-url").val());
|
||||||
|
$('#scriptInfo2').text(
|
||||||
|
$.i18n.prop("setProxy")+
|
||||||
|
" IP:133.133.2.100"
|
||||||
|
+ " ,port: " + server.port
|
||||||
|
+ $.i18n.prop("recordScript"))
|
||||||
|
$('#stopRecording').attr('disabled', false);
|
||||||
|
$('#startRecording').attr('disabled', false);
|
||||||
|
startServerSuccess = true;
|
||||||
|
stopServerSuccess = false;
|
||||||
|
} else {
|
||||||
|
$('#scriptInfo').html(
|
||||||
|
$.i18n.prop("startServerFail") + data.failedMessage);
|
||||||
|
}
|
||||||
|
}, "json");
|
||||||
|
}
|
||||||
|
|
||||||
|
function startRecording() {
|
||||||
|
if (server != null) {
|
||||||
|
$.post("startRecording", {
|
||||||
|
port : server.port,
|
||||||
|
scriptRecordUUID : server.fileName
|
||||||
|
}, function(data) {
|
||||||
|
if (!data.success) {
|
||||||
|
$('#scriptInfo3').text(
|
||||||
|
"start recording error:" + data.failedMessage);
|
||||||
|
$('#stopRecording').attr('disabled', false);
|
||||||
|
$('#startRecording').attr('disabled', true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$('#scriptInfo3').text($.i18n.prop("stopRecordingMessage"));
|
||||||
|
var url = $('#target-url2').val();
|
||||||
|
window.open(url);
|
||||||
|
$('#stopRecording').attr('disabled', false);
|
||||||
|
$('#startRecording').attr('disabled', true);
|
||||||
|
startRecordingSuccess = true;
|
||||||
|
stopServerSuccess = false;
|
||||||
|
}
|
||||||
|
}, "json");
|
||||||
|
} else {
|
||||||
|
$('#scriptInfo3').text("record script server has not started");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function stopRecording() {
|
||||||
|
if (server != null) {
|
||||||
|
$.post("stopScriptRecording", {
|
||||||
|
port : server.port,
|
||||||
|
scriptRecordUUID : server.fileName
|
||||||
|
}, function(data) {
|
||||||
|
if (!data.success) {
|
||||||
|
$('#scriptInfo3').text(
|
||||||
|
"stop record server error:" + data.failedMessage);
|
||||||
|
|
||||||
|
$('#stopRecording').attr('disabled', true);
|
||||||
|
$('#startRecording').attr('disabled', false);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
$('#scriptInfo3').text($.i18n.prop("stopRecord"));
|
||||||
|
$('#stopRecording').attr('disabled', true);
|
||||||
|
$('#fileName').show();
|
||||||
|
stopServer();
|
||||||
|
stopServerSuccess = true;
|
||||||
|
startRecordingSuccess = false;
|
||||||
|
}
|
||||||
|
}, "json");
|
||||||
|
} else {
|
||||||
|
$('#scriptInfo3').text("record script server has not started");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function stopServer() {
|
||||||
|
if (server != null) {
|
||||||
|
$.post("stopRecordServer", {
|
||||||
|
port : server.port,
|
||||||
|
scriptRecordUUID : server.fileName
|
||||||
|
}, function(data) {
|
||||||
|
if (!data.success) {
|
||||||
|
$('#scriptInfo3').text(
|
||||||
|
"stop record server error:" + data.failedMessage);
|
||||||
|
$('#stopRecording').attr('disabled', true);
|
||||||
|
$('#startRecording').attr('disabled', false);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
stopServerSuccess = true;
|
||||||
|
startServerSuccess = false;
|
||||||
|
}
|
||||||
|
}, "json");
|
||||||
|
} else {
|
||||||
|
$('#scriptInfo3').text("record script server has not started");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function testRecordProxy() {
|
||||||
|
$.post("testRecordProxy", {}, function(data) {
|
||||||
|
if (data.success) {
|
||||||
|
$('#mySecondModal').modal('hide');
|
||||||
|
$('#myThirdModal').modal('show');
|
||||||
|
$('#scriptInfo3').text(
|
||||||
|
$.i18n.prop("startRecordingMessage"));
|
||||||
|
} else {
|
||||||
|
$("#ProxySettingMessage").attr("class","show");
|
||||||
|
}
|
||||||
|
}, "json");
|
||||||
|
}
|
||||||
|
|
||||||
|
function saveScript() {
|
||||||
|
var scriptName = document.getElementsByName("scriptname")[0].value;
|
||||||
|
$.post("saveScriptRecorded", {
|
||||||
|
scriptName : scriptName,
|
||||||
|
port : server.port,
|
||||||
|
scriptRecordUUID : server.fileName
|
||||||
|
}, function(data) {
|
||||||
|
if (data.success) {
|
||||||
|
$("#scriptInfo3").text($.i18n.prop("saveScriptSuccess"));
|
||||||
|
$('#fileName').hide();
|
||||||
|
server = null;
|
||||||
|
} else {
|
||||||
|
$("#scriptInfo3").text($.i18n.prop("saveScriptFail") + data.failedMessage);
|
||||||
|
$('#fileName').hide();
|
||||||
|
}
|
||||||
|
loadScript(table, 2);
|
||||||
|
});
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
$('.btn-setting').click(function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
$('#myModal').modal('show');
|
||||||
|
});
|
||||||
|
|
||||||
|
function dismiss(container){
|
||||||
|
$(container).modal('hide');
|
||||||
|
if(startRecordingSuccess && !stopServerSuccess){
|
||||||
|
stopRecording();
|
||||||
|
$('#fileName').hide();
|
||||||
|
}
|
||||||
|
if(startServerSuccess && !stopServerSuccess)
|
||||||
|
stopServer();
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#uploadScript')
|
||||||
|
.click(
|
||||||
|
function() {
|
||||||
|
var myModalContent = $('#myModal').html();
|
||||||
|
$(".modal-footer").html("");
|
||||||
|
var uploadForm = '<form method="post" enctype="multipart/form-data" action="uploadScriptFile">'
|
||||||
|
+ '<p>script name:<input class="input-mini" type="text" name="scriptName" ></p>'
|
||||||
|
+ '<p>script to upload: <input type="file" name="scriptFile"/></p>'
|
||||||
|
+ '<p><input type="submit"/></p></form>';
|
||||||
|
var status = "<div id='status'><h3></h3><div>";
|
||||||
|
$('#scriptInfo').html("");
|
||||||
|
$('#scriptInfo').html(uploadForm + status);
|
||||||
|
|
||||||
|
$('form').ajaxForm({
|
||||||
|
success : function(data) {
|
||||||
|
if (data.success) {
|
||||||
|
$("#status").text(data.message);
|
||||||
|
loadScript(table, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
$("#status").text(data.failedMessage);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$('#myModal-close').click(function() {
|
||||||
|
$('#myModal').html(myModalContent);
|
||||||
|
$('#myModal').modal('hide');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
addEvent(table);
|
||||||
|
loadScript(table);
|
||||||
|
$('#stopRecording').attr('disabled', true);
|
||||||
|
});
|
||||||
|
|
||||||
|
function refresh() {
|
||||||
|
location.replace(location);
|
||||||
|
}
|
|
@ -0,0 +1,64 @@
|
||||||
|
function loadScript(table) {
|
||||||
|
var editButton = "<a class='btn btn-success edit' ><i class='icon-edit icon-white'></i>"
|
||||||
|
+ $.i18n.prop('script-edit') + "</a>";
|
||||||
|
var deleteButton = "<a class='btn btn-info delete'><i class='icon-trash icon-white'></i>"
|
||||||
|
+ $.i18n.prop('delete') + "</a>";
|
||||||
|
table.clear();
|
||||||
|
$.post("loadScripts", {}, function(data) {
|
||||||
|
if (data.success) {
|
||||||
|
var scripts = data.scripts;
|
||||||
|
if (scripts == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for ( var i = 0; i < scripts.length; i++) {
|
||||||
|
var tr = table.row.add(
|
||||||
|
[ i + 1, scripts[i].name,
|
||||||
|
new Date(scripts[i].createDateTime),
|
||||||
|
editButton + deleteButton ]).draw().node();
|
||||||
|
$(tr).attr("id", scripts[i].id);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
information(data.failedMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
}, "json");
|
||||||
|
|
||||||
|
}
|
||||||
|
function addEvent(table) {
|
||||||
|
var tbody = table.table().body();
|
||||||
|
$(tbody).on("click", "td a.delete", function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
var row = $(this).closest("tr");
|
||||||
|
var scriptId = $(row).attr("id");
|
||||||
|
deleteScript(scriptId, table.row(row));
|
||||||
|
|
||||||
|
});
|
||||||
|
$(tbody).on("click", "td a.edit", function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
var row = $(this).closest("tr");
|
||||||
|
var scriptId = $(row).attr("id");
|
||||||
|
var scriptId = $(row).attr("id");
|
||||||
|
var scriptName = table.row(row).data()[1];
|
||||||
|
editScript(scriptId, scriptName);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteScript(scriptId, row) {
|
||||||
|
$.post("deleteScript", {
|
||||||
|
scriptId : scriptId
|
||||||
|
}, function(data) {
|
||||||
|
if (data.success) {
|
||||||
|
|
||||||
|
information($.i18n.prop("script-deleteSuc"));
|
||||||
|
row.remove().draw();
|
||||||
|
} else {
|
||||||
|
information(data.failedMessage);
|
||||||
|
// error message
|
||||||
|
}
|
||||||
|
}, "json");
|
||||||
|
}
|
||||||
|
function editScript(scriptId, scriptName) {
|
||||||
|
window.open("editScript.jsp?name=" + scriptName + "&scriptId=" + scriptId);// need
|
||||||
|
}
|
|
@ -36,4 +36,144 @@ function getScriptFilterOptions(){
|
||||||
}
|
}
|
||||||
return scriptFilterOptions;
|
return scriptFilterOptions;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function checkTotalAllocation() {
|
||||||
|
if (document.getElementById("totalNumber").childNodes[0].nodeValue == "100%") {
|
||||||
|
$("#totalNumber").attr("class","total-right");
|
||||||
|
$("#alertMessage").attr("class", "hide");
|
||||||
|
} else {
|
||||||
|
$("#totalNumber").attr("class","total-false");
|
||||||
|
$("#alertMessage").attr("class", "show");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkRequireLoad() {
|
||||||
|
if (parseInt($("#RequireLoad").val()) <= 0
|
||||||
|
|| $("#RequireLoad").val() == "")
|
||||||
|
$("#RequireLoad").attr("class",
|
||||||
|
"load-config-input-alert");
|
||||||
|
else
|
||||||
|
$("#RequireLoad").attr("class",
|
||||||
|
"load-config-input");
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkWarmUp() {
|
||||||
|
if (parseInt($("#WarmUp").val()) <= 0
|
||||||
|
|| $("#WarmUp").val() == "")
|
||||||
|
$("#WarmUp").attr("class",
|
||||||
|
"load-config-input-alert");
|
||||||
|
else
|
||||||
|
$("#WarmUp").attr("class",
|
||||||
|
"load-config-input");
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkCoolDown() {
|
||||||
|
if (parseInt($("#CoolDown").val()) <= 0
|
||||||
|
|| $("#CoolDown").val() == "")
|
||||||
|
$("#CoolDown").attr("class",
|
||||||
|
"load-config-input-alert");
|
||||||
|
else
|
||||||
|
$("#CoolDown").attr("class",
|
||||||
|
"load-config-input");
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkExecuteRange() {
|
||||||
|
if (parseInt($("#ExecuteRange").val()) <= 0
|
||||||
|
|| $("#ExecuteRange").val() == "")
|
||||||
|
$("#ExecuteRange").attr("class",
|
||||||
|
"load-config-input-alert");
|
||||||
|
else
|
||||||
|
$("#ExecuteRange").attr("class",
|
||||||
|
"load-config-input");
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkLoadConfig() {
|
||||||
|
checkExecuteRange();
|
||||||
|
checkCoolDown();
|
||||||
|
checkRequireLoad();
|
||||||
|
checkWarmUp();
|
||||||
|
if ($("#ExecuteRange").attr("class") == "load-config-input"
|
||||||
|
&& $("#CoolDown").attr("class") == "load-config-input"
|
||||||
|
&& $("#WarmUp").attr("class") == "load-config-input"
|
||||||
|
&& $("#RequireLoad").attr("class") == "load-config-input")
|
||||||
|
$("#loadConfigMessage").attr("class",
|
||||||
|
"hide");
|
||||||
|
else
|
||||||
|
$("#loadConfigMessage").attr("class",
|
||||||
|
"show");
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkUserScenarios() {
|
||||||
|
var input= $("#userScenarios").find("input");
|
||||||
|
var boolean = 0;
|
||||||
|
var number = 0;
|
||||||
|
for ( var i = 0; i < input.length; i++) {
|
||||||
|
if (input[i].value == "" || parseInt(input[i].value) <= 0) {
|
||||||
|
// input[i].setAttribute("class", "allocation-input-alert");
|
||||||
|
boolean = 1;
|
||||||
|
}
|
||||||
|
// else
|
||||||
|
// input[i].setAttribute("class", "allocation-input");
|
||||||
|
}
|
||||||
|
for ( var k = 0; k < input.length; k++) {
|
||||||
|
if ($(input[k]).attr("class") == "allocation-input")
|
||||||
|
number++;
|
||||||
|
}
|
||||||
|
if (number == input.length)
|
||||||
|
boolean = 0;
|
||||||
|
if (boolean == 1)
|
||||||
|
$("#userConfigMessage").attr("class",
|
||||||
|
"show");
|
||||||
|
else
|
||||||
|
$("#userConfigMessage").attr("class",
|
||||||
|
"hide");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkIP() {
|
||||||
|
|
||||||
|
var input = $("#ipConfig").find("input");
|
||||||
|
var patrn = /^(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])$/;
|
||||||
|
var boolean = 0;
|
||||||
|
var number = 0;
|
||||||
|
for ( var i = 0; i < input.length; i++) {
|
||||||
|
if (input[i].value == "" || patrn.exec(input[i].value) == null) {
|
||||||
|
input[i].setAttribute("class", "ip-input-alert");
|
||||||
|
boolean = 1;
|
||||||
|
} else
|
||||||
|
input[i].setAttribute("class", "ip-input");
|
||||||
|
}
|
||||||
|
for ( var k = 0; k < input.length; k++) {
|
||||||
|
if (input[k].getAttribute("class") == "ip-input")
|
||||||
|
number++;
|
||||||
|
}
|
||||||
|
if (number == input.length)
|
||||||
|
boolean = 0;
|
||||||
|
if (boolean == 1)
|
||||||
|
$("#ipConfigMessage")
|
||||||
|
.attr("class", "show");
|
||||||
|
else
|
||||||
|
$("#ipConfigMessage")
|
||||||
|
.attr("class", "hide");
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkName() {
|
||||||
|
if ($("#testConfigurationName").val() == "") {
|
||||||
|
$("#testConfigurationName").attr("class",
|
||||||
|
"name-input-alert");
|
||||||
|
$("#nameMessage").attr("class", "show");
|
||||||
|
} else {
|
||||||
|
$("#testConfigurationName").attr("class",
|
||||||
|
"name-input");
|
||||||
|
$("#nameMessage").attr("class", "hide");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkAllInpute() {
|
||||||
|
checkLoadConfig();
|
||||||
|
checkUserScenarios();
|
||||||
|
checkIP();
|
||||||
|
checkName();
|
||||||
}
|
}
|
|
@ -85,14 +85,29 @@ function start() {
|
||||||
for ( var j = 0; j < input.length; j++)
|
for ( var j = 0; j < input.length; j++)
|
||||||
loadList.push(parseInt(requireLoad * allocationList[j] / 100));
|
loadList.push(parseInt(requireLoad * allocationList[j] / 100));
|
||||||
scriptIdList = getScriptIdList();
|
scriptIdList = getScriptIdList();
|
||||||
// var scriptFilterOptions=getScriptFilterOptions();
|
|
||||||
|
var isFilterTimer = false;
|
||||||
|
var filterTypeMatches = "";
|
||||||
|
var filterSelected = $("#filterList").find("input[name='filterList']:checked");
|
||||||
|
|
||||||
|
for(var i=0;i<filterSelected.length;i++)
|
||||||
|
{
|
||||||
|
var id = filterSelected[i].id;
|
||||||
|
if(id == "think-time"){
|
||||||
|
isFilterTimer = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
filterTypeMatches += id+"|";
|
||||||
|
}
|
||||||
|
//delete last |
|
||||||
|
if(filterTypeMatches != "")
|
||||||
|
filterTypeMatches = filterTypeMatches.substring(0,filterTypeMatches.length-1);
|
||||||
|
|
||||||
for ( var k = 0; k < input.length; k++){
|
for ( var k = 0; k < input.length; k++){
|
||||||
scriptList.push(new ScriptModel(scriptIdList[k], loadList[k], warmUp,
|
scriptList.push(new ScriptModel(scriptIdList[k], loadList[k], warmUp,
|
||||||
coolDown, executeRange));
|
coolDown, executeRange,isFilterTimer,filterTypeMatches));
|
||||||
}
|
}
|
||||||
var filterSelected = $("#filterList div input[name='filterList']:checked");
|
|
||||||
for(var i=0;i<filterSelected.length;i++)
|
|
||||||
filterArray.push(filterSelected[i].id);
|
|
||||||
|
|
||||||
var name = $("#testConfigurationName").val();
|
var name = $("#testConfigurationName").val();
|
||||||
var testPlan = new TestPlanRequestModel(scriptList, ipList, name);
|
var testPlan = new TestPlanRequestModel(scriptList, ipList, name);
|
||||||
|
@ -110,4 +125,18 @@ function start() {
|
||||||
error : function(request, status, error) {
|
error : function(request, status, error) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function createNewScript(){
|
||||||
|
window.open("script.jsp");
|
||||||
|
}
|
||||||
|
function viewScript(node) {
|
||||||
|
var scriptId;
|
||||||
|
var scriptName;
|
||||||
|
var selectNodes = document.getElementsByName("select");
|
||||||
|
var index = node.parentNode.parentNode.rowIndex - 1;
|
||||||
|
scriptName = selectNodes[index].options[selectNodes[index].selectedIndex].value;
|
||||||
|
scriptId = getScriptId(scriptName);
|
||||||
|
window.open("editScript.jsp?name=" + scriptName + "&scriptId=" + scriptId);
|
||||||
|
}
|
||||||
|
|
|
@ -1,17 +1,104 @@
|
||||||
function createCheckbox(id,text){
|
function createCheckbox(id,text){
|
||||||
var line = $("<td style=\"cursor:pointer;\"></td>");
|
var line = $("<td style=\"cursor:pointer;\"></td>");
|
||||||
line.click(function(){
|
line.click(function(){checkBoxClick(id)});
|
||||||
if(document.getElementById(id).checked){
|
|
||||||
document.getElementById(id).checked = false;
|
|
||||||
}else{
|
|
||||||
document.getElementById(id).checked = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
var input = $("<input type='checkbox' name='filterList' id="+id+">");
|
var input = $("<input type='checkbox' name='filterList' id="+id+">");
|
||||||
input.attr("text",text);
|
input.attr("text",text);
|
||||||
|
input.click(function(){checkBoxClick(id)});
|
||||||
line.append(input);
|
line.append(input);
|
||||||
line.append(document.createTextNode(text));
|
line.append(document.createTextNode(text));
|
||||||
line.addClass("line");
|
line.addClass("line");
|
||||||
return line;
|
return line;
|
||||||
|
}
|
||||||
|
function checkBoxClick(id){
|
||||||
|
if(document.getElementById(id).checked){
|
||||||
|
document.getElementById(id).checked = false;
|
||||||
|
}else{
|
||||||
|
document.getElementById(id).checked = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadSchedulePlot() {
|
||||||
|
var options = {
|
||||||
|
chart : {
|
||||||
|
renderTo : 'highchartsPlot',
|
||||||
|
defaultSeriesType : 'line',
|
||||||
|
type : 'area',
|
||||||
|
height : 300,
|
||||||
|
|
||||||
|
},
|
||||||
|
plotOptions : {
|
||||||
|
series : {
|
||||||
|
fillOpacity : 0.5,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
credits : {
|
||||||
|
enabled : false
|
||||||
|
},
|
||||||
|
legend : {
|
||||||
|
enabled : false
|
||||||
|
},
|
||||||
|
title : {
|
||||||
|
text : $.i18n.prop('test-loadSchedule') ,
|
||||||
|
x : -50
|
||||||
|
},
|
||||||
|
xAxis : {
|
||||||
|
categories : [ 0 ],
|
||||||
|
min : 0,
|
||||||
|
},
|
||||||
|
yAxis : {
|
||||||
|
plotLines : [ {
|
||||||
|
value : 0,
|
||||||
|
width : 1,
|
||||||
|
color : '#808080'
|
||||||
|
} ],
|
||||||
|
min : 0
|
||||||
|
},
|
||||||
|
tooltip : {
|
||||||
|
formatter : function() {
|
||||||
|
var formatStr = '<b>'+this.y+ ' users after ' + this.x + ' seconds</b>';
|
||||||
|
return formatStr;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
series : [ {
|
||||||
|
data : [ 0 ]
|
||||||
|
} ]
|
||||||
|
};
|
||||||
|
var RequireLoad = parseInt($("#RequireLoad").val());
|
||||||
|
var WarmUp = parseInt($("#WarmUp").val());
|
||||||
|
var CoolDown = parseInt($("#CoolDown").val());
|
||||||
|
var ExecuteRange = parseInt($("#ExecuteRange").val());
|
||||||
|
options.xAxis.categories.push(WarmUp);
|
||||||
|
options.xAxis.categories.push(WarmUp + ExecuteRange);
|
||||||
|
options.xAxis.categories.push(WarmUp + ExecuteRange + CoolDown);
|
||||||
|
options.series[0].data.push(RequireLoad);
|
||||||
|
options.series[0].data.push(RequireLoad);
|
||||||
|
options.series[0].data.push(0);
|
||||||
|
var chart = new Highcharts.Chart(options);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function toggleTestExecutionPlan() {
|
||||||
|
$("#loadTestExecutionPlan").slideToggle();
|
||||||
|
$('#loadConfigMessage').attr("class", "hide");
|
||||||
|
if ($("#icon-load").attr("class") == "icon-plus")
|
||||||
|
$("#icon-load").attr("class", "icon-minus");
|
||||||
|
else
|
||||||
|
$("#icon-load").attr("class", "icon-plus");
|
||||||
|
}
|
||||||
|
function toggleUserScenarios() {
|
||||||
|
$("#userScenarios").slideToggle();
|
||||||
|
$('#alertMessage').attr("class", "hide");
|
||||||
|
$('#userConfigMessage').attr("class", "hide");
|
||||||
|
if ($("#icon-user").attr("class") == "icon-plus")
|
||||||
|
$("#icon-user").attr("class", "icon-minus");
|
||||||
|
else
|
||||||
|
$("#icon-user").attr("class", "icon-plus");
|
||||||
|
}
|
||||||
|
function toggleIpConfig() {
|
||||||
|
$("#ipConfig").slideToggle();
|
||||||
|
$('#ipConfigMessage').attr("class", "hide");
|
||||||
|
if ($("#icon-ip").attr("class").indexOf("icon-plus") >= 0)
|
||||||
|
$("#icon-ip").attr("class", "icon-minus");
|
||||||
|
else
|
||||||
|
$("#icon-ip").attr("class", "icon-plus");
|
||||||
}
|
}
|
|
@ -3,104 +3,72 @@ $(document).ready(function() {
|
||||||
loadSchedulePlot();
|
loadSchedulePlot();
|
||||||
loadFilterTypeList();
|
loadFilterTypeList();
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#selectFilter #ok").click(function() {
|
$("#selectFilter #ok").click(function() {
|
||||||
$("#selectFilter").hide();
|
$("#selectFilter").hide();
|
||||||
// $("#selectFilter #ok").addClass("clicked");
|
|
||||||
// filter=[];
|
|
||||||
});
|
});
|
||||||
$("#createFilter").click(function(){
|
$("#createFilter").click(function() {
|
||||||
$("#selectFilter").show();
|
$("#selectFilter").show();
|
||||||
})
|
})
|
||||||
function toggleTestExecutionPlan() {
|
|
||||||
$("#loadTestExecutionPlan").slideToggle();
|
|
||||||
$('#loadConfigMessage').attr("class", "hide");
|
|
||||||
if ($("#icon-load").attr("class") == "icon-plus")
|
|
||||||
$("#icon-load").attr("class", "icon-minus");
|
|
||||||
else
|
|
||||||
$("#icon-load").attr("class", "icon-plus");
|
|
||||||
}
|
|
||||||
function toggleUserScenarios() {
|
|
||||||
$("#userScenarios").slideToggle();
|
|
||||||
$('#alertMessage').attr("class", "hide");
|
|
||||||
$('#userConfigMessage').attr("class", "hide");
|
|
||||||
if ($("#icon-user").attr("class") == "icon-plus")
|
|
||||||
$("#icon-user").attr("class", "icon-minus");
|
|
||||||
else
|
|
||||||
$("#icon-user").attr("class", "icon-plus");
|
|
||||||
}
|
|
||||||
function toggleIpConfig() {
|
|
||||||
$("#ipConfig").slideToggle();
|
|
||||||
$('#ipConfigMessage').attr("class", "hide");
|
|
||||||
if ($("#icon-ip").attr("class").indexOf("icon-plus") >= 0)
|
|
||||||
$("#icon-ip").attr("class", "icon-minus");
|
|
||||||
else
|
|
||||||
$("#icon-ip").attr("class", "icon-plus");
|
|
||||||
}
|
|
||||||
|
|
||||||
var scenarioConfigContent;
|
var scenarioConfigContent;
|
||||||
function addScenario() {
|
function addScenario() {
|
||||||
|
//create delete button
|
||||||
var newTdNode = document.createElement("td");
|
var newTdNode = document.createElement("td");
|
||||||
var newINode = document.createElement("i");
|
var newINode = document.createElement("i");
|
||||||
newINode.setAttribute("class", "icon-trash");
|
newINode.setAttribute("class", "icon-trash");
|
||||||
|
|
||||||
newINode.setAttribute("style", "cursor:pointer");
|
newINode.setAttribute("style", "cursor:pointer");
|
||||||
|
|
||||||
newINode.setAttribute("onClick", "deleteScenarios(this)");
|
newINode.setAttribute("onClick", "deleteScenarios(this)");
|
||||||
newTdNode.appendChild(newINode);
|
newTdNode.appendChild(newINode);
|
||||||
var lastInputNodeValue;
|
//end
|
||||||
var lengthBeforAddAction = $("#userConfig").find("input").length;
|
var lastScaleValue;
|
||||||
lastInputNodeValue = document.getElementById("userConfig").getElementsByTagName("input")[lengthBeforAddAction - 1].value;
|
var scaleObject = $("#userConfig").find("input");
|
||||||
if (document.getElementById("userConfig").childNodes.length == 2) {
|
var numOfScript = scaleObject.length;
|
||||||
scenarioConfigContent = $("#userConfig").html();
|
lastScaleValue = scaleObject[numOfScript - 1].value;
|
||||||
document.getElementById("userConfig").innerHTML = $("#userConfig").html()+ scenarioConfigContent;
|
//create new tr
|
||||||
var length = $("#userConfig").find("tr").length;
|
if (numOfScript == 1) {
|
||||||
document.getElementById("userConfig").getElementsByTagName("tr")[length - 1].appendChild(newTdNode);
|
$("#userConfig")[0].children[1].children[0].appendChild(newTdNode);
|
||||||
|
scenarioConfigContent = $("#userConfig")[0].children[1].innerHTML;
|
||||||
|
$("#userConfig")[0].children[1].innerHTML += scenarioConfigContent;
|
||||||
} else {
|
} else {
|
||||||
document.getElementById("userConfig").innerHTML =$("#userConfig").html()+ scenarioConfigContent;
|
$("#userConfig")[0].children[1].innerHTML += scenarioConfigContent;
|
||||||
var length = $("#userConfig").find("tr").length;
|
|
||||||
document.getElementById("userConfig").getElementsByTagName("tr")[length - 1].appendChild(newTdNode);
|
|
||||||
}
|
}
|
||||||
if (lengthBeforAddAction <= 2) {
|
scaleObject = $("#userConfig").find("input");
|
||||||
var allocationLess = parseInt(100 / (lengthBeforAddAction + 1));
|
if (numOfScript == 1) {
|
||||||
var allocationMore = 100 - parseInt(100 / (lengthBeforAddAction + 1))
|
var allocationLess = parseInt(100 / (numOfScript + 1));
|
||||||
* lengthBeforAddAction;
|
var allocationMore = 100 - parseInt(100 / (numOfScript + 1))
|
||||||
for ( var i = 0; i < lengthBeforAddAction; i++) {
|
* numOfScript;
|
||||||
document.getElementById("userConfig").getElementsByTagName("input")[i]
|
for (var i = 0; i < numOfScript; i++) {
|
||||||
.setAttribute("value", allocationLess);
|
scaleObject[i].setAttribute("value", allocationLess);
|
||||||
}
|
}
|
||||||
document.getElementById("userConfig").getElementsByTagName("input")[lengthBeforAddAction]
|
scaleObject[numOfScript].setAttribute("value", allocationMore);
|
||||||
.setAttribute("value", allocationMore);
|
|
||||||
} else {
|
} else {
|
||||||
var allocationLess = parseInt(lastInputNodeValue / 2);
|
var allocationLess = parseInt(lastScaleValue / 2);
|
||||||
var allocationMore = lastInputNodeValue - allocationLess;
|
var allocationMore = lastScaleValue - allocationLess;
|
||||||
document.getElementById("userConfig").getElementsByTagName("input")[lengthBeforAddAction - 1]
|
scaleObject[numOfScript - 1].setAttribute("value", allocationLess);
|
||||||
.setAttribute("value", allocationLess);
|
scaleObject[numOfScript].setAttribute("value", allocationMore);
|
||||||
document.getElementById("userConfig").getElementsByTagName("input")[lengthBeforAddAction]
|
|
||||||
.setAttribute("value", allocationMore);
|
|
||||||
}
|
}
|
||||||
if ($("#userConfig").find("input").length == 10) {
|
if ($("#userConfig").find("input").length == 10) {
|
||||||
$("#userScenariosButton").attr("class",
|
$("#userScenariosButton").attr("class", "btn disabled");
|
||||||
"btn disabled");
|
$("#userScenariosButton").attr("onClick", "");
|
||||||
$("#userScenariosButton").attr("onClick",
|
|
||||||
"");
|
|
||||||
}
|
}
|
||||||
changeTotal();
|
changeTotal();
|
||||||
checkUserScenarios();
|
checkUserScenarios();
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteScenarios(selectedNode) {
|
function deleteScenarios(selectedNode) {
|
||||||
var deleteNode = selectedNode.parentNode.parentNode.parentNode;
|
var deleteNode = selectedNode.parentNode.parentNode;//tr
|
||||||
var Node = deleteNode.parentNode;
|
var Node = deleteNode.parentNode;//tbody
|
||||||
var previousSiblingNode = deleteNode.previousSibling;
|
|
||||||
Node.removeChild(deleteNode);
|
Node.removeChild(deleteNode);
|
||||||
Node.removeChild(previousSiblingNode);
|
var scaleObject = $("#userConfig").find("input");
|
||||||
if ($("#userConfig").find("input").length < 10) {
|
var numOfScript = scaleObject.length;
|
||||||
$("#userScenariosButton").attr("class",
|
if (numOfScript < 10) {
|
||||||
"btn btn-primary");
|
$("#userScenariosButton").attr("class", "btn btn-primary");
|
||||||
$("#userScenariosButton").attr("onClick",
|
$("#userScenariosButton").attr("onClick", "addScenario()");
|
||||||
"addScenario()");
|
if(numOfScript == 1){
|
||||||
|
//remove delete button
|
||||||
|
var onlyOneTrNode = scaleObject[0].parentNode.parentNode;
|
||||||
|
var deleteNode = onlyOneTrNode.children[3];
|
||||||
|
onlyOneTrNode.removeChild(deleteNode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
changeTotal();
|
changeTotal();
|
||||||
checkUserScenarios();
|
checkUserScenarios();
|
||||||
|
@ -113,9 +81,9 @@ function addIP() {
|
||||||
var textNode = document.createTextNode("IP:");
|
var textNode = document.createTextNode("IP:");
|
||||||
var inputNode = document.createElement("input");
|
var inputNode = document.createElement("input");
|
||||||
var tr = document.createElement("tr");
|
var tr = document.createElement("tr");
|
||||||
|
|
||||||
// inputNode.attr({type:"text",class:"ip-input",onblur:"checkIP()"});
|
// inputNode.attr({type:"text",class:"ip-input",onblur:"checkIP()"});
|
||||||
|
|
||||||
inputNode.setAttribute("type", "text");
|
inputNode.setAttribute("type", "text");
|
||||||
inputNode.setAttribute("class", "ip-input");
|
inputNode.setAttribute("class", "ip-input");
|
||||||
inputNode.setAttribute("onblur", "checkIP()");
|
inputNode.setAttribute("onblur", "checkIP()");
|
||||||
|
@ -144,235 +112,19 @@ function changeTotal() {
|
||||||
var inputNode = $("#userConfig").find(".allocation-input");
|
var inputNode = $("#userConfig").find(".allocation-input");
|
||||||
var total = 0;
|
var total = 0;
|
||||||
var length = inputNode.length;
|
var length = inputNode.length;
|
||||||
for ( var i = 0; i < length; i++) {
|
for (var i = 0; i < length; i++) {
|
||||||
total = parseInt(total) + parseInt(inputNode[i].value);
|
total = parseInt(total) + parseInt(inputNode[i].value);
|
||||||
}
|
}
|
||||||
document.getElementById("totalNumber").innerHTML = total + "%";
|
document.getElementById("totalNumber").innerHTML = total + "%";
|
||||||
checkTotalAllocation();
|
checkTotalAllocation();
|
||||||
}
|
}
|
||||||
|
|
||||||
function viewScript(node) {
|
|
||||||
var scriptId;
|
|
||||||
var scriptName;
|
|
||||||
var selectNodes = document.getElementsByName("select");
|
|
||||||
var index = node.parentNode.parentNode.rowIndex - 1;
|
|
||||||
scriptName = selectNodes[index].options[selectNodes[index].selectedIndex].value;
|
|
||||||
scriptId = getScriptId(scriptName);
|
|
||||||
window.open("editScript.jsp?name=" + scriptName + "&scriptId=" + scriptId);
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkTotalAllocation() {
|
|
||||||
if (document.getElementById("totalNumber").childNodes[0].nodeValue == "100%") {
|
|
||||||
$("#totalNumber").attr("class","total-right");
|
|
||||||
$("#alertMessage").attr("class", "hide");
|
|
||||||
} else {
|
|
||||||
$("#totalNumber").attr("class","total-false");
|
|
||||||
$("#alertMessage").attr("class", "show");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkRequireLoad() {
|
|
||||||
if (parseInt($("#RequireLoad").val()) <= 0
|
|
||||||
|| $("#RequireLoad").val() == "")
|
|
||||||
$("#RequireLoad").attr("class",
|
|
||||||
"load-config-input-alert");
|
|
||||||
else
|
|
||||||
$("#RequireLoad").attr("class",
|
|
||||||
"load-config-input");
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkWarmUp() {
|
|
||||||
if (parseInt($("#WarmUp").val()) <= 0
|
|
||||||
|| $("#WarmUp").val() == "")
|
|
||||||
$("#WarmUp").attr("class",
|
|
||||||
"load-config-input-alert");
|
|
||||||
else
|
|
||||||
$("#WarmUp").attr("class",
|
|
||||||
"load-config-input");
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkCoolDown() {
|
|
||||||
if (parseInt($("#CoolDown").val()) <= 0
|
|
||||||
|| $("#CoolDown").val() == "")
|
|
||||||
$("#CoolDown").attr("class",
|
|
||||||
"load-config-input-alert");
|
|
||||||
else
|
|
||||||
$("#CoolDown").attr("class",
|
|
||||||
"load-config-input");
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkExecuteRange() {
|
|
||||||
if (parseInt($("#ExecuteRange").val()) <= 0
|
|
||||||
|| $("#ExecuteRange").val() == "")
|
|
||||||
$("#ExecuteRange").attr("class",
|
|
||||||
"load-config-input-alert");
|
|
||||||
else
|
|
||||||
$("#ExecuteRange").attr("class",
|
|
||||||
"load-config-input");
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkLoadConfig() {
|
|
||||||
checkExecuteRange();
|
|
||||||
checkCoolDown();
|
|
||||||
checkRequireLoad();
|
|
||||||
checkWarmUp();
|
|
||||||
if ($("#ExecuteRange").attr("class") == "load-config-input"
|
|
||||||
&& $("#CoolDown").attr("class") == "load-config-input"
|
|
||||||
&& $("#WarmUp").attr("class") == "load-config-input"
|
|
||||||
&& $("#RequireLoad").attr("class") == "load-config-input")
|
|
||||||
$("#loadConfigMessage").attr("class",
|
|
||||||
"hide");
|
|
||||||
else
|
|
||||||
$("#loadConfigMessage").attr("class",
|
|
||||||
"show");
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkUserScenarios() {
|
|
||||||
var input= $("#userScenarios").find("input");
|
|
||||||
var boolean = 0;
|
|
||||||
var number = 0;
|
|
||||||
for ( var i = 0; i < input.length; i++) {
|
|
||||||
if (input[i].value == "" || parseInt(input[i].value) <= 0) {
|
|
||||||
// input[i].setAttribute("class", "allocation-input-alert");
|
|
||||||
boolean = 1;
|
|
||||||
}
|
|
||||||
// else
|
|
||||||
// input[i].setAttribute("class", "allocation-input");
|
|
||||||
}
|
|
||||||
for ( var k = 0; k < input.length; k++) {
|
|
||||||
if ($(input[k]).attr("class") == "allocation-input")
|
|
||||||
number++;
|
|
||||||
}
|
|
||||||
if (number == input.length)
|
|
||||||
boolean = 0;
|
|
||||||
if (boolean == 1)
|
|
||||||
$("#userConfigMessage").attr("class",
|
|
||||||
"show");
|
|
||||||
else
|
|
||||||
$("#userConfigMessage").attr("class",
|
|
||||||
"hide");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkIP() {
|
|
||||||
|
|
||||||
var input = $("#ipConfig").find("input");
|
|
||||||
var patrn = /^(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])$/;
|
|
||||||
var boolean = 0;
|
|
||||||
var number = 0;
|
|
||||||
for ( var i = 0; i < input.length; i++) {
|
|
||||||
if (input[i].value == "" || patrn.exec(input[i].value) == null) {
|
|
||||||
input[i].setAttribute("class", "ip-input-alert");
|
|
||||||
boolean = 1;
|
|
||||||
} else
|
|
||||||
input[i].setAttribute("class", "ip-input");
|
|
||||||
}
|
|
||||||
for ( var k = 0; k < input.length; k++) {
|
|
||||||
if (input[k].getAttribute("class") == "ip-input")
|
|
||||||
number++;
|
|
||||||
}
|
|
||||||
if (number == input.length)
|
|
||||||
boolean = 0;
|
|
||||||
if (boolean == 1)
|
|
||||||
$("#ipConfigMessage")
|
|
||||||
.attr("class", "show");
|
|
||||||
else
|
|
||||||
$("#ipConfigMessage")
|
|
||||||
.attr("class", "hide");
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkName() {
|
|
||||||
if ($("#testConfigurationName").val() == "") {
|
|
||||||
$("#testConfigurationName").attr("class",
|
|
||||||
"name-input-alert");
|
|
||||||
$("#nameMessage").attr("class", "show");
|
|
||||||
} else {
|
|
||||||
$("#testConfigurationName").attr("class",
|
|
||||||
"name-input");
|
|
||||||
$("#nameMessage").attr("class", "hide");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkAllInpute() {
|
|
||||||
checkLoadConfig();
|
|
||||||
checkUserScenarios();
|
|
||||||
checkIP();
|
|
||||||
checkName();
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadSchedulePlot() {
|
|
||||||
var options = {
|
|
||||||
chart : {
|
|
||||||
renderTo : 'highchartsPlot',
|
|
||||||
defaultSeriesType : 'line',
|
|
||||||
type : 'area',
|
|
||||||
height : 300,
|
|
||||||
|
|
||||||
},
|
|
||||||
plotOptions : {
|
|
||||||
series : {
|
|
||||||
fillOpacity : 0.5,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
credits : {
|
|
||||||
enabled : false
|
|
||||||
},
|
|
||||||
legend : {
|
|
||||||
enabled : false
|
|
||||||
},
|
|
||||||
title : {
|
|
||||||
text : $.i18n.prop('test-loadSchedule') ,
|
|
||||||
x : -50
|
|
||||||
},
|
|
||||||
xAxis : {
|
|
||||||
categories : [ 0 ],
|
|
||||||
min : 0,
|
|
||||||
},
|
|
||||||
yAxis : {
|
|
||||||
plotLines : [ {
|
|
||||||
value : 0,
|
|
||||||
width : 1,
|
|
||||||
color : '#808080'
|
|
||||||
} ],
|
|
||||||
min : 0
|
|
||||||
},
|
|
||||||
tooltip : {
|
|
||||||
formatter : function() {
|
|
||||||
return '<b>' + + '</b><br/>' + this.y
|
|
||||||
+ 'users after' + this.x + 'seconds';
|
|
||||||
}
|
|
||||||
},
|
|
||||||
series : [ {
|
|
||||||
data : [ 0 ]
|
|
||||||
} ]
|
|
||||||
};
|
|
||||||
var RequireLoad = parseInt($("#RequireLoad").val());
|
|
||||||
var WarmUp = parseInt($("#WarmUp").val());
|
|
||||||
var CoolDown = parseInt($("#CoolDown").val());
|
|
||||||
var ExecuteRange = parseInt($("#ExecuteRange").val());
|
|
||||||
options.xAxis.categories.push(WarmUp);
|
|
||||||
options.xAxis.categories.push(WarmUp + ExecuteRange);
|
|
||||||
options.xAxis.categories.push(WarmUp + ExecuteRange + CoolDown);
|
|
||||||
options.series[0].data.push(RequireLoad);
|
|
||||||
options.series[0].data.push(RequireLoad);
|
|
||||||
options.series[0].data.push(0);
|
|
||||||
var chart = new Highcharts.Chart(options);
|
|
||||||
}
|
|
||||||
|
|
||||||
function startTest() {
|
function startTest() {
|
||||||
checkAllInpute();
|
checkAllInpute();
|
||||||
if ($("#nameMessage").attr("class") == "hide"
|
if ($("#nameMessage").attr("class") == "hide"
|
||||||
&& $("#loadConfigMessage").attr(
|
&& $("#loadConfigMessage").attr("class") == "hide"
|
||||||
"class") == "hide"
|
|
||||||
&& $("#alertMessage").attr("class") == "hide"
|
&& $("#alertMessage").attr("class") == "hide"
|
||||||
&& $("#userConfigMessage").attr(
|
&& $("#userConfigMessage").attr("class") == "hide"
|
||||||
"class") == "hide"
|
|
||||||
&& $("#ipConfigMessage").attr("class") == "hide")
|
&& $("#ipConfigMessage").attr("class") == "hide")
|
||||||
start();
|
start();
|
||||||
}
|
}
|
||||||
|
|
||||||
function createNewScript(){
|
|
||||||
window.open("script.jsp");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,171 +0,0 @@
|
||||||
var server = null;
|
|
||||||
var table = $("#scriptTab").DataTable();
|
|
||||||
|
|
||||||
$('.btn-setting').click(function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
$('#myModal').modal('show');
|
|
||||||
});
|
|
||||||
$("#mySecondModal #cancel").click(function() {
|
|
||||||
$('#mySecondModal').modal('hide');
|
|
||||||
});
|
|
||||||
function startServer() {
|
|
||||||
$.post("startRecordServer", {}, function(data) {
|
|
||||||
if (data.success) {
|
|
||||||
server = data.server;
|
|
||||||
$('#myModal').modal('hide');
|
|
||||||
$('#mySecondModal').modal('show');
|
|
||||||
$('#scriptInfo2').text(
|
|
||||||
$.i18n.prop("setProxy")+
|
|
||||||
" IP:133.133.2.100"
|
|
||||||
+ " ,port: " + server.port
|
|
||||||
+ $.i18n.prop("recordScript"));
|
|
||||||
//$('#startServer').attr('disabled', true);
|
|
||||||
//$('#stopServer').attr('disabled', false);
|
|
||||||
} else {
|
|
||||||
$('#scriptInfo').html(
|
|
||||||
$.i18n.prop("startServerFail") + data.failedMessage);
|
|
||||||
}
|
|
||||||
}, "json");
|
|
||||||
}
|
|
||||||
$('#uploadScript')
|
|
||||||
.click(
|
|
||||||
function() {
|
|
||||||
var myModalContent = $('#myModal').html();
|
|
||||||
$(".modal-footer").html("");
|
|
||||||
var uploadForm = '<form method="post" enctype="multipart/form-data" action="uploadScriptFile">'
|
|
||||||
+ '<p>script name:<input class="input-mini" type="text" name="scriptName" ></p>'
|
|
||||||
+ '<p>script to upload: <input type="file" name="scriptFile"/></p>'
|
|
||||||
+ '<p><input type="submit"/></p></form>';
|
|
||||||
var status = "<div id='status'><h3></h3><div>";
|
|
||||||
$('#scriptInfo').html("");
|
|
||||||
$('#scriptInfo').html(uploadForm + status);
|
|
||||||
|
|
||||||
$('form').ajaxForm({
|
|
||||||
success : function(data) {
|
|
||||||
if (data.success) {
|
|
||||||
$("#status").text(data.message);
|
|
||||||
loadScript(table, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
$("#status").text(data.failedMessage);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$('#myModal-close').click(function() {
|
|
||||||
$('#myModal').html(myModalContent);
|
|
||||||
$('#myModal').modal('hide');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
function stopServer() {
|
|
||||||
if (server != null) {
|
|
||||||
$.post("stopRecordServer", {
|
|
||||||
port : server.port,
|
|
||||||
scriptRecordUUID : server.fileName
|
|
||||||
}, function(data) {
|
|
||||||
if (!data.success) {
|
|
||||||
$('#scriptInfo3').text(
|
|
||||||
"stop record server error:" + data.failedMessage);
|
|
||||||
$('#stopServer').attr('disabled', true);
|
|
||||||
$('#startServer').attr('disabled', false);
|
|
||||||
}
|
|
||||||
|
|
||||||
else {
|
|
||||||
$('#stopServer').attr('disabled', false);
|
|
||||||
$('#fileName').show();
|
|
||||||
$('#scriptInfo3').text(
|
|
||||||
$.i18n.prop("stopRecord")
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}, "json");
|
|
||||||
} else {
|
|
||||||
$('#scriptInfo3').text("record script server has not started");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function saveScript() {
|
|
||||||
var scriptName = document.getElementsByName("scriptname")[0].value;
|
|
||||||
$.post("saveScriptRecorded", {
|
|
||||||
scriptName : scriptName,
|
|
||||||
port : server.port,
|
|
||||||
scriptRecordUUID : server.fileName
|
|
||||||
}, function(data) {
|
|
||||||
if (data.success) {
|
|
||||||
$("#scriptInfo3").text($.i18n.prop("saveScriptSuccess"));
|
|
||||||
$('#fileName').hide();
|
|
||||||
server = null;
|
|
||||||
} else {
|
|
||||||
$("#scriptInfo3").text($.i18n.prop("saveScriptFail") + data.failedMessage);
|
|
||||||
$('#fileName').hide();
|
|
||||||
}
|
|
||||||
loadScript(table, 2);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
$(document).ready(function() {
|
|
||||||
addEvent(table);
|
|
||||||
loadScript(table);
|
|
||||||
$('#stopServer').attr('disabled', true);
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
function refresh() {
|
|
||||||
location.replace(location);
|
|
||||||
}
|
|
||||||
|
|
||||||
//add by hemeimei
|
|
||||||
function getScriptPlugins(scriptId) {
|
|
||||||
|
|
||||||
$.post("getScriptPlugins", {
|
|
||||||
scriptId : scriptId
|
|
||||||
}, function(data) {
|
|
||||||
if (!data.success) {
|
|
||||||
information("failed to get script:" + data.failedMessage);
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
data.scriptPlugins;
|
|
||||||
}
|
|
||||||
|
|
||||||
}, "json")
|
|
||||||
}
|
|
||||||
|
|
||||||
function testRecordProxy() {
|
|
||||||
$.post("testRecordProxy", {}, function(data) {
|
|
||||||
if (data.success) {
|
|
||||||
$('#mySecondModal').modal('hide');
|
|
||||||
$('#myThirdModal').modal('show');
|
|
||||||
//server = data.server;
|
|
||||||
$('#scriptInfo3').text(
|
|
||||||
$.i18n.prop("RecordingScript"));
|
|
||||||
//$('#startServer').attr('disabled', true);
|
|
||||||
//$('#stopServer').attr('disabled', true);
|
|
||||||
} else {
|
|
||||||
$('#scriptInfo2').html(
|
|
||||||
$.i18n.prop("ProxySettingError") + data.failedMessage);
|
|
||||||
}
|
|
||||||
}, "json");
|
|
||||||
}
|
|
||||||
|
|
||||||
function startRecording() {
|
|
||||||
if (server != null) {
|
|
||||||
$.post("startRecording", {
|
|
||||||
port : server.port,
|
|
||||||
scriptRecordUUID : server.fileName
|
|
||||||
}, function(data) {
|
|
||||||
if (!data.success) {
|
|
||||||
$('#scriptInfo3').text(
|
|
||||||
"start recording error:" + data.failedMessage);
|
|
||||||
$('#stopServer').attr('disabled', false);
|
|
||||||
$('#startRecording').attr('disabled', true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$('#scriptInfo3').text($.i18n.prop("stopRecord"));
|
|
||||||
var url = $('#target-url').val();
|
|
||||||
window.open(url);
|
|
||||||
$('#stopServer').attr('disabled', false);
|
|
||||||
$('#startRecording').attr('disabled', true);
|
|
||||||
}
|
|
||||||
}, "json");
|
|
||||||
} else {
|
|
||||||
$('#scriptInfo3').text("record script server has not started");
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,376 +0,0 @@
|
||||||
$(document).ready(function() {
|
|
||||||
loadScripts();
|
|
||||||
loadSchedulePlot();
|
|
||||||
loadFilterTypeList();
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#selectFilter #ok").click(function() {
|
|
||||||
$("#selectFilter").hide();
|
|
||||||
// $("#selectFilter #ok").addClass("clicked");
|
|
||||||
// filter=[];
|
|
||||||
});
|
|
||||||
|
|
||||||
function toggleTestExecutionPlan() {
|
|
||||||
$("#loadTestExecutionPlan").slideToggle();
|
|
||||||
$('#loadConfigMessage').attr("class", "hide");
|
|
||||||
if ($("#icon-load").attr("class") == "icon-plus")
|
|
||||||
$("#icon-load").attr("class", "icon-minus");
|
|
||||||
else
|
|
||||||
$("#icon-load").attr("class", "icon-plus");
|
|
||||||
}
|
|
||||||
function toggleUserScenarios() {
|
|
||||||
$("#userScenarios").slideToggle();
|
|
||||||
$('#alertMessage').attr("class", "hide");
|
|
||||||
$('#userConfigMessage').attr("class", "hide");
|
|
||||||
if ($("#icon-user").attr("class") == "icon-plus")
|
|
||||||
$("#icon-user").attr("class", "icon-minus");
|
|
||||||
else
|
|
||||||
$("#icon-user").attr("class", "icon-plus");
|
|
||||||
}
|
|
||||||
function toggleIpConfig() {
|
|
||||||
$("#ipConfig").slideToggle();
|
|
||||||
$('#ipConfigMessage').attr("class", "hide");
|
|
||||||
if ($("#icon-ip").attr("class").indexOf("icon-plus") >= 0)
|
|
||||||
$("#icon-ip").attr("class", "icon-minus");
|
|
||||||
else
|
|
||||||
$("#icon-ip").attr("class", "icon-plus");
|
|
||||||
}
|
|
||||||
|
|
||||||
var scenarioConfigContent;
|
|
||||||
function addScenario() {
|
|
||||||
|
|
||||||
var newTdNode = document.createElement("td");
|
|
||||||
var newINode = document.createElement("i");
|
|
||||||
newINode.setAttribute("class", "icon-trash");
|
|
||||||
|
|
||||||
newINode.setAttribute("style", "cursor:pointer");
|
|
||||||
|
|
||||||
newINode.setAttribute("onClick", "deleteScenarios(this)");
|
|
||||||
newTdNode.appendChild(newINode);
|
|
||||||
var lastInputNodeValue;
|
|
||||||
var lengthBeforAddAction = $("#userConfig").find("input").length;
|
|
||||||
lastInputNodeValue = document.getElementById("userConfig").getElementsByTagName("input")[lengthBeforAddAction - 1].value;
|
|
||||||
if (document.getElementById("userConfig").childNodes.length == 2) {
|
|
||||||
scenarioConfigContent = $("#userConfig").html();
|
|
||||||
document.getElementById("userConfig").innerHTML = $("#userConfig").html()+ scenarioConfigContent;
|
|
||||||
var length = $("#userConfig").find("tr").length;
|
|
||||||
document.getElementById("userConfig").getElementsByTagName("tr")[length - 1].appendChild(newTdNode);
|
|
||||||
} else {
|
|
||||||
document.getElementById("userConfig").innerHTML =$("#userConfig").html()+ scenarioConfigContent;
|
|
||||||
var length = $("#userConfig").find("tr").length;
|
|
||||||
document.getElementById("userConfig").getElementsByTagName("tr")[length - 1].appendChild(newTdNode);
|
|
||||||
}
|
|
||||||
if (lengthBeforAddAction <= 2) {
|
|
||||||
var allocationLess = parseInt(100 / (lengthBeforAddAction + 1));
|
|
||||||
var allocationMore = 100 - parseInt(100 / (lengthBeforAddAction + 1))
|
|
||||||
* lengthBeforAddAction;
|
|
||||||
for ( var i = 0; i < lengthBeforAddAction; i++) {
|
|
||||||
document.getElementById("userConfig").getElementsByTagName("input")[i]
|
|
||||||
.setAttribute("value", allocationLess);
|
|
||||||
}
|
|
||||||
document.getElementById("userConfig").getElementsByTagName("input")[lengthBeforAddAction]
|
|
||||||
.setAttribute("value", allocationMore);
|
|
||||||
} else {
|
|
||||||
var allocationLess = parseInt(lastInputNodeValue / 2);
|
|
||||||
var allocationMore = lastInputNodeValue - allocationLess;
|
|
||||||
document.getElementById("userConfig").getElementsByTagName("input")[lengthBeforAddAction - 1]
|
|
||||||
.setAttribute("value", allocationLess);
|
|
||||||
document.getElementById("userConfig").getElementsByTagName("input")[lengthBeforAddAction]
|
|
||||||
.setAttribute("value", allocationMore);
|
|
||||||
}
|
|
||||||
if ($("#userConfig").find("input").length == 10) {
|
|
||||||
$("#userScenariosButton").attr("class",
|
|
||||||
"btn disabled");
|
|
||||||
$("#userScenariosButton").attr("onClick",
|
|
||||||
"");
|
|
||||||
}
|
|
||||||
changeTotal();
|
|
||||||
checkUserScenarios();
|
|
||||||
}
|
|
||||||
|
|
||||||
function deleteScenarios(selectedNode) {
|
|
||||||
var deleteNode = selectedNode.parentNode.parentNode.parentNode;
|
|
||||||
var Node = deleteNode.parentNode;
|
|
||||||
var previousSiblingNode = deleteNode.previousSibling;
|
|
||||||
Node.removeChild(deleteNode);
|
|
||||||
Node.removeChild(previousSiblingNode);
|
|
||||||
if ($("#userConfig").find("input").length < 10) {
|
|
||||||
$("#userScenariosButton").attr("class",
|
|
||||||
"btn btn-primary");
|
|
||||||
$("#userScenariosButton").attr("onClick",
|
|
||||||
"addScenario()");
|
|
||||||
}
|
|
||||||
changeTotal();
|
|
||||||
checkUserScenarios();
|
|
||||||
}
|
|
||||||
|
|
||||||
function addIP() {
|
|
||||||
var th1 = document.createElement("th");
|
|
||||||
var th2 = document.createElement("th");
|
|
||||||
var th3 = document.createElement("th");
|
|
||||||
var textNode = document.createTextNode("IP:");
|
|
||||||
var inputNode = document.createElement("input");
|
|
||||||
var tr = document.createElement("tr");
|
|
||||||
|
|
||||||
// inputNode.attr({type:"text",class:"ip-input",onblur:"checkIP()"});
|
|
||||||
|
|
||||||
inputNode.setAttribute("type", "text");
|
|
||||||
inputNode.setAttribute("class", "ip-input");
|
|
||||||
inputNode.setAttribute("onblur", "checkIP()");
|
|
||||||
var i = document.createElement("i");
|
|
||||||
i.setAttribute("class", "icon-trash");
|
|
||||||
i.setAttribute("style", "cursor:pointer");
|
|
||||||
i.setAttribute("onClick", "deleteIP(this)");
|
|
||||||
th1.appendChild(textNode);
|
|
||||||
th2.appendChild(inputNode);
|
|
||||||
th3.appendChild(i);
|
|
||||||
tr.appendChild(th1);
|
|
||||||
tr.appendChild(th2);
|
|
||||||
tr.appendChild(th3);
|
|
||||||
document.getElementById("ipConfigTable").appendChild(tr);
|
|
||||||
checkIP();
|
|
||||||
}
|
|
||||||
|
|
||||||
function deleteIP(selectedNode) {
|
|
||||||
var deletedNode = selectedNode.parentNode.parentNode;
|
|
||||||
var parentNode = deletedNode.parentNode;
|
|
||||||
parentNode.removeChild(deletedNode);
|
|
||||||
checkIP();
|
|
||||||
}
|
|
||||||
|
|
||||||
function changeTotal() {
|
|
||||||
var inputNode = $("#userConfig").find(".allocation-input");
|
|
||||||
var total = 0;
|
|
||||||
var length = inputNode.length;
|
|
||||||
for ( var i = 0; i < length; i++) {
|
|
||||||
total = parseInt(total) + parseInt(inputNode[i].value);
|
|
||||||
}
|
|
||||||
document.getElementById("totalNumber").innerHTML = total + "%";
|
|
||||||
checkTotalAllocation();
|
|
||||||
}
|
|
||||||
|
|
||||||
function viewScript(node) {
|
|
||||||
var scriptId;
|
|
||||||
var scriptName;
|
|
||||||
var selectNodes = document.getElementsByName("select");
|
|
||||||
var index = node.parentNode.parentNode.rowIndex - 1;
|
|
||||||
scriptName = selectNodes[index].options[selectNodes[index].selectedIndex].value;
|
|
||||||
scriptId = getScriptId(scriptName);
|
|
||||||
window.open("editScript.jsp?name=" + scriptName + "&scriptId=" + scriptId);
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkTotalAllocation() {
|
|
||||||
if (document.getElementById("totalNumber").childNodes[0].nodeValue == "100%") {
|
|
||||||
$("#totalNumber").attr("class","total-right");
|
|
||||||
$("#alertMessage").attr("class", "hide");
|
|
||||||
} else {
|
|
||||||
$("#totalNumber").attr("class","total-false");
|
|
||||||
$("#alertMessage").attr("class", "show");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkRequireLoad() {
|
|
||||||
if (parseInt($("#RequireLoad").val()) <= 0
|
|
||||||
|| $("#RequireLoad").val() == "")
|
|
||||||
$("#RequireLoad").attr("class",
|
|
||||||
"load-config-input-alert");
|
|
||||||
else
|
|
||||||
$("#RequireLoad").attr("class",
|
|
||||||
"load-config-input");
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkWarmUp() {
|
|
||||||
if (parseInt($("#WarmUp").val()) <= 0
|
|
||||||
|| $("#WarmUp").val() == "")
|
|
||||||
$("#WarmUp").attr("class",
|
|
||||||
"load-config-input-alert");
|
|
||||||
else
|
|
||||||
$("#WarmUp").attr("class",
|
|
||||||
"load-config-input");
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkCoolDown() {
|
|
||||||
if (parseInt($("#CoolDown").val()) <= 0
|
|
||||||
|| $("#CoolDown").val() == "")
|
|
||||||
$("#CoolDown").attr("class",
|
|
||||||
"load-config-input-alert");
|
|
||||||
else
|
|
||||||
$("#CoolDown").attr("class",
|
|
||||||
"load-config-input");
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkExecuteRange() {
|
|
||||||
if (parseInt($("#ExecuteRange").val()) <= 0
|
|
||||||
|| $("#ExecuteRange").val() == "")
|
|
||||||
$("#ExecuteRange").attr("class",
|
|
||||||
"load-config-input-alert");
|
|
||||||
else
|
|
||||||
$("#ExecuteRange").attr("class",
|
|
||||||
"load-config-input");
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkLoadConfig() {
|
|
||||||
checkExecuteRange();
|
|
||||||
checkCoolDown();
|
|
||||||
checkRequireLoad();
|
|
||||||
checkWarmUp();
|
|
||||||
if ($("#ExecuteRange").attr("class") == "load-config-input"
|
|
||||||
&& $("#CoolDown").attr("class") == "load-config-input"
|
|
||||||
&& $("#WarmUp").attr("class") == "load-config-input"
|
|
||||||
&& $("#RequireLoad").attr("class") == "load-config-input")
|
|
||||||
$("#loadConfigMessage").attr("class",
|
|
||||||
"hide");
|
|
||||||
else
|
|
||||||
$("#loadConfigMessage").attr("class",
|
|
||||||
"show");
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkUserScenarios() {
|
|
||||||
var input= $("#userScenarios").find("input");
|
|
||||||
var boolean = 0;
|
|
||||||
var number = 0;
|
|
||||||
for ( var i = 0; i < input.length; i++) {
|
|
||||||
if (input[i].value == "" || parseInt(input[i].value) <= 0) {
|
|
||||||
// input[i].setAttribute("class", "allocation-input-alert");
|
|
||||||
boolean = 1;
|
|
||||||
}
|
|
||||||
// else
|
|
||||||
// input[i].setAttribute("class", "allocation-input");
|
|
||||||
}
|
|
||||||
for ( var k = 0; k < input.length; k++) {
|
|
||||||
if ($(input[k]).attr("class") == "allocation-input")
|
|
||||||
number++;
|
|
||||||
}
|
|
||||||
if (number == input.length)
|
|
||||||
boolean = 0;
|
|
||||||
if (boolean == 1)
|
|
||||||
$("#userConfigMessage").attr("class",
|
|
||||||
"show");
|
|
||||||
else
|
|
||||||
$("#userConfigMessage").attr("class",
|
|
||||||
"hide");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkIP() {
|
|
||||||
|
|
||||||
var input = $("#ipConfig").find("input");
|
|
||||||
var patrn = /^(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])$/;
|
|
||||||
var boolean = 0;
|
|
||||||
var number = 0;
|
|
||||||
for ( var i = 0; i < input.length; i++) {
|
|
||||||
if (input[i].value == "" || patrn.exec(input[i].value) == null) {
|
|
||||||
input[i].setAttribute("class", "ip-input-alert");
|
|
||||||
boolean = 1;
|
|
||||||
} else
|
|
||||||
input[i].setAttribute("class", "ip-input");
|
|
||||||
}
|
|
||||||
for ( var k = 0; k < input.length; k++) {
|
|
||||||
if (input[k].getAttribute("class") == "ip-input")
|
|
||||||
number++;
|
|
||||||
}
|
|
||||||
if (number == input.length)
|
|
||||||
boolean = 0;
|
|
||||||
if (boolean == 1)
|
|
||||||
$("#ipConfigMessage")
|
|
||||||
.attr("class", "show");
|
|
||||||
else
|
|
||||||
$("#ipConfigMessage")
|
|
||||||
.attr("class", "hide");
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkName() {
|
|
||||||
if ($("#testConfigurationName").val() == "") {
|
|
||||||
$("#testConfigurationName").attr("class",
|
|
||||||
"name-input-alert");
|
|
||||||
$("#nameMessage").attr("class", "show");
|
|
||||||
} else {
|
|
||||||
$("#testConfigurationName").attr("class",
|
|
||||||
"name-input");
|
|
||||||
$("#nameMessage").attr("class", "hide");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkAllInpute() {
|
|
||||||
checkLoadConfig();
|
|
||||||
checkUserScenarios();
|
|
||||||
checkIP();
|
|
||||||
checkName();
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadSchedulePlot() {
|
|
||||||
var options = {
|
|
||||||
chart : {
|
|
||||||
renderTo : 'highchartsPlot',
|
|
||||||
defaultSeriesType : 'line',
|
|
||||||
type : 'area',
|
|
||||||
height : 300,
|
|
||||||
|
|
||||||
},
|
|
||||||
plotOptions : {
|
|
||||||
series : {
|
|
||||||
fillOpacity : 0.5,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
credits : {
|
|
||||||
enabled : false
|
|
||||||
},
|
|
||||||
legend : {
|
|
||||||
enabled : false
|
|
||||||
},
|
|
||||||
title : {
|
|
||||||
text : $.i18n.prop('test-loadSchedule') ,
|
|
||||||
x : -50
|
|
||||||
},
|
|
||||||
xAxis : {
|
|
||||||
categories : [ 0 ],
|
|
||||||
min : 0,
|
|
||||||
},
|
|
||||||
yAxis : {
|
|
||||||
plotLines : [ {
|
|
||||||
value : 0,
|
|
||||||
width : 1,
|
|
||||||
color : '#808080'
|
|
||||||
} ],
|
|
||||||
min : 0
|
|
||||||
},
|
|
||||||
tooltip : {
|
|
||||||
formatter : function() {
|
|
||||||
return '<b>' + + '</b><br/>' + this.y
|
|
||||||
+ 'users after' + this.x + 'seconds';
|
|
||||||
}
|
|
||||||
},
|
|
||||||
series : [ {
|
|
||||||
data : [ 0 ]
|
|
||||||
} ]
|
|
||||||
};
|
|
||||||
var RequireLoad = parseInt($("#RequireLoad").val());
|
|
||||||
var WarmUp = parseInt($("#WarmUp").val());
|
|
||||||
var CoolDown = parseInt($("#CoolDown").val());
|
|
||||||
var ExecuteRange = parseInt($("#ExecuteRange").val());
|
|
||||||
options.xAxis.categories.push(WarmUp);
|
|
||||||
options.xAxis.categories.push(WarmUp + ExecuteRange);
|
|
||||||
options.xAxis.categories.push(WarmUp + ExecuteRange + CoolDown);
|
|
||||||
options.series[0].data.push(RequireLoad);
|
|
||||||
options.series[0].data.push(RequireLoad);
|
|
||||||
options.series[0].data.push(0);
|
|
||||||
var chart = new Highcharts.Chart(options);
|
|
||||||
}
|
|
||||||
|
|
||||||
function startTest() {
|
|
||||||
checkAllInpute();
|
|
||||||
if ($("#nameMessage").attr("class") == "hide"
|
|
||||||
&& $("#loadConfigMessage").attr(
|
|
||||||
"class") == "hide"
|
|
||||||
&& $("#alertMessage").attr("class") == "hide"
|
|
||||||
&& $("#userConfigMessage").attr(
|
|
||||||
"class") == "hide"
|
|
||||||
&& $("#ipConfigMessage").attr("class") == "hide")
|
|
||||||
start();
|
|
||||||
}
|
|
||||||
|
|
||||||
function createNewScript(){
|
|
||||||
window.open("script.jsp");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -25,10 +25,10 @@ body {
|
||||||
padding: 9px 0;
|
padding: 9px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal{
|
.modal {
|
||||||
position:absolute;
|
position: absolute;
|
||||||
left:617px;
|
left: 617px;
|
||||||
top:850px
|
top: 850px
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<link href="lib/chrisma/css/charisma-app.css" rel="stylesheet">
|
<link href="lib/chrisma/css/charisma-app.css" rel="stylesheet">
|
||||||
|
@ -74,9 +74,8 @@ body {
|
||||||
</div>
|
</div>
|
||||||
<!--box content-->
|
<!--box content-->
|
||||||
|
|
||||||
<div class="title-frame">
|
<div class="title-frame" onClick="toggleTestExecutionPlan()">
|
||||||
<a href="#"><i class="icon-minus" id="icon-load"
|
<i class="icon-minus" id="icon-load"></i>
|
||||||
onClick="toggleTestExecutionPlan()"></i></a>
|
|
||||||
<p class="title">
|
<p class="title">
|
||||||
<fmt:message key="testPlanConfig" />
|
<fmt:message key="testPlanConfig" />
|
||||||
</p>
|
</p>
|
||||||
|
@ -127,9 +126,8 @@ body {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="title-frame">
|
<div class="title-frame" onClick="toggleUserScenarios()">
|
||||||
<a href="#"><i class="icon-minus" id="icon-user"
|
<i class="icon-minus" id="icon-user"></i>
|
||||||
onClick="toggleUserScenarios()"></i></a>
|
|
||||||
<p class="title">
|
<p class="title">
|
||||||
<fmt:message key="script" />
|
<fmt:message key="script" />
|
||||||
</p>
|
</p>
|
||||||
|
@ -163,54 +161,53 @@ body {
|
||||||
</table>
|
</table>
|
||||||
<div id="alertMessage" class="hide">The total allocation
|
<div id="alertMessage" class="hide">The total allocation
|
||||||
needs to be 100%</div>
|
needs to be 100%</div>
|
||||||
<button type="submit" class="btn btn-primary"
|
<button type="submit" class="btn btn-primary"
|
||||||
id="userScenariosButton"
|
id="userScenariosButton"
|
||||||
onClick="addScenario();checkUserScenarios()">
|
onClick="addScenario();checkUserScenarios()">
|
||||||
<fmt:message key="addScript" />
|
<fmt:message key="addScript" />
|
||||||
</button>
|
</button>
|
||||||
<button type="submit" class="btn btn-primary" id="createNewScript"
|
<button type="submit" class="btn btn-primary" id="createNewScript"
|
||||||
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">
|
<button type="submit" class="btn btn-primary" id="createFilter">
|
||||||
<fmt:message key="plugin_jsp_filter" />
|
<fmt:message key="plugin_jsp_filter" />
|
||||||
</button>
|
</button>
|
||||||
<div class="modal hide" id="selectFilter">
|
<div class="modal hide" id="selectFilter">
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<div class="inset scroll" id="filterList"></div>
|
<div class="inset scroll" id="filterList"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-primary btn-width" id="ok">
|
<button type="button" class="btn btn-primary btn-width" id="ok">
|
||||||
<fmt:message key="plugin_jsp_finish" />
|
<fmt:message key="plugin_jsp_finish" />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div id="userConfigMessage" class="hide">all input can not
|
|
||||||
be empty and must be greater than zero!</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div id="userConfigMessage" class="hide">all input can not
|
||||||
|
be empty and must be greater than zero!</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="title-frame">
|
<div class="title-frame" onClick="toggleIpConfig()">
|
||||||
<a href="#"><i class="icon-plus float-left" id="icon-ip"
|
<i class="icon-plus float-left" id="icon-ip"></i>
|
||||||
onClick="toggleIpConfig()"></i></a>
|
<p class="title">
|
||||||
<p class="title">
|
<fmt:message key="sutIp" />
|
||||||
<fmt:message key="sutIp" />
|
</p>
|
||||||
</p>
|
</div>
|
||||||
</div>
|
<div id="ipConfig" class="content-frame hide">
|
||||||
<div id="ipConfig" class="content-frame hide">
|
<table id="ipConfigTable" class="table-margin-top"></table>
|
||||||
<table id="ipConfigTable" class="table-margin-top"></table>
|
<button type="submit" class="btn btn-primary add-button"
|
||||||
<button type="submit" class="btn btn-primary add-button"
|
onClick="addIP();checkIP()">
|
||||||
onClick="addIP();checkIP()">
|
<fmt:message key="addIp" />
|
||||||
<fmt:message key="addIp" />
|
</button>
|
||||||
</button>
|
<div id="ipConfigMessage" class="hide">
|
||||||
<div id="ipConfigMessage" class="hide">
|
<fmt:message key="test-iptip" />
|
||||||
<fmt:message key="test-iptip" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="span12 center">
|
|
||||||
<button class="btn btn-large btn-primary" onClick="startTest()">
|
|
||||||
<fmt:message key="startTest" />
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="span12 center">
|
||||||
|
<button class="btn btn-large btn-primary" onClick="startTest()">
|
||||||
|
<fmt:message key="startTest" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
|
|
Loading…
Reference in New Issue