diff --git a/backend/src/main/java/io/metersphere/api/jmeter/APIBackendListenerClient.java b/backend/src/main/java/io/metersphere/api/jmeter/APIBackendListenerClient.java index 2cd73f9ccb..66f3588154 100644 --- a/backend/src/main/java/io/metersphere/api/jmeter/APIBackendListenerClient.java +++ b/backend/src/main/java/io/metersphere/api/jmeter/APIBackendListenerClient.java @@ -13,12 +13,10 @@ import io.metersphere.notice.service.MailService; import io.metersphere.notice.service.NoticeService; import io.metersphere.track.service.TestPlanTestCaseService; import org.apache.commons.lang3.StringUtils; -import org.apache.http.protocol.HTTP; 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 org.pac4j.core.context.HttpConstants; import org.springframework.http.HttpMethod; import java.io.Serializable; @@ -41,6 +39,12 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl private APIReportService apiReportService; + private TestPlanTestCaseService testPlanTestCaseService; + + private NoticeService noticeService; + + private MailService mailService; + public String runMode = ApiRunMode.RUN.name(); // 测试ID @@ -60,6 +64,18 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl if (apiReportService == null) { LogUtil.error("apiReportService is required"); } + testPlanTestCaseService = CommonBeanFactory.getBean(TestPlanTestCaseService.class); + if (testPlanTestCaseService == null) { + LogUtil.error("testPlanTestCaseService is required"); + } + noticeService = CommonBeanFactory.getBean(NoticeService.class); + if (noticeService == null) { + LogUtil.error("noticeService is required"); + } + mailService = CommonBeanFactory.getBean(MailService.class); + if (mailService == null) { + LogUtil.error("mailService is required"); + } super.setupTest(context); } @@ -112,7 +128,7 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl testResult.getScenarios().addAll(scenarios.values()); testResult.getScenarios().sort(Comparator.comparing(ScenarioResult::getId)); - ApiTestReport report = null; + ApiTestReport report; if (StringUtils.equals(this.runMode, ApiRunMode.DEBUG.name())) { report = apiReportService.get(debugReportId); } else { @@ -123,7 +139,6 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl queue.clear(); super.teardownTest(context); - TestPlanTestCaseService testPlanTestCaseService = CommonBeanFactory.getBean(TestPlanTestCaseService.class); List ids = testPlanTestCaseService.getTestPlanTestCaseIds(testResult.getTestId()); if (ids.size() > 0) { try { @@ -137,10 +152,8 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl } } - NoticeService noticeService = CommonBeanFactory.getBean(NoticeService.class); try { List noticeList = noticeService.queryNotice(testResult.getTestId()); - MailService mailService = CommonBeanFactory.getBean(MailService.class); mailService.sendApiNotification(report, noticeList); } catch (Exception e) { LogUtil.error(e); diff --git a/backend/src/main/java/io/metersphere/xpack b/backend/src/main/java/io/metersphere/xpack index cf6b065263..ee74568be0 160000 --- a/backend/src/main/java/io/metersphere/xpack +++ b/backend/src/main/java/io/metersphere/xpack @@ -1 +1 @@ -Subproject commit cf6b06526324326a563d933e07118fac014a63b4 +Subproject commit ee74568be0beba46da19616f5832e83f9164c688 diff --git a/frontend/src/business/components/api/test/model/ScenarioModel.js b/frontend/src/business/components/api/test/model/ScenarioModel.js index a95344447c..8c1deeb47c 100644 --- a/frontend/src/business/components/api/test/model/ScenarioModel.js +++ b/frontend/src/business/components/api/test/model/ScenarioModel.js @@ -555,14 +555,6 @@ export class TCPRequest extends Request { } isValid() { - if (this.enable) { - if (!this.server) { - return { - isValid: false, - info: 'api_test.request.tcp.server_cannot_be_empty' - } - } - } return { isValid: true } diff --git a/frontend/src/business/components/track/case/components/TestCaseEdit.vue b/frontend/src/business/components/track/case/components/TestCaseEdit.vue index 47534ead9f..ac1a3d9511 100644 --- a/frontend/src/business/components/track/case/components/TestCaseEdit.vue +++ b/frontend/src/business/components/track/case/components/TestCaseEdit.vue @@ -243,7 +243,7 @@ :label="$t('load_test.file_type')"> + :label="$t('test_track.case.upload_time')">