Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
wenyann 2020-05-11 14:13:16 +08:00
commit 4a958d6f44
29 changed files with 117 additions and 749 deletions

View File

@ -2,10 +2,12 @@ FROM registry.fit2cloud.com/metersphere/fabric8-java-alpine-openjdk8-jre
MAINTAINER FIT2CLOUD <support@fit2cloud.com>
RUN mkdir -p /opt/apps
RUN mkdir -p /opt/apps && mkdir -p /opt/jmeter
ADD backend/target/backend-1.0.jar /opt/apps
ADD backend/target/classes/jmeter/ /opt/jmeter/
ENV JAVA_APP_JAR=/opt/apps/backend-1.0.jar
ENV AB_OFF=true

View File

@ -1,16 +1,13 @@
package io.metersphere.api.jmeter;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.LogUtil;
import io.metersphere.config.JmeterProperties;
import io.metersphere.i18n.Translator;
import org.apache.jmeter.save.SaveService;
import org.apache.jmeter.util.JMeterUtils;
import org.apache.jorphan.collections.HashTree;
import org.springframework.stereotype.Service;
import org.springframework.util.ResourceUtils;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.lang.reflect.Field;
@ -25,8 +22,8 @@ public class JMeterService {
public void run(InputStream is) {
String JMETER_HOME = jmeterProperties.getHome();
String JMETER_PROPERTIES = JMETER_HOME + "/bin/jmeter.properties";
JMeterUtils.loadJMeterProperties(getPath(JMETER_PROPERTIES));
JMeterUtils.setJMeterHome(getPath(JMETER_HOME));
JMeterUtils.loadJMeterProperties(JMETER_PROPERTIES);
JMeterUtils.setJMeterHome(JMETER_HOME);
try {
Object scriptWrapper = SaveService.loadElement(is);
HashTree testPlan = getHashTree(scriptWrapper);
@ -43,14 +40,4 @@ public class JMeterService {
field.setAccessible(true);
return (HashTree) field.get(scriptWrapper);
}
private String getPath(String path) {
try {
return ResourceUtils.getURL(ResourceUtils.CLASSPATH_URL_PREFIX + path).getPath();
} catch (FileNotFoundException e) {
LogUtil.error("file not found: " + path, e);
MSException.throwException(Translator.get("api_file_not_found_error"));
}
return null;
}
}

View File

@ -1,5 +1,10 @@
package io.metersphere.dto;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class ApiReportDTO {
private String id;
@ -13,92 +18,4 @@ public class ApiReportDTO {
private String testName;
private String projectId;
private String projectName;
public String getProjectId() {
return projectId;
}
public void setProjectId(String projectId) {
this.projectId = projectId;
}
public String getProjectName() {
return projectName;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTestId() {
return testId;
}
public void setTestId(String testId) {
this.testId = testId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Long getCreateTime() {
return createTime;
}
public void setCreateTime(Long createTime) {
this.createTime = createTime;
}
public Long getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Long updateTime) {
this.updateTime = updateTime;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getTestName() {
return testName;
}
public void setTestName(String testName) {
this.testName = testName;
}
}

View File

@ -1,15 +1,11 @@
package io.metersphere.dto;
import io.metersphere.base.domain.LoadTest;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class LoadTestDTO extends LoadTest {
private String projectName;
public String getProjectName() {
return projectName;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
}

View File

@ -1,31 +1,12 @@
package io.metersphere.dto;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class NodeDTO {
private String ip;
private Integer port;
private Integer maxConcurrency;
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public Integer getPort() {
return port;
}
public void setPort(Integer port) {
this.port = port;
}
public Integer getMaxConcurrency() {
return maxConcurrency;
}
public void setMaxConcurrency(Integer maxConcurrency) {
this.maxConcurrency = maxConcurrency;
}
}

View File

@ -1,106 +1,23 @@
package io.metersphere.dto;
import lombok.Getter;
import lombok.Setter;
import java.util.ArrayList;
import java.util.List;
@Getter
@Setter
public class OrganizationMemberDTO {
private String id;
private String name;
private String email;
private String phone;
private String status;
private Long createTime;
private Long updateTime;
private String language;
private String organizationId;
public String getOrganizationId() {
return organizationId;
}
public void setOrganizationId(String organizationId) {
this.organizationId = organizationId;
}
private List<String> roleIds = new ArrayList<>();
public List<String> getRoleIds() {
return roleIds;
}
public void setRoleIds(List<String> roleIds) {
this.roleIds = roleIds;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public Long getCreateTime() {
return createTime;
}
public void setCreateTime(Long createTime) {
this.createTime = createTime;
}
public Long getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Long updateTime) {
this.updateTime = updateTime;
}
public String getLanguage() {
return language;
}
public void setLanguage(String language) {
this.language = language;
}
}

View File

@ -1,5 +1,10 @@
package io.metersphere.dto;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class ProjectDTO {
private String id;
@ -10,59 +15,4 @@ public class ProjectDTO {
private Long createTime;
private Long updateTime;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getWorkspaceId() {
return workspaceId;
}
public void setWorkspaceId(String workspaceId) {
this.workspaceId = workspaceId;
}
public String getWorkspaceName() {
return workspaceName;
}
public void setWorkspaceName(String workspaceName) {
this.workspaceName = workspaceName;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Long getCreateTime() {
return createTime;
}
public void setCreateTime(Long createTime) {
this.createTime = createTime;
}
public Long getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Long updateTime) {
this.updateTime = updateTime;
}
}

View File

@ -1,5 +1,10 @@
package io.metersphere.dto;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class ReportDTO {
private String id;
@ -13,92 +18,4 @@ public class ReportDTO {
private String testName;
private String projectId;
private String projectName;
public String getProjectId() {
return projectId;
}
public void setProjectId(String projectId) {
this.projectId = projectId;
}
public String getProjectName() {
return projectName;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTestId() {
return testId;
}
public void setTestId(String testId) {
this.testId = testId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Long getCreateTime() {
return createTime;
}
public void setCreateTime(Long createTime) {
this.createTime = createTime;
}
public Long getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Long updateTime) {
this.updateTime = updateTime;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getTestName() {
return testName;
}
public void setTestName(String testName) {
this.testName = testName;
}
}

View File

@ -1,18 +1,13 @@
package io.metersphere.dto;
import io.metersphere.base.domain.TestCaseWithBLOBs;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
@Data
@Getter
@Setter
public class TestCaseDTO extends TestCaseWithBLOBs{
private String maintainerName;
public String getMaintainerName() {
return maintainerName;
}
public void setMaintainerName(String maintainerName) {
this.maintainerName = maintainerName;
}
}

View File

@ -1,27 +1,16 @@
package io.metersphere.dto;
import io.metersphere.base.domain.TestCaseNode;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
@Getter
@Setter
public class TestCaseNodeDTO extends TestCaseNode {
private String label;
private List<TestCaseNodeDTO> children;
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public List<TestCaseNodeDTO> getChildren() {
return children;
}
public void setChildren(List<TestCaseNodeDTO> children) {
this.children = children;
}
}

View File

@ -1,18 +1,20 @@
package io.metersphere.dto;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
@Data
@Getter
@Setter
public class TestCaseReportMetricDTO {
private List<TestCaseReportStatusResultDTO> executeResult;
private List<TestCaseReportModuleResultDTO> moduleExecuteResult;
private List<String> executors;
private String principal;
private Long startTime;
private Long endTime;
private String projectName;
private List<TestCaseReportStatusResultDTO> executeResult;
private List<TestCaseReportModuleResultDTO> moduleExecuteResult;
private List<String> executors;
private String principal;
private Long startTime;
private Long endTime;
private String projectName;
}

View File

@ -1,8 +1,10 @@
package io.metersphere.dto;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
@Data
@Getter
@Setter
public class TestCaseReportModuleResultDTO {
private String moduleId;
private String moduleName;

View File

@ -1,7 +1,10 @@
package io.metersphere.dto;
import lombok.Data;
@Data
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class TestCaseReportStatusResultDTO {
private String status;
private Integer count;

View File

@ -1,9 +1,11 @@
package io.metersphere.dto;
import io.metersphere.base.domain.TestCaseWithBLOBs;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
@Data
@Getter
@Setter
public class TestPlanCaseDTO extends TestCaseWithBLOBs {
private String executor;

View File

@ -1,15 +1,11 @@
package io.metersphere.dto;
import io.metersphere.base.domain.TestPlan;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class TestPlanDTO extends TestPlan {
private String projectName;
public String getProjectName() {
return projectName;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
}

View File

@ -2,18 +2,15 @@ package io.metersphere.dto;
import io.metersphere.base.domain.TestResource;
import io.metersphere.base.domain.TestResourcePool;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
@Getter
@Setter
public class TestResourcePoolDTO extends TestResourcePool {
private List<TestResource> resources;
public List<TestResource> getResources() {
return resources;
}
public void setResources(List<TestResource> resources) {
this.resources = resources;
}
}

View File

@ -2,10 +2,14 @@ package io.metersphere.dto;
import io.metersphere.base.domain.Role;
import io.metersphere.base.domain.UserRole;
import lombok.Getter;
import lombok.Setter;
import java.util.ArrayList;
import java.util.List;
@Getter
@Setter
public class UserDTO {
private String id;
@ -31,101 +35,6 @@ public class UserDTO {
private List<UserRole> userRoles = new ArrayList<>();
public List<Role> getRoles() {
return roles;
}
public void setRoles(List<Role> roles) {
this.roles = roles;
}
private static final long serialVersionUID = 1L;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id == null ? null : id.trim();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email == null ? null : email.trim();
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone == null ? null : phone.trim();
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status == null ? null : status.trim();
}
public Long getCreateTime() {
return createTime;
}
public void setCreateTime(Long createTime) {
this.createTime = createTime;
}
public Long getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Long updateTime) {
this.updateTime = updateTime;
}
public List<UserRole> getUserRoles() {
return userRoles;
}
public void setUserRoles(List<UserRole> userRoles) {
this.userRoles = userRoles;
}
public String getLanguage() {
return language;
}
public void setLanguage(String language) {
this.language = language;
}
public String getLastWorkspaceId() {
return lastWorkspaceId;
}
public void setLastWorkspaceId(String lastWorkspaceId) {
this.lastWorkspaceId = lastWorkspaceId;
}
public String getLastOrganizationId() {
return lastOrganizationId;
}
public void setLastOrganizationId(String lastOrganizationId) {
this.lastOrganizationId = lastOrganizationId;
}
}

View File

@ -2,18 +2,15 @@ package io.metersphere.dto;
import io.metersphere.base.domain.Role;
import io.metersphere.base.domain.User;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
@Getter
@Setter
public class UserOperateDTO extends User {
private List<Role> roleList;
public List<Role> getRoleList() {
return roleList;
}
public void setRoleList(List<Role> roleList) {
this.roleList = roleList;
}
}

View File

@ -1,5 +1,10 @@
package io.metersphere.dto;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class UserRoleDTO {
private String id;
@ -10,59 +15,4 @@ public class UserRoleDTO {
private String parentId;
private Boolean switchable = true;
public String getRoleId() {
return roleId;
}
public void setRoleId(String roleId) {
this.roleId = roleId;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public Boolean getSwitchable() {
return switchable;
}
public void setSwitchable(Boolean switchable) {
this.switchable = switchable;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public String getParentId() {
return parentId;
}
public void setParentId(String parentId) {
this.parentId = parentId;
}
}

View File

@ -1,5 +1,10 @@
package io.metersphere.dto;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class UserRoleHelpDTO {
private String roleId;
@ -8,43 +13,4 @@ public class UserRoleHelpDTO {
private String sourceName;
private String parentId;
public String getParentId() {
return parentId;
}
public void setParentId(String parentId) {
this.parentId = parentId;
}
public String getRoleId() {
return roleId;
}
public void setRoleId(String roleId) {
this.roleId = roleId;
}
public String getRoleName() {
return roleName;
}
public void setRoleName(String roleName) {
this.roleName = roleName;
}
public String getSourceId() {
return sourceId;
}
public void setSourceId(String sourceId) {
this.sourceId = sourceId;
}
public String getSourceName() {
return sourceName;
}
public void setSourceName(String sourceName) {
this.sourceName = sourceName;
}
}

View File

@ -1,5 +1,10 @@
package io.metersphere.dto;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class WorkspaceDTO {
private String id;
@ -8,43 +13,4 @@ public class WorkspaceDTO {
private String description;
private String organizationName;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getOrganizationId() {
return organizationId;
}
public void setOrganizationId(String organizationId) {
this.organizationId = organizationId;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getOrganizationName() {
return organizationName;
}
public void setOrganizationName(String organizationName) {
this.organizationName = organizationName;
}
}

View File

@ -1,8 +1,13 @@
package io.metersphere.dto;
import lombok.Getter;
import lombok.Setter;
import java.util.ArrayList;
import java.util.List;
@Getter
@Setter
public class WorkspaceMemberDTO {
private String id;
@ -16,83 +21,4 @@ public class WorkspaceMemberDTO {
private String workspaceId;
private List<String> roleIds = new ArrayList<>();
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public Long getCreateTime() {
return createTime;
}
public void setCreateTime(Long createTime) {
this.createTime = createTime;
}
public Long getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Long updateTime) {
this.updateTime = updateTime;
}
public String getLanguage() {
return language;
}
public void setLanguage(String language) {
this.language = language;
}
public String getWorkspaceId() {
return workspaceId;
}
public void setWorkspaceId(String workspaceId) {
this.workspaceId = workspaceId;
}
public List<String> getRoleIds() {
return roleIds;
}
public void setRoleIds(List<String> roleIds) {
this.roleIds = roleIds;
}
}

View File

@ -65,4 +65,4 @@ kafka.ssl.truststore-type=
# jmeter
jmeter.image=registry.fit2cloud.com/metersphere/jmeter-master:0.0.4
jmeter.home=jmeter
jmeter.home=/opt/jmeter

View File

@ -30,5 +30,4 @@ user_email_is_null=User email cannot be null
password_is_null=Password cannot be null
workspace_not_exists=Workspace is not exists
#api
api_load_script_error="Load script error"
api_file_not_found_error="File not found"
api_load_script_error="Load script error"

View File

@ -30,5 +30,4 @@ user_email_is_null=用户邮箱不能为空
password_is_null=密码不能为空
workspace_not_exists=工作空间不存在
#api
api_load_script_error="读取脚本失败"
api_file_not_found_error="文件未找到"
api_load_script_error="读取脚本失败"

View File

@ -85,7 +85,7 @@
handleCommand(command) {
switch (command) {
case "personal":
this.$setLang("en-US");
this.$setLang("en_US");
break;
case "logout":
this.$get("/signout", function () {

View File

@ -197,24 +197,24 @@ export default {
running: "Running",
reset: "Rest",
input_name: "Please enter the test name",
select_project: "Please select project",
select_project: "Select project",
scenario: {
config: "Scenario Config",
input_name: "Please enter the scenario name",
name: "Scenario Name",
base_url: "Base URL",
base_url_description: "Base URL as URL prefix for all requests",
parameters: "arguments",
parameters: "Parameters",
headers: "Headers",
kv_description: "Will be used for requests where the item is not set",
},
request: {
input_name: "Please enter the request name",
name: "Request Name",
name: "Name",
method: "Method",
url: "url",
url: "URL",
url_description: "etc: https://fit2cloud.com",
parameters: "arguments",
parameters: "Parameters",
parameters_desc: "Parameters will be appended to the URL e.g. https://fit2cloud.com?Name=Value&Name2=Value2",
headers: "Headers",
body: "Body",
@ -238,6 +238,7 @@ export default {
response_in_time: "Response in time",
},
extract: "Extract from response",
extract_desc: "Extract data from the response and store it in variables. Use the variables in subsequent requests.",
}
},
api_report: {

View File

@ -13,8 +13,8 @@ const messages = {
...enLocale
},
'zh_CN': {
...zh_CN,
...zh_CNLocale
...zh_CNLocale,
...zh_CN
},
'zh_TW': {
...zh_TWLocale
@ -38,7 +38,8 @@ function setI18nLanguage(lang) {
Vue.prototype.$setLang = function (lang) {
if (i18n.locale !== lang) {
if (!loadedLanguages.includes(lang)) {
return import(`./${lang}`).then(response => {
let file = lang.replace("_", "-");
return import(`./${file}`).then(response => {
i18n.mergeLocaleMessage(lang, response.default);
loadedLanguages.push(lang);
return setI18nLanguage(lang)

View File

@ -241,6 +241,7 @@ export default {
response_in_time: "响应时间在...毫秒以内",
},
extract: "提取",
extract_desc: "从响应中提取数据并将其存储在变量中。在后续请求中使用变量",
}
},
api_report: {