refactor the plugin manange :now add plugin ui of xml is able
This commit is contained in:
parent
b78fee3924
commit
60726bfe3b
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<ui>
|
||||
<behaviorInfos>
|
||||
<behaviorInfos>
|
||||
<name>reset</name>
|
||||
</behaviorInfos>
|
||||
<behaviorInfos>
|
||||
<name>next</name>
|
||||
</behaviorInfos>
|
||||
</behaviorInfos>
|
||||
<name>CsvProvider</name>
|
||||
<params>
|
||||
<param>
|
||||
<lable>The name of the input file(Required)</lable>
|
||||
<name>fileName</name>
|
||||
</param>
|
||||
</params>
|
||||
</ui>
|
|
@ -0,0 +1,42 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- <!DOCTYPE ui SYSTEM "ui.dtd"> -->
|
||||
<ui>
|
||||
<plugin name="test">
|
||||
<params>
|
||||
<param name="fileName" label="The name of the input file(Required)">
|
||||
<field size="7" />
|
||||
</param>
|
||||
<param name="separator"
|
||||
label="The separator of the input file and the following fieldNames">
|
||||
<field size="7" />
|
||||
</param>
|
||||
<param name="fieldNames" label="fields names:">
|
||||
<nfield />
|
||||
</param>
|
||||
<param name="shared" label="to share the file descriptor">
|
||||
<checkbox>
|
||||
<choice value="enable" default="false" />
|
||||
</checkbox>
|
||||
</param>
|
||||
<param name="loop" label="when to the EOF, is in loop">
|
||||
<checkbox>
|
||||
<choice value="enable" default="true" />
|
||||
</checkbox>
|
||||
</param>
|
||||
<param name="loadAtRuntime" label="is to load it at runtime">
|
||||
<checkbox>
|
||||
<choice value="loadAtRuntime" default="true" />
|
||||
</checkbox>
|
||||
</param>
|
||||
<param name="commentPrefix" label="perfix of the commnet">
|
||||
<nfield></nfield>
|
||||
</param>
|
||||
</params>
|
||||
</plugin>
|
||||
<behavior name="next">
|
||||
<params />
|
||||
</behavior>
|
||||
<behavior name="reset">
|
||||
<params />
|
||||
</behavior>
|
||||
</ui>
|
|
@ -0,0 +1,37 @@
|
|||
<!ELEMENT ui (plugin,(behavior)*)>
|
||||
<!ELEMENT plugin (params)>
|
||||
<!ATTLIST plugin
|
||||
name CDATA #REQUIRED
|
||||
>
|
||||
<!ELEMENT behavior (params)>
|
||||
<!ATTLIST behavior
|
||||
name CDATA #REQUIRED
|
||||
>
|
||||
<!ELEMENT timer (params)>
|
||||
<!ATTLIST timer
|
||||
name CDATA #REQUIRED
|
||||
>
|
||||
<!ELEMENT params (param)*>
|
||||
<!ELEMENT param (radiobutton|field|checkbox|nfield|combo|table)>
|
||||
<!ATTLIST param
|
||||
name CDATA #REQUIRED
|
||||
label CDATA #IMPLIED
|
||||
>
|
||||
<!ELEMENT radiobutton (choice*)>
|
||||
<!ELEMENT choice EMPTY>
|
||||
<!ATTLIST choice
|
||||
value CDATA #REQUIRED
|
||||
default (true|false) "false"
|
||||
>
|
||||
<!ELEMENT checkbox (choice*)>
|
||||
<!ELEMENT field EMPTY>
|
||||
<!ATTLIST field
|
||||
size CDATA #REQUIRED
|
||||
text CDATA ""
|
||||
>
|
||||
<!ELEMENT nfield EMPTY>
|
||||
<!ELEMENT table EMPTY>
|
||||
<!ATTLIST table
|
||||
cols CDATA #REQUIRED
|
||||
>
|
||||
<!ELEMENT combo (choice*)>
|
|
@ -0,0 +1,42 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- <!DOCTYPE ui SYSTEM "ui.dtd"> -->
|
||||
<ui>
|
||||
<plugin name="CsvProvider">
|
||||
<params>
|
||||
<param name="fileName" label="The name of the input file(Required)">
|
||||
<field size="7" />
|
||||
</param>
|
||||
<param name="separator"
|
||||
label="The separator of the input file and the following fieldNames">
|
||||
<field size="7" />
|
||||
</param>
|
||||
<param name="fieldNames" label="fields names:">
|
||||
<nfield />
|
||||
</param>
|
||||
<param name="shared" label="to share the file descriptor">
|
||||
<checkbox>
|
||||
<choice value="enable" default="false" />
|
||||
</checkbox>
|
||||
</param>
|
||||
<param name="loop" label="when to the EOF, is in loop">
|
||||
<checkbox>
|
||||
<choice value="enable" default="true" />
|
||||
</checkbox>
|
||||
</param>
|
||||
<param name="loadAtRuntime" label="is to load it at runtime">
|
||||
<checkbox>
|
||||
<choice value="loadAtRuntime" default="true" />
|
||||
</checkbox>
|
||||
</param>
|
||||
<param name="commentPrefix" label="perfix of the commnet">
|
||||
<nfield></nfield>
|
||||
</param>
|
||||
</params>
|
||||
</plugin>
|
||||
<behavior name="next">
|
||||
<params />
|
||||
</behavior>
|
||||
<behavior name="reset">
|
||||
<params />
|
||||
</behavior>
|
||||
</ui>
|
|
@ -22,6 +22,12 @@
|
|||
<version>4.11</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>dom4j</groupId>
|
||||
<artifactId>dom4j</artifactId>
|
||||
<version>1.6.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-webmvc</artifactId>
|
||||
|
|
|
@ -1,19 +1,20 @@
|
|||
package org.bench4q.master.api;
|
||||
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bench4q.master.domain.service.PluginService;
|
||||
import org.bench4q.master.domain.service.UserService;
|
||||
import org.bench4q.master.exception.Bench4QException;
|
||||
import org.bench4q.master.exception.ExceptionLog;
|
||||
import org.bench4q.share.models.master.plugin.PluginGUI;
|
||||
import org.bench4q.share.models.master.plugin.PluginResponseModel;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.multipart.commons.CommonsMultipartFile;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/plugin")
|
||||
|
@ -59,8 +60,8 @@ public class PluginController extends BaseController {
|
|||
PluginResponseModel pluginResponseModel = new PluginResponseModel();
|
||||
try {
|
||||
|
||||
pluginResponseModel.setMethodModels(this.getPluginService()
|
||||
.getMethodsInPlugin(pluginName));
|
||||
// pluginResponseModel.setMethodModels(this.getPluginService()
|
||||
// .getMethodsInPlugin(pluginName));
|
||||
pluginResponseModel.setSuccess(true);
|
||||
return pluginResponseModel;
|
||||
} catch (Exception e) {
|
||||
|
@ -70,62 +71,22 @@ public class PluginController extends BaseController {
|
|||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "loadMethodList/{pluginName}", method = {
|
||||
RequestMethod.GET, RequestMethod.POST })
|
||||
@ResponseBody
|
||||
public PluginResponseModel getMethodList(
|
||||
@PathVariable("pluginName") String pluginName)
|
||||
throws Bench4QException {
|
||||
if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) {
|
||||
throw new Bench4QException(400 + "", "not permitted",
|
||||
"/loadMethodList/{pluginName}");
|
||||
}
|
||||
PluginResponseModel pluginResponseModel = new PluginResponseModel();
|
||||
try {
|
||||
|
||||
pluginResponseModel.setMethodList(this.getPluginService()
|
||||
.getMethodNameInPlugin(pluginName));
|
||||
pluginResponseModel.setSuccess(true);
|
||||
return pluginResponseModel;
|
||||
} catch (Exception e) {
|
||||
logger.error(ExceptionLog.getStackTrace(e));
|
||||
pluginResponseModel.setSuccess(false);
|
||||
return pluginResponseModel;
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "loadMethodParams/{pluginName}/{methodName}", method = {
|
||||
RequestMethod.GET, RequestMethod.POST })
|
||||
@ResponseBody
|
||||
public PluginResponseModel getMethodParams(
|
||||
@PathVariable("pluginName") String pluginName,
|
||||
@PathVariable("methodName") String methodName)
|
||||
throws Bench4QException {
|
||||
if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) {
|
||||
throw new Bench4QException(400 + "", "not permitted",
|
||||
"loadMethodParams/{pluginName}/{methodName}");
|
||||
}
|
||||
PluginResponseModel pluginResponseModel = new PluginResponseModel();
|
||||
pluginResponseModel.setMethosMethodParamModels(this.getPluginService()
|
||||
.getMethodParamModelsInPlugin(pluginName, methodName));
|
||||
pluginResponseModel.setSuccess(true);
|
||||
return pluginResponseModel;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/addPlugin", method = { RequestMethod.PUT })
|
||||
@ResponseBody
|
||||
public PluginResponseModel addPlugin(@RequestBody PluginGUI pluginGUI)
|
||||
public PluginResponseModel addPlugin(
|
||||
@RequestParam("script") CommonsMultipartFile plugin)
|
||||
throws Bench4QException {
|
||||
if (!this.checkScope(UserService.SUPER_AUTHENTICATION)) {
|
||||
throw new Bench4QException(400 + "", "not permitted",
|
||||
"addPlugin/{pluginName}/{methodName}");
|
||||
}
|
||||
PluginResponseModel pluginResponseModel = validatePlugin(pluginGUI);
|
||||
String pluginUIContent = new String(plugin.getBytes());
|
||||
PluginResponseModel pluginResponseModel = new PluginResponseModel();
|
||||
|
||||
if (pluginResponseModel.isSuccess()) {
|
||||
pluginResponseModel.setSuccess(this.getPluginService().addPlugin(
|
||||
pluginGUI.getPlugin()));
|
||||
pluginUIContent));
|
||||
}
|
||||
|
||||
return pluginResponseModel;
|
||||
|
||||
}
|
||||
|
@ -138,7 +99,7 @@ public class PluginController extends BaseController {
|
|||
throws Bench4QException {
|
||||
if (!this.checkScope(UserService.SUPER_AUTHENTICATION)) {
|
||||
throw new Bench4QException(400 + "", "not permitted",
|
||||
"loadMethodParams/{pluginName}/{methodName}");
|
||||
"deletePlugin/{pluginName}");
|
||||
}
|
||||
PluginResponseModel pluginResponseModel = new PluginResponseModel();
|
||||
pluginResponseModel.setSuccess(this.getPluginService().deletePlugin(
|
||||
|
@ -147,19 +108,4 @@ public class PluginController extends BaseController {
|
|||
|
||||
}
|
||||
|
||||
private PluginResponseModel validatePlugin(PluginGUI pluginGUI) {
|
||||
PluginResponseModel pluginResponseModel = new PluginResponseModel();
|
||||
pluginResponseModel.setSuccess(true);
|
||||
if (pluginGUI.getPlugin() == null) {
|
||||
pluginResponseModel.setSuccess(false);
|
||||
pluginResponseModel.setFailMessage("plugin is null");
|
||||
}
|
||||
if (pluginGUI.getPlugin().getMethods() == null
|
||||
|| pluginGUI.getPlugin().getMethods().size() == 0) {
|
||||
pluginResponseModel.setSuccess(false);
|
||||
pluginResponseModel.setFailMessage("method is empty");
|
||||
}
|
||||
return pluginResponseModel;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,64 +1,63 @@
|
|||
package org.bench4q.master.domain.entity.plugin;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name = "method")
|
||||
public class Method {
|
||||
private int id;
|
||||
private String name;
|
||||
private Plugin plugin;
|
||||
private Set<MethodParam> methodParams;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id", nullable = false)
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Column(name = "method", nullable = false)
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "pluginId",nullable = false)
|
||||
public Plugin getPlugin() {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
public void setPlugin(Plugin plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@OneToMany(mappedBy = "method", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
|
||||
public Set<MethodParam> getMethodParams() {
|
||||
return methodParams;
|
||||
}
|
||||
|
||||
public void setMethodParams(Set<MethodParam> methodParams) {
|
||||
this.methodParams = methodParams;
|
||||
}
|
||||
|
||||
}
|
||||
package org.bench4q.master.domain.entity.plugin;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name = "behaviorInfo")
|
||||
public class BehaviorInfo {
|
||||
private int id;
|
||||
private String name;
|
||||
private Set<BehaviorParamInfo> params;
|
||||
private PluginUI pluginUI;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id", nullable = false)
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Column(name = "name", nullable = false)
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@OneToMany(mappedBy = "behaviorInfo", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
|
||||
public Set<BehaviorParamInfo> getParams() {
|
||||
return params;
|
||||
}
|
||||
|
||||
public void setParams(Set<BehaviorParamInfo> params) {
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "pluginId", nullable = false)
|
||||
public PluginUI getPluginUI() {
|
||||
return pluginUI;
|
||||
}
|
||||
|
||||
public void setPluginUI(PluginUI pluginUI) {
|
||||
this.pluginUI = pluginUI;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package org.bench4q.master.domain.entity.plugin;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name = "behaviorParamInfo")
|
||||
public class BehaviorParamInfo extends ParamInfo {
|
||||
private BehaviorInfo behaviorInfo;
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "behaviorId", nullable = false)
|
||||
public BehaviorInfo getBehaviorInfo() {
|
||||
return behaviorInfo;
|
||||
}
|
||||
|
||||
public void setBehaviorInfo(BehaviorInfo behaviorInfo) {
|
||||
this.behaviorInfo = behaviorInfo;
|
||||
};
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package org.bench4q.master.domain.entity.plugin;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name = "checboxType")
|
||||
public class CheckBoxType extends ParamType {
|
||||
private List<ChoiceType> choiceList;
|
||||
|
||||
@OneToMany(mappedBy = "parentContainer", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
|
||||
public List<ChoiceType> getChoiceList() {
|
||||
return choiceList;
|
||||
}
|
||||
|
||||
public void setChoiceList(List<ChoiceType> choiceList) {
|
||||
this.choiceList = choiceList;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package org.bench4q.master.domain.entity.plugin;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name = "choiceType")
|
||||
public class ChoiceType extends ParamType {
|
||||
private String value;
|
||||
private boolean defaultValue;
|
||||
private ParamType parentContainer;
|
||||
|
||||
@Column(name = "value")
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Column(name = "defaultValue")
|
||||
public boolean isDefaultValue() {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public void setDefaultValue(Boolean defaultValue) {
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "containerId")
|
||||
public ParamType getParentContainer() {
|
||||
return parentContainer;
|
||||
}
|
||||
|
||||
public void setParentContainer(ParamType parentContainer) {
|
||||
this.parentContainer = parentContainer;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package org.bench4q.master.domain.entity.plugin;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name = "comboType")
|
||||
public class ComboType extends ParamType {
|
||||
|
||||
private List<ChoiceType> choiceList;
|
||||
|
||||
@OneToMany(mappedBy = "parentContainer", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
|
||||
public List<ChoiceType> getChoiceList() {
|
||||
return choiceList;
|
||||
}
|
||||
|
||||
public void setChoiceList(List<ChoiceType> choiceList) {
|
||||
this.choiceList = choiceList;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package org.bench4q.master.domain.entity.plugin;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name = "fieldType")
|
||||
public class FieldType extends ParamType {
|
||||
private int size;
|
||||
private String text;
|
||||
|
||||
@Column(name = "size")
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public void setSize(int size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
@Column(name = "text")
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,105 +0,0 @@
|
|||
package org.bench4q.master.domain.entity.plugin;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name = "methodParam")
|
||||
public class MethodParam {
|
||||
private int id;
|
||||
private Method method;
|
||||
private String lable;
|
||||
private String name;
|
||||
private ParamType paramType;
|
||||
private String valueSeperator = ";";
|
||||
private String fieldSeperator = ",";
|
||||
private Set<MethodParamProperty> methodParamProperties;
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id", nullable = false)
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Column(name = "name", nullable = false)
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "methodId", nullable = false)
|
||||
public Method getMethod() {
|
||||
return method;
|
||||
}
|
||||
|
||||
public void setMethod(Method method) {
|
||||
this.method = method;
|
||||
}
|
||||
|
||||
@Column(name = "lable")
|
||||
public String getLable() {
|
||||
return lable;
|
||||
}
|
||||
|
||||
public void setLable(String lable) {
|
||||
this.lable = lable;
|
||||
}
|
||||
|
||||
@ManyToOne(cascade = CascadeType.MERGE, fetch = FetchType.EAGER)
|
||||
@JoinColumn(name = "paramTypeId", nullable = false)
|
||||
public ParamType getParamType() {
|
||||
return paramType;
|
||||
}
|
||||
|
||||
public void setParamType(ParamType paramType) {
|
||||
this.paramType = paramType;
|
||||
}
|
||||
|
||||
@Column(name = "valueSeperator")
|
||||
public String getValueSeperator() {
|
||||
return valueSeperator;
|
||||
}
|
||||
|
||||
public void setValueSeperator(String valueSeperator) {
|
||||
this.valueSeperator = valueSeperator;
|
||||
}
|
||||
|
||||
@Column(name = "fieldSeperator")
|
||||
public String getFieldSeperator() {
|
||||
return fieldSeperator;
|
||||
}
|
||||
|
||||
public void setFieldSeperator(String fieldSeperator) {
|
||||
this.fieldSeperator = fieldSeperator;
|
||||
}
|
||||
|
||||
@OneToMany(mappedBy = "methodParam", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
|
||||
public Set<MethodParamProperty> getMethodParamProperties() {
|
||||
return methodParamProperties;
|
||||
}
|
||||
|
||||
public void setMethodParamProperties(
|
||||
Set<MethodParamProperty> methodParamProperties) {
|
||||
this.methodParamProperties = methodParamProperties;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
package org.bench4q.master.domain.entity.plugin;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name = "methodParamProperty")
|
||||
public class MethodParamProperty {
|
||||
|
||||
private int id;
|
||||
private String propertyKey;
|
||||
private String propertyValue;
|
||||
private MethodParam methodParam;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id", nullable = false)
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Column(name = "propertyKey", nullable = false)
|
||||
public String getPropertyKey() {
|
||||
return propertyKey;
|
||||
}
|
||||
|
||||
public void setPropertyKey(String propertyKey) {
|
||||
this.propertyKey = propertyKey;
|
||||
}
|
||||
|
||||
@Column(name = "propertyValue", nullable = false)
|
||||
public String getPropertyValue() {
|
||||
return propertyValue;
|
||||
}
|
||||
|
||||
public void setPropertyValue(String propertyValue) {
|
||||
this.propertyValue = propertyValue;
|
||||
}
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "methodParamId")
|
||||
public MethodParam getMethodParam() {
|
||||
return methodParam;
|
||||
}
|
||||
|
||||
public void setMethodParam(MethodParam methodParam) {
|
||||
this.methodParam = methodParam;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package org.bench4q.master.domain.entity.plugin;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name = "nfieldType")
|
||||
public class NFieldType extends ParamType {
|
||||
private int size;
|
||||
private String text;
|
||||
|
||||
@Column(name = "size")
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public void setSize(int size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
@Column(name = "text")
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
package org.bench4q.master.domain.entity.plugin;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.MappedSuperclass;
|
||||
import javax.persistence.OneToOne;
|
||||
|
||||
@MappedSuperclass
|
||||
public class ParamInfo {
|
||||
|
||||
private int id;
|
||||
private String name;
|
||||
private String lable;
|
||||
private ParamType type;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id", nullable = false)
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Column(name = "name", nullable = false)
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Column(name = "lable")
|
||||
public String getLable() {
|
||||
return lable;
|
||||
}
|
||||
|
||||
public void setLable(String lable) {
|
||||
this.lable = lable;
|
||||
}
|
||||
|
||||
@OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
|
||||
@JoinColumn(name = "typeId", nullable = false)
|
||||
public ParamType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(ParamType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
}
|
|
@ -2,23 +2,21 @@ package org.bench4q.master.domain.entity.plugin;
|
|||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.EnumType;
|
||||
import javax.persistence.Enumerated;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Inheritance;
|
||||
import javax.persistence.InheritanceType;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.bench4q.share.models.master.plugin.ParamTypeEnum;
|
||||
|
||||
@Entity
|
||||
@Table(name = "paramType")
|
||||
public class ParamType {
|
||||
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
|
||||
public abstract class ParamType {
|
||||
private int id;
|
||||
private ParamTypeEnum type;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@GeneratedValue(strategy = GenerationType.TABLE)
|
||||
@Column(name = "id", nullable = false)
|
||||
public int getId() {
|
||||
return id;
|
||||
|
@ -28,14 +26,4 @@ public class ParamType {
|
|||
this.id = id;
|
||||
}
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(name="type",columnDefinition = "ENUM('Field', 'MultiField', 'Table','CheckBox')")
|
||||
public ParamTypeEnum getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(ParamTypeEnum type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,10 +14,10 @@ import javax.persistence.Table;
|
|||
|
||||
@Entity
|
||||
@Table(name = "plugin")
|
||||
public class Plugin {
|
||||
public class PluginInfo {
|
||||
private int id;
|
||||
private String name;
|
||||
private Set<Method> pluginMethods;
|
||||
private Set<PluginParamInfo> pluginParamInfos;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
|
@ -33,19 +33,20 @@ public class Plugin {
|
|||
@Column(name = "name", nullable = false)
|
||||
public String getName() {
|
||||
return name;
|
||||
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@OneToMany(mappedBy = "plugin", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY)
|
||||
public Set<Method> getPluginMethods() {
|
||||
return pluginMethods;
|
||||
@OneToMany(mappedBy = "pluginInfo", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY)
|
||||
public Set<PluginParamInfo> getPluginParamInfos() {
|
||||
return pluginParamInfos;
|
||||
}
|
||||
|
||||
public void setPluginMethods(Set<Method> pluginMethods) {
|
||||
this.pluginMethods = pluginMethods;
|
||||
public void setPluginParamInfos(Set<PluginParamInfo> pluginParamInfos) {
|
||||
this.pluginParamInfos = pluginParamInfos;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package org.bench4q.master.domain.entity.plugin;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name = "pluginParamInfo")
|
||||
public class PluginParamInfo extends ParamInfo {
|
||||
private PluginInfo pluginInfo;
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "pluginId", nullable = false)
|
||||
public PluginInfo getPluginInfo() {
|
||||
return pluginInfo;
|
||||
}
|
||||
|
||||
public void setPluginInfo(PluginInfo pluginInfo) {
|
||||
this.pluginInfo = pluginInfo;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package org.bench4q.master.domain.entity.plugin;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name = "pluginUI")
|
||||
public class PluginUI {
|
||||
|
||||
private int id;
|
||||
private PluginInfo pluginInfo;
|
||||
private Set<BehaviorInfo> behaviorInfos;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id", nullable = false)
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
|
||||
@JoinColumn(name = "pluginUIId", nullable = false)
|
||||
public PluginInfo getPluginInfo() {
|
||||
return pluginInfo;
|
||||
}
|
||||
|
||||
public void setPluginInfo(PluginInfo pluginInfo) {
|
||||
this.pluginInfo = pluginInfo;
|
||||
}
|
||||
|
||||
@OneToMany(mappedBy = "pluginUI", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY)
|
||||
public Set<BehaviorInfo> getBehaviorInfos() {
|
||||
return behaviorInfos;
|
||||
}
|
||||
|
||||
public void setBehaviorInfos(Set<BehaviorInfo> behaviorInfos) {
|
||||
this.behaviorInfos = behaviorInfos;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package org.bench4q.master.domain.entity.plugin;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name = "radioButtonType")
|
||||
public class RadioButtonType extends ParamType {
|
||||
private List<ChoiceType> choices;
|
||||
|
||||
@OneToMany(mappedBy = "parentContainer", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
|
||||
public List<ChoiceType> getChoices() {
|
||||
return choices;
|
||||
}
|
||||
|
||||
public void setChoices(List<ChoiceType> choices) {
|
||||
this.choices = choices;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package org.bench4q.master.domain.entity.plugin;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name="tableType")
|
||||
public class TableType extends ParamType {
|
||||
private String cols;
|
||||
@Column(name="cols")
|
||||
public String getCols() {
|
||||
return cols;
|
||||
}
|
||||
|
||||
public void setCols(String cols) {
|
||||
this.cols = cols;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,182 @@
|
|||
package org.bench4q.master.domain.factory;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import org.bench4q.master.domain.entity.plugin.BehaviorInfo;
|
||||
import org.bench4q.master.domain.entity.plugin.CheckBoxType;
|
||||
import org.bench4q.master.domain.entity.plugin.ChoiceType;
|
||||
import org.bench4q.master.domain.entity.plugin.ComboType;
|
||||
import org.bench4q.master.domain.entity.plugin.FieldType;
|
||||
import org.bench4q.master.domain.entity.plugin.NFieldType;
|
||||
import org.bench4q.master.domain.entity.plugin.ParamInfo;
|
||||
import org.bench4q.master.domain.entity.plugin.ParamType;
|
||||
import org.bench4q.master.domain.entity.plugin.PluginInfo;
|
||||
import org.bench4q.master.domain.entity.plugin.PluginUI;
|
||||
import org.bench4q.master.domain.entity.plugin.RadioButtonType;
|
||||
import org.bench4q.master.domain.entity.plugin.TableType;
|
||||
import org.bench4q.share.models.master.plugin.BehaviorInfoModel;
|
||||
import org.bench4q.share.models.master.plugin.CheckBoxModel;
|
||||
import org.bench4q.share.models.master.plugin.ChoiceModel;
|
||||
import org.bench4q.share.models.master.plugin.ComboModel;
|
||||
import org.bench4q.share.models.master.plugin.FieldModel;
|
||||
import org.bench4q.share.models.master.plugin.NFieldModel;
|
||||
import org.bench4q.share.models.master.plugin.ParamInfoModel;
|
||||
import org.bench4q.share.models.master.plugin.ParamTypeModel;
|
||||
import org.bench4q.share.models.master.plugin.PluginInfoModel;
|
||||
import org.bench4q.share.models.master.plugin.PluginUIModel;
|
||||
import org.bench4q.share.models.master.plugin.RadioButtonModel;
|
||||
import org.bench4q.share.models.master.plugin.TableModel;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class PluginDomainFactory {
|
||||
private ParamTypeModelFactory paramTypeModelFactory;
|
||||
|
||||
public ParamTypeModelFactory getParamTypeModelFactory() {
|
||||
return paramTypeModelFactory;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setParamTypeModelFactory(
|
||||
ParamTypeModelFactory paramTypeModelFactory) {
|
||||
this.paramTypeModelFactory = paramTypeModelFactory;
|
||||
}
|
||||
|
||||
public PluginUIModel createPluginUIModel(PluginUI pluginUI) {
|
||||
PluginUIModel pluginUIModel = new PluginUIModel();
|
||||
pluginUIModel.setPluginInfoModel(createPluginInfoModel(pluginUI
|
||||
.getPluginInfo()));
|
||||
pluginUIModel.setBehaviorInfos(createBehaviorInfoModels(pluginUI.getBehaviorInfos()));
|
||||
return pluginUIModel;
|
||||
|
||||
}
|
||||
|
||||
private PluginInfoModel createPluginInfoModel(PluginInfo pluginInfo) {
|
||||
PluginInfoModel pluginInfoModel = new PluginInfoModel();
|
||||
pluginInfoModel.setName(pluginInfo.getName());
|
||||
pluginInfoModel.setParamInfoModels(createParamInfoModels(pluginInfo
|
||||
.getPluginParamInfos()));
|
||||
return pluginInfoModel;
|
||||
}
|
||||
|
||||
private List<BehaviorInfoModel> createBehaviorInfoModels(
|
||||
Set<BehaviorInfo> behaviorInfos) {
|
||||
List<BehaviorInfoModel> behaviorInfoModels = new LinkedList<BehaviorInfoModel>();
|
||||
for (BehaviorInfo behaviorInfo : behaviorInfos) {
|
||||
behaviorInfoModels.add(createBehaviorInfoModel(behaviorInfo));
|
||||
}
|
||||
return behaviorInfoModels;
|
||||
}
|
||||
|
||||
private BehaviorInfoModel createBehaviorInfoModel(BehaviorInfo behaviorInfo) {
|
||||
BehaviorInfoModel behaviorInfoModel = new BehaviorInfoModel();
|
||||
behaviorInfoModel.setName(behaviorInfo.getName());
|
||||
behaviorInfoModel.setParamInfoModels(createParamInfoModels(behaviorInfo
|
||||
.getParams()));
|
||||
return behaviorInfoModel;
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
private List<ParamInfoModel> createParamInfoModels(
|
||||
Set<? extends ParamInfo> paramInfos) {
|
||||
List<ParamInfoModel> paramInfoModels = new LinkedList<ParamInfoModel>();
|
||||
for (ParamInfo paramInfo : paramInfos) {
|
||||
paramInfoModels.add(createParamInfoModel(paramInfo));
|
||||
}
|
||||
return paramInfoModels;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
private ParamInfoModel createParamInfoModel(ParamInfo paramInfo) {
|
||||
ParamInfoModel paramInfoModel = new ParamInfoModel();
|
||||
paramInfoModel.setName(paramInfo.getName());
|
||||
paramInfoModel.setLable(paramInfo.getLable());
|
||||
paramInfoModel.setParamTypeModel(this.getParamTypeModelFactory()
|
||||
.createParamTypeModel(paramInfo.getType()));
|
||||
return paramInfoModel;
|
||||
}
|
||||
}
|
||||
|
||||
@Component
|
||||
class ParamTypeModelFactory {
|
||||
public ParamTypeModel createParamTypeModel(ParamType paramType) {
|
||||
if (paramType instanceof FieldType)
|
||||
return createFieldModel((FieldType) paramType);
|
||||
else if (paramType instanceof NFieldType)
|
||||
return createNFieldModel((NFieldType) paramType);
|
||||
else if (paramType instanceof TableType)
|
||||
return createTableModel((TableType) paramType);
|
||||
else if (paramType instanceof CheckBoxType)
|
||||
return createCheckBoxModel((CheckBoxType) paramType);
|
||||
else if (paramType instanceof ComboType)
|
||||
return createComboModel((ComboType) paramType);
|
||||
else if (paramType instanceof RadioButtonType)
|
||||
return createRadioButton((RadioButtonType) paramType);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
private FieldModel createFieldModel(FieldType fieldType) {
|
||||
FieldModel fieldModel = new FieldModel();
|
||||
fieldModel.setSize(fieldType.getSize());
|
||||
fieldModel.setText(fieldType.getText());
|
||||
return fieldModel;
|
||||
|
||||
}
|
||||
|
||||
private NFieldModel createNFieldModel(NFieldType nFieldType) {
|
||||
NFieldModel nFieldModel = new NFieldModel();
|
||||
nFieldModel.setSize(nFieldType.getSize());
|
||||
nFieldModel.setText(nFieldType.getText());
|
||||
return nFieldModel;
|
||||
|
||||
}
|
||||
|
||||
private TableModel createTableModel(TableType tableType) {
|
||||
TableModel tableModel = new TableModel();
|
||||
tableModel.setCols(tableType.getCols());
|
||||
return tableModel;
|
||||
}
|
||||
|
||||
private CheckBoxModel createCheckBoxModel(CheckBoxType checkBoxType) {
|
||||
CheckBoxModel checkBoxModel = new CheckBoxModel();
|
||||
checkBoxModel.setChoiceModels(createChoiceModels(checkBoxType
|
||||
.getChoiceList()));
|
||||
return checkBoxModel;
|
||||
|
||||
}
|
||||
|
||||
private ComboModel createComboModel(ComboType comboType) {
|
||||
ComboModel comboModel = new ComboModel();
|
||||
comboModel
|
||||
.setChoiceModels(createChoiceModels(comboType.getChoiceList()));
|
||||
return comboModel;
|
||||
}
|
||||
|
||||
private RadioButtonModel createRadioButton(RadioButtonType radioButtonType) {
|
||||
RadioButtonModel radioButtonModel = new RadioButtonModel();
|
||||
radioButtonModel.setChoiceModels(createChoiceModels(radioButtonType
|
||||
.getChoices()));
|
||||
return radioButtonModel;
|
||||
|
||||
}
|
||||
|
||||
private List<ChoiceModel> createChoiceModels(List<ChoiceType> choiceTypes) {
|
||||
List<ChoiceModel> choiceModels = new LinkedList<ChoiceModel>();
|
||||
for (ChoiceType choiceType : choiceTypes) {
|
||||
choiceModels.add(createChoiceModel(choiceType));
|
||||
}
|
||||
return choiceModels;
|
||||
}
|
||||
|
||||
private ChoiceModel createChoiceModel(ChoiceType choiceType) {
|
||||
ChoiceModel choiceModel = new ChoiceModel();
|
||||
choiceModel.setDefaultValue(choiceType.isDefaultValue());
|
||||
choiceModel.setValue(choiceType.getValue());
|
||||
return choiceModel;
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,298 @@
|
|||
package org.bench4q.master.domain.factory;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bench4q.master.domain.entity.plugin.BehaviorInfo;
|
||||
import org.bench4q.master.domain.entity.plugin.BehaviorParamInfo;
|
||||
import org.bench4q.master.domain.entity.plugin.CheckBoxType;
|
||||
import org.bench4q.master.domain.entity.plugin.ChoiceType;
|
||||
import org.bench4q.master.domain.entity.plugin.ComboType;
|
||||
import org.bench4q.master.domain.entity.plugin.FieldType;
|
||||
import org.bench4q.master.domain.entity.plugin.NFieldType;
|
||||
import org.bench4q.master.domain.entity.plugin.ParamType;
|
||||
import org.bench4q.master.domain.entity.plugin.PluginInfo;
|
||||
import org.bench4q.master.domain.entity.plugin.PluginParamInfo;
|
||||
import org.bench4q.master.domain.entity.plugin.PluginUI;
|
||||
import org.bench4q.master.domain.entity.plugin.RadioButtonType;
|
||||
import org.bench4q.master.domain.entity.plugin.TableType;
|
||||
import org.bench4q.master.exception.ExceptionLog;
|
||||
import org.dom4j.Attribute;
|
||||
import org.dom4j.Document;
|
||||
import org.dom4j.DocumentException;
|
||||
import org.dom4j.DocumentHelper;
|
||||
import org.dom4j.Element;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class PluginEntityFactory {
|
||||
private Logger logger = Logger.getLogger(PluginEntityFactory.class);
|
||||
|
||||
public PluginUI createPluginUIWithOutId(String pluginUIContent) {
|
||||
Element root = getDocument(pluginUIContent).getRootElement();
|
||||
PluginUI pluginUI = new PluginUI();
|
||||
pluginUI.setPluginInfo(createPluginInfoWithOutId(XmlParseHelper
|
||||
.getOneChildElementByName(root, "plugin")));
|
||||
pluginUI.setBehaviorInfos(createBehaviorInfosWithOutId(
|
||||
XmlParseHelper.getChildElementsByName(root, "behavior"),
|
||||
pluginUI));
|
||||
return pluginUI;
|
||||
}
|
||||
|
||||
private Document getDocument(String pluginUI) {
|
||||
try {
|
||||
return DocumentHelper.parseText(pluginUI);
|
||||
|
||||
} catch (DocumentException e) {
|
||||
logger.info(ExceptionLog.getStackTrace(e));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private PluginInfo createPluginInfoWithOutId(Element element) {
|
||||
|
||||
PluginInfo pluginInfo = new PluginInfo();
|
||||
pluginInfo.setName(XmlParseHelper.getAttribute(element, "name"));
|
||||
Element paramsElement = XmlParseHelper.getOneChildElementByName(
|
||||
element, "params");
|
||||
pluginInfo.setPluginParamInfos(createPluginParamInfos(
|
||||
XmlParseHelper.getChildElements(paramsElement), pluginInfo));
|
||||
return pluginInfo;
|
||||
|
||||
}
|
||||
|
||||
private Set<BehaviorInfo> createBehaviorInfosWithOutId(
|
||||
List<Element> elements, PluginUI pluginUI) {
|
||||
Set<BehaviorInfo> behaviorInfos = new HashSet<BehaviorInfo>();
|
||||
for (Element element : elements) {
|
||||
behaviorInfos.add(createBehaviorInfoWithOutId(element, pluginUI));
|
||||
}
|
||||
return behaviorInfos;
|
||||
}
|
||||
|
||||
private BehaviorInfo createBehaviorInfoWithOutId(Element element,
|
||||
PluginUI pluginUI) {
|
||||
BehaviorInfo behaviorInfo = new BehaviorInfo();
|
||||
behaviorInfo.setName(XmlParseHelper.getAttribute(element, "name"));
|
||||
behaviorInfo.setPluginUI(pluginUI);
|
||||
behaviorInfo.setParams(createBehaviorParamInfos(
|
||||
XmlParseHelper.getChildElements(element), behaviorInfo));
|
||||
return behaviorInfo;
|
||||
}
|
||||
|
||||
private Set<BehaviorParamInfo> createBehaviorParamInfos(
|
||||
List<Element> elements, BehaviorInfo behaviorInfo) {
|
||||
Set<BehaviorParamInfo> paramInfos = new HashSet<BehaviorParamInfo>();
|
||||
for (Element element : elements) {
|
||||
BehaviorParamInfo behaviorParamInfo = createBehaviorParamInfo(
|
||||
element, behaviorInfo);
|
||||
if (behaviorParamInfo != null)
|
||||
paramInfos.add(behaviorParamInfo);
|
||||
}
|
||||
if (paramInfos.size() == 0)
|
||||
paramInfos = null;
|
||||
return paramInfos;
|
||||
}
|
||||
|
||||
private Set<PluginParamInfo> createPluginParamInfos(List<Element> elements,
|
||||
PluginInfo pluginInfo) {
|
||||
Set<PluginParamInfo> paramInfos = new HashSet<PluginParamInfo>();
|
||||
for (Element element : elements) {
|
||||
PluginParamInfo pluginParamInfo = createPluginParamInfoWithOutId(
|
||||
element, pluginInfo);
|
||||
if (pluginParamInfo != null)
|
||||
paramInfos.add(pluginParamInfo);
|
||||
}
|
||||
if (paramInfos.size() == 0)
|
||||
paramInfos = null;
|
||||
return paramInfos;
|
||||
}
|
||||
|
||||
private BehaviorParamInfo createBehaviorParamInfo(Element element,
|
||||
BehaviorInfo behaviorInfo) {
|
||||
if (XmlParseHelper.getAttribute(element, "name") == null)
|
||||
return null;
|
||||
BehaviorParamInfo behaviorParamInfo = new BehaviorParamInfo();
|
||||
behaviorParamInfo.setLable(XmlParseHelper
|
||||
.getAttribute(element, "lable"));
|
||||
behaviorParamInfo.setName(XmlParseHelper.getAttribute(element, "name"));
|
||||
ParamTypeFactory paramTypeFactory = new ParamTypeFactory();
|
||||
if (XmlParseHelper.getSingleChild(element) != null)
|
||||
behaviorParamInfo
|
||||
.setType(paramTypeFactory
|
||||
.createParamTypeInfo(XmlParseHelper
|
||||
.getSingleChild(element)));
|
||||
|
||||
behaviorParamInfo.setBehaviorInfo(behaviorInfo);
|
||||
|
||||
return behaviorParamInfo;
|
||||
}
|
||||
|
||||
private PluginParamInfo createPluginParamInfoWithOutId(Element element,
|
||||
PluginInfo pluginInfo) {
|
||||
if (XmlParseHelper.getAttribute(element, "name") == null)
|
||||
return null;
|
||||
PluginParamInfo pluginParamInfo = new PluginParamInfo();
|
||||
pluginParamInfo.setLable(XmlParseHelper.getAttribute(element, "lable"));
|
||||
pluginParamInfo.setName(XmlParseHelper.getAttribute(element, "name"));
|
||||
ParamTypeFactory paramTypeFactory = new ParamTypeFactory();
|
||||
pluginParamInfo.setType(paramTypeFactory
|
||||
.createParamTypeInfo(XmlParseHelper.getSingleChild(element)));
|
||||
pluginParamInfo.setPluginInfo(pluginInfo);
|
||||
return pluginParamInfo;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class ParamTypeFactory {
|
||||
public ParamType createParamTypeInfo(Element element) {
|
||||
String type = element.getName();
|
||||
switch (type) {
|
||||
case "field":
|
||||
return createFileType(element);
|
||||
case "nfield":
|
||||
return createNFieldType(element);
|
||||
case "table":
|
||||
return createTableType(element);
|
||||
case "radiobutton":
|
||||
return createRadioButtonType(element);
|
||||
case "checkbox":
|
||||
return createCheckBoxType(element);
|
||||
case "combo":
|
||||
return createComboType(element);
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
private FieldType createFileType(Element element) {
|
||||
FieldType fieldType = new FieldType();
|
||||
fieldType.setSize(Integer.parseInt(XmlParseHelper.getAttribute(element,
|
||||
"size")));
|
||||
fieldType.setText(XmlParseHelper.getAttribute(element, "text"));
|
||||
return fieldType;
|
||||
}
|
||||
|
||||
private NFieldType createNFieldType(Element element) {
|
||||
NFieldType nFieldType = new NFieldType();
|
||||
if (XmlParseHelper.getAttribute(element, "size") != null)
|
||||
nFieldType.setSize(Integer.parseInt(XmlParseHelper.getAttribute(
|
||||
element, "size")));
|
||||
nFieldType.setText(XmlParseHelper.getAttribute(element, "text"));
|
||||
return nFieldType;
|
||||
}
|
||||
|
||||
private TableType createTableType(Element element) {
|
||||
TableType tableType = new TableType();
|
||||
tableType.setCols(XmlParseHelper.getAttribute(element, "cols"));
|
||||
return tableType;
|
||||
}
|
||||
|
||||
private RadioButtonType createRadioButtonType(Element element) {
|
||||
RadioButtonType radioButtonType = new RadioButtonType();
|
||||
radioButtonType.setChoices(createChoiceTypes(
|
||||
XmlParseHelper.getChildElements(element), radioButtonType));
|
||||
return radioButtonType;
|
||||
}
|
||||
|
||||
private CheckBoxType createCheckBoxType(Element element) {
|
||||
CheckBoxType checkBoxType = new CheckBoxType();
|
||||
|
||||
checkBoxType.setChoiceList(createChoiceTypes(
|
||||
XmlParseHelper.getChildElements(element), checkBoxType));
|
||||
return checkBoxType;
|
||||
}
|
||||
|
||||
private ComboType createComboType(Element element) {
|
||||
ComboType comboType = new ComboType();
|
||||
comboType.setChoiceList(createChoiceTypes(
|
||||
XmlParseHelper.getChildElements(element), comboType));
|
||||
return comboType;
|
||||
}
|
||||
|
||||
private List<ChoiceType> createChoiceTypes(List<Element> elements,
|
||||
ParamType parentContainer) {
|
||||
List<ChoiceType> choiceTypes = new LinkedList<ChoiceType>();
|
||||
for (Element element : elements) {
|
||||
choiceTypes.add(createChoiceType(element, parentContainer));
|
||||
}
|
||||
return choiceTypes;
|
||||
|
||||
}
|
||||
|
||||
private ChoiceType createChoiceType(Element element,
|
||||
ParamType parentContainer) {
|
||||
ChoiceType choiceType = new ChoiceType();
|
||||
choiceType.setValue(XmlParseHelper.getAttribute(element, "value"));
|
||||
choiceType.setDefaultValue(Boolean.getBoolean(XmlParseHelper
|
||||
.getAttribute(element, "default")));
|
||||
choiceType.setParentContainer(parentContainer);
|
||||
return choiceType;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class XmlParseHelper {
|
||||
public static Element getSingleChild(Element element) {
|
||||
List<Element> choiceElements = new LinkedList<Element>();
|
||||
for (@SuppressWarnings("rawtypes")
|
||||
Iterator iterator = element.elementIterator(); iterator.hasNext();) {
|
||||
choiceElements.add((Element) iterator.next());
|
||||
}
|
||||
if (choiceElements.size() == 0)
|
||||
return null;
|
||||
else
|
||||
return choiceElements.get(0);
|
||||
}
|
||||
|
||||
public static String getAttribute(Element element, String attributeName) {
|
||||
for (@SuppressWarnings("rawtypes")
|
||||
Iterator iterator = element.attributeIterator(); iterator.hasNext();) {
|
||||
Attribute attribute = (Attribute) iterator.next();
|
||||
if (attribute.getName().equals(attributeName)) {
|
||||
return attribute.getValue();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static List<Element> getChildElements(Element element) {
|
||||
List<Element> choiceElements = new LinkedList<Element>();
|
||||
for (@SuppressWarnings("rawtypes")
|
||||
Iterator iterator = element.elementIterator(); iterator.hasNext();) {
|
||||
choiceElements.add((Element) iterator.next());
|
||||
}
|
||||
return choiceElements;
|
||||
}
|
||||
|
||||
public static Element getOneChildElementByName(Element element,
|
||||
String elementName) {
|
||||
for (@SuppressWarnings("rawtypes")
|
||||
Iterator iterator = element.elementIterator(); iterator.hasNext();) {
|
||||
Element childElement = (Element) iterator.next();
|
||||
if (childElement.getName().equals(elementName))
|
||||
|
||||
return childElement;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static List<Element> getChildElementsByName(Element element,
|
||||
String elementName) {
|
||||
|
||||
List<Element> elements = new LinkedList<>();
|
||||
for (Iterator iterator = element.elementIterator(); iterator.hasNext();) {
|
||||
Element childElement = (Element) iterator.next();
|
||||
if (childElement.getName().equals(elementName))
|
||||
elements.add(childElement);
|
||||
}
|
||||
return elements;
|
||||
|
||||
}
|
||||
}
|
|
@ -1,148 +0,0 @@
|
|||
package org.bench4q.master.domain.factory;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bench4q.master.domain.entity.plugin.Method;
|
||||
import org.bench4q.master.domain.entity.plugin.MethodParam;
|
||||
import org.bench4q.master.domain.entity.plugin.MethodParamProperty;
|
||||
import org.bench4q.master.domain.entity.plugin.ParamType;
|
||||
import org.bench4q.master.domain.entity.plugin.Plugin;
|
||||
import org.bench4q.master.domain.repository.PluginRepository;
|
||||
import org.bench4q.master.exception.Bench4QException;
|
||||
import org.bench4q.share.models.master.plugin.MethodModel;
|
||||
import org.bench4q.share.models.master.plugin.MethodParamModel;
|
||||
import org.bench4q.share.models.master.plugin.MethodParamPropertyModel;
|
||||
import org.bench4q.share.models.master.plugin.ParamTypeEnum;
|
||||
import org.bench4q.share.models.master.plugin.PluginModel;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class PluginFactory {
|
||||
|
||||
private PluginRepository pluginRepository;
|
||||
|
||||
public PluginRepository getPluginRepository() {
|
||||
return pluginRepository;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setPluginRepository(PluginRepository pluginRepository) {
|
||||
this.pluginRepository = pluginRepository;
|
||||
}
|
||||
|
||||
public Plugin createPluginEntity(PluginModel pluginModel)
|
||||
throws Bench4QException {
|
||||
Plugin plugin = new Plugin();
|
||||
plugin.setPluginMethods(new HashSet<Method>());
|
||||
if (pluginModel.getMethods() != null) {
|
||||
for (MethodModel methodModel : pluginModel.getMethods()) {
|
||||
plugin.getPluginMethods().add(
|
||||
createMethodEntity(methodModel, plugin));
|
||||
}
|
||||
plugin.setName(pluginModel.getName());
|
||||
return plugin;
|
||||
} else
|
||||
throw new Bench4QException("", "no method in plugin", "");
|
||||
|
||||
}
|
||||
|
||||
private Method createMethodEntity(MethodModel methodModel, Plugin plugin)
|
||||
throws Bench4QException {
|
||||
Method method = new Method();
|
||||
method.setMethodParams(new HashSet<MethodParam>());
|
||||
method.setName(methodModel.getName());
|
||||
if (methodModel.getMethodParams() != null) {
|
||||
for (MethodParamModel methodParamModel : methodModel
|
||||
.getMethodParams()) {
|
||||
Logger.getLogger(PluginFactory.class).info(
|
||||
"method model:" + methodModel.getName());
|
||||
method.getMethodParams().add(
|
||||
createMethodParamEntity(methodParamModel, method));
|
||||
}
|
||||
}
|
||||
method.setPlugin(plugin);
|
||||
|
||||
return method;
|
||||
}
|
||||
|
||||
private MethodParam createMethodParamEntity(
|
||||
MethodParamModel methodParamModel, Method method)
|
||||
throws Bench4QException {
|
||||
MethodParam methodParam = new MethodParam();
|
||||
methodParam.setLable(methodParamModel.getLable());
|
||||
methodParam.setName(methodParamModel.getName());
|
||||
methodParam.setMethod(method);
|
||||
methodParam.setParamType(createPraParamTypeWithOutId(methodParamModel
|
||||
.getParamType()));
|
||||
if (methodParamModel.getMethodParamProperties() != null) {
|
||||
methodParam
|
||||
.setMethodParamProperties(new HashSet<MethodParamProperty>());
|
||||
for (MethodParamPropertyModel methodParamPropertyModel : methodParamModel
|
||||
.getMethodParamProperties()) {
|
||||
methodParam.getMethodParamProperties().add(
|
||||
createMethodParamPropertyWithOutId(
|
||||
methodParamPropertyModel, methodParam));
|
||||
}
|
||||
}
|
||||
return methodParam;
|
||||
}
|
||||
|
||||
private ParamType createPraParamTypeWithOutId(ParamTypeEnum paramTypeEnum)
|
||||
throws Bench4QException {
|
||||
return this.getPluginRepository().getParamTypeByType(paramTypeEnum);
|
||||
}
|
||||
|
||||
private MethodParamProperty createMethodParamPropertyWithOutId(
|
||||
MethodParamPropertyModel methodParamPropertyModel,
|
||||
MethodParam methodParam) {
|
||||
MethodParamProperty methodParamProperty = new MethodParamProperty();
|
||||
methodParamProperty.setPropertyKey(methodParamPropertyModel.getKey());
|
||||
methodParamProperty.setPropertyValue(methodParamPropertyModel
|
||||
.getValue());
|
||||
methodParamProperty.setMethodParam(methodParam);
|
||||
return methodParamProperty;
|
||||
}
|
||||
|
||||
public static MethodModel extractMethodModel(Method method) {
|
||||
MethodModel methodModel = new MethodModel();
|
||||
methodModel.setName(method.getName());
|
||||
if (method.getMethodParams() != null) {
|
||||
methodModel.setMethodParams(new HashSet<MethodParamModel>());
|
||||
for (MethodParam methodParam : method.getMethodParams()) {
|
||||
methodModel.getMethodParams().add(
|
||||
extractMethodParamModel(methodParam));
|
||||
}
|
||||
}
|
||||
return methodModel;
|
||||
}
|
||||
|
||||
private static MethodParamModel extractMethodParamModel(
|
||||
MethodParam methodParam) {
|
||||
MethodParamModel methodParamModel = new MethodParamModel();
|
||||
methodParamModel.setLable(methodParam.getLable());
|
||||
methodParamModel.setName(methodParam.getName());
|
||||
methodParamModel.setParamType(methodParam.getParamType().getType());
|
||||
if (methodParam.getMethodParamProperties() != null) {
|
||||
methodParamModel
|
||||
.setMethodParamProperties(new HashSet<MethodParamPropertyModel>());
|
||||
for (MethodParamProperty methodParamProperty : methodParam
|
||||
.getMethodParamProperties()) {
|
||||
methodParamModel.getMethodParamProperties().add(
|
||||
extractMethodParamPropertyModel(methodParamProperty));
|
||||
}
|
||||
}
|
||||
return methodParamModel;
|
||||
}
|
||||
|
||||
private static MethodParamPropertyModel extractMethodParamPropertyModel(
|
||||
MethodParamProperty methodParamProperty) {
|
||||
MethodParamPropertyModel methodParamPropertyModel = new MethodParamPropertyModel();
|
||||
methodParamPropertyModel.setKey(methodParamProperty.getPropertyKey());
|
||||
methodParamPropertyModel.setValue(methodParamProperty
|
||||
.getPropertyValue());
|
||||
return methodParamPropertyModel;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,13 +1,12 @@
|
|||
package org.bench4q.master.domain.repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bench4q.master.domain.entity.plugin.Method;
|
||||
import org.bench4q.master.domain.entity.plugin.ParamType;
|
||||
import org.bench4q.master.domain.entity.plugin.Plugin;
|
||||
import org.bench4q.master.exception.Bench4QException;
|
||||
import java.util.Set;
|
||||
import org.bench4q.master.domain.entity.plugin.BehaviorInfo;
|
||||
import org.bench4q.master.domain.entity.plugin.PluginInfo;
|
||||
import org.bench4q.master.domain.entity.plugin.PluginUI;
|
||||
import org.bench4q.master.exception.ExceptionLog;
|
||||
import org.bench4q.master.exception.ExceptionUtils.EntityUniqueAlReadyExistException;
|
||||
import org.bench4q.share.models.master.plugin.ParamTypeEnum;
|
||||
import org.hibernate.Criteria;
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.Transaction;
|
||||
|
@ -16,64 +15,26 @@ import org.springframework.stereotype.Component;
|
|||
|
||||
@Component
|
||||
public class PluginRepository extends AbstractRepositoty {
|
||||
@SuppressWarnings("unchecked")
|
||||
private void fillParamType(Session session) throws Bench4QException {
|
||||
Transaction transaction = session.beginTransaction();
|
||||
List<ParamType> ret = session.createCriteria(ParamType.class).list();
|
||||
if (ret.size() == 0) {
|
||||
try {
|
||||
for (ParamTypeEnum paramTypeEnum : ParamTypeEnum.values()) {
|
||||
ParamType paramType = new ParamType();
|
||||
paramType.setType(paramTypeEnum);
|
||||
session.merge(paramType);
|
||||
}
|
||||
transaction.commit();
|
||||
} catch (Exception e) {
|
||||
transaction.rollback();
|
||||
logger.error(e, e.fillInStackTrace());
|
||||
throw new Bench4QException("", "fill paramType fail", "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ParamType getParamTypeByType(ParamTypeEnum paramTypeEnum)
|
||||
throws Bench4QException {
|
||||
|
||||
ParamType paramType = null;
|
||||
Session session = this.getSessionHelper().openSession();
|
||||
@SuppressWarnings("unchecked")
|
||||
List<ParamType> ret = session.createCriteria(ParamType.class).list();
|
||||
if (ret.size() == 0) {
|
||||
fillParamType(session);
|
||||
}
|
||||
paramType = (ParamType) session.createCriteria(ParamType.class)
|
||||
.add(Restrictions.eq("type", paramTypeEnum)).uniqueResult();
|
||||
if (paramType == null)
|
||||
logger.info("paramType not exit");
|
||||
releaseSession(session);
|
||||
return paramType;
|
||||
}
|
||||
|
||||
public boolean attatch(Plugin plugin) throws Bench4QException {
|
||||
|
||||
public boolean attatch(PluginUI pluginUI) {
|
||||
Session session = this.getSessionHelper().openSession();
|
||||
Transaction transaction = session.beginTransaction();
|
||||
Plugin pluginExist = null;
|
||||
try {
|
||||
pluginExist = (Plugin) session.createCriteria(Plugin.class)
|
||||
.add(Restrictions.eq("name", plugin.getName()))
|
||||
.uniqueResult();
|
||||
if (pluginExist != null) {
|
||||
logger.info("the plugin exist");
|
||||
PluginInfo pluginInfo = null;
|
||||
pluginInfo = (PluginInfo) session
|
||||
.createCriteria(PluginInfo.class)
|
||||
.add(Restrictions.eq("name", pluginUI.getPluginInfo()
|
||||
.getName())).uniqueResult();
|
||||
if (pluginInfo != null) {
|
||||
logger.info("the plugin already exists");
|
||||
return false;
|
||||
}
|
||||
session.merge(plugin);
|
||||
session.merge(pluginUI);
|
||||
transaction.commit();
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
transaction.rollback();
|
||||
logger.error(e, e.fillInStackTrace());
|
||||
throw new Bench4QException("", "add plugin fail", "");
|
||||
logger.error(ExceptionLog.getStackTrace(e));
|
||||
return false;
|
||||
} finally {
|
||||
releaseSession(session);
|
||||
}
|
||||
|
@ -83,82 +44,100 @@ public class PluginRepository extends AbstractRepositoty {
|
|||
protected void guardOtherUniqueConditionForEntity(
|
||||
String uniquePropertyName, String value)
|
||||
throws EntityUniqueAlReadyExistException {
|
||||
if (getPlugin(value) != null) {
|
||||
if (getPluginUI(value) != null) {
|
||||
throw new EntityUniqueAlReadyExistException("User with the name "
|
||||
+ value + "already exists");
|
||||
}
|
||||
}
|
||||
|
||||
public boolean detach(String pluginName) throws Bench4QException {
|
||||
public boolean detach(String pluginName) {
|
||||
Session session = this.getSessionHelper().openSession();
|
||||
Transaction transaction = session.beginTransaction();
|
||||
try {
|
||||
Plugin pluginExist = (Plugin) session.createCriteria(Plugin.class)
|
||||
.add(Restrictions.eq("name", pluginName)).uniqueResult();
|
||||
if (pluginExist == null) {
|
||||
PluginUI pluginUI = getPluginUI(pluginName);
|
||||
if (pluginUI == null) {
|
||||
logger.info("plugin not exist");
|
||||
return false;
|
||||
}
|
||||
session.delete(pluginExist);
|
||||
session.delete(pluginUI);
|
||||
transaction.commit();
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
logger.error(e, e.fillInStackTrace());
|
||||
logger.error(ExceptionLog.getStackTrace(e));
|
||||
transaction.rollback();
|
||||
throw new Bench4QException("", "delete plugin fail", "");
|
||||
return false;
|
||||
} finally {
|
||||
releaseSession(session);
|
||||
}
|
||||
}
|
||||
|
||||
public List<Plugin> loadPlugins() throws Bench4QException {
|
||||
public List<PluginUI> loadPlugins() {
|
||||
Session session = this.getSessionHelper().openSession();
|
||||
try {
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Plugin> ret = session.createCriteria(Plugin.class)
|
||||
List<PluginUI> ret = session.createCriteria(PluginUI.class)
|
||||
.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY).list();
|
||||
return ret;
|
||||
} catch (Exception e) {
|
||||
logger.error("load Plugins ");
|
||||
logger.error(e, e.fillInStackTrace());
|
||||
throw new Bench4QException("", "load plugin failed", "");
|
||||
logger.error(ExceptionLog.getStackTrace(e));
|
||||
return null;
|
||||
} finally {
|
||||
releaseSession(session);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isExist(Plugin plugin) {
|
||||
public Set<BehaviorInfo> loadBehaviorInfos(String pluginName) {
|
||||
Session session = this.getSessionHelper().openSession();
|
||||
Plugin pluginAlreadyExist = (Plugin) session
|
||||
.createCriteria(Plugin.class)
|
||||
.add(Restrictions.eq("userName", plugin.getName()))
|
||||
try {
|
||||
|
||||
PluginUI pluginUI = dogetPluginUI(pluginName, session);
|
||||
Set<BehaviorInfo> behaviorInfos = pluginUI.getBehaviorInfos();
|
||||
logger.info(behaviorInfos.size());
|
||||
|
||||
return behaviorInfos;
|
||||
} catch (Exception e) {
|
||||
logger.info(ExceptionLog.getStackTrace(e));
|
||||
return null;
|
||||
} finally {
|
||||
releaseSession(session);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isExist(PluginUI plugin) {
|
||||
Session session = this.getSessionHelper().openSession();
|
||||
PluginInfo pluginAlreadyExist = (PluginInfo) session
|
||||
.createCriteria(PluginInfo.class)
|
||||
.add(Restrictions.eq("name", plugin.getPluginInfo().getName()))
|
||||
.uniqueResult();
|
||||
releaseSession(session);
|
||||
return pluginAlreadyExist != null;
|
||||
}
|
||||
|
||||
public Plugin getPlugin(String pluginName) {
|
||||
Plugin plugin = null;
|
||||
public PluginUI getPluginUI(String pluginName) {
|
||||
if (pluginName == null) {
|
||||
logger.info("plugin name is null");
|
||||
return null;
|
||||
}
|
||||
PluginUI pluginUI = null;
|
||||
Session session = this.getSessionHelper().openSession();
|
||||
plugin = deGetPlugin(pluginName, session);
|
||||
plugin.getPluginMethods();
|
||||
pluginUI = dogetPluginUI(pluginName, session);
|
||||
releaseSession(session);
|
||||
return plugin;
|
||||
if (pluginUI == null)
|
||||
logger.info(pluginName + " plugin is null from repository");
|
||||
return pluginUI;
|
||||
}
|
||||
|
||||
private Plugin deGetPlugin(String pluginName, Session session) {
|
||||
return (Plugin) session.createCriteria(Plugin.class)
|
||||
public PluginUI dogetPluginUI(String pluginName, Session session) {
|
||||
PluginInfo pluginInfo = deGetPluginInfo(pluginName, session);
|
||||
if (pluginInfo == null)
|
||||
return null;
|
||||
return (PluginUI) session.createCriteria(PluginUI.class)
|
||||
.add(Restrictions.eq("pluginInfo", pluginInfo)).uniqueResult();
|
||||
}
|
||||
|
||||
private PluginInfo deGetPluginInfo(String pluginName, Session session) {
|
||||
return (PluginInfo) session.createCriteria(PluginInfo.class)
|
||||
.add(Restrictions.eq("name", pluginName)).uniqueResult();
|
||||
}
|
||||
|
||||
public List<Method> loadMethodsInPlugin(Plugin plugin) {
|
||||
Session session = this.getSessionHelper().openSession();
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Method> methods = (List<Method>) session
|
||||
.createCriteria(Method.class)
|
||||
.add(Restrictions.eq("plugin", plugin)).list();
|
||||
releaseSession(session);
|
||||
return methods;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -60,26 +60,6 @@ public class TestPlanRepository extends AbstractRepositoty {
|
|||
}
|
||||
}
|
||||
|
||||
// public TestPlan getTestPlanWithOneMonitorResult(String
|
||||
// testPlanRunId,Monitor monitor){
|
||||
//
|
||||
// Session session = this.getSessionHelper().openSession();
|
||||
// try{
|
||||
// TestPlan testPlan=(TestPlan) session
|
||||
// .createCriteria(TestPlan.class)
|
||||
// .add(Restrictions.eq("testPlanRunId", testPlanRunId))
|
||||
// .uniqueResult();
|
||||
// monitor=testPlan.extractSpecifiedMonitor(monitor.getHostName());
|
||||
// List<MonitorResult> monitorResults=session
|
||||
// .createCriteria(MonitorResult.class)
|
||||
// .add(Restrictions.eq("testPlanRunId", monitor))
|
||||
// .uniqueResult();
|
||||
//
|
||||
// }catch(Exception e){
|
||||
// logger.info(ExceptionLog.getStackTrace(e));
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
|
||||
@Override
|
||||
protected void guardOtherUniqueConditionForEntity(
|
||||
|
|
|
@ -1,27 +1,17 @@
|
|||
package org.bench4q.master.domain.service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bench4q.master.domain.entity.plugin.Plugin;
|
||||
import org.bench4q.master.domain.repository.PluginRepository;
|
||||
import org.bench4q.master.exception.Bench4QException;
|
||||
import org.bench4q.master.domain.entity.plugin.Method;
|
||||
import org.bench4q.master.domain.factory.PluginFactory;
|
||||
import org.bench4q.share.models.master.plugin.MethodModel;
|
||||
import org.bench4q.share.models.master.plugin.MethodParamModel;
|
||||
import org.bench4q.share.models.master.plugin.PluginModel;
|
||||
import org.bench4q.master.domain.factory.PluginEntityFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class PluginService {
|
||||
private PluginRepository pluginRepository;
|
||||
private PluginFactory pluginFactory;
|
||||
private Logger logger = Logger.getLogger(PluginService.class);
|
||||
private PluginEntityFactory pluginEntityFactory;
|
||||
|
||||
public PluginRepository getPluginRepository() {
|
||||
return pluginRepository;
|
||||
|
@ -32,96 +22,29 @@ public class PluginService {
|
|||
this.pluginRepository = pluginRepository;
|
||||
}
|
||||
|
||||
public PluginFactory getPluginFactory() {
|
||||
return pluginFactory;
|
||||
public PluginEntityFactory getPluginEntityFactory() {
|
||||
return pluginEntityFactory;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private void setPluginFactory(PluginFactory pluginFactory) {
|
||||
this.pluginFactory = pluginFactory;
|
||||
private void setPluginEntityFactory(PluginEntityFactory pluginEntityFactory) {
|
||||
this.pluginEntityFactory = pluginEntityFactory;
|
||||
}
|
||||
|
||||
public boolean addPlugin(PluginModel pluginModel) throws Bench4QException {
|
||||
public boolean addPlugin(String pluginUIContent) {
|
||||
return this.getPluginRepository().attatch(
|
||||
|
||||
this.getPluginFactory().createPluginEntity(pluginModel));
|
||||
this.getPluginEntityFactory().createPluginUIWithOutId(
|
||||
pluginUIContent));
|
||||
}
|
||||
|
||||
public boolean deletePlugin(String pluginName) throws Bench4QException {
|
||||
public boolean deletePlugin(String pluginName) {
|
||||
return this.getPluginRepository().detach(pluginName);
|
||||
}
|
||||
|
||||
public List<String> getPluginNameList() throws Bench4QException {
|
||||
List<String> pluginNameList = new ArrayList<String>();
|
||||
Set<Plugin> plugins = getPlugins();
|
||||
if (plugins != null) {
|
||||
for (Plugin plugin : plugins) {
|
||||
pluginNameList.add(plugin.getName());
|
||||
}
|
||||
}
|
||||
public List<String> getPluginNameList() {
|
||||
List<String> pluginNameList = new LinkedList<String>();
|
||||
return pluginNameList;
|
||||
}
|
||||
|
||||
private Set<Plugin> getPlugins() throws Bench4QException {
|
||||
List<Plugin> loadPluginList = this.getPluginRepository().loadPlugins();
|
||||
Set<Plugin> plugins = new HashSet<Plugin>();
|
||||
if (loadPluginList != null) {
|
||||
|
||||
for (Plugin plugin : loadPluginList) {
|
||||
plugins.add(plugin);
|
||||
}
|
||||
}
|
||||
|
||||
return plugins;
|
||||
}
|
||||
|
||||
public List<String> getMethodNameInPlugin(String pluginName) {
|
||||
List<String> methodNameList = new ArrayList<String>();
|
||||
Plugin plugin = this.getPluginRepository().getPlugin(pluginName);
|
||||
List<Method> methods = this.getPluginRepository().loadMethodsInPlugin(
|
||||
plugin);
|
||||
|
||||
if (methods != null) {
|
||||
for (Method method : methods) {
|
||||
methodNameList.add(method.getName());
|
||||
}
|
||||
}
|
||||
return methodNameList;
|
||||
}
|
||||
|
||||
private Method getMethodInPlugin(String pluginName, String methodName)
|
||||
throws Bench4QException {
|
||||
Plugin plugin = this.getPluginRepository().getPlugin(pluginName);
|
||||
List<Method> methods = this.getPluginRepository().loadMethodsInPlugin(
|
||||
plugin);
|
||||
if (methods != null) {
|
||||
for (Method method : methods) {
|
||||
if (method.getName().equals(methodName))
|
||||
return method;
|
||||
}
|
||||
}
|
||||
logger.info("method is empty");
|
||||
|
||||
throw new Bench4QException("", "no such method:" + methodName
|
||||
+ "in plugin:" + pluginName, "");
|
||||
|
||||
}
|
||||
|
||||
public Set<MethodParamModel> getMethodParamModelsInPlugin(
|
||||
String pluginName, String methodName) throws Bench4QException {
|
||||
return PluginFactory.extractMethodModel(
|
||||
this.getMethodInPlugin(pluginName, methodName))
|
||||
.getMethodParams();
|
||||
}
|
||||
|
||||
public Set<MethodModel> getMethodsInPlugin(String pluginName) {
|
||||
Plugin plugin = this.getPluginRepository().getPlugin(pluginName);
|
||||
Set<MethodModel> methodModels = new HashSet<MethodModel>();
|
||||
for (Method method : this.getPluginRepository().loadMethodsInPlugin(
|
||||
plugin)) {
|
||||
methodModels.add(PluginFactory.extractMethodModel(method));
|
||||
}
|
||||
return methodModels;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -30,10 +30,6 @@ public final class SessionHelper {
|
|||
}
|
||||
}
|
||||
|
||||
public Session getCurrentSession(){
|
||||
return this.getSessionFactory().getCurrentSession();
|
||||
|
||||
}
|
||||
public Session openSession() {
|
||||
return this.getSessionFactory().openSession();
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
<property name="connection.autoReconnect">true</property>
|
||||
<property name="connection.autoReconnectForPools">true</property>
|
||||
<property name="connection.is-connection-validation-required">true</property>
|
||||
|
||||
<mapping class="org.bench4q.master.domain.entity.User" />
|
||||
<mapping class="org.bench4q.master.domain.entity.Script" />
|
||||
<mapping class="org.bench4q.master.domain.entity.PlanedConfig" />
|
||||
|
@ -29,10 +28,19 @@
|
|||
<mapping class="org.bench4q.master.domain.entity.TestPlanScriptResult" />
|
||||
<mapping class="org.bench4q.master.domain.entity.Monitor" />
|
||||
<mapping class="org.bench4q.master.domain.entity.MonitorResult" />
|
||||
<mapping class="org.bench4q.master.domain.entity.plugin.Plugin" />
|
||||
<mapping class="org.bench4q.master.domain.entity.plugin.Method" />
|
||||
<mapping class="org.bench4q.master.domain.entity.plugin.MethodParam" />
|
||||
<mapping class="org.bench4q.master.domain.entity.plugin.PluginUI" />
|
||||
<mapping class="org.bench4q.master.domain.entity.plugin.PluginInfo" />
|
||||
<mapping class="org.bench4q.master.domain.entity.plugin.BehaviorInfo" />
|
||||
<mapping class="org.bench4q.master.domain.entity.plugin.ParamType" />
|
||||
<mapping class="org.bench4q.master.domain.entity.plugin.MethodParamProperty" />
|
||||
<mapping class="org.bench4q.master.domain.entity.plugin.PluginParamInfo" />
|
||||
<mapping class="org.bench4q.master.domain.entity.plugin.BehaviorParamInfo" />
|
||||
<mapping class="org.bench4q.master.domain.entity.plugin.ParamInfo" />
|
||||
<mapping class="org.bench4q.master.domain.entity.plugin.FieldType" />
|
||||
<mapping class="org.bench4q.master.domain.entity.plugin.NFieldType" />
|
||||
<mapping class="org.bench4q.master.domain.entity.plugin.CheckBoxType" />
|
||||
<mapping class="org.bench4q.master.domain.entity.plugin.TableType" />
|
||||
<mapping class="org.bench4q.master.domain.entity.plugin.RadioButtonType" />
|
||||
<mapping class="org.bench4q.master.domain.entity.plugin.ComboType" />
|
||||
<mapping class="org.bench4q.master.domain.entity.plugin.ChoiceType" />
|
||||
</session-factory>
|
||||
</hibernate-configuration>
|
|
@ -0,0 +1,21 @@
|
|||
package TestHelper;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.bench4q.master.domain.entity.plugin.PluginUI;
|
||||
import org.bench4q.master.domain.factory.PluginEntityFactory;
|
||||
public class Test_PluginHelper{
|
||||
public static PluginUI createPluginUI(String fileName) throws IOException {
|
||||
PluginEntityFactory pluginEntityFactory = new PluginEntityFactory();
|
||||
String fileSeparator = System.getProperty("file.separator");
|
||||
String filePath = System.getProperty("user.dir") + fileSeparator
|
||||
+ "pluginUI" + fileSeparator + fileName;
|
||||
File file = new File(filePath);
|
||||
String uiContent = FileUtils.readFileToString(file);
|
||||
PluginUI pluginUI = pluginEntityFactory
|
||||
.createPluginUIWithOutId(uiContent);
|
||||
return pluginUI;
|
||||
}
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
package TestHelper;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bench4q.share.models.master.plugin.MethodModel;
|
||||
import org.bench4q.share.models.master.plugin.MethodParamModel;
|
||||
import org.bench4q.share.models.master.plugin.ParamTypeEnum;
|
||||
import org.bench4q.share.models.master.plugin.PluginModel;
|
||||
import org.bench4q.share.models.master.plugin.MethodParamPropertyModel;
|
||||
|
||||
public class Test_PlunginHelper {
|
||||
|
||||
public static PluginModel createOnePlugin() {
|
||||
PluginModel plugin = new PluginModel();
|
||||
MethodModel method = new MethodModel();
|
||||
MethodParamModel methodParamModelUrl = new MethodParamModel();
|
||||
methodParamModelUrl.setLable("input url");
|
||||
methodParamModelUrl.setName("url");
|
||||
methodParamModelUrl.setMethodParamProperties(generatePropertyForField());
|
||||
methodParamModelUrl.setParamType(ParamTypeEnum.Field);
|
||||
|
||||
MethodParamModel methodParamsParamModel = new MethodParamModel();
|
||||
methodParamsParamModel.setName("queryparams");
|
||||
methodParamsParamModel.setLable("key=value");
|
||||
methodParamsParamModel.setMethodParamProperties(generatePropertyForMulti());
|
||||
methodParamsParamModel.setParamType(ParamTypeEnum.MultiField);
|
||||
Set<MethodParamModel> methodParams = new HashSet<MethodParamModel>();
|
||||
methodParams.add(methodParamModelUrl);
|
||||
methodParams.add(methodParamsParamModel);
|
||||
method.setName("get");
|
||||
method.setMethodParams(methodParams);
|
||||
|
||||
Set<MethodModel> methods = new HashSet<MethodModel>();
|
||||
methods.add(method);
|
||||
plugin.setMethods(methods);
|
||||
plugin.setName("http" + UUID.randomUUID());
|
||||
return plugin;
|
||||
|
||||
}
|
||||
private static Set<MethodParamPropertyModel> generatePropertyForField() {
|
||||
Set<MethodParamPropertyModel> metList = new HashSet<MethodParamPropertyModel>();
|
||||
MethodParamPropertyModel methodParamPropertyModel = new MethodParamPropertyModel();
|
||||
methodParamPropertyModel.setKey("size");
|
||||
methodParamPropertyModel.setValue("20");
|
||||
metList.add(methodParamPropertyModel);
|
||||
return metList;
|
||||
|
||||
}
|
||||
private static Set<MethodParamPropertyModel> generatePropertyForMulti() {
|
||||
Set<MethodParamPropertyModel> metList = new HashSet<MethodParamPropertyModel>();
|
||||
MethodParamPropertyModel methodParamPropertyModel = new MethodParamPropertyModel();
|
||||
methodParamPropertyModel.setKey("size");
|
||||
methodParamPropertyModel.setValue("20");
|
||||
metList.add(methodParamPropertyModel);
|
||||
return metList;
|
||||
|
||||
}
|
||||
}
|
|
@ -7,16 +7,16 @@ import java.io.IOException;
|
|||
import javax.xml.bind.JAXBException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bench4q.master.domain.entity.plugin.PluginUI;
|
||||
import org.bench4q.share.communication.HttpRequester.HttpResponse;
|
||||
import org.bench4q.share.helper.MarshalHelper;
|
||||
import org.bench4q.share.models.master.plugin.PluginGUI;
|
||||
import org.bench4q.share.models.master.plugin.PluginResponseModel;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import TestHelper.Test_PlunginHelper;
|
||||
import TestHelper.Test_PluginHelper;
|
||||
|
||||
public class PluginControllerTest extends TestBase {
|
||||
private final String URLSTRING = BASE_URL + "/plugin";
|
||||
|
@ -36,10 +36,9 @@ public class PluginControllerTest extends TestBase {
|
|||
public void testAddPlugin() throws JAXBException, IOException {
|
||||
this.setAccessTocken(this.login());
|
||||
String url = URLSTRING + "/addPlugin";
|
||||
PluginGUI pluginGUI = new PluginGUI();
|
||||
pluginGUI.setPlugin(Test_PlunginHelper.createOnePlugin());
|
||||
pluginName = pluginGUI.getPlugin().getName();
|
||||
String pluginContentString = MarshalHelper.marshal(PluginGUI.class,
|
||||
PluginUI pluginGUI = Test_PluginHelper.createPluginUI("ui.xml");
|
||||
pluginName = pluginGUI.getPluginInfo().getName();
|
||||
String pluginContentString = MarshalHelper.marshal(PluginUI.class,
|
||||
pluginGUI);
|
||||
HttpResponse httpResponse = this.httpRequester.sendPutXml(url,
|
||||
pluginContentString,
|
||||
|
@ -55,27 +54,29 @@ public class PluginControllerTest extends TestBase {
|
|||
Assert.assertTrue(pluginResponseModel.isSuccess());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetMethodParamModel() throws IOException, JAXBException {
|
||||
String url = URLSTRING + "/loadMethodParams";
|
||||
String urlForLoadMethod = URLSTRING + "/loadMethodList/" + pluginName;
|
||||
HttpResponse httpResponseMethod = this.httpRequester.sendPost(
|
||||
urlForLoadMethod, null,
|
||||
makeAccessTockenMap(this.getAccessTocken()));
|
||||
PluginResponseModel pluginResponseModelMethod = (PluginResponseModel) MarshalHelper
|
||||
.unmarshal(PluginResponseModel.class,
|
||||
httpResponseMethod.getContent());
|
||||
assertTrue(pluginResponseModelMethod.isSuccess());
|
||||
String methodName = pluginResponseModelMethod.getMethodList().get(0);
|
||||
url += "/" + pluginName + "/" + methodName;
|
||||
HttpResponse httpResponse = this.httpRequester.sendPost(url, null,
|
||||
makeAccessTockenMap(this.getAccessTocken()));
|
||||
PluginResponseModel pluginResponseModel = (PluginResponseModel) MarshalHelper
|
||||
.tryUnmarshal(PluginResponseModel.class,
|
||||
httpResponse.getContent());
|
||||
Assert.assertTrue(pluginResponseModel.isSuccess());
|
||||
assertEquals(2, pluginResponseModel.getMethosMethodParamModels().size());
|
||||
}
|
||||
// @Test
|
||||
// public void testGetMethodParamModel() throws IOException, JAXBException {
|
||||
// String url = URLSTRING + "/loadMethodParams";
|
||||
// String urlForLoadMethod = URLSTRING + "/loadMethodList/" + pluginName;
|
||||
// HttpResponse httpResponseMethod = this.httpRequester.sendPost(
|
||||
// urlForLoadMethod, null,
|
||||
// makeAccessTockenMap(this.getAccessTocken()));
|
||||
// PluginResponseModel pluginResponseModelMethod = (PluginResponseModel)
|
||||
// MarshalHelper
|
||||
// .unmarshal(PluginResponseModel.class,
|
||||
// httpResponseMethod.getContent());
|
||||
// assertTrue(pluginResponseModelMethod.isSuccess());
|
||||
// String methodName = pluginResponseModelMethod.getMethodList().get(0);
|
||||
// url += "/" + pluginName + "/" + methodName;
|
||||
// HttpResponse httpResponse = this.httpRequester.sendPost(url, null,
|
||||
// makeAccessTockenMap(this.getAccessTocken()));
|
||||
// PluginResponseModel pluginResponseModel = (PluginResponseModel)
|
||||
// MarshalHelper
|
||||
// .tryUnmarshal(PluginResponseModel.class,
|
||||
// httpResponse.getContent());
|
||||
// Assert.assertTrue(pluginResponseModel.isSuccess());
|
||||
// assertEquals(2, pluginResponseModel.getMethosMethodParamModels().size());
|
||||
// }
|
||||
|
||||
@Test
|
||||
public void testLoadPluginList() throws JAXBException, IOException {
|
||||
|
@ -90,19 +91,20 @@ public class PluginControllerTest extends TestBase {
|
|||
Assert.assertTrue(pluginResponseModel.getPluginList().size() > 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLoadMethodNameList() throws IOException, JAXBException {
|
||||
String urlForLoadMethod = URLSTRING + "/loadMethodList/" + pluginName;
|
||||
HttpResponse httpResponse = this.httpRequester.sendPost(
|
||||
urlForLoadMethod, null,
|
||||
makeAccessTockenMap(this.getAccessTocken()));
|
||||
System.out.println(httpResponse.getContent());
|
||||
PluginResponseModel pluginResponseModel = (PluginResponseModel) MarshalHelper
|
||||
.unmarshal(PluginResponseModel.class, httpResponse.getContent());
|
||||
assertNotNull(pluginResponseModel);
|
||||
Assert.assertTrue(pluginResponseModel.isSuccess());
|
||||
assertEquals(2, pluginResponseModel.getMethodList().size());
|
||||
}
|
||||
// @Test
|
||||
// public void testLoadMethodNameList() throws IOException, JAXBException {
|
||||
// String urlForLoadMethod = URLSTRING + "/loadMethodList/" + pluginName;
|
||||
// HttpResponse httpResponse = this.httpRequester.sendPost(
|
||||
// urlForLoadMethod, null,
|
||||
// makeAccessTockenMap(this.getAccessTocken()));
|
||||
// System.out.println(httpResponse.getContent());
|
||||
// PluginResponseModel pluginResponseModel = (PluginResponseModel)
|
||||
// MarshalHelper
|
||||
// .unmarshal(PluginResponseModel.class, httpResponse.getContent());
|
||||
// assertNotNull(pluginResponseModel);
|
||||
// Assert.assertTrue(pluginResponseModel.isSuccess());
|
||||
// assertEquals(2, pluginResponseModel.getMethodList().size());
|
||||
// }
|
||||
|
||||
@Test
|
||||
public void testDeletePlugin() throws IOException, JAXBException {
|
||||
|
@ -123,22 +125,23 @@ public class PluginControllerTest extends TestBase {
|
|||
Assert.assertTrue(pluginResponseModel.isSuccess());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetMethodInPlugin() throws IOException {
|
||||
String url = URLSTRING + "/loadMethods/" + pluginName;
|
||||
HttpResponse httpResponse = this.httpRequester.sendPost(url, null,
|
||||
makeAccessTockenMap(this.getAccessTocken()));
|
||||
Logger.getLogger(PluginControllerTest.class).info(
|
||||
httpResponse.getContent());
|
||||
PluginResponseModel pluginResponseModel = (PluginResponseModel) MarshalHelper
|
||||
.tryUnmarshal(PluginResponseModel.class,
|
||||
httpResponse.getContent());
|
||||
|
||||
assertNotNull(pluginResponseModel);
|
||||
assertTrue(pluginResponseModel.isSuccess());
|
||||
assertTrue(pluginResponseModel.getMethodModels().size() == 2);
|
||||
|
||||
}
|
||||
// @Test
|
||||
// public void testGetMethodInPlugin() throws IOException {
|
||||
// String url = URLSTRING + "/loadMethods/" + pluginName;
|
||||
// HttpResponse httpResponse = this.httpRequester.sendPost(url, null,
|
||||
// makeAccessTockenMap(this.getAccessTocken()));
|
||||
// Logger.getLogger(PluginControllerTest.class).info(
|
||||
// httpResponse.getContent());
|
||||
// PluginResponseModel pluginResponseModel = (PluginResponseModel)
|
||||
// MarshalHelper
|
||||
// .tryUnmarshal(PluginResponseModel.class,
|
||||
// httpResponse.getContent());
|
||||
//
|
||||
// assertNotNull(pluginResponseModel);
|
||||
// assertTrue(pluginResponseModel.isSuccess());
|
||||
// assertTrue(pluginResponseModel.getMethodModels().size() == 2);
|
||||
//
|
||||
// }
|
||||
|
||||
@After
|
||||
public void clear() throws IOException {
|
||||
|
|
|
@ -101,9 +101,7 @@ public class Test_TestResultSave extends TestBase_MakeUpTestPlan {
|
|||
testPlanFromRepo);
|
||||
assertEquals(TestPlanStatus.InRunning, testPlan.run());
|
||||
testPlanScript = getOneTestPlanScript(testPlan);
|
||||
|
||||
List<Object> resultList = new ArrayList<>();
|
||||
|
||||
resultList.addAll(testPlanScript.doAfterRun());
|
||||
this.getTestResultSave().update(testPlan, resultList);
|
||||
testPlanFromRepo = this.getTestPlanRepository().getTestPlanBy(
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
package org.bench4q.master.test.factory;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.bench4q.master.domain.entity.plugin.BehaviorInfo;
|
||||
import org.bench4q.master.domain.entity.plugin.FieldType;
|
||||
import org.bench4q.master.domain.entity.plugin.PluginInfo;
|
||||
import org.bench4q.master.domain.entity.plugin.PluginParamInfo;
|
||||
import org.bench4q.master.domain.entity.plugin.PluginUI;
|
||||
import org.bench4q.master.domain.factory.PluginEntityFactory;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(locations = { "classpath:service-test-context.xml" })
|
||||
public class Test_PluginEntityFactory {
|
||||
|
||||
private PluginEntityFactory pluginEntityFactory;
|
||||
|
||||
public PluginEntityFactory getPluginEntityFactory() {
|
||||
return pluginEntityFactory;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setPluginEntityFactory(PluginEntityFactory pluginEntityFactory) {
|
||||
this.pluginEntityFactory = pluginEntityFactory;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_createPluginFormString() throws IOException {
|
||||
String fileSeparator = System.getProperty("file.separator");
|
||||
String filePath = System.getProperty("user.dir") + fileSeparator
|
||||
+ "pluginUI" + fileSeparator + "ui.xml";
|
||||
File file = new File(filePath);
|
||||
String uiContent = FileUtils.readFileToString(file);
|
||||
PluginUI pluginUI = pluginEntityFactory
|
||||
.createPluginUIWithOutId(uiContent);
|
||||
assertNotNull(pluginUI);
|
||||
assertNotNull(pluginUI.getBehaviorInfos());
|
||||
assertNotNull(pluginUI.getPluginInfo());
|
||||
PluginInfo pluginInfo = pluginUI.getPluginInfo();
|
||||
assertNotNull(pluginInfo.getPluginParamInfos());
|
||||
assertEquals(pluginInfo.getPluginParamInfos().size(), 7);
|
||||
Set<PluginParamInfo> pluginParamInfos = pluginInfo
|
||||
.getPluginParamInfos();
|
||||
FieldType fieldType = null;
|
||||
for (PluginParamInfo pluginParamInfo : pluginParamInfos) {
|
||||
if (pluginParamInfo.getType() instanceof FieldType)
|
||||
fieldType = (FieldType) pluginParamInfo.getType();
|
||||
}
|
||||
assertTrue(fieldType.getSize() == 7);
|
||||
BehaviorInfo behaviorInfo=pluginUI.getBehaviorInfos().iterator().next();
|
||||
assertNull(behaviorInfo.getParams());
|
||||
}
|
||||
}
|
|
@ -2,17 +2,10 @@ package org.bench4q.master.test.repository;
|
|||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bench4q.master.domain.entity.plugin.Method;
|
||||
import org.bench4q.master.domain.entity.plugin.MethodParam;
|
||||
import org.bench4q.master.domain.entity.plugin.ParamType;
|
||||
import org.bench4q.master.domain.entity.plugin.Plugin;
|
||||
import org.bench4q.master.domain.factory.PluginFactory;
|
||||
import org.bench4q.master.domain.entity.plugin.PluginUI;
|
||||
import org.bench4q.master.domain.factory.PluginEntityFactory;
|
||||
import org.bench4q.master.domain.repository.PluginRepository;
|
||||
import org.bench4q.master.exception.Bench4QException;
|
||||
import org.bench4q.share.models.master.plugin.ParamTypeEnum;
|
||||
import org.bench4q.share.models.master.plugin.PluginModel;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
@ -20,15 +13,14 @@ import org.junit.runner.RunWith;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import TestHelper.Test_PlunginHelper;
|
||||
import TestHelper.Test_PluginHelper;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(locations = { "classpath:service-test-context.xml" })
|
||||
public class Test_PluginRepository {
|
||||
private PluginRepository pluginRepository;
|
||||
private String pluginName;
|
||||
private PluginFactory pluginFactory;
|
||||
private PluginEntityFactory pluginEntityFactory;
|
||||
|
||||
public PluginRepository getPluginRepository() {
|
||||
return pluginRepository;
|
||||
|
@ -39,79 +31,70 @@ public class Test_PluginRepository {
|
|||
this.pluginRepository = pluginRepository;
|
||||
}
|
||||
|
||||
public PluginFactory getPluginFactory() {
|
||||
return pluginFactory;
|
||||
public PluginEntityFactory getPluginEntityFactory() {
|
||||
return pluginEntityFactory;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setPluginFactory(PluginFactory pluginFactory) {
|
||||
this.pluginFactory = pluginFactory;
|
||||
public void setPluginEntityFactory(PluginEntityFactory pluginEntityFactory) {
|
||||
this.pluginEntityFactory = pluginEntityFactory;
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() throws Bench4QException {
|
||||
pluginName = addPlugin();
|
||||
this.pluginName = addPlugin("ui.xml");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetPlugin() {
|
||||
assertNotNull(this.getPluginRepository().getPlugin(pluginName));
|
||||
assertNotNull(pluginName);
|
||||
assertNotNull(this.getPluginRepository().getPluginUI(pluginName));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TestLoadMethodParam() {
|
||||
Plugin plugin = this.getPluginRepository().getPlugin(pluginName);
|
||||
MethodParam methodParam = plugin.getPluginMethods().iterator().next()
|
||||
.getMethodParams().iterator().next();
|
||||
|
||||
System.out.println(methodParam.getParamType().getClass());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetMethodList() throws Bench4QException {
|
||||
Plugin plugin = this.getPluginRepository().getPlugin(pluginName);
|
||||
assertNotNull(plugin);
|
||||
assertEquals(1, plugin.getPluginMethods().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLoadPlugin() throws Bench4QException {
|
||||
|
||||
public void testLoadPlugins() throws Bench4QException {
|
||||
int countBeforeInsert = this.getPluginRepository().loadPlugins().size();
|
||||
String insertPlugin = addPlugin();
|
||||
String name = addPlugin("test.xml");
|
||||
|
||||
assertEquals(countBeforeInsert + 1, this.getPluginRepository()
|
||||
.loadPlugins().size());
|
||||
this.getPluginRepository().detach(insertPlugin);
|
||||
assertTrue(this.getPluginRepository().detach(name));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLoadBehaviores() {
|
||||
assertEquals(2,
|
||||
this.getPluginRepository().loadBehaviorInfos(this.pluginName)
|
||||
.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetPluginUI() {
|
||||
assertNotNull(this.getPluginRepository().getPluginUI(pluginName));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetParamTypeByType() throws Bench4QException {
|
||||
ParamType paramType = this.getPluginRepository().getParamTypeByType(
|
||||
ParamTypeEnum.Field);
|
||||
assertNotNull(paramType);
|
||||
assertEquals(paramType.getType(), ParamTypeEnum.Field);
|
||||
|
||||
public void testDeletePlugin() {
|
||||
String name = addPlugin("ui.xml");
|
||||
assertTrue(this.getPluginRepository().detach(name));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLoadMethodInPlugin(){
|
||||
Plugin plugin=this.getPluginRepository().getPlugin(this.pluginName);
|
||||
List<Method> methods=this.getPluginRepository().loadMethodsInPlugin(plugin);
|
||||
assertNotNull(methods);
|
||||
assertTrue(methods.size()>0);
|
||||
|
||||
}
|
||||
@After
|
||||
public void clear() throws Bench4QException {
|
||||
this.getPluginRepository().detach(pluginName);
|
||||
}
|
||||
|
||||
private String addPlugin() throws Bench4QException {
|
||||
PluginModel pluginModel = Test_PlunginHelper.createOnePlugin();
|
||||
this.getPluginRepository().attatch(
|
||||
this.getPluginFactory().createPluginEntity(pluginModel));
|
||||
return pluginModel.getName();
|
||||
private String addPlugin(String fileName) {
|
||||
try {
|
||||
PluginUI pluginUI = Test_PluginHelper.createPluginUI(fileName);
|
||||
boolean add = this.getPluginRepository().attatch(pluginUI);
|
||||
System.out.println(add);
|
||||
return pluginUI.getPluginInfo().getName();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,127 +1,109 @@
|
|||
package org.bench4q.master.test.service;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.bench4q.master.domain.service.PluginService;
|
||||
import org.bench4q.master.exception.Bench4QException;
|
||||
import org.bench4q.share.helper.MarshalHelper;
|
||||
import org.bench4q.share.models.master.plugin.PluginModel;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import TestHelper.Test_PlunginHelper;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(locations = { "classpath:service-test-context.xml" })
|
||||
public class Test_PluginService {
|
||||
|
||||
private PluginService pluginService;
|
||||
private String nameForPlugin;
|
||||
// private PluginService pluginService;
|
||||
// private String nameForPlugin;
|
||||
//
|
||||
// public PluginService getPluginService() {
|
||||
// return pluginService;
|
||||
// }
|
||||
//
|
||||
// @Autowired
|
||||
// public void setPluginService(PluginService pluginService) {
|
||||
// this.pluginService = pluginService;
|
||||
// }
|
||||
//
|
||||
// @Before
|
||||
// public void setUp() throws Bench4QException {
|
||||
// nameForPlugin = addPlugin();
|
||||
// }
|
||||
|
||||
public PluginService getPluginService() {
|
||||
return pluginService;
|
||||
}
|
||||
// @Test
|
||||
// public void testPluginModel() throws JAXBException, IOException {
|
||||
// File file = new File(
|
||||
// buildSavePath()
|
||||
// + System.getProperty("file.separator")
|
||||
// + new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss")
|
||||
// .format(new Date()) + "plugin.xml");
|
||||
// FileUtils.writeStringToFile(
|
||||
// file,
|
||||
// MarshalHelper.marshal(PluginModel.class,
|
||||
// Test_PlunginHelper.createOnePlugin()));
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void testLoadMethodNameList() throws Bench4QException {
|
||||
// assertTrue(this.getPluginService().getPluginNameList().size() > 0);
|
||||
// int methodCount = this.getPluginService()
|
||||
// .getMethodNameInPlugin(nameForPlugin).size();
|
||||
// assertEquals(2, methodCount);
|
||||
// }
|
||||
|
||||
@Autowired
|
||||
public void setPluginService(PluginService pluginService) {
|
||||
this.pluginService = pluginService;
|
||||
}
|
||||
// @Test
|
||||
// public void testLoadPluginNameList() throws Bench4QException {
|
||||
// int pluginCountBefore = this.getPluginService().getPluginNameList()
|
||||
// .size();
|
||||
// String pluginName = addPlugin();
|
||||
// System.out.println(this.getPluginService().getPluginNameList().size()
|
||||
// - pluginCountBefore);
|
||||
// Assert.assertTrue(this.getPluginService().getPluginNameList().size() == (pluginCountBefore + 1));
|
||||
//
|
||||
// Assert.assertTrue(this.getPluginService().deletePlugin(pluginName));
|
||||
// }
|
||||
|
||||
@Before
|
||||
public void setUp() throws Bench4QException {
|
||||
nameForPlugin = addPlugin();
|
||||
}
|
||||
// @Test
|
||||
// public void getMethodParam() throws Bench4QException {
|
||||
// String methodName = this.getPluginService()
|
||||
// .getMethodNameInPlugin(nameForPlugin).get(0);
|
||||
// assertTrue(this.getPluginService()
|
||||
// .getMethodParamModelsInPlugin(nameForPlugin, methodName).size() == 2);
|
||||
// }
|
||||
|
||||
@Test
|
||||
public void testPluginModel() throws JAXBException, IOException {
|
||||
File file = new File(
|
||||
buildSavePath()
|
||||
+ System.getProperty("file.separator")
|
||||
+ new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss")
|
||||
.format(new Date()) + "plugin.xml");
|
||||
FileUtils.writeStringToFile(
|
||||
file,
|
||||
MarshalHelper.marshal(PluginModel.class,
|
||||
Test_PlunginHelper.createOnePlugin()));
|
||||
// @Test
|
||||
// public void testDeletePlugin() throws Bench4QException {
|
||||
// String pluginName = addPlugin();
|
||||
// Assert.assertTrue(this.getPluginService().deletePlugin(pluginName));
|
||||
//
|
||||
// }
|
||||
|
||||
}
|
||||
// @Test
|
||||
// public void testGetMethodInPlugin() {
|
||||
// assertTrue(this.getPluginService().getMethodsInPlugin(nameForPlugin)
|
||||
// .size() > 0);
|
||||
// }
|
||||
//
|
||||
// private String addPlugin() throws Bench4QException {
|
||||
// PluginModel plugin = Test_PlunginHelper.createOnePlugin();
|
||||
// plugin.setName("test" + UUID.randomUUID());
|
||||
// Assert.assertTrue(this.getPluginService().addPlugin(plugin));
|
||||
// return plugin.getName();
|
||||
// }
|
||||
|
||||
@Test
|
||||
public void testLoadMethodNameList() throws Bench4QException {
|
||||
assertTrue(this.getPluginService().getPluginNameList().size() > 0);
|
||||
int methodCount = this.getPluginService()
|
||||
.getMethodNameInPlugin(nameForPlugin).size();
|
||||
assertEquals(2, methodCount);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLoadPluginNameList() throws Bench4QException {
|
||||
int pluginCountBefore = this.getPluginService().getPluginNameList()
|
||||
.size();
|
||||
String pluginName = addPlugin();
|
||||
System.out.println(this.getPluginService().getPluginNameList().size()
|
||||
- pluginCountBefore);
|
||||
Assert.assertTrue(this.getPluginService().getPluginNameList().size() == (pluginCountBefore + 1));
|
||||
|
||||
Assert.assertTrue(this.getPluginService().deletePlugin(pluginName));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getMethodParam() throws Bench4QException {
|
||||
String methodName = this.getPluginService()
|
||||
.getMethodNameInPlugin(nameForPlugin).get(0);
|
||||
assertTrue(this.getPluginService()
|
||||
.getMethodParamModelsInPlugin(nameForPlugin, methodName).size() == 2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeletePlugin() throws Bench4QException {
|
||||
String pluginName = addPlugin();
|
||||
Assert.assertTrue(this.getPluginService().deletePlugin(pluginName));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetMethodInPlugin() {
|
||||
assertTrue(this.getPluginService().getMethodsInPlugin(nameForPlugin)
|
||||
.size() > 0);
|
||||
}
|
||||
|
||||
private String addPlugin() throws Bench4QException {
|
||||
PluginModel plugin = Test_PlunginHelper.createOnePlugin();
|
||||
plugin.setName("test" + UUID.randomUUID());
|
||||
Assert.assertTrue(this.getPluginService().addPlugin(plugin));
|
||||
return plugin.getName();
|
||||
}
|
||||
|
||||
@After
|
||||
public void clear() throws Bench4QException {
|
||||
this.getPluginService().deletePlugin(nameForPlugin);
|
||||
}
|
||||
|
||||
private String buildSavePath() {
|
||||
String dirString = "GUI" + System.getProperty("file.separator")
|
||||
+ System.getProperty("file.separator");
|
||||
File dirFile = new File(dirString);
|
||||
if (!dirFile.exists()) {
|
||||
dirFile.mkdirs();
|
||||
}
|
||||
return dirString;
|
||||
}
|
||||
// @After
|
||||
// public void clear() throws Bench4QException {
|
||||
// this.getPluginService().deletePlugin(nameForPlugin);
|
||||
// }
|
||||
//
|
||||
// private String buildSavePath() {
|
||||
// String dirString = "GUI" + System.getProperty("file.separator")
|
||||
// + System.getProperty("file.separator");
|
||||
// File dirFile = new File(dirString);
|
||||
// if (!dirFile.exists()) {
|
||||
// dirFile.mkdirs();
|
||||
// }
|
||||
// return dirString;
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue