add test proxy server api

This commit is contained in:
hmm 2014-08-27 08:36:20 +08:00
parent 3ffc68d3e4
commit 69d6b8b23f
3 changed files with 23 additions and 8 deletions

View File

@ -21,9 +21,11 @@ import org.bench4q.web.masterMessager.ScriptMessager;
import org.bench4q.web.model.ScenarioModel;
import org.bench4q.web.service.ScriptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
@ -101,7 +103,6 @@ public class ScriptController extends BaseController {
if (operateScriptServerResponseModel.isSuccess()) {
ScriptModel scriptModel = operateScriptServerResponseModel
.getScriptModels().get(0);
System.out.println(scriptModel.getScriptContent());
RunScenarioModel runScenarioModel = (RunScenarioModel) MarshalHelper
.tryUnmarshal(RunScenarioModel.class,
scriptModel.getScriptContent());
@ -132,7 +133,6 @@ public class ScriptController extends BaseController {
if (operateScriptServerResponseModel.isSuccess()) {
ScriptModel scriptModel = operateScriptServerResponseModel
.getScriptModels().get(0);
System.out.println(scriptModel.getScriptContent());
RunScenarioModel runScenarioModel = (RunScenarioModel) MarshalHelper
.tryUnmarshal(RunScenarioModel.class,
scriptModel.getScriptContent());
@ -252,7 +252,6 @@ public class ScriptController extends BaseController {
Gson gson = new Gson();
RunScenarioModel runScenarioModel = gson.fromJson(runScenarioModelStr,
RunScenarioModel.class);
System.out.println(MarshalHelper.tryMarshal(runScenarioModel));
return processScriptResponse(
map,
this.getScriptMessager().updateScript(accessToken, scriptId,
@ -289,6 +288,22 @@ public class ScriptController extends BaseController {
this.getScriptMessager().stopScriptRecordServer(accessToken,
port, scriptRecordUUID));
}
@RequestMapping("testRecordProxy")
@ResponseBody
public Map<String, Object> testRecordProxy(
@RequestHeader HttpHeaders headers) {
Map<String,Object> map = new HashMap<String,Object>();
//is from proxy
boolean isFromProxy = Boolean.parseBoolean(headers.getFirst("FromProxy"));
if(isFromProxy)
{
success(map);
}else{
fail(map,"proxy setting error!");
}
return map ;
}
@RequestMapping("saveScriptRecorded")
@ResponseBody

View File

@ -1 +1 @@
masterAddress=133.133.2.100:8901
masterAddress=localhost:8901

View File

@ -65,7 +65,7 @@ DataCollector.prototype.multiFieldData = function(editor) {
};
DataCollector.prototype.tableData = function(editor) {
var thArray = editor.find("thead").children("tr")[0].children("th");
var thArray = editor.find("thead").children("tr").children("th");
var editorArray = editor.find("tbody").children("tr");
var name = editor.attr("id");
var value = "";
@ -77,14 +77,14 @@ DataCollector.prototype.tableData = function(editor) {
|| $(tdArray[j]).children("input").val() == "") {
continue;
}
trValue += thArray[j] + "=" + $(tdArray[j]).children("input").val()
trValue += thArray[j].innerText + "=" + $(tdArray[j]).children("input").val()
+ "|";
}
trValue = trValue.substring(0, trValue.length - 1);
value += trValue + ";";
value += trValue + "|;";
}
value = value.substring(0, value.length - 1);
value = value.substring(0, value.length - 2);
// if (!this.validate(value)) {
// return false;
// }