From f9bd848e27590cc0d1695a0829db24ba68ee459f Mon Sep 17 00:00:00 2001 From: fanfuxiaoran <495538672@qq.com> Date: Tue, 4 Mar 2014 18:04:40 +0800 Subject: [PATCH] fix the bug in loadTestPlans --- .../org/bench4q/web/TestPlan/RunTestPlan.java | 8 +- .../web/api/AuthorizeActionController.java | 10 +- .../web/api/TestPlanHistoryResult.java | 4 +- .../web/service/CommunicateWithMaster.java | 3 +- src/main/webapp/test-new.jsp | 196 ------------------ 5 files changed, 12 insertions(+), 209 deletions(-) delete mode 100644 src/main/webapp/test-new.jsp diff --git a/src/main/java/org/bench4q/web/TestPlan/RunTestPlan.java b/src/main/java/org/bench4q/web/TestPlan/RunTestPlan.java index 20f5b77a..43331967 100644 --- a/src/main/java/org/bench4q/web/TestPlan/RunTestPlan.java +++ b/src/main/java/org/bench4q/web/TestPlan/RunTestPlan.java @@ -7,7 +7,7 @@ import javax.xml.bind.JAXBException; import org.bench4q.share.models.master.MonitorModel; import org.bench4q.share.models.master.RunningScriptModel; -import org.bench4q.share.models.master.TestPlanBusinessModel; +import org.bench4q.share.models.master.TestPlanModel; import org.bench4q.share.models.master.TestPlanResultModel; import org.bench4q.share.models.master.TestScriptConfig; import org.bench4q.web.exception.CustomGenericException; @@ -30,7 +30,7 @@ public class RunTestPlan extends BaseService { TestPlanResultModel testPlanResultModel = (TestPlanResultModel) communicateWithMaster .getRespnseObjectByPostXml(accessToken, url, TestPlanResultModel.class, ObjectXmlExchange.toXml( - TestPlanBusinessModel.class, + TestPlanModel.class, createTestPlan(testPlanRequestModel, monitorPort)), caller); TestPlanTaskModel testPlanTaskModel = this @@ -43,9 +43,9 @@ public class RunTestPlan extends BaseService { } - private TestPlanBusinessModel createTestPlan(TestPlanRequestModel testPlan, + private TestPlanModel createTestPlan(TestPlanRequestModel testPlan, int port) { - TestPlanBusinessModel testPlanModel = new TestPlanBusinessModel(); + TestPlanModel testPlanModel = new TestPlanModel(); if (testPlan.getScriptList() != null && testPlan.getScriptList().size() > 0) { List scriptList = createRunningScriptModel(testPlan diff --git a/src/main/java/org/bench4q/web/api/AuthorizeActionController.java b/src/main/java/org/bench4q/web/api/AuthorizeActionController.java index db6ea540..d1cf0954 100644 --- a/src/main/java/org/bench4q/web/api/AuthorizeActionController.java +++ b/src/main/java/org/bench4q/web/api/AuthorizeActionController.java @@ -74,13 +74,13 @@ public class AuthorizeActionController extends BaseControllerService { httpResponse.getContent()); return extractRegisterModel(registerResponseModel); } catch (IOException e) { - logger.info(e.getStackTrace()); + logger.info(e,e.fillInStackTrace()); throw new CustomGenericException("1", "invalidate httpresponse:io exception", this.baseUrl + "/register"); } catch (JAXBException e) { // TODO Auto-generated catch block - logger.info(e.getStackTrace()); + logger.info(e,e.fillInStackTrace()); throw new CustomGenericException("1", "invalidate httpresponse:JAXBException", this.baseUrl + "/register"); @@ -98,19 +98,19 @@ public class AuthorizeActionController extends BaseControllerService { params, null); if (HttpRequester.isInvalidResponse(httpResponse)) { throw new CustomGenericException("1", - "invalidate httpResponse", + "network error:", "AuthorizeActionController_authorize"); } return (AuthorizeResponseModel) ObjectXmlExchange.fromXml( AuthorizeResponseModel.class, httpResponse.getContent()); } catch (IOException e) { - logger.info(e.getStackTrace()); + logger.info(e,e.fillInStackTrace()); throw new CustomGenericException("1", "invalidate httpResponse:IOException", "AuthorizeActionController_authorize"); } catch (JAXBException e) { - logger.info(e.getStackTrace()); + logger.info(e,e.fillInStackTrace()); throw new CustomGenericException("1", "invalidate httpResponse:JAXBException", "AuthorizeActionController_authorize"); diff --git a/src/main/java/org/bench4q/web/api/TestPlanHistoryResult.java b/src/main/java/org/bench4q/web/api/TestPlanHistoryResult.java index 0c268d4c..95b0332b 100644 --- a/src/main/java/org/bench4q/web/api/TestPlanHistoryResult.java +++ b/src/main/java/org/bench4q/web/api/TestPlanHistoryResult.java @@ -67,7 +67,7 @@ public class TestPlanHistoryResult extends BaseControllerService { @ModelAttribute("accessToken") String accessToken) throws CustomGenericException { String caller = "TestPlanHistoryResult:loadTestPlans"; - String url = this.getBaseUrl() + "/loadTestPlans"; + String url = "testPlan"+ "/loadTestPlans"; TestPlanResponseModel testPlanResponseModel = (TestPlanResponseModel) this .getTestPlanService() .getCommunicateWithMaster() @@ -142,7 +142,7 @@ public class TestPlanHistoryResult extends BaseControllerService { public BaseResponseModel deleteTest(HttpServletResponse response, @ModelAttribute("accessToken") String accessToken, @RequestParam String testPlanId) throws CustomGenericException { - String url = this.getBaseUrl() + "/removeTestPlanFromPool"; + String url = "testPlan" + "/removeTestPlanFromPool"; String caller = "TestPlanHistoryController:deleteTest"; Map params = this.makeParamsMap("testPlanId", testPlanId); diff --git a/src/main/java/org/bench4q/web/service/CommunicateWithMaster.java b/src/main/java/org/bench4q/web/service/CommunicateWithMaster.java index 6f5cadd0..001fe5f1 100644 --- a/src/main/java/org/bench4q/web/service/CommunicateWithMaster.java +++ b/src/main/java/org/bench4q/web/service/CommunicateWithMaster.java @@ -62,7 +62,7 @@ public class CommunicateWithMaster { masterIpFilePath)); prop.load(inputStream); inputStream.close(); - masterAddress = prop.getProperty("masterAddress") + "/"; + masterAddress = prop.getProperty("masterAddress") ; } catch (URISyntaxException e1) { e1.printStackTrace(); } catch (IOException e) { @@ -122,7 +122,6 @@ public class CommunicateWithMaster { throw new CustomGenericException("1", HTTPRSEPONSE_INVALIDATE, caller); } - System.out.println(httpResponse.getContent()); if (httpResponse.getCode() == HttpStatus.BAD_REQUEST_400) { ErrorResponseModel errorResponseModel = (ErrorResponseModel) ObjectXmlExchange .fromXml(ErrorResponseModel.class, diff --git a/src/main/webapp/test-new.jsp b/src/main/webapp/test-new.jsp deleted file mode 100644 index 1ab0640d..00000000 --- a/src/main/webapp/test-new.jsp +++ /dev/null @@ -1,196 +0,0 @@ - -<%@ page language="java" contentType="text/html; charset=UTF-8" - pageEncoding="UTF-8"%> - - -<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> - -Bench4Q - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- -
- - - -
- -
- -
-
-
-
-

- Create test configuration -

-
-
-

Test configuration name

- -
the test configuration name can not be empty!
-
-
- -
- -
- -

Load test execution plan

-
-
-
- - - - - - - - - - - - - - - - - - - - -
RequireLoad
Warm Up
Cool Down
ExecuteRange
-
all input can not be empty
and must be greater than zero!
-
-
-
- -
- -

User scenarios

-
-
- - - - - - - - - - - - -
Allocation %Script NameOperation
% - - - -
- - - - - -
Total:100%
-
The total allocation needs to be 100%
- -
all input can not be empty and must be greater than zero!
-
- -
- -

IP config

-
-
- - - - - -
IP:
- -
all IP address can not be empty and must be consistent with the format!
-
-
- -
-
-
- -
- - - - - - - - - - - - - - - - - - - - - - -
- -