This commit is contained in:
chenjianxing 2020-05-06 16:21:25 +08:00
commit 52ead84a20
97 changed files with 1314 additions and 5365 deletions

1
backend/.gitignore vendored
View File

@ -26,6 +26,7 @@ yarn-error.log*
src/main/resources/static
src/main/resources/templates
src/test/
target
.settings
.project

View File

@ -39,6 +39,12 @@
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
@ -60,6 +66,7 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
@ -128,12 +135,6 @@
<artifactId>slf4j-simple</artifactId>
</dependency>
<dependency>
<groupId>com.opencsv</groupId>
<artifactId>opencsv</artifactId>
<version>5.1</version>
</dependency>
<!-- jmeter -->
<!-- <dependency>-->
<!-- <groupId>org.apache.jmeter</groupId>-->
@ -255,6 +256,11 @@
<artifactId>mysql-connector-java</artifactId>
<version>5.1.41</version>
</dependency>
<dependency>
<groupId>com.itfsw</groupId>
<artifactId>mybatis-generator-plugin</artifactId>
<version>1.3.8</version>
</dependency>
</dependencies>
</plugin>
</plugins>

View File

@ -7,6 +7,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.annotation.PropertySource;
@SpringBootApplication(exclude = {QuartzAutoConfiguration.class})
@ServletComponentScan
@ -14,6 +15,7 @@ import org.springframework.boot.web.servlet.ServletComponentScan;
KafkaProperties.class,
JmeterProperties.class
})
@PropertySource(value = {"file:/opt/metersphere/conf/metersphere.properties"}, encoding = "UTF-8", ignoreResourceNotFound = true)
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);

View File

@ -0,0 +1,45 @@
package io.metersphere.api.jmeter;
import org.apache.jmeter.assertions.AssertionResult;
import org.apache.jmeter.samplers.SampleResult;
import org.apache.jmeter.visualizers.backend.AbstractBackendListenerClient;
import org.apache.jmeter.visualizers.backend.BackendListenerContext;
import java.io.Serializable;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
public class APIBackendListenerClient extends AbstractBackendListenerClient implements Serializable {
private final AtomicInteger count = new AtomicInteger();
@Override
public void handleSampleResults(List<SampleResult> sampleResults, BackendListenerContext context) {
System.out.println(context.getParameter("id"));
sampleResults.forEach(result -> {
for (AssertionResult assertionResult : result.getAssertionResults()) {
System.out.println(assertionResult.getName() + ": " + assertionResult.isError());
System.out.println(assertionResult.getName() + ": " + assertionResult.isFailure());
System.out.println(assertionResult.getName() + ": " + assertionResult.getFailureMessage());
}
println("getSampleLabel", result.getSampleLabel());
println("getErrorCount", result.getErrorCount());
println("getRequestHeaders", result.getRequestHeaders());
println("getResponseHeaders", result.getResponseHeaders());
println("getSampleLabel", result.getSampleLabel());
println("getSampleLabel", result.getSampleLabel());
println("getResponseCode", result.getResponseCode());
println("getResponseCode size", result.getResponseData().length);
println("getLatency", result.getLatency());
println("end - start", result.getEndTime() - result.getStartTime());
println("getTimeStamp", result.getTimeStamp());
println("getTime", result.getTime());
});
System.err.println(count.addAndGet(sampleResults.size()));
}
private void println(String name, Object value) {
System.out.println(name + ": " + value);
}
}

View File

@ -0,0 +1,35 @@
package io.metersphere.api.jmeter;
import io.metersphere.commons.exception.MSException;
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 java.io.InputStream;
import java.lang.reflect.Field;
@Service
public class JMeterService {
public void run(InputStream is) {
JMeterUtils.loadJMeterProperties("/Users/q4speed/Downloads/apache-jmeter-5.2.1/bin/jmeter.properties");
JMeterUtils.setJMeterHome("/Users/q4speed/Downloads/apache-jmeter-5.2.1");
try {
Object scriptWrapper = SaveService.loadElement(is);
HashTree testPlan = getHashTree(scriptWrapper);
LocalRunner runner = new LocalRunner(testPlan);
runner.run();
} catch (Exception e) {
MSException.throwException(Translator.get("api_load_script_error"));
}
}
public HashTree getHashTree(Object scriptWrapper) throws Exception {
Field field = scriptWrapper.getClass().getDeclaredField("testPlan");
field.setAccessible(true);
return (HashTree) field.get(scriptWrapper);
}
}

View File

@ -0,0 +1,24 @@
package io.metersphere.api.jmeter;
import org.apache.jmeter.engine.JMeterEngine;
import org.apache.jmeter.engine.JMeterEngineException;
import org.apache.jmeter.engine.StandardJMeterEngine;
import org.apache.jorphan.collections.HashTree;
public class LocalRunner {
private final HashTree jmxTree;
public LocalRunner(HashTree jmxTree) {
this.jmxTree = jmxTree;
}
public void run() {
JMeterEngine engine = new StandardJMeterEngine();
engine.configure(jmxTree);
try {
engine.runTest();
} catch (JMeterEngineException e) {
engine.stopTest(true);
}
}
}

View File

