diff --git a/bench4q-web/pom.xml b/bench4q-web/pom.xml index fba60149..baa57b1e 100644 --- a/bench4q-web/pom.xml +++ b/bench4q-web/pom.xml @@ -116,6 +116,39 @@ spring-beans 3.2.3.RELEASE + + net.sf.json-lib + json-lib + 2.3 + jdk15 + + + + + commons-beanutils + commons-beanutils + 1.7.0 + + + commons-lang + commons-lang + 2.5 + + + commons-logging + commons-logging + 1.1.1 + + + net.sf.ezmorph + ezmorph + 1.0.6 + + + commons-collections + commons-collections + 3.2.1 + diff --git a/bench4q-web/src/main/java/org/bench4q/web/controller/TestPlanActionController.java b/bench4q-web/src/main/java/org/bench4q/web/controller/TestPlanActionController.java index 08ca5021..8f3613ea 100644 --- a/bench4q-web/src/main/java/org/bench4q/web/controller/TestPlanActionController.java +++ b/bench4q-web/src/main/java/org/bench4q/web/controller/TestPlanActionController.java @@ -15,6 +15,8 @@ import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; import javax.xml.bind.Unmarshaller; +import net.sf.json.JSONObject; + import org.bench4q.master.api.model.AgentBriefModel; import org.bench4q.master.api.model.RunTestPlanResultModel; import org.bench4q.master.api.model.RunningScriptModel; @@ -28,7 +30,6 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.SessionAttributes; -import sun.tools.tree.ThisExpression; @Controller @@ -66,7 +67,7 @@ public class TestPlanActionController extends BaseActionController { } @RequestMapping("runTestPlan.do") - public void runTestPlan(HttpServletRequest request, @ModelAttribute("accessToken") String accessToken) throws JAXBException, IOException{ + public void runTestPlan(HttpServletRequest request, @ModelAttribute("accessToken") String accessToken) throws JAXBException, IOException, InterruptedException{ System.out.println("enter runTestPlan"); String urlString = masterIP+"testPlan/runTestPlanWithTestPlanModel"; String content; @@ -88,10 +89,10 @@ public class TestPlanActionController extends BaseActionController { HttpResponse httpResponse = httpRequester.sendPostXml(urlString, content, properties); RunTestPlanResultModel runTestPlanResultModel = extractRunTestPlanResultModel(httpResponse.getContent()); this.setTestPlanId(runTestPlanResultModel.getTestPlanId()); + getRunningIofo(accessToken); } - @RequestMapping("getRunningInfo.do") - public void getRunningIofo(@ModelAttribute("accessToken") String accessToken) + public void getRunningIofo(String accessToken) throws IOException, JAXBException { System.out.println("enter getrunninginfo"); System.out.println(this.getTestPlanId()); @@ -109,7 +110,7 @@ public class TestPlanActionController extends BaseActionController { } @RequestMapping("getAgentBriefStatus.do") - public @ResponseBody String getAgentBriefStatus(@ModelAttribute("accessToken") String accessToken) throws IOException, JAXBException + public @ResponseBody JSONObject getAgentBriefStatus(@ModelAttribute("accessToken") String accessToken) throws IOException, JAXBException { System.out.println("getagentbriefstatus"); UUID agentRunIdUuid; @@ -126,8 +127,11 @@ public class TestPlanActionController extends BaseActionController { } } TestBriefStatusModel returnModel = agentBriefModel.getTestStatusModel(); + + JSONObject jsonObject = JSONObject.fromObject(returnModel); + System.out.println(jsonObject.toString()); System.out.println(returnModel.getAverageResponseTime()); - return String.valueOf(returnModel.getAverageResponseTime()); + return jsonObject; } diff --git a/bench4q-web/src/main/webapp/js/mainPage.js b/bench4q-web/src/main/webapp/js/mainPage.js index 757bd00b..e434f624 100644 --- a/bench4q-web/src/main/webapp/js/mainPage.js +++ b/bench4q-web/src/main/webapp/js/mainPage.js @@ -220,11 +220,7 @@ for(var i=0;i<3;i++){ var requireLoad = document.getElementsByName("requireLoad")[0].value; //alert(scriptID+requireLoad); $.post("runTestPlan.do",{scriptID:scriptID,requireLoad:requireLoad}); - alert("1"); - $.post("getRunningInfo.do"); - alert("2"); - $.post("getAgentBriefStatus.do"); - alert("3") + $(".formPage2").hide(); $(".formPage4").show(1); $("#highcontainer").show(); @@ -244,7 +240,13 @@ for(var i=0;i<3;i++){ load: function() { // set up the updating of the chart each second var series = this.series[0]; - setInterval(function(){$.post("getAgentBriefStatus.do",{},function(data){ + setTimeout(function(){$.post("getAgentBriefStatus.do",{},function(data){ + alert("4"); + alert(data); + + var domdata = jQuery.parseJSON(data); + alert(domdata); + alert(domdata.totalCount); var x = (new Date()).getTime(); // current time if(data=="NaN") data="0"; @@ -256,7 +258,7 @@ for(var i=0;i<3;i++){ } }, title: { - text: 'Live random data' + text: 'average responseTime' }, xAxis: { type: 'datetime', @@ -264,7 +266,7 @@ for(var i=0;i<3;i++){ }, yAxis: { title: { - text: 'Value' + text: 'responseTime' }, plotLines: [{ value: 0, @@ -286,7 +288,7 @@ for(var i=0;i<3;i++){ enabled: false }, series: [{ - name: 'Random data', + name: 'average responseTime', data: (function() { // generate an array of random data var data = [], diff --git a/bench4q-web/target/classes/org/bench4q/web/controller/TestPlanActionController.class b/bench4q-web/target/classes/org/bench4q/web/controller/TestPlanActionController.class index fb2269f4..bb40db66 100644 Binary files a/bench4q-web/target/classes/org/bench4q/web/controller/TestPlanActionController.class and b/bench4q-web/target/classes/org/bench4q/web/controller/TestPlanActionController.class differ diff --git a/bench4q-web/target/m2e-wtp/web-resources/META-INF/maven/bench4q-web/bench4q-web/pom.properties b/bench4q-web/target/m2e-wtp/web-resources/META-INF/maven/bench4q-web/bench4q-web/pom.properties index e031819e..d275dd3f 100644 --- a/bench4q-web/target/m2e-wtp/web-resources/META-INF/maven/bench4q-web/bench4q-web/pom.properties +++ b/bench4q-web/target/m2e-wtp/web-resources/META-INF/maven/bench4q-web/bench4q-web/pom.properties @@ -1,5 +1,5 @@ #Generated by Maven Integration for Eclipse -#Fri Aug 16 11:08:45 CST 2013 +#Fri Aug 16 16:23:16 CST 2013 version=0.0.1-SNAPSHOT groupId=bench4q-web m2e.projectName=bench4q-web diff --git a/bench4q-web/target/m2e-wtp/web-resources/META-INF/maven/bench4q-web/bench4q-web/pom.xml b/bench4q-web/target/m2e-wtp/web-resources/META-INF/maven/bench4q-web/bench4q-web/pom.xml index fba60149..baa57b1e 100644 --- a/bench4q-web/target/m2e-wtp/web-resources/META-INF/maven/bench4q-web/bench4q-web/pom.xml +++ b/bench4q-web/target/m2e-wtp/web-resources/META-INF/maven/bench4q-web/bench4q-web/pom.xml @@ -116,6 +116,39 @@ spring-beans 3.2.3.RELEASE + + net.sf.json-lib + json-lib + 2.3 + jdk15 + + + + + commons-beanutils + commons-beanutils + 1.7.0 + + + commons-lang + commons-lang + 2.5 + + + commons-logging + commons-logging + 1.1.1 + + + net.sf.ezmorph + ezmorph + 1.0.6 + + + commons-collections + commons-collections + 3.2.1 +