Merge branch 'v1.1' of https://github.com/metersphere/server into v1.1
This commit is contained in:
commit
2bc11e4f4e
|
@ -6,11 +6,11 @@ ARG MS_VERSION=dev
|
||||||
|
|
||||||
RUN mkdir -p /opt/apps && mkdir -p /opt/jmeter
|
RUN mkdir -p /opt/apps && mkdir -p /opt/jmeter
|
||||||
|
|
||||||
ADD backend/target/backend-1.0.jar /opt/apps
|
ADD backend/target/backend-1.1.jar /opt/apps
|
||||||
|
|
||||||
ADD backend/target/classes/jmeter/ /opt/jmeter/
|
ADD backend/target/classes/jmeter/ /opt/jmeter/
|
||||||
|
|
||||||
ENV JAVA_APP_JAR=/opt/apps/backend-1.0.jar
|
ENV JAVA_APP_JAR=/opt/apps/backend-1.1.jar
|
||||||
|
|
||||||
ENV AB_OFF=true
|
ENV AB_OFF=true
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>metersphere-server</artifactId>
|
<artifactId>metersphere-server</artifactId>
|
||||||
<groupId>io.metersphere</groupId>
|
<groupId>io.metersphere</groupId>
|
||||||
<version>1.0</version>
|
<version>1.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
@ -376,4 +376,4 @@
|
||||||
<url>https://maven.pkg.github.com/metersphere/jmeter-plugins-for-apache-dubbo</url>
|
<url>https://maven.pkg.github.com/metersphere/jmeter-plugins-for-apache-dubbo</url>
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -3,6 +3,7 @@ package io.metersphere.base.mapper.ext;
|
||||||
import io.metersphere.base.domain.TestCase;
|
import io.metersphere.base.domain.TestCase;
|
||||||
import io.metersphere.track.request.testcase.QueryTestCaseRequest;
|
import io.metersphere.track.request.testcase.QueryTestCaseRequest;
|
||||||
import io.metersphere.track.dto.TestCaseDTO;
|
import io.metersphere.track.dto.TestCaseDTO;
|
||||||
|
import io.metersphere.track.request.testcase.TestCaseBatchRequest;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -15,7 +16,7 @@ public interface ExtTestCaseMapper {
|
||||||
|
|
||||||
List<TestCaseDTO> listByMethod(@Param("request") QueryTestCaseRequest request);
|
List<TestCaseDTO> listByMethod(@Param("request") QueryTestCaseRequest request);
|
||||||
|
|
||||||
List<TestCaseDTO> listBytestCaseIds(@Param("request") QueryTestCaseRequest request);
|
List<TestCaseDTO> listBytestCaseIds(@Param("request") TestCaseBatchRequest request);
|
||||||
|
|
||||||
TestCase getMaxNumByProjectId(@Param("projectId") String projectId);
|
TestCase getMaxNumByProjectId(@Param("projectId") String projectId);
|
||||||
|
|
||||||
|
|
|
@ -202,9 +202,9 @@
|
||||||
select test_case.*,api_test.name as apiName,load_test.name AS performName from test_case left join api_test on
|
select test_case.*,api_test.name as apiName,load_test.name AS performName from test_case left join api_test on
|
||||||
test_case.test_id=api_test.id left join load_test on test_case.test_id=load_test.id
|
test_case.test_id=api_test.id left join load_test on test_case.test_id=load_test.id
|
||||||
<where>
|
<where>
|
||||||
<if test="request.testCaseIds!=null and request.testCaseIds.size() > 0">
|
<if test="request.ids!=null and request.ids.size() > 0">
|
||||||
and test_case.id in
|
and test_case.id in
|
||||||
<foreach collection="request.testCaseIds" open="(" close=")" separator="," item="id">
|
<foreach collection="request.ids" open="(" close=")" separator="," item="id">
|
||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
|
|
|
@ -15,12 +15,11 @@ import io.metersphere.performance.controller.request.ReportRequest;
|
||||||
import io.metersphere.performance.service.ReportService;
|
import io.metersphere.performance.service.ReportService;
|
||||||
import org.apache.shiro.authz.annotation.Logical;
|
import org.apache.shiro.authz.annotation.Logical;
|
||||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||||
import org.springframework.http.HttpHeaders;
|
|
||||||
import org.springframework.http.MediaType;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.OutputStream;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
|
@ -112,11 +111,15 @@ public class PerformanceReportController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("log/download/{reportId}/{resourceId}")
|
@GetMapping("log/download/{reportId}/{resourceId}")
|
||||||
public ResponseEntity<byte[]> downloadLog(@PathVariable String reportId, @PathVariable String resourceId) {
|
public void downloadLog(@PathVariable String reportId, @PathVariable String resourceId, HttpServletResponse response) throws Exception {
|
||||||
byte[] bytes = reportService.downloadLog(reportId, resourceId);
|
try (OutputStream outputStream = response.getOutputStream()) {
|
||||||
return ResponseEntity.ok()
|
List<String> content = reportService.downloadLog(reportId, resourceId);
|
||||||
.contentType(MediaType.parseMediaType("application/octet-stream"))
|
response.setContentType("application/x-download");
|
||||||
.header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"jmeter.log\"")
|
response.addHeader("Content-Disposition", "attachment;filename=jmeter.log");
|
||||||
.body(bytes);
|
for (String log : content) {
|
||||||
|
outputStream.write(log.getBytes());
|
||||||
|
}
|
||||||
|
outputStream.flush();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@ -210,14 +211,13 @@ public class ReportService {
|
||||||
return loadTestReportLogMapper.selectByExampleWithBLOBs(example);
|
return loadTestReportLogMapper.selectByExampleWithBLOBs(example);
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] downloadLog(String reportId, String resourceId) {
|
public List<String> downloadLog(String reportId, String resourceId) {
|
||||||
LoadTestReportLogExample example = new LoadTestReportLogExample();
|
LoadTestReportLogExample example = new LoadTestReportLogExample();
|
||||||
example.createCriteria().andReportIdEqualTo(reportId).andResourceIdEqualTo(resourceId);
|
example.createCriteria().andReportIdEqualTo(reportId).andResourceIdEqualTo(resourceId);
|
||||||
example.setOrderByClause("part desc");
|
example.setOrderByClause("part desc");
|
||||||
List<LoadTestReportLog> loadTestReportLogs = loadTestReportLogMapper.selectByExampleWithBLOBs(example);
|
List<LoadTestReportLog> loadTestReportLogs = loadTestReportLogMapper.selectByExampleWithBLOBs(example);
|
||||||
|
|
||||||
String content = loadTestReportLogs.stream().map(LoadTestReportLog::getContent).reduce("", (a, b) -> a + b);
|
return loadTestReportLogs.stream().map(LoadTestReportLog::getContent).collect(Collectors.toList());
|
||||||
return content.getBytes();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public LoadTestReport getReport(String reportId) {
|
public LoadTestReport getReport(String reportId) {
|
||||||
|
|
|
@ -110,9 +110,9 @@ public class TestCaseController {
|
||||||
public void testCaseTemplateExport(HttpServletResponse response){
|
public void testCaseTemplateExport(HttpServletResponse response){
|
||||||
testCaseService.testCaseTemplateExport(response);
|
testCaseService.testCaseTemplateExport(response);
|
||||||
}
|
}
|
||||||
@GetMapping("/export/testCase/{testCaseIds}")
|
@PostMapping("/export/testcase")
|
||||||
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
|
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
|
||||||
public void testCaseExport(HttpServletResponse response,QueryTestCaseRequest request){
|
public void testCaseExport( HttpServletResponse response,@RequestBody TestCaseBatchRequest request){
|
||||||
testCaseService.testCaseExport(response,request);
|
testCaseService.testCaseExport(response,request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -310,7 +310,7 @@ public class TestCaseService {
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCaseExport(HttpServletResponse response, QueryTestCaseRequest request) {
|
public void testCaseExport(HttpServletResponse response, TestCaseBatchRequest request) {
|
||||||
EasyExcelExporter easyExcelExporter = null;
|
EasyExcelExporter easyExcelExporter = null;
|
||||||
try {
|
try {
|
||||||
easyExcelExporter = new EasyExcelExporter(TestCaseExcelData.class);
|
easyExcelExporter = new EasyExcelExporter(TestCaseExcelData.class);
|
||||||
|
@ -323,7 +323,7 @@ public class TestCaseService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<TestCaseExcelData> generateTestCaseExcel(QueryTestCaseRequest request) {
|
private List<TestCaseExcelData> generateTestCaseExcel(TestCaseBatchRequest request) {
|
||||||
List<TestCaseDTO> TestCaseList = extTestCaseMapper.listBytestCaseIds(request);
|
List<TestCaseDTO> TestCaseList = extTestCaseMapper.listBytestCaseIds(request);
|
||||||
List<TestCaseExcelData> list = new ArrayList<>();
|
List<TestCaseExcelData> list = new ArrayList<>();
|
||||||
SessionUser user = SessionUtils.getUser();
|
SessionUser user = SessionUtils.getUser();
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>metersphere-server</artifactId>
|
<artifactId>metersphere-server</artifactId>
|
||||||
<groupId>io.metersphere</groupId>
|
<groupId>io.metersphere</groupId>
|
||||||
<version>1.0</version>
|
<version>1.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
|
@ -292,9 +292,10 @@
|
||||||
},
|
},
|
||||||
exportTestCase() {
|
exportTestCase() {
|
||||||
let config = {
|
let config = {
|
||||||
url: '/test/case/export/testCase/' + [...this.selectIds],
|
url: '/test/case/export/testcase',
|
||||||
method: 'get',
|
method: 'post',
|
||||||
responseType: 'blob'
|
responseType: 'blob',
|
||||||
|
data: {ids: [...this.selectIds]}
|
||||||
};
|
};
|
||||||
this.result = this.$request(config).then(response => {
|
this.result = this.$request(config).then(response => {
|
||||||
const filename = this.$t('test_track.case.test_case') + ".xlsx";
|
const filename = this.$t('test_track.case.test_case') + ".xlsx";
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -4,7 +4,7 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>io.metersphere</groupId>
|
<groupId>io.metersphere</groupId>
|
||||||
<artifactId>metersphere-server</artifactId>
|
<artifactId>metersphere-server</artifactId>
|
||||||
<version>1.0</version>
|
<version>1.1</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
|
|
Loading…
Reference in New Issue