This commit is contained in:
fit2-zhao 2020-12-25 13:57:54 +08:00
commit 719bda0ff7
7 changed files with 31 additions and 32 deletions

View File

@ -369,7 +369,7 @@ public class ApiDefinitionService {
return apiImport; return apiImport;
} }
private void importApiTest(ApiTestImportRequest importRequest, ApiDefinitionImport apiImport) { private void importApiTest(ApiTestImportRequest request, ApiDefinitionImport apiImport) {
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH); SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
ApiDefinitionMapper batchMapper = sqlSession.getMapper(ApiDefinitionMapper.class); ApiDefinitionMapper batchMapper = sqlSession.getMapper(ApiDefinitionMapper.class);
List<ApiDefinitionResult> data = apiImport.getData(); List<ApiDefinitionResult> data = apiImport.getData();
@ -378,6 +378,7 @@ public class ApiDefinitionService {
if (item.getName().length() > 255) { if (item.getName().length() > 255) {
item.setName(item.getName().substring(0, 255)); item.setName(item.getName().substring(0, 255));
} }
item.setModuleId(request.getModuleId());
createTest(item, batchMapper); createTest(item, batchMapper);
if (i % 300 == 0) { if (i % 300 == 0) {
sqlSession.flushStatements(); sqlSession.flushStatements();

View File

@ -16,7 +16,6 @@ import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List; import java.util.List;
@RestController @RestController
@ -29,20 +28,18 @@ public class ProjectController {
@GetMapping("/listAll") @GetMapping("/listAll")
public List<ProjectDTO> listAll() { public List<ProjectDTO> listAll() {
// String currentWorkspaceId = SessionUtils.getCurrentWorkspaceId(); String currentWorkspaceId = SessionUtils.getCurrentWorkspaceId();
// ProjectRequest request = new ProjectRequest(); ProjectRequest request = new ProjectRequest();
// request.setWorkspaceId(currentWorkspaceId); request.setWorkspaceId(currentWorkspaceId);
// return projectService.getProjectList(request); return projectService.getProjectList(request);
return new ArrayList<>();
} }
/*jenkins项目列表*/ /*jenkins项目列表*/
@GetMapping("/listAll/{workspaceId}") @GetMapping("/listAll/{workspaceId}")
public List<ProjectDTO> jlistAll(@PathVariable String workspaceId) { public List<ProjectDTO> jlistAll(@PathVariable String workspaceId) {
// ProjectRequest request = new ProjectRequest(); ProjectRequest request = new ProjectRequest();
// request.setWorkspaceId(workspaceId); request.setWorkspaceId(workspaceId);
// return projectService.getProjectList(request); return projectService.getProjectList(request);
return new ArrayList<>();
} }
@GetMapping("/recent/{count}") @GetMapping("/recent/{count}")

View File

@ -878,6 +878,24 @@ public class JmeterDocumentParser implements DocumentParser {
} }
private void processVariableThroughputTimer(Element variableThroughputTimer) { private void processVariableThroughputTimer(Element variableThroughputTimer) {
Object durations = context.getProperty("duration");
Integer duration;
if (durations instanceof List) {
Object o = ((List<?>) durations).get(0);
duration = (Integer) o;
((List<?>) durations).remove(0);
} else {
duration = (Integer) durations;
}
Object rpsLimits = context.getProperty("rpsLimit");
String rpsLimit;
if (rpsLimits instanceof List) {
Object o = ((List<?>) rpsLimits).get(0);
((List<?>) rpsLimits).remove(0);
rpsLimit = o.toString();
} else {
rpsLimit = rpsLimits.toString();
}
if (variableThroughputTimer.getChildNodes().getLength() > 0) { if (variableThroughputTimer.getChildNodes().getLength() > 0) {
final NodeList childNodes = variableThroughputTimer.getChildNodes(); final NodeList childNodes = variableThroughputTimer.getChildNodes();
for (int i = 0; i < childNodes.getLength(); i++) { for (int i = 0; i < childNodes.getLength(); i++) {
@ -903,27 +921,9 @@ public class JmeterDocumentParser implements DocumentParser {
stringPropCount++; stringPropCount++;
} else { } else {
stringPropCount = 0; stringPropCount = 0;
Object durations = context.getProperty("duration");// 传入的是分钟数, 需要转化成秒数
Integer duration;
if (durations instanceof List) {
Object o = ((List<?>) durations).get(0);
duration = (Integer) o;
((List<?>) durations).remove(0);
} else {
duration = (Integer) durations;
}
prop.getFirstChild().setNodeValue(String.valueOf(duration)); prop.getFirstChild().setNodeValue(String.valueOf(duration));
continue; continue;
} }
Object rpsLimits = context.getProperty("rpsLimit");
String rpsLimit;
if (rpsLimits instanceof List) {
Object o = ((List<?>) rpsLimits).get(0);
((List<?>) rpsLimits).remove(0);
rpsLimit = o.toString();
} else {
rpsLimit = rpsLimits.toString();
}
prop.getFirstChild().setNodeValue(rpsLimit); prop.getFirstChild().setNodeValue(rpsLimit);
} }
} }

@ -1 +1 @@
Subproject commit 9f4a9bbf46fc1333dbcccea21f83e27e3ec10b1f Subproject commit 79343a2763b014355f91fc21b2356a95ae437973

View File

@ -21,6 +21,7 @@
:is-read-only="isReadOnly" :is-read-only="isReadOnly"
@exportAPI="exportAPI" @exportAPI="exportAPI"
@saveAsEdit="saveAsEdit" @saveAsEdit="saveAsEdit"
@refreshTable="$emit('refreshTable')"
@refresh="refresh" @refresh="refresh"
@debug="debug"/> @debug="debug"/>
</template> </template>

View File

@ -33,7 +33,7 @@
@saveAsEdit="saveAsEdit" @saveAsEdit="saveAsEdit"
@refresh="refresh" @refresh="refresh"
ref="basisApi"/> ref="basisApi"/>
<api-import ref="apiImport" @refresh="refresh"/> <api-import ref="apiImport" @refresh="$emit('refreshTable')"/>
</div> </div>
</template> </template>

@ -1 +1 @@
Subproject commit 010ad7a5f072a5e9d368c756a2473bbd20781433 Subproject commit 8cda5c873cd9985c97adb34efacf507167fa4182