This commit is contained in:
hmm 2014-08-27 08:38:43 +08:00
commit 56a302cb4d
8 changed files with 62 additions and 30 deletions

View File

@ -7,7 +7,7 @@
</plugin> </plugin>
<behavior name="Get"> <behavior name="Get">
<params> <params>
<param name="url" label="The Url to request" required="true"> <param name="url" label="The Url to request!!!!!!" required="true">
<field size="7" /> <field size="7" />
</param> </param>
<param name="queryParams" label="The query params of this request" required="false"> <param name="queryParams" label="The query params of this request" required="false">
@ -31,11 +31,12 @@
<param name="queryParams" label="The query params of this request" required="false"> <param name="queryParams" label="The query params of this request" required="false">
<nfield /> <nfield />
</param> </param>
<param name="headers" label="The headers of this request"> <param name="headers" label="The headers of this request" required="false">
<table cols="header|value" /> <table cols="header|value" />
</param> </param>
<param name="respVarsToSaveInSession" <param name="respVarsToSaveInSession"
label="The regular expression of extracting variables from response"> label="The regular expression of extracting variables from response"
required="false">
<table cols="varName|varRegularExpression|leftBoundry|rightBoundry" /> <table cols="varName|varRegularExpression|leftBoundry|rightBoundry" />
</param> </param>
</params> </params>
@ -48,7 +49,7 @@
<param name="queryParams" label="The query params of this request" required="false"> <param name="queryParams" label="The query params of this request" required="false">
<nfield /> <nfield />
</param> </param>
<param name="headers" label="The headers of this request"> <param name="headers" label="The headers of this request" required="false">
<table cols="header|value" /> <table cols="header|value" />
</param> </param>
<param name="bodyContent" label="The body that will be post" required="false"> <param name="bodyContent" label="The body that will be post" required="false">
@ -58,7 +59,8 @@
<nfield /> <nfield />
</param> </param>
<param name="respVarsToSaveInSession" <param name="respVarsToSaveInSession"
label="The regular expression of extracting variables from response"> label="The regular expression of extracting variables from response"
required="false">
<table cols="varName|varRegularExpression|leftBoundry|rightBoundry" /> <table cols="varName|varRegularExpression|leftBoundry|rightBoundry" />
</param> </param>
</params> </params>
@ -71,7 +73,7 @@
<param name="queryParams" label="The query params of this request" required="false"> <param name="queryParams" label="The query params of this request" required="false">
<nfield /> <nfield />
</param> </param>
<param name="headers" label="The headers of this request"> <param name="headers" label="The headers of this request" required="false">
<table cols="header|value" /> <table cols="header|value" />
</param> </param>
<param name="bodyContent" label="The body that will be put" required="false"> <param name="bodyContent" label="The body that will be put" required="false">
@ -81,7 +83,8 @@
<nfield /> <nfield />
</param> </param>
<param name="respVarsToSaveInSession" <param name="respVarsToSaveInSession"
label="The regular expression of extracting variables from response"> label="The regular expression of extracting variables from response"
required="false">
<table cols="varName|varRegularExpression|leftBoundry|rightBoundry" /> <table cols="varName|varRegularExpression|leftBoundry|rightBoundry" />
</param> </param>
</params> </params>

View File

@ -19,6 +19,7 @@ public class ParamInfo {
private int id; private int id;
private String name; private String name;
private String lable; private String lable;
private String required;
private ParamType paramType; private ParamType paramType;
private ParamsContainer paramsContainer; private ParamsContainer paramsContainer;
@ -51,6 +52,15 @@ public class ParamInfo {
this.lable = lable; this.lable = lable;
} }
@Column(name = "required")
public String getRequired() {
return required;
}
public void setRequired(String required) {
this.required = required;
}
@OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER) @OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
@JoinColumn(name = "typeId", nullable = false) @JoinColumn(name = "typeId", nullable = false)
public ParamType getParamType() { public ParamType getParamType() {

View File

@ -165,6 +165,8 @@ public class PluginEntityFactory {
ParamInfo paramInfo = new ParamInfo(); ParamInfo paramInfo = new ParamInfo();
paramInfo.setLable(XmlParseHelper.getAttribute(paramElement, "label")); paramInfo.setLable(XmlParseHelper.getAttribute(paramElement, "label"));
paramInfo.setName(XmlParseHelper.getAttribute(paramElement, "name")); paramInfo.setName(XmlParseHelper.getAttribute(paramElement, "name"));
paramInfo.setRequired(XmlParseHelper.getAttribute(paramElement,
"required"));
paramInfo.setParamType(ParamTypeFactory paramInfo.setParamType(ParamTypeFactory
.createParamTypeInfo(XmlParseHelper .createParamTypeInfo(XmlParseHelper
.getSingleChild(paramElement))); .getSingleChild(paramElement)));

View File

@ -95,6 +95,11 @@
margin-bottom:5px margin-bottom:5px
} }
.testHeader .span-brief .value{
color:#317eac;
font-size:19px
}
.testHeader .span-brief h4{ .testHeader .span-brief h4{
font-size:23px font-size:23px
} }

View File

@ -46,15 +46,15 @@ body {
<div class="row-fluid testHeader testHeader-top"> <div class="row-fluid testHeader testHeader-top">
<div class="span4 span-brief"> <div class="span4 span-brief">
<h6><fmt:message key="testPlanName" /></h6><br> <h6><fmt:message key="testPlanName" /></h6><br>
<div id="testplanName"></div> <div class="value" id="testplanName"></div>
</div> </div>
<div class="span4 span-brief"> <div class="span4 span-brief">
<h6><fmt:message key="createdatetime" /></h6><br> <h6><fmt:message key="createdatetime" /></h6><br>
<div id="createTime"></div> <div class="value" id="createTime"></div>
</div> </div>
<div class="span4 span-brief"> <div class="span4 span-brief">
<h6><fmt:message key="testExecuteTime" /></h6><br> <h6><fmt:message key="testExecuteTime" /></h6><br>
<div id="testTime"></div> <div class="value" id="testTime"></div>
</div> </div>
<%-- </div> <%-- </div>
<div class="span4 span-brief"> <div class="span4 span-brief">

View File

@ -22,9 +22,9 @@ ContainerFactory.prototype.createEditorContainer = function(header, id,
containerInfo[i].name == ""; containerInfo[i].name == "";
} }
if (containerInfo[i].children == null) { if (containerInfo[i].children == null) {
console.log(containerInfo[i]);
this.appendEdtiors(container, containerInfo[i].label, this.appendEdtiors(container, containerInfo[i].label,
containerInfo[i].nameCN, containerInfo[i].name, containerInfo[i].nameCN, containerInfo[i].required, containerInfo[i].name,
containerInfo[i].paramTypeModel,containerInfo[i].value == null ?"":containerInfo[i].value); containerInfo[i].paramTypeModel,containerInfo[i].value == null ?"":containerInfo[i].value);
} else { } else {
$(container).append( $(container).append(
@ -39,29 +39,30 @@ ContainerFactory.prototype.createEditorContainer = function(header, id,
}; };
ContainerFactory.prototype.appendEdtiors = function(container, label, name, id, ContainerFactory.prototype.appendEdtiors = function(container, label, name, required, id,
editorInfo, value) { editorInfo, value) {
var editorFactory = new EditorFactory(); var editorFactory = new EditorFactory();
if (editorInfo.type.toLowerCase() == "field") { if (editorInfo.type.toLowerCase() == "field") {
console.log("required:"+required);
$(container).append( $(container).append(
editorFactory.createField(label, name, editorInfo.size, id,value)); editorFactory.createField(label, name, required, editorInfo.size, id,value));
} else if (editorInfo.type.toLowerCase() == "nfield") { } else if (editorInfo.type.toLowerCase() == "nfield") {
$(container).append( $(container).append(
editorFactory editorFactory
.createMultiField(label, name, editorInfo.size, id,value)); .createMultiField(label, name, required, editorInfo.size, id,value));
} else if (editorInfo.type.toLowerCase() == "table") { } else if (editorInfo.type.toLowerCase() == "table") {
$(container).append( $(container).append(
editorFactory.createTable(label, name, editorInfo.cols, id,value)); editorFactory.createTable(label, name, required, editorInfo.cols, id,value));
} else if (editorInfo.type.toLowerCase() == "file") { } else if (editorInfo.type.toLowerCase() == "file") {
$(container).append( $(container).append(
editorFactory.createFile(lable, name, editorInfo.size, id,value)); editorFactory.createFile(lable, name, required, editorInfo.size, id,value));
} else if (editorInfo.type.toLowerCase() == "date") { } else if (editorInfo.type.toLowerCase() == "date") {
$(container).append( $(container).append(
editorFactory.createDate(label, name, editorInfo.size, id,value)); editorFactory.createDate(label, name, required, editorInfo.size, id,value));
} else if (editorInfo.type.toLowerCase() == "select") { } else if (editorInfo.type.toLowerCase() == "select") {
$(container).append( $(container).append(
editorFactory.createSelect(label, name, editorInfo.size, editorFactory.createSelect(label, name, editorInfo.size,

View File

@ -1,6 +1,5 @@
$(document).ready(function(){ $(document).ready(function(){
$("#behaviorEditor").on("focusout",".editor input",function(){ $("#behaviorEditor").on("focusout",".editor input",function(){
console.log(this); console.log(this);
alert("This input field has lost its focus.");
}) })
}); });

View File

@ -50,14 +50,14 @@ EditorFactory.prototype.createChoice = function(value, defaultValue, name,
return div; return div;
} }
EditorFactory.prototype.createField = function(label, name, size, id, value) { EditorFactory.prototype.createField = function(label, name, required, size, id, value) {
var div = this.createBaseEditor(label, id); var div = this.createBaseEditor(label, id);
$(div).children(".editor").attr("editorType", "field"); $(div).children(".editor").attr("editorType", "field");
$(div).children(".editor").append(this.createFieldLine(size, name, value)); $(div).children(".editor").append(this.createFieldLine(size, name, required, value));
return div; return div;
} }
EditorFactory.prototype.createMultiField = function(label, name, size, id, EditorFactory.prototype.createMultiField = function(label, name, required, size, id,
value) { value) {
var div = this.createBaseEditor(label, id); var div = this.createBaseEditor(label, id);
$(div).children(".editor").attr("editorType", "multiField"); $(div).children(".editor").attr("editorType", "multiField");
@ -65,7 +65,7 @@ EditorFactory.prototype.createMultiField = function(label, name, size, id,
var values = value.split(";"); var values = value.split(";");
for (var i = 0; i < values.length; i++) { for (var i = 0; i < values.length; i++) {
$(div).children(".editor").append( $(div).children(".editor").append(
this.createFieldLine(size, name, values[i])); this.createFieldLine(size, name, required, values[i]));
} }
} }
@ -94,19 +94,22 @@ EditorFactory.prototype.createMultiField = function(label, name, size, id,
return div; return div;
} }
EditorFactory.prototype.createFieldLine = function(size, name, value) { EditorFactory.prototype.createFieldLine = function(size, name, required, value) {
var fieldDiv = document.createElement("div"); var fieldDiv = document.createElement("div");
$(fieldDiv).addClass("field"); $(fieldDiv).addClass("field");
var fieldName = document.createElement("label"); var fieldName = document.createElement("label");
$(fieldName).html(name); $(fieldName).html(name);
var field = document.createElement("input"); var field = document.createElement("input");
$(field).attr("type", "text"); $(field).attr("type", "text");
if(required=="true"){
$(field).attr("required", "required");
}
// $(field).attr("maxlength", size); // $(field).attr("maxlength", size);
$(field).attr("value", value); $(field).attr("value", value);
$(fieldDiv).append(fieldName.outerHTML + field.outerHTML); $(fieldDiv).append(fieldName.outerHTML + field.outerHTML);
return fieldDiv; return fieldDiv;
} }
EditorFactory.prototype.createFile = function(label, name, size, id, value) { EditorFactory.prototype.createFile = function(label, name, required, size, id, value) {
if (size == null || size <= 0) { if (size == null || size <= 0) {
size = 150; size = 150;
} }
@ -119,6 +122,9 @@ EditorFactory.prototype.createFile = function(label, name, size, id, value) {
$(fieldName).html(name); $(fieldName).html(name);
var file = document.createElement("input"); var file = document.createElement("input");
$(file).attr("type", "file"); $(file).attr("type", "file");
if(required == "true"){
$(field).attr("required", "required");
}
// $(field).attr("maxlength", size); // $(field).attr("maxlength", size);
$(fileEditor).append(fieldName.outerHTML + file.outerHTML); $(fileEditor).append(fieldName.outerHTML + file.outerHTML);
$(div).children(".editor").append(fileEditor); $(div).children(".editor").append(fileEditor);
@ -134,7 +140,7 @@ EditorFactory.prototype.createTable = /**
* @param value * @param value
* @returns * @returns
*/ */
function(label, name, cols, id, value) { function(label, name, required, cols, id, value) {
var div = this.createBaseEditor(label, id); var div = this.createBaseEditor(label, id);
$(div).children(".editor").attr("editorType", "table"); $(div).children(".editor").attr("editorType", "table");
@ -152,7 +158,7 @@ function(label, name, cols, id, value) {
function(event) { function(event) {
event.preventDefault(); event.preventDefault();
$(this).parent().children("table").children("tbody").append( $(this).parent().children("table").children("tbody").append(
createTr(event.data.headers, event.data.fieldName)); createTr(event.data.headers, event.data.fieldName, required));
}); });
var deleteButton = document.createElement("button"); var deleteButton = document.createElement("button");
$(deleteButton).html("remove"); $(deleteButton).html("remove");
@ -188,7 +194,7 @@ function(label, name, cols, id, value) {
var tbody = document.createElement("tbody"); var tbody = document.createElement("tbody");
$(thead).append(createHeader(headers)); $(thead).append(createHeader(headers));
for (var i = 0; i < values.length; i++) {//this minus one because there is a "|;" in the end of value string for (var i = 0; i < values.length; i++) {//this minus one because there is a "|;" in the end of value string
$(tbody).append(createTr(headers, name, values[i])); $(tbody).append(createTr(headers, name, required, values[i]));
} }
$(table).append(thead); $(table).append(thead);
@ -208,7 +214,7 @@ function(label, name, cols, id, value) {
} }
return tr; return tr;
} }
function createTr(headers, name, value) { function createTr(headers, name, required, value) {
value == null? value="":value; value == null? value="":value;
var values = value.split("|"); var values = value.split("|");
var tr = document.createElement("tr"); var tr = document.createElement("tr");
@ -220,6 +226,9 @@ function(label, name, cols, id, value) {
var input = document.createElement("input"); var input = document.createElement("input");
$(input).attr("type", "text"); $(input).attr("type", "text");
$(input).attr("style","width:"+"90%"); $(input).attr("style","width:"+"90%");
if(required == "true"){
$(field).attr("required", "required");
}
if(values[i] != undefined){ if(values[i] != undefined){
$(input).val(values[i].split("=")[1]); $(input).val(values[i].split("=")[1]);
} }
@ -259,7 +268,7 @@ EditorFactory.prototype.createSelect = function(label, name, size, options, id,
$(div).children(".editor").append(select); $(div).children(".editor").append(select);
return div; return div;
} }
EditorFactory.prototype.createDate = function(label, name, size, id, value) { EditorFactory.prototype.createDate = function(label, name, required, size, id, value) {
if (size == null || size < 0) { if (size == null || size < 0) {
size = 150 size = 150
@ -270,6 +279,9 @@ EditorFactory.prototype.createDate = function(label, name, size, id, value) {
$(dateLabel).html(name); $(dateLabel).html(name);
var date = document.createElement("input"); var date = document.createElement("input");
$(date).attr("type", "date"); $(date).attr("type", "date");
if(required == "true"){
$(field).attr("required", "required");
}
$(div).children(".editor").append(dateLabel); $(div).children(".editor").append(dateLabel);
$(div).children(".editor").append(date); $(div).children(".editor").append(date);
return div; return div;