diff --git a/backend/pom.xml b/backend/pom.xml index b4d37b6d32..b4d5c1a4df 100644 --- a/backend/pom.xml +++ b/backend/pom.xml @@ -1,597 +1,604 @@ - - - - - - metersphere-server - io.metersphere - 1.4 - - - 4.0.0 - backend - - - UTF-8 - 1.6.0 - 1.8 - 5.2.1 - 1.1.3 - 2.7.7 - 20.1.0 - - - - - org.springframework.boot - spring-boot-starter-web - - - spring-boot-starter-tomcat - org.springframework.boot - - - - - - org.springframework.boot - spring-boot-configuration-processor - - - - org.springframework.boot - spring-boot-starter - - - - org.springframework.boot - spring-boot-starter-actuator - - - - org.springframework.boot - spring-boot-starter-test - test - - - - org.springframework.boot - spring-boot-starter-aop - - - org.springframework.boot - spring-boot-starter-jetty - - - org.springframework.boot - spring-boot-starter-mail - - - - org.projectlombok - lombok - - - - org.mybatis.spring.boot - mybatis-spring-boot-starter - 2.1.2 - - - - org.springframework.boot - spring-boot-starter-websocket - - - - - org.flywaydb - flyway-core - - - mysql - mysql-connector-java - runtime - - - com.github.pagehelper - pagehelper - 5.0.3 - - - - org.apache.shiro - shiro-spring-boot-starter - ${shiro.version} - - - - org.apache.commons - commons-lang3 - - - org.apache.commons - commons-collections4 - 4.1 - - - org.apache.commons - commons-text - 1.8 - - - commons-codec - commons-codec - - - - com.alibaba - fastjson - 1.2.72 - - - - - org.springdoc - springdoc-openapi-ui - 1.2.32 - - - - - - org.apache.jmeter - ApacheJMeter_http - ${jmeter.version} - - - org.apache.logging.log4j - log4j-slf4j-impl - - - - - - org.python - jython-standalone - 2.7.0 - - - - org.apache.jmeter - ApacheJMeter_functions - ${jmeter.version} - - - - org.apache.jmeter - ApacheJMeter_jdbc - ${jmeter.version} - - - - org.apache.jmeter - ApacheJMeter_tcp - ${jmeter.version} - - - - - com.microsoft.sqlserver - mssql-jdbc - 7.4.1.jre8 - - - - org.postgresql - postgresql - 42.2.14 - - - - com.oracle.database.jdbc - ojdbc8 - 19.7.0.0 - - - - - org.apache.dubbo - dubbo - ${dubbo.version} - - - org.apache.zookeeper - zookeeper - 3.4.13 - - - org.apache.curator - curator-framework - 4.0.1 - - - org.apache.curator - curator-recipes - 4.0.1 - - - - - org.apache.dubbo - dubbo-registry-nacos - ${dubbo.version} - - - com.alibaba.nacos - nacos-api - ${nacos.version} - - - com.alibaba.nacos - nacos-client - ${nacos.version} - - - - com.alibaba - easyexcel - 2.1.7 - - - - com.fit2cloud - quartz-spring-boot-starter - 0.0.7 - - - - io.metersphere - jmeter-plugins-dubbo - 2.7.11 - - - - - org.springframework.boot - spring-boot-starter-data-ldap - - - - - io.swagger - swagger-parser - 1.0.51 - - - - - org.graalvm.sdk - graal-sdk - ${graalvm.version} - compile - - - org.graalvm.js - js - ${graalvm.version} - runtime - - - org.graalvm.js - js-scriptengine - ${graalvm.version} - runtime - - - org.graalvm.tools - profiler - ${graalvm.version} - runtime - - - org.graalvm.tools - chromeinspector - ${graalvm.version} - runtime - - - - - org.pac4j - pac4j-cas - 3.0.2 - - - io.buji - buji-pac4j - 4.0.0 - - - shiro-web - org.apache.shiro - - - - - - org.jsoup - jsoup - 1.10.3 - - - - com.atlassian.commonmark - commonmark - 0.15.2 - - - - org.apache.commons - commons-compress - 1.20 - - - - org.dom4j - dom4j - 2.1.3 - - - - jaxen - jaxen - 1.2.0 - - - - org.json - json - 20171018 - - - - com.aliyun - alibaba-dingtalk-service-sdk - 1.0.1 - - - org.apache.httpcomponents - httpclient - 4.5.6 - - - - - - - - src/main/java - - **/*.properties - **/*.xml - - false - - - src/main/resources - - **/* - - false - - - - - - org.springframework.boot - spring-boot-maven-plugin - - true - - - org.projectlombok - lombok - - - org.springframework.boot - spring-boot-configuration-processor - - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.12.4 - - true - - - - maven-clean-plugin - - - - src/main/resources/static - - ** - - false - - - src/main/resources/templates - - ** - - false - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.8 - 1.8 - - - - - - org.apache.maven.plugins - maven-war-plugin - 2.6 - - - - org.apache.maven.plugins - maven-jar-plugin - - - **/jmeter/lib/**/*.jar - - - - - - org.apache.maven.plugins - maven-antrun-plugin - - - main-class-placement - generate-resources - - - - - - - - - - - - - - - - run - - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - copy - generate-resources - - copy - - - - - - - org.apache.jmeter - ApacheJMeter_functions - ${jmeter.version} - jar - true - src/main/resources/jmeter/lib/ext - ApacheJMeter_functions.jar - - - org.python - jython-standalone - 2.7.0 - jar - true - src/main/resources/jmeter/lib/ext - jython-standalone.jar - - - ${project.build.directory}/wars - false - true - - - - org.mybatis.generator - mybatis-generator-maven-plugin - 1.3.7 - - true - true - - - - mysql - mysql-connector-java - 8.0.16 - - - com.itfsw - mybatis-generator-plugin - 1.3.8 - - - - - org.apache.maven.plugins - maven-resources-plugin - - - copy-and-filter-allatori-config - package - - copy-resources - - - ${basedir}/target - - - ${basedir}/allatori - - allatori.xml - - true - - - - - - - - org.codehaus.mojo - exec-maven-plugin - - - run-allatori - package - - exec - - - - - java - - -Xms128m - -Xmx512m - -jar - ${basedir}/target/classes/allatori/allatori.jar - ${basedir}/target/classes/allatori/allatori.xml - - - - - - + + + + + + metersphere-server + io.metersphere + 1.4 + + + 4.0.0 + backend + + + UTF-8 + 1.6.0 + 1.8 + 5.2.1 + 1.1.3 + 2.7.7 + 20.1.0 + + + + + org.springframework.boot + spring-boot-starter-web + + + spring-boot-starter-tomcat + org.springframework.boot + + + + + + org.springframework.boot + spring-boot-configuration-processor + + + + org.springframework.boot + spring-boot-starter + + + + org.springframework.boot + spring-boot-starter-actuator + + + + org.springframework.boot + spring-boot-starter-test + test + + + + org.springframework.boot + spring-boot-starter-aop + + + org.springframework.boot + spring-boot-starter-jetty + + + org.springframework.boot + spring-boot-starter-mail + + + + org.projectlombok + lombok + + + + org.mybatis.spring.boot + mybatis-spring-boot-starter + 2.1.2 + + + + org.springframework.boot + spring-boot-starter-websocket + + + + + org.flywaydb + flyway-core + + + mysql + mysql-connector-java + runtime + + + com.github.pagehelper + pagehelper + 5.0.3 + + + + org.apache.shiro + shiro-spring-boot-starter + ${shiro.version} + + + + org.apache.commons + commons-lang3 + + + org.apache.commons + commons-collections4 + 4.1 + + + org.apache.commons + commons-text + 1.8 + + + commons-codec + commons-codec + + + + com.alibaba + fastjson + 1.2.72 + + + + + org.springdoc + springdoc-openapi-ui + 1.2.32 + + + + + + org.apache.jmeter + ApacheJMeter_http + ${jmeter.version} + + + org.apache.logging.log4j + log4j-slf4j-impl + + + + + + org.python + jython-standalone + 2.7.0 + + + + org.apache.jmeter + ApacheJMeter_functions + ${jmeter.version} + + + + org.apache.jmeter + ApacheJMeter_jdbc + ${jmeter.version} + + + + org.apache.jmeter + ApacheJMeter_tcp + ${jmeter.version} + + + + + com.microsoft.sqlserver + mssql-jdbc + 7.4.1.jre8 + + + + org.postgresql + postgresql + 42.2.14 + + + + com.oracle.database.jdbc + ojdbc8 + 19.7.0.0 + + + + + org.apache.dubbo + dubbo + ${dubbo.version} + + + org.apache.zookeeper + zookeeper + 3.4.13 + + + org.apache.curator + curator-framework + 4.0.1 + + + org.apache.curator + curator-recipes + 4.0.1 + + + + + org.apache.dubbo + dubbo-registry-nacos + ${dubbo.version} + + + com.alibaba.nacos + nacos-api + ${nacos.version} + + + com.alibaba.nacos + nacos-client + ${nacos.version} + + + + com.alibaba + easyexcel + 2.1.7 + + + + com.fit2cloud + quartz-spring-boot-starter + 0.0.7 + + + + io.metersphere + jmeter-plugins-dubbo + 2.7.11 + + + + + org.springframework.boot + spring-boot-starter-data-ldap + + + + + io.swagger + swagger-parser + 1.0.51 + + + + + org.graalvm.sdk + graal-sdk + ${graalvm.version} + compile + + + org.graalvm.js + js + ${graalvm.version} + runtime + + + org.graalvm.js + js-scriptengine + ${graalvm.version} + runtime + + + org.graalvm.tools + profiler + ${graalvm.version} + runtime + + + org.graalvm.tools + chromeinspector + ${graalvm.version} + runtime + + + + + org.pac4j + pac4j-cas + 3.0.2 + + + io.buji + buji-pac4j + 4.0.0 + + + shiro-web + org.apache.shiro + + + + + + org.jsoup + jsoup + 1.10.3 + + + + com.atlassian.commonmark + commonmark + 0.15.2 + + + + org.apache.commons + commons-compress + 1.20 + + + + org.dom4j + dom4j + 2.1.3 + + + + jaxen + jaxen + 1.2.0 + + + + org.json + json + 20171018 + + + + com.aliyun + alibaba-dingtalk-service-sdk + 1.0.1 + + + org.apache.httpcomponents + httpclient + 4.5.6 + + + + org.apache.commons + commons-text + 1.3 + + + + + + + + + src/main/java + + **/*.properties + **/*.xml + + false + + + src/main/resources + + **/* + + false + + + + + + org.springframework.boot + spring-boot-maven-plugin + + true + + + org.projectlombok + lombok + + + org.springframework.boot + spring-boot-configuration-processor + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.12.4 + + true + + + + maven-clean-plugin + + + + src/main/resources/static + + ** + + false + + + src/main/resources/templates + + ** + + false + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + + + + + org.apache.maven.plugins + maven-war-plugin + 2.6 + + + + org.apache.maven.plugins + maven-jar-plugin + + + **/jmeter/lib/**/*.jar + + + + + + org.apache.maven.plugins + maven-antrun-plugin + + + main-class-placement + generate-resources + + + + + + + + + + + + + + + + run + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy + generate-resources + + copy + + + + + + + org.apache.jmeter + ApacheJMeter_functions + ${jmeter.version} + jar + true + src/main/resources/jmeter/lib/ext + ApacheJMeter_functions.jar + + + org.python + jython-standalone + 2.7.0 + jar + true + src/main/resources/jmeter/lib/ext + jython-standalone.jar + + + ${project.build.directory}/wars + false + true + + + + org.mybatis.generator + mybatis-generator-maven-plugin + 1.3.7 + + true + true + + + + mysql + mysql-connector-java + 8.0.16 + + + com.itfsw + mybatis-generator-plugin + 1.3.8 + + + + + org.apache.maven.plugins + maven-resources-plugin + + + copy-and-filter-allatori-config + package + + copy-resources + + + ${basedir}/target + + + ${basedir}/allatori + + allatori.xml + + true + + + + + + + + org.codehaus.mojo + exec-maven-plugin + + + run-allatori + package + + exec + + + + + java + + -Xms128m + -Xmx512m + -jar + ${basedir}/target/classes/allatori/allatori.jar + ${basedir}/target/classes/allatori/allatori.xml + + + + + + \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/api/controller/APITestController.java b/backend/src/main/java/io/metersphere/api/controller/APITestController.java index 0951eccb13..0b73d1f183 100644 --- a/backend/src/main/java/io/metersphere/api/controller/APITestController.java +++ b/backend/src/main/java/io/metersphere/api/controller/APITestController.java @@ -1,144 +1,153 @@ -package io.metersphere.api.controller; - -import com.github.pagehelper.Page; -import com.github.pagehelper.PageHelper; -import io.metersphere.api.dto.*; -import io.metersphere.api.dto.scenario.request.dubbo.RegistryCenter; -import io.metersphere.api.service.APITestService; -import io.metersphere.base.domain.ApiTest; -import io.metersphere.base.domain.Schedule; -import io.metersphere.commons.constants.RoleConstants; -import io.metersphere.commons.utils.PageUtils; -import io.metersphere.commons.utils.Pager; -import io.metersphere.commons.utils.SessionUtils; -import io.metersphere.controller.request.QueryScheduleRequest; -import io.metersphere.dto.ScheduleDao; -import io.metersphere.service.CheckOwnerService; -import org.apache.shiro.authz.annotation.Logical; -import org.apache.shiro.authz.annotation.RequiresRoles; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -import javax.annotation.Resource; - -import java.util.List; - -@RestController -@RequestMapping(value = "/api") -@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER}, logical = Logical.OR) -public class APITestController { - @Resource - private APITestService apiTestService; - @Resource - private CheckOwnerService checkownerService; - - @GetMapping("recent/{count}") - public List recentTest(@PathVariable int count) { - String currentWorkspaceId = SessionUtils.getCurrentWorkspaceId(); - QueryAPITestRequest request = new QueryAPITestRequest(); - request.setWorkspaceId(currentWorkspaceId); - request.setUserId(SessionUtils.getUserId()); - PageHelper.startPage(1, count, true); - return apiTestService.recentTest(request); - } - - @PostMapping("/list/{goPage}/{pageSize}") - public Pager> list(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryAPITestRequest request) { - Page page = PageHelper.startPage(goPage, pageSize, true); - request.setWorkspaceId(SessionUtils.getCurrentWorkspaceId()); - return PageUtils.setPageInfo(page, apiTestService.list(request)); - } - - @PostMapping("/list/ids") - public List listByIds(@RequestBody QueryAPITestRequest request) { - return apiTestService.listByIds(request); - } - - @GetMapping("/list/{projectId}") - public List list(@PathVariable String projectId) { - checkownerService.checkProjectOwner(projectId); - return apiTestService.getApiTestByProjectId(projectId); - } - - @PostMapping(value = "/schedule/update") - public void updateSchedule(@RequestBody Schedule request) { - apiTestService.updateSchedule(request); - } - - @PostMapping(value = "/schedule/create") - public void createSchedule(@RequestBody Schedule request) { - apiTestService.createSchedule(request); - } - - @PostMapping(value = "/create", consumes = {"multipart/form-data"}) - public void create(@RequestPart("request") SaveAPITestRequest request, @RequestPart(value = "file") MultipartFile file, @RequestPart(value = "files") List bodyFiles) { - apiTestService.create(request, file, bodyFiles); - } - - @PostMapping(value = "/create/merge", consumes = {"multipart/form-data"}) - public void mergeCreate(@RequestPart("request") SaveAPITestRequest request, @RequestPart(value = "file") MultipartFile file, @RequestPart(value = "selectIds") List selectIds) { - apiTestService.mergeCreate(request, file, selectIds); - } - - @PostMapping(value = "/update", consumes = {"multipart/form-data"}) - public void update(@RequestPart("request") SaveAPITestRequest request, @RequestPart(value = "file") MultipartFile file, @RequestPart(value = "files") List bodyFiles) { - checkownerService.checkApiTestOwner(request.getId()); - apiTestService.update(request, file, bodyFiles); - } - - @PostMapping(value = "/copy") - public void copy(@RequestBody SaveAPITestRequest request) { - apiTestService.copy(request); - } - - @GetMapping("/get/{testId}") - public APITestResult get(@PathVariable String testId) { - checkownerService.checkApiTestOwner(testId); - return apiTestService.get(testId); - } - - - @PostMapping("/delete") - public void delete(@RequestBody DeleteAPITestRequest request) { - String testId = request.getId(); - checkownerService.checkApiTestOwner(testId); - apiTestService.delete(testId); - } - - @PostMapping(value = "/run") - public String run(@RequestBody SaveAPITestRequest request) { - return apiTestService.run(request); - } - - @PostMapping(value = "/run/debug", consumes = {"multipart/form-data"}) - public String runDebug(@RequestPart("request") SaveAPITestRequest request, @RequestPart(value = "file") MultipartFile file, @RequestPart(value = "files") List bodyFiles) { - return apiTestService.runDebug(request, file, bodyFiles); - } - - @PostMapping(value = "/checkName") - public void checkName(@RequestBody SaveAPITestRequest request) { - apiTestService.checkName(request); - } - - @PostMapping(value = "/import", consumes = {"multipart/form-data"}) - @RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR) - public ApiTest testCaseImport(@RequestPart(value = "file", required = false) MultipartFile file, @RequestPart("request") ApiTestImportRequest request) { - return apiTestService.apiTestImport(file, request); - } - - @PostMapping("/dubbo/providers") - public List getProviders(@RequestBody RegistryCenter registry) { - return apiTestService.getProviders(registry); - } - - @PostMapping("/list/schedule/{goPage}/{pageSize}") - public List listSchedule(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryScheduleRequest request) { - Page page = PageHelper.startPage(goPage, pageSize, true); - return apiTestService.listSchedule(request); - } - - @PostMapping("/list/schedule") - public List listSchedule(@RequestBody QueryScheduleRequest request) { - return apiTestService.listSchedule(request); - } -} +package io.metersphere.api.controller; + +import com.github.pagehelper.Page; +import com.github.pagehelper.PageHelper; +import io.metersphere.api.dto.*; +import io.metersphere.api.dto.scenario.request.dubbo.RegistryCenter; +import io.metersphere.api.service.APITestService; +import io.metersphere.base.domain.ApiTest; +import io.metersphere.base.domain.Schedule; +import io.metersphere.commons.constants.RoleConstants; +import io.metersphere.commons.utils.PageUtils; +import io.metersphere.commons.utils.Pager; +import io.metersphere.commons.utils.SessionUtils; +import io.metersphere.controller.request.QueryScheduleRequest; +import io.metersphere.dto.ScheduleDao; +import io.metersphere.service.CheckOwnerService; + +import org.apache.shiro.authz.annotation.Logical; +import org.apache.shiro.authz.annotation.RequiresRoles; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; + +import java.util.HashMap; +import java.util.List; + +import static io.metersphere.commons.utils.JsonPathUtils.getListJson; + + +@RestController +@RequestMapping(value = "/api") +@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER}, logical = Logical.OR) +public class APITestController { + @Resource + private APITestService apiTestService; + @Resource + private CheckOwnerService checkownerService; + + @GetMapping("recent/{count}") + public List recentTest(@PathVariable int count) { + String currentWorkspaceId = SessionUtils.getCurrentWorkspaceId(); + QueryAPITestRequest request = new QueryAPITestRequest(); + request.setWorkspaceId(currentWorkspaceId); + request.setUserId(SessionUtils.getUserId()); + PageHelper.startPage(1, count, true); + return apiTestService.recentTest(request); + } + + @PostMapping("/list/{goPage}/{pageSize}") + public Pager> list(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryAPITestRequest request) { + Page page = PageHelper.startPage(goPage, pageSize, true); + request.setWorkspaceId(SessionUtils.getCurrentWorkspaceId()); + return PageUtils.setPageInfo(page, apiTestService.list(request)); + } + + @PostMapping("/list/ids") + public List listByIds(@RequestBody QueryAPITestRequest request) { + return apiTestService.listByIds(request); + } + + @GetMapping("/list/{projectId}") + public List list(@PathVariable String projectId) { + checkownerService.checkProjectOwner(projectId); + return apiTestService.getApiTestByProjectId(projectId); + } + + @PostMapping(value = "/schedule/update") + public void updateSchedule(@RequestBody Schedule request) { + apiTestService.updateSchedule(request); + } + + @PostMapping(value = "/schedule/create") + public void createSchedule(@RequestBody Schedule request) { + apiTestService.createSchedule(request); + } + + @PostMapping(value = "/create", consumes = {"multipart/form-data"}) + public void create(@RequestPart("request") SaveAPITestRequest request, @RequestPart(value = "file") MultipartFile file, @RequestPart(value = "files") List bodyFiles) { + apiTestService.create(request, file, bodyFiles); + } + + @PostMapping(value = "/create/merge", consumes = {"multipart/form-data"}) + public void mergeCreate(@RequestPart("request") SaveAPITestRequest request, @RequestPart(value = "file") MultipartFile file, @RequestPart(value = "selectIds") List selectIds) { + apiTestService.mergeCreate(request, file, selectIds); + } + @PostMapping(value = "/update", consumes = {"multipart/form-data"}) + public void update(@RequestPart("request") SaveAPITestRequest request, @RequestPart(value = "file") MultipartFile file, @RequestPart(value = "files") List bodyFiles) { + checkownerService.checkApiTestOwner(request.getId()); + apiTestService.update(request, file, bodyFiles); + } + + @PostMapping(value = "/copy") + public void copy(@RequestBody SaveAPITestRequest request) { + apiTestService.copy(request); + } + + @GetMapping("/get/{testId}") + public APITestResult get(@PathVariable String testId) { + checkownerService.checkApiTestOwner(testId); + return apiTestService.get(testId); + } + + + @PostMapping("/delete") + public void delete(@RequestBody DeleteAPITestRequest request) { + String testId = request.getId(); + checkownerService.checkApiTestOwner(testId); + apiTestService.delete(testId); + } + + @PostMapping(value = "/run") + public String run(@RequestBody SaveAPITestRequest request) { + return apiTestService.run(request); + } + + @PostMapping(value = "/run/debug", consumes = {"multipart/form-data"}) + public String runDebug(@RequestPart("request") SaveAPITestRequest request, @RequestPart(value = "file") MultipartFile file, @RequestPart(value = "files") List bodyFiles) { + return apiTestService.runDebug(request, file, bodyFiles); + } + + @PostMapping(value = "/checkName") + public void checkName(@RequestBody SaveAPITestRequest request) { + apiTestService.checkName(request); + } + + @PostMapping(value = "/import", consumes = {"multipart/form-data"}) + @RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR) + public ApiTest testCaseImport(@RequestPart(value = "file", required = false) MultipartFile file, @RequestPart("request") ApiTestImportRequest request) { + return apiTestService.apiTestImport(file, request); + } + + @PostMapping("/dubbo/providers") + public List getProviders(@RequestBody RegistryCenter registry) { + return apiTestService.getProviders(registry); + } + + @PostMapping("/list/schedule/{goPage}/{pageSize}") + public List listSchedule(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryScheduleRequest request) { + Page page = PageHelper.startPage(goPage, pageSize, true); + return apiTestService.listSchedule(request); + } + + @PostMapping("/list/schedule") + public List listSchedule(@RequestBody QueryScheduleRequest request) { + return apiTestService.listSchedule(request); + } + + @PostMapping("/getJsonPaths") + public List getJsonPaths(@RequestBody QueryJsonPathRequest request) { + return getListJson(request.getJsonPath()); + } +} diff --git a/backend/src/main/java/io/metersphere/api/dto/QueryJsonPathRequest.java b/backend/src/main/java/io/metersphere/api/dto/QueryJsonPathRequest.java new file mode 100644 index 0000000000..b6c391abf3 --- /dev/null +++ b/backend/src/main/java/io/metersphere/api/dto/QueryJsonPathRequest.java @@ -0,0 +1,12 @@ +package io.metersphere.api.dto; + +import java.io.Serializable; + +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class QueryJsonPathRequest implements Serializable { + private String jsonPath; +} diff --git a/backend/src/main/java/io/metersphere/api/dto/scenario/assertions/AssertionJSR223.java b/backend/src/main/java/io/metersphere/api/dto/scenario/assertions/AssertionJSR223.java new file mode 100644 index 0000000000..e492a46a59 --- /dev/null +++ b/backend/src/main/java/io/metersphere/api/dto/scenario/assertions/AssertionJSR223.java @@ -0,0 +1,20 @@ +package io.metersphere.api.dto.scenario.assertions; + +import lombok.Data; +import lombok.EqualsAndHashCode; + +@EqualsAndHashCode(callSuper = true) +@Data +public class AssertionJSR223 extends AssertionType { + private String variable; + private String operator; + private String value; + private String desc; + private String name; + private String script; + private String language; + + public AssertionJSR223() { + setType(AssertionType.JSR223); + } +} diff --git a/backend/src/main/java/io/metersphere/api/dto/scenario/assertions/AssertionType.java b/backend/src/main/java/io/metersphere/api/dto/scenario/assertions/AssertionType.java index 443ea969a9..207c960234 100644 --- a/backend/src/main/java/io/metersphere/api/dto/scenario/assertions/AssertionType.java +++ b/backend/src/main/java/io/metersphere/api/dto/scenario/assertions/AssertionType.java @@ -7,6 +7,7 @@ public class AssertionType { public final static String REGEX = "Regex"; public final static String DURATION = "Duration"; public final static String JSON_PATH = "JSONPath"; + public final static String JSR223 = "JSR223"; public final static String TEXT = "Text"; private String type; diff --git a/backend/src/main/java/io/metersphere/api/dto/scenario/assertions/Assertions.java b/backend/src/main/java/io/metersphere/api/dto/scenario/assertions/Assertions.java index d910c0af13..ecbe07467b 100644 --- a/backend/src/main/java/io/metersphere/api/dto/scenario/assertions/Assertions.java +++ b/backend/src/main/java/io/metersphere/api/dto/scenario/assertions/Assertions.java @@ -8,5 +8,6 @@ import java.util.List; public class Assertions { private List regex; private List jsonPath; + private List jsr223; private AssertionDuration duration; } diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseCommentMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseCommentMapper.java new file mode 100644 index 0000000000..60f44b7202 --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseCommentMapper.java @@ -0,0 +1,17 @@ +package io.metersphere.base.mapper.ext; + +import io.metersphere.track.dto.TestCaseCommentDTO; +import org.springframework.data.repository.query.Param; + +import java.util.List; + +public interface ExtTestCaseCommentMapper { + + /** + * 获取用例的评论 + * @param caseId + * @return + */ + List getCaseComments(@Param("caseId") String caseId); + +} diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseCommentMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseCommentMapper.xml new file mode 100644 index 0000000000..9a92b100cd --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseCommentMapper.xml @@ -0,0 +1,14 @@ + + + + + + + + + \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseReviewMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseReviewMapper.xml index 1ff3351f72..6c576ba1a2 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseReviewMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseReviewMapper.xml @@ -6,11 +6,11 @@ parameterType="io.metersphere.track.request.testreview.QueryCaseReviewRequest"> select distinct test_case_review.id, test_case_review.name, test_case_review.creator, test_case_review.status, test_case_review.create_time, test_case_review.update_time, test_case_review.end_time, - test_case_review.description - from test_case_review, project, test_case_review_project + test_case_review.description, user.name as creatorName + from test_case_review join test_case_review_project on test_case_review.id = test_case_review_project.review_id + join project on test_case_review_project.project_id = project.id + left join user on test_case_review.creator = user.id - test_case_review.id = test_case_review_project.review_id - and test_case_review_project.project_id = project.id and test_case_review.name like CONCAT('%', #{request.name},'%') diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.xml index 62571a403a..4737fed2b2 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.xml @@ -94,6 +94,12 @@ + + and test_plan_test_case.executor + + + +