fix the param label bug

This commit is contained in:
fanfuxiaoran 2014-06-10 14:03:24 +08:00
parent a0e32473fa
commit e50013404d
7 changed files with 35 additions and 21 deletions

View File

@ -5,6 +5,7 @@ import java.util.List;
import javax.xml.bind.JAXBException;
import org.bench4q.share.helper.MarshalHelper;
import org.bench4q.share.models.master.MonitorModel;
import org.bench4q.share.models.master.RunningScriptModel;
import org.bench4q.share.models.master.TestPlanModel;

View File

@ -4,11 +4,15 @@ import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import javax.xml.bind.JAXBException;
import org.bench4q.share.helper.ExceptionLog;
import org.bench4q.share.helper.MarshalHelper;
import org.bench4q.share.models.agent.RunScenarioModel;
import org.bench4q.share.models.master.OperateScriptServerResponseModel;
import org.bench4q.share.models.master.ScriptModel;
import org.bench4q.web.masterMessager.ScriptMessager;
import org.bench4q.web.model.ScenarioModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
@ -98,8 +102,15 @@ public class ScriptController extends BaseController {
@ModelAttribute("accessToken") String accessToken,
@RequestParam String scriptName,
@RequestParam MultipartFile scriptFile) throws IOException {
String script = new String(scriptFile.getBytes());
Map<String, Object> map = new HashMap<String, Object>();
String script = new String(scriptFile.getBytes());
try {
MarshalHelper.unmarshal(ScenarioModel.class, script);
} catch (JAXBException e) {
ExceptionLog.getStackTrace(e);
return fail(map, "error script file");
}
OperateScriptServerResponseModel operateScriptServerResponseModel = this
.getScriptMessager().uploadScriptFile(accessToken, scriptName,
script);

View File

@ -10,6 +10,7 @@ import java.util.Set;
import javax.xml.bind.JAXBException;
import org.bench4q.share.helper.MarshalHelper;
import org.bench4q.share.models.agent.BehaviorStatusCodeResultModel;
import org.bench4q.share.models.master.MonitorModel;
import org.bench4q.share.models.master.ScriptModel;
@ -113,11 +114,12 @@ public class TestPlanActionController {
@RequestBody TestPlanRequestModel testPlanRequestModel)
throws CustomGenericException {
String caller = this.BASECALLER + "runTestPlan";
if (this.getTestPlanService().isValidateTestRunModel(
if (!this.getTestPlanService().isValidateTestRunModel(
testPlanRequestModel)) {
throw new CustomGenericException("0",
"run testplan request model is invalidate", caller);
}
System.out.println(MarshalHelper.tryMarshal(testPlanRequestModel));
TestPlanResultModel testPlanResultModel = this.getRunTestPlan()
.runTestPlan(accessToken, testPlanRequestModel, model);
return new BaseResponseModel(true, (Object) testPlanResultModel);

View File

@ -135,26 +135,26 @@ public class TestPlanService extends BaseService {
if (testPlanRequestModel.getScriptList() == null
|| testPlanRequestModel.getScriptList().size() == 0)
return true;
return false;
if (testPlanRequestModel.getTestPlanName() == null
|| testPlanRequestModel.getTestPlanName().equals(""))
testPlanRequestModel.setTestPlanName("default");
for (WebScriptModel scriptModel : testPlanRequestModel.getScriptList()) {
if (isValidateScriptModel(scriptModel))
return true;
if (!isValidateScriptModel(scriptModel))
return false;
}
return false;
return true;
}
private boolean isValidateScriptModel(WebScriptModel scriptModel) {
if (scriptModel.getId() == 0)
return true;
if (scriptModel.getLoad() == 0)
return true;
if (scriptModel.getExecuteRange() == 0)
return true;
return false;
if (scriptModel.getLoad() == 0)
return false;
if (scriptModel.getExecuteRange() == 0)
return false;
return true;
}
public Map<String, Double> getUrlContentTypePercent(

View File

@ -9,34 +9,34 @@ function createPluginsOrBehaviorsForm(data, behaviorIndex) {
for (var j = 0; j < paramInfoList.length; j++) {
var paramTypeModel = paramInfoList[j].paramTypeModel;
var methodParamModel = new ParamInfoModel(paramInfoList[j].name,
paramInfoList[j].lable, paramTypeModel);
paramInfoList[j].label, paramTypeModel);
var type = paramTypeModel.type;
if (type == "field") {
var size = paramTypeModel.size;
var text = paramTypeModel.text;
fieldHTML += createField(methodParamModel.lable,
fieldHTML += createField(methodParamModel.label,
methodParamModel.name, size, text, behaviorIndex);
} else if (type == "nfield") {
var size = paramTypeModel.size;
var text = paramTypeModel.text;
fieldHTML += createMultiField(methodParamModel.lable,
fieldHTML += createMultiField(methodParamModel.label,
methodParamModel.name, size, text, nfieldCount);
nfieldCount++;
} else if (type == "table") {
var cols = paramTypeModel.cols;
fieldHTML += createTable(methodParamModel.lable,
fieldHTML += createTable(methodParamModel.label,
methodParamModel.name, cols, null, behaviorIndex);
} else if (type == "checkBox") {
var rows = paramTypeModel.choiceModels;
fieldHTML += createCheckBox(methodParamModel.lable,
fieldHTML += createCheckBox(methodParamModel.label,
methodParamModel.name, rows, null, behaviorIndex);
} else if (type == "radioButton") {
var rows = paramTypeModel.choiceModels;// List<ChoiceModel>
fieldHTML += createRadioButton(methodParamModel.lable,
fieldHTML += createRadioButton(methodParamModel.label,
methodParamModel.name, rows, null, behaviorIndex);
} else if (type == "file") {
var text = paramTypeModel.text;
fieldHTML += createFile(methodParamModel.lable,
fieldHTML += createFile(methodParamModel.label,
methodParamModel.name, text, behaviorIndex);
}
}

View File

@ -5,9 +5,9 @@ function BehaviorInfoModel(paramInfoModels,behaviorType,name){
this.name=name;
}
function ParamInfoModel(name,lable,paramTypeModel){
function ParamInfoModel(name,label,paramTypeModel){
this.name=name;
this.lable=lable;
this.label=label;
this.paramTypeModel=paramTypeModel;
}

View File

@ -167,9 +167,9 @@ function getScriptId(scriptName) {
$.ajaxSetup({
async : false
});
$.post("loadScript", {}, function(data) {
$.post("loadScripts", {}, function(data) {
if (data.success) {
data = data.data;
data = data.scripts;
for ( var i = 0; i < data.length; i++) {
if (data[i].name == scriptName) {
scriptId = data[i].id;