@ -4,6 +4,7 @@ import io.metersphere.api.dto.APITestResult;
import io.metersphere.api.dto.DeleteAPITestRequest;
import io.metersphere.api.dto.QueryAPITestRequest;
import io.metersphere.api.dto.SaveAPITestRequest;
import io.metersphere.api.jmeter.JMeterService;
import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.ApiTestFileMapper;
import io.metersphere.base.mapper.ApiTestMapper;
@ -18,6 +19,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
@ -36,6 +38,8 @@ public class ApiTestService {
private ApiTestFileMapper apiTestFileMapper;
@Resource
private FileService fileService;
@Resource
private JMeterService jMeterService;
public List<APITestResult> list(QueryAPITestRequest request) {
return extApiTestMapper.list(request);
@ -47,7 +51,7 @@ public class ApiTestService {
}
public String save(SaveAPITestRequest request, List<MultipartFile> files) {
if (files == null) {
if (files == null || files.isEmpty()) {
throw new IllegalArgumentException(Translator.get("file_cannot_be_null"));
}
@ -75,11 +79,26 @@ public class ApiTestService {
}
public void delete(DeleteAPITestRequest request) {
deleteFileByTestId(request.getId());
apiTestMapper.deleteByPrimaryKey(request.getId());
}
public String run(SaveAPITestRequest request, List<MultipartFile> files) {
return save(request, files);
String id = save(request, files);
try {
changeStatus(request.getId(), APITestStatus.Running);
jMeterService.run(files.get(0).getInputStream());
} catch (IOException e) {
MSException.throwException(Translator.get("api_load_script_error"));
}
return id;
}
public void changeStatus(String id, APITestStatus status) {
ApiTestWithBLOBs apiTest = new ApiTestWithBLOBs();
apiTest.setId(id);
apiTest.setStatus(status.name());
apiTestMapper.updateByPrimaryKeySelective(apiTest);
}
private ApiTestWithBLOBs updateTest(SaveAPITestRequest request) {
@ -113,7 +132,7 @@ public class ApiTestService {
return test;
}
public void deleteFileByTestId(String testId) {
private void deleteFileByTestId(String testId) {
ApiTestFileExample ApiTestFileExample = new ApiTestFileExample();
ApiTestFileExample.createCriteria().andTestIdEqualTo(testId);
final List<ApiTestFile> ApiTestFiles = apiTestFileMapper.selectByExample(ApiTestFileExample);
@ -121,9 +140,20 @@ public class ApiTestService {
if (!CollectionUtils.isEmpty(ApiTestFiles)) {
final List<String> fileIds = ApiTestFiles.stream().map(ApiTestFile::getFileId).collect(Collectors.toList());
fileService.deleteFileByIds(fileIds);
}
}
private ApiTestFile getFileByTestId(String testId) {
ApiTestFileExample ApiTestFileExample = new ApiTestFileExample();
ApiTestFileExample.createCriteria().andTestIdEqualTo(testId);
final List<ApiTestFile> ApiTestFiles = apiTestFileMapper.selectByExample(ApiTestFileExample);
apiTestFileMapper.selectByExample(ApiTestFileExample);
if (!CollectionUtils.isEmpty(ApiTestFiles)) {
return ApiTestFiles.get(0);
} else {
return null;
}
}
}

View File

@ -1,7 +1,10 @@
package io.metersphere.base.domain;
import lombok.Data;
import java.io.Serializable;
@Data
public class ApiTest implements Serializable {
private String id;
@ -18,60 +21,4 @@ public class ApiTest implements Serializable {
private Long updateTime;
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 getProjectId() {
return projectId;
}
public void setProjectId(String projectId) {
this.projectId = projectId == null ? null : projectId.trim();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description == null ? null : description.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;
}
}

View File

@ -1,27 +1,14 @@
package io.metersphere.base.domain;
import lombok.Data;
import java.io.Serializable;
@Data
public class ApiTestFile implements Serializable {
private String testId;
private String fileId;
private static final long serialVersionUID = 1L;
public String getTestId() {
return testId;
}
public void setTestId(String testId) {
this.testId = testId == null ? null : testId.trim();
}
public String getFileId() {
return fileId;
}
public void setFileId(String fileId) {
this.fileId = fileId == null ? null : fileId.trim();
}
}

View File

@ -1,7 +1,10 @@
package io.metersphere.base.domain;
import lombok.Data;
import java.io.Serializable;
@Data
public class ApiTestReport implements Serializable {
private String id;
@ -20,68 +23,4 @@ public class ApiTestReport implements Serializable {
private String content;
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 getTestId() {
return testId;
}
public void setTestId(String testId) {
this.testId = testId == null ? null : testId.trim();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description == null ? null : description.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 String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status == null ? null : status.trim();
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content == null ? null : content.trim();
}
}

View File

@ -1,27 +1,18 @@
package io.metersphere.base.domain;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.io.Serializable;
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ApiTestWithBLOBs extends ApiTest implements Serializable {
private String scenarioDefinition;
private String schedule;
private static final long serialVersionUID = 1L;
public String getScenarioDefinition() {
return scenarioDefinition;
}
public void setScenarioDefinition(String scenarioDefinition) {
this.scenarioDefinition = scenarioDefinition == null ? null : scenarioDefinition.trim();
}
public String getSchedule() {
return schedule;
}
public void setSchedule(String schedule) {
this.schedule = schedule == null ? null : schedule.trim();
}
}

View File

@ -1,27 +1,14 @@
package io.metersphere.base.domain;
import lombok.Data;
import java.io.Serializable;
@Data
public class FileContent implements Serializable {
private String fileId;
private byte[] file;
private static final long serialVersionUID = 1L;
public String getFileId() {
return fileId;
}
public void setFileId(String fileId) {
this.fileId = fileId == null ? null : fileId.trim();
}
public byte[] getFile() {
return file;
}
public void setFile(byte[] file) {
this.file = file;
}
}

View File

@ -1,7 +1,10 @@
package io.metersphere.base.domain;
import lombok.Data;
import java.io.Serializable;
@Data
public class FileMetadata implements Serializable {
private String id;
@ -16,52 +19,4 @@ public class FileMetadata implements Serializable {
private Long size;
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 getType() {
return type;
}
public void setType(String type) {
this.type = type == null ? null : type.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 Long getSize() {
return size;
}
public void setSize(Long size) {
this.size = size;
}
}

View File

@ -1,7 +1,10 @@
package io.metersphere.base.domain;
import lombok.Data;
import java.io.Serializable;
@Data
public class LoadTest implements Serializable {
private String id;
@ -20,68 +23,4 @@ public class LoadTest implements Serializable {
private String testResourcePoolId;
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 getProjectId() {
return projectId;
}
public void setProjectId(String projectId) {
this.projectId = projectId == null ? null : projectId.trim();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description == null ? null : description.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 String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status == null ? null : status.trim();
}
public String getTestResourcePoolId() {
return testResourcePoolId;
}
public void setTestResourcePoolId(String testResourcePoolId) {
this.testResourcePoolId = testResourcePoolId == null ? null : testResourcePoolId.trim();
}
}

View File

@ -1,27 +1,14 @@
package io.metersphere.base.domain;
import lombok.Data;
import java.io.Serializable;
@Data
public class LoadTestFile implements Serializable {
private String testId;
private String fileId;
private static final long serialVersionUID = 1L;
public String getTestId() {
return testId;
}
public void setTestId(String testId) {
this.testId = testId == null ? null : testId.trim();
}
public String getFileId() {
return fileId;
}
public void setFileId(String fileId) {
this.fileId = fileId == null ? null : fileId.trim();
}
}

View File

@ -1,7 +1,10 @@
package io.metersphere.base.domain;
import lombok.Data;
import java.io.Serializable;
@Data
public class LoadTestReport implements Serializable {
private String id;
@ -16,52 +19,4 @@ public class LoadTestReport implements Serializable {
private String status;
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 getTestId() {
return testId;
}
public void setTestId(String testId) {
this.testId = testId == null ? null : testId.trim();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.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 String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status == null ? null : status.trim();
}
}

View File

@ -1,27 +1,14 @@
package io.metersphere.base.domain;
import lombok.Data;
import java.io.Serializable;
@Data
public class LoadTestReportDetail implements Serializable {
private String reportId;
private String content;
private static final long serialVersionUID = 1L;
public String getReportId() {
return reportId;
}
public void setReportId(String reportId) {
this.reportId = reportId == null ? null : reportId.trim();
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content == null ? null : content.trim();
}
}

View File

@ -1,7 +1,10 @@
package io.metersphere.base.domain;
import lombok.Data;
import java.io.Serializable;
@Data
public class LoadTestReportLog implements Serializable {
private Long id;
@ -12,36 +15,4 @@ public class LoadTestReportLog implements Serializable {
private String content;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getReportId() {
return reportId;
}
public void setReportId(String reportId) {
this.reportId = reportId == null ? null : reportId.trim();
}
public String getResourceId() {
return resourceId;
}
public void setResourceId(String resourceId) {
this.resourceId = resourceId == null ? null : resourceId.trim();
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content == null ? null : content.trim();
}
}

View File

@ -1,7 +1,10 @@
package io.metersphere.base.domain;
import lombok.Data;
import java.io.Serializable;
@Data
public class LoadTestReportResult implements Serializable {
private Long id;
@ -12,36 +15,4 @@ public class LoadTestReportResult implements Serializable {
private String reportValue;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getReportId() {
return reportId;
}
public void setReportId(String reportId) {
this.reportId = reportId == null ? null : reportId.trim();
}
public String getReportKey() {
return reportKey;
}
public void setReportKey(String reportKey) {
this.reportKey = reportKey == null ? null : reportKey.trim();
}
public String getReportValue() {
return reportValue;
}
public void setReportValue(String reportValue) {
this.reportValue = reportValue == null ? null : reportValue.trim();
}
}

View File

@ -1,27 +1,18 @@
package io.metersphere.base.domain;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.io.Serializable;
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class LoadTestReportWithBLOBs extends LoadTestReport implements Serializable {
private String description;
private String content;
private static final long serialVersionUID = 1L;
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description == null ? null : description.trim();
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content == null ? null : content.trim();
}
}

View File

@ -1,7 +1,14 @@
package io.metersphere.base.domain;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.io.Serializable;
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class LoadTestWithBLOBs extends LoadTest implements Serializable {
private String loadConfiguration;
@ -10,28 +17,4 @@ public class LoadTestWithBLOBs extends LoadTest implements Serializable {
private String schedule;
private static final long serialVersionUID = 1L;
public String getLoadConfiguration() {
return loadConfiguration;
}
public void setLoadConfiguration(String loadConfiguration) {
this.loadConfiguration = loadConfiguration == null ? null : loadConfiguration.trim();
}
public String getAdvancedConfiguration() {
return advancedConfiguration;
}
public void setAdvancedConfiguration(String advancedConfiguration) {
this.advancedConfiguration = advancedConfiguration == null ? null : advancedConfiguration.trim();
}
public String getSchedule() {
return schedule;
}
public void setSchedule(String schedule) {
this.schedule = schedule == null ? null : schedule.trim();
}
}

View File

@ -1,7 +1,10 @@
package io.metersphere.base.domain;
import lombok.Data;
import java.io.Serializable;
@Data
public class Organization implements Serializable {
private String id;
@ -14,44 +17,4 @@ public class Organization implements Serializable {
private Long updateTime;
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 getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description == null ? null : description.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;
}
}

View File

@ -1,7 +1,10 @@
package io.metersphere.base.domain;
import lombok.Data;
import java.io.Serializable;
@Data
public class Project implements Serializable {
private String id;
@ -16,52 +19,4 @@ public class Project implements Serializable {
private Long updateTime;
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 getWorkspaceId() {
return workspaceId;
}
public void setWorkspaceId(String workspaceId) {
this.workspaceId = workspaceId == null ? null : workspaceId.trim();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description == null ? null : description.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;
}
}

View File

@ -1,7 +1,10 @@
package io.metersphere.base.domain;
import lombok.Data;
import java.io.Serializable;
@Data
public class Role implements Serializable {
private String id;
@ -16,52 +19,4 @@ public class Role implements Serializable {
private Long updateTime;
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 getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description == null ? null : description.trim();
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type == null ? null : type.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;
}
}

View File

@ -1,7 +1,10 @@
package io.metersphere.base.domain;
import lombok.Data;
import java.io.Serializable;
@Data
public class SystemParameter implements Serializable {
private String paramKey;
@ -12,36 +15,4 @@ public class SystemParameter implements Serializable {
private Integer sort;
private static final long serialVersionUID = 1L;
public String getParamKey() {
return paramKey;
}
public void setParamKey(String paramKey) {
this.paramKey = paramKey == null ? null : paramKey.trim();
}
public String getParamValue() {
return paramValue;
}
public void setParamValue(String paramValue) {
this.paramValue = paramValue == null ? null : paramValue.trim();
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type == null ? null : type.trim();
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
}

View File

@ -1,7 +1,10 @@
package io.metersphere.base.domain;
import lombok.Data;
import java.io.Serializable;
@Data
public class TestCase implements Serializable {
private String id;
@ -28,100 +31,4 @@ public class TestCase implements Serializable {
private Long updateTime;
private static final long serialVersionUID = 1L;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id == null ? null : id.trim();
}
public Integer getNodeId() {
return nodeId;
}
public void setNodeId(Integer nodeId) {
this.nodeId = nodeId;
}
public String getNodePath() {
return nodePath;
}
public void setNodePath(String nodePath) {
this.nodePath = nodePath == null ? null : nodePath.trim();
}
public String getProjectId() {
return projectId;
}
public void setProjectId(String projectId) {
this.projectId = projectId == null ? null : projectId.trim();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type == null ? null : type.trim();
}
public String getMaintainer() {
return maintainer;
}
public void setMaintainer(String maintainer) {
this.maintainer = maintainer == null ? null : maintainer.trim();
}
public String getPriority() {
return priority;
}
public void setPriority(String priority) {
this.priority = priority == null ? null : priority.trim();
}
public String getMethod() {
return method;
}
public void setMethod(String method) {
this.method = method == null ? null : method.trim();
}
public String getPrerequisite() {
return prerequisite;
}
public void setPrerequisite(String prerequisite) {
this.prerequisite = prerequisite == null ? null : prerequisite.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;
}
}

View File

@ -1,7 +1,10 @@
package io.metersphere.base.domain;
import lombok.Data;
import java.io.Serializable;
@Data
public class TestCaseNode implements Serializable {
private Integer id;
@ -18,60 +21,4 @@ public class TestCaseNode implements Serializable {
private Long updateTime;
private static final long serialVersionUID = 1L;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getProjectId() {
return projectId;
}
public void setProjectId(String projectId) {
this.projectId = projectId == null ? null : projectId.trim();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public Integer getpId() {
return pId;
}
public void setpId(Integer pId) {
this.pId = pId;
}
public Integer getLevel() {
return level;
}
public void setLevel(Integer level) {
this.level = level;
}
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,7 +1,9 @@
package io.metersphere.base.domain;
import java.io.Serializable;
import lombok.Data;
@Data
public class TestCaseReport implements Serializable {
private Long id;
@ -16,52 +18,4 @@ public class TestCaseReport implements Serializable {
private String content;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public String getPlanId() {
return planId;
}
public void setPlanId(String planId) {
this.planId = planId == null ? null : planId.trim();
}
public Long getStartTime() {
return startTime;
}
public void setStartTime(Long startTime) {
this.startTime = startTime;
}
public Long getEndTime() {
return endTime;
}
public void setEndTime(Long endTime) {
this.endTime = endTime;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content == null ? null : content.trim();
}
}

View File

@ -1,7 +1,9 @@
package io.metersphere.base.domain;
import java.io.Serializable;
import lombok.Data;
@Data
public class TestCaseReportTemplate implements Serializable {
private Long id;
@ -16,52 +18,4 @@ public class TestCaseReportTemplate implements Serializable {
private String content;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public String getWorkspaceId() {
return workspaceId;
}
public void setWorkspaceId(String workspaceId) {
this.workspaceId = workspaceId == null ? null : workspaceId.trim();
}
public Long getStartTime() {
return startTime;
}
public void setStartTime(Long startTime) {
this.startTime = startTime;
}
public Long getEndTime() {
return endTime;
}
public void setEndTime(Long endTime) {
this.endTime = endTime;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content == null ? null : content.trim();
}
}

View File

@ -1,27 +1,18 @@
package io.metersphere.base.domain;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.io.Serializable;
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class TestCaseWithBLOBs extends TestCase implements Serializable {
private String remark;
private String steps;
private static final long serialVersionUID = 1L;
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark == null ? null : remark.trim();
}
public String getSteps() {
return steps;
}
public void setSteps(String steps) {
this.steps = steps == null ? null : steps.trim();
}
}

View File

@ -1,7 +1,10 @@
package io.metersphere.base.domain;
import lombok.Data;
import java.io.Serializable;
@Data
public class TestPlan implements Serializable {
private String id;
@ -30,108 +33,4 @@ public class TestPlan implements Serializable {
private String tags;
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 getProjectId() {
return projectId;
}
public void setProjectId(String projectId) {
this.projectId = projectId == null ? null : projectId.trim();
}
public String getWorkspaceId() {
return workspaceId;
}
public void setWorkspaceId(String workspaceId) {
this.workspaceId = workspaceId == null ? null : workspaceId.trim();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description == null ? null : description.trim();
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status == null ? null : status.trim();
}
public String getStage() {
return stage;
}
public void setStage(String stage) {
this.stage = stage == null ? null : stage.trim();
}
public String getPrincipal() {
return principal;
}
public void setPrincipal(String principal) {
this.principal = principal == null ? null : principal.trim();
}
public String getTestCaseMatchRule() {
return testCaseMatchRule;
}
public void setTestCaseMatchRule(String testCaseMatchRule) {
this.testCaseMatchRule = testCaseMatchRule == null ? null : testCaseMatchRule.trim();
}
public String getExecutorMatchRule() {
return executorMatchRule;
}
public void setExecutorMatchRule(String executorMatchRule) {
this.executorMatchRule = executorMatchRule == null ? null : executorMatchRule.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 String getTags() {
return tags;
}
public void setTags(String tags) {
this.tags = tags == null ? null : tags.trim();
}
}

View File

@ -1,7 +1,10 @@
package io.metersphere.base.domain;
import lombok.Data;
import java.io.Serializable;
@Data
public class TestPlanTestCase implements Serializable {
private Integer id;
@ -22,76 +25,4 @@ public class TestPlanTestCase implements Serializable {
private String results;
private static final long serialVersionUID = 1L;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getPlanId() {
return planId;
}
public void setPlanId(String planId) {
this.planId = planId == null ? null : planId.trim();
}
public String getCaseId() {
return caseId;
}
public void setCaseId(String caseId) {
this.caseId = caseId == null ? null : caseId.trim();
}
public String getExecutor() {
return executor;
}
public void setExecutor(String executor) {
this.executor = executor == null ? null : executor.trim();
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status == null ? null : status.trim();
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark == null ? null : remark.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 String getResults() {
return results;
}
public void setResults(String results) {
this.results = results == null ? null : results.trim();
}
}

View File

@ -1,7 +1,10 @@
package io.metersphere.base.domain;
import lombok.Data;
import java.io.Serializable;
@Data
public class TestResource implements Serializable {
private String id;
@ -16,52 +19,4 @@ public class TestResource implements Serializable {
private String configuration;
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 getTestResourcePoolId() {
return testResourcePoolId;
}
public void setTestResourcePoolId(String testResourcePoolId) {
this.testResourcePoolId = testResourcePoolId == null ? null : testResourcePoolId.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 String getConfiguration() {
return configuration;
}
public void setConfiguration(String configuration) {
this.configuration = configuration == null ? null : configuration.trim();
}
}

View File

@ -1,7 +1,10 @@
package io.metersphere.base.domain;
import lombok.Data;
import java.io.Serializable;
@Data
public class TestResourcePool implements Serializable {
private String id;
@ -18,60 +21,4 @@ public class TestResourcePool implements Serializable {
private Long updateTime;
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 getType() {
return type;
}
public void setType(String type) {
this.type = type == null ? null : type.trim();
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description == null ? null : description.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;
}
}

View File

@ -1,7 +1,10 @@
package io.metersphere.base.domain;
import lombok.Data;
import java.io.Serializable;
@Data
public class User implements Serializable {
private String id;
@ -26,92 +29,4 @@ public class User implements Serializable {
private String phone;
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 getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password == null ? null : password.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 String getLanguage() {
return language;
}
public void setLanguage(String language) {
this.language = language == null ? null : language.trim();
}
public String getLastWorkspaceId() {
return lastWorkspaceId;
}
public void setLastWorkspaceId(String lastWorkspaceId) {
this.lastWorkspaceId = lastWorkspaceId == null ? null : lastWorkspaceId.trim();
}
public String getLastOrganizationId() {
return lastOrganizationId;
}
public void setLastOrganizationId(String lastOrganizationId) {
this.lastOrganizationId = lastOrganizationId == null ? null : lastOrganizationId.trim();
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone == null ? null : phone.trim();
}
}

View File

@ -1,7 +1,10 @@
package io.metersphere.base.domain;
import lombok.Data;
import java.io.Serializable;
@Data
public class UserRole implements Serializable {
private String id;
@ -16,52 +19,4 @@ public class UserRole implements Serializable {
private Long updateTime;
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 getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId == null ? null : userId.trim();
}
public String getRoleId() {
return roleId;
}
public void setRoleId(String roleId) {
this.roleId = roleId == null ? null : roleId.trim();
}
public String getSourceId() {
return sourceId;
}
public void setSourceId(String sourceId) {
this.sourceId = sourceId == null ? null : sourceId.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;
}
}

View File

@ -1,7 +1,10 @@
package io.metersphere.base.domain;
import lombok.Data;
import java.io.Serializable;
@Data
public class Workspace implements Serializable {
private String id;
@ -16,52 +19,4 @@ public class Workspace implements Serializable {
private Long updateTime;
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 getOrganizationId() {
return organizationId;
}
public void setOrganizationId(String organizationId) {
this.organizationId = organizationId == null ? null : organizationId.trim();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description == null ? null : description.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;
}
}

View File

@ -102,22 +102,19 @@
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.TestCaseNode">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into test_case_node (project_id, name, p_id,
level, create_time, update_time
)
values (#{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{pId,jdbcType=INTEGER},
#{level,jdbcType=INTEGER}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}
)
insert into test_case_node (id, project_id, name,
p_id, level, create_time,
update_time)
values (#{id,jdbcType=INTEGER}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{pId,jdbcType=INTEGER}, #{level,jdbcType=INTEGER}, #{createTime,jdbcType=BIGINT},
#{updateTime,jdbcType=BIGINT})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestCaseNode">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into test_case_node
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="projectId != null">
project_id,
</if>
@ -138,6 +135,9 @@
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="projectId != null">
#{projectId,jdbcType=VARCHAR},
</if>

View File

@ -1,13 +0,0 @@
package io.metersphere.base.mapper.ext;
import io.metersphere.controller.request.resourcepool.QueryResourcePoolRequest;
import io.metersphere.dto.TestResourcePoolDTO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ExtTestReourcePoolMapper {
List<TestResourcePoolDTO> listResourcePools(@Param("request") QueryResourcePoolRequest request);
// List<TestResource> listResourcesByPoolId(@Param("poolId") String poolId);
}

View File

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="io.metersphere.base.mapper.ext.ExtTestReourcePoolMapper">
<resultMap id="TestReourcePoolResultMap" type="io.metersphere.dto.TestResourcePoolDTO">
<id column="id" jdbcType="VARCHAR" property="id"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="type" jdbcType="VARCHAR" property="type"/>
<result column="description" jdbcType="VARCHAR" property="description"/>
<result column="status" jdbcType="VARCHAR" property="status"/>
<result column="create_time" jdbcType="BIGINT" property="createTime"/>
<result column="update_time" jdbcType="BIGINT" property="updateTime"/>
<collection property="resources" column="id" ofType="io.metersphere.base.domain.TestResource"
select="io.metersphere.base.mapper.ext.ExtTestReourcePoolMapper.listResourcesByPoolId">
</collection>
</resultMap>
<select id="listResourcePools" resultMap="TestReourcePoolResultMap">
SELECT * FROM test_resource_pool
<where>
<if test="request.name != null">
and test_resource_pool.name like CONCAT('%', #{request.name},'%')
</if>
</where>
</select>
<select id="listResourcesByPoolId" resultType="io.metersphere.base.domain.TestResource">
SELECT * FROM test_resource WHERE test_resource_pool_id = #{id}
</select>
</mapper>

View File

@ -1,5 +1,10 @@
package io.metersphere.commons.utils;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class MybatisInterceptorConfig {
private String modelName;
private String attrName;
@ -9,7 +14,6 @@ public class MybatisInterceptorConfig {
private String undoClass;
private String undoMethod;
public MybatisInterceptorConfig() {
}
@ -17,100 +21,25 @@ public class MybatisInterceptorConfig {
* 用时需谨慎
* 主要配置多个的时候参数少一点
*
* @param modelName
* @param modelClass
* @param attrName
*/
public MybatisInterceptorConfig(String modelName, String attrName) {
this.modelName = modelName;
public MybatisInterceptorConfig(Class<?> modelClass, String attrName) {
this.modelName = modelClass.getName();
this.attrName = attrName;
this.interceptorClass = "io.metersphere.commons.utils.EncryptUtils";
this.interceptorClass = EncryptUtils.class.getName();
this.interceptorMethod = "aesEncrypt";
this.undoClass = "io.metersphere.commons.utils.EncryptUtils";
this.undoClass = EncryptUtils.class.getName();
this.undoMethod = "aesDecrypt";
}
public MybatisInterceptorConfig(String modelName, String attrName, String attrNameForList) {
this.modelName = modelName;
public MybatisInterceptorConfig(Class<?> modelClass, String attrName, Class<?> interceptorClass, String interceptorMethod, String undoMethod) {
this.modelName = modelClass.getName();
this.attrName = attrName;
this.attrNameForList = attrNameForList;
this.interceptorClass = "io.metersphere.commons.utils.EncryptUtils";
this.interceptorMethod = "aesEncrypt";
this.undoClass = "io.metersphere.commons.utils.EncryptUtils";
this.undoMethod = "aesDecrypt";
}
public MybatisInterceptorConfig(String modelName, String attrName, String interceptorClass, String interceptorMethod, String undoMethod) {
this.modelName = modelName;
this.attrName = attrName;
this.interceptorClass = interceptorClass;
this.interceptorClass = interceptorClass.getName();
this.interceptorMethod = interceptorMethod;
this.undoClass = interceptorClass;
this.undoClass = interceptorClass.getName();
this.undoMethod = undoMethod;
}
public MybatisInterceptorConfig(String modelName, String attrName, String attrNameForList, String interceptorClass, String interceptorMethod, String undoMethod) {
this.modelName = modelName;
this.attrName = attrName;
this.attrNameForList = attrNameForList;
this.interceptorClass = interceptorClass;
this.interceptorMethod = interceptorMethod;
this.undoClass = interceptorClass;
this.undoMethod = undoMethod;
}
public String getModelName() {
return modelName;
}
public void setModelName(String modelName) {
this.modelName = modelName;
}
public String getAttrName() {
return attrName;
}
public void setAttrName(String attrName) {
this.attrName = attrName;
}
public String getAttrNameForList() {
return attrNameForList;
}
public void setAttrNameForList(String attrNameForList) {
this.attrNameForList = attrNameForList;
}
public String getInterceptorMethod() {
return interceptorMethod;
}
public void setInterceptorMethod(String interceptorMethod) {
this.interceptorMethod = interceptorMethod;
}
public String getUndoMethod() {
return undoMethod;
}
public void setUndoMethod(String undoMethod) {
this.undoMethod = undoMethod;
}
public String getInterceptorClass() {
return interceptorClass;
}
public void setInterceptorClass(String interceptorClass) {
this.interceptorClass = interceptorClass;
}
public String getUndoClass() {
return undoClass;
}
public void setUndoClass(String undoClass) {
this.undoClass = undoClass;
}
}

View File

@ -8,7 +8,7 @@ public class JmeterProperties {
public static final String JMETER_PREFIX = "jmeter";
private String image = "registry.fit2cloud.com/metersphere/jmeter-master:0.0.3";
private String image;
public String getImage() {
return image;

View File

@ -1,13 +1,15 @@
package io.metersphere.config;
import com.github.pagehelper.PageInterceptor;
import io.metersphere.base.domain.FileContent;
import io.metersphere.base.domain.TestResource;
import io.metersphere.commons.utils.CompressUtils;
import io.metersphere.commons.utils.MybatisInterceptorConfig;
import io.metersphere.interceptor.MybatisInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import java.util.ArrayList;
@ -17,7 +19,6 @@ import java.util.Properties;
@Configuration
@MapperScan(basePackages = "io.metersphere.base.mapper", sqlSessionFactoryRef = "sqlSessionFactory")
@EnableTransactionManagement
@PropertySource(value = {"file:/opt/fit2cloud/conf/metersphere.properties"}, encoding = "UTF-8", ignoreResourceNotFound = true)
public class MybatisConfig {
@Bean
@ -39,7 +40,8 @@ public class MybatisConfig {
public MybatisInterceptor dbInterceptor() {
MybatisInterceptor interceptor = new MybatisInterceptor();
List<MybatisInterceptorConfig> configList = new ArrayList<>();
configList.add(new MybatisInterceptorConfig("io.metersphere.base.domain.FileContent", "file", "io.metersphere.commons.utils.CompressUtils", "zip", "unzip"));
configList.add(new MybatisInterceptorConfig(FileContent.class, "file", CompressUtils.class, "zip", "unzip"));
configList.add(new MybatisInterceptorConfig(TestResource.class, "configuration"));
interceptor.setInterceptorConfigList(configList);
return interceptor;
}

View File

@ -54,10 +54,10 @@ public class LoginController {
List<UserRole> org = userRoles.stream().filter(ur -> ur.getRoleId().startsWith("org")).collect(Collectors.toList());
if (test.size() > 0) {
String wsId = test.get(0).getSourceId();
userService.switchUserRole(user, "workspace", wsId);
userService.switchUserRole("workspace", wsId);
} else if (org.size() > 0) {
String orgId = org.get(0).getSourceId();
userService.switchUserRole(user, "organization", orgId);
userService.switchUserRole("organization", orgId);
}
}
// 返回 userDTO

View File

@ -129,16 +129,14 @@ public class UserController {
@PostMapping("/switch/source/org/{sourceId}")
@RequiresRoles(RoleConstants.ORG_ADMIN)
public UserDTO switchOrganization(@PathVariable(value = "sourceId") String sourceId) {
UserDTO user = SessionUtils.getUser();
userService.switchUserRole(user,"organization",sourceId);
userService.switchUserRole("organization",sourceId);
return SessionUtils.getUser();
}
@PostMapping("/switch/source/ws/{sourceId}")
@RequiresRoles(value = {RoleConstants.TEST_MANAGER,RoleConstants.TEST_VIEWER,RoleConstants.TEST_USER}, logical = Logical.OR)
public UserDTO switchWorkspace(@PathVariable(value = "sourceId") String sourceId) {
UserDTO user = SessionUtils.getUser();
userService.switchUserRole(user, "workspace", sourceId);
userService.switchUserRole("workspace", sourceId);
return SessionUtils.getUser();
}

View File

@ -27,6 +27,7 @@ public class WorkspaceController {
@PostMapping("add")
@RequiresRoles(RoleConstants.ORG_ADMIN)
public Workspace addWorkspace(@RequestBody Workspace workspace) {
workspaceService.checkWorkspaceOwnerByOrgAdmin(workspace.getId());
return workspaceService.saveWorkspace(workspace);
}

View File

@ -1,7 +1,10 @@
package io.metersphere.report.base;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class ChartsData {
/**
@ -52,20 +55,4 @@ public class ChartsData {
public void setyAxis2(BigDecimal yAxis2) {
this.yAxis2 = yAxis2;
}
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}

View File

@ -1,41 +1,13 @@
package io.metersphere.report.base;
import lombok.Data;
@Data
public class Errors {
private String errorType;
private String errorNumber;
private String precentOfErrors;
private String precentOfAllSamples;
private String percentOfErrors;
private String percentOfAllSamples;
public String getErrorType() {
return errorType;
}
public void setErrorType(String errorType) {
this.errorType = errorType;
}
public String getErrorNumber() {
return errorNumber;
}
public void setErrorNumber(String errorNumber) {
this.errorNumber = errorNumber;
}
public String getPrecentOfErrors() {
return precentOfErrors;
}
public void setPrecentOfErrors(String precentOfErrors) {
this.precentOfErrors = precentOfErrors;
}
public String getPrecentOfAllSamples() {
return precentOfAllSamples;
}
public void setPrecentOfAllSamples(String precentOfAllSamples) {
this.precentOfAllSamples = precentOfAllSamples;
}
}

View File

@ -1,5 +1,8 @@
package io.metersphere.report.base;
import lombok.Data;
@Data
public class ErrorsTop5 {
private String sample;
@ -16,107 +19,4 @@ public class ErrorsTop5 {
private String error5;
private String error5Size;
public String getSample() {
return sample;
}
public void setSample(String sample) {
this.sample = sample;
}
public String getSamples() {
return samples;
}
public void setSamples(String samples) {
this.samples = samples;
}
public String getErrorsAllSize() {
return errorsAllSize;
}
public void setErrorsAllSize(String errorsAllSize) {
this.errorsAllSize = errorsAllSize;
}
public String getError1() {
return error1;
}
public void setError1(String error1) {
this.error1 = error1;
}
public String getError1Size() {
return error1Size;
}
public void setError1Size(String error1Size) {
this.error1Size = error1Size;
}
public String getError2() {
return error2;
}
public void setError2(String error2) {
this.error2 = error2;
}
public String getError2Size() {
return error2Size;
}
public void setError2Size(String error2Size) {
this.error2Size = error2Size;
}
public String getError3() {
return error3;
}
public void setError3(String error3) {
this.error3 = error3;
}
public String getError3Size() {
return error3Size;
}
public void setError3Size(String error3Size) {
this.error3Size = error3Size;
}
public String getError4() {
return error4;
}
public void setError4(String error4) {
this.error4 = error4;
}
public String getError4Size() {
return error4Size;
}
public void setError4Size(String error4Size) {
this.error4Size = error4Size;
}
public String getError5() {
return error5;
}
public void setError5(String error5) {
this.error5 = error5;
}
public String getError5Size() {
return error5Size;
}
public void setError5Size(String error5Size) {
this.error5Size = error5Size;
}
}

View File

@ -1,180 +0,0 @@
package io.metersphere.report.base;
import com.opencsv.bean.CsvBindByName;
public class Metric {
// timestamp,elapsed,label,responseCode,responseMessage,threadName,dataType,success,failureMessage,bytes,sentBytes,grpThreads,allThreads,URL,Latency,IdleTime,Connect
@CsvBindByName(column = "timestamp") // 访问开始时间
private String timestamp;
@CsvBindByName(column = "elapsed") // 访问开始到结束的用时 - 响应时间
private String elapsed;
@CsvBindByName(column = "label") // 请求的标签
private String label;
@CsvBindByName(column = "responseCode") // 响应码
private String responseCode;
@CsvBindByName(column = "responseMessage") // 响应信息
private String responseMessage;
@CsvBindByName(column = "threadName") // 请求所属线程
private String threadName;
@CsvBindByName(column = "dataType") // 数据类型
private String dataType;
@CsvBindByName(column = "success") // 访问是否成功
private String success;
@CsvBindByName(column = "failureMessage") // 访问失败信息
private String failureMessage;
@CsvBindByName(column = "bytes") //
private String bytes;
@CsvBindByName(column = "sentBytes") //
private String sentBytes;
@CsvBindByName(column = "grpThreads") // 线程组
private String grpThreads;
@CsvBindByName(column = "allThreads") //
private String allThreads;
@CsvBindByName(column = "URL") //
private String url;
@CsvBindByName(column = "Latency") // 延时
private String latency;
@CsvBindByName(column = "IdleTime") // 闲置时间
private String idleTime;
@CsvBindByName(column = "Connect") //
private String connect;
public String getTimestamp() {
return timestamp;
}
public void setTimestamp(String timestamp) {
this.timestamp = timestamp;
}
public String getElapsed() {
return elapsed;
}
public void setElapsed(String elapsed) {
this.elapsed = elapsed;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getResponseCode() {
return responseCode;
}
public void setResponseCode(String responseCode) {
this.responseCode = responseCode;
}
public String getResponseMessage() {
return responseMessage;
}
public void setResponseMessage(String responseMessage) {
this.responseMessage = responseMessage;
}
public String getThreadName() {
return threadName;
}
public void setThreadName(String threadName) {
this.threadName = threadName;
}
public String getDataType() {
return dataType;
}
public void setDataType(String dataType) {
this.dataType = dataType;
}
public String getSuccess() {
return success;
}
public void setSuccess(String success) {
this.success = success;
}
public String getFailureMessage() {
return failureMessage;
}
public void setFailureMessage(String failureMessage) {
this.failureMessage = failureMessage;
}
public String getBytes() {
return bytes;
}
public void setBytes(String bytes) {
this.bytes = bytes;
}
public String getSentBytes() {
return sentBytes;
}
public void setSentBytes(String sentBytes) {
this.sentBytes = sentBytes;
}
public String getGrpThreads() {
return grpThreads;
}
public void setGrpThreads(String grpThreads) {
this.grpThreads = grpThreads;
}
public String getAllThreads() {
return allThreads;
}
public void setAllThreads(String allThreads) {
this.allThreads = allThreads;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getLatency() {
return latency;
}
public void setLatency(String latency) {
this.latency = latency;
}
public String getIdleTime() {
return idleTime;
}
public void setIdleTime(String idleTime) {
this.idleTime = idleTime;
}
public String getConnect() {
return connect;
}
public void setConnect(String connect) {
this.connect = connect;
}
}

View File

@ -1,32 +1,12 @@
package io.metersphere.report.base;
import lombok.Data;
@Data
public class ReportTimeInfo {
private String duration;
private String startTime;
private String endTime;
public String getDuration() {
return duration;
}
public void setDuration(String duration) {
this.duration = duration;
}
public String getStartTime() {
return startTime;
}
public void setStartTime(String startTime) {
this.startTime = startTime;
}
public String getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
}

View File

@ -1,5 +1,8 @@
package io.metersphere.report.base;
import lombok.Data;
@Data
public class Statistics {
private String label;
@ -28,107 +31,4 @@ public class Statistics {
private String sent;
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getSamples() {
return samples;
}
public void setSamples(String samples) {
this.samples = samples;
}
public String getKo() {
return ko;
}
public void setKo(String ko) {
this.ko = ko;
}
public String getError() {
return error;
}
public void setError(String error) {
this.error = error;
}
public String getAverage() {
return average;
}
public void setAverage(String average) {
this.average = average;
}
public String getMin() {
return min;
}
public void setMin(String min) {
this.min = min;
}
public String getMax() {
return max;
}
public void setMax(String max) {
this.max = max;
}
public String getTp90() {
return tp90;
}
public void setTp90(String tp90) {
this.tp90 = tp90;
}
public String getTp95() {
return tp95;
}
public void setTp95(String tp95) {
this.tp95 = tp95;
}
public String getTp99() {
return tp99;
}
public void setTp99(String tp99) {
this.tp99 = tp99;
}
public String getTransactions() {
return transactions;
}
public void setTransactions(String transactions) {
this.transactions = transactions;
}
public String getSent() {
return sent;
}
public void setSent(String sent) {
this.sent = sent;
}
public String getReceived() {
return received;
}
public void setReceived(String received) {
this.received = received;
}
}

View File

@ -1,5 +1,8 @@
package io.metersphere.report.base;
import lombok.Data;
@Data
public class TestOverview {
private String maxUsers;
@ -9,51 +12,4 @@ public class TestOverview {
private String responseTime90;
private String avgBandwidth;
public String getMaxUsers() {
return maxUsers;
}
public void setMaxUsers(String maxUsers) {
this.maxUsers = maxUsers;
}
public String getAvgThroughput() {
return avgThroughput;
}
public void setAvgThroughput(String avgThroughput) {
this.avgThroughput = avgThroughput;
}
public String getErrors() {
return errors;
}
public void setErrors(String errors) {
this.errors = errors;
}
public String getAvgResponseTime() {
return avgResponseTime;
}
public void setAvgResponseTime(String avgResponseTime) {
this.avgResponseTime = avgResponseTime;
}
public String getResponseTime90() {
return responseTime90;
}
public void setResponseTime90(String responseTime90) {
this.responseTime90 = responseTime90;
}
public String getAvgBandwidth() {
return avgBandwidth;
}
public void setAvgBandwidth(String avgBandwidth) {
this.avgBandwidth = avgBandwidth;
}
}

View File

@ -67,7 +67,7 @@ public class ShiroDBRealm extends AuthorizingRealm {
UserDTO user = userService.getUserDTO(userId);
String msg;
if (user == null) {
msg = "not exist user is trying to login, user:" + userId;
msg = "The user does not exist: " + userId;
logger.warn(msg);
throw new UnknownAccountException(msg);
}

View File

@ -4,12 +4,14 @@ import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.OrganizationMapper;
import io.metersphere.base.mapper.UserMapper;
import io.metersphere.base.mapper.UserRoleMapper;
import io.metersphere.base.mapper.WorkspaceMapper;
import io.metersphere.base.mapper.ext.ExtOrganizationMapper;
import io.metersphere.base.mapper.ext.ExtUserRoleMapper;
import io.metersphere.commons.constants.RoleConstants;
import io.metersphere.commons.exception.MSException;
import io.metersphere.controller.request.OrganizationRequest;
import io.metersphere.dto.OrganizationMemberDTO;
import io.metersphere.dto.UserDTO;
import io.metersphere.dto.UserRoleHelpDTO;
import io.metersphere.i18n.Translator;
import io.metersphere.user.SessionUser;
@ -39,6 +41,12 @@ public class OrganizationService {
private UserMapper userMapper;
@Resource
private ExtOrganizationMapper extOrganizationMapper;
@Resource
private WorkspaceMapper workspaceMapper;
@Resource
private WorkspaceService workspaceService;
@Resource
private UserService userService;
public Organization addOrganization(Organization organization) {
long currentTimeMillis = System.currentTimeMillis();
@ -59,6 +67,23 @@ public class OrganizationService {
}
public void deleteOrganization(String organizationId) {
WorkspaceExample example = new WorkspaceExample();
WorkspaceExample.Criteria criteria = example.createCriteria();
criteria.andOrganizationIdEqualTo(organizationId);
// delete workspace
List<Workspace> workspaces = workspaceMapper.selectByExample(example);
List<String> workspaceIdList = workspaces.stream().map(Workspace::getId).collect(Collectors.toList());
for (String workspaceId : workspaceIdList) {
workspaceService.deleteWorkspace(workspaceId);
}
// delete organization member
UserRoleExample userRoleExample = new UserRoleExample();
userRoleExample.createCriteria().andSourceIdEqualTo(organizationId);
userRoleMapper.deleteByExample(userRoleExample);
// delete org
organizationMapper.deleteByPrimaryKey(organizationId);
}
@ -123,7 +148,8 @@ public class OrganizationService {
}
public void checkOrgOwner(String organizationId) {
SessionUser user = SessionUtils.getUser();
SessionUser sessionUser = SessionUtils.getUser();
UserDTO user = userService.getUserDTO(sessionUser.getId());
List<String> collect = user.getUserRoles().stream()
.filter(ur -> RoleConstants.ORG_ADMIN.equals(ur.getRoleId()))
.map(UserRole::getSourceId)

View File

@ -50,13 +50,35 @@ public class PerformanceTestService {
@Resource
private LoadTestReportLogMapper loadTestReportLogMapper;
@Resource
private LoadTestReportResultMapper loadTestReportResultMapper;
@Resource
private TestResourceService testResourceService;
@Resource
private ReportService reportService;
public List<LoadTestDTO> list(QueryTestPlanRequest request) {
return extLoadTestMapper.list(request);
}
public void delete(DeleteTestPlanRequest request) {
String testId = request.getId();
LoadTestReportExample loadTestReportExample = new LoadTestReportExample();
loadTestReportExample.createCriteria().andTestIdEqualTo(testId);
List<LoadTestReport> loadTestReports = loadTestReportMapper.selectByExample(loadTestReportExample);
List<String> reportIdList = loadTestReports.stream().map(LoadTestReport::getId).collect(Collectors.toList());
// delete load_test_report_result
LoadTestReportResultExample loadTestReportResultExample = new LoadTestReportResultExample();
loadTestReportResultExample.createCriteria().andReportIdIn(reportIdList);
loadTestReportResultMapper.deleteByExample(loadTestReportResultExample);
// delete load_test_report, delete load_test_report_detail
reportIdList.forEach(reportId -> {
loadTestReportDetailMapper.deleteByPrimaryKey(reportId);
reportService.deleteReport(reportId);
});
// delete load_test
loadTestMapper.deleteByPrimaryKey(request.getId());
deleteFileByTestId(request.getId());

View File

@ -1,11 +1,15 @@
package io.metersphere.service;
import io.metersphere.base.domain.LoadTest;
import io.metersphere.base.domain.LoadTestExample;
import io.metersphere.base.domain.Project;
import io.metersphere.base.domain.ProjectExample;
import io.metersphere.base.mapper.LoadTestMapper;
import io.metersphere.base.mapper.ProjectMapper;
import io.metersphere.base.mapper.ext.ExtProjectMapper;
import io.metersphere.commons.exception.MSException;
import io.metersphere.controller.request.ProjectRequest;
import io.metersphere.controller.request.testplan.DeleteTestPlanRequest;
import io.metersphere.dto.ProjectDTO;
import io.metersphere.i18n.Translator;
import io.metersphere.user.SessionUtils;
@ -16,6 +20,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
@Service
@Transactional(rollbackFor = Exception.class)
@ -24,6 +29,10 @@ public class ProjectService {
private ProjectMapper projectMapper;
@Resource
private ExtProjectMapper extProjectMapper;
@Resource
private PerformanceTestService performanceTestService;
@Resource
private LoadTestMapper loadTestMapper;
public Project addProject(Project project) {
if (StringUtils.isBlank(project.getName())) {
@ -54,11 +63,27 @@ public class ProjectService {
}
public void deleteProject(String projectId) {
// delete test
LoadTestExample loadTestExample = new LoadTestExample();
loadTestExample.createCriteria().andProjectIdEqualTo(projectId);
List<LoadTest> loadTests = loadTestMapper.selectByExample(loadTestExample);
List<String> loadTestIdList = loadTests.stream().map(LoadTest::getId).collect(Collectors.toList());
loadTestIdList.forEach(loadTestId -> {
DeleteTestPlanRequest deleteTestPlanRequest = new DeleteTestPlanRequest();
deleteTestPlanRequest.setId(loadTestId);
performanceTestService.delete(deleteTestPlanRequest);
});
// TODO 删除项目下 测试跟踪 相关
// TODO 删除项目下 接口测试 相关
// delete project
projectMapper.deleteByPrimaryKey(projectId);
}
public void updateProject(Project project) {
project.setCreateTime(null);// 创建时间禁止修改
project.setCreateTime(null);
project.setUpdateTime(System.currentTimeMillis());
projectMapper.updateByPrimaryKeySelective(project);
}

View File

@ -1,8 +1,10 @@
package io.metersphere.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.LoadTestMapper;
import io.metersphere.base.mapper.LoadTestReportLogMapper;
import io.metersphere.base.mapper.LoadTestReportMapper;
import io.metersphere.base.mapper.LoadTestReportResultMapper;
import io.metersphere.base.mapper.ext.ExtLoadTestReportMapper;
@ -20,8 +22,10 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service
@Transactional(rollbackFor = Exception.class)
@ -35,6 +39,10 @@ public class ReportService {
private LoadTestMapper loadTestMapper;
@Resource
private LoadTestReportResultMapper loadTestReportResultMapper;
@Resource
private LoadTestReportLogMapper loadTestReportLogMapper;
@Resource
private TestResourceService testResourceService;
public List<ReportDTO> getRecentReportList(ReportRequest request) {
return extLoadTestReportMapper.getReportList(request);
@ -150,7 +158,34 @@ public class ReportService {
}
public Map<String, String> log(String reportId) {
// todo 查询日志
return null;
Map<String, String> logMap = new HashMap<>();
LoadTestReportLogExample example = new LoadTestReportLogExample();
example.createCriteria().andReportIdEqualTo(reportId);
List<LoadTestReportLog> loadTestReportLogs = loadTestReportLogMapper.selectByExampleWithBLOBs(example);
loadTestReportLogs.stream().map(log -> {
Map<String, String> result = new HashMap<>();
TestResource testResource = testResourceService.getTestResource(log.getResourceId());
if (testResource == null) {
result.put(log.getResourceId(), log.getContent());
return result;
}
String configuration = testResource.getConfiguration();
JSONObject object = JSON.parseObject(configuration);
if (StringUtils.isNotBlank(object.getString("masterUrl"))) {
result.put(object.getString("masterUrl"), log.getContent());
return result;
}
if (StringUtils.isNotBlank(object.getString("ip"))) {
result.put(object.getString("ip"), log.getContent());
return result;
}
result.put(log.getResourceId(), log.getContent());
return result;
}).forEach(log -> logMap.putAll(log.entrySet().stream()
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)))
);
return logMap;
}
}

View File

@ -92,7 +92,7 @@ public class TestCaseNodeService {
List<TestCaseNodeDTO> childrens = Optional.ofNullable(nodeTree.getChildren()).orElse(new ArrayList<>());
lowerNodes.forEach(node -> {
if (node.getpId().equals(rootNode.getId())){
if (node.getPId().equals(rootNode.getId())){
childrens.add(buildNodeTree(nodeLevelMap, node));
nodeTree.setChildren(childrens);
}
@ -327,7 +327,7 @@ public class TestCaseNodeService {
private Integer insertTestCaseNode(String nodeName, Integer pId, String projectId, Integer level) {
TestCaseNode testCaseNode = new TestCaseNode();
testCaseNode.setName(nodeName.trim());
testCaseNode.setpId(pId);
testCaseNode.setPId(pId);
testCaseNode.setProjectId(projectId);
testCaseNode.setCreateTime(System.currentTimeMillis());
testCaseNode.setUpdateTime(System.currentTimeMillis());

View File

@ -7,15 +7,16 @@ import io.metersphere.base.domain.TestResourcePool;
import io.metersphere.base.domain.TestResourcePoolExample;
import io.metersphere.base.mapper.TestResourceMapper;
import io.metersphere.base.mapper.TestResourcePoolMapper;
import io.metersphere.base.mapper.ext.ExtTestReourcePoolMapper;
import io.metersphere.commons.constants.ResourcePoolTypeEnum;
import io.metersphere.commons.constants.ResourceStatusEnum;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.LogUtil;
import io.metersphere.controller.request.resourcepool.QueryResourcePoolRequest;
import io.metersphere.dto.NodeDTO;
import io.metersphere.dto.TestResourcePoolDTO;
import io.metersphere.engine.kubernetes.provider.KubernetesProvider;
import io.metersphere.i18n.Translator;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.http.HttpStatus;
@ -25,10 +26,13 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
import static io.metersphere.commons.constants.ResourceStatusEnum.INVALID;
import static io.metersphere.commons.constants.ResourceStatusEnum.VALID;
/**
@ -45,8 +49,6 @@ public class TestResourcePoolService {
@Resource
private TestResourceMapper testResourceMapper;
@Resource
private ExtTestReourcePoolMapper extTestReourcePoolMapper;
@Resource
private RestTemplate restTemplate;
public TestResourcePoolDTO addTestResourcePool(TestResourcePoolDTO testResourcePool) {
@ -71,7 +73,27 @@ public class TestResourcePoolService {
}
public List<TestResourcePoolDTO> listResourcePools(QueryResourcePoolRequest request) {
return extTestReourcePoolMapper.listResourcePools(request);
TestResourcePoolExample example = new TestResourcePoolExample();
TestResourcePoolExample.Criteria criteria = example.createCriteria();
if (StringUtils.isNotBlank(request.getName())) {
criteria.andNameLike(StringUtils.wrapIfMissing(request.getName(), "%"));
}
List<TestResourcePool> testResourcePools = testResourcePoolMapper.selectByExample(example);
List<TestResourcePoolDTO> testResourcePoolDTOS = new ArrayList<>();
testResourcePools.forEach(pool -> {
TestResourceExample example2 = new TestResourceExample();
example2.createCriteria().andTestResourcePoolIdEqualTo(pool.getId());
List<TestResource> testResources = testResourceMapper.selectByExampleWithBLOBs(example2);
TestResourcePoolDTO testResourcePoolDTO = new TestResourcePoolDTO();
try {
BeanUtils.copyProperties(testResourcePoolDTO, pool);
testResourcePoolDTO.setResources(testResources);
testResourcePoolDTOS.add(testResourcePoolDTO);
} catch (IllegalAccessException | InvocationTargetException e) {
LogUtil.error(e);
}
});
return testResourcePoolDTOS;
}
private void validateTestResourcePool(TestResourcePoolDTO testResourcePool) {
@ -98,6 +120,7 @@ public class TestResourcePoolService {
if (nodeIps.size() < testResourcePool.getResources().size()) {
MSException.throwException(Translator.get("duplicate_node_ip"));
}
testResourcePool.setStatus(VALID.name());
for (TestResource resource : testResourcePool.getResources()) {
NodeDTO nodeDTO = JSON.parseObject(resource.getConfiguration(), NodeDTO.class);
boolean isValidate = validateNode(nodeDTO);
@ -134,6 +157,7 @@ public class TestResourcePoolService {
KubernetesProvider provider = new KubernetesProvider(testResource.getConfiguration());
provider.validateCredential();
testResource.setStatus(VALID.name());
testResourcePool.setStatus(VALID.name());
} catch (Exception e) {
testResource.setStatus(ResourceStatusEnum.INVALID.name());
testResourcePool.setStatus(ResourceStatusEnum.INVALID.name());
@ -161,6 +185,18 @@ public class TestResourcePoolService {
}
public List<TestResourcePool> listValidResourcePools() {
QueryResourcePoolRequest request = new QueryResourcePoolRequest();
List<TestResourcePoolDTO> testResourcePools = listResourcePools(request);
// 重新校验 pool
for (TestResourcePoolDTO pool : testResourcePools) {
try {
updateTestResourcePool(pool);
} catch (MSException e) {
pool.setStatus(INVALID.name());
pool.setUpdateTime(System.currentTimeMillis());
testResourcePoolMapper.updateByPrimaryKeySelective(pool);
}
}
TestResourcePoolExample example = new TestResourcePoolExample();
example.createCriteria().andStatusEqualTo(ResourceStatusEnum.VALID.name());
return testResourcePoolMapper.selectByExample(example);

View File

@ -47,4 +47,8 @@ public class TestResourceService {
example.createCriteria().andTestResourcePoolIdEqualTo(resourcePoolId);
return testResourceMapper.selectByExampleWithBLOBs(example);
}
public TestResource getTestResource(String resourceId) {
return testResourceMapper.selectByPrimaryKey(resourceId);
}
}

View File

@ -128,7 +128,11 @@ public class UserService {
userMapper.updateByPrimaryKeySelective(user);
}
public void switchUserRole(UserDTO user, String sign, String sourceId) {
public void switchUserRole(String sign, String sourceId) {
SessionUser sessionUser = SessionUtils.getUser();
// 获取最新UserDTO
UserDTO user = getUserDTO(sessionUser.getId());
User newUser = new User();
if (StringUtils.equals("organization", sign)) {
user.setLastOrganizationId(sourceId);

View File

@ -1,6 +1,7 @@
package io.metersphere.service;
import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.ProjectMapper;
import io.metersphere.base.mapper.UserMapper;
import io.metersphere.base.mapper.UserRoleMapper;
import io.metersphere.base.mapper.WorkspaceMapper;
@ -10,6 +11,7 @@ import io.metersphere.base.mapper.ext.ExtWorkspaceMapper;
import io.metersphere.commons.constants.RoleConstants;
import io.metersphere.commons.exception.MSException;
import io.metersphere.controller.request.WorkspaceRequest;
import io.metersphere.dto.UserDTO;
import io.metersphere.dto.UserRoleHelpDTO;
import io.metersphere.dto.WorkspaceDTO;
import io.metersphere.dto.WorkspaceMemberDTO;
@ -41,6 +43,12 @@ public class WorkspaceService {
private UserMapper userMapper;
@Resource
private ExtOrganizationMapper extOrganizationMapper;
@Resource
private ProjectService projectService;
@Resource
private ProjectMapper projectMapper;
@Resource
private UserService userService;
public Workspace saveWorkspace(Workspace workspace) {
if (StringUtils.isBlank(workspace.getName())) {
@ -89,6 +97,21 @@ public class WorkspaceService {
}
public void deleteWorkspace(String workspaceId) {
// delete project
ProjectExample projectExample = new ProjectExample();
projectExample.createCriteria().andWorkspaceIdEqualTo(workspaceId);
List<Project> projectList = projectMapper.selectByExample(projectExample);
List<String> projectIdList = projectList.stream().map(Project::getId).collect(Collectors.toList());
projectIdList.forEach(projectId -> {
projectService.deleteProject(projectId);
});
// delete workspace member
UserRoleExample userRoleExample = new UserRoleExample();
userRoleExample.createCriteria().andSourceIdEqualTo(workspaceId);
userRoleMapper.deleteByExample(userRoleExample);
// delete workspace
workspaceMapper.deleteByPrimaryKey(workspaceId);
}
@ -98,7 +121,8 @@ public class WorkspaceService {
public void checkWorkspaceOwnerByOrgAdmin(String workspaceId) {
checkWorkspaceIsExist(workspaceId);
WorkspaceExample example = new WorkspaceExample();
SessionUser user = SessionUtils.getUser();
SessionUser sessionUser = SessionUtils.getUser();
UserDTO user = userService.getUserDTO(sessionUser.getId());
List<String> orgIds = user.getUserRoles().stream()
.filter(ur -> RoleConstants.ORG_ADMIN.equals(ur.getRoleId()))
.map(UserRole::getSourceId)
@ -114,7 +138,8 @@ public class WorkspaceService {
public void checkWorkspaceOwner(String workspaceId) {
checkWorkspaceIsExist(workspaceId);
WorkspaceExample example = new WorkspaceExample();
SessionUser user = SessionUtils.getUser();
SessionUser sessionUser = SessionUtils.getUser();
UserDTO user = userService.getUserDTO(sessionUser.getId());
List<String> orgIds = user.getUserRoles().stream()
.filter(ur -> RoleConstants.ORG_ADMIN.equals(ur.getRoleId()))
.map(UserRole::getSourceId)

View File

@ -22,7 +22,7 @@ mybatis.configuration.use-column-label=true
mybatis.configuration.auto-mapping-behavior=full
mybatis.configuration.default-statement-timeout=25000
logging.file.path=/opt/fit2cloud/logs/${spring.application.name}
logging.file.path=/opt/metersphere/logs/${spring.application.name}
# view
spring.resources.static-locations=classpath:/templates/,classpath:/static/
@ -36,4 +36,31 @@ spring.flyway.baseline-version=0
spring.flyway.encoding=UTF-8
spring.flyway.validate-on-migrate=false
spring.messages.basename=i18n/messages
spring.messages.basename=i18n/messages
# kafka
kafka.acks=1
kafka.fields=
kafka.timestamp=yyyy-MM-dd'T'HH:mm:ss.SSSZZ
kafka.sample-filter=
kafka.test-mode=info
kafka.parse-all-req-headers=false
kafka.parse-all-res-headers=false
kafka.compression-type=
kafka.batch-size=16384
kafka.client-id=JMeterKafkaBackendListener
kafka.connections-max-idle-ms=180000
kafka.ssl.enabled=false
kafka.ssl.key-password=
kafka.ssl.keystore-location=
kafka.ssl.keystore-password=
kafka.ssl.truststore-location=
kafka.ssl.truststore-password=
kafka.ssl.enabled-protocols=TLSv1.2,TLSv1.1,TLSv1
kafka.ssl.keystore-type=JKS
kafka.ssl.protocol=TLS
kafka.ssl.provider=
kafka.ssl.truststore-type=
# jmeter
jmeter.image=registry.fit2cloud.com/metersphere/jmeter-master:0.0.4

View File

@ -3,14 +3,27 @@
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd" >
<generatorConfiguration>
<!--配置数据库连接的位置-->
<properties url="file:///opt/fit2cloud/conf/metersphere.properties"/>
<properties url="file:///opt/metersphere/conf/metersphere.properties"/>
<!-- 设置mysql驱动路径 -->
<!--<classPathEntry location="/Users/liuruibin/.m2/repository/mysql/mysql-connector-java/5.1.34/mysql-connector-java-5.1.34.jar"/>-->
<!-- 此处指定生成针对MyBatis3的DAO -->
<context id="mysql" targetRuntime="MyBatis3">
<plugin type="org.mybatis.generator.plugins.SerializablePlugin"/>
<plugin type="org.mybatis.generator.plugins.UnmergeableXmlMappersPlugin" />
<!-- Lombok插件 -->
<plugin type="com.itfsw.mybatis.generator.plugins.LombokPlugin">
<!-- @Data 默认开启,同时插件会对子类自动附加@EqualsAndHashCode(callSuper = true)@ToString(callSuper = true) -->
<property name="@Data" value="true"/>
<!-- @Builder 必须在 Lombok 版本 >= 1.18.2 的情况下开启,对存在继承关系的类自动替换成@SuperBuilder -->
<property name="@Builder" value="false"/>
<!-- @NoArgsConstructor 和 @AllArgsConstructor 使用规则和Lombok一致 -->
<property name="@AllArgsConstructor" value="false"/>
<property name="@NoArgsConstructor" value="false"/>
<!-- @Getter、@Setter、@Accessors 等使用规则参见官方文档 -->
<property name="@Accessors(chain = true)" value="false"/>
<!-- 临时解决IDEA工具对@SuperBuilder的不支持问题开启后(默认未开启)插件在遇到@SuperBuilder注解时会调用ModelBuilderPlugin来生成相应的builder代码 -->
<property name="supportSuperBuilderForIdea" value="false"/>
</plugin>
<!-- 用来除去时间信息的这在配合类似subversion的代码管理工具时使用很有效因为可以减少没有必要的注释迁入 -->
<commentGenerator>
<property name="suppressDate" value="true"/>
@ -46,15 +59,6 @@
<!--要生成的数据库表 -->
<!--<table tableName="api_test"/>-->
<!--<table tableName="api_test_file"/>-->
<!--<table tableName="api_test_report"/>-->
<!--<table tableName="test_case_node">-->
<!--<generatedKey column="id" sqlStatement="MySql" identity="true"/>-->
<!--</table>-->
<!--<table tableName="test_case"/>-->
<!--<table tableName="test_plan_test_case"/>-->
<table tableName="test_case_report_template">
<generatedKey column="id" sqlStatement="MySql" identity="true"/>
</table>

View File

@ -28,4 +28,6 @@ user_email_already_exists=User email already exists
user_name_is_null=User name cannot be null
user_email_is_null=User email cannot be null
password_is_null=Password cannot be null
workspace_not_exists=Workspace is not exists
workspace_not_exists=Workspace is not exists
#api
api_load_script_error="Load script error"

View File

@ -28,4 +28,6 @@ user_email_already_exists=用户邮箱已存在
user_name_is_null=用户名不能为空
user_email_is_null=用户邮箱不能为空
password_is_null=密码不能为空
workspace_not_exists=工作空间不存在
workspace_not_exists=工作空间不存在
#api
api_load_script_error="读取脚本失败"

File diff suppressed because it is too large Load Diff

View File

@ -1,54 +0,0 @@
package io.metersphere;
import io.metersphere.base.domain.SystemParameter;
import io.metersphere.base.mapper.UserMapper;
import io.metersphere.commons.constants.ParamConstants;
import io.metersphere.commons.utils.CompressUtils;
import io.metersphere.service.RegistryParamService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import javax.annotation.Resource;
import java.util.List;
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class ApplicationTests {
@Resource
UserMapper userMapper;
@Resource
private RegistryParamService registryParamService;
@Test
public void test1() {
final Object test = CompressUtils.zip("test".getBytes());
final Object unzip = CompressUtils.unzip(test);
System.out.println(new String((byte[]) unzip));
}
@Test
public void test2() {
List<SystemParameter> registry = registryParamService.getRegistry(ParamConstants.Classify.REGISTRY.getValue());
System.out.println(registry);
for (SystemParameter sp : registry) {
if ("registry.password".equals(sp.getParamKey())) {
sp.setParamValue("Calong@2015");
}
if ("registry.url".equals(sp.getParamKey())) {
sp.setParamValue("registry.fit2cloud.com");
}
if ("registry.repo".equals(sp.getParamKey())) {
sp.setParamValue("metersphere");
}
if ("registry.username".equals(sp.getParamKey())) {
sp.setParamValue("developer");
}
}
registryParamService.updateRegistry(registry);
}
}

View File

@ -1,34 +0,0 @@
package io.metersphere;
import io.fabric8.kubernetes.api.model.Pod;
import io.fabric8.kubernetes.api.model.PodList;
import io.fabric8.kubernetes.client.ConfigBuilder;
import io.fabric8.kubernetes.client.DefaultKubernetesClient;
import io.fabric8.kubernetes.client.KubernetesClient;
import org.junit.Before;
import org.junit.Test;
public class BaseTest {
protected KubernetesClient kubernetesClient;
@Before
public void before() {
try {
ConfigBuilder configBuilder = new ConfigBuilder();
configBuilder.withMasterUrl("https://172.16.10.93:6443");
kubernetesClient = new DefaultKubernetesClient(configBuilder.build());
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
@Test
public void test1() {
PodList list = kubernetesClient.pods().list();
for (Pod item : list.getItems()) {
System.out.println(item);
}
}
}

View File

@ -1,536 +0,0 @@
package io.metersphere;
import io.metersphere.config.KafkaProperties;
import org.apache.commons.lang3.StringUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import javax.annotation.Resource;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import java.io.File;
import java.io.FileInputStream;
import java.io.StringWriter;
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class JmxFileParseTest {
private final static String HASH_TREE_ELEMENT = "hashTree";
private final static String TEST_PLAN = "TestPlan";
private final static String STRING_PROP = "stringProp";
private final static String CONCURRENCY_THREAD_GROUP = "com.blazemeter.jmeter.threads.concurrency.ConcurrencyThreadGroup";
private final static String VARIABLE_THROUGHPUT_TIMER = "kg.apc.jmeter.timers.VariableThroughputTimer";
private final static String BACKEND_LISTENER = "BackendListener";
private final static String THREAD_GROUP = "ThreadGroup";
private final static String CONFIG_TEST_ELEMENT = "ConfigTestElement";
private final static String DNS_CACHE_MANAGER = "DNSCacheManager";
private final static String ARGUMENTS = "Arguments";
@Resource
private KafkaProperties kafkaProperties;
@Test
public void testProperties() {
System.out.println(kafkaProperties.getSsl());
}
@Test
public void parse() throws Exception {
File file = new File("/Users/liuruibin/Downloads/blaze_meter_dev2.jmx");
file = new File("/Users/liuruibin/Desktop/041301.jmx");
final FileInputStream inputStream = new FileInputStream(file);
final InputSource inputSource = new InputSource(inputStream);
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = factory.newDocumentBuilder();
final Document document = docBuilder.parse(inputSource);
final Element jmeterTestPlan = document.getDocumentElement();
NodeList childNodes = jmeterTestPlan.getChildNodes();
for (int i = 0; i < childNodes.getLength(); i++) {
Node node = childNodes.item(i);
if (node instanceof Element) {
Element ele = (Element) node;
// jmeterTestPlan的子元素肯定是<hashTree></hashTree>
parseHashTree(ele);
}
}
DOMSource domSource = new DOMSource(document);
StringWriter writer = new StringWriter();
StreamResult result = new StreamResult(writer);
TransformerFactory tf = TransformerFactory.newInstance();
Transformer transformer = tf.newTransformer();
transformer.transform(domSource, result);
System.out.println("XML IN String format is: \n" + writer.toString());
// FileUtils.writeStringToFile(new File("/tmp/test-jmeter.jmx"), writer.toString(), StandardCharsets.UTF_8);
}
private void parseHashTree(Element hashTree) {
if (!valid(hashTree)) {
return;
}
if (hashTree.getChildNodes().getLength() > 0) {
final NodeList childNodes = hashTree.getChildNodes();
for (int i = 0; i < childNodes.getLength(); i++) {
Node node = childNodes.item(i);
if (node instanceof Element) {
Element ele = (Element) node;
if (!valid(ele)) {
continue;
}
if (nodeNameEquals(ele, HASH_TREE_ELEMENT)) {
parseHashTree(ele);
} else if (nodeNameEquals(ele, TEST_PLAN)) {
processTearDownTestPlan(ele);
} else if (nodeNameEquals(ele, CONCURRENCY_THREAD_GROUP)) {
processConcurrencyThreadGroup(ele);
processCheckoutTimer(ele);
processCheckoutBackendListener(ele);
} else if (nodeNameEquals(ele, THREAD_GROUP)) {
processThreadGroup(ele);
processConcurrencyThreadGroup(ele);
processCheckoutTimer(ele);
processCheckoutBackendListener(ele);
} else if (nodeNameEquals(ele, VARIABLE_THROUGHPUT_TIMER)) {
} else if (nodeNameEquals(ele, BACKEND_LISTENER)) {
// processBackendListener(ele);
} else if (nodeNameEquals(ele, CONFIG_TEST_ELEMENT)) {
// processConfigTestElement(ele);
} else if (nodeNameEquals(ele, DNS_CACHE_MANAGER)) {
// processDnsCacheManager(ele);
} else if (nodeNameEquals(ele, ARGUMENTS)) {
// processArguments(ele);
}
}
}
}
}
private void processArguments(Element ele) {
/*
<Arguments guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
<collectionProp name="Arguments.arguments">
<elementProp name="BASE_URL_1" elementType="Argument">
<stringProp name="Argument.name">BASE_URL_1</stringProp>
<stringProp name="Argument.value">rddev2.fit2cloud.com</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
</collectionProp>
</Arguments>
*/
NodeList childNodes = ele.getChildNodes();
for (int i = 0; i < childNodes.getLength(); i++) {
Node item = childNodes.item(i);
if (item instanceof Element && nodeNameEquals(item, "collectionProp")) {
removeChildren(item);
Document document = item.getOwnerDocument();
Element elementProp = document.createElement("elementProp");
elementProp.setAttribute("name", "");
elementProp.setAttribute("elementType", "");
elementProp.appendChild(createStringProp(document, "Argument.name", ""));
elementProp.appendChild(createStringProp(document, "Argument.value", ""));
elementProp.appendChild(createStringProp(document, "Argument.metadata", "="));
item.appendChild(elementProp);
}
}
}
private void processDnsCacheManager(Element ele) {
/*
<DNSCacheManager guiclass="DNSCachePanel" testclass="DNSCacheManager" testname="DNS Cache Manager" enabled="true">
<collectionProp name="DNSCacheManager.servers"/>
<collectionProp name="DNSCacheManager.hosts">
<elementProp name="baiud.com" elementType="StaticHost">
<stringProp name="StaticHost.Name">baiud.com</stringProp>
<stringProp name="StaticHost.Address">172.16.10.187</stringProp>
</elementProp>
</collectionProp>
<boolProp name="DNSCacheManager.clearEachIteration">true</boolProp>
<boolProp name="DNSCacheManager.isCustomResolver">true</boolProp>
</DNSCacheManager>
*/
NodeList childNodes = ele.getChildNodes();
for (int i = 0, size = childNodes.getLength(); i < size; i++) {
Node item = childNodes.item(i);
if (item instanceof Element && nodeNameEquals(item, "collectionProp")
&& StringUtils.equals(((Element) item).getAttribute("name"), "DNSCacheManager.hosts")) {
Node childNode = item.getFirstChild();
// todo 绑定域名 多个
while (!(childNode instanceof Element)) {
childNode = childNode.getNextSibling();
}
Element elementProp = ((Element) childNode);
elementProp.setAttribute("name", "baidu.com");
elementProp.setAttribute("elementType", "StaticHost");
removeChildren(elementProp);
elementProp.appendChild(createStringProp(ele.getOwnerDocument(), "StaticHost.Name", ""));
elementProp.appendChild(createStringProp(ele.getOwnerDocument(), "StaticHost.Address", ""));
}
if (item instanceof Element && nodeNameEquals(item, "boolProp")
&& StringUtils.equals(((Element) item).getAttribute("name"), "DNSCacheManager.isCustomResolver")) {
item.getFirstChild().setNodeValue("true");
}
}
}
private void processConfigTestElement(Element ele) {
/*
<ConfigTestElement guiclass="HttpDefaultsGui" testclass="ConfigTestElement" testname="HTTP Request Defaults" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
<collectionProp name="Arguments.arguments"/>
</elementProp>
<stringProp name="HTTPSampler.domain"></stringProp>
<stringProp name="HTTPSampler.port"></stringProp>
<stringProp name="HTTPSampler.protocol"></stringProp>
<stringProp name="HTTPSampler.contentEncoding"></stringProp>
<stringProp name="HTTPSampler.path"></stringProp>
<boolProp name="HTTPSampler.image_parser">true</boolProp>
<boolProp name="HTTPSampler.concurrentDwn">true</boolProp>
<stringProp name="HTTPSampler.concurrentPool">6</stringProp>
<stringProp name="HTTPSampler.connect_timeout">30000</stringProp>
<stringProp name="HTTPSampler.response_timeout"></stringProp>
</ConfigTestElement>
*/
NodeList childNodes = ele.getChildNodes();
for (int i = 0, size = childNodes.getLength(); i < size; i++) {
Node item = childNodes.item(i);
if (item instanceof Element && nodeNameEquals(item, STRING_PROP)
&& StringUtils.equals(((Element) item).getAttribute("name"), "HTTPSampler.connect_timeout")) {
item.getFirstChild().setNodeValue("30000");
}
}
}
private void processTearDownTestPlan(Element ele) {
/*<boolProp name="TestPlan.tearDown_on_shutdown">true</boolProp>*/
Document document = ele.getOwnerDocument();
Element tearDownSwitch = createBoolProp(document, "TestPlan.tearDown_on_shutdown", true);
ele.appendChild(tearDownSwitch);
Node hashTree = ele.getNextSibling();
while (!(hashTree instanceof Element)) {
hashTree = hashTree.getNextSibling();
}
/*
<PostThreadGroup guiclass="PostThreadGroupGui" testclass="PostThreadGroup" testname="tearDown Thread Group" enabled="true">
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
<elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
<boolProp name="LoopController.continue_forever">false</boolProp>
<stringProp name="LoopController.loops">1</stringProp>
</elementProp>
<stringProp name="ThreadGroup.num_threads">1</stringProp>
<stringProp name="ThreadGroup.ramp_time">1</stringProp>
<boolProp name="ThreadGroup.scheduler">false</boolProp>
<stringProp name="ThreadGroup.duration"></stringProp>
<stringProp name="ThreadGroup.delay"></stringProp>
<boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp>
</PostThreadGroup>
*/
Element tearDownElement = document.createElement("PostThreadGroup");
tearDownElement.setAttribute("guiclass", "PostThreadGroupGui");
tearDownElement.setAttribute("testclass", "PostThreadGroup");
tearDownElement.setAttribute("testname", "tearDown Thread Group");
tearDownElement.setAttribute("enabled", "true");
tearDownElement.appendChild(createStringProp(document, "ThreadGroup.on_sample_error", "continue"));
tearDownElement.appendChild(createStringProp(document, "ThreadGroup.num_threads", "1"));
tearDownElement.appendChild(createStringProp(document, "ThreadGroup.ramp_time", "1"));
tearDownElement.appendChild(createStringProp(document, "ThreadGroup.duration", ""));
tearDownElement.appendChild(createStringProp(document, "ThreadGroup.delay", ""));
tearDownElement.appendChild(createBoolProp(document, "ThreadGroup.scheduler", false));
tearDownElement.appendChild(createBoolProp(document, "ThreadGroup.same_user_on_next_iteration", true));
Element elementProp = document.createElement("elementProp");
elementProp.setAttribute("name", "ThreadGroup.main_controller");
elementProp.setAttribute("elementType", "LoopController");
elementProp.setAttribute("guiclass", "LoopControlPanel");
elementProp.setAttribute("testclass", "LoopController");
elementProp.setAttribute("testname", "Loop Controller");
elementProp.setAttribute("enabled", "true");
elementProp.appendChild(createBoolProp(document, "LoopController.continue_forever", false));
elementProp.appendChild(createStringProp(document, "LoopController.loops", "1"));
tearDownElement.appendChild(elementProp);
hashTree.appendChild(tearDownElement);
Element tearDownHashTree = document.createElement(HASH_TREE_ELEMENT);
/*
<OnceOnlyController guiclass="OnceOnlyControllerGui" testclass="OnceOnlyController" testname="Once Only Controller" enabled="true"/>
*/
Element onceOnlyController = document.createElement("OnceOnlyController");
onceOnlyController.setAttribute("guiclass", "OnceOnlyControllerGui");
onceOnlyController.setAttribute("testclass", "OnceOnlyController");
onceOnlyController.setAttribute("testname", "Once Only Controller");
onceOnlyController.setAttribute("enabled", "true");
tearDownHashTree.appendChild(onceOnlyController);
/*
<hashTree>
<DebugSampler guiclass="TestBeanGUI" testclass="DebugSampler" testname="Debug Sampler" enabled="true">
<boolProp name="displayJMeterProperties">false</boolProp>
<boolProp name="displayJMeterVariables">true</boolProp>
<boolProp name="displaySystemProperties">false</boolProp>
</DebugSampler>
<hashTree/>
</hashTree>
*/
Element onceOnlyHashTree = document.createElement(HASH_TREE_ELEMENT);
Element debugSampler = document.createElement("DebugSampler");
debugSampler.setAttribute("guiclass", "TestBeanGUI");
debugSampler.setAttribute("testclass", "DebugSampler");
debugSampler.setAttribute("testname", "Debug Sampler");
debugSampler.setAttribute("enabled", "true");
debugSampler.appendChild(createBoolProp(document, "displayJMeterProperties", false));
debugSampler.appendChild(createBoolProp(document, "displayJMeterVariables", true));
debugSampler.appendChild(createBoolProp(document, "displaySystemProperties", false));
onceOnlyHashTree.appendChild(debugSampler);
// 添加空的 hashTree
onceOnlyHashTree.appendChild(document.createElement(HASH_TREE_ELEMENT));
tearDownHashTree.appendChild(onceOnlyHashTree);
hashTree.appendChild(tearDownHashTree);
// 添加backend listener
processCheckoutBackendListener(tearDownElement);
}
private Element createBoolProp(Document document, String name, boolean value) {
Element tearDownSwitch = document.createElement("boolProp");
tearDownSwitch.setAttribute("name", name);
tearDownSwitch.appendChild(document.createTextNode(String.valueOf(value)));
return tearDownSwitch;
}
private void processBackendListener(Element backendListener) {
Document document = backendListener.getOwnerDocument();
// 清空child
removeChildren(backendListener);
backendListener.appendChild(createStringProp(document, "classname", "io.github.rahulsinghai.jmeter.backendlistener.kafka.KafkaBackendClient"));
backendListener.appendChild(createStringProp(document, "QUEUE_SIZE", "5000"));
// elementProp
Element elementProp = document.createElement("elementProp");
elementProp.setAttribute("name", "arguments");
elementProp.setAttribute("elementType", "Arguments");
elementProp.setAttribute("guiclass", "ArgumentsPanel");
elementProp.setAttribute("testclass", "Arguments");
elementProp.setAttribute("enabled", "true");
Element collectionProp = document.createElement("collectionProp");
collectionProp.setAttribute("name", "Arguments.arguments");
collectionProp.appendChild(createKafkaProp(document, "kafka.acks", kafkaProperties.getAcks()));
collectionProp.appendChild(createKafkaProp(document, "kafka.bootstrap.servers", kafkaProperties.getBootstrapServers()));
collectionProp.appendChild(createKafkaProp(document, "kafka.topic", kafkaProperties.getTopic()));
collectionProp.appendChild(createKafkaProp(document, "kafka.sample.filter", kafkaProperties.getSampleFilter()));
collectionProp.appendChild(createKafkaProp(document, "kafka.fields", kafkaProperties.getFields()));
collectionProp.appendChild(createKafkaProp(document, "kafka.test.mode", kafkaProperties.getTestMode()));
collectionProp.appendChild(createKafkaProp(document, "kafka.parse.all.req.headers", kafkaProperties.getParseAllReqHeaders()));
collectionProp.appendChild(createKafkaProp(document, "kafka.parse.all.res.headers", kafkaProperties.getParseAllResHeaders()));
collectionProp.appendChild(createKafkaProp(document, "kafka.timestamp", kafkaProperties.getTimestamp()));
collectionProp.appendChild(createKafkaProp(document, "kafka.compression.type", kafkaProperties.getCompressionType()));
collectionProp.appendChild(createKafkaProp(document, "kafka.ssl.enabled", kafkaProperties.getSsl().getEnabled()));
collectionProp.appendChild(createKafkaProp(document, "kafka.ssl.key.password", kafkaProperties.getSsl().getKeyPassword()));
collectionProp.appendChild(createKafkaProp(document, "kafka.ssl.keystore.location", kafkaProperties.getSsl().getKeystoreLocation()));
collectionProp.appendChild(createKafkaProp(document, "kafka.ssl.keystore.password", kafkaProperties.getSsl().getKeystorePassword()));
collectionProp.appendChild(createKafkaProp(document, "kafka.ssl.truststore.location", kafkaProperties.getSsl().getTruststoreLocation()));
collectionProp.appendChild(createKafkaProp(document, "kafka.ssl.truststore.password", kafkaProperties.getSsl().getTruststorePassword()));
collectionProp.appendChild(createKafkaProp(document, "kafka.ssl.enabled.protocols", kafkaProperties.getSsl().getEnabledProtocols()));
collectionProp.appendChild(createKafkaProp(document, "kafka.ssl.keystore.type", kafkaProperties.getSsl().getKeystoreType()));
collectionProp.appendChild(createKafkaProp(document, "kafka.ssl.protocol", kafkaProperties.getSsl().getProtocol()));
collectionProp.appendChild(createKafkaProp(document, "kafka.ssl.provider", kafkaProperties.getSsl().getProvider()));
collectionProp.appendChild(createKafkaProp(document, "kafka.ssl.truststore.type", kafkaProperties.getSsl().getTruststoreType()));
collectionProp.appendChild(createKafkaProp(document, "kafka.batch.size", kafkaProperties.getBatchSize()));
collectionProp.appendChild(createKafkaProp(document, "kafka.client.id", kafkaProperties.getClientId()));
collectionProp.appendChild(createKafkaProp(document, "kafka.connections.max.idle.ms", kafkaProperties.getConnectionsMaxIdleMs()));
// 添加关联关系 test.id test.name
collectionProp.appendChild(createKafkaProp(document, "test.id", ""));
collectionProp.appendChild(createKafkaProp(document, "test.name", ""));
elementProp.appendChild(collectionProp);
// set elementProp
backendListener.appendChild(elementProp);
}
private void processCheckoutBackendListener(Element element) {
Document document = element.getOwnerDocument();
Node listenerParent = element.getNextSibling();
while (!(listenerParent instanceof Element)) {
listenerParent = listenerParent.getNextSibling();
}
NodeList childNodes = listenerParent.getChildNodes();
for (int i = 0, l = childNodes.getLength(); i < l; i++) {
Node item = childNodes.item(i);
if (nodeNameEquals(item, BACKEND_LISTENER)) {
// 如果已经存在不再添加
return;
}
}
// add class name
Element backendListener = document.createElement(BACKEND_LISTENER);
backendListener.setAttribute("guiclass", "BackendListenerGui");
backendListener.setAttribute("testclass", "BackendListener");
backendListener.setAttribute("testname", "Backend Listener");
backendListener.setAttribute("enabled", "true");
listenerParent.appendChild(backendListener);
listenerParent.appendChild(document.createElement(HASH_TREE_ELEMENT));
}
private Element createKafkaProp(Document document, String name, String value) {
Element eleProp = document.createElement("elementProp");
eleProp.setAttribute("name", name);
eleProp.setAttribute("elementType", "Argument");
eleProp.appendChild(createStringProp(document, "Argument.name", name));
eleProp.appendChild(createStringProp(document, "Argument.value", value));
eleProp.appendChild(createStringProp(document, "Argument.metadata", "="));
return eleProp;
}
private void processThreadGroup(Element threadGroup) {
// 重命名 tagName
Document document = threadGroup.getOwnerDocument();
document.renameNode(threadGroup, threadGroup.getNamespaceURI(), CONCURRENCY_THREAD_GROUP);
threadGroup.setAttribute("guiclass", CONCURRENCY_THREAD_GROUP + "Gui");
threadGroup.setAttribute("testclass", CONCURRENCY_THREAD_GROUP);
/*
<elementProp name="ThreadGroup.main_controller" elementType="com.blazemeter.jmeter.control.VirtualUserController"/>
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
<stringProp name="TargetLevel">2</stringProp>
<stringProp name="RampUp">12</stringProp>
<stringProp name="Steps">2</stringProp>
<stringProp name="Hold">3</stringProp>
<stringProp name="LogFilename"></stringProp>
<stringProp name="Iterations">1</stringProp>
<stringProp name="Unit">S</stringProp>
*/
removeChildren(threadGroup);
// elementProp
Element elementProp = document.createElement("elementProp");
elementProp.setAttribute("name", "ThreadGroup.main_controller");
elementProp.setAttribute("elementType", "com.blazemeter.jmeter.control.VirtualUserController");
threadGroup.appendChild(elementProp);
threadGroup.appendChild(createStringProp(document, "ThreadGroup.on_sample_error", "continue"));
threadGroup.appendChild(createStringProp(document, "TargetLevel", "2"));
threadGroup.appendChild(createStringProp(document, "RampUp", "12"));
threadGroup.appendChild(createStringProp(document, "Steps", "2"));
threadGroup.appendChild(createStringProp(document, "Hold", "12"));
threadGroup.appendChild(createStringProp(document, "LogFilename", ""));
threadGroup.appendChild(createStringProp(document, "Iterations", "1"));
threadGroup.appendChild(createStringProp(document, "Unit", "S"));
}
private void processCheckoutTimer(Element element) {
/*
<kg.apc.jmeter.timers.VariableThroughputTimer guiclass="kg.apc.jmeter.timers.VariableThroughputTimerGui" testclass="kg.apc.jmeter.timers.VariableThroughputTimer" testname="jp@gc - Throughput Shaping Timer" enabled="true">
<collectionProp name="load_profile">
<collectionProp name="140409499">
<stringProp name="49">1</stringProp>
<stringProp name="49">1</stringProp>
<stringProp name="1570">13</stringProp>
</collectionProp>
</collectionProp>
</kg.apc.jmeter.timers.VariableThroughputTimer>
*/
Document document = element.getOwnerDocument();
Node timerParent = element.getNextSibling();
while (!(timerParent instanceof Element)) {
timerParent = timerParent.getNextSibling();
}
NodeList childNodes = timerParent.getChildNodes();
for (int i = 0, l = childNodes.getLength(); i < l; i++) {
Node item = childNodes.item(i);
if (nodeNameEquals(item, VARIABLE_THROUGHPUT_TIMER)) {
// 如果已经存在不再添加
return;
}
}
Element timer = document.createElement(VARIABLE_THROUGHPUT_TIMER);
timer.setAttribute("guiclass", VARIABLE_THROUGHPUT_TIMER + "Gui");
timer.setAttribute("testclass", VARIABLE_THROUGHPUT_TIMER);
timer.setAttribute("testname", "jp@gc - Throughput Shaping Timer");
timer.setAttribute("enabled", "true");
Element collectionProp = document.createElement("collectionProp");
collectionProp.setAttribute("name", "load_profile");
Element childCollectionProp = document.createElement("collectionProp");
childCollectionProp.setAttribute("name", "140409499");
childCollectionProp.appendChild(createStringProp(document, "49", "1"));
childCollectionProp.appendChild(createStringProp(document, "49", "1"));
childCollectionProp.appendChild(createStringProp(document, "1570", "10"));
collectionProp.appendChild(childCollectionProp);
timer.appendChild(collectionProp);
timerParent.appendChild(timer);
// 添加一个空的hashTree
timerParent.appendChild(document.createElement(HASH_TREE_ELEMENT));
}
private Element createStringProp(Document document, String name, String value) {
Element unit = document.createElement(STRING_PROP);
unit.setAttribute("name", name);
unit.appendChild(document.createTextNode(value));
return unit;
}
private void processConcurrencyThreadGroup(Element concurrencyThreadGroup) {
if (concurrencyThreadGroup.getChildNodes().getLength() > 0) {
final NodeList childNodes = concurrencyThreadGroup.getChildNodes();
for (int i = 0; i < childNodes.getLength(); i++) {
Node node = childNodes.item(i);
if (node instanceof Element) {
Element ele = (Element) node;
if (!valid(ele)) {
continue;
}
if (nodeNameEquals(ele, STRING_PROP)) {
parseStringProp(ele);
}
}
}
}
}
private void parseStringProp(Element stringProp) {
if (stringProp.getChildNodes().getLength() > 0) {
stringProp.getFirstChild().setNodeValue("1");
}
}
private boolean nodeNameEquals(Node node, String desiredName) {
return desiredName.equals(node.getNodeName()) || desiredName.equals(node.getLocalName());
}
private boolean valid(Element ele) {
return StringUtils.isBlank(ele.getAttribute("enabled")) || Boolean.parseBoolean(ele.getAttribute("enabled"));
}
private void removeChildren(Node node) {
while (node.hasChildNodes()) {
node.removeChild(node.getFirstChild());
}
}
}

View File

@ -1,204 +0,0 @@
package io.metersphere;
import com.opencsv.bean.CsvToBean;
import com.opencsv.bean.CsvToBeanBuilder;
import com.opencsv.bean.HeaderColumnNameMappingStrategy;
import org.junit.Test;
import java.io.Reader;
import java.io.StringReader;
import java.util.*;
import java.util.stream.Collectors;
public class JtlTest {
public static List<Metric> beanBuilderExample(String content) {
HeaderColumnNameMappingStrategy<io.metersphere.Metric> ms = new HeaderColumnNameMappingStrategy<>();
ms.setType(io.metersphere.Metric.class);
try (Reader reader = new StringReader(content)) {
CsvToBean<io.metersphere.Metric> cb = new CsvToBeanBuilder<Metric>(reader)
.withType(Metric.class)
.withSkipLines(0)
.withMappingStrategy(ms)
.withIgnoreLeadingWhiteSpace(true)
.build();
return cb.parse();
} catch (Exception ex) {
ex.printStackTrace();
}
return null;
}
@Test
public void getRequestStatistics() {
String jtlString = "timeStamp,elapsed,label,responseCode,responseMessage,threadName,dataType,success,failureMessage,bytes,sentBytes,grpThreads,allThreads,URL,Latency,IdleTime,Connect\n" +
"1584602493891,1107,https://rddev2.fit2cloud.com/,200,OK,Thread Group 1-3,text,true,,1473653,6950,3,3,https://rddev2.fit2cloud.com/auth/realms/cmp/protocol/openid-connect/auth?response_type=code&client_id=cmp-client&redirect_uri=https%3A%2F%2Frddev2.fit2cloud.com%2Fdashboard%2F&state=c81989f3-27d5-4b1a-a2db-03ddb06475d5&login=true&scope=openid,232,0,26\n" +
"1584602493891,235,https://rddev2.fit2cloud.com/-0,302,Found,Thread Group 1-3,,true,,214,567,3,3,https://rddev2.fit2cloud.com/,232,0,26\n" +
"1584602494128,11,https://rddev2.fit2cloud.com/-1,302,Found,Thread Group 1-3,,true,,615,577,3,3,https://rddev2.fit2cloud.com/dashboard/,11,0,0\n" +
"1584602494142,33,https://rddev2.fit2cloud.com/-2,200,OK,Thread Group 1-3,text,true,,8068,851,3,3,https://rddev2.fit2cloud.com/auth/realms/cmp/protocol/openid-connect/auth?response_type=code&client_id=cmp-client&redirect_uri=https%3A%2F%2Frddev2.fit2cloud.com%2Fdashboard%2F&state=c81989f3-27d5-4b1a-a2db-03ddb06475d5&login=true&scope=openid,32,0,0\n" +
"1584602494242,756,https://rddev2.fit2cloud.com/-3,200,OK,Thread Group 1-3,text,true,,1464756,4955,3,3,https://rddev2.fit2cloud.com/login,46,0,0\n" +
"1584602493891,1154,https://rddev2.fit2cloud.com/,200,OK,Thread Group 1-2,text,true,,1473685,6950,3,3,https://rddev2.fit2cloud.com/auth/realms/cmp/protocol/openid-connect/auth?response_type=code&client_id=cmp-client&redirect_uri=https%3A%2F%2Frddev2.fit2cloud.com%2Fdashboard%2F&state=374d02c0-6e1f-4937-b457-27d6e6ccf264&login=true&scope=openid,232,0,25\n" +
"1584602493891,235,https://rddev2.fit2cloud.com/-0,302,Found,Thread Group 1-2,,true,,214,567,3,3,https://rddev2.fit2cloud.com/,232,0,25\n" +
"1584602494128,11,https://rddev2.fit2cloud.com/-1,302,Found,Thread Group 1-2,,true,,615,577,3,3,https://rddev2.fit2cloud.com/dashboard/,11,0,0\n" +
"1584602494142,35,https://rddev2.fit2cloud.com/-2,200,OK,Thread Group 1-2,text,true,,8068,851,3,3,https://rddev2.fit2cloud.com/auth/realms/cmp/protocol/openid-connect/auth?response_type=code&client_id=cmp-client&redirect_uri=https%3A%2F%2Frddev2.fit2cloud.com%2Fdashboard%2F&state=374d02c0-6e1f-4937-b457-27d6e6ccf264&login=true&scope=openid,35,0,0\n" +
"1584602494242,803,https://rddev2.fit2cloud.com/-3,200,OK,Thread Group 1-2,text,true,,1464788,4955,3,3,https://rddev2.fit2cloud.com/login,45,0,0\n" +
"1584602493891,1316,https://rddev2.fit2cloud.com/,200,OK,Thread Group 1-1,text,true,,1473686,6942,3,3,https://rddev2.fit2cloud.com/auth/realms/cmp/protocol/openid-connect/auth?response_type=code&client_id=cmp-client&redirect_uri=https%3A%2F%2Frddev2.fit2cloud.com%2Fdashboard%2F&state=515530c4-0f36-454a-b536-9a11c7d2c47a&login=true&scope=openid,232,0,25\n" +
"1584602493891,235,https://rddev2.fit2cloud.com/-0,302,Found,Thread Group 1-1,,true,,214,567,3,3,https://rddev2.fit2cloud.com/,232,0,25\n" +
"1584602494128,12,https://rddev2.fit2cloud.com/-1,302,Found,Thread Group 1-1,,true,,614,577,3,3,https://rddev2.fit2cloud.com/dashboard/,12,0,0\n" +
"1584602494142,36,https://rddev2.fit2cloud.com/-2,200,OK,Thread Group 1-1,text,true,,8068,850,3,3,https://rddev2.fit2cloud.com/auth/realms/cmp/protocol/openid-connect/auth?response_type=code&client_id=cmp-client&redirect_uri=https%3A%2F%2Frddev2.fit2cloud.com%2Fdashboard%2F&state=515530c4-0f36-454a-b536-9a11c7d2c47a&login=true&scope=openid,35,0,0\n" +
"1584602494242,965,https://rddev2.fit2cloud.com/-3,200,OK,Thread Group 1-1,text,true,,1464790,4948,3,3,https://rddev2.fit2cloud.com/login,48,0,0\n" +
"1584602496824,550,https://rddev2.fit2cloud.com/,200,OK,Thread Group 1-5,text,true,,1473644,6950,5,5,https://rddev2.fit2cloud.com/auth/realms/cmp/protocol/openid-connect/auth?response_type=code&client_id=cmp-client&redirect_uri=https%3A%2F%2Frddev2.fit2cloud.com%2Fdashboard%2F&state=211a68fc-eb1e-482d-b5d2-636b411a133e&login=true&scope=openid,54,0,0\n" +
"1584602496824,54,https://rddev2.fit2cloud.com/-0,302,Found,Thread Group 1-5,,true,,214,567,5,5,https://rddev2.fit2cloud.com/,54,0,0\n" +
"1584602496878,12,https://rddev2.fit2cloud.com/-1,302,Found,Thread Group 1-5,,true,,615,577,5,5,https://rddev2.fit2cloud.com/dashboard/,12,0,0\n" +
"1584602496890,29,https://rddev2.fit2cloud.com/-2,200,OK,Thread Group 1-5,text,true,,8074,851,5,5,https://rddev2.fit2cloud.com/auth/realms/cmp/protocol/openid-connect/auth?response_type=code&client_id=cmp-client&redirect_uri=https%3A%2F%2Frddev2.fit2cloud.com%2Fdashboard%2F&state=211a68fc-eb1e-482d-b5d2-636b411a133e&login=true&scope=openid,29,0,0\n" +
"1584602496922,452,https://rddev2.fit2cloud.com/-3,200,OK,Thread Group 1-5,text,true,,1464741,4955,5,5,https://rddev2.fit2cloud.com/login,20,0,0\n" +
"1584602496821,559,https://rddev2.fit2cloud.com/,200,OK,Thread Group 1-4,text,true,,1473633,6958,5,5,https://rddev2.fit2cloud.com/auth/realms/cmp/protocol/openid-connect/auth?response_type=code&client_id=cmp-client&redirect_uri=https%3A%2F%2Frddev2.fit2cloud.com%2Fdashboard%2F&state=e6ebc175-e3dc-4c99-933b-f6610688dbfe&login=true&scope=openid,57,0,2\n" +
"1584602496821,57,https://rddev2.fit2cloud.com/-0,302,Found,Thread Group 1-4,,true,,214,567,5,5,https://rddev2.fit2cloud.com/,57,0,2\n" +
"1584602496878,11,https://rddev2.fit2cloud.com/-1,302,Found,Thread Group 1-4,,true,,616,577,5,5,https://rddev2.fit2cloud.com/dashboard/,11,0,0\n" +
"1584602496889,27,https://rddev2.fit2cloud.com/-2,200,OK,Thread Group 1-4,text,true,,8068,852,5,5,https://rddev2.fit2cloud.com/auth/realms/cmp/protocol/openid-connect/auth?response_type=code&client_id=cmp-client&redirect_uri=https%3A%2F%2Frddev2.fit2cloud.com%2Fdashboard%2F&state=e6ebc175-e3dc-4c99-933b-f6610688dbfe&login=true&scope=openid,27,0,0\n" +
"1584602496919,461,https://rddev2.fit2cloud.com/-3,200,OK,Thread Group 1-4,text,true,,1464735,4962,5,5,https://rddev2.fit2cloud.com/login,20,0,0\n" +
"1584602499028,73,https://rddev2.fit2cloud.com/auth/realms/cmp/login-actions/authenticate?session_code=YWUneSay4qlQuHRZsD4kPaZDIIR50KJLaNpW7uhsD-Q&execution=c7620733-54ab-46b2-802b-66764e42682b&client_id=cmp-client&tab_id=S8xOQPgCmhQ,400,Bad Request,Thread Group 1-1,text,false,,4469,1745,8,8,https://rddev2.fit2cloud.com/auth/realms/cmp/login-actions/authenticate,73,0,6\n" +
"1584602499125,0,https://rddev2.fit2cloud.com/dashboard/?state=3d31fe47-47bd-47f2-950d-9d135e0600ef&session_state=191d0330-dd9f-4bb0-8c24-0e3df46e2ff1&code=efe49afa-7afb-4c38-8e0c-38323291938c.191d0330-dd9f-4bb0-8c24-0e3df46e2ff1.fd56cca3-6d54-44aa-b879-a35e79fc1bfc,Non HTTP response code: java.net.URISyntaxException,\"Non HTTP response message: Illegal character in query at index 45: https://rddev2.fit2cloud.com/dashboard/?code=\n" +
" efe49afa-7afb-4c38-8e0c-38323291938c.191d0330-dd9f-4bb0-8c24-0e3df46e2ff1.fd56cca3-6d54-44aa-b879-a35e79fc1bfc\n" +
" &state=3d31fe47-47bd-47f2-950d-9d135e0600ef&session_state=191d0330-dd9f-4bb0-8c24-0e3df46e2ff1\",Thread Group 1-1,text,false,,1392,0,8,8,\"https://rddev2.fit2cloud.com/dashboard/?code=\n" +
" efe49afa-7afb-4c38-8e0c-38323291938c.191d0330-dd9f-4bb0-8c24-0e3df46e2ff1.fd56cca3-6d54-44aa-b879-a35e79fc1bfc\n" +
" &state=3d31fe47-47bd-47f2-950d-9d135e0600ef&session_state=191d0330-dd9f-4bb0-8c24-0e3df46e2ff1\",0,0,0\n" +
"1584602499126,21,https://rddev2.fit2cloud.com/dashboard/anonymous/i18n/en_US.json?_t=1577351137654,200,OK,Thread Group 1-1,text,true,,12438,559,8,8,https://rddev2.fit2cloud.com/dashboard/anonymous/i18n/en_US.json?_t=1577351137654,21,0,0\n" +
"1584602499251,18,https://rddev2.fit2cloud.com/dashboard/web-public/project/html/task-menus.html?_t=1577351137654,200,OK,Thread Group 1-1,text,true,,1916,573,8,8,https://rddev2.fit2cloud.com/dashboard/web-public/project/html/task-menus.html?_t=1577351137654,18,0,0\n" +
"1584602498833,509,https://rddev2.fit2cloud.com/,200,OK,Thread Group 1-7,text,true,,1473651,6942,8,8,https://rddev2.fit2cloud.com/auth/realms/cmp/protocol/openid-connect/auth?response_type=code&client_id=cmp-client&redirect_uri=https%3A%2F%2Frddev2.fit2cloud.com%2Fdashboard%2F&state=1f8130d4-f1c4-44f5-8633-03cc4892f31c&login=true&scope=openid,39,0,1\n" +
"1584602498833,39,https://rddev2.fit2cloud.com/-0,302,Found,Thread Group 1-7,,true,,214,567,8,8,https://rddev2.fit2cloud.com/,39,0,1\n" +
"1584602498872,9,https://rddev2.fit2cloud.com/-1,302,Found,Thread Group 1-7,,true,,614,577,8,8,https://rddev2.fit2cloud.com/dashboard/,9,0,0\n" +
"1584602498881,18,https://rddev2.fit2cloud.com/-2,200,OK,Thread Group 1-7,text,true,,8074,850,8,8,https://rddev2.fit2cloud.com/auth/realms/cmp/protocol/openid-connect/auth?response_type=code&client_id=cmp-client&redirect_uri=https%3A%2F%2Frddev2.fit2cloud.com%2Fdashboard%2F&state=1f8130d4-f1c4-44f5-8633-03cc4892f31c&login=true&scope=openid,18,0,0\n" +
"1584602498901,441,https://rddev2.fit2cloud.com/-3,200,OK,Thread Group 1-7,text,true,,1464749,4948,8,8,https://rddev2.fit2cloud.com/login,25,0,0\n" +
"1584602499325,71,https://rddev2.fit2cloud.com/auth/realms/cmp/login-actions/authenticate?session_code=YWUneSay4qlQuHRZsD4kPaZDIIR50KJLaNpW7uhsD-Q&execution=c7620733-54ab-46b2-802b-66764e42682b&client_id=cmp-client&tab_id=S8xOQPgCmhQ,400,Bad Request,Thread Group 1-2,text,false,,4469,1746,8,8,https://rddev2.fit2cloud.com/auth/realms/cmp/login-actions/authenticate,70,0,4\n" +
"1584602499445,16,https://rddev2.fit2cloud.com/dashboard/web-public/project/html/notification-menus.html?_t=1577351137654,200,OK,Thread Group 1-1,text,true,,1570,581,8,8,https://rddev2.fit2cloud.com/dashboard/web-public/project/html/notification-menus.html?_t=1577351137654,16,0,0\n" +
"1584602498832,637,https://rddev2.fit2cloud.com/,200,OK,Thread Group 1-6,text,true,,1473640,6958,8,8,https://rddev2.fit2cloud.com/auth/realms/cmp/protocol/openid-connect/auth?response_type=code&client_id=cmp-client&redirect_uri=https%3A%2F%2Frddev2.fit2cloud.com%2Fdashboard%2F&state=ceda817a-6ac6-4516-9cd8-c1b25429bf94&login=true&scope=openid,50,0,1\n" +
"1584602498832,50,https://rddev2.fit2cloud.com/-0,302,Found,Thread Group 1-6,,true,,214,567,8,8,https://rddev2.fit2cloud.com/,50,0,1\n" +
"1584602498882,9,https://rddev2.fit2cloud.com/-1,302,Found,Thread Group 1-6,,true,,616,577,8,8,https://rddev2.fit2cloud.com/dashboard/,9,0,0\n" +
"1584602498891,35,https://rddev2.fit2cloud.com/-2,200,OK,Thread Group 1-6,text,true,,8068,852,8,8,https://rddev2.fit2cloud.com/auth/realms/cmp/protocol/openid-connect/auth?response_type=code&client_id=cmp-client&redirect_uri=https%3A%2F%2Frddev2.fit2cloud.com%2Fdashboard%2F&state=ceda817a-6ac6-4516-9cd8-c1b25429bf94&login=true&scope=openid,35,0,0\n" +
"1584602498927,542,https://rddev2.fit2cloud.com/-3,200,OK,Thread Group 1-6,text,true,,1464742,4962,8,8,https://rddev2.fit2cloud.com/login,23,0,0\n" +
"1584602498836,635,https://rddev2.fit2cloud.com/,200,OK,Thread Group 1-8,text,true,,1473639,6950,8,8,https://rddev2.fit2cloud.com/auth/realms/cmp/protocol/openid-connect/auth?response_type=code&client_id=cmp-client&redirect_uri=https%3A%2F%2Frddev2.fit2cloud.com%2Fdashboard%2F&state=1b42574e-756d-4157-9987-a8e1df496718&login=true&scope=openid,46,0,0\n" +
"1584602498836,46,https://rddev2.fit2cloud.com/-0,302,Found,Thread Group 1-8,,true,,214,567,8,8,https://rddev2.fit2cloud.com/,46,0,0\n" +
"1584602498883,12,https://rddev2.fit2cloud.com/-1,302,Found,Thread Group 1-8,,true,,615,577,8,8,https://rddev2.fit2cloud.com/dashboard/,12,0,0\n" +
"1584602498896,36,https://rddev2.fit2cloud.com/-2,200,OK,Thread Group 1-8,text,true,,8074,851,8,8,https://rddev2.fit2cloud.com/auth/realms/cmp/protocol/openid-connect/auth?response_type=code&client_id=cmp-client&redirect_uri=https%3A%2F%2Frddev2.fit2cloud.com%2Fdashboard%2F&state=1b42574e-756d-4157-9987-a8e1df496718&login=true&scope=openid,36,0,0\n" +
"1584602498933,538,https://rddev2.fit2cloud.com/-3,200,OK,Thread Group 1-8,text,true,,1464736,4955,8,8,https://rddev2.fit2cloud.com/login,26,0,0\n" +
"1584602499605,0,https://rddev2.fit2cloud.com/dashboard/?state=3d31fe47-47bd-47f2-950d-9d135e0600ef&session_state=191d0330-dd9f-4bb0-8c24-0e3df46e2ff1&code=efe49afa-7afb-4c38-8e0c-38323291938c.191d0330-dd9f-4bb0-8c24-0e3df46e2ff1.fd56cca3-6d54-44aa-b879-a35e79fc1bfc,Non HTTP response code: java.net.URISyntaxException,\"Non HTTP response message: Illegal character in query at index 45: https://rddev2.fit2cloud.com/dashboard/?code=\n" +
" efe49afa-7afb-4c38-8e0c-38323291938c.191d0330-dd9f-4bb0-8c24-0e3df46e2ff1.fd56cca3-6d54-44aa-b879-a35e79fc1bfc\n" +
" &state=3d31fe47-47bd-47f2-950d-9d135e0600ef&session_state=191d0330-dd9f-4bb0-8c24-0e3df46e2ff1\",Thread Group 1-2,text,false,,1392,0,8,8,\"https://rddev2.fit2cloud.com/dashboard/?code=\n" +
" efe49afa-7afb-4c38-8e0c-38323291938c.191d0330-dd9f-4bb0-8c24-0e3df46e2ff1.fd56cca3-6d54-44aa-b879-a35e79fc1bfc\n" +
" &state=3d31fe47-47bd-47f2-950d-9d135e0600ef&session_state=191d0330-dd9f-4bb0-8c24-0e3df46e2ff1\",0,0,0\n" +
"1584602499607,19,https://rddev2.fit2cloud.com/dashboard/anonymous/i18n/en_US.json?_t=1577351137654,200,OK,Thread Group 1-2,text,true,,12424,560,8,8,https://rddev2.fit2cloud.com/dashboard/anonymous/i18n/en_US.json?_t=1577351137654,19,0,0\n" +
"1584602499856,21,https://rddev2.fit2cloud.com/dashboard/web-public/project/html/task-list.html?_t=1577351137654,200,OK,Thread Group 1-1,text,true,,2516,572,8,8,https://rddev2.fit2cloud.com/dashboard/web-public/project/html/task-list.html?_t=1577351137654,21,0,0\n" +
"1584602500034,27,https://rddev2.fit2cloud.com/dashboard/web-public/project/html/task-menus.html?_t=1577351137654,200,OK,Thread Group 1-2,text,true,,1916,574,8,8,https://rddev2.fit2cloud.com/dashboard/web-public/project/html/task-menus.html?_t=1577351137654,27,0,0\n" +
"1584602500182,23,https://rddev2.fit2cloud.com/dashboard/anonymous/license/validate?_nocache=1578039505321,200,OK,Thread Group 1-1,text,true,,288,566,8,8,https://rddev2.fit2cloud.com/dashboard/anonymous/license/validate?_nocache=1578039505321,23,0,0\n" +
"1584602500484,18,https://rddev2.fit2cloud.com/dashboard/web-public/project/html/notification-menus.html?_t=1577351137654,200,OK,Thread Group 1-2,text,true,,1570,582,8,8,https://rddev2.fit2cloud.com/dashboard/web-public/project/html/notification-menus.html?_t=1577351137654,18,0,0\n" +
"1584602500504,16,https://rddev2.fit2cloud.com/dashboard/web-public/project/html/task-list.html?_t=1577351137654,200,OK,Thread Group 1-2,text,true,,2516,573,8,8,https://rddev2.fit2cloud.com/dashboard/web-public/project/html/task-list.html?_t=1577351137654,16,0,0\n" +
"1584602500206,420,https://rddev2.fit2cloud.com/dashboard/module/all?_nocache=1578039505321,200,OK,Thread Group 1-1,text,true,,1473342,5748,8,8,https://rddev2.fit2cloud.com/auth/realms/cmp/protocol/openid-connect/auth?response_type=code&client_id=cmp-client&redirect_uri=https%3A%2F%2Frddev2.fit2cloud.com%2Fdashboard%2Fmodule%2Fall?_nocache%3D1578039505321&state=573519c4-a91b-4e46-b28d-f68231a8faf8&login=true&scope=openid,10,0,0\n" +
"1584602500206,10,https://rddev2.fit2cloud.com/dashboard/module/all?_nocache=1578039505321-0,302,Found,Thread Group 1-1,,true,,555,550,8,8,https://rddev2.fit2cloud.com/dashboard/module/all?_nocache=1578039505321,10,0,0\n" +
"1584602500216,23,https://rddev2.fit2cloud.com/dashboard/module/all?_nocache=1578039505321-1,200,OK,Thread Group 1-1,text,true,,8038,1439,8,8,https://rddev2.fit2cloud.com/auth/realms/cmp/protocol/openid-connect/auth?response_type=code&client_id=cmp-client&redirect_uri=https%3A%2F%2Frddev2.fit2cloud.com%2Fdashboard%2Fmodule%2Fall?_nocache%3D1578039505321&state=573519c4-a91b-4e46-b28d-f68231a8faf8&login=true&scope=openid,23,0,0\n" +
"1584602500243,383,https://rddev2.fit2cloud.com/dashboard/module/all?_nocache=1578039505321-2,200,OK,Thread Group 1-1,text,true,,1464749,3759,8,8,https://rddev2.fit2cloud.com/login,24,0,0\n" +
"1584602500622,18,https://rddev2.fit2cloud.com/dashboard/anonymous/license/validate?_nocache=1578039505321,200,OK,Thread Group 1-2,text,true,,288,567,8,8,https://rddev2.fit2cloud.com/dashboard/anonymous/license/validate?_nocache=1578039505321,18,0,0\n" +
"1584602500735,15,https://rddev2.fit2cloud.com/web-public/fit2cloud/html/loading/loading.html?_t=1577351137654,200,OK,Thread Group 1-1,text,true,,503,506,8,8,https://rddev2.fit2cloud.com/web-public/fit2cloud/html/loading/loading.html?_t=1577351137654,15,0,0\n" +
"1584602501143,58,https://rddev2.fit2cloud.com/auth/realms/cmp/login-actions/authenticate?session_code=YWUneSay4qlQuHRZsD4kPaZDIIR50KJLaNpW7uhsD-Q&execution=c7620733-54ab-46b2-802b-66764e42682b&client_id=cmp-client&tab_id=S8xOQPgCmhQ,400,Bad Request,Thread Group 1-5,text,false,,4469,1746,8,8,https://rddev2.fit2cloud.com/auth/realms/cmp/login-actions/authenticate,58,0,4\n" +
"1584602501233,0,https://rddev2.fit2cloud.com/dashboard/?state=3d31fe47-47bd-47f2-950d-9d135e0600ef&session_state=191d0330-dd9f-4bb0-8c24-0e3df46e2ff1&code=efe49afa-7afb-4c38-8e0c-38323291938c.191d0330-dd9f-4bb0-8c24-0e3df46e2ff1.fd56cca3-6d54-44aa-b879-a35e79fc1bfc,Non HTTP response code: java.net.URISyntaxException,\"Non HTTP response message: Illegal character in query at index 45: https://rddev2.fit2cloud.com/dashboard/?code=\n" +
" efe49afa-7afb-4c38-8e0c-38323291938c.191d0330-dd9f-4bb0-8c24-0e3df46e2ff1.fd56cca3-6d54-44aa-b879-a35e79fc1bfc\n" +
" &state=3d31fe47-47bd-47f2-950d-9d135e0600ef&session_state=191d0330-dd9f-4bb0-8c24-0e3df46e2ff1\",Thread Group 1-5,text,false,,1392,0,8,8,\"https://rddev2.fit2cloud.com/dashboard/?code=\n" +
" efe49afa-7afb-4c38-8e0c-38323291938c.191d0330-dd9f-4bb0-8c24-0e3df46e2ff1.fd56cca3-6d54-44aa-b879-a35e79fc1bfc\n" +
" &state=3d31fe47-47bd-47f2-950d-9d135e0600ef&session_state=191d0330-dd9f-4bb0-8c24-0e3df46e2ff1\",0,0,0\n" +
"1584602501234,19,https://rddev2.fit2cloud.com/dashboard/anonymous/i18n/en_US.json?_t=1577351137654,200,OK,Thread Group 1-5,text,true,,12438,560,8,8,https://rddev2.fit2cloud.com/dashboard/anonymous/i18n/en_US.json?_t=1577351137654,19,0,0\n" +
"1584602501253,17,https://rddev2.fit2cloud.com/dashboard/web-public/project/html/task-menus.html?_t=1577351137654,200,OK,Thread Group 1-5,text,true,,1916,574,8,8,https://rddev2.fit2cloud.com/dashboard/web-public/project/html/task-menus.html?_t=1577351137654,17,0,0\n" +
"1584602500841,509,https://rddev2.fit2cloud.com/dashboard/module/all?_nocache=1578039505321,200,OK,Thread Group 1-2,text,true,,1473319,5757,8,8,https://rddev2.fit2cloud.com/auth/realms/cmp/protocol/openid-connect/auth?response_type=code&client_id=cmp-client&redirect_uri=https%3A%2F%2Frddev2.fit2cloud.com%2Fdashboard%2Fmodule%2Fall?_nocache%3D1578039505321&state=c27f5334-b14f-43e8-ba3d-a31d6f385c32&login=true&scope=openid,13,0,0\n" +
"1584602500841,13,https://rddev2.fit2cloud.com/dashboard/module/all?_nocache=1578039505321-0,302,Found,Thread Group 1-2,,true,,555,551,8,8,https://rddev2.fit2cloud.com/dashboard/module/all?_nocache=1578039505321,13,0,0\n" +
"1584602500855,29,https://rddev2.fit2cloud.com/dashboard/module/all?_nocache=1578039505321-1,200,OK,Thread Group 1-2,text,true,,8038,1440,8,8,https://rddev2.fit2cloud.com/auth/realms/cmp/protocol/openid-connect/auth?response_type=code&client_id=cmp-client&redirect_uri=https%3A%2F%2Frddev2.fit2cloud.com%2Fdashboard%2Fmodule%2Fall?_nocache%3D1578039505321&state=c27f5334-b14f-43e8-ba3d-a31d6f385c32&login=true&scope=openid,29,0,0\n" +
"1584602500887,463,https://rddev2.fit2cloud.com/dashboard/module/all?_nocache=1578039505321-2,200,OK,Thread Group 1-2,text,true,,1464726,3766,8,8,https://rddev2.fit2cloud.com/login,26,0,0\n" +
"1584602501352,16,https://rddev2.fit2cloud.com/web-public/fit2cloud/html/loading/loading.html?_t=1577351137654,200,OK,Thread Group 1-2,text,true,,503,507,8,8,https://rddev2.fit2cloud.com/web-public/fit2cloud/html/loading/loading.html?_t=1577351137654,16,0,0\n" +
"1584602501458,13,https://rddev2.fit2cloud.com/dashboard/web-public/project/html/notification-menus.html?_t=1577351137654,200,OK,Thread Group 1-5,text,true,,1570,582,8,8,https://rddev2.fit2cloud.com/dashboard/web-public/project/html/notification-menus.html?_t=1577351137654,13,0,0\n" +
"1584602501663,17,https://rddev2.fit2cloud.com/dashboard/web-public/project/html/task-list.html?_t=1577351137654,200,OK,Thread Group 1-5,text,true,,2516,573,8,8,https://rddev2.fit2cloud.com/dashboard/web-public/project/html/task-list.html?_t=1577351137654,17,0,0\n" +
"1584602501435,359,https://rddev2.fit2cloud.com/dashboard/flow/runtime/task/pending/1/50,200,OK,Thread Group 1-1,text,true,,1473387,6761,8,8,https://rddev2.fit2cloud.com/auth/realms/cmp/protocol/openid-connect/auth?response_type=code&client_id=cmp-client&redirect_uri=https%3A%2F%2Frddev2.fit2cloud.com%2Fdashboard%2Fflow%2Fruntime%2Ftask%2Fpending%2F1%2F50&state=832af3d4-2ca4-4e23-bf2a-e14a01d27fc0&login=true&scope=openid,11,0,0\n" +
"1584602501435,11,https://rddev2.fit2cloud.com/dashboard/flow/runtime/task/pending/1/50-0,302,Found,Thread Group 1-1,,true,,558,653,8,8,https://rddev2.fit2cloud.com/dashboard/flow/runtime/task/pending/1/50,11,0,0\n" +
"1584602501446,22,https://rddev2.fit2cloud.com/dashboard/flow/runtime/task/pending/1/50-1,200,OK,Thread Group 1-1,text,true,,8030,1614,8,8,https://rddev2.fit2cloud.com/auth/realms/cmp/protocol/openid-connect/auth?response_type=code&client_id=cmp-client&redirect_uri=https%3A%2F%2Frddev2.fit2cloud.com%2Fdashboard%2Fflow%2Fruntime%2Ftask%2Fpending%2F1%2F50&state=832af3d4-2ca4-4e23-bf2a-e14a01d27fc0&login=true&scope=openid,22,0,0\n" +
"1584602501471,323,https://rddev2.fit2cloud.com/dashboard/flow/runtime/task/pending/1/50-2,200,OK,Thread Group 1-1,text,true,,1464799,4494,8,8,https://rddev2.fit2cloud.com/login,23,0,0\n" +
"1584602501784,17,https://rddev2.fit2cloud.com/dashboard/anonymous/license/validate?_nocache=1578039505321,200,OK,Thread Group 1-5,text,true,,288,567,8,8,https://rddev2.fit2cloud.com/dashboard/anonymous/license/validate?_nocache=1578039505321,17,0,0\n" +
"1584602501907,304,https://rddev2.fit2cloud.com/dashboard/notification/list/unread/1/50,200,OK,Thread Group 1-1,text,true,,1473471,6749,10,10,https://rddev2.fit2cloud.com/auth/realms/cmp/protocol/openid-connect/auth?response_type=code&client_id=cmp-client&redirect_uri=https%3A%2F%2Frddev2.fit2cloud.com%2Fdashboard%2Fnotification%2Flist%2Funread%2F1%2F50&state=1904f64b-a8f9-44d8-867e-359cfe46297f&login=true&scope=openid,10,0,0\n" +
"1584602501907,10,https://rddev2.fit2cloud.com/dashboard/notification/list/unread/1/50-0,302,Found,Thread Group 1-1,,true,,555,652,10,10,https://rddev2.fit2cloud.com/dashboard/notification/list/unread/1/50,10,0,0\n" +
"1584602501917,24,https://rddev2.fit2cloud.com/dashboard/notification/list/unread/1/50-1,200,OK,Thread Group 1-1,text,true,,8021,1603,10,10,https://rddev2.fit2cloud.com/auth/realms/cmp/protocol/openid-connect/auth?response_type=code&client_id=cmp-client&redirect_uri=https%3A%2F%2Frddev2.fit2cloud.com%2Fdashboard%2Fnotification%2Flist%2Funread%2F1%2F50&state=1904f64b-a8f9-44d8-867e-359cfe46297f&login=true&scope=openid,24,0,0\n" +
"1584602501943,268,https://rddev2.fit2cloud.com/dashboard/notification/list/unread/1/50-2,200,OK,Thread Group 1-1,text,true,,1464895,4494,10,10,https://rddev2.fit2cloud.com/login,23,0,0\n" +
"1584602502213,16,https://rddev2.fit2cloud.com/web-public/project/html/pagination.html?_t=1577351137654,200,OK,Thread Group 1-1,text,true,,1162,499,10,10,https://rddev2.fit2cloud.com/web-public/project/html/pagination.html?_t=1577351137654,16,0,0\n" +
"1584602501802,513,https://rddev2.fit2cloud.com/dashboard/module/all?_nocache=1578039505321,200,OK,Thread Group 1-5,text,true,,1473342,5757,10,10,https://rddev2.fit2cloud.com/auth/realms/cmp/protocol/openid-connect/auth?response_type=code&client_id=cmp-client&redirect_uri=https%3A%2F%2Frddev2.fit2cloud.com%2Fdashboard%2Fmodule%2Fall?_nocache%3D1578039505321&state=7d3aea03-3217-44da-81be-35c41c1db2d7&login=true&scope=openid,15,0,0\n" +
"1584602501802,15,https://rddev2.fit2cloud.com/dashboard/module/all?_nocache=1578039505321-0,302,Found,Thread Group 1-5,,true,,555,551,10,10,https://rddev2.fit2cloud.com/dashboard/module/all?_nocache=1578039505321,15,0,0\n" +
"1584602501817,23,https://rddev2.fit2cloud.com/dashboard/module/all?_nocache=1578039505321-1,200,OK,Thread Group 1-5,text,true,,8038,1440,10,10,https://rddev2.fit2cloud.com/auth/realms/cmp/protocol/openid-connect/auth?response_type=code&client_id=cmp-client&redirect_uri=https%3A%2F%2Frddev2.fit2cloud.com%2Fdashboard%2Fmodule%2Fall?_nocache%3D1578039505321&state=7d3aea03-3217-44da-81be-35c41c1db2d7&login=true&scope=openid,23,0,0\n" +
"1584602501842,473,https://rddev2.fit2cloud.com/dashboard/module/all?_nocache=1578039505321-2,200,OK,Thread Group 1-5,text,true,,1464749,3766,10,10,https://rddev2.fit2cloud.com/login,18,0,0\n" +
"1584602502316,28,https://rddev2.fit2cloud.com/web-public/fit2cloud/html/loading/loading.html?_t=1577351137654,200,OK,Thread Group 1-5,text,true,,503,507,10,10,https://rddev2.fit2cloud.com/web-public/fit2cloud/html/loading/loading.html?_t=1577351137654,28,0,0\n" +
"1584602502110,631,https://rddev2.fit2cloud.com/,200,OK,Thread Group 1-10,text,true,,1473668,6950,10,10,https://rddev2.fit2cloud.com/auth/realms/cmp/protocol/openid-connect/auth?response_type=code&client_id=cmp-client&redirect_uri=https%3A%2F%2Frddev2.fit2cloud.com%2Fdashboard%2F&state=26792af8-d8cd-4ed6-b0e0-68ad7220004f&login=true&scope=openid,63,0,1\n" +
"1584602502110,63,https://rddev2.fit2cloud.com/-0,302,Found,Thread Group 1-10,,true,,214,567,10,10,https://rddev2.fit2cloud.com/,63,0,1\n" +
"1584602502173,15,https://rddev2.fit2cloud.com/-1,302,Found,Thread Group 1-10,,true,,615,577,10,10,https://rddev2.fit2cloud.com/dashboard/,15,0,0\n" +
"1584602502189,39,https://rddev2.fit2cloud.com/-2,200,OK,Thread Group 1-10,text,true,,8074,851,10,10,https://rddev2.fit2cloud.com/auth/realms/cmp/protocol/openid-connect/auth?response_type=code&client_id=cmp-client&redirect_uri=https%3A%2F%2Frddev2.fit2cloud.com%2Fdashboard%2F&state=26792af8-d8cd-4ed6-b0e0-68ad7220004f&login=true&scope=openid,39,0,0\n" +
"1584602502229,512,https://rddev2.fit2cloud.com/-3,200,OK,Thread Group 1-10,text,true,,1464765,4955,10,10,https://rddev2.fit2cloud.com/login,18,0,0\n" +
"1584602502169,625,https://rddev2.fit2cloud.com/dashboard/flow/runtime/task/pending/1/50,200,OK,Thread Group 1-2,text,true,,1473329,6770,10,10,https://rddev2.fit2cloud.com/auth/realms/cmp/protocol/openid-connect/auth?response_type=code&client_id=cmp-client&redirect_uri=https%3A%2F%2Frddev2.fit2cloud.com%2Fdashboard%2Fflow%2Fruntime%2Ftask%2Fpending%2F1%2F50&state=7bfdeacf-3f22-449d-88f9-f0d792bfe1bb&login=true&scope=openid,19,0,0\n" +
"1584602502169,19,https://rddev2.fit2cloud.com/dashboard/flow/runtime/task/pending/1/50-0,302,Found,Thread Group 1-2,,true,,558,654,10,10,https://rddev2.fit2cloud.com/dashboard/flow/runtime/task/pending/1/50,19,0,0\n" +
"1584602502189,32,https://rddev2.fit2cloud.com/dashboard/flow/runtime/task/pending/1/50-1,200,OK,Thread Group 1-2,text,true,,8030,1615,10,10,https://rddev2.fit2cloud.com/auth/realms/cmp/protocol/openid-connect/auth?response_type=code&client_id=cmp-client&redirect_uri=https%3A%2F%2Frddev2.fit2cloud.com%2Fdashboard%2Fflow%2Fruntime%2Ftask%2Fpending%2F1%2F50&state=7bfdeacf-3f22-449d-88f9-f0d792bfe1bb&login=true&scope=openid,32,0,0\n" +
"1584602502222,572,https://rddev2.fit2cloud.com/dashboard/flow/runtime/task/pending/1/50-2,200,OK,Thread Group 1-2,text,true,,1464741,4501,10,10,https://rddev2.fit2cloud.com/login,21,0,0\n" +
"1584602502110,713,https://rddev2.fit2cloud.com/,200,OK,Thread Group 1-9,text,true,,1473667,6942,10,10,https://rddev2.fit2cloud.com/auth/realms/cmp/protocol/openid-connect/auth?response_type=code&client_id=cmp-client&redirect_uri=https%3A%2F%2Frddev2.fit2cloud.com%2Fdashboard%2F&state=cb0aadfc-16eb-486b-b7f1-2c2df1c3231c&login=true&scope=openid,63,0,1\n" +
"1584602502110,63,https://rddev2.fit2cloud.com/-0,302,Found,Thread Group 1-9,,true,,214,567,10,10,https://rddev2.fit2cloud.com/,63,0,1\n" +
"1584602502174,21,https://rddev2.fit2cloud.com/-1,302,Found,Thread Group 1-9,,true,,614,577,10,10,https://rddev2.fit2cloud.com/dashboard/,21,0,0\n" +
"1584602502195,34,https://rddev2.fit2cloud.com/-2,200,OK,Thread Group 1-9,text,true,,8074,850,10,10,https://rddev2.fit2cloud.com/auth/realms/cmp/protocol/openid-connect/auth?response_type=code&client_id=cmp-client&redirect_uri=https%3A%2F%2Frddev2.fit2cloud.com%2Fdashboard%2F&state=cb0aadfc-16eb-486b-b7f1-2c2df1c3231c&login=true&scope=openid,34,0,0\n" +
"1584602502231,592,https://rddev2.fit2cloud.com/-3,200,OK,Thread Group 1-9,text,true,,1464765,4948,10,10,https://rddev2.fit2cloud.com/login,21,0,0\n" +
"1584602502434,434,https://rddev2.fit2cloud.com/dashboard/flow/runtime/task/pending/1/50,200,OK,Thread Group 1-1,text,true,,1473315,6926,10,10,https://rddev2.fit2cloud.com/auth/realms/cmp/protocol/openid-connect/auth?response_type=code&client_id=cmp-client&redirect_uri=https%3A%2F%2Frddev2.fit2cloud.com%2Fdashboard%2Fflow%2Fruntime%2Ftask%2Fpending%2F1%2F50&state=b2a99afa-66a7-411d-bba9-239c9b20de82&login=true&scope=openid,18,0,0\n" +
"1584602502434,18,https://rddev2.fit2cloud.com/dashboard/flow/runtime/task/pending/1/50-0,302,Found,Thread Group 1-1,,true,,558,731,10,10,https://rddev2.fit2cloud.com/dashboard/flow/runtime/task/pending/1/50,18,0,0\n" +
"1584602502452,27,https://rddev2.fit2cloud.com/dashboard/flow/runtime/task/pending/1/50-1,200,OK,Thread Group 1-1,text,true,,8024,1603,10,10,https://rddev2.fit2cloud.com/auth/realms/cmp/protocol/openid-connect/auth?response_type=code&client_id=cmp-client&redirect_uri=https%3A%2F%2Frddev2.fit2cloud.com%2Fdashboard%2Fflow%2Fruntime%2Ftask%2Fpending%2F1%2F50&state=b2a99afa-66a7-411d-bba9-239c9b20de82&login=true&scope=openid,27,0,0\n" +
"1584602502481,387,https://rddev2.fit2cloud.com/dashboard/flow/runtime/task/pending/1/50-2,200,OK,Thread Group 1-1,text,true,,1464733,4592,10,10,https://rddev2.fit2cloud.com/login,25,0,0\n" +
"1584602502839,65,https://rddev2.fit2cloud.com/auth/realms/cmp/login-actions/authenticate?session_code=YWUneSay4qlQuHRZsD4kPaZDIIR50KJLaNpW7uhsD-Q&execution=c7620733-54ab-46b2-802b-66764e42682b&client_id=cmp-client&tab_id=S8xOQPgCmhQ,400,Bad Request,Thread Group 1-3,text,false,,4462,1746,10,10,https://rddev2.fit2cloud.com/auth/realms/cmp/login-actions/authenticate,65,0,1\n" +
"1584602502961,0,https://rddev2.fit2cloud.com/dashboard/?state=3d31fe47-47bd-47f2-950d-9d135e0600ef&session_state=191d0330-dd9f-4bb0-8c24-0e3df46e2ff1&code=efe49afa-7afb-4c38-8e0c-38323291938c.191d0330-dd9f-4bb0-8c24-0e3df46e2ff1.fd56cca3-6d54-44aa-b879-a35e79fc1bfc,Non HTTP response code: java.net.URISyntaxException,\"Non HTTP response message: Illegal character in query at index 45: https://rddev2.fit2cloud.com/dashboard/?code=\n" +
" efe49afa-7afb-4c38-8e0c-38323291938c.191d0330-dd9f-4bb0-8c24-0e3df46e2ff1.fd56cca3-6d54-44aa-b879-a35e79fc1bfc\n" +
" &state=3d31fe47-47bd-47f2-950d-9d135e0600ef&session_state=191d0330-dd9f-4bb0-8c24-0e3df46e2ff1\",Thread Group 1-3,text,false,,1392,0,10,10,\"https://rddev2.fit2cloud.com/dashboard/?code=\n" +
" efe49afa-7afb-4c38-8e0c-38323291938c.191d0330-dd9f-4bb0-8c24-0e3df46e2ff1.fd56cca3-6d54-44aa-b879-a35e79fc1bfc\n" +
" &state=3d31fe47-47bd-47f2-950d-9d135e0600ef&session_state=191d0330-dd9f-4bb0-8c24-0e3df46e2ff1\",0,0,0\n" +
"1584602503108,27,https://rddev2.fit2cloud.com/dashboard/anonymous/i18n/en_US.json?_t=1577351137654,200,OK,Thread Group 1-3,text,true,,12438,560,10,10,https://rddev2.fit2cloud.com/dashboard/anonymous/i18n/en_US.json?_t=1577351137654,27,0,0\n" +
"1584602503239,23,https://rddev2.fit2cloud.com/dashboard/web-public/project/html/task-menus.html?_t=1577351137654,200,OK,Thread Group 1-3,text,true,,1916,574,10,10,https://rddev2.fit2cloud.com/dashboard/web-public/project/html/task-menus.html?_t=1577351137654,23,0,0\n" +
"1584602503006,262,https://rddev2.fit2cloud.com/dashboard/user/current/info?_nocache=1578039505484,200,OK,Thread Group 1-1,text,true,,1473599,5844,10,10,https://rddev2.fit2cloud.com/auth/realms/cmp/protocol/openid-connect/auth?response_type=code&client_id=cmp-client&redirect_uri=https%3A%2F%2Frddev2.fit2cloud.com%2Fdashboard%2Fuser%2Fcurrent%2Finfo?_nocache%3D1578039505484&state=10ff89f8-c521-42a3-99bd-d2929d4260cc&login=true&scope=openid,14,0,0\n" +
"1584602503006,14,https://rddev2.fit2cloud.com/dashboard/user/current/info?_nocache=1578039505484-0,302,Found,Thread Group 1-1,,true,,564,557,10,10,https://rddev2.fit2cloud.com/dashboard/user/current/info?_nocache=1578039505484,14,0,0\n" +
"1584602503021,22,https://rddev2.fit2cloud.com/dashboard/user/current/info?_nocache=1578039505484-1,200,OK,Thread Group 1-1,text,true,,8056,1528,10,10,https://rddev2.fit2cloud.com/auth/realms/cmp/protocol/openid-connect/auth?response_type=code&client_id=cmp-client&redirect_uri=https%3A%2F%2Frddev2.fit2cloud.com%2Fdashboard%2Fuser%2Fcurrent%2Finfo?_nocache%3D1578039505484&state=10ff89f8-c521-42a3-99bd-d2929d4260cc&login=true&scope=openid,22,0,0\n" +
"1584602503047,221,https://rddev2.fit2cloud.com/dashboard/user/current/info?_nocache=1578039505484-2,200,OK,Thread Group 1-1,text,true,,1464979,3759,10,10,https://rddev2.fit2cloud.com/login,20,0,0\n" +
"1584602502806,506,https://rddev2.fit2cloud.com/dashboard/notification/list/unread/1/50,200,OK,Thread Group 1-2,text,true,,1473450,6758,10,10,https://rddev2.fit2cloud.com/auth/realms/cmp/protocol/openid-connect/auth?response_type=code&client_id=cmp-client&redirect_uri=https%3A%2F%2Frddev2.fit2cloud.com%2Fdashboard%2Fnotification%2Flist%2Funread%2F1%2F50&state=f4ac4eb9-f92a-4bcc-8214-3eac6df6d1c9&login=true&scope=openid,12,0,0\n" +
"1584602502806,12,https://rddev2.fit2cloud.com/dashboard/notification/list/unread/1/50-0,302,Found,Thread Group 1-2,,true,,555,653,10,10,https://rddev2.fit2cloud.com/dashboard/notification/list/unread/1/50,12,0,0\n" +
"1584602502819,26,https://rddev2.fit2cloud.com/dashboard/notification/list/unread/1/50-1,200,OK,Thread Group 1-2,text,true,,8027,1604,10,10,https://rddev2.fit2cloud.com/auth/realms/cmp/protocol/openid-connect/auth?response_type=code&client_id=cmp-client&redirect_uri=https%3A%2F%2Frddev2.fit2cloud.com%2Fdashboard%2Fnotification%2Flist%2Funread%2F1%2F50&state=f4ac4eb9-f92a-4bcc-8214-3eac6df6d1c9&login=true&scope=openid,26,0,0\n" +
"1584602502846,466,https://rddev2.fit2cloud.com/dashboard/notification/list/unread/1/50-2,200,OK,Thread Group 1-2,text,true,,1464868,4501,10,10,https://rddev2.fit2cloud.com/login,15,0,0\n" +
"1584602503314,13,https://rddev2.fit2cloud.com/web-public/project/html/pagination.html?_t=1577351137654,200,OK,Thread Group 1-2,text,true,,1162,500,10,10,https://rddev2.fit2cloud.com/web-public/project/html/pagination.html?_t=1577351137654,13,0,0\n" +
"1584602503471,15,https://rddev2.fit2cloud.com/dashboard/web-public/project/html/header-menu.html?_t=1577351137654,200,OK,Thread Group 1-1,text,true,,3117,574,10,10,https://rddev2.fit2cloud.com/dashboard/web-public/project/html/header-menu.html?_t=1577351137654,15,0,0\n" +
"1584602503471,54,https://rddev2.fit2cloud.com/auth/realms/cmp/login-actions/authenticate?session_code=YWUneSay4qlQuHRZsD4kPaZDIIR50KJLaNpW7uhsD-Q&execution=c7620733-54ab-46b2-802b-66764e42682b&client_id=cmp-client&tab_id=S8xOQPgCmhQ,400,Bad Request,Thread Group 1-4,text,false,,4462,1747,10,10,https://rddev2.fit2cloud.com/auth/realms/cmp/login-actions/authenticate,54,0,4\n" +
"1584602503569,0,https://rddev2.fit2cloud.com/dashboard/?state=3d31fe47-47bd-47f2-950d-9d135e0600ef&session_state=191d0330-dd9f-4bb0-8c24-0e3df46e2ff1&code=efe49afa-7afb-4c38-8e0c-38323291938c.191d0330-dd9f-4bb0-8c24-0e3df46e2ff1.fd56cca3-6d54-44aa-b879-a35e79fc1bfc,Non HTTP response code: java.net.URISyntaxException,\"Non HTTP response message: Illegal character in query at index 45: https://rddev2.fit2cloud.com/dashboard/?code=\n" +
" efe49afa-7afb-4c38-8e0c-38323291938c.191d0330-dd9f-4bb0-8c24-0e3df46e2ff1.fd56cca3-6d54-44aa-b879-a35e79fc1bfc\n" +
" &state=3d31fe47-47bd-47f2-950d-9d135e0600ef&session_state=191d0330-dd9f-4bb0-8c24-0e3df46e2ff1\",Thread Group 1-4,text,false,,1392,0,10,10,\"https://rddev2.fit2cloud.com/dashboard/?code=\n" +
" efe49afa-7afb-4c38-8e0c-38323291938c.191d0330-dd9f-4bb0-8c24-0e3df46e2ff1.fd56cca3-6d54-44aa-b879-a35e79fc1bfc\n" +
" &state=3d31fe47-47bd-47f2-950d-9d135e0600ef&session_state=191d0330-dd9f-4bb0-8c24-0e3df46e2ff1\",0,0,0\n" +
"1584602503108,494,https://rddev2.fit2cloud.com/dashboard/flow/runtime/task/pending/1/50,200,OK,Thread Group 1-5,text,true,,1473344,6770,10,10,https://rddev2.fit2cloud.com/auth/realms/cmp/protocol/openid-connect/auth?response_type=code&client_id=cmp-client&redirect_uri=https%3A%2F%2Frddev2.fit2cloud.com%2Fdashboard%2Fflow%2Fruntime%2Ftask%2Fpending%2F1%2F50&state=bbc579c2-fce7-4f4c-a9e0-9e27c818248c&login=true&scope=openid,21,0,0\n" +
"1584602503108,21,https://rddev2.fit2cloud.com/dashboard/flow/runtime/task/pending/1/50-0,302,Found,Thread Group 1-5,,true,,558,654,10,10,https://rddev2.fit2cloud.com/dashboard/flow/runtime/task/pending/1/50,21,0,0\n" +
"1584602503129,39,https://rddev2.fit2cloud.com/dashboard/flow/runtime/task/pending/1/50-1,200,OK,Thread Group 1-5,text,true,,8030,1615,10,10,https://rddev2.fit2cloud.com/auth/realms/cmp/protocol/openid-connect/auth?response_type=code&client_id=cmp-client&redirect_uri=https%3A%2F%2Frddev2.fit2cloud.com%2Fdashboard%2Fflow%2Fruntime%2Ftask%2Fpending%2F1%2F50&state=bbc579c2-fce7-4f4c-a9e0-9e27c818248c&login=true&scope=openid,39,0,0\n" +
"1584602503170,432,https://rddev2.fit2cloud.com/dashboard/flow/runtime/task/pending/1/50-2,200,OK,Thread Group 1-5,text,true,,1464756,4501,10,10,https://rddev2.fit2cloud.com/login,25,0,0\n" +
"1584602503607,363,https://rddev2.fit2cloud.com/dashboard/notification/list/unread/1/50,200,OK,Thread Group 1-5,text,true,,1473560,6758,10,10,https://rddev2.fit2cloud.com/auth/realms/cmp/protocol/openid-connect/auth?response_type=code&client_id=cmp-client&redirect_uri=https%3A%2F%2Frddev2.fit2cloud.com%2Fdashboard%2Fnotification%2Flist%2Funread%2F1%2F50&state=db071ff5-a114-4a0d-b693-fd1d8e477e75&login=true&scope=openid,12,0,0\n" +
"1584602503607,12,https://rddev2.fit2cloud.com/dashboard/notification/list/unread/1/50-0,302,Found,Thread Group 1-5,,true,,555,653,10,10,https://rddev2.fit2cloud.com/dashboard/notification/list/unread/1/50,12,0,0\n" +
"1584602503619,23,https://rddev2.fit2cloud.com/dashboard/notification/list/unread/1/50-1,200,OK,Thread Group 1-5,text,true,,8027,1604,10,10,https://rddev2.fit2cloud.com/auth/realms/cmp/protocol/openid-connect/auth?response_type=code&client_id=cmp-client&redirect_uri=https%3A%2F%2Frddev2.fit2cloud.com%2Fdashboard%2Fnotification%2Flist%2Funread%2F1%2F50&state=db071ff5-a114-4a0d-b693-fd1d8e477e75&login=true&scope=openid,23,0,0\n" +
"1584602503644,326,https://rddev2.fit2cloud.com/dashboard/notification/list/unread/1/50-2,200,OK,Thread Group 1-5,text,true,,1464978,4501,10,10,https://rddev2.fit2cloud.com/login,18,0,0\n" +
"1584602503971,15,https://rddev2.fit2cloud.com/web-public/project/html/pagination.html?_t=1577351137654,200,OK,Thread Group 1-5,text,true,,1162,500,10,10,https://rddev2.fit2cloud.com/web-public/project/html/pagination.html?_t=1577351137654,15,0,0\n" +
"1584602503971,19,https://rddev2.fit2cloud.com/dashboard/anonymous/i18n/en_US.json?_t=1577351137654,200,OK,Thread Group 1-4,text,true,,12438,561,10,10,https://rddev2.fit2cloud.com/dashboard/anonymous/i18n/en_US.json?_t=1577351137654,19,0,0\n" +
"1584602503792,32,https://rddev2.fit2cloud.com/dashboard/user/source/list?_nocache=1578039505551,200,OK,Thread Group 1-1,text,true,,8617,2109,10,10,https://rddev2.fit2cloud.com/auth/realms/cmp/protocol/openid-connect/auth?response_type=code&client_id=cmp-client&redirect_uri=https%3A%2F%2Frddev2.fit2cloud.com%2Fdashboard%2Fuser%2Fsource%2Flist?_nocache%3D1578039505551&state=2bc90b74-8d32-4217-a573-bfbd969b6b16&login=true&scope=openid,10,0,0\n" +
"1584602503792,10,https://rddev2.fit2cloud.com/dashboard/user/source/list?_nocache=1578039505551-0,302,Found,Thread Group 1-1,,true,,563,556,10,10,https://rddev2.fit2cloud.com/dashboard/user/source/list?_nocache=1578039505551,10,0,0\n" +
"1584602503803,21,https://rddev2.fit2cloud.com/dashboard/user/source/list?_nocache=1578039505551-1,200,OK,Thread Group 1-1,text,true,,8054,1553,10,10,https://rddev2.fit2cloud.com/auth/realms/cmp/protocol/openid-connect/auth?response_type=code&client_id=cmp-client&redirect_uri=https%3A%2F%2Frddev2.fit2cloud.com%2Fdashboard%2Fuser%2Fsource%2Flist?_nocache%3D1578039505551&state=2bc90b74-8d32-4217-a573-bfbd969b6b16&login=true&scope=openid,21,0,0\n" +
"1584602504095,21,https://rddev2.fit2cloud.com/auth/realms/cmp/login-actions/authenticate?session_code=YWUneSay4qlQuHRZsD4kPaZDIIR50KJLaNpW7uhsD-Q&execution=c7620733-54ab-46b2-802b-66764e42682b&client_id=cmp-client&tab_id=S8xOQPgCmhQ,400,Bad Request,Thread Group 1-9,text,false,,4469,1745,9,9,https://rddev2.fit2cloud.com/auth/realms/cmp/login-actions/authenticate,21,0,0\n" +
"1584602504100,20,https://rddev2.fit2cloud.com/dashboard/web-public/project/html/task-menus.html?_t=1577351137654,200,OK,Thread Group 1-4,text,true,,1916,575,8,8,https://rddev2.fit2cloud.com/dashboard/web-public/project/html/task-menus.html?_t=1577351137654,20,0,0\n" +
"1584602504095,27,https://rddev2.fit2cloud.com/auth/realms/cmp/login-actions/authenticate?session_code=YWUneSay4qlQuHRZsD4kPaZDIIR50KJLaNpW7uhsD-Q&execution=c7620733-54ab-46b2-802b-66764e42682b&client_id=cmp-client&tab_id=S8xOQPgCmhQ,400,Bad Request,Thread Group 1-10,text,false,,4462,1746,7,7,https://rddev2.fit2cloud.com/auth/realms/cmp/login-actions/authenticate,27,0,0\n" +
"1584602504095,39,https://rddev2.fit2cloud.com/dashboard/flow/runtime/task/pending/1/50,200,OK,Thread Group 1-2,text,true,,8588,2336,6,6,https://rddev2.fit2cloud.com/auth/realms/cmp/protocol/openid-connect/auth?response_type=code&client_id=cmp-client&redirect_uri=https%3A%2F%2Frddev2.fit2cloud.com%2Fdashboard%2Fflow%2Fruntime%2Ftask%2Fpending%2F1%2F50&state=24c9d65b-0421-4732-8193-0bf5f70b3fa4&login=true&scope=openid,13,0,0\n" +
"1584602504095,13,https://rddev2.fit2cloud.com/dashboard/flow/runtime/task/pending/1/50-0,302,Found,Thread Group 1-2,,true,,558,732,6,6,https://rddev2.fit2cloud.com/dashboard/flow/runtime/task/pending/1/50,13,0,0\n" +
"1584602504108,26,https://rddev2.fit2cloud.com/dashboard/flow/runtime/task/pending/1/50-1,200,OK,Thread Group 1-2,text,true,,8030,1604,6,6,https://rddev2.fit2cloud.com/auth/realms/cmp/protocol/openid-connect/auth?response_type=code&client_id=cmp-client&redirect_uri=https%3A%2F%2Frddev2.fit2cloud.com%2Fdashboard%2Fflow%2Fruntime%2Ftask%2Fpending%2F1%2F50&state=24c9d65b-0421-4732-8193-0bf5f70b3fa4&login=true&scope=openid,26,0,0\n" +
"1584602504095,55,https://rddev2.fit2cloud.com/auth/realms/cmp/login-actions/authenticate?session_code=YWUneSay4qlQuHRZsD4kPaZDIIR50KJLaNpW7uhsD-Q&execution=c7620733-54ab-46b2-802b-66764e42682b&client_id=cmp-client&tab_id=S8xOQPgCmhQ,400,Bad Request,Thread Group 1-8,text,false,,4469,1746,5,5,https://rddev2.fit2cloud.com/auth/realms/cmp/login-actions/authenticate,55,0,3\n" +
"1584602504095,59,https://rddev2.fit2cloud.com/auth/realms/cmp/login-actions/authenticate?session_code=YWUneSay4qlQuHRZsD4kPaZDIIR50KJLaNpW7uhsD-Q&execution=c7620733-54ab-46b2-802b-66764e42682b&client_id=cmp-client&tab_id=S8xOQPgCmhQ,400,Bad Request,Thread Group 1-6,text,false,,4462,1747,4,4,https://rddev2.fit2cloud.com/auth/realms/cmp/login-actions/authenticate,59,0,4\n" +
"1584602504095,65,https://rddev2.fit2cloud.com/auth/realms/cmp/login-actions/authenticate?session_code=YWUneSay4qlQuHRZsD4kPaZDIIR50KJLaNpW7uhsD-Q&execution=c7620733-54ab-46b2-802b-66764e42682b&client_id=cmp-client&tab_id=S8xOQPgCmhQ,400,Bad Request,Thread Group 1-7,text,false,,4469,1745,3,3,https://rddev2.fit2cloud.com/auth/realms/cmp/login-actions/authenticate,65,0,4\n" +
"1584602504200,12,https://rddev2.fit2cloud.com/dashboard/web-public/project/html/notification-menus.html?_t=1577351137654,200,OK,Thread Group 1-3,text,true,,1570,582,2,2,https://rddev2.fit2cloud.com/dashboard/web-public/project/html/notification-menus.html?_t=1577351137654,12,0,0\n";
List<Metric> metrics = beanBuilderExample(jtlString);
// 根据label分组label作为map的key
Map<String, List<Metric>> map = metrics.stream().collect(Collectors.groupingBy(Metric::getLabel));
}
}

View File

@ -1,180 +0,0 @@
package io.metersphere;
import com.opencsv.bean.CsvBindByName;
public class Metric {
// timestamp,elapsed,label,responseCode,responseMessage,threadName,dataType,success,failureMessage,bytes,sentBytes,grpThreads,allThreads,URL,Latency,IdleTime,Connect
@CsvBindByName(column = "timestamp")
private String timestamp;
@CsvBindByName(column = "elapsed")
private String elapsed;
@CsvBindByName(column = "label")
private String label;
@CsvBindByName(column = "responseCode")
private String responseCode;
@CsvBindByName(column = "responseMessage")
private String responseMessage;
@CsvBindByName(column = "threadName")
private String threadName;
@CsvBindByName(column = "dataType")
private String dataType;
@CsvBindByName(column = "success")
private String success;
@CsvBindByName(column = "failureMessage")
private String failureMessage;
@CsvBindByName(column = "bytes")
private String bytes;
@CsvBindByName(column = "sentBytes")
private String sentBytes;
@CsvBindByName(column = "grpThreads")
private String grpThreads;
@CsvBindByName(column = "allThreads")
private String allThreads;
@CsvBindByName(column = "URL")
private String url;
@CsvBindByName(column = "Latency")
private String latency;
@CsvBindByName(column = "IdleTime")
private String idleTime;
@CsvBindByName(column = "Connect")
private String connect;
public String getTimestamp() {
return timestamp;
}
public void setTimestamp(String timestamp) {
this.timestamp = timestamp;
}
public String getElapsed() {
return elapsed;
}
public void setElapsed(String elapsed) {
this.elapsed = elapsed;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getResponseCode() {
return responseCode;
}
public void setResponseCode(String responseCode) {
this.responseCode = responseCode;
}
public String getResponseMessage() {
return responseMessage;
}
public void setResponseMessage(String responseMessage) {
this.responseMessage = responseMessage;
}
public String getThreadName() {
return threadName;
}
public void setThreadName(String threadName) {
this.threadName = threadName;
}
public String getDataType() {
return dataType;
}
public void setDataType(String dataType) {
this.dataType = dataType;
}
public String getSuccess() {
return success;
}
public void setSuccess(String success) {
this.success = success;
}
public String getFailureMessage() {
return failureMessage;
}
public void setFailureMessage(String failureMessage) {
this.failureMessage = failureMessage;
}
public String getBytes() {
return bytes;
}
public void setBytes(String bytes) {
this.bytes = bytes;
}
public String getSentBytes() {
return sentBytes;
}
public void setSentBytes(String sentBytes) {
this.sentBytes = sentBytes;
}
public String getGrpThreads() {
return grpThreads;
}
public void setGrpThreads(String grpThreads) {
this.grpThreads = grpThreads;
}
public String getAllThreads() {
return allThreads;
}
public void setAllThreads(String allThreads) {
this.allThreads = allThreads;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getLatency() {
return latency;
}
public void setLatency(String latency) {
this.latency = latency;
}
public String getIdleTime() {
return idleTime;
}
public void setIdleTime(String idleTime) {
this.idleTime = idleTime;
}
public String getConnect() {
return connect;
}
public void setConnect(String connect) {
this.connect = connect;
}
}

View File

@ -1,61 +0,0 @@
package io.metersphere;
import com.opencsv.bean.CsvToBean;
import com.opencsv.bean.CsvToBeanBuilder;
import com.opencsv.bean.HeaderColumnNameMappingStrategy;
import io.metersphere.base.domain.LoadTestReportDetail;
import io.metersphere.base.domain.LoadTestReportWithBLOBs;
import io.metersphere.base.mapper.LoadTestReportDetailMapper;
import io.metersphere.base.mapper.LoadTestReportMapper;
import io.metersphere.report.base.Metric;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import javax.annotation.Resource;
import java.io.Reader;
import java.io.StringReader;
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class ReportContentTests {
@Resource
private LoadTestReportDetailMapper loadTestReportDetailMapper;
@Resource
private LoadTestReportMapper loadTestReportMapper;
@Test
public void test1() {
String reportId = "ba972086-7d74-4f58-99b0-9c014114fd99";
LoadTestReportDetail loadTestReportDetail = loadTestReportDetailMapper.selectByPrimaryKey(reportId);
LoadTestReportWithBLOBs loadTestReportWithBLOBs = loadTestReportMapper.selectByPrimaryKey(reportId);
HeaderColumnNameMappingStrategy<Metric> ms = new HeaderColumnNameMappingStrategy<>();
ms.setType(Metric.class);
try (Reader reader = new StringReader(loadTestReportDetail.getContent())) {
CsvToBean<Metric> cb = new CsvToBeanBuilder<Metric>(reader)
.withType(Metric.class)
.withSkipLines(0)
.withMappingStrategy(ms)
.withIgnoreLeadingWhiteSpace(true)
.build();
System.out.println(cb.parse().size());
} catch (Exception ex) {
ex.printStackTrace();
}
try (Reader reader = new StringReader(loadTestReportWithBLOBs.getContent())) {
CsvToBean<Metric> cb = new CsvToBeanBuilder<Metric>(reader)
.withType(Metric.class)
.withSkipLines(0)
.withMappingStrategy(ms)
.withIgnoreLeadingWhiteSpace(true)
.build();
System.out.println(cb.parse().size());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}

View File

@ -1,36 +0,0 @@
package io.metersphere;
import io.metersphere.report.base.Statistics;
import org.junit.Test;
import java.lang.reflect.Field;
public class ResultDataParseTest {
String[] s = {"1","2","3","4","5","6","7","8","9","10","11","12","13"};
public static <T> T setParam(Class<T> clazz, Object[] args)
throws Exception {
if (clazz == null || args == null) {
throw new IllegalArgumentException();
}
T t = clazz.newInstance();
Field[] fields = clazz.getDeclaredFields();
if (fields == null || fields.length > args.length) {
throw new IndexOutOfBoundsException();
}
for (int i = 0; i < fields.length; i++) {
fields[i].setAccessible(true);
fields[i].set(t, args[i]);
}
return t;
}
@Test
public void test() throws Exception {
Statistics statistics = setParam(Statistics.class, s);
System.out.println(statistics.toString());
}
}

View File

@ -1,30 +0,0 @@
package io.metersphere.service;
import io.metersphere.base.domain.TestCaseNode;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import javax.annotation.Resource;
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class TestCaseTest {
@Resource
TestCaseNodeService testCaseNodeService;
@Test
public void addNode() {
TestCaseNode node = new TestCaseNode();
node.setName("node01");
node.setProjectId("2ade216b-01a6-43d0-b48c-4a3898306096");
node.setCreateTime(System.currentTimeMillis());
node.setUpdateTime(System.currentTimeMillis());
testCaseNodeService.addNode(node);
}
}

View File

@ -1,25 +0,0 @@
package io.metersphere.service;
import io.metersphere.controller.request.resourcepool.QueryResourcePoolRequest;
import io.metersphere.dto.TestResourcePoolDTO;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import javax.annotation.Resource;
import java.util.List;
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class TestResourcePoolServiceTest {
@Resource
private TestResourcePoolService testResourcePoolService;
@Test
public void listResourcePools() {
List<TestResourcePoolDTO> list = testResourcePoolService.listResourcePools(new QueryResourcePoolRequest());
System.out.println(list.size());
}
}

View File

@ -32,8 +32,6 @@
<script>
import MsApiScenarioConfig from "./components/ApiScenarioConfig";
import {Test} from "./model/ScenarioModel"
import Jmx from "./model/JMX";
import {get, post, scenario} from "./model/test"
export default {
name: "MsApiTestConfig",
@ -122,10 +120,10 @@
formData.append('request', new Blob([requestJson], {
type: "application/json"
}));
let jmx = new Jmx(get, "baidu", ["www.baidu.com"]).generate();
let blob = new Blob([jmx], {type: "application/octet-stream"});
formData.append("files", new File([blob], "baidu.jmx"));
let jmx = this.test.toJMX();
let blob = new Blob([jmx.xml], {type: "application/octet-stream"});
formData.append("files", new File([blob], jmx.name));
console.log(jmx.xml)
return {
method: 'POST',

View File

@ -4,9 +4,9 @@
<el-col class="assertion-select">
<el-select class="assertion-item" v-model="regex.subject" size="small"
:placeholder="$t('api_test.request.assertions.select_subject')">
<el-option label="HttpCode" value="HTTP_CODE"/>
<el-option label="Header" value="HEADER"/>
<el-option label="Body" value="BODY"/>
<el-option label="Response Code" :value="subjects.RESPONSE_CODE"/>
<el-option label="Response Headers" :value="subjects.RESPONSE_HEADERS"/>
<el-option label="Response Data" :value="subjects.RESPONSE_DATA"/>
</el-select>
</el-col>
<el-col>
@ -22,7 +22,7 @@
</template>
<script>
import {Regex} from "../model/ScenarioModel";
import {ASSERTION_REGEX_SUBJECT, Regex} from "../model/ScenarioModel";
export default {
name: "MsApiAssertionRegex",
@ -42,6 +42,12 @@
list: Array
},
data() {
return {
subjects: ASSERTION_REGEX_SUBJECT,
}
},
methods: {
add: function () {
this.list.push(new Regex(this.regex));

View File

@ -21,12 +21,12 @@
props: {
edit: Boolean,
responseTime: ResponseTime
duration: ResponseTime
},
data() {
return {
time: this.responseTime.responseInTime
time: this.duration.value
}
},
@ -34,11 +34,11 @@
add: function () {
this.remove();
setTimeout(() => {
this.responseTime.responseInTime = this.time;
this.duration.value = this.time;
})
},
remove: function () {
this.responseTime.responseInTime = null;
this.duration.value = null;
}
}
}

View File

@ -4,9 +4,9 @@
<el-col class="assertion-select">
<el-select class="assertion-item" v-model="subject" size="small"
:placeholder="$t('api_test.request.assertions.select_subject')">
<el-option label="HttpCode" value="HTTP_CODE"/>
<el-option label="Header" value="HEADER"/>
<el-option label="Body" value="BODY"/>
<el-option label="Response Code" :value="subjects.RESPONSE_CODE"/>
<el-option label="Response Headers" :value="subjects.RESPONSE_HEADERS"/>
<el-option label="Response Data" :value="subjects.RESPONSE_DATA"/>
</el-select>
</el-col>
<el-col class="assertion-select">
@ -31,7 +31,7 @@
</template>
<script>
import {Regex} from "../model/ScenarioModel";
import {Regex, ASSERTION_REGEX_SUBJECT} from "../model/ScenarioModel";
export default {
name: "MsApiAssertionText",
@ -42,6 +42,7 @@
data() {
return {
subjects: ASSERTION_REGEX_SUBJECT,
subject: "",
condition: "",
value: ""
@ -54,27 +55,27 @@
},
toRegex: function () {
let expression = "";
let description = "";
let description = this.subject;
switch (this.condition) {
case "CONTAINS":
expression = ".*" + this.value + ".*";
description = "contains: " + this.value;
description += " contains: " + this.value;
break;
case "NOT_CONTAINS":
expression = "^((?!" + this.value + ").)*$";
description = "not contains: " + this.value;
description += " not contains: " + this.value;
break;
case "EQUALS":
expression = "^" + this.value + "$";
description = "equals: " + this.value;
description += " equals: " + this.value;
break;
case "START_WITH":
expression = "^" + this.value;
description = "start with: " + this.value;
description += " start with: " + this.value;
break;
case "END_WITH":
expression = this.value + "$";
description = "end with: " + this.value;
description += " end with: " + this.value;
break;
}
return new Regex({

View File

@ -12,7 +12,7 @@
<el-col :span="20">
<ms-api-assertion-text :list="assertions.regex" v-if="type === options.TEXT"/>
<ms-api-assertion-regex :list="assertions.regex" v-if="type === options.REGEX"/>
<ms-api-assertion-response-time :response-time="assertions.responseTime" v-if="type === options.RESPONSE_TIME"/>
<ms-api-assertion-response-time :duration="assertions.duration" v-if="type === options.RESPONSE_TIME"/>
</el-col>
</el-row>

View File

@ -35,8 +35,8 @@
computed: {
isShow() {
let rt = this.assertions.responseTime;
return rt.responseInTime !== null && rt.responseInTime > 0;
let rt = this.assertions.duration;
return rt.value !== null && rt.value > 0;
}
}
}

View File

@ -4,14 +4,14 @@
<el-radio-button :label="type.KV">
{{$t('api_test.request.body_kv')}}
</el-radio-button>
<el-radio-button :label="type.TEXT">
<el-radio-button :label="type.RAW">
{{$t('api_test.request.body_text')}}
</el-radio-button>
</el-radio-group>
<ms-api-key-value :items="body.kvs" v-if="body.isKV()"/>
<el-input class="textarea" type="textarea" v-model="body.text" :autosize="{ minRows: 10, maxRows: 25}" resize="none"
<el-input class="textarea" type="textarea" v-model="body.raw" :autosize="{ minRows: 10, maxRows: 25}" resize="none"
v-else/>
</div>
</template>

View File

@ -6,27 +6,14 @@
<div class="kv-row" v-for="(item, index) in items" :key="index">
<el-row type="flex" :gutter="20" justify="space-between" align="middle">
<el-col>
<el-input v-model="item.key" placeholder="Key" size="small" maxlength="100" @change="check"/>
<el-input v-model="item.name" placeholder="Key" size="small" maxlength="100" @change="change"/>
</el-col>
<el-col>
<el-input v-model="item.value" placeholder="Value" size="small" maxlength="100" @change="check"/>
<el-input v-model="item.value" placeholder="Value" size="small" maxlength="100" @change="change"/>
</el-col>
<el-col class="kv-delete">
<el-button size="mini" class="el-icon-delete-solid" circle @click="remove(index)"/>
</el-col>
</el-row>
</div>
<div class="kv-row">
<el-row type="flex" :gutter="20" justify="space-between" align="middle">
<el-col>
<el-input v-model="kv.key" placeholder="Key" size="small" maxlength="100" @change="add"/>
</el-col>
<el-col>
<el-input v-model="kv.value" placeholder="Value" size="small" maxlength="100" @change="add"/>
</el-col>
<el-col class="kv-delete">
<el-button size="mini" class="el-icon-delete-solid" circle :disabled="true"/>
<el-button size="mini" class="el-icon-delete-solid" circle @click="remove(index)"
:disabled="isDisable(index)"/>
</el-col>
</el-row>
</div>
@ -44,33 +31,38 @@
items: Array
},
data() {
return {
kv: new KeyValue()
methods: {
remove: function (index) {
this.items.splice(index, 1);
this.$emit('change', this.items);
},
change: function () {
let isNeedCreate = true;
let removeIndex = -1;
this.items.forEach((item, index) => {
if (!item.name && !item.value) {
//
if (index !== this.items.length - 1) {
removeIndex = index;
}
//
isNeedCreate = false;
}
});
if (isNeedCreate) {
this.items.push(new KeyValue());
}
this.$emit('change', this.items);
// TODO key
},
isDisable: function (index) {
return this.items.length - 1 === index;
}
},
methods: {
add: function () {
if (this.kv.key || this.kv.value) {
this.items.push(this.kv);
this.kv = new KeyValue();
}
},
remove: function (index) {
this.items.splice(index, 1);
},
check: function () {
let removeIndex = -1;
this.items.forEach((item, index) => {
if (!item.key && !item.value) {
removeIndex = index;
}
});
if (removeIndex !== -1) {
this.remove(removeIndex);
}
// TODO key
created() {
if (this.items.length === 0) {
this.items.push(new KeyValue());
}
}
}

View File

@ -43,7 +43,7 @@
computed: {
isSelected() {
return function (request) {
return this.selected.randomId === request.randomId;
return this.selected.id === request.id;
}
}
},

View File

@ -5,8 +5,9 @@
</el-form-item>
<el-form-item :label="$t('api_test.request.url')" prop="url">
<el-input v-model="request.url" maxlength="100" :placeholder="$t('api_test.request.url_description')">
<el-select v-model="request.method" slot="prepend" class="request-method-select">
<el-input v-model="request.url" maxlength="100" :placeholder="$t('api_test.request.url_description')"
@change="urlChange" clearable>
<el-select v-model="request.method" slot="prepend" class="request-method-select" @change="methodChange">
<el-option label="GET" value="GET"/>
<el-option label="POST" value="POST"/>
<el-option label="PUT" value="PUT"/>
@ -21,7 +22,8 @@
<el-tabs v-model="activeName">
<el-tab-pane :label="$t('api_test.request.parameters')" name="parameters">
<ms-api-key-value :items="request.parameters" :description="$t('api_test.request.parameters_desc')"/>
<ms-api-key-value :items="request.parameters" :description="$t('api_test.request.parameters_desc')"
@change="parametersChange"/>
</el-tab-pane>
<el-tab-pane :label="$t('api_test.request.headers')" name="headers">
<ms-api-key-value :items="request.headers"/>
@ -43,7 +45,7 @@
import MsApiKeyValue from "./ApiKeyValue";
import MsApiBody from "./ApiBody";
import MsApiAssertions from "./ApiAssertions";
import {Request} from "../model/ScenarioModel";
import {KeyValue, Request} from "../model/ScenarioModel";
export default {
name: "MsApiRequestForm",
@ -66,6 +68,48 @@
}
},
methods: {
urlChange() {
if (!this.request.url) return;
let parameters = [];
let url = new URL(this.addProtocol(this.request.url));
url.searchParams.forEach(function (key, value) {
if (key && value) {
parameters.push(new KeyValue({name: key, value: value}));
}
});
//
parameters.push(new KeyValue());
this.request.parameters = parameters;
this.request.url = url.toString();
},
methodChange(value) {
if (value === 'GET' && this.activeName === 'body') {
this.activeName = 'parameters';
}
},
parametersChange(parameters) {
if (!this.request.url) return;
let url = new URL(this.addProtocol(this.request.url));
url.search = "";
parameters.forEach(function (parameter) {
if (parameter.name && parameter.value) {
url.searchParams.append(parameter.name, parameter.value);
}
})
this.request.url = url.toString();
},
addProtocol(url) {
if (url) {
if (!url.toLowerCase().startsWith("https") && !url.toLowerCase().startsWith("http")) {
return "https://" + url;
}
}
return url;
}
},
computed: {
isNotGet() {
return this.request.method !== "GET";

View File

@ -12,7 +12,7 @@
{{$t('api_test.scenario.config')}}
</span>
</div>
<!-- 暂时去掉将来再-->
<!-- 暂时去掉将来再-->
<!-- <el-dropdown trigger="click" @command="handleCommand">-->
<!-- <span class="el-dropdown-link el-icon-more scenario-btn"/>-->
<!-- <el-dropdown-menu slot="dropdown">-->
@ -24,7 +24,7 @@
</ms-api-collapse-item>
</ms-api-collapse>
</div>
<!-- 暂时去掉将来再-->
<!-- 暂时去掉将来再-->
<!-- <el-button class="scenario-create" type="primary" size="mini" icon="el-icon-plus" plain @click="createScenario"/>-->
</el-aside>

View File

@ -4,18 +4,18 @@
<el-input v-model="scenario.name" maxlength="100"/>
</el-form-item>
<el-form-item :label="$t('api_test.scenario.base_url')" prop="url">
<el-input :placeholder="$t('api_test.scenario.base_url_description')" v-model="scenario.url" maxlength="100"/>
</el-form-item>
<!-- <el-form-item :label="$t('api_test.scenario.base_url')" prop="url">-->
<!-- <el-input :placeholder="$t('api_test.scenario.base_url_description')" v-model="scenario.url" maxlength="100"/>-->
<!-- </el-form-item>-->
<el-tabs v-model="activeName">
<el-tab-pane :label="$t('api_test.scenario.variables')" name="variables">
<ms-api-key-value :items="scenario.variables"/>
</el-tab-pane>
<el-tab-pane :label="$t('api_test.scenario.headers')" name="headers">
<ms-api-key-value :items="scenario.headers"/>
</el-tab-pane>
</el-tabs>
<!-- <el-tabs v-model="activeName">-->
<!-- <el-tab-pane :label="$t('api_test.scenario.parameters')" name="parameters">-->
<!-- <ms-api-key-value :items="scenario.parameters" :description="$t('api_test.scenario.kv_description')"/>-->
<!-- </el-tab-pane>-->
<!-- <el-tab-pane :label="$t('api_test.scenario.headers')" name="headers">-->
<!-- <ms-api-key-value :items="scenario.headers" :description="$t('api_test.scenario.kv_description')"/>-->
<!-- </el-tab-pane>-->
<!-- </el-tabs>-->
</el-form>
</template>
@ -32,7 +32,7 @@
data() {
return {
activeName: "variables",
activeName: "parameters",
rules: {
name: [
{max: 100, message: this.$t('commons.input_limit', [0, 100]), trigger: 'blur'}

View File

@ -1,619 +1,399 @@
let Xml4js = function (options = {}) {
this.depth = 0;
this.encoding = options.encoding || 'UTF-8';
this.xml = '<?xml version="1.0" encoding="UTF-8"?>\n';
};
const INDENT = ' '; // 缩进2空格
Xml4js.prototype = {
toString: function () {
return this.xml;
},
write: function () {
let context = this,
elem,
attr = null,
value = null,
callback = false,
fn = null,
hasValue = null,
empty = null;
export class Element {
constructor(name, attributes, value) {
this.indent = '';
this.name = name;
this.attributes = attributes || {};
this.value = undefined;
this.elements = [];
elem = arguments[0];
if (elem === '<hashTree/>') {
this.xml += '<hashTree/>\n'
return;
}
if (typeof arguments[1] == 'object') {
attr = arguments[1];
} else if (typeof arguments[1] == 'function') {
callback = true;
fn = arguments[1];
if (value instanceof Element) {
this.elements.push(value);
} else {
value = arguments[1];
}
if (typeof arguments[2] == 'function') {
if (!callback) {
callback = true;
fn = arguments[2];
}
} else {
if (value === null) {
value = arguments[2];
}
}
hasValue = value !== null;
empty = !hasValue && !callback;
function indent(depth) {
if (depth == null)
return '';
let space = '';
for (let i = 0; i < depth; i++)
if (context.tabs)
space += "\t";
else
space += ' ';
return space;
}
if (elem === 'cdata') {
this.xml += indent(this.depth) + '<![CDATA[' + value + ']]>\n';
} else {
this.xml += indent(this.depth) + '<' + elem;
if (attr) {
for (let key in attr) {
if (attr.hasOwnProperty(key)) {
this.xml += ' ';
this.xml += key + '="' + attr[key] + '"';
}
}
}
if (value !== null)
this.xml += '>' + value + '</' + elem + '>\n';
if (callback) {
this.xml += '>\n'
this.depth++;
if (fn instanceof Function) {
fn();
}
this.depth--;
this.xml += indent(this.depth) + '</' + elem + '>\n'
}
if (empty)
this.xml += '/>\n';
this.value = value;
}
}
};
/**
*
*JMX 构造对象
*/
let Jmx = function (data, name, ds) {
this.data = data;
this.name = name;
let domains = {};
ds.forEach(function (d) {
domains[d] = d;
});
this.domains = domains;
this.xml = new Xml4js();
};
Jmx.prototype = {
generate: function () {
generateXml(this.xml, this.preprocessing());
return this.xml.toString();
},
preprocessing: function () {
let domainAlias = {};
let index = 1;
Object.getOwnPropertyNames(this.domains).forEach(function (key) {
domainAlias[key] = "BASE_URL_" + index;
index = index + 1;
});
let UserAgent = null;
let hsps = [];
let domains = this.domains;
this.data.forEach(function (item) {
let url = new URL(item.url);
if (domains[url.hostname]) {
let hsp = new HTTPSamplerProxy(item.label.replace(/&/gi, "&amp;"));
hsp.stringProp("HTTPSampler.domain", "${" + domainAlias[url.hostname] + "}");
hsp.stringProp("HTTPSampler.protocol", url.protocol.split(":")[0]);
hsp.stringProp("HTTPSampler.path", url.pathname);
hsp.stringProp("HTTPSampler.method", item.method);
if (url.port === "") {
hsp.intProp("HTTPSampler.port", 0);
} else {
hsp.intProp("HTTPSampler.port", url.port);
}
hsp.addArguments(item.url, item.body);
hsps.push(hsp);
if (item.headers.length === 0) {
hsps.push("<hashTree/>");
} else {
let cphmh = new CollectionPropHeaderManagerHeaders();
item.headers.forEach(function (h) {
if (h.name === 'User-Agent') {
UserAgent = h.value;
} else {
cphmh.addValue(new elementPropHeaderManager(h.name, h.value));
}
});
// Add Header
let ephm = new HeaderManager();
ephm.addValue(cphmh);
let ht = new HashTree();
ht.addValue(ephm);
ht.addValue("<hashTree/>");
hsps.push(ht);
}
}
});
let jmeterTestPlan = new JmeterTestPlan();
let hashTree = new HashTree();
jmeterTestPlan.addValue(hashTree);
let testPlan = new TestPlan(this.name);
testPlan.boolProp("TestPlan.functional_mode", false);
testPlan.boolProp("TestPlan.serialize_threadgroups", false);
testPlan.boolProp("TestPlan.tearDown_on_shutdown", true);
testPlan.stringProp("TestPlan.comments", "");
testPlan.stringProp("TestPlan.user_define_classpath", "");
testPlan.addArguments();
hashTree.addValue(testPlan);
let hashTree1 = new HashTree();
hashTree.addValue(hashTree1);
//HeaderManager
let hm = new HeaderManager();
hm.userAgent(UserAgent);
hashTree1.addValue(hm);
hashTree1.addValue("<hashTree/>");
//Arguments
let arg = new Arguments();
arg.addArguments(domainAlias);
hashTree1.addValue(arg);
hashTree1.addValue("<hashTree/>");
//DNSCacheManager
let dns = new DNSCacheManager();
dns.init();
hashTree1.addValue(dns);
hashTree1.addValue("<hashTree/>");
//AuthManager
let auth = new AuthManager();
auth.init();
hashTree1.addValue(auth);
hashTree1.addValue("<hashTree/>");
//CookieManager
let cookie = new CookieManager();
cookie.init();
hashTree1.addValue(cookie);
hashTree1.addValue("<hashTree/>");
//CacheManager
let cache = new CacheManager();
cache.boolProp("clearEachIteration", true);
cache.boolProp("useExpires", false);
cache.boolProp("CacheManager.controlledByThread", false);
hashTree1.addValue(cache);
hashTree1.addValue("<hashTree/>");
let threadGroup = new ThreadGroup();
hashTree1.addValue(threadGroup);
threadGroup.intProp("ThreadGroup.num_threads", 1);
threadGroup.intProp("ThreadGroup.ramp_time", 1);
threadGroup.longProp("ThreadGroup.delay", 0);
threadGroup.longProp("ThreadGroup.duration", 0);
threadGroup.stringProp("ThreadGroup.on_sample_error", "continue");
threadGroup.boolProp("ThreadGroup.scheduler", false);
let lc = new LoopController();
threadGroup.addValue(lc);
lc.boolProp("LoopController.continue_forever", false);
lc.stringProp("LoopController.loops", 1);
let ht = new HashTree();
hashTree1.addValue(ht);
hsps.forEach(function (hsp) {
ht.addValue(hsp);
});
return jmeterTestPlan;
set(value) {
this.elements = [];
this.value = value;
}
};
add(element) {
if (element instanceof Element) {
this.value = undefined;
this.elements.push(element);
return element;
}
}
function generateXml(xml, hashTree) {
if (hashTree instanceof HashTree) {
if (hashTree.values.length > 0 && !(hashTree.values[0] instanceof HashTree)) {
xml.write(hashTree.element, hashTree.attributes, hashTree.values[0]);
commonValue(tag, name, value) {
return this.add(new Element(tag, {name: name}, value));
}
boolProp(name, value) {
return this.commonValue('boolProp', name, value);
}
intProp(name, value) {
return this.commonValue('intProp', name, value);
}
longProp(name, value) {
return this.commonValue('longProp', name, value);
}
stringProp(name, value) {
return this.commonValue('stringProp', name, value);
}
collectionProp(name) {
return this.commonValue('collectionProp', name);
}
elementProp(name, elementType) {
return this.add(new Element('elementProp', {name: name, elementType: elementType}));
}
isEmptyValue() {
return this.value === undefined || this.value === '';
}
isEmptyElement() {
return this.elements.length === 0;
}
isEmpty() {
return this.isEmptyValue() && this.isEmptyElement();
}
toXML(indent) {
if (indent) {
this.indent = indent;
}
let str = this.start();
str += this.content();
str += this.end();
return str;
}
start() {
let str = this.indent + '<' + this.name;
for (let key in this.attributes) {
if (this.attributes.hasOwnProperty(key)) {
str += ' ' + key + '="' + this.attributes[key] + '"';
}
}
if (this.isEmpty()) {
str += '/>';
} else {
xml.write(hashTree.element, hashTree.attributes, function () {
if (hashTree.values.length > 0) {
hashTree.values.forEach(function (v) {
generateXml(xml, v);
})
}
str += '>';
}
return str;
}
content() {
if (!this.isEmptyValue()) {
return this.value;
}
let str = '';
let parent = this;
if (this.elements.length > 0) {
str += '\n';
this.elements.forEach(e => {
e.indent += parent.indent + INDENT;
str += e.toXML();
});
}
} else {
xml.write(hashTree);
return str;
}
}
/**
* HashTree 初始对象
*/
let HashTree = function (element, attributes, value) {
this.element = element || "hashTree";
this.attributes = attributes || {};
this.values = [];
if (value !== undefined) {
this.values.push(value);
}
};
HashTree.prototype.addValue = function (hashTree) {
this.values.push(hashTree)
};
HashTree.prototype.commonValue = function (element, name, value) {
this.values.push(new HashTree(element, {name: name}, value))
};
HashTree.prototype.intProp = function (name, value) {
this.commonValue("intProp", name, value);
};
HashTree.prototype.longProp = function (name, value) {
this.commonValue("longProp", name, value);
};
HashTree.prototype.stringProp = function (name, value) {
this.commonValue("stringProp", name, value);
};
HashTree.prototype.boolProp = function (name, value) {
this.commonValue("boolProp", name, value);
};
/**
* HashTree 的帮助对象
*/
let CHashTree = function (element, guiclass, testclass, testname, enabled) {
HashTree.call(this, element, {
guiclass: guiclass,
testclass: testclass,
testname: testname || "TEST",
enabled: enabled || "true"
});
};
CHashTree.prototype = new HashTree();
/**
* JmeterTestPlan
*
*/
let JmeterTestPlan = function (options = {}) {
HashTree.call(this, "jmeterTestPlan",
{
version: options.version || "1.2",
properties: options.properties || "5.0",
jmeter: options.jmeter || "5.2.1"
});
};
JmeterTestPlan.prototype = new HashTree();
/**
* TestPlan
*
*/
let TestPlan = function (name) {
CHashTree.call(this, "TestPlan", "TestPlanGui", "TestPlan", name);
};
TestPlan.prototype = new CHashTree();
TestPlan.prototype.addArguments = function () {
let ht = new HashTree("elementProp", {
name: "TestPlan.user_defined_variables",
elementType: "Arguments"
});
ht.addValue(new HashTree("collectionProp", {name: "Arguments.arguments"}));
this.values.push(ht);
};
/**
* HeaderManager
*
*/
let HeaderManager = function () {
CHashTree.call(this, "HeaderManager", "HeaderPanel", "HeaderManager", "HTTP Header manager");
};
HeaderManager.prototype = new CHashTree();
HeaderManager.prototype.userAgent = function (userAgent) {
let cp = new HashTree("collectionProp", {
name: "HeaderManager.headers",
});
let ep = new HashTree("elementProp", {
name: "User-Agent",
elementType: "Header"
});
ep.stringProp("Header.name", "User-Agent");
ep.stringProp("Header.value", userAgent);
cp.addValue(ep);
this.values.push(cp);
};
/**
* Arguments
*
*/
let Arguments = function () {
CHashTree.call(this, "Arguments", "ArgumentsPanel", "Arguments", "User Defined Variables");
};
Arguments.prototype = new CHashTree();
Arguments.prototype.addArguments = function (domianAlias) {
let cp = new HashTree("collectionProp", {name: "Arguments.arguments"});
if (domianAlias) {
Object.getOwnPropertyNames(domianAlias).forEach(function (key) {
cp.addValue(addArgumentsCommon(domianAlias[key], key, true, true));
});
}
this.values.push(cp);
};
/**
* DNSCacheManager
*
*/
let DNSCacheManager = function () {
CHashTree.call(this, "DNSCacheManager", "DNSCachePanel", "DNSCacheManager", "DNS Cache Manager");
};
DNSCacheManager.prototype = new CHashTree();
DNSCacheManager.prototype.init = function () {
let cp = new HashTree("collectionProp", {name: "DNSCacheManager.servers"});
this.values.push(cp);
this.boolProp("DNSCacheManager.clearEachIteration", true);
this.boolProp("DNSCacheManager.isCustomResolver", false);
};
/**
* AuthManager
*
*/
let AuthManager = function () {
CHashTree.call(this, "AuthManager", "AuthPanel", "AuthManager", "HTTP Authorization Manager");
};
AuthManager.prototype = new CHashTree();
AuthManager.prototype.init = function () {
let cp = new HashTree("collectionProp", {name: "AuthManager.auth_list"});
this.values.push(cp);
this.boolProp("AuthManager.controlledByThreadGroup", false);
};
/**
* CookieManager
*
*/
let CookieManager = function () {
CHashTree.call(this, "CookieManager", "CookiePanel", "CookieManager", "HTTP Cookie Manager");
};
CookieManager.prototype = new CHashTree();
CookieManager.prototype.init = function () {
let cp = new HashTree("collectionProp", {name: "CookieManager.cookies"});
this.values.push(cp);
this.boolProp("CookieManager.clearEachIteration", true);
this.boolProp("CookieManager.controlledByThreadGroup", false);
};
/**
* CacheManager
*
*/
let CacheManager = function () {
CHashTree.call(this, "CacheManager", "CacheManagerGui", "CacheManager", "HTTP Cache Manager");
};
CacheManager.prototype = new CHashTree();
/**
* ThreadGroup
*
*/
let ThreadGroup = function () {
CHashTree.call(this, "ThreadGroup", "ThreadGroupGui", "ThreadGroup", "Group1");
};
ThreadGroup.prototype = new CHashTree();
let LoopController = function () {
HashTree.call(this, "elementProp", {
name: "ThreadGroup.main_controller",
elementType: "LoopController",
guiclass: "LoopControlPanel",
testclass: "LoopController",
testname: "Loop Controller",
enabled: "true"
});
};
LoopController.prototype = new HashTree();
/**
* HTTPSamplerProxy
*
*/
let HTTPSamplerProxy = function (name) {
HashTree.call(this, "HTTPSamplerProxy", {
guiclass: "HttpTestSampleGui",
testclass: "HTTPSamplerProxy",
testname: name,
enabled: "true"
});
};
HTTPSamplerProxy.prototype = new HashTree();
HTTPSamplerProxy.prototype.addArguments = function (url, body) {
let ht = new HashTree("elementProp", {
name: "HTTPSampler.Arguments",
elementType: "Arguments",
guiclass: "HTTPArgumentsPanel",
testclass: "Arguments",
enabled: "true"
});
let cp = new HashTree("collectionProp", {name: "Arguments.arguments"});
ht.addValue(cp);
let params = getUrlParams(url);
params.forEach(function (item) {
cp.addValue(addArgumentsCommon(item.name, item.value, false));
});
if (body) {
this.boolProp("HTTPSampler.postBodyRaw", true);
if (body instanceof Array) {
cp.addValue(addArgumentsBody(body[0], true));
} else {
cp.addValue(addArgumentsBody(body, true));
end() {
if (this.isEmpty()) {
return '\n';
}
let str = '</' + this.name + '>\n';
if (!this.isEmptyValue()) {
return str;
}
if (!this.isEmptyElement()) {
return this.indent + str;
}
}
this.values.push(ht);
};
function addArgumentsCommon(name, value, alwaysEncode, metadata) {
let ht = new HashTree("elementProp", {
name: name,
elementType: "HTTPArgument"
});
ht.boolProp("HTTPArgument.always_encode", alwaysEncode);
if (typeof (name) == 'string') {
ht.stringProp("Argument.name", name);
}
ht.stringProp("Argument.value", value);
if (!metadata) {
ht.stringProp("Argument.metadata", "=");
}
return ht;
}
function addArgumentsBody(value, alwaysEncode, metadata) {
let ht = new HashTree("elementProp", {
name: name,
elementType: "HTTPArgument"
});
ht.boolProp("HTTPArgument.always_encode", alwaysEncode);
ht.stringProp("Argument.value", value);
if (!metadata) {
ht.stringProp("Argument.metadata", "=");
export class HashTree extends Element {
constructor() {
super('hashTree');
}
add(te) {
if (te instanceof TestElement) {
super.add(te);
}
}
return ht;
}
function getUrlParams(url) {
let params = [];
if (url.indexOf('?') === -1) {
return params;
export class TestElement extends Element {
constructor(name, attributes, value) {
// Element, 只能添加Element
super(name, attributes, value);
// HashTree, 只能添加TestElement
this.hashTree = new HashTree();
}
let queryString = url.split('?')[1];
queryString = queryString.split('#')[0];
let arr = queryString.split('&');
put(te) {
this.hashTree.add(te);
}
arr.forEach(function (item) {
let a = item.split('=');
params.push({
name: a[0],
value: a[1]
toXML() {
let str = super.toXML();
str += this.hashTree.toXML(this.indent);
return str;
}
}
export class DefaultTestElement extends TestElement {
constructor(tag, guiclass, testclass, testname, enabled) {
super(tag, {
guiclass: guiclass,
testclass: testclass,
testname: testname || tag + ' Name',
enabled: enabled || true
});
});
return params;
}
}
export class TestPlan extends DefaultTestElement {
constructor(testName) {
super('TestPlan', 'TestPlanGui', 'TestPlan', testName || 'TestPlan');
let ElementPropHeaderManager = function () {
HashTree.call(this, "elementProp", {
name: "HTTPSampler.header_manager",
elementType: "HeaderManager"
});
};
ElementPropHeaderManager.prototype = new HashTree();
this.boolProp("TestPlan.functional_mode", false);
this.boolProp("TestPlan.serialize_threadgroups", false);
this.boolProp("TestPlan.tearDown_on_shutdown", true);
this.stringProp("TestPlan.comments", "");
this.stringProp("TestPlan.user_define_classpath", "");
}
}
let CollectionPropHeaderManagerHeaders = function () {
HashTree.call(this, "collectionProp", {
name: "HeaderManager.headers"
});
};
CollectionPropHeaderManagerHeaders.prototype = new HashTree();
export class ThreadGroup extends DefaultTestElement {
constructor(testName) {
super('ThreadGroup', 'ThreadGroupGui', 'ThreadGroup', testName);
this.intProp("ThreadGroup.num_threads", 1);
this.intProp("ThreadGroup.ramp_time", 1);
this.longProp("ThreadGroup.delay", 0);
this.longProp("ThreadGroup.duration", 0);
this.stringProp("ThreadGroup.on_sample_error", "continue");
this.boolProp("ThreadGroup.scheduler", false);
let elementPropHeaderManager = function (name, value) {
let ht = new HashTree("elementProp", {
name: name,
elementType: "Header"
});
ht.stringProp("Header.name", name);
ht.stringProp("Header.value", value);
return ht;
};
let loopAttrs = {
name: "ThreadGroup.main_controller",
elementType: "LoopController",
guiclass: "LoopControlPanel",
testclass: "LoopController",
testname: "Loop Controller",
enabled: "true"
};
let loopController = this.add(new Element('elementProp', loopAttrs));
loopController.boolProp('LoopController.continue_forever', false);
loopController.stringProp('LoopController.loops', 1);
}
}
export default Jmx;
export class HTTPSamplerProxy extends DefaultTestElement {
constructor(testName, request) {
super('HTTPSamplerProxy', 'HttpTestSampleGui', 'HTTPSamplerProxy', testName || 'HTTP Request');
this.request = request || {};
this.stringProp("HTTPSampler.domain", this.request.hostname);
this.stringProp("HTTPSampler.protocol", this.request.protocol.split(":")[0]);
this.stringProp("HTTPSampler.path", this.request.pathname);
this.stringProp("HTTPSampler.method", this.request.method);
if (this.request.port) {
this.stringProp("HTTPSampler.port", "");
} else {
this.stringProp("HTTPSampler.port", this.request.port);
}
}
addRequestArguments(arg) {
if (arg instanceof HTTPSamplerArguments) {
this.add(arg);
}
}
addRequestBody(body) {
if (body instanceof HTTPSamplerArguments) {
this.boolProp('HTTPSampler.postBodyRaw', true);
this.add(body);
}
}
putRequestHeader(header) {
if (header instanceof HeaderManager) {
this.put(header);
}
}
putResponseAssertion(assertion) {
if (assertion instanceof ResponseAssertion) {
this.put(assertion);
}
}
putDurationAssertion(assertion) {
if (assertion instanceof DurationAssertion) {
this.put(assertion);
}
}
}
// 这是一个Element
export class HTTPSamplerArguments extends Element {
constructor(args) {
super('elementProp', {
name: "HTTPsampler.Arguments", // s必须小写
elementType: "Arguments",
guiclass: "HTTPArgumentsPanel",
testclass: "Arguments",
enabled: "true"
});
this.args = args || [];
let collectionProp = this.collectionProp('Arguments.arguments');
this.args.forEach(arg => {
let elementProp = collectionProp.elementProp(arg.name, 'HTTPArgument');
elementProp.boolProp('HTTPArgument.always_encode', false);
elementProp.boolProp('HTTPArgument.use_equals', true);
if (arg.name) {
elementProp.stringProp('Argument.name', arg.name);
}
elementProp.stringProp('Argument.value', arg.value);
elementProp.stringProp('Argument.metadata', "=");
});
}
}
export class DurationAssertion extends DefaultTestElement {
constructor(testName, duration) {
super('DurationAssertion', 'DurationAssertionGui', 'DurationAssertion', testName || 'Duration Assertion');
this.duration = duration || 0;
this.stringProp('DurationAssertion.duration', this.duration);
}
}
export class ResponseAssertion extends DefaultTestElement {
constructor(testName, assertion) {
super('ResponseAssertion', 'AssertionGui', 'ResponseAssertion', testName || 'Response Assertion');
this.assertion = assertion || {};
this.stringProp('Assertion.test_field', this.assertion.field);
this.boolProp('Assertion.assume_success', false);
this.intProp('Assertion.test_type', this.assertion.type);
this.stringProp('Assertion.custom_message', this.assertion.message);
let collectionProp = this.collectionProp('Asserion.test_strings');
let random = Math.floor(Math.random() * 10000);
collectionProp.stringProp(random, this.assertion.value);
}
}
export class ResponseCodeAssertion extends ResponseAssertion {
constructor(testName, type, value, message) {
let assertion = {
field: 'Assertion.response_code',
type: type,
value: value,
message: message,
}
super(testName, assertion)
}
}
export class ResponseDataAssertion extends ResponseAssertion {
constructor(testName, type, value, message) {
let assertion = {
field: 'Assertion.response_data',
type: type,
value: value,
message: message,
}
super(testName, assertion)
}
}
export class ResponseHeadersAssertion extends ResponseAssertion {
constructor(testName, type, value, message) {
let assertion = {
field: 'Assertion.response_headers',
type: type,
value: value,
message: message,
}
super(testName, assertion)
}
}
export class HeaderManager extends DefaultTestElement {
constructor(testName, headers) {
super('HeaderManager', 'HeaderPanel', 'HeaderManager', testName || 'HTTP Header manager');
this.headers = headers || [];
let collectionProp = this.collectionProp('HeaderManager.headers');
this.headers.forEach(header => {
let elementProp = collectionProp.elementProp('', 'Header');
elementProp.stringProp('Header.name', header.name);
elementProp.stringProp('Header.value', header.value);
});
}
}
export class Arguments extends DefaultTestElement {
constructor(testName, args) {
super('Arguments', 'ArgumentsPanel', 'Arguments', testName || 'User Defined Variables');
this.args = args || [];
let collectionProp = this.collectionProp('Arguments.arguments');
this.args.forEach(arg => {
let elementProp = collectionProp.elementProp(arg.name, 'HTTPArgument');
elementProp.boolProp('HTTPArgument.always_encode', true);
elementProp.stringProp('Argument.name', arg.name);
elementProp.stringProp('Argument.value', arg.value);
elementProp.stringProp('Argument.metadata', "=");
});
}
}
export class BackendListener extends DefaultTestElement {
constructor(testName, className, args) {
super('BackendListener', 'BackendListenerGui', 'BackendListener', testName || 'Backend Listener');
this.stringProp('classname', className);
this.add(new ElementArguments(args));
}
}
export class ElementArguments extends Element {
constructor(args) {
super('elementProp', {
name: "arguments",
elementType: "Arguments",
guiclass: "ArgumentsPanel",
testclass: "Arguments",
enabled: "true"
});
let collectionProp = this.collectionProp('Arguments.arguments');
args.forEach(arg => {
let elementProp = collectionProp.elementProp(arg.name, 'Argument');
elementProp.stringProp('Argument.name', arg.name);
elementProp.stringProp('Argument.value', arg.value);
elementProp.stringProp('Argument.metadata', "=");
});
}
}

View File

@ -1,17 +1,41 @@
import {generateId} from "element-ui/src/utils/util";
import {
Element,
HTTPSamplerProxy,
HashTree,
TestElement,
TestPlan,
ThreadGroup,
HeaderManager,
HTTPSamplerArguments,
ResponseCodeAssertion,
ResponseDataAssertion,
ResponseHeadersAssertion,
BackendListener
} from "./JMX";
export const generateId = function () {
return Math.floor(Math.random() * 10000);
};
export const BODY_TYPE = {
KV: "KV",
TEXT: "TEXT"
KV: "KeyValue",
FORM_DATA: "Form Data",
RAW: "Raw"
}
export const ASSERTION_TYPE = {
TEXT: "TEXT",
REGEX: "REGEX",
RESPONSE_TIME: "RESPONSE_TIME"
TEXT: "Text",
REGEX: "Regex",
RESPONSE_TIME: "Response Time"
}
class BaseConfig {
export const ASSERTION_REGEX_SUBJECT = {
RESPONSE_CODE: "Response Code",
RESPONSE_HEADERS: "Response Headers",
RESPONSE_DATA: "Response Data"
}
export class BaseConfig {
set(options) {
options = this.initOptions(options)
@ -41,11 +65,16 @@ class BaseConfig {
initOptions(options) {
return options || {};
}
isValid() {
return true;
}
}
export class Test extends BaseConfig {
constructor(options) {
super();
this.version = '1.0.0';
this.id = null;
this.name = null;
this.projectId = null;
@ -60,19 +89,27 @@ export class Test extends BaseConfig {
options.scenarioDefinition = options.scenarioDefinition || [new Scenario()];
return options;
}
toJMX() {
return {
name: this.name + '.jmx',
xml: new JMXGenerator(this).toXML()
};
}
}
export class Scenario extends BaseConfig {
constructor(options) {
super();
this.id = generateId();
this.name = null;
this.url = null;
this.variables = [];
this.parameters = [];
this.headers = [];
this.requests = [];
this.set(options);
this.sets({variables: KeyValue, headers: KeyValue, requests: Request}, options);
this.sets({parameters: KeyValue, headers: KeyValue, requests: Request}, options);
}
initOptions(options) {
@ -85,7 +122,7 @@ export class Scenario extends BaseConfig {
export class Request extends BaseConfig {
constructor(options) {
super();
this.randomId = generateId();
this.id = generateId();
this.name = null;
this.url = null;
this.method = null;
@ -113,26 +150,50 @@ export class Body extends BaseConfig {
constructor(options) {
super();
this.type = null;
this.text = null;
this.raw = null;
this.kvs = [];
this.set(options);
this.sets({kvs: KeyValue}, options);
}
isValid() {
if (this.isKV()) {
return this.kvs.some(kv => {
return kv.isValid();
})
} else {
return !!this.raw;
}
}
isKV() {
return this.type === BODY_TYPE.KV;
}
}
export class KeyValue extends BaseConfig {
constructor(options) {
constructor() {
let options, key, value;
if (arguments.length === 1) {
options = arguments[0];
}
if (arguments.length === 2) {
key = arguments[0];
value = arguments[1];
}
super();
this.key = null;
this.value = null;
this.name = key;
this.value = value;
this.set(options);
}
isValid() {
return !!this.name || !!this.value;
}
}
export class Assertions extends BaseConfig {
@ -140,20 +201,20 @@ export class Assertions extends BaseConfig {
super();
this.text = [];
this.regex = [];
this.responseTime = null;
this.duration = null;
this.set(options);
this.sets({text: KeyValue, regex: KeyValue}, options);
this.sets({text: Text, regex: Regex}, options);
}
initOptions(options) {
options = options || {};
options.responseTime = new ResponseTime(options.responseTime);
options.duration = new ResponseTime(options.duration);
return options;
}
}
class AssertionType extends BaseConfig {
export class AssertionType extends BaseConfig {
constructor(type) {
super();
this.type = type;
@ -180,14 +241,168 @@ export class Regex extends AssertionType {
this.set(options);
}
isValid() {
return !!this.subject && !!this.expression;
}
}
export class ResponseTime extends AssertionType {
constructor(options) {
super(ASSERTION_TYPE.RESPONSE_TIME);
this.responseInTime = null;
this.value = null;
this.set(options);
}
isValid() {
return !!this.value;
}
}
/** ------------------------------------------------------------------------ **/
const JMX_ASSERTION_CONDITION = {
MATCH: 1,
CONTAINS: 1 << 1,
NOT: 1 << 2,
EQUALS: 1 << 3,
SUBSTRING: 1 << 4,
OR: 1 << 5
}
class JMXRequest {
constructor(request) {
if (request && request instanceof Request && request.url) {
let url = new URL(request.url);
this.method = request.method;
this.hostname = url.hostname;
this.pathname = url.pathname;
this.port = url.port;
this.protocol = url.protocol.split(":")[0];
if (this.method.toUpperCase() !== "GET") {
this.pathname += url.search.replace('&', '&amp;');
}
}
}
}
class JMeterTestPlan extends Element {
constructor() {
super('jmeterTestPlan', {
version: "1.2", properties: "5.0", jmeter: "5.2.1"
});
this.add(new HashTree());
}
put(te) {
if (te instanceof TestElement) {
this.elements[0].add(te);
}
}
}
class JMXGenerator {
constructor(test) {
if (!test || !test.id || !(test instanceof Test)) return;
let testPlan = new TestPlan(test.name);
test.scenarioDefinition.forEach(scenario => {
let threadGroup = new ThreadGroup(scenario.name);
scenario.requests.forEach(request => {
let httpSamplerProxy = new HTTPSamplerProxy(request.name, new JMXRequest(request));
this.addRequestHeader(httpSamplerProxy, request);
if (request.method.toUpperCase() === 'GET') {
this.addRequestArguments(httpSamplerProxy, request);
} else {
this.addRequestBody(httpSamplerProxy, request);
}
this.addRequestAssertion(httpSamplerProxy, request);
threadGroup.put(httpSamplerProxy);
})
this.addBackendListener(threadGroup, test.id);
testPlan.put(threadGroup);
})
this.jmeterTestPlan = new JMeterTestPlan();
this.jmeterTestPlan.put(testPlan);
}
addRequestHeader(httpSamplerProxy, request) {
let name = request.name + " Headers";
let headers = request.headers.filter(this.filter);
if (headers.length > 0) {
httpSamplerProxy.putRequestHeader(new HeaderManager(name, headers));
}
}
addRequestArguments(httpSamplerProxy, request) {
let args = request.parameters.filter(this.filter)
if (args.length > 0) {
httpSamplerProxy.addRequestArguments(new HTTPSamplerArguments(args));
}
}
addRequestBody(httpSamplerProxy, request) {
let body = [];
if (request.body.isKV()) {
body = request.body.kvs.filter(this.filter);
} else {
body.push({name: '', value: request.body.raw});
}
httpSamplerProxy.addRequestBody(new HTTPSamplerArguments(body));
}
addRequestAssertion(httpSamplerProxy, request) {
let assertions = request.assertions;
if (assertions.regex.length > 0) {
assertions.regex.filter(this.filter).forEach(regex => {
httpSamplerProxy.putResponseAssertion(this.getAssertion(regex));
})
}
if (assertions.duration.isValid()) {
httpSamplerProxy.putDurationAssertion(assertions.duration.type, assertions.duration.value);
}
}
getAssertion(regex) {
let name = regex.description;
let type = JMX_ASSERTION_CONDITION.MATCH; // 固定用Match自己写正则
let value = regex.expression;
switch (regex.subject) {
case ASSERTION_REGEX_SUBJECT.RESPONSE_CODE:
return new ResponseCodeAssertion(name, type, value);
case ASSERTION_REGEX_SUBJECT.RESPONSE_DATA:
return new ResponseDataAssertion(name, type, value);
case ASSERTION_REGEX_SUBJECT.RESPONSE_HEADERS:
return new ResponseHeadersAssertion(name, type, value);
}
}
addBackendListener(threadGroup, testId) {
let testName = 'API Backend Listener';
let className = 'io.metersphere.api.jmeter.APIBackendListenerClient';
let args = [{name: 'id', value: testId}];
threadGroup.put(new BackendListener(testName, className, args));
}
filter(config) {
return config.isValid();
}
toXML() {
let xml = '<?xml version="1.0" encoding="UTF-8"?>\n';
xml += this.jmeterTestPlan.toXML();
return xml;
}
}

View File

@ -1,95 +0,0 @@
export const get = [{
"headers": [{"name": "Upgrade-Insecure-Requests", "value": "1"}, {
"name": "User-Agent",
"value": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.122 Safari/537.36"
}, {
"name": "Accept",
"value": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"
}],
"label": "https://www.baidu.com/",
"method": "GET",
"requestId": "21478",
"request_subtype": "",
"request_type": "top_level",
"tabId": 394,
"timestamp": 1587958164590,
"url": "https://www.baidu.com/"
}, {
"headers": [{"name": "Accept", "value": "application/json, text/javascript, */*; q=0.01"}, {
"name": "User-Agent",
"value": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.122 Safari/537.36"
}],
"label": "https://www.baidu.com/sugrec?prod=pc_his&from=pc_web&json=1&sid=1447_31124_21122_31424_31341_30903_31229_30824_26350_31164_31195&hisdata=&csor=0",
"method": "GET",
"requestId": "21522",
"request_subtype": "",
"request_type": "ajax",
"tabId": 394,
"timestamp": 1587958165726,
"url": "https://www.baidu.com/sugrec?prod=pc_his&from=pc_web&json=1&sid=1447_31124_21122_31424_31341_30903_31229_30824_26350_31164_31195&hisdata=&csor=0"
}, {
"headers": [{"name": "Accept", "value": "text/plain, */*; q=0.01"}, {
"name": "User-Agent",
"value": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.122 Safari/537.36"
}, {"name": "X-Requested-With", "value": "XMLHttpRequest"}],
"label": "https://www.baidu.com/home/xman/data/tipspluslist?indextype=manht&_req_seqid=0xacf4e73f00017936&asyn=1&t=1587958166015&sid=1447_31124_21122_31424_31341_30903_31229_30824_26350_31164_31195",
"method": "GET",
"requestId": "21540",
"request_subtype": "",
"request_type": "ajax",
"tabId": 394,
"timestamp": 1587958166018,
"url": "https://www.baidu.com/home/xman/data/tipspluslist?indextype=manht&_req_seqid=0xacf4e73f00017936&asyn=1&t=1587958166015&sid=1447_31124_21122_31424_31341_30903_31229_30824_26350_31164_31195"
}, {
"headers": [{"name": "Accept", "value": "text/plain, */*; q=0.01"}, {
"name": "User-Agent",
"value": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.122 Safari/537.36"
}, {"name": "X-Requested-With", "value": "XMLHttpRequest"}],
"label": "https://www.baidu.com/home/msg/data/personalcontent?num=8&indextype=manht&_req_seqid=0xacf4e73f00017936&asyn=1&t=1587958166028&sid=1447_31124_21122_31424_31341_30903_31229_30824_26350_31164_31195",
"method": "GET",
"requestId": "21541",
"request_subtype": "",
"request_type": "ajax",
"tabId": 394,
"timestamp": 1587958166031,
"url": "https://www.baidu.com/home/msg/data/personalcontent?num=8&indextype=manht&_req_seqid=0xacf4e73f00017936&asyn=1&t=1587958166028&sid=1447_31124_21122_31424_31341_30903_31229_30824_26350_31164_31195"
}];
export const post = [{
"body": ["{\"id\":null,\"projectId\":\"e15d2d02-7404-485f-944b-2f2dbd456e3e\",\"name\":\"test second\",\"scenarioDefinition\":\"[{\\\"name\\\":null,\\\"url\\\":null,\\\"variables\\\":[],\\\"headers\\\":[],\\\"requests\\\":[{\\\"randomId\\\":2311,\\\"name\\\":null,\\\"url\\\":null,\\\"method\\\":\\\"GET\\\",\\\"parameters\\\":[],\\\"headers\\\":[],\\\"body\\\":{\\\"type\\\":null,\\\"text\\\":null,\\\"kvs\\\":[]},\\\"assertions\\\":{\\\"text\\\":[],\\\"regex\\\":[],\\\"responseTime\\\":{\\\"type\\\":\\\"RESPONSE_TIME\\\",\\\"responseInTime\\\":null}},\\\"extract\\\":[]}]}]\"}"],
"headers": [{"name": "Accept", "value": "application/json, text/plain, */*"}, {
"name": "User-Agent",
"value": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.122 Safari/537.36"
}, {"name": "Content-Type", "value": "application/json;charset=UTF-8"}],
"label": "http://localhost:8080/api/save",
"method": "POST",
"requestId": "26129",
"request_subtype": "",
"request_type": "ajax",
"tabId": 466,
"timestamp": 1587968228917,
"url": "http://localhost:8080/api/save"
}]
export const scenario = [{
"name": "Scenario 1",
"url": null,
"variables": [],
"headers": [],
"requests": [{
"randomId": 6271,
"name": "Request 1",
"url": "https://www.baidu.com",
"method": "GET",
"parameters": [{"key": "flag", "value": "test"}],
"headers": [{"key": "test_header", "value": "test_heade_value"}],
"body": {"type": null, "text": null, "kvs": []},
"assertions": {
"text": [],
"regex": [{"type": "REGEX", "subject": "HTTP_CODE", "expression": "^200$", "description": "equals: 200"}],
"responseTime": {"type": "RESPONSE_TIME", "responseInTime": null}
},
"extract": []
}]
}]

View File

@ -6,8 +6,10 @@
<el-col :span="16">
<el-row>
<el-breadcrumb separator-class="el-icon-arrow-right">
<el-breadcrumb-item :to="{ path: '/' }">{{projectName}}</el-breadcrumb-item>
<el-breadcrumb-item>{{testName}}</el-breadcrumb-item>
<el-breadcrumb-item :to="{ path: '/performance/test/' + this.projectId }">{{projectName}}
</el-breadcrumb-item>
<el-breadcrumb-item :to="{ path: '/performance/test/edit/' + this.testId }">{{testName}}
</el-breadcrumb-item>
<el-breadcrumb-item>{{reportName}}</el-breadcrumb-item>
</el-breadcrumb>
</el-row>
@ -74,7 +76,9 @@
reportId: '',
status: '',
reportName: '',
testId: '',
testName: '',
projectId: '',
projectName: '',
startTime: '0',
endTime: '0',
@ -90,7 +94,9 @@
let data = res.data;
if (data) {
this.reportName = data.name;
this.testId = data.testId;
this.testName = data.testName;
this.projectId = data.projectId;
this.projectName = data.projectName;
}
})

View File

@ -19,12 +19,12 @@
sortable>
</el-table-column>
<el-table-column
prop="precentOfErrors"
prop="percentOfErrors"
label="% in errors"
sortable>
</el-table-column>
<el-table-column
prop="precentOfAllSamples"
prop="percentOfAllSamples"
label="% in all samples"
sortable>
</el-table-column>

View File

@ -1,6 +1,10 @@
<template>
<div>
{{logContent}}
<div v-loading="result.loading">
<el-tabs type="border-card" :stretch="true">
<el-tab-pane v-for="(item, key) in logContent" :key="key" :label="key" class="logging-content">
{{item}}
</el-tab-pane>
</el-tabs>
</div>
</template>
@ -10,12 +14,13 @@
props: ['id', 'status'],
data() {
return {
logContent: null
logContent: null,
result: {},
}
},
methods: {
initTableData() {
this.$get("/performance/report/log/" + this.id, res => {
this.result = this.$get("/performance/report/log/" + this.id, res => {
this.logContent = res.data;
})
}
@ -34,6 +39,7 @@
.logging-content {
white-space: pre-line;
overflow: auto;
height: calc(100vh - 420px);
}
</style>

View File

@ -1,5 +1,5 @@
<template>
<div class="pressure-config-container">
<div v-loading="result.loading" class="pressure-config-container">
<el-row>
<el-col :span="10">
<el-form :inline="true">
@ -110,6 +110,7 @@
props: ['testPlan'],
data() {
return {
result: {},
threadNumber: 10,
duration: 10,
rampUpTime: 10,
@ -148,8 +149,12 @@
},
methods: {
getResourcePools() {
this.$get('/testresourcepool/list/all/valid', response => {
this.result = this.$get('/testresourcepool/list/all/valid', response => {
this.resourcePools = response.data;
// null
if (response.data.filter(p => p.id === this.resourcePool).length === 0) {
this.resourcePool = null;
}
})
},
getLoadConfig(testId) {

View File

@ -56,7 +56,7 @@ export default {
workspace: {
'create': '创建工作空间',
'update': '修改工作空间',
'delete_confirm': '删除工作空间会联删除该工作空间下的资源,确定要删除吗?',
'delete_confirm': '删除工作空间会联删除该工作空间下的资源,确定要删除吗?',
'add': '添加工作空间',
'input_name': '请输入工作空间名称',
'search_by_name': '根据名称搜索',
@ -67,7 +67,7 @@ export default {
organization: {
'create': '创建组织',
'modify': '修改组织',
'delete_confirm': '这个组织确定要删除吗?',
'delete_confirm': '删除组织会关联删除该组织下的资源,确定要删除吗?',
'input_name': '请输入组织名称',
'select_organization': '请选择组织',
'search_by_name': '根据名称搜索',
@ -185,8 +185,9 @@ export default {
name: "场景名称",
base_url: "基础URL",
base_url_description: "基础URL作为所有请求的URL前缀",
variables: "变量",
headers: "请求头"
parameters: "请求变量",
headers: "请求头",
kv_description: "将用于未设置该项的请求",
},
request: {
input_name: "请输入请求名称",