fix the bug in loadTestPlans

This commit is contained in:
fanfuxiaoran 2014-03-04 18:04:40 +08:00
parent ae6b807d1f
commit f9bd848e27
5 changed files with 12 additions and 209 deletions

View File

@ -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<RunningScriptModel> scriptList = createRunningScriptModel(testPlan

View File

@ -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");

View File

@ -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<String, String> params = this.makeParamsMap("testPlanId",
testPlanId);

View File

@ -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,

View File

@ -1,196 +0,0 @@
<!DOCTYPE html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<html>
<head>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<meta charset="utf-8">
<title>Bench4Q</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description"
content="Bench4Q, a new method for QOS benchmarking.">
<meta name="author" content="Kai Ren">
<!-- The styles -->
<link id="bs-css" href="css/bootstrap-cerulean.css" rel="stylesheet">
<style type="text/css">
body {
padding-bottom: 40px;
}
.sidebar-nav {
padding: 9px 0;
}
</style>
<link href="css/bootstrap-responsive.css" rel="stylesheet">
<link href="css/charisma-app.css" rel="stylesheet">
<link href="css/jquery-ui-1.8.21.custom.css" rel="stylesheet">
<link href='css/chosen.css' rel='stylesheet'>
<link href='css/uniform.default.css' rel='stylesheet'>
<link href='css/colorbox.css' rel='stylesheet'>
<link href='css/jquery.noty.css' rel='stylesheet'>
<link href='css/noty_theme_default.css' rel='stylesheet'>
<link href='css/elfinder.min.css' rel='stylesheet'>
<link href='css/elfinder.theme.css' rel='stylesheet'>
<link href='css/opa-icons.css' rel='stylesheet'>
<link href='css/uploadify.css' rel='stylesheet'>
<link href='bench4q-css/bench4q.css' rel='stylesheet'>
<link rel="shortcut icon" href="img/favicon.ico">
<link href='css/buttons.css' rel='stylesheet'>
<link href='bench4q-css/test-new.css' rel='stylesheet'>
</head>
<body>
<fmt:bundle basename="i18n">
<jsp:include page="publiccontrol/navigatebar.jsp"></jsp:include>
<div >
<div >
<jsp:include page="publiccontrol/leftmenubar.jsp"></jsp:include>
<div id="content" class="span10">
<!-- content starts -->
<!-- up navigatebar start-->
<div>
<ul class="breadcrumb">
<li><a href="homepage.jsp"><fmt:message key="home" /></a> <span
class="divider">/</span></li>
<li><a href="#"><fmt:message key="creatatest" /></a></li>
</ul>
</div>
<!-- up navigatebar ends -->
<div>
<div>
<div>
<div>
<h3>
Create test configuration
</h3>
</div>
<div class="test-name-frame">
<div><p class="test-name-title">Test configuration name</p>
<input id="testConfigurationName" class="name-input" type="text" class="text-left" onblur="checkName()"/>
<div id="nameMessage" class="hide">the test configuration name can not be empty!</div>
</div>
</div>
<!--box content-->
</div>
<div class="title-frame">
<a href="#" ><i class="icon-plus" id="icon-load" onClick="toggleTestExecutionPlan()"></i></a>
<p class="title">Load test execution plan</p>
</div>
<div id="loadTestExecutionPlan" class="content-frame">
<div class="float-left">
<table id="loadConfig" class="table-margin-top">
<tr>
<th>RequireLoad</th>
<td><input id="RequireLoad" class="load-config-input" type="text" value="10" onblur="loadSchedulePlot();checkLoadConfig()"/></td>
</tr>
<tr><td height="15"></td></tr>
<tr>
<th>Warm Up</th>
<td><input id="WarmUp" class="load-config-input" type="text" value="10" onblur="loadSchedulePlot();checkLoadConfig()"/></td>
</tr>
<tr><td height="15"></td></tr>
<tr>
<th>Cool Down</th>
<td><input id="CoolDown" class="load-config-input" type="text" value="10" onblur="loadSchedulePlot();checkLoadConfig()"/></td>
</tr>
<tr><td height="15"></td></tr>
<tr>
<th>ExecuteRange</th>
<td><input id="ExecuteRange" class="load-config-input" type="text" value="10" onblur="loadSchedulePlot();checkLoadConfig()"/></td>
</tr>
</table>
<div id="loadConfigMessage" class="hide">all input can not be empty <br/>and must be greater than zero!</div>
</div>
<div id="highchartsPlot"></div>
</div>
<div class="title-frame">
<a href="#" ><i class="icon-plus" id="icon-user" onClick="toggleUserScenarios()"></i></a>
<p class="title">User scenarios</p>
</div>
<div id="userScenarios" class="content-frame">
<table id="userConfig" class="table-margin-top">
<tr>
<th>Allocation %</th>
<th>Script Name</th>
<th>Operation</th>
</tr>
<tr>
<td><input class="allocation-input" value="100" type="text" onblur="changeTotal();checkUserScenarios()"/> %</td>
<td>
<select name="select">
</select>
</td>
<td>
<button type="submit" class="btn btn-warning"
onClick="viewScript(this)">View/Edit</button>
</td>
</tr>
</table>
<table>
<tr>
<th>Total:</th>
<th id="totalNumber" class="total-right">100%</th>
</tr>
</table>
<div id="alertMessage" class="hide">The total allocation needs to be 100%</div>
<button type="submit" class="btn btn-primary add-button" id="userScenariosButton"
onClick="addScenario();checkUserScenarios()">Add scenario
</button>
<div id="userConfigMessage" class="hide">all input can not be empty and must be greater than zero!</div>
</div>
<div class="title-frame">
<a href="#" ><i class="icon-plus float-left" id="icon-ip" onClick="toggleIpConfig()"></i></a>
<p class="title">IP config</p>
</div>
<div id="ipConfig" class="content-frame">
<table id="ipConfigTable" class="table-margin-top">
<tr>
<th>IP:</th>
<th><input type="text" class="ip-input" onblur="checkIP()"/></th>
</tr>
</table>
<button type="submit" class="btn btn-primary add-button"
onClick="addIP();checkIP()">Add IP
</button>
<div id="ipConfigMessage" class="hide">all IP address can not be empty and must be consistent with the format!</div>
</div>
</div>
<button class="centre button button-block button-rounded button-caution button-large" onClick="startTest()">START TEST</button>
</div>
</div>
</div>
<jsp:include page="publiccontrol/footer.jsp"></jsp:include>
</div>
<!--/.fluid-container-->
<!-- external javascript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<!-- jQuery -->
<script src="js/jquery-1.7.2.min.js"></script>
<!-- jQuery UI -->
<script src="js/jquery-ui-1.8.21.custom.min.js"></script>
<!-- custom dropdown library -->
<script src="js/bootstrap-dropdown.js"></script>
<!-- library for advanced tooltip -->
<script src="js/bootstrap-tooltip.js"></script>
<!-- popover effect library -->
<script src="js/bootstrap-popover.js"></script>
<!-- library for cookie management -->
<script src="js/jquery.cookie.js"></script>
<!-- application script for Charisma demo -->
<script src="js/theme.js"></script>
<!-- <script src="script/base.js"></script> -->
<script src="script/test-new.js"></script>
<script src="js/highcharts.js"></script>
</fmt:bundle>
</body>
</html>