a little update

This commit is contained in:
rkasdf 2013-08-16 18:22:07 +08:00
parent ce712478f6
commit bec6f437ff
6 changed files with 88 additions and 16 deletions

View File

@ -116,6 +116,39 @@
<artifactId>spring-beans</artifactId>
<version>3.2.3.RELEASE</version>
</dependency>
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.3</version>
<classifier>jdk15</classifier>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.7.0</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>net.sf.ezmorph</groupId>
<artifactId>ezmorph</artifactId>
<version>1.0.6</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.1</version>
</dependency>
</dependencies>

View File

@ -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;
}

View File

@ -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 = [],

View File

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

View File

@ -116,6 +116,39 @@
<artifactId>spring-beans</artifactId>
<version>3.2.3.RELEASE</version>
</dependency>
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.3</version>
<classifier>jdk15</classifier>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.7.0</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>net.sf.ezmorph</groupId>
<artifactId>ezmorph</artifactId>
<version>1.0.6</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.1</version>
</dependency>
</dependencies>