From 6f7edddb0311412f9826e196dc1bcc5dc25313e3 Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Tue, 23 Feb 2021 17:27:36 +0800 Subject: [PATCH 1/5] =?UTF-8?q?fix(=E6=80=A7=E8=83=BD=E6=B5=8B=E8=AF=95):?= =?UTF-8?q?=20=E5=90=AF=E5=8A=A8jmeter=E4=B9=8B=E5=89=8D=E6=A3=80=E6=9F=A5?= =?UTF-8?q?=E7=AB=99=E7=82=B9=E9=85=8D=E7=BD=AE=E6=98=AF=E5=90=A6=E5=8F=AF?= =?UTF-8?q?=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/metersphere/commons/utils/ShiroUtils.java | 1 + .../performance/controller/JmeterFileController.java | 5 +++++ .../performance/engine/docker/DockerTestEngine.java | 6 +++--- backend/src/main/java/io/metersphere/xpack | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/backend/src/main/java/io/metersphere/commons/utils/ShiroUtils.java b/backend/src/main/java/io/metersphere/commons/utils/ShiroUtils.java index 27430e98ae..78c1d168fc 100644 --- a/backend/src/main/java/io/metersphere/commons/utils/ShiroUtils.java +++ b/backend/src/main/java/io/metersphere/commons/utils/ShiroUtils.java @@ -25,6 +25,7 @@ public class ShiroUtils { filterChainDefinitionMap.put("/favicon.ico", "anon"); filterChainDefinitionMap.put("/display/file/**", "anon"); filterChainDefinitionMap.put("/jmeter/download/**", "anon"); + filterChainDefinitionMap.put("/jmeter/ping", "anon"); filterChainDefinitionMap.put("/authsource/list/allenable", "anon"); filterChainDefinitionMap.put("/sso/signin", "anon"); filterChainDefinitionMap.put("/sso/callback", "anon"); diff --git a/backend/src/main/java/io/metersphere/performance/controller/JmeterFileController.java b/backend/src/main/java/io/metersphere/performance/controller/JmeterFileController.java index f39070d3b8..6ad3c39089 100644 --- a/backend/src/main/java/io/metersphere/performance/controller/JmeterFileController.java +++ b/backend/src/main/java/io/metersphere/performance/controller/JmeterFileController.java @@ -18,6 +18,11 @@ public class JmeterFileController { @Resource private JmeterFileService jmeterFileService; + @GetMapping("ping") + public String checkStatus() { + return "PONG"; + } + @GetMapping("download") public ResponseEntity downloadJmeterFiles(@RequestParam("testId") String testId, @RequestParam("resourceId") String resourceId, @RequestParam("ratio") double ratio, @RequestParam("startTime") long startTime, diff --git a/backend/src/main/java/io/metersphere/performance/engine/docker/DockerTestEngine.java b/backend/src/main/java/io/metersphere/performance/engine/docker/DockerTestEngine.java index c59a8664e1..eb28578592 100644 --- a/backend/src/main/java/io/metersphere/performance/engine/docker/DockerTestEngine.java +++ b/backend/src/main/java/io/metersphere/performance/engine/docker/DockerTestEngine.java @@ -74,14 +74,14 @@ public class DockerTestEngine extends AbstractEngine { BaseSystemConfigDTO baseInfo = CommonBeanFactory.getBean(SystemParameterService.class).getBaseInfo(); KafkaProperties kafkaProperties = CommonBeanFactory.getBean(KafkaProperties.class); JmeterProperties jmeterProperties = CommonBeanFactory.getBean(JmeterProperties.class); - String metersphereUrl = "http://localhost:8081"; + String metersphereUrl = "http://localhost:8081"; // 占位符 if (baseInfo != null) { metersphereUrl = baseInfo.getUrl(); } - + String jmeterPingUrl = metersphereUrl + "/jmeter/ping"; // 检查下载地址是否正确 // docker 不能从 localhost 中下载文件 if (StringUtils.contains(metersphereUrl, "http://localhost") - || !UrlTestUtils.testUrlWithTimeOut(metersphereUrl, 1000)) { + || !UrlTestUtils.testUrlWithTimeOut(jmeterPingUrl, 1000)) { MSException.throwException(Translator.get("run_load_test_file_init_error")); } diff --git a/backend/src/main/java/io/metersphere/xpack b/backend/src/main/java/io/metersphere/xpack index b9042074b7..611c38a8b0 160000 --- a/backend/src/main/java/io/metersphere/xpack +++ b/backend/src/main/java/io/metersphere/xpack @@ -1 +1 @@ -Subproject commit b9042074b780205e275c674f64417799110519fd +Subproject commit 611c38a8b0db7180ea4d4c8ace749ac25499672d From dc0adf3d8bf40942a02977239b4796a228dcaba7 Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Tue, 23 Feb 2021 19:02:09 +0800 Subject: [PATCH 2/5] =?UTF-8?q?refactor(=E6=80=A7=E8=83=BD=E6=B5=8B?= =?UTF-8?q?=E8=AF=95):=20=E5=8E=BB=E6=8E=89teardown=E7=BA=BF=E7=A8=8B?= =?UTF-8?q?=E7=BB=84=EF=BC=8C=E4=BD=BF=E7=94=A8=E6=97=A5=E5=BF=97=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E5=88=A4=E6=96=AD=E7=BB=93=E6=9D=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xml/reader/jmx/JmeterDocumentParser.java | 88 ------------------- 1 file changed, 88 deletions(-) diff --git a/backend/src/main/java/io/metersphere/performance/parse/xml/reader/jmx/JmeterDocumentParser.java b/backend/src/main/java/io/metersphere/performance/parse/xml/reader/jmx/JmeterDocumentParser.java index 73f401036e..09422aea6a 100644 --- a/backend/src/main/java/io/metersphere/performance/parse/xml/reader/jmx/JmeterDocumentParser.java +++ b/backend/src/main/java/io/metersphere/performance/parse/xml/reader/jmx/JmeterDocumentParser.java @@ -90,7 +90,6 @@ public class JmeterDocumentParser implements DocumentParser { parseHashTree(ele); } else if (nodeNameEquals(ele, TEST_PLAN)) { processSetupTestPlan(ele); - processTearDownTestPlan(ele); processCheckoutConfigTestElement(ele); processCheckoutDnsCacheManager(ele); processCheckoutArguments(ele); @@ -566,93 +565,6 @@ public class JmeterDocumentParser implements DocumentParser { } } - private void processTearDownTestPlan(Element ele) { - /*true*/ - 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(); - } - /* - - continue - - false - 1 - - 1 - 1 - false - - - true - - */ - 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); - /* - - */ - 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); - /* - - - false - true - false - - - - */ - 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); From ec426fcc1e02812e291aab832fa6a1b461d87b3b Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Tue, 23 Feb 2021 19:04:09 +0800 Subject: [PATCH 3/5] =?UTF-8?q?refactor(=E6=80=A7=E8=83=BD=E6=B5=8B?= =?UTF-8?q?=E8=AF=95):=20=E5=8F=98=E9=87=8F=E5=90=8D=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xml/reader/jmx/JmeterDocumentParser.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/backend/src/main/java/io/metersphere/performance/parse/xml/reader/jmx/JmeterDocumentParser.java b/backend/src/main/java/io/metersphere/performance/parse/xml/reader/jmx/JmeterDocumentParser.java index 09422aea6a..349563c8f2 100644 --- a/backend/src/main/java/io/metersphere/performance/parse/xml/reader/jmx/JmeterDocumentParser.java +++ b/backend/src/main/java/io/metersphere/performance/parse/xml/reader/jmx/JmeterDocumentParser.java @@ -566,17 +566,17 @@ public class JmeterDocumentParser implements DocumentParser { } 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; + Element boolProp = document.createElement("boolProp"); + boolProp.setAttribute("name", name); + boolProp.appendChild(document.createTextNode(String.valueOf(value))); + return boolProp; } private Element createIntProp(Document document, String name, int value) { - Element tearDownSwitch = document.createElement("intProp"); - tearDownSwitch.setAttribute("name", name); - tearDownSwitch.appendChild(document.createTextNode(String.valueOf(value))); - return tearDownSwitch; + Element intProp = document.createElement("intProp"); + intProp.setAttribute("name", name); + intProp.appendChild(document.createTextNode(String.valueOf(value))); + return intProp; } private void processBackendListener(Element backendListener) { From b312f8d3337c1cd49910e8286aa6a8c12153a600 Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Tue, 23 Feb 2021 20:40:41 +0800 Subject: [PATCH 4/5] =?UTF-8?q?fix:=20=E8=AF=B7=E6=B1=82json=E8=BD=AC?= =?UTF-8?q?=E6=8D=A2=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../metersphere/api/dto/definition/request/MsTestElement.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/MsTestElement.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/MsTestElement.java index fb30feb4b1..e287a189ed 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/MsTestElement.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/MsTestElement.java @@ -41,7 +41,6 @@ import org.apache.jmeter.config.Arguments; import org.apache.jmeter.config.CSVDataSet; import org.apache.jmeter.config.RandomVariableConfig; import org.apache.jmeter.modifiers.CounterConfig; -import org.apache.jmeter.protocol.http.control.AuthManager; import org.apache.jmeter.save.SaveService; import org.apache.jmeter.testelement.TestElement; import org.apache.jorphan.collections.HashTree; @@ -75,7 +74,7 @@ import java.util.stream.Collectors; }) @JSONType(seeAlso = {MsHTTPSamplerProxy.class, MsHeaderManager.class, MsJSR223Processor.class, MsJSR223PostProcessor.class, - MsJSR223PreProcessor.class, MsTestPlan.class, MsThreadGroup.class, AuthManager.class, MsAssertions.class, + MsJSR223PreProcessor.class, MsTestPlan.class, MsThreadGroup.class, MsAuthManager.class, MsAssertions.class, MsExtract.class, MsTCPSampler.class, MsDubboSampler.class, MsJDBCSampler.class, MsConstantTimer.class, MsIfController.class, MsScenario.class, MsLoopController.class, MsJmeterElement.class}, typeKey = "type") @Data public abstract class MsTestElement { From 03556344922acc5f621c1841711d8e82e7affaeb Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Wed, 24 Feb 2021 10:13:09 +0800 Subject: [PATCH 5/5] =?UTF-8?q?style(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA?= =?UTF-8?q?=EF=BC=8C=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20=E6=89=80?= =?UTF-8?q?=E6=9C=89TAG=E6=A0=87=E7=AD=BE=E6=98=BE=E7=A4=BA=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../automation/scenario/ApiScenarioList.vue | 4 +- .../components/list/ApiCaseSimpleList.vue | 4 +- .../definition/components/list/ApiList.vue | 1025 ++++++++--------- .../track/case/components/TestCaseList.vue | 4 +- .../comonents/api/RelevanceScenarioList.vue | 6 +- .../comonents/api/TestPlanApiCaseList.vue | 4 +- .../comonents/api/TestPlanApiScenarioList.vue | 4 +- .../functional/FunctionalTestCaseList.vue | 4 +- .../component/ScenarioFailureCasesList.vue | 4 +- 9 files changed, 520 insertions(+), 539 deletions(-) diff --git a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue index 0514b8985e..1d88e26b71 100644 --- a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue +++ b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue @@ -68,9 +68,7 @@ diff --git a/frontend/src/business/components/api/definition/components/list/ApiList.vue b/frontend/src/business/components/api/definition/components/list/ApiList.vue index 3b1ff4faa2..8a350023f9 100644 --- a/frontend/src/business/components/api/definition/components/list/ApiList.vue +++ b/frontend/src/business/components/api/definition/components/list/ApiList.vue @@ -114,13 +114,10 @@ v-if="item.id == 'tags'" prop="tags" :label="$t('commons.tag')" - min-width="80px" - :key="index" - > + min-width="120px" + :key="index"> @@ -209,555 +206,555 @@ diff --git a/frontend/src/business/components/track/case/components/TestCaseList.vue b/frontend/src/business/components/track/case/components/TestCaseList.vue index d0140ce774..e5f891f255 100644 --- a/frontend/src/business/components/track/case/components/TestCaseList.vue +++ b/frontend/src/business/components/track/case/components/TestCaseList.vue @@ -135,9 +135,7 @@ diff --git a/frontend/src/business/components/track/plan/view/comonents/api/RelevanceScenarioList.vue b/frontend/src/business/components/track/plan/view/comonents/api/RelevanceScenarioList.vue index 976e6d1ef3..3f40e57480 100644 --- a/frontend/src/business/components/track/plan/view/comonents/api/RelevanceScenarioList.vue +++ b/frontend/src/business/components/track/plan/view/comonents/api/RelevanceScenarioList.vue @@ -17,11 +17,9 @@ - + diff --git a/frontend/src/business/components/track/plan/view/comonents/api/TestPlanApiCaseList.vue b/frontend/src/business/components/track/plan/view/comonents/api/TestPlanApiCaseList.vue index 62422a5db6..685d3f6aaf 100644 --- a/frontend/src/business/components/track/plan/view/comonents/api/TestPlanApiCaseList.vue +++ b/frontend/src/business/components/track/plan/view/comonents/api/TestPlanApiCaseList.vue @@ -80,9 +80,7 @@ :label="$t('commons.tag')" :key="index"> diff --git a/frontend/src/business/components/track/plan/view/comonents/api/TestPlanApiScenarioList.vue b/frontend/src/business/components/track/plan/view/comonents/api/TestPlanApiScenarioList.vue index e2fa9fbca6..d5e51c5d58 100644 --- a/frontend/src/business/components/track/plan/view/comonents/api/TestPlanApiScenarioList.vue +++ b/frontend/src/business/components/track/plan/view/comonents/api/TestPlanApiScenarioList.vue @@ -37,9 +37,7 @@ diff --git a/frontend/src/business/components/track/plan/view/comonents/report/TemplateComponent/component/ScenarioFailureCasesList.vue b/frontend/src/business/components/track/plan/view/comonents/report/TemplateComponent/component/ScenarioFailureCasesList.vue index 20431cf5de..f9430218bf 100644 --- a/frontend/src/business/components/track/plan/view/comonents/report/TemplateComponent/component/ScenarioFailureCasesList.vue +++ b/frontend/src/business/components/track/plan/view/comonents/report/TemplateComponent/component/ScenarioFailureCasesList.vue @@ -20,9 +20,7 @@