add jstree and edit useBahavior

This commit is contained in:
luqiong 2014-08-15 16:21:25 +08:00
parent f6d63208ee
commit 859b9696b9
47 changed files with 20629 additions and 20763 deletions

View File

@ -1,190 +1,190 @@
package org.bench4q.web.api; package org.bench4q.web.api;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.bench4q.share.models.master.MonitorMemoryResponseModel; import org.bench4q.share.models.master.MonitorMemoryResponseModel;
import org.bench4q.share.models.master.MonitorNetworkReponseModel; import org.bench4q.share.models.master.MonitorNetworkReponseModel;
import org.bench4q.share.models.master.MonitorPhysicalDiskResponseModel; import org.bench4q.share.models.master.MonitorPhysicalDiskResponseModel;
import org.bench4q.share.models.master.MonitorProcessorResponseModel; import org.bench4q.share.models.master.MonitorProcessorResponseModel;
import org.bench4q.web.masterMessager.MonitorMessager; import org.bench4q.web.masterMessager.MonitorMessager;
import org.bench4q.web.model.ResultModel; import org.bench4q.web.model.ResultModel;
import org.bench4q.web.service.MonitorService; import org.bench4q.web.service.MonitorService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.SessionAttributes; import org.springframework.web.bind.annotation.SessionAttributes;
@Controller @Controller
@SessionAttributes({ "accessToken" }) @SessionAttributes({ "accessToken" })
public class MonitorController extends BaseController { public class MonitorController extends BaseController {
private MonitorMessager monitorMessager; private MonitorMessager monitorMessager;
private final String port = "5556"; private final String port = "5556";
private MonitorService monitorService; private MonitorService monitorService;
public MonitorMessager getMonitorMessager() { public MonitorMessager getMonitorMessager() {
return monitorMessager; return monitorMessager;
} }
@Autowired @Autowired
public void setMonitorMessager(MonitorMessager monitorMessager) { public void setMonitorMessager(MonitorMessager monitorMessager) {
this.monitorMessager = monitorMessager; this.monitorMessager = monitorMessager;
} }
public MonitorService getMonitorService() { public MonitorService getMonitorService() {
return monitorService; return monitorService;
} }
@Autowired @Autowired
public void setMonitorService(MonitorService monitorService) { public void setMonitorService(MonitorService monitorService) {
this.monitorService = monitorService; this.monitorService = monitorService;
} }
@RequestMapping("/{testPlanId}/{ip}/cpu/{fieldName}/{startTime}") @RequestMapping("/{testPlanId}/{ip}/cpu/{fieldName}/{startTime}")
@ResponseBody @ResponseBody
public Map<String, Object> getCpuResult( public Map<String, Object> getCpuResult(
@ModelAttribute("accessToken") String accessToken, @ModelAttribute("accessToken") String accessToken,
@PathVariable("testPlanId") String testplanId, @PathVariable("testPlanId") String testplanId,
@PathVariable String ip, @PathVariable String fieldName, @PathVariable String ip, @PathVariable String fieldName,
@PathVariable String startTime) { @PathVariable String startTime) {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
MonitorProcessorResponseModel monitorProcessorResponseModel = this MonitorProcessorResponseModel monitorProcessorResponseModel = this
.getMonitorMessager().porcessor(accessToken, testplanId, ip, .getMonitorMessager().porcessor(accessToken, testplanId, ip,
port, startTime); port, startTime);
if (monitorProcessorResponseModel == null) { if (monitorProcessorResponseModel == null) {
return fail(map, SERVER_ERROR); return fail(map, SERVER_ERROR);
} }
List<ResultModel> resultModels = this.getMonitorService() List<ResultModel> resultModels = this.getMonitorService()
.extractMonitorResult( .extractMonitorResult(
monitorProcessorResponseModel.getProcessorModels(), monitorProcessorResponseModel.getProcessorModels(),
fieldName); fieldName);
if (resultModels == null) { if (resultModels == null) {
return fail(map, SERVER_ERROR); return fail(map, SERVER_ERROR);
} else { } else {
success(map); success(map);
map.put("result", resultModels); map.put("result", resultModels);
return map; return map;
} }
} }
// @RequestMapping("/{testPlanId}/SUT/{ip}/cpu/{cpuInstance}/{fieldName}/{startTime}") // @RequestMapping("/{testPlanId}/SUT/{ip}/cpu/{cpuInstance}/{fieldName}/{startTime}")
// @ResponseBody // @ResponseBody
// public Map<String, Object> getCpuResult( // public Map<String, Object> getCpuResult(
// @ModelAttribute("accessToken") String accessToken, // @ModelAttribute("accessToken") String accessToken,
// @PathVariable("testPlanId") String testplanId, // @PathVariable("testPlanId") String testplanId,
// @PathVariable String ip, @PathVariable String port, // @PathVariable String ip, @PathVariable String port,
// @PathVariable String cpuInstance, @PathVariable String fieldName, // @PathVariable String cpuInstance, @PathVariable String fieldName,
// @PathVariable String startTime) { // @PathVariable String startTime) {
// Map<String, Object> map = new HashMap<String, Object>(); // Map<String, Object> map = new HashMap<String, Object>();
// MonitorProcessorResponseModel monitorProcessorResponseModel = this // MonitorProcessorResponseModel monitorProcessorResponseModel = this
// .getMonitorMessager().porcessor(accessToken, testplanId, ip, // .getMonitorMessager().porcessor(accessToken, testplanId, ip,
// port, startTime); // port, startTime);
// if (monitorProcessorResponseModel == null) { // if (monitorProcessorResponseModel == null) {
// return fail(map, SERVER_ERROR); // return fail(map, SERVER_ERROR);
// } // }
// //
// List<ResultModel> resultModels = this.getMonitorService() // List<ResultModel> resultModels = this.getMonitorService()
// .extractCpuResultModelList( // .extractCpuResultModelList(
// monitorProcessorResponseModel.getProcessorModels(), // monitorProcessorResponseModel.getProcessorModels(),
// cpuInstance, fieldName); // cpuInstance, fieldName);
// if (resultModels == null) { // if (resultModels == null) {
// return fail(map, SERVER_ERROR); // return fail(map, SERVER_ERROR);
// } else { // } else {
// success(map); // success(map);
// map.put("result", resultModels); // map.put("result", resultModels);
// return map; // return map;
// } // }
// //
// } // }
@RequestMapping("/{testPlanId}/{ip}/memory/{fieldName}/{startTime}") @RequestMapping("/{testPlanId}/{ip}/memory/{fieldName}/{startTime}")
@ResponseBody @ResponseBody
public Map<String, Object> getMemoryStatus( public Map<String, Object> getMemoryStatus(
@ModelAttribute("accessToken") String accessToken, @ModelAttribute("accessToken") String accessToken,
@PathVariable("testPlanId") String testPlanId, @PathVariable("testPlanId") String testPlanId,
@PathVariable String ip, @PathVariable String fieldName, @PathVariable String ip, @PathVariable String fieldName,
@PathVariable String startTime) { @PathVariable String startTime) {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
MonitorMemoryResponseModel monitorMemoryResponseModel = this MonitorMemoryResponseModel monitorMemoryResponseModel = this
.getMonitorMessager().memory(accessToken, testPlanId, ip, port, .getMonitorMessager().memory(accessToken, testPlanId, ip, port,
startTime); startTime);
if (monitorMemoryResponseModel == null) { if (monitorMemoryResponseModel == null) {
return fail(map, SERVER_ERROR); return fail(map, SERVER_ERROR);
} }
List<ResultModel> resultModels = this List<ResultModel> resultModels = this
.getMonitorService() .getMonitorService()
.extractMonitorResult( .extractMonitorResult(
monitorMemoryResponseModel.getMemoryModels(), fieldName); monitorMemoryResponseModel.getMemoryModels(), fieldName);
if (resultModels == null) { if (resultModels == null) {
return fail(map, SERVER_ERROR); return fail(map, SERVER_ERROR);
} else { } else {
map = success(map); map = success(map);
map.put("result", resultModels); map.put("result", resultModels);
return map; return map;
} }
} }
@RequestMapping("/{testPlanId}/{ip}/physicalDisk/{fieldName}/{startTime}") @RequestMapping("/{testPlanId}/{ip}/physicalDisk/{fieldName}/{startTime}")
@ResponseBody @ResponseBody
public Map<String, Object> getPhysicalDisk( public Map<String, Object> getPhysicalDisk(
@ModelAttribute("accessToken") String accessToken, @ModelAttribute("accessToken") String accessToken,
@PathVariable("testPlanId") String testPlanId, @PathVariable("testPlanId") String testPlanId,
@PathVariable String ip, @PathVariable String fieldName, @PathVariable String ip, @PathVariable String fieldName,
@PathVariable String startTime) { @PathVariable String startTime) {
Map<String, Object> map = new HashMap<String,Object>(); Map<String, Object> map = new HashMap<String,Object>();
MonitorPhysicalDiskResponseModel monitorPhysicalDiskResponseModel = this MonitorPhysicalDiskResponseModel monitorPhysicalDiskResponseModel = this
.getMonitorMessager().physicalDisk(accessToken, testPlanId, ip, .getMonitorMessager().physicalDisk(accessToken, testPlanId, ip,
port, startTime); port, startTime);
if (monitorPhysicalDiskResponseModel == null) { if (monitorPhysicalDiskResponseModel == null) {
return fail(map, SERVER_ERROR); return fail(map, SERVER_ERROR);
} }
List<ResultModel> resultModels = this List<ResultModel> resultModels = this
.getMonitorService() .getMonitorService()
.extractMonitorResult( .extractMonitorResult(
monitorPhysicalDiskResponseModel monitorPhysicalDiskResponseModel
.getPhysicalDiskModels(), .getPhysicalDiskModels(),
fieldName); fieldName);
if (resultModels == null) { if (resultModels == null) {
return fail(map, ""); return fail(map, "");
} else { } else {
map = success(map); map = success(map);
map.put("result", resultModels); map.put("result", resultModels);
return map; return map;
} }
} }
@RequestMapping("/{testPlanId}/{ip}/network/{fieldName}/{startTime}") @RequestMapping("/{testPlanId}/{ip}/network/{fieldName}/{startTime}")
@ResponseBody @ResponseBody
public Map<String, Object> getNetworkStaus( public Map<String, Object> getNetworkStaus(
@ModelAttribute("accessToken") String accessToken, @ModelAttribute("accessToken") String accessToken,
@PathVariable("testPlanId") String testPlanId, @PathVariable("testPlanId") String testPlanId,
@PathVariable String ip, @PathVariable String fieldName, @PathVariable String ip, @PathVariable String fieldName,
@PathVariable String startTime) { @PathVariable String startTime) {
Map<String, Object> map = new HashMap<String,Object>(); Map<String, Object> map = new HashMap<String,Object>();
MonitorNetworkReponseModel monitorNetworkReponseModel = this MonitorNetworkReponseModel monitorNetworkReponseModel = this
.getMonitorMessager().network(accessToken, testPlanId, ip, .getMonitorMessager().network(accessToken, testPlanId, ip,
port, startTime); port, startTime);
if (monitorNetworkReponseModel == null) { if (monitorNetworkReponseModel == null) {
return fail(map, SERVER_ERROR); return fail(map, SERVER_ERROR);
} }
List<ResultModel> resultModels = this.getMonitorService() List<ResultModel> resultModels = this.getMonitorService()
.extractMonitorResult(monitorNetworkReponseModel.getModels(), .extractMonitorResult(monitorNetworkReponseModel.getModels(),
fieldName); fieldName);
if (resultModels == null) { if (resultModels == null) {
return fail(map, SERVER_ERROR); return fail(map, SERVER_ERROR);
} else { } else {
map = success(map); map = success(map);
map.put("result", resultModels); map.put("result", resultModels);
return map; return map;
} }
} }
} }

View File

@ -1,393 +1,393 @@
package org.bench4q.web.api; package org.bench4q.web.api;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import javax.xml.bind.JAXBException; import javax.xml.bind.JAXBException;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.bench4q.share.helper.ExceptionLog; import org.bench4q.share.helper.ExceptionLog;
import org.bench4q.share.helper.MarshalHelper; import org.bench4q.share.helper.MarshalHelper;
import org.bench4q.share.models.agent.BehaviorStatusCodeResultModel; import org.bench4q.share.models.agent.BehaviorStatusCodeResultModel;
import org.bench4q.share.models.master.MonitorModel; import org.bench4q.share.models.master.MonitorModel;
import org.bench4q.share.models.master.ScriptHandleModel; import org.bench4q.share.models.master.ScriptHandleModel;
import org.bench4q.share.models.master.TestPlanDBModel; import org.bench4q.share.models.master.TestPlanDBModel;
import org.bench4q.share.models.master.TestPlanModel; import org.bench4q.share.models.master.TestPlanModel;
import org.bench4q.share.models.master.TestPlanResultModel; import org.bench4q.share.models.master.TestPlanResultModel;
import org.bench4q.share.models.master.TestPlanScriptBriefResultModel; import org.bench4q.share.models.master.TestPlanScriptBriefResultModel;
import org.bench4q.share.models.master.statistics.ScriptBehaviorsBriefModel; import org.bench4q.share.models.master.statistics.ScriptBehaviorsBriefModel;
import org.bench4q.share.models.master.statistics.ScriptBriefResultModel; import org.bench4q.share.models.master.statistics.ScriptBriefResultModel;
import org.bench4q.share.models.master.statistics.ScriptPagesBriefModel; import org.bench4q.share.models.master.statistics.ScriptPagesBriefModel;
import org.bench4q.web.init.TestResultHandle; import org.bench4q.web.init.TestResultHandle;
import org.bench4q.web.masterMessager.TestPlanMessager; import org.bench4q.web.masterMessager.TestPlanMessager;
import org.bench4q.web.model.ResultInfoModel; import org.bench4q.web.model.ResultInfoModel;
import org.bench4q.web.model.TestBriefStatusModel; import org.bench4q.web.model.TestBriefStatusModel;
import org.bench4q.web.model.TestPlanRequestModel; import org.bench4q.web.model.TestPlanRequestModel;
import org.bench4q.web.model.UrlContentTypeDistributionModel; import org.bench4q.web.model.UrlContentTypeDistributionModel;
import org.bench4q.web.service.TestPlanService; import org.bench4q.web.service.TestPlanService;
import org.bench4q.web.validation.TestPlanValidate; import org.bench4q.web.validation.TestPlanValidate;
import org.bench4q.web.validation.ValidateResponseModel; import org.bench4q.web.validation.ValidateResponseModel;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.SessionAttributes; import org.springframework.web.bind.annotation.SessionAttributes;
@Controller @Controller
@SessionAttributes({ "accessToken" }) @SessionAttributes({ "accessToken" })
public class TestPlanController extends BaseController { public class TestPlanController extends BaseController {
private TestPlanMessager testPlanMessager; private TestPlanMessager testPlanMessager;
private TestPlanValidate testPlanValidate; private TestPlanValidate testPlanValidate;
private TestPlanService testPlanService; private TestPlanService testPlanService;
private final int monitorPort = 5556; private final int monitorPort = 5556;
private TestPlanMessager getTestPlanMessager() { private TestPlanMessager getTestPlanMessager() {
return testPlanMessager; return testPlanMessager;
} }
@Autowired @Autowired
private void setTestPlanMessager(TestPlanMessager testPlanMessager) { private void setTestPlanMessager(TestPlanMessager testPlanMessager) {
this.testPlanMessager = testPlanMessager; this.testPlanMessager = testPlanMessager;
} }
private TestPlanValidate getTestPlanValidate() { private TestPlanValidate getTestPlanValidate() {
return testPlanValidate; return testPlanValidate;
} }
@Autowired @Autowired
private void setTestPlanValidate(TestPlanValidate testPlanValidate) { private void setTestPlanValidate(TestPlanValidate testPlanValidate) {
this.testPlanValidate = testPlanValidate; this.testPlanValidate = testPlanValidate;
} }
private TestPlanService getTestPlanService() { private TestPlanService getTestPlanService() {
return testPlanService; return testPlanService;
} }
@Autowired @Autowired
private void setTestPlanService(TestPlanService testPlanService) { private void setTestPlanService(TestPlanService testPlanService) {
this.testPlanService = testPlanService; this.testPlanService = testPlanService;
} }
@RequestMapping(value = "runTestPlan", method = RequestMethod.POST) @RequestMapping(value = "runTestPlan", method = RequestMethod.POST)
@ResponseBody @ResponseBody
public Map<String, Object> runTestPlan( public Map<String, Object> runTestPlan(
@ModelAttribute("accessToken") String accessToken, @ModelAttribute("accessToken") String accessToken,
@RequestBody TestPlanRequestModel testPlanRequestModel) { @RequestBody TestPlanRequestModel testPlanRequestModel) {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
ValidateResponseModel validateResponseModel = this ValidateResponseModel validateResponseModel = this
.getTestPlanValidate().validateTestPlanSubmited( .getTestPlanValidate().validateTestPlanSubmited(
testPlanRequestModel); testPlanRequestModel);
if (!validateResponseModel.isSuccess()) { if (!validateResponseModel.isSuccess()) {
return fail(map, validateResponseModel.getMessage()); return fail(map, validateResponseModel.getMessage());
} else { } else {
TestPlanModel testPlanModel = this.getTestPlanService() TestPlanModel testPlanModel = this.getTestPlanService()
.createTestPlan(testPlanRequestModel, monitorPort); .createTestPlan(testPlanRequestModel, monitorPort);
String testPlanContent; String testPlanContent;
try { try {
testPlanContent = MarshalHelper.marshal(TestPlanModel.class, testPlanContent = MarshalHelper.marshal(TestPlanModel.class,
testPlanModel); testPlanModel);
} catch (JAXBException e) { } catch (JAXBException e) {
Logger.getLogger(TestPlanController.class).info( Logger.getLogger(TestPlanController.class).info(
ExceptionLog.getStackTrace(e)); ExceptionLog.getStackTrace(e));
return fail(map, "error testPlan"); return fail(map, "error testPlan");
} }
TestPlanResultModel testPlanResultModel = this TestPlanResultModel testPlanResultModel = this
.getTestPlanMessager().runTestPlan(accessToken, .getTestPlanMessager().runTestPlan(accessToken,
testPlanContent); testPlanContent);
if (testPlanResultModel != null if (testPlanResultModel != null
&& testPlanResultModel.getTestPlanId() != null) { && testPlanResultModel.getTestPlanId() != null) {
map = success(map); map = success(map);
map.put("testPlanResult", testPlanResultModel); map.put("testPlanResult", testPlanResultModel);
return map; return map;
} else { } else {
return fail(map, "empty test plan id"); return fail(map, "empty test plan id");
} }
} }
} }
@RequestMapping("/{testPlanId}/runningInfo") @RequestMapping("/{testPlanId}/runningInfo")
@ResponseBody @ResponseBody
public Map<String, Object> getRunningInfo( public Map<String, Object> getRunningInfo(
@ModelAttribute("accessToken") String accessToken, @ModelAttribute("accessToken") String accessToken,
@PathVariable String testPlanId) { @PathVariable String testPlanId) {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
TestPlanResultModel testPlanResultModel = this.getTestPlanMessager() TestPlanResultModel testPlanResultModel = this.getTestPlanMessager()
.getRunningTestInfo(accessToken, testPlanId); .getRunningTestInfo(accessToken, testPlanId);
if (testPlanResultModel == null) { if (testPlanResultModel == null) {
return fail(map, ""); return fail(map, "");
} else { } else {
success(map); success(map);
map.put("testPlan", testPlanResultModel); map.put("testPlan", testPlanResultModel);
return map; return map;
} }
} }
@RequestMapping(value = "/{testPlanId}/queryTestPlan") @RequestMapping(value = "/{testPlanId}/queryTestPlan")
@ResponseBody @ResponseBody
public Map<String, Object> queryTestPlan( public Map<String, Object> queryTestPlan(
@ModelAttribute("accessToken") String accessToken, @ModelAttribute("accessToken") String accessToken,
@PathVariable String testPlanId) { @PathVariable String testPlanId) {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
TestPlanDBModel testPlanResultModel = this.getTestPlanMessager() TestPlanDBModel testPlanResultModel = this.getTestPlanMessager()
.queryTestPlanById(accessToken, testPlanId); .queryTestPlanById(accessToken, testPlanId);
if (testPlanResultModel != null) { if (testPlanResultModel != null) {
success(map); success(map);
map.put("testPlan", testPlanResultModel); map.put("testPlan", testPlanResultModel);
return map; return map;
} else { } else {
return fail(map, ""); return fail(map, "");
} }
} }
@RequestMapping("/{testPlanId}/testResultHanadle") @RequestMapping("/{testPlanId}/testResultHanadle")
@ResponseBody @ResponseBody
public Map<String, Object> getTestResultHandle( public Map<String, Object> getTestResultHandle(
@ModelAttribute("accessToken") String accessToken, @ModelAttribute("accessToken") String accessToken,
@PathVariable String testPlanId) { @PathVariable String testPlanId) {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
TestPlanResultModel testPlanResultModel = this.getTestPlanMessager() TestPlanResultModel testPlanResultModel = this.getTestPlanMessager()
.getRunningTestInfo(accessToken, testPlanId); .getRunningTestInfo(accessToken, testPlanId);
if (testPlanResultModel == null) { if (testPlanResultModel == null) {
return fail(map, ""); return fail(map, "");
} }
try { try {
List<ResultInfoModel> results = new LinkedList<ResultInfoModel>(); List<ResultInfoModel> results = new LinkedList<ResultInfoModel>();
List<ResultInfoModel> scriptResultInfoModels = TestResultHandle.scriptResultInfoModel; List<ResultInfoModel> scriptResultInfoModels = TestResultHandle.scriptResultInfoModel;
List<ResultInfoModel> sutResultInfoModels = TestResultHandle.sutInfoModel; List<ResultInfoModel> sutResultInfoModels = TestResultHandle.sutInfoModel;
for (ScriptHandleModel scriptHandleModel : testPlanResultModel for (ScriptHandleModel scriptHandleModel : testPlanResultModel
.getScripts()) { .getScripts()) {
if (scriptHandleModel == null) { if (scriptHandleModel == null) {
continue; continue;
} }
results.add(getScriptResultInfoModels(scriptHandleModel, results.add(getScriptResultInfoModels(scriptHandleModel,
scriptResultInfoModels)); scriptResultInfoModels));
} }
if (testPlanResultModel.getMonitorModels() != null) { if (testPlanResultModel.getMonitorModels() != null) {
for (MonitorModel monitorModel : testPlanResultModel for (MonitorModel monitorModel : testPlanResultModel
.getMonitorModels()) { .getMonitorModels()) {
results.add(getSUTResultInfoModel(monitorModel, results.add(getSUTResultInfoModel(monitorModel,
sutResultInfoModels)); sutResultInfoModels));
} }
} }
map.put("resultHandle", results); map.put("resultHandle", results);
success(map); success(map);
return map; return map;
} catch (Exception e) { } catch (Exception e) {
Logger.getLogger(this.getClass()).info( Logger.getLogger(this.getClass()).info(
ExceptionLog.getStackTrace(e)); ExceptionLog.getStackTrace(e));
return fail(map, ""); return fail(map, "");
} }
} }
private ResultInfoModel getScriptResultInfoModels( private ResultInfoModel getScriptResultInfoModels(
ScriptHandleModel scriptHandleModel, ScriptHandleModel scriptHandleModel,
List<ResultInfoModel> scriptResultModels) { List<ResultInfoModel> scriptResultModels) {
ResultInfoModel resultInfoModel = new ResultInfoModel(); ResultInfoModel resultInfoModel = new ResultInfoModel();
resultInfoModel.setName(scriptHandleModel.getScriptName()); resultInfoModel.setName(scriptHandleModel.getScriptName());
resultInfoModel.setValue(scriptHandleModel.getScriptId().toString()); resultInfoModel.setValue(scriptHandleModel.getScriptId().toString());
resultInfoModel.setChildren(scriptResultModels); resultInfoModel.setChildren(scriptResultModels);
return resultInfoModel; return resultInfoModel;
} }
private ResultInfoModel getSUTResultInfoModel(MonitorModel monitorModel, private ResultInfoModel getSUTResultInfoModel(MonitorModel monitorModel,
List<ResultInfoModel> resultInfoModels) { List<ResultInfoModel> resultInfoModels) {
ResultInfoModel resultInfoModel = new ResultInfoModel(); ResultInfoModel resultInfoModel = new ResultInfoModel();
resultInfoModel.setName(monitorModel.getHostName()); resultInfoModel.setName(monitorModel.getHostName());
resultInfoModel.setValue(monitorModel.getHostName()); resultInfoModel.setValue(monitorModel.getHostName());
resultInfoModel.setChildren(resultInfoModels); resultInfoModel.setChildren(resultInfoModels);
return resultInfoModel; return resultInfoModel;
} }
@RequestMapping("/{testPlanId}/{scriptId}/scriptBriefResult/{fieldName}/{startTime}") @RequestMapping("/{testPlanId}/{scriptId}/scriptBriefResult/{fieldName}/{startTime}")
@ResponseBody @ResponseBody
public Map<String, Object> getScriptBriefStatus( public Map<String, Object> getScriptBriefStatus(
@ModelAttribute("accessToken") String accessToken, @ModelAttribute("accessToken") String accessToken,
@PathVariable String testPlanId, @PathVariable String scriptId, @PathVariable String testPlanId, @PathVariable String scriptId,
@PathVariable String fieldName, @PathVariable String startTime) { @PathVariable String fieldName, @PathVariable String startTime) {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
TestPlanScriptBriefResultModel testPlanScriptBriefResultModel = this TestPlanScriptBriefResultModel testPlanScriptBriefResultModel = this
.getTestPlanMessager().getScriptBriefResult(accessToken, .getTestPlanMessager().getScriptBriefResult(accessToken,
testPlanId, scriptId, startTime); testPlanId, scriptId, startTime);
Logger.getLogger(this.getClass()).info(MarshalHelper.tryMarshal(testPlanScriptBriefResultModel)); Logger.getLogger(this.getClass()).info(MarshalHelper.tryMarshal(testPlanScriptBriefResultModel));
if (testPlanScriptBriefResultModel != null) { if (testPlanScriptBriefResultModel != null) {
success(map); success(map);
map.put("result", map.put("result",
this.getTestPlanService().extractResultModelList( this.getTestPlanService().extractResultModelList(
testPlanScriptBriefResultModel, fieldName)); testPlanScriptBriefResultModel, fieldName));
return map; return map;
} else { } else {
return fail(map, ""); return fail(map, "");
} }
} }
@RequestMapping("/{testPlanId}/testBriefStatus") @RequestMapping("/{testPlanId}/testBriefStatus")
@ResponseBody @ResponseBody
public Map<String, Object> getTestBriefStatus( public Map<String, Object> getTestBriefStatus(
@ModelAttribute("accessToken") String accessToken, @ModelAttribute("accessToken") String accessToken,
@PathVariable String testPlanId) { @PathVariable String testPlanId) {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
TestBriefStatusModel testBriefStatusModel = new TestBriefStatusModel(); TestBriefStatusModel testBriefStatusModel = new TestBriefStatusModel();
long vus = 0; long vus = 0;
long requests = 0; long requests = 0;
TestPlanResultModel testPlanResultModel = this.getTestPlanMessager() TestPlanResultModel testPlanResultModel = this.getTestPlanMessager()
.getRunningTestInfo(accessToken, testPlanId); .getRunningTestInfo(accessToken, testPlanId);
if (testPlanResultModel == null) { if (testPlanResultModel == null) {
return fail(map, ""); return fail(map, "");
} }
for (ScriptHandleModel scriptHandleModel : testPlanResultModel for (ScriptHandleModel scriptHandleModel : testPlanResultModel
.getScripts()) { .getScripts()) {
ScriptBriefResultModel lastScriptBriefResultModel = this ScriptBriefResultModel lastScriptBriefResultModel = this
.getTestPlanMessager().getLatestScriptBriefResult( .getTestPlanMessager().getLatestScriptBriefResult(
accessToken, testPlanId, accessToken, testPlanId,
scriptHandleModel.getScriptId().toString()); scriptHandleModel.getScriptId().toString());
if (lastScriptBriefResultModel == null) { if (lastScriptBriefResultModel == null) {
continue; continue;
} }
requests += lastScriptBriefResultModel.getTotalFailCountFromBegin() requests += lastScriptBriefResultModel.getTotalFailCountFromBegin()
+ lastScriptBriefResultModel + lastScriptBriefResultModel
.getTotalSuccessCountFromBegin(); .getTotalSuccessCountFromBegin();
vus += lastScriptBriefResultModel.getvUserCount(); vus += lastScriptBriefResultModel.getvUserCount();
} }
testBriefStatusModel.setRequests(requests); testBriefStatusModel.setRequests(requests);
testBriefStatusModel.setVus(vus); testBriefStatusModel.setVus(vus);
map.put("briefInfo", testBriefStatusModel); map.put("briefInfo", testBriefStatusModel);
return success(map); return success(map);
} }
@RequestMapping("/{testPlanId}/{scriptId}/behaviors") @RequestMapping("/{testPlanId}/{scriptId}/behaviors")
@ResponseBody @ResponseBody
public Map<String, Object> getScriptBehaviorBriefModel( public Map<String, Object> getScriptBehaviorBriefModel(
@ModelAttribute("accessToken") String accessToken, @ModelAttribute("accessToken") String accessToken,
@PathVariable String testPlanId, @PathVariable String scriptId) { @PathVariable String testPlanId, @PathVariable String scriptId) {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
ScriptBehaviorsBriefModel scriptBehaviorsBriefModel = this ScriptBehaviorsBriefModel scriptBehaviorsBriefModel = this
.getTestPlanMessager().getScriptBehaviorsBriefResult( .getTestPlanMessager().getScriptBehaviorsBriefResult(
accessToken, testPlanId, scriptId); accessToken, testPlanId, scriptId);
if (scriptBehaviorsBriefModel == null) { if (scriptBehaviorsBriefModel == null) {
return fail(map, ""); return fail(map, "");
} }
map = success(map); map = success(map);
map.put("behaviors", scriptBehaviorsBriefModel); map.put("behaviors", scriptBehaviorsBriefModel);
return map; return map;
} }
@RequestMapping("/{testPlanId}/{scriptId}/page") @RequestMapping("/{testPlanId}/{scriptId}/page")
@ResponseBody @ResponseBody
public Map<String, Object> getScriptPageBriefModel( public Map<String, Object> getScriptPageBriefModel(
@ModelAttribute("accessToken") String accessToken, @ModelAttribute("accessToken") String accessToken,
@PathVariable String testPlanId, @PathVariable String scriptId) { @PathVariable String testPlanId, @PathVariable String scriptId) {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
ScriptPagesBriefModel scriptPagesBriefModel = this ScriptPagesBriefModel scriptPagesBriefModel = this
.getTestPlanMessager().getScriptPageBriefModel(accessToken, .getTestPlanMessager().getScriptPageBriefModel(accessToken,
testPlanId, scriptId); testPlanId, scriptId);
if (scriptPagesBriefModel == null) { if (scriptPagesBriefModel == null) {
return fail(map, ""); return fail(map, "");
} }
map = success(map); map = success(map);
map.put("pages", scriptPagesBriefModel); map.put("pages", scriptPagesBriefModel);
return map; return map;
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@RequestMapping("/{testPlanId}/urlContentTypeDistribution") @RequestMapping("/{testPlanId}/urlContentTypeDistribution")
@ResponseBody @ResponseBody
public Map<String, Object> getUrlContentTypeDistribution( public Map<String, Object> getUrlContentTypeDistribution(
@ModelAttribute("accessToken") String accessToken, @ModelAttribute("accessToken") String accessToken,
@PathVariable String testPlanId) { @PathVariable String testPlanId) {
List<UrlContentTypeDistributionModel> urlContentTypeDistributionModels = new ArrayList<UrlContentTypeDistributionModel>(); List<UrlContentTypeDistributionModel> urlContentTypeDistributionModels = new ArrayList<UrlContentTypeDistributionModel>();
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
Map<String, Long> urlContentTypeCountMap = (Map<String, Long>) getUrlContentTypeCount( Map<String, Long> urlContentTypeCountMap = (Map<String, Long>) getUrlContentTypeCount(
accessToken, testPlanId).get("result"); accessToken, testPlanId).get("result");
if (urlContentTypeCountMap == null) { if (urlContentTypeCountMap == null) {
return fail(map, ""); return fail(map, "");
} }
Map<String, Double> urlContentTypePercentMap = this Map<String, Double> urlContentTypePercentMap = this
.getTestPlanService().getUrlContentTypePercent( .getTestPlanService().getUrlContentTypePercent(
urlContentTypeCountMap); urlContentTypeCountMap);
Set<String> keys = urlContentTypeCountMap.keySet(); Set<String> keys = urlContentTypeCountMap.keySet();
Iterator<String> iterator = keys.iterator(); Iterator<String> iterator = keys.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
String key = iterator.next(); String key = iterator.next();
urlContentTypeDistributionModels urlContentTypeDistributionModels
.add(new UrlContentTypeDistributionModel(key, .add(new UrlContentTypeDistributionModel(key,
urlContentTypeCountMap.get(key), urlContentTypeCountMap.get(key),
urlContentTypePercentMap.get(key))); urlContentTypePercentMap.get(key)));
} }
map = success(map); map = success(map);
map.put("result", urlContentTypePercentMap); map.put("result", urlContentTypePercentMap);
return map; return map;
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@RequestMapping("/{testPlanId}/urlContentTypePercent") @RequestMapping("/{testPlanId}/urlContentTypePercent")
@ResponseBody @ResponseBody
public Map<String, Object> getUrlContentTypePercent( public Map<String, Object> getUrlContentTypePercent(
@ModelAttribute("accessToken") String accessToken, @ModelAttribute("accessToken") String accessToken,
@PathVariable String testPlanId) { @PathVariable String testPlanId) {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
Map<String, Long> urlContentTypeCountMap = (Map<String, Long>) getUrlContentTypeCount( Map<String, Long> urlContentTypeCountMap = (Map<String, Long>) getUrlContentTypeCount(
accessToken, testPlanId).get("result"); accessToken, testPlanId).get("result");
if (urlContentTypeCountMap == null) { if (urlContentTypeCountMap == null) {
return fail(map, ""); return fail(map, "");
} }
map = success(map); map = success(map);
map.put("result", map.put("result",
this.getTestPlanService().getUrlContentTypePercent( this.getTestPlanService().getUrlContentTypePercent(
urlContentTypeCountMap)); urlContentTypeCountMap));
return map; return map;
} }
@RequestMapping("/{testPlanId}/urlContentTypeCount") @RequestMapping("/{testPlanId}/urlContentTypeCount")
@ResponseBody @ResponseBody
public Map<String, Object> getUrlContentTypeCount( public Map<String, Object> getUrlContentTypeCount(
@ModelAttribute("accessToken") String accessToken, @ModelAttribute("accessToken") String accessToken,
@PathVariable String testPlanId) { @PathVariable String testPlanId) {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
List<BehaviorStatusCodeResultModel> behaviorStatusCodeResultModels = this List<BehaviorStatusCodeResultModel> behaviorStatusCodeResultModels = this
.getTestPlanService().getAllBehaviorStatusCodeResultModels( .getTestPlanService().getAllBehaviorStatusCodeResultModels(
accessToken, testPlanId); accessToken, testPlanId);
if (behaviorStatusCodeResultModels == null) { if (behaviorStatusCodeResultModels == null) {
map.put("result", null); map.put("result", null);
return fail(map, ""); return fail(map, "");
} }
Map<String, Long> urlContentCountMap = new HashMap<String, Long>(); Map<String, Long> urlContentCountMap = new HashMap<String, Long>();
for (BehaviorStatusCodeResultModel behaviorStatusCodeResultModel : behaviorStatusCodeResultModels) { for (BehaviorStatusCodeResultModel behaviorStatusCodeResultModel : behaviorStatusCodeResultModels) {
if (urlContentCountMap.get(behaviorStatusCodeResultModel if (urlContentCountMap.get(behaviorStatusCodeResultModel
.getContentType()) == null) .getContentType()) == null)
urlContentCountMap.put( urlContentCountMap.put(
behaviorStatusCodeResultModel.getContentType(), behaviorStatusCodeResultModel.getContentType(),
behaviorStatusCodeResultModel.getCount()); behaviorStatusCodeResultModel.getCount());
else { else {
long originalValue = urlContentCountMap long originalValue = urlContentCountMap
.get(behaviorStatusCodeResultModel.getContentType()); .get(behaviorStatusCodeResultModel.getContentType());
urlContentCountMap.put( urlContentCountMap.put(
behaviorStatusCodeResultModel.getContentType(), behaviorStatusCodeResultModel.getContentType(),
originalValue originalValue
+ behaviorStatusCodeResultModel.getCount()); + behaviorStatusCodeResultModel.getCount());
} }
} }
map = success(map); map = success(map);
map.put("result", urlContentCountMap); map.put("result", urlContentCountMap);
return map; return map;
} }
} }

View File

@ -1,102 +1,102 @@
package org.bench4q.web.api; package org.bench4q.web.api;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.bench4q.share.communication.HttpRequester.HttpResponse; import org.bench4q.share.communication.HttpRequester.HttpResponse;
import org.bench4q.share.helper.ExceptionLog; import org.bench4q.share.helper.ExceptionLog;
import org.bench4q.share.models.master.TestPlanResponseModel; import org.bench4q.share.models.master.TestPlanResponseModel;
import org.bench4q.web.masterMessager.TestPlanMessager; import org.bench4q.web.masterMessager.TestPlanMessager;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.SessionAttributes; import org.springframework.web.bind.annotation.SessionAttributes;
@Controller @Controller
@SessionAttributes({ "accessToken" }) @SessionAttributes({ "accessToken" })
public class TestPlanHistoryController extends BaseController { public class TestPlanHistoryController extends BaseController {
private TestPlanMessager testPlanMessager; private TestPlanMessager testPlanMessager;
public TestPlanMessager getTestPlanMessager() { public TestPlanMessager getTestPlanMessager() {
return testPlanMessager; return testPlanMessager;
} }
@Autowired @Autowired
public void setTestPlanMessager(TestPlanMessager testPlanMessager) { public void setTestPlanMessager(TestPlanMessager testPlanMessager) {
this.testPlanMessager = testPlanMessager; this.testPlanMessager = testPlanMessager;
} }
@RequestMapping(value = "loadTestPlans", method = { RequestMethod.GET, @RequestMapping(value = "loadTestPlans", method = { RequestMethod.GET,
RequestMethod.POST }) RequestMethod.POST })
@ResponseBody @ResponseBody
public Map<String, Object> loadTestPlans( public Map<String, Object> loadTestPlans(
@ModelAttribute("accessToken") String accessToken) { @ModelAttribute("accessToken") String accessToken) {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
TestPlanResponseModel testPlanResponseModel = this TestPlanResponseModel testPlanResponseModel = this
.getTestPlanMessager().loadTestPlans(accessToken); .getTestPlanMessager().loadTestPlans(accessToken);
if (testPlanResponseModel == null || !testPlanResponseModel.isSuccess()) { if (testPlanResponseModel == null || !testPlanResponseModel.isSuccess()) {
return fail(map, ""); return fail(map, "");
} else { } else {
success(map); success(map);
map.put("testPlans", testPlanResponseModel.getTestPlanDBModels()); map.put("testPlans", testPlanResponseModel.getTestPlanDBModels());
return map; return map;
} }
} }
@RequestMapping(value = "downloadReport", method = { RequestMethod.GET, @RequestMapping(value = "downloadReport", method = { RequestMethod.GET,
RequestMethod.POST }) RequestMethod.POST })
public void downloadReport(HttpServletResponse response, public void downloadReport(HttpServletResponse response,
@ModelAttribute("accessToken") String accessToken, @ModelAttribute("accessToken") String accessToken,
@RequestParam String testPlanId) { @RequestParam String testPlanId) {
HttpResponse httpResponse = this.getTestPlanMessager().loadReport( HttpResponse httpResponse = this.getTestPlanMessager().loadReport(
accessToken, testPlanId); accessToken, testPlanId);
if (httpResponse == null || httpResponse.getContent() == "") { if (httpResponse == null || httpResponse.getContent() == "") {
return; return;
} }
try { try {
byte[] pdfBuffer = httpResponse.getContent().getBytes(); byte[] pdfBuffer = httpResponse.getContent().getBytes();
ServletOutputStream outputStream = response.getOutputStream(); ServletOutputStream outputStream = response.getOutputStream();
response.reset(); response.reset();
response.setHeader("Content-disposition", "attachment; filename=\"" response.setHeader("Content-disposition", "attachment; filename=\""
+ testPlanId.toString() + ".pdf\""); + testPlanId.toString() + ".pdf\"");
response.addHeader("Content-Length", "" + pdfBuffer.length); response.addHeader("Content-Length", "" + pdfBuffer.length);
response.setContentType("application/pdf"); response.setContentType("application/pdf");
outputStream.write(pdfBuffer); outputStream.write(pdfBuffer);
outputStream.flush(); outputStream.flush();
outputStream.close(); outputStream.close();
} catch (Exception e) { } catch (Exception e) {
Logger.getLogger(this.getClass()).info( Logger.getLogger(this.getClass()).info(
ExceptionLog.getStackTrace(e)); ExceptionLog.getStackTrace(e));
return; return;
} }
} }
@RequestMapping(value = "deleteTest", method = { RequestMethod.GET, @RequestMapping(value = "deleteTest", method = { RequestMethod.GET,
RequestMethod.POST }) RequestMethod.POST })
@ResponseBody @ResponseBody
public Map<String, Object> deleteTest(HttpServletResponse response, public Map<String, Object> deleteTest(HttpServletResponse response,
@ModelAttribute("accessToken") String accessToken, @ModelAttribute("accessToken") String accessToken,
@RequestParam String testPlanId) { @RequestParam String testPlanId) {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
TestPlanResponseModel testPlanResponseModel = this TestPlanResponseModel testPlanResponseModel = this
.getTestPlanMessager().deleteTestPlan(accessToken, testPlanId); .getTestPlanMessager().deleteTestPlan(accessToken, testPlanId);
if (testPlanResponseModel == null || !testPlanResponseModel.isSuccess()) { if (testPlanResponseModel == null || !testPlanResponseModel.isSuccess()) {
return fail(map, ""); return fail(map, "");
} else { } else {
return success(map); return success(map);
} }
} }
} }

View File

@ -1,90 +1,90 @@
package org.bench4q.web.masterMessager; package org.bench4q.web.masterMessager;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.Map; import java.util.Map;
import org.bench4q.share.communication.HttpRequester.HttpResponse; import org.bench4q.share.communication.HttpRequester.HttpResponse;
import org.bench4q.share.helper.MarshalHelper; import org.bench4q.share.helper.MarshalHelper;
import org.bench4q.share.models.master.AgentModel; import org.bench4q.share.models.master.AgentModel;
import org.bench4q.share.models.master.AgentResponseModel; import org.bench4q.share.models.master.AgentResponseModel;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@Component @Component
public class AgentManagerMessager extends MasterMessager { public class AgentManagerMessager extends MasterMessager {
public AgentManagerMessager() { public AgentManagerMessager() {
super(MasterAddressManamger.getMasterAddress() + "/agentManage"); super(MasterAddressManamger.getMasterAddress() + "/agentManage");
} }
public AgentResponseModel addAgent(String accessToken, public AgentResponseModel addAgent(String accessToken,
String agentModelContent) { String agentModelContent) {
System.out.println("enter and agent"); System.out.println("enter and agent");
String url = this.getBaseUrl() + "/addAgentToPool"; String url = this.getBaseUrl() + "/addAgentToPool";
HttpResponse httpResponse = null; HttpResponse httpResponse = null;
try { try {
httpResponse = this.getHttpRequester().sendPostXml(url, httpResponse = this.getHttpRequester().sendPostXml(url,
agentModelContent, makeAccessTockenMap(accessToken)); agentModelContent, makeAccessTockenMap(accessToken));
System.out.println("agent:"+httpResponse.getContent()); System.out.println("agent:"+httpResponse.getContent());
if (!validateHttpResponse(httpResponse)) { if (!validateHttpResponse(httpResponse)) {
handleInvalidatedResponse(url); handleInvalidatedResponse(url);
createFaliAgentResponseModel(); createFaliAgentResponseModel();
} }
return (AgentResponseModel) MarshalHelper.unmarshal( return (AgentResponseModel) MarshalHelper.unmarshal(
AgentResponseModel.class, httpResponse.getContent()); AgentResponseModel.class, httpResponse.getContent());
} catch (Exception e) { } catch (Exception e) {
this.handleException(httpResponse, e); this.handleException(httpResponse, e);
return createFaliAgentResponseModel(); return createFaliAgentResponseModel();
} }
} }
public AgentResponseModel deleteAgent(String accessToken, String agentId, public AgentResponseModel deleteAgent(String accessToken, String agentId,
String hostName) { String hostName) {
String url = this.getBaseUrl() + "/removeAgentFromPool"; String url = this.getBaseUrl() + "/removeAgentFromPool";
Map<String, String> params = new HashMap<String, String>(); Map<String, String> params = new HashMap<String, String>();
params.put("agentId", agentId); params.put("agentId", agentId);
params.put("hostName", hostName); params.put("hostName", hostName);
return this.getAgentResponseModel(url, params, accessToken); return this.getAgentResponseModel(url, params, accessToken);
} }
public AgentResponseModel loadAgents(String accessToken) { public AgentResponseModel loadAgents(String accessToken) {
String url = this.getBaseUrl() + "/queryAgentList"; String url = this.getBaseUrl() + "/queryAgentList";
AgentResponseModel agentResponseModel = this.getAgentResponseModel(url, AgentResponseModel agentResponseModel = this.getAgentResponseModel(url,
null, accessToken); null, accessToken);
if (agentResponseModel.getAgents() == null) { if (agentResponseModel.getAgents() == null) {
agentResponseModel.setAgents(new LinkedList<AgentModel>()); agentResponseModel.setAgents(new LinkedList<AgentModel>());
} }
return agentResponseModel; return agentResponseModel;
} }
private AgentResponseModel getAgentResponseModel(String url, private AgentResponseModel getAgentResponseModel(String url,
Map<String, String> params, String accessToken) { Map<String, String> params, String accessToken) {
HttpResponse httpResponse = null; HttpResponse httpResponse = null;
try { try {
httpResponse = this.getHttpRequester().sendGet(url, params, httpResponse = this.getHttpRequester().sendGet(url, params,
makeAccessTockenMap(accessToken)); makeAccessTockenMap(accessToken));
if (!validateHttpResponse(httpResponse)) { if (!validateHttpResponse(httpResponse)) {
handleInvalidatedResponse(url); handleInvalidatedResponse(url);
return createFaliAgentResponseModel(); return createFaliAgentResponseModel();
} }
return (AgentResponseModel) MarshalHelper.unmarshal( return (AgentResponseModel) MarshalHelper.unmarshal(
AgentResponseModel.class, httpResponse.getContent()); AgentResponseModel.class, httpResponse.getContent());
} catch (Exception e) { } catch (Exception e) {
this.handleException(httpResponse, e); this.handleException(httpResponse, e);
return createFaliAgentResponseModel(); return createFaliAgentResponseModel();
} }
} }
private AgentResponseModel createFaliAgentResponseModel() { private AgentResponseModel createFaliAgentResponseModel() {
AgentResponseModel agentResponseModel = new AgentResponseModel(); AgentResponseModel agentResponseModel = new AgentResponseModel();
agentResponseModel.setSuccess(false); agentResponseModel.setSuccess(false);
agentResponseModel.setFailCauseString(this.SERVER_ERROR); agentResponseModel.setFailCauseString(this.SERVER_ERROR);
return agentResponseModel; return agentResponseModel;
} }
} }

View File

@ -1,72 +1,72 @@
package org.bench4q.web.masterMessager; package org.bench4q.web.masterMessager;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.bench4q.share.communication.HttpRequester; import org.bench4q.share.communication.HttpRequester;
import org.bench4q.share.communication.HttpRequester.HttpResponse; import org.bench4q.share.communication.HttpRequester.HttpResponse;
import org.bench4q.share.helper.ExceptionLog; import org.bench4q.share.helper.ExceptionLog;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@Component @Component
public abstract class MasterMessager { public abstract class MasterMessager {
private final String AUTH_HEADER_PROPERTY = "Authorization"; private final String AUTH_HEADER_PROPERTY = "Authorization";
private final String ACCES_TOCKEN_STARTER = "Bearer "; private final String ACCES_TOCKEN_STARTER = "Bearer ";
protected final String SERVER_ERROR = "web server error"; protected final String SERVER_ERROR = "web server error";
protected String baseUrl; protected String baseUrl;
protected HttpRequester httpRequester; protected HttpRequester httpRequester;
protected Logger logger = Logger.getLogger(MasterMessager.class); protected Logger logger = Logger.getLogger(MasterMessager.class);
public String getBaseUrl() { public String getBaseUrl() {
return baseUrl; return baseUrl;
} }
protected void setBaseUrl(String baseUrl) { protected void setBaseUrl(String baseUrl) {
this.baseUrl = baseUrl; this.baseUrl = baseUrl;
} }
protected HttpRequester getHttpRequester() { protected HttpRequester getHttpRequester() {
return httpRequester; return httpRequester;
} }
@Autowired @Autowired
private void setHttpRequester(HttpRequester httpRequester) { private void setHttpRequester(HttpRequester httpRequester) {
this.httpRequester = httpRequester; this.httpRequester = httpRequester;
} }
public MasterMessager(String baseUrl) { public MasterMessager(String baseUrl) {
this.setBaseUrl(baseUrl); this.setBaseUrl(baseUrl);
} }
protected Map<String, String> makeAccessTockenMap(String accessToken) { protected Map<String, String> makeAccessTockenMap(String accessToken) {
Map<String, String> properties = new HashMap<String, String>(); Map<String, String> properties = new HashMap<String, String>();
properties properties
.put(AUTH_HEADER_PROPERTY, ACCES_TOCKEN_STARTER + accessToken); .put(AUTH_HEADER_PROPERTY, ACCES_TOCKEN_STARTER + accessToken);
return properties; return properties;
} }
protected void handleException(HttpResponse httpResponse, Exception e) { protected void handleException(HttpResponse httpResponse, Exception e) {
if (httpResponse != null) if (httpResponse != null)
logger.error(httpResponse.getContent()); logger.error(httpResponse.getContent());
logger.error(ExceptionLog.getStackTrace(e)); logger.error(ExceptionLog.getStackTrace(e));
} }
protected void handleInvalidatedResponse(String url) { protected void handleInvalidatedResponse(String url) {
logger.error(url+":invalidated http response"); logger.error(url+":invalidated http response");
} }
protected boolean validateHttpResponse(HttpResponse httpResponse) { protected boolean validateHttpResponse(HttpResponse httpResponse) {
if (httpResponse == null) { if (httpResponse == null) {
logger.info("http response is null"); logger.info("http response is null");
return false; return false;
} }
if (httpResponse.getCode() == 200) { if (httpResponse.getCode() == 200) {
return true; return true;
} }
logger.info(httpResponse.getContent()); logger.info(httpResponse.getContent());
return false; return false;
} }
} }

View File

@ -1,134 +1,134 @@
package org.bench4q.web.masterMessager; package org.bench4q.web.masterMessager;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.bench4q.share.communication.HttpRequester.HttpResponse; import org.bench4q.share.communication.HttpRequester.HttpResponse;
import org.bench4q.share.helper.MarshalHelper; import org.bench4q.share.helper.MarshalHelper;
import org.bench4q.share.models.master.MonitorMemoryResponseModel; import org.bench4q.share.models.master.MonitorMemoryResponseModel;
import org.bench4q.share.models.master.MonitorNetworkReponseModel; import org.bench4q.share.models.master.MonitorNetworkReponseModel;
import org.bench4q.share.models.master.MonitorPhysicalDiskResponseModel; import org.bench4q.share.models.master.MonitorPhysicalDiskResponseModel;
import org.bench4q.share.models.master.MonitorProcessorResponseModel; import org.bench4q.share.models.master.MonitorProcessorResponseModel;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
@Component @Component
public class MonitorMessager extends MasterMessager { public class MonitorMessager extends MasterMessager {
public MonitorMessager() { public MonitorMessager() {
super(MasterAddressManamger.getMasterAddress() + "/monitorController"); super(MasterAddressManamger.getMasterAddress() + "/monitorController");
} }
@RequestMapping(value = "/memorySUTInfo", method = { RequestMethod.GET, @RequestMapping(value = "/memorySUTInfo", method = { RequestMethod.GET,
RequestMethod.POST }) RequestMethod.POST })
public MonitorMemoryResponseModel memory(String accessToken, public MonitorMemoryResponseModel memory(String accessToken,
String testPlanRunId, String hostName, String port, String testPlanRunId, String hostName, String port,
String duationBegin) { String duationBegin) {
String url = this.getBaseUrl() + "/memorySUTInfo"; String url = this.getBaseUrl() + "/memorySUTInfo";
Map<String, String> params = createParmsMap(testPlanRunId, hostName, Map<String, String> params = createParmsMap(testPlanRunId, hostName,
port, duationBegin); port, duationBegin);
HttpResponse httpResponse = null; HttpResponse httpResponse = null;
try { try {
httpResponse = this.getHttpRequester().sendPost(url, params, httpResponse = this.getHttpRequester().sendPost(url, params,
makeAccessTockenMap(accessToken)); makeAccessTockenMap(accessToken));
if (!validateHttpResponse(httpResponse)) { if (!validateHttpResponse(httpResponse)) {
handleInvalidatedResponse(url); handleInvalidatedResponse(url);
return null; return null;
} }
MonitorMemoryResponseModel memoryResponseModel = (MonitorMemoryResponseModel) MarshalHelper MonitorMemoryResponseModel memoryResponseModel = (MonitorMemoryResponseModel) MarshalHelper
.unmarshal(MonitorMemoryResponseModel.class, .unmarshal(MonitorMemoryResponseModel.class,
httpResponse.getContent()); httpResponse.getContent());
return memoryResponseModel; return memoryResponseModel;
} catch (Exception e) { } catch (Exception e) {
this.handleException(httpResponse, e); this.handleException(httpResponse, e);
return null; return null;
} }
} }
public MonitorProcessorResponseModel porcessor(String accessToken, public MonitorProcessorResponseModel porcessor(String accessToken,
String testPlanRunId, String hostName, String port, String testPlanRunId, String hostName, String port,
String duationBegin) { String duationBegin) {
String url = this.baseUrl + "/processorSUTInfo"; String url = this.baseUrl + "/processorSUTInfo";
Map<String, String> params = createParmsMap(testPlanRunId, hostName, Map<String, String> params = createParmsMap(testPlanRunId, hostName,
port, duationBegin); port, duationBegin);
HttpResponse httpResponse = null; HttpResponse httpResponse = null;
try { try {
httpResponse = this.getHttpRequester().sendGet(url, params, httpResponse = this.getHttpRequester().sendGet(url, params,
makeAccessTockenMap(accessToken)); makeAccessTockenMap(accessToken));
if (!validateHttpResponse(httpResponse)) { if (!validateHttpResponse(httpResponse)) {
return null; return null;
} }
MonitorProcessorResponseModel monitorProcessorResponseModel = (MonitorProcessorResponseModel) MarshalHelper MonitorProcessorResponseModel monitorProcessorResponseModel = (MonitorProcessorResponseModel) MarshalHelper
.unmarshal(MonitorProcessorResponseModel.class, .unmarshal(MonitorProcessorResponseModel.class,
httpResponse.getContent()); httpResponse.getContent());
return monitorProcessorResponseModel; return monitorProcessorResponseModel;
} catch (Exception e) { } catch (Exception e) {
this.handleException(httpResponse, e); this.handleException(httpResponse, e);
return null; return null;
} }
} }
public MonitorNetworkReponseModel network(String accessToken, public MonitorNetworkReponseModel network(String accessToken,
String testPlanRunId, String hostName, String port, String testPlanRunId, String hostName, String port,
String duationBegin) { String duationBegin) {
String url = this.baseUrl + "/networkInfo"; String url = this.baseUrl + "/networkInfo";
Map<String, String> params = createParmsMap(testPlanRunId, hostName, Map<String, String> params = createParmsMap(testPlanRunId, hostName,
port, duationBegin); port, duationBegin);
HttpResponse httpResponse = null; HttpResponse httpResponse = null;
try { try {
httpResponse = this.getHttpRequester().sendGet(url, params, httpResponse = this.getHttpRequester().sendGet(url, params,
makeAccessTockenMap(accessToken)); makeAccessTockenMap(accessToken));
if (!validateHttpResponse(httpResponse)) { if (!validateHttpResponse(httpResponse)) {
handleInvalidatedResponse(url); handleInvalidatedResponse(url);
return null; return null;
} }
MonitorNetworkReponseModel networkInterfaceModel = (MonitorNetworkReponseModel) MarshalHelper MonitorNetworkReponseModel networkInterfaceModel = (MonitorNetworkReponseModel) MarshalHelper
.unmarshal(MonitorNetworkReponseModel.class, .unmarshal(MonitorNetworkReponseModel.class,
httpResponse.getContent()); httpResponse.getContent());
return networkInterfaceModel; return networkInterfaceModel;
} catch (Exception e) { } catch (Exception e) {
this.handleException(httpResponse, e); this.handleException(httpResponse, e);
return null; return null;
} }
} }
public MonitorPhysicalDiskResponseModel physicalDisk(String accessToken, public MonitorPhysicalDiskResponseModel physicalDisk(String accessToken,
String testPlanRunId, String hostName, String port, String testPlanRunId, String hostName, String port,
String duationBegin) { String duationBegin) {
String url = this.baseUrl + "/logicDiskMonitorSUTInfo" + "/" String url = this.baseUrl + "/logicDiskMonitorSUTInfo" + "/"
+ testPlanRunId + "/" + hostName + "/" + port + "/" + testPlanRunId + "/" + hostName + "/" + port + "/"
+ duationBegin; + duationBegin;
HttpResponse httpResponse = null; HttpResponse httpResponse = null;
try { try {
httpResponse = this.getHttpRequester().sendGet(url, null, httpResponse = this.getHttpRequester().sendGet(url, null,
makeAccessTockenMap(accessToken)); makeAccessTockenMap(accessToken));
if (!validateHttpResponse(httpResponse)) { if (!validateHttpResponse(httpResponse)) {
this.handleInvalidatedResponse(url); this.handleInvalidatedResponse(url);
return null; return null;
} }
MonitorPhysicalDiskResponseModel monitorPhysicalDiskResponseModel = (MonitorPhysicalDiskResponseModel) MarshalHelper MonitorPhysicalDiskResponseModel monitorPhysicalDiskResponseModel = (MonitorPhysicalDiskResponseModel) MarshalHelper
.unmarshal(MonitorPhysicalDiskResponseModel.class, .unmarshal(MonitorPhysicalDiskResponseModel.class,
httpResponse.getContent()); httpResponse.getContent());
return monitorPhysicalDiskResponseModel; return monitorPhysicalDiskResponseModel;
} catch (Exception e) { } catch (Exception e) {
this.handleException(httpResponse, e); this.handleException(httpResponse, e);
return null; return null;
} }
} }
private Map<String, String> createParmsMap(String testPlanRunId, private Map<String, String> createParmsMap(String testPlanRunId,
String hostName, String port, String duationBegin) { String hostName, String port, String duationBegin) {
Map<String, String> params = new HashMap<String, String>(); Map<String, String> params = new HashMap<String, String>();
params.put("testPlanRunId", testPlanRunId); params.put("testPlanRunId", testPlanRunId);
params.put("hostName", hostName); params.put("hostName", hostName);
params.put("port", port); params.put("port", port);
params.put("duationBegin", duationBegin); params.put("duationBegin", duationBegin);
return params; return params;
} }
} }

View File

@ -1,18 +1,18 @@
package org.bench4q.web.model; package org.bench4q.web.model;
import java.util.List; import java.util.List;
import org.bench4q.share.models.master.AgentModel; import org.bench4q.share.models.master.AgentModel;
public class AgentListModel { public class AgentListModel {
private List<AgentModel> list; private List<AgentModel> list;
public List<AgentModel> getList() { public List<AgentModel> getList() {
return list; return list;
} }
public void setList(List<AgentModel> list) { public void setList(List<AgentModel> list) {
this.list = list; this.list = list;
} }
} }

View File

@ -1,42 +1,42 @@
package org.bench4q.web.model; package org.bench4q.web.model;
import java.util.List; import java.util.List;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement @XmlRootElement
public class ResultInfoModel { public class ResultInfoModel {
private String name; private String name;
private String value; private String value;
private List<ResultInfoModel> children; private List<ResultInfoModel> children;
public ResultInfoModel(){ public ResultInfoModel(){
} }
public ResultInfoModel(String name,String value,List<ResultInfoModel> resultInfoModels){ public ResultInfoModel(String name,String value,List<ResultInfoModel> resultInfoModels){
this.name=name; this.name=name;
this.value=value; this.value=value;
this.children=resultInfoModels; this.children=resultInfoModels;
} }
public ResultInfoModel(String name,String value){ public ResultInfoModel(String name,String value){
this.name=name; this.name=name;
this.value=value; this.value=value;
} }
public String getName() { public String getName() {
return name; return name;
} }
public void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
} }
public String getValue() { public String getValue() {
return value; return value;
} }
public void setValue(String value) { public void setValue(String value) {
this.value = value; this.value = value;
} }
public List<ResultInfoModel> getChildren() { public List<ResultInfoModel> getChildren() {
return children; return children;
} }
public void setChildren(List<ResultInfoModel> children) { public void setChildren(List<ResultInfoModel> children) {
this.children = children; this.children = children;
} }
} }

View File

@ -1,27 +1,27 @@
package org.bench4q.web.model; package org.bench4q.web.model;
import java.util.Date; import java.util.Date;
public class ResultModel { public class ResultModel {
private boolean finished; private boolean finished;
private Object data; private Object data;
private Date time; private Date time;
public boolean isFinished() { public boolean isFinished() {
return finished; return finished;
} }
public void setFinished(boolean finished) { public void setFinished(boolean finished) {
this.finished = finished; this.finished = finished;
} }
public Date getTime() { public Date getTime() {
return time; return time;
} }
public void setTime(Date time) { public void setTime(Date time) {
this.time = time; this.time = time;
} }
public Object getData() { public Object getData() {
return data; return data;
} }
public void setData(Object data) { public void setData(Object data) {
this.data = data; this.data = data;
} }
} }

View File

@ -1,29 +1,29 @@
package org.bench4q.web.model; package org.bench4q.web.model;
import java.util.Date; import java.util.Date;
public class TestBriefStatusModel { public class TestBriefStatusModel {
private long vus; private long vus;
private long requests; private long requests;
private Date time; private Date time;
public long getVus() { public long getVus() {
return vus; return vus;
} }
public void setVus(long vus) { public void setVus(long vus) {
this.vus = vus; this.vus = vus;
} }
public long getRequests() { public long getRequests() {
return requests; return requests;
} }
public void setRequests(long requests) { public void setRequests(long requests) {
this.requests = requests; this.requests = requests;
} }
public Date getTime() { public Date getTime() {
return time; return time;
} }
public void setTime(Date time) { public void setTime(Date time) {
this.time = time; this.time = time;
} }
} }

View File

@ -1,54 +1,54 @@
package org.bench4q.web.model; package org.bench4q.web.model;
import java.util.List; import java.util.List;
public class TestPlanRequestModel { public class TestPlanRequestModel {
private List<String> ipList; private List<String> ipList;
private List<WebScriptModel> scriptList; private List<WebScriptModel> scriptList;
private String testPlanName; private String testPlanName;
public TestPlanRequestModel() { public TestPlanRequestModel() {
} }
public TestPlanRequestModel(String testPlanName, public TestPlanRequestModel(String testPlanName,
List<WebScriptModel> scriptList) { List<WebScriptModel> scriptList) {
this.testPlanName = testPlanName; this.testPlanName = testPlanName;
this.scriptList = scriptList; this.scriptList = scriptList;
} }
public TestPlanRequestModel(String testPlanName, public TestPlanRequestModel(String testPlanName,
List<WebScriptModel> scriptList, List<String> ipList) { List<WebScriptModel> scriptList, List<String> ipList) {
this.ipList = ipList; this.ipList = ipList;
} }
public String getTestPlanName() { public String getTestPlanName() {
return testPlanName; return testPlanName;
} }
public void setTestPlanName(String testPlanName) { public void setTestPlanName(String testPlanName) {
this.testPlanName = testPlanName; this.testPlanName = testPlanName;
} }
public List<String> getIpList() { public List<String> getIpList() {
return ipList; return ipList;
} }
public void setIpList(List<String> ipList) { public void setIpList(List<String> ipList) {
this.ipList = ipList; this.ipList = ipList;
} }
public List<WebScriptModel> getScriptList() { public List<WebScriptModel> getScriptList() {
return scriptList; return scriptList;
} }
public void setScriptList(List<WebScriptModel> scriptList) { public void setScriptList(List<WebScriptModel> scriptList) {
this.scriptList = scriptList; this.scriptList = scriptList;
} }
} }

View File

@ -1,36 +1,36 @@
package org.bench4q.web.model; package org.bench4q.web.model;
public class UrlContentTypeDistributionModel { public class UrlContentTypeDistributionModel {
private String contentType; private String contentType;
private long count; private long count;
private double percentage; private double percentage;
public UrlContentTypeDistributionModel(){ public UrlContentTypeDistributionModel(){
} }
public UrlContentTypeDistributionModel(String contentType,long count,double percentage){ public UrlContentTypeDistributionModel(String contentType,long count,double percentage){
this.contentType=contentType; this.contentType=contentType;
this.count=count; this.count=count;
this.percentage=percentage; this.percentage=percentage;
} }
public String getContentType() { public String getContentType() {
return contentType; return contentType;
} }
public void setContentType(String contentType) { public void setContentType(String contentType) {
this.contentType = contentType; this.contentType = contentType;
} }
public long getCount() { public long getCount() {
return count; return count;
} }
public void setCount(long count) { public void setCount(long count) {
this.count = count; this.count = count;
} }
public double getPercentage() { public double getPercentage() {
return percentage; return percentage;
} }
public void setPercentage(double percentage) { public void setPercentage(double percentage) {
this.percentage = percentage; this.percentage = percentage;
} }
} }

View File

@ -1,38 +1,38 @@
package org.bench4q.web.model; package org.bench4q.web.model;
public class UserModel { public class UserModel {
private String username; private String username;
private String password; private String password;
private String retype_pwd; private String retype_pwd;
public UserModel(){ public UserModel(){
} }
public UserModel(String name,String password){ public UserModel(String name,String password){
this.username=name; this.username=name;
this.password=password; this.password=password;
} }
public UserModel(String name,String password,String retype_pwd){ public UserModel(String name,String password,String retype_pwd){
this.username=name; this.username=name;
this.password=password; this.password=password;
this.retype_pwd=retype_pwd; this.retype_pwd=retype_pwd;
} }
public String getUsername() { public String getUsername() {
return username; return username;
} }
public void setUsername(String username) { public void setUsername(String username) {
this.username = username; this.username = username;
} }
public String getPassword() { public String getPassword() {
return password; return password;
} }
public void setPassword(String password) { public void setPassword(String password) {
this.password = password; this.password = password;
} }
public String getRetype_pwd() { public String getRetype_pwd() {
return retype_pwd; return retype_pwd;
} }
public void setRetype_pwd(String retype_pwd) { public void setRetype_pwd(String retype_pwd) {
this.retype_pwd = retype_pwd; this.retype_pwd = retype_pwd;
} }
} }

View File

@ -1,74 +1,74 @@
package org.bench4q.web.model; package org.bench4q.web.model;
public class WebScriptModel { public class WebScriptModel {
private int id; private int id;
private int load; private int load;
private long warmup; private long warmup;
private long executeRange; private long executeRange;
private long cooldown; private long cooldown;
private boolean staticResources; private boolean staticResources;
private boolean timer; private boolean timer;
public WebScriptModel() { public WebScriptModel() {
} }
public WebScriptModel(int id,int load,long warmup,long executeRange,long cooldown){ public WebScriptModel(int id,int load,long warmup,long executeRange,long cooldown){
this.id=id; this.id=id;
this.load=load; this.load=load;
this.warmup=warmup; this.warmup=warmup;
this.executeRange=executeRange; this.executeRange=executeRange;
this.cooldown=cooldown; this.cooldown=cooldown;
} }
public int getId() { public int getId() {
return id; return id;
} }
public void setId(int id) { public void setId(int id) {
this.id = id; this.id = id;
} }
public int getLoad() { public int getLoad() {
return load; return load;
} }
public void setLoad(int load) { public void setLoad(int load) {
this.load = load; this.load = load;
} }
public long getWarmup() { public long getWarmup() {
return warmup; return warmup;
} }
public void setWarmup(long warmup) { public void setWarmup(long warmup) {
this.warmup = warmup; this.warmup = warmup;
} }
public long getExecuteRange() { public long getExecuteRange() {
return executeRange; return executeRange;
} }
public void setExecuteRange(long executeRange) { public void setExecuteRange(long executeRange) {
this.executeRange = executeRange; this.executeRange = executeRange;
} }
public long getCooldown() { public long getCooldown() {
return cooldown; return cooldown;
} }
public void setCooldown(long cooldown) { public void setCooldown(long cooldown) {
this.cooldown = cooldown; this.cooldown = cooldown;
} }
public boolean isStaticResources() { public boolean isStaticResources() {
return staticResources; return staticResources;
} }
public void setStaticResources(boolean staticResources) { public void setStaticResources(boolean staticResources) {
this.staticResources = staticResources; this.staticResources = staticResources;
} }
public boolean isTimer() { public boolean isTimer() {
return timer; return timer;
} }
public void setTimer(boolean timer) { public void setTimer(boolean timer) {
this.timer = timer; this.timer = timer;
} }
} }

View File

@ -1,41 +1,41 @@
package org.bench4q.web.service; package org.bench4q.web.service;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.List; import java.util.List;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.bench4q.share.helper.ExceptionLog; import org.bench4q.share.helper.ExceptionLog;
import org.bench4q.web.model.ResultModel; import org.bench4q.web.model.ResultModel;
public class ChangeToResultModel { public class ChangeToResultModel {
public static ResultModel getResultModel(Object object, public static ResultModel getResultModel(Object object,
List<String> fieldNames) throws NoSuchFieldException { List<String> fieldNames) throws NoSuchFieldException {
ResultModel resultModel = new ResultModel(); ResultModel resultModel = new ResultModel();
for (String fieldName : fieldNames) { for (String fieldName : fieldNames) {
resultModel.setData(getSpecificFieldValue(object, fieldName)); resultModel.setData(getSpecificFieldValue(object, fieldName));
} }
return resultModel; return resultModel;
} }
private static Object getSpecificFieldValue(Object object, String fieldName) private static Object getSpecificFieldValue(Object object, String fieldName)
throws NoSuchFieldException { throws NoSuchFieldException {
try { try {
Field field = getFieldAndSetAccessible(object, fieldName); Field field = getFieldAndSetAccessible(object, fieldName);
return field.get(object); return field.get(object);
} catch (Exception e) { } catch (Exception e) {
Logger.getLogger(ChangeToResultModel.class).info( Logger.getLogger(ChangeToResultModel.class).info(
ExceptionLog.getStackTrace(e)); ExceptionLog.getStackTrace(e));
throw new NoSuchFieldException(); throw new NoSuchFieldException();
} }
} }
private static Field getFieldAndSetAccessible(Object object, private static Field getFieldAndSetAccessible(Object object,
String fieldName) throws NoSuchFieldException, SecurityException { String fieldName) throws NoSuchFieldException, SecurityException {
Field field = object.getClass().getDeclaredField(fieldName); Field field = object.getClass().getDeclaredField(fieldName);
field.setAccessible(true); field.setAccessible(true);
return field; return field;
} }
} }

View File

@ -1,42 +1,42 @@
package org.bench4q.web.service; package org.bench4q.web.service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.bench4q.share.helper.ExceptionLog; import org.bench4q.share.helper.ExceptionLog;
import org.bench4q.share.models.master.statistics.SampleModel; import org.bench4q.share.models.master.statistics.SampleModel;
import org.bench4q.web.model.ResultModel; import org.bench4q.web.model.ResultModel;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@Component @Component
public class MonitorService { public class MonitorService {
private Logger logger = Logger.getLogger(MonitorService.class); private Logger logger = Logger.getLogger(MonitorService.class);
public List<ResultModel> extractMonitorResult( public List<ResultModel> extractMonitorResult(
List<? extends SampleModel> list, String fieldName) { List<? extends SampleModel> list, String fieldName) {
if (list == null) if (list == null)
return null; return null;
List<ResultModel> resultModels = new ArrayList<ResultModel>(); List<ResultModel> resultModels = new ArrayList<ResultModel>();
List<String> fieldNames = new ArrayList<String>(); List<String> fieldNames = new ArrayList<String>();
fieldNames.add(fieldName); fieldNames.add(fieldName);
for (SampleModel sampleModel : list) { for (SampleModel sampleModel : list) {
if (sampleModel != null) { if (sampleModel != null) {
ResultModel resultModel; ResultModel resultModel;
try { try {
resultModel = ChangeToResultModel.getResultModel( resultModel = ChangeToResultModel.getResultModel(
sampleModel, fieldNames); sampleModel, fieldNames);
resultModel.setTime(sampleModel.getSamplingTime()); resultModel.setTime(sampleModel.getSamplingTime());
resultModel.setFinished(sampleModel.isFinished()); resultModel.setFinished(sampleModel.isFinished());
resultModels.add(resultModel); resultModels.add(resultModel);
} catch (NoSuchFieldException e) { } catch (NoSuchFieldException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
logger.info(ExceptionLog.getStackTrace(e)); logger.info(ExceptionLog.getStackTrace(e));
} }
} }
} }
return resultModels; return resultModels;
} }
} }

View File

@ -1,30 +1,30 @@
package org.bench4q.web.service; package org.bench4q.web.service;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import org.bench4q.share.models.master.plugin.PluginInfoModel; import org.bench4q.share.models.master.plugin.PluginInfoModel;
import org.bench4q.share.models.master.plugin.PluginResponseModel; import org.bench4q.share.models.master.plugin.PluginResponseModel;
import org.bench4q.share.models.master.plugin.PluginUIModel; import org.bench4q.share.models.master.plugin.PluginUIModel;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@Component @Component
public class PluginService { public class PluginService {
public List<PluginInfoModel> extractPluginInfoModels( public List<PluginInfoModel> extractPluginInfoModels(
PluginResponseModel pluginResponseModel) { PluginResponseModel pluginResponseModel) {
List<PluginInfoModel> pluginInfoModels = new LinkedList<PluginInfoModel>(); List<PluginInfoModel> pluginInfoModels = new LinkedList<PluginInfoModel>();
if (pluginResponseModel == null if (pluginResponseModel == null
|| pluginResponseModel.getPluginUIModels() == null) { || pluginResponseModel.getPluginUIModels() == null) {
return pluginInfoModels; return pluginInfoModels;
} else { } else {
for (PluginUIModel pluginUIModel : pluginResponseModel for (PluginUIModel pluginUIModel : pluginResponseModel
.getPluginUIModels()) { .getPluginUIModels()) {
pluginInfoModels.add(pluginUIModel.getPluginInfoModel()); pluginInfoModels.add(pluginUIModel.getPluginInfoModel());
} }
return pluginInfoModels; return pluginInfoModels;
} }
} }
} }

View File

@ -1,143 +1,143 @@
package org.bench4q.web.service; package org.bench4q.web.service;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.bench4q.share.models.agent.ParameterModel; import org.bench4q.share.models.agent.ParameterModel;
import org.bench4q.share.models.agent.RunScenarioModel; import org.bench4q.share.models.agent.RunScenarioModel;
import org.bench4q.share.models.agent.scriptrecord.BatchModel; import org.bench4q.share.models.agent.scriptrecord.BatchModel;
import org.bench4q.share.models.agent.scriptrecord.BehaviorModel; import org.bench4q.share.models.agent.scriptrecord.BehaviorModel;
import org.bench4q.share.models.agent.scriptrecord.PageModel; import org.bench4q.share.models.agent.scriptrecord.PageModel;
import org.bench4q.share.models.agent.scriptrecord.UsePluginModel; import org.bench4q.share.models.agent.scriptrecord.UsePluginModel;
import org.bench4q.share.models.master.plugin.BehaviorInfoModel; import org.bench4q.share.models.master.plugin.BehaviorInfoModel;
import org.bench4q.share.models.master.plugin.ParamInfoModel; import org.bench4q.share.models.master.plugin.ParamInfoModel;
import org.bench4q.share.models.master.plugin.PluginInfoModel; import org.bench4q.share.models.master.plugin.PluginInfoModel;
import org.bench4q.web.masterMessager.PluginMessager; import org.bench4q.web.masterMessager.PluginMessager;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@Component @Component
public class ScriptService { public class ScriptService {
private PluginMessager pluginMessager; private PluginMessager pluginMessager;
public PluginMessager getPluginMessager() { public PluginMessager getPluginMessager() {
return pluginMessager; return pluginMessager;
} }
@Autowired @Autowired
public void setPluginMessager(PluginMessager pluginMessager) { public void setPluginMessager(PluginMessager pluginMessager) {
this.pluginMessager = pluginMessager; this.pluginMessager = pluginMessager;
} }
public RunScenarioModel createRunScenarioModel( public RunScenarioModel createRunScenarioModel(
List<UsePluginModel> usePlugins, List<BehaviorModel> behaviorModels) { List<UsePluginModel> usePlugins, List<BehaviorModel> behaviorModels) {
RunScenarioModel runScenarioModel = new RunScenarioModel(); RunScenarioModel runScenarioModel = new RunScenarioModel();
runScenarioModel.setUsePlugins(usePlugins); runScenarioModel.setUsePlugins(usePlugins);
List<PageModel> pageModels = new LinkedList<PageModel>(); List<PageModel> pageModels = new LinkedList<PageModel>();
int count = 0; int count = 0;
for (BehaviorModel behaviorModel : behaviorModels) { for (BehaviorModel behaviorModel : behaviorModels) {
List<BehaviorModel> behaviorList = new LinkedList<BehaviorModel>(); List<BehaviorModel> behaviorList = new LinkedList<BehaviorModel>();
behaviorModel.setId(count); behaviorModel.setId(count);
behaviorList.add(behaviorModel); behaviorList.add(behaviorModel);
BatchModel batchModel = new BatchModel(); BatchModel batchModel = new BatchModel();
batchModel.setBehaviors(behaviorList); batchModel.setBehaviors(behaviorList);
batchModel.setChildId(-1); batchModel.setChildId(-1);
batchModel.setId(count); batchModel.setId(count);
batchModel.setParentId(-1); batchModel.setParentId(-1);
List<BatchModel> batchModels = new LinkedList<BatchModel>(); List<BatchModel> batchModels = new LinkedList<BatchModel>();
batchModels.add(batchModel); batchModels.add(batchModel);
PageModel pageModel = new PageModel(); PageModel pageModel = new PageModel();
pageModel.setBatches(batchModels); pageModel.setBatches(batchModels);
pageModels.add(pageModel); pageModels.add(pageModel);
count++; count++;
} }
runScenarioModel.setPages(pageModels); runScenarioModel.setPages(pageModels);
return runScenarioModel; return runScenarioModel;
} }
public Map<UsePluginModel, PluginInfoModel> createUsePluginInfoModelsWithValue( public Map<UsePluginModel, PluginInfoModel> createUsePluginInfoModelsWithValue(
List<UsePluginModel> usePluginModels, String accessToken) { List<UsePluginModel> usePluginModels, String accessToken) {
Map<UsePluginModel, PluginInfoModel> map = new HashMap<UsePluginModel, PluginInfoModel>(); Map<UsePluginModel, PluginInfoModel> map = new HashMap<UsePluginModel, PluginInfoModel>();
for (UsePluginModel usePluginModel : usePluginModels) { for (UsePluginModel usePluginModel : usePluginModels) {
map.put(usePluginModel, map.put(usePluginModel,
createPluginInfoModelWithValue(usePluginModel, accessToken)); createPluginInfoModelWithValue(usePluginModel, accessToken));
} }
return map; return map;
} }
public Map<BehaviorModel, BehaviorInfoModel> createBehaviorInfoModelsWithValue( public Map<BehaviorModel, BehaviorInfoModel> createBehaviorInfoModelsWithValue(
RunScenarioModel runScenarioModel, String accessToken) { RunScenarioModel runScenarioModel, String accessToken) {
Map<String, String> behaviorPluginMap = getBehaviorUsePluginName(runScenarioModel); Map<String, String> behaviorPluginMap = getBehaviorUsePluginName(runScenarioModel);
Map<BehaviorModel, BehaviorInfoModel> map = new HashMap<BehaviorModel, BehaviorInfoModel>(); Map<BehaviorModel, BehaviorInfoModel> map = new HashMap<BehaviorModel, BehaviorInfoModel>();
for (PageModel pageModel : runScenarioModel.getPages()) { for (PageModel pageModel : runScenarioModel.getPages()) {
BehaviorModel behaviorModel = pageModel.getBatches().get(0) BehaviorModel behaviorModel = pageModel.getBatches().get(0)
.getBehaviors().get(0); .getBehaviors().get(0);
System.out.println(behaviorPluginMap.get(behaviorModel.getUse())); System.out.println(behaviorPluginMap.get(behaviorModel.getUse()));
map.put(behaviorModel, map.put(behaviorModel,
createBehaviorModelWithValue(accessToken, behaviorModel, createBehaviorModelWithValue(accessToken, behaviorModel,
behaviorPluginMap.get(behaviorModel.getUse()))); behaviorPluginMap.get(behaviorModel.getUse())));
} }
return map; return map;
} }
private PluginInfoModel createPluginInfoModelWithValue( private PluginInfoModel createPluginInfoModelWithValue(
UsePluginModel usePluginModel, String accessToken) { UsePluginModel usePluginModel, String accessToken) {
PluginInfoModel pluginInfoModel = this.getPluginMessager() PluginInfoModel pluginInfoModel = this.getPluginMessager()
.getPluginInfoModel(accessToken, usePluginModel.getName()) .getPluginInfoModel(accessToken, usePluginModel.getName())
.getPluginInfoModel(); .getPluginInfoModel();
pluginInfoModel.setParamInfoModels(createParameterModelsWithValue( pluginInfoModel.setParamInfoModels(createParameterModelsWithValue(
usePluginModel.getParameters(), usePluginModel.getParameters(),
pluginInfoModel.getParamInfoModels())); pluginInfoModel.getParamInfoModels()));
return pluginInfoModel; return pluginInfoModel;
} }
private BehaviorInfoModel createBehaviorModelWithValue(String accessToken, private BehaviorInfoModel createBehaviorModelWithValue(String accessToken,
BehaviorModel behaviorModel, String pluginName) { BehaviorModel behaviorModel, String pluginName) {
List<BehaviorInfoModel> behaviorInfoModels = this.getPluginMessager() List<BehaviorInfoModel> behaviorInfoModels = this.getPluginMessager()
.loadBehaviors(accessToken, pluginName) .loadBehaviors(accessToken, pluginName)
.getBehaviorInfoModels(); .getBehaviorInfoModels();
BehaviorInfoModel behaviorInfoModel = null; BehaviorInfoModel behaviorInfoModel = null;
for (BehaviorInfoModel behaviorInfoModelTemp : behaviorInfoModels) { for (BehaviorInfoModel behaviorInfoModelTemp : behaviorInfoModels) {
if (behaviorInfoModelTemp.getName().equals(behaviorModel.getName())) { if (behaviorInfoModelTemp.getName().equals(behaviorModel.getName())) {
behaviorInfoModel = behaviorInfoModelTemp; behaviorInfoModel = behaviorInfoModelTemp;
} }
} }
behaviorInfoModel.setParamInfoModels(createParameterModelsWithValue( behaviorInfoModel.setParamInfoModels(createParameterModelsWithValue(
behaviorModel.getParameters(), behaviorModel.getParameters(),
behaviorInfoModel.getParamInfoModels())); behaviorInfoModel.getParamInfoModels()));
return behaviorInfoModel; return behaviorInfoModel;
} }
private Map<String, String> getBehaviorUsePluginName( private Map<String, String> getBehaviorUsePluginName(
RunScenarioModel runScenarioModel) { RunScenarioModel runScenarioModel) {
Map<String, String> map = new HashMap<String, String>(); Map<String, String> map = new HashMap<String, String>();
List<UsePluginModel> usePluginModels = runScenarioModel.getUsePlugins(); List<UsePluginModel> usePluginModels = runScenarioModel.getUsePlugins();
for (UsePluginModel usePluginModel : usePluginModels) { for (UsePluginModel usePluginModel : usePluginModels) {
map.put(usePluginModel.getId(), usePluginModel.getName()); map.put(usePluginModel.getId(), usePluginModel.getName());
} }
return map; return map;
} }
private List<ParamInfoModel> createParameterModelsWithValue( private List<ParamInfoModel> createParameterModelsWithValue(
List<ParameterModel> parameters, List<ParameterModel> parameters,
List<ParamInfoModel> paramInfoModels) { List<ParamInfoModel> paramInfoModels) {
if (parameters == null) { if (parameters == null) {
return paramInfoModels; return paramInfoModels;
} }
for (ParameterModel parameterModel : parameters) { for (ParameterModel parameterModel : parameters) {
for (ParamInfoModel paramInfoModel : paramInfoModels) { for (ParamInfoModel paramInfoModel : paramInfoModels) {
if (parameterModel.getKey() == paramInfoModel.getName()) { if (parameterModel.getKey() == paramInfoModel.getName()) {
paramInfoModel.setValue(parameterModel.getValue()); paramInfoModel.setValue(parameterModel.getValue());
} }
} }
} }
return paramInfoModels; return paramInfoModels;
} }
} }

View File

@ -1,201 +1,201 @@
package org.bench4q.web.service; package org.bench4q.web.service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.bench4q.share.models.agent.BehaviorBriefModel; import org.bench4q.share.models.agent.BehaviorBriefModel;
import org.bench4q.share.models.agent.BehaviorStatusCodeResultModel; import org.bench4q.share.models.agent.BehaviorStatusCodeResultModel;
import org.bench4q.share.models.master.MonitorModel; import org.bench4q.share.models.master.MonitorModel;
import org.bench4q.share.models.master.RunningScriptModel; import org.bench4q.share.models.master.RunningScriptModel;
import org.bench4q.share.models.master.ScriptHandleModel; import org.bench4q.share.models.master.ScriptHandleModel;
import org.bench4q.share.models.master.TestPlanModel; import org.bench4q.share.models.master.TestPlanModel;
import org.bench4q.share.models.master.TestPlanResultModel; import org.bench4q.share.models.master.TestPlanResultModel;
import org.bench4q.share.models.master.TestPlanScriptBriefResultModel; import org.bench4q.share.models.master.TestPlanScriptBriefResultModel;
import org.bench4q.share.models.master.TestScriptConfig; import org.bench4q.share.models.master.TestScriptConfig;
import org.bench4q.share.models.master.statistics.ScriptBehaviorsBriefModel; import org.bench4q.share.models.master.statistics.ScriptBehaviorsBriefModel;
import org.bench4q.share.models.master.statistics.ScriptBriefResultModel; import org.bench4q.share.models.master.statistics.ScriptBriefResultModel;
import org.bench4q.web.masterMessager.TestPlanMessager; import org.bench4q.web.masterMessager.TestPlanMessager;
import org.bench4q.web.model.ResultModel; import org.bench4q.web.model.ResultModel;
import org.bench4q.web.model.TestPlanRequestModel; import org.bench4q.web.model.TestPlanRequestModel;
import org.bench4q.web.model.WebScriptModel; import org.bench4q.web.model.WebScriptModel;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@Component @Component
public class TestPlanService { public class TestPlanService {
private TestPlanMessager testPlanMessager; private TestPlanMessager testPlanMessager;
public TestPlanMessager getTestPlanMessager() { public TestPlanMessager getTestPlanMessager() {
return testPlanMessager; return testPlanMessager;
} }
@Autowired @Autowired
public void setTestPlanMessager(TestPlanMessager testPlanMessager) { public void setTestPlanMessager(TestPlanMessager testPlanMessager) {
this.testPlanMessager = testPlanMessager; this.testPlanMessager = testPlanMessager;
} }
public TestPlanModel createTestPlan(TestPlanRequestModel testPlan, int port) { public TestPlanModel createTestPlan(TestPlanRequestModel testPlan, int port) {
TestPlanModel testPlanModel = new TestPlanModel(); TestPlanModel testPlanModel = new TestPlanModel();
testPlanModel.setName(testPlan.getTestPlanName()); testPlanModel.setName(testPlan.getTestPlanName());
if (testPlan.getScriptList() != null if (testPlan.getScriptList() != null
&& testPlan.getScriptList().size() > 0) { && testPlan.getScriptList().size() > 0) {
List<RunningScriptModel> scriptList = createRunningScriptModel(testPlan List<RunningScriptModel> scriptList = createRunningScriptModel(testPlan
.getScriptList()); .getScriptList());
testPlanModel.setRunningScriptModels(scriptList); testPlanModel.setRunningScriptModels(scriptList);
} }
if (testPlan.getIpList() != null && testPlan.getIpList().size() > 0) { if (testPlan.getIpList() != null && testPlan.getIpList().size() > 0) {
List<MonitorModel> ipList = createMonitorModel( List<MonitorModel> ipList = createMonitorModel(
testPlan.getIpList(), port); testPlan.getIpList(), port);
testPlanModel.setMonitorModels(ipList); testPlanModel.setMonitorModels(ipList);
} else } else
testPlanModel.setMonitorModels(new ArrayList<MonitorModel>()); testPlanModel.setMonitorModels(new ArrayList<MonitorModel>());
return testPlanModel; return testPlanModel;
} }
private List<RunningScriptModel> createRunningScriptModel( private List<RunningScriptModel> createRunningScriptModel(
List<WebScriptModel> scriptParam) { List<WebScriptModel> scriptParam) {
List<RunningScriptModel> scriptList = new ArrayList<RunningScriptModel>(); List<RunningScriptModel> scriptList = new ArrayList<RunningScriptModel>();
for (WebScriptModel scriptModel : scriptParam) { for (WebScriptModel scriptModel : scriptParam) {
RunningScriptModel runnningScriptModel = new RunningScriptModel(); RunningScriptModel runnningScriptModel = new RunningScriptModel();
runnningScriptModel.setScriptId(scriptModel.getId()); runnningScriptModel.setScriptId(scriptModel.getId());
runnningScriptModel.setRequireLoad(scriptModel.getLoad()); runnningScriptModel.setRequireLoad(scriptModel.getLoad());
// ScriptFilterOptionsModel scriptFilterOptionsModel = new ScriptFilterOptionsModel(); // ScriptFilterOptionsModel scriptFilterOptionsModel = new ScriptFilterOptionsModel();
// scriptFilterOptionsModel.setStaticResources(scriptModel // scriptFilterOptionsModel.setStaticResources(scriptModel
// .isStaticResources()); // .isStaticResources());
// scriptFilterOptionsModel.setTimer(scriptModel.isTimer()); // scriptFilterOptionsModel.setTimer(scriptModel.isTimer());
TestScriptConfig testScriptConfig = new TestScriptConfig(); TestScriptConfig testScriptConfig = new TestScriptConfig();
testScriptConfig.setCoolDown(scriptModel.getCooldown()); testScriptConfig.setCoolDown(scriptModel.getCooldown());
testScriptConfig.setExecuteRange(scriptModel.getExecuteRange()); testScriptConfig.setExecuteRange(scriptModel.getExecuteRange());
testScriptConfig.setWarmUp(scriptModel.getWarmup()); testScriptConfig.setWarmUp(scriptModel.getWarmup());
runnningScriptModel.setConfig(testScriptConfig); runnningScriptModel.setConfig(testScriptConfig);
// runnningScriptModel // runnningScriptModel
// .setScriptFilterOptionsModel(scriptFilterOptionsModel); // .setScriptFilterOptionsModel(scriptFilterOptionsModel);
scriptList.add(runnningScriptModel); scriptList.add(runnningScriptModel);
} }
return scriptList; return scriptList;
} }
private List<MonitorModel> createMonitorModel(List<String> ipParam, int port) { private List<MonitorModel> createMonitorModel(List<String> ipParam, int port) {
List<MonitorModel> ipList = new ArrayList<MonitorModel>(); List<MonitorModel> ipList = new ArrayList<MonitorModel>();
for (String ip : ipParam) { for (String ip : ipParam) {
MonitorModel monitorModel = new MonitorModel(); MonitorModel monitorModel = new MonitorModel();
monitorModel.setHostName(ip); monitorModel.setHostName(ip);
monitorModel.setPort(port); monitorModel.setPort(port);
ipList.add(monitorModel); ipList.add(monitorModel);
} }
return ipList; return ipList;
} }
public List<ResultModel> extractResultModelList( public List<ResultModel> extractResultModelList(
TestPlanScriptBriefResultModel testPlanScriptBriefResultModel, TestPlanScriptBriefResultModel testPlanScriptBriefResultModel,
String fieldName) { String fieldName) {
if (testPlanScriptBriefResultModel.getScriptBriefResultModels() == null) { if (testPlanScriptBriefResultModel.getScriptBriefResultModels() == null) {
return new LinkedList<ResultModel>(); return new LinkedList<ResultModel>();
} }
List<ResultModel> resultModels = new ArrayList<ResultModel>(); List<ResultModel> resultModels = new ArrayList<ResultModel>();
for (ScriptBriefResultModel scriptBriefResultModel : testPlanScriptBriefResultModel for (ScriptBriefResultModel scriptBriefResultModel : testPlanScriptBriefResultModel
.getScriptBriefResultModels()) { .getScriptBriefResultModels()) {
List<String> fieldNames = new ArrayList<String>(); List<String> fieldNames = new ArrayList<String>();
fieldNames.add(fieldName); fieldNames.add(fieldName);
ResultModel resultModel; ResultModel resultModel;
try { try {
resultModel = ChangeToResultModel.getResultModel( resultModel = ChangeToResultModel.getResultModel(
scriptBriefResultModel, fieldNames); scriptBriefResultModel, fieldNames);
resultModel.setFinished(scriptBriefResultModel.isFinished()); resultModel.setFinished(scriptBriefResultModel.isFinished());
resultModel.setTime(scriptBriefResultModel.getSamplingTime()); resultModel.setTime(scriptBriefResultModel.getSamplingTime());
resultModels.add(resultModel); resultModels.add(resultModel);
} catch (NoSuchFieldException e) { } catch (NoSuchFieldException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
} }
System.out.println("resultLength:" + resultModels.size()); System.out.println("resultLength:" + resultModels.size());
return resultModels; return resultModels;
} }
public List<BehaviorStatusCodeResultModel> getAllBehaviorStatusCodeResultModels( public List<BehaviorStatusCodeResultModel> getAllBehaviorStatusCodeResultModels(
String accessToken, String testPlanId) { String accessToken, String testPlanId) {
TestPlanResultModel testPlanResultModel = this.getTestPlanMessager() TestPlanResultModel testPlanResultModel = this.getTestPlanMessager()
.getRunningTestInfo(accessToken, testPlanId); .getRunningTestInfo(accessToken, testPlanId);
if (testPlanResultModel == null) { if (testPlanResultModel == null) {
Logger.getLogger(this.getClass()).info( Logger.getLogger(this.getClass()).info(
"testPlan is null:" + testPlanId); "testPlan is null:" + testPlanId);
return null; return null;
} }
List<ScriptHandleModel> scriptList = testPlanResultModel.getScripts(); List<ScriptHandleModel> scriptList = testPlanResultModel.getScripts();
if (scriptList == null) { if (scriptList == null) {
return null; return null;
} }
List<BehaviorStatusCodeResultModel> behaviorStatusCodeResultModels = new LinkedList<BehaviorStatusCodeResultModel>(); List<BehaviorStatusCodeResultModel> behaviorStatusCodeResultModels = new LinkedList<BehaviorStatusCodeResultModel>();
for (ScriptHandleModel scriptHandleModel : scriptList) { for (ScriptHandleModel scriptHandleModel : scriptList) {
ScriptBehaviorsBriefModel scriptBehaviorBriefModel = this ScriptBehaviorsBriefModel scriptBehaviorBriefModel = this
.getTestPlanMessager().getScriptBehaviorsBriefResult( .getTestPlanMessager().getScriptBehaviorsBriefResult(
accessToken, testPlanId, accessToken, testPlanId,
scriptHandleModel.getScriptId().toString()); scriptHandleModel.getScriptId().toString());
behaviorStatusCodeResultModels behaviorStatusCodeResultModels
.addAll(extractBehaviorStatusCodeResultModels(scriptBehaviorBriefModel)); .addAll(extractBehaviorStatusCodeResultModels(scriptBehaviorBriefModel));
} }
return behaviorStatusCodeResultModels; return behaviorStatusCodeResultModels;
} }
private List<BehaviorStatusCodeResultModel> extractBehaviorStatusCodeResultModels( private List<BehaviorStatusCodeResultModel> extractBehaviorStatusCodeResultModels(
ScriptBehaviorsBriefModel scriptBehaviorsBriefModel) { ScriptBehaviorsBriefModel scriptBehaviorsBriefModel) {
List<BehaviorStatusCodeResultModel> behaviorStatusCodeResultModels = new ArrayList<BehaviorStatusCodeResultModel>(); List<BehaviorStatusCodeResultModel> behaviorStatusCodeResultModels = new ArrayList<BehaviorStatusCodeResultModel>();
if (scriptBehaviorsBriefModel == null if (scriptBehaviorsBriefModel == null
|| scriptBehaviorsBriefModel.getBehaviorBriefModels() == null) { || scriptBehaviorsBriefModel.getBehaviorBriefModels() == null) {
return behaviorStatusCodeResultModels; return behaviorStatusCodeResultModels;
} }
for (BehaviorBriefModel behaviorBriefModel : scriptBehaviorsBriefModel for (BehaviorBriefModel behaviorBriefModel : scriptBehaviorsBriefModel
.getBehaviorBriefModels()) { .getBehaviorBriefModels()) {
if (behaviorBriefModel.getDetailStatusCodeResultModels() != null) if (behaviorBriefModel.getDetailStatusCodeResultModels() != null)
behaviorStatusCodeResultModels.addAll(behaviorBriefModel behaviorStatusCodeResultModels.addAll(behaviorBriefModel
.getDetailStatusCodeResultModels()); .getDetailStatusCodeResultModels());
} }
return behaviorStatusCodeResultModels; return behaviorStatusCodeResultModels;
} }
public long getTotalCount(Map<String, Long> urlContentTypeCountMap) { public long getTotalCount(Map<String, Long> urlContentTypeCountMap) {
Set<String> keys = urlContentTypeCountMap.keySet(); Set<String> keys = urlContentTypeCountMap.keySet();
Iterator<String> iterator = keys.iterator(); Iterator<String> iterator = keys.iterator();
long totalCount = 0; long totalCount = 0;
while (iterator.hasNext()) { while (iterator.hasNext()) {
totalCount += urlContentTypeCountMap.get(iterator.next()); totalCount += urlContentTypeCountMap.get(iterator.next());
} }
return totalCount; return totalCount;
} }
public Map<String, Double> getUrlContentTypePercent( public Map<String, Double> getUrlContentTypePercent(
Map<String, Long> urlContentTypeCountMap) { Map<String, Long> urlContentTypeCountMap) {
long totalCount = this.getTotalCount(urlContentTypeCountMap); long totalCount = this.getTotalCount(urlContentTypeCountMap);
if (urlContentTypeCountMap == null) if (urlContentTypeCountMap == null)
return null; return null;
if (totalCount == 0) if (totalCount == 0)
return null; return null;
Map<String, Double> urlContentTypePercentMap = new HashMap<String, Double>(); Map<String, Double> urlContentTypePercentMap = new HashMap<String, Double>();
Set<String> keys = urlContentTypeCountMap.keySet(); Set<String> keys = urlContentTypeCountMap.keySet();
Iterator<String> iterator = keys.iterator(); Iterator<String> iterator = keys.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
String key = iterator.next(); String key = iterator.next();
double percent = (double) urlContentTypeCountMap.get(key) double percent = (double) urlContentTypeCountMap.get(key)
/ (double) totalCount * 100; / (double) totalCount * 100;
urlContentTypePercentMap.put(key, new Double(percent)); urlContentTypePercentMap.put(key, new Double(percent));
} }
return urlContentTypePercentMap; return urlContentTypePercentMap;
} }
} }

View File

@ -1,34 +1,34 @@
package org.bench4q.web.validation; package org.bench4q.web.validation;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@Component @Component
public class AgentValidate { public class AgentValidate {
public ValidateResponseModel validateAddedAgent(String hostName, public ValidateResponseModel validateAddedAgent(String hostName,
String maxLoad, String port) { String maxLoad, String port) {
if (!ValidateHelper.validateIp(hostName)) { if (!ValidateHelper.validateIp(hostName)) {
return new ValidateResponseModel(false, "error host name"); return new ValidateResponseModel(false, "error host name");
} }
if (!ValidateHelper.validateInteger(maxLoad)) { if (!ValidateHelper.validateInteger(maxLoad)) {
return new ValidateResponseModel(false, "error maxLoad"); return new ValidateResponseModel(false, "error maxLoad");
} }
if (!ValidateHelper.validateInteger(port)) { if (!ValidateHelper.validateInteger(port)) {
return new ValidateResponseModel(false, "error port"); return new ValidateResponseModel(false, "error port");
} }
return new ValidateResponseModel(true, ""); return new ValidateResponseModel(true, "");
} }
public ValidateResponseModel validateDeleteAgent(String hostName, public ValidateResponseModel validateDeleteAgent(String hostName,
String agentId) { String agentId) {
if (!ValidateHelper.validateIp(hostName)) { if (!ValidateHelper.validateIp(hostName)) {
return new ValidateResponseModel(false, "error host name"); return new ValidateResponseModel(false, "error host name");
} }
if (!ValidateHelper.validateInteger(agentId)) { if (!ValidateHelper.validateInteger(agentId)) {
return new ValidateResponseModel(false, "error agentId"); return new ValidateResponseModel(false, "error agentId");
} }
return new ValidateResponseModel(true, ""); return new ValidateResponseModel(true, "");
} }
} }

View File

@ -1,4 +1,4 @@
package org.bench4q.web.validation; package org.bench4q.web.validation;
public class ScriptValidate { public class ScriptValidate {
} }

View File

@ -1,34 +1,34 @@
package org.bench4q.web.validation; package org.bench4q.web.validation;
import org.bench4q.web.model.TestPlanRequestModel; import org.bench4q.web.model.TestPlanRequestModel;
import org.bench4q.web.model.WebScriptModel; import org.bench4q.web.model.WebScriptModel;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@Component @Component
public class TestPlanValidate { public class TestPlanValidate {
public ValidateResponseModel validateTestPlanSubmited( public ValidateResponseModel validateTestPlanSubmited(
TestPlanRequestModel testPlanRequestModel) { TestPlanRequestModel testPlanRequestModel) {
if (testPlanRequestModel.getScriptList() == null if (testPlanRequestModel.getScriptList() == null
|| testPlanRequestModel.getScriptList().size() == 0) { || testPlanRequestModel.getScriptList().size() == 0) {
return new ValidateResponseModel(false, "empty script in test"); return new ValidateResponseModel(false, "empty script in test");
} }
for (WebScriptModel scriptModel : testPlanRequestModel.getScriptList()) { for (WebScriptModel scriptModel : testPlanRequestModel.getScriptList()) {
if (!isValidateScriptModel(scriptModel)) { if (!isValidateScriptModel(scriptModel)) {
return new ValidateResponseModel(false, "error script config"); return new ValidateResponseModel(false, "error script config");
} }
} }
return new ValidateResponseModel(true, ""); return new ValidateResponseModel(true, "");
} }
private boolean isValidateScriptModel(WebScriptModel scriptModel) { private boolean isValidateScriptModel(WebScriptModel scriptModel) {
if (scriptModel.getId() == 0) if (scriptModel.getId() == 0)
return false; return false;
if (scriptModel.getLoad() == 0) if (scriptModel.getLoad() == 0)
return false; return false;
if (scriptModel.getExecuteRange() == 0) if (scriptModel.getExecuteRange() == 0)
return false; return false;
return true; return true;
} }
} }

View File

@ -1,50 +1,50 @@
package org.bench4q.web.validation; package org.bench4q.web.validation;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
public class ValidateHelper { public class ValidateHelper {
public static boolean validateStringInput(String input) { public static boolean validateStringInput(String input) {
if (input == null || input.length() == 0) { if (input == null || input.length() == 0) {
return false; return false;
} }
return true; return true;
} }
public static boolean validateInteger(String input) { public static boolean validateInteger(String input) {
Pattern pattern = Pattern.compile("[0-9]*"); Pattern pattern = Pattern.compile("[0-9]*");
Matcher isNum = pattern.matcher(input); Matcher isNum = pattern.matcher(input);
return isNum.matches(); return isNum.matches();
} }
public static boolean validateIp(String input) { public static boolean validateIp(String input) {
input.replaceAll(" ", ""); input.replaceAll(" ", "");
String ip = "^(1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|[1-9])\\." String ip = "^(1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|[1-9])\\."
+ "(1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|\\d)\\." + "(1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|\\d)\\."
+ "(1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|\\d)\\." + "(1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|\\d)\\."
+ "(1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|\\d)$"; + "(1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|\\d)$";
Pattern pattern = Pattern.compile(ip); Pattern pattern = Pattern.compile(ip);
Matcher matcher = pattern.matcher(input); Matcher matcher = pattern.matcher(input);
return matcher.matches(); return matcher.matches();
} }
public static void main(String args[]) { public static void main(String args[]) {
String ip = " 133.133.12.1"; String ip = " 133.133.12.1";
System.out.println(validateIp(ip)); System.out.println(validateIp(ip));
String ipError = "122.122.1.r"; String ipError = "122.122.1.r";
System.err.println(validateInteger(ipError)); System.err.println(validateInteger(ipError));
String number = "123"; String number = "123";
System.out.println(validateInteger(number)); System.out.println(validateInteger(number));
System.err.println(validateInteger("u7")); System.err.println(validateInteger("u7"));
} }
} }

View File

@ -1,29 +1,29 @@
package org.bench4q.web.validation; package org.bench4q.web.validation;
public class ValidateResponseModel { public class ValidateResponseModel {
private boolean success; private boolean success;
private String message; private String message;
public ValidateResponseModel(boolean success, String message) { public ValidateResponseModel(boolean success, String message) {
this.success = success; this.success = success;
this.message = message; this.message = message;
} }
public boolean isSuccess() { public boolean isSuccess() {
return success; return success;
} }
public void setSuccess(boolean success) { public void setSuccess(boolean success) {
this.success = success; this.success = success;
} }
public String getMessage() { public String getMessage() {
return message; return message;
} }
public void setMessage(String message) { public void setMessage(String message) {
this.message = message; this.message = message;
} }
} }

View File

@ -1,24 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" <beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<context:component-scan base-package="org.bench4q" /> <context:component-scan base-package="org.bench4q" />
<mvc:annotation-driven /> <mvc:annotation-driven />
<mvc:resources mapping="/images/**" location="/images/" /> <mvc:resources mapping="/images/**" location="/images/" />
<mvc:resources mapping="/style/**" location="/style/" /> <mvc:resources mapping="/style/**" location="/style/" />
<mvc:resources mapping="/script/**" location="/script/" /> <mvc:resources mapping="/script/**" location="/script/" />
<mvc:resources mapping="/css/**" location="/css/" /> <mvc:resources mapping="/css/**" location="/css/" />
<mvc:resources mapping="/static/**" location="/static/" /> <mvc:resources mapping="/static/**" location="/static/" />
<mvc:resources mapping="/img/**" location="/img/" /> <mvc:resources mapping="/img/**" location="/img/" />
<mvc:resources mapping="/i18n/**" location="/i18n/" /> <mvc:resources mapping="/i18n/**" location="/i18n/" />
<mvc:default-servlet-handler /> <mvc:default-servlet-handler />
<!-- ③:对模型视图名称的解析,即在模型视图名称添加前后缀 --> <!-- ③:对模型视图名称的解析,即在模型视图名称添加前后缀 -->
<bean <bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver"> class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="suffix" value=".jsp" /> <property name="suffix" value=".jsp" />
</bean> </bean>
</beans> </beans>

View File

@ -1 +1 @@
masterAddress=127.0.0.1:8901 masterAddress=133.133.2.100:8901

View File

@ -1,24 +1,24 @@
log4j.rootLogger = INFO,WARN,ERROR,D log4j.rootLogger = INFO,WARN,ERROR,D
log4j.appender.WARN = org.apache.log4j.DailyRollingFileAppender log4j.appender.WARN = org.apache.log4j.DailyRollingFileAppender
log4j.appender.WARN.File = logs/warnlog.log log4j.appender.WARN.File = logs/warnlog.log
log4j.appender.WARN.Append = true log4j.appender.WARN.Append = true
log4j.appender.WARN.Threshold = WARN log4j.appender.WARN.Threshold = WARN
log4j.appender.WARN.layout = org.apache.log4j.PatternLayout log4j.appender.WARN.layout = org.apache.log4j.PatternLayout
log4j.appender.WARN.layout.ConversionPattern = %-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n log4j.appender.WARN.layout.ConversionPattern = %-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n
log4j.appender.ERROR = org.apache.log4j.DailyRollingFileAppender log4j.appender.ERROR = org.apache.log4j.DailyRollingFileAppender
log4j.appender.ERROR.File = logs/errorlog.log log4j.appender.ERROR.File = logs/errorlog.log
log4j.appender.ERROR.Append = true log4j.appender.ERROR.Append = true
log4j.appender.ERROR.Threshold = ERROR log4j.appender.ERROR.Threshold = ERROR
log4j.appender.ERROR.layout = org.apache.log4j.PatternLayout log4j.appender.ERROR.layout = org.apache.log4j.PatternLayout
log4j.appender.ERROR.layout.ConversionPattern = %-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n log4j.appender.ERROR.layout.ConversionPattern = %-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n
log4j.appender.D = org.apache.log4j.DailyRollingFileAppender log4j.appender.D = org.apache.log4j.DailyRollingFileAppender
log4j.appender.D.File = logs/info.log log4j.appender.D.File = logs/info.log
log4j.appender.D.Append = true log4j.appender.D.Append = true
log4j.appender.D.Threshold = TRACE log4j.appender.D.Threshold = TRACE
log4j.appender.D.layout = org.apache.log4j.PatternLayout log4j.appender.D.layout = org.apache.log4j.PatternLayout
log4j.appender.D.layout.ConversionPattern = %-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n log4j.appender.D.layout.ConversionPattern = %-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n

View File

@ -1,461 +1,461 @@
<?xml version="1.0" encoding="ISO-8859-1"?> <?xml version="1.0" encoding="ISO-8859-1"?>
<!-- ===================================================================== --> <!-- ===================================================================== -->
<!-- This file contains the default descriptor for web applications. --> <!-- This file contains the default descriptor for web applications. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- --> - -->
<!-- The intent of this descriptor is to include jetty specific or common --> <!-- The intent of this descriptor is to include jetty specific or common -->
<!-- configuration for all webapps. If a context has a webdefault.xml --> <!-- configuration for all webapps. If a context has a webdefault.xml -->
<!-- descriptor, it is applied before the contexts own web.xml file --> <!-- descriptor, it is applied before the contexts own web.xml file -->
<!-- --> <!-- -->
<!-- A context may be assigned a default descriptor by: --> <!-- A context may be assigned a default descriptor by: -->
<!-- + Calling WebApplicationContext.setDefaultsDescriptor --> <!-- + Calling WebApplicationContext.setDefaultsDescriptor -->
<!-- + Passed an arg to addWebApplications --> <!-- + Passed an arg to addWebApplications -->
<!-- --> <!-- -->
<!-- This file is used both as the resource within the jetty.jar (which is --> <!-- This file is used both as the resource within the jetty.jar (which is -->
<!-- used as the default if no explicit defaults descriptor is set) and it --> <!-- used as the default if no explicit defaults descriptor is set) and it -->
<!-- is copied to the etc directory of the Jetty distro and explicitly --> <!-- is copied to the etc directory of the Jetty distro and explicitly -->
<!-- by the jetty.xml file. --> <!-- by the jetty.xml file. -->
<!-- --> <!-- -->
<!-- ===================================================================== --> <!-- ===================================================================== -->
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
metadata-complete="true" version="2.5"> metadata-complete="true" version="2.5">
<description> <description>
Default web.xml file. Default web.xml file.
This file is applied to a Web application before it's own WEB_INF/web.xml file This file is applied to a Web application before it's own WEB_INF/web.xml file
</description> </description>
<!-- ==================================================================== --> <!-- ==================================================================== -->
<!-- Removes static references to beans from javax.el.BeanELResolver to --> <!-- Removes static references to beans from javax.el.BeanELResolver to -->
<!-- ensure webapp classloader can be released on undeploy --> <!-- ensure webapp classloader can be released on undeploy -->
<!-- ==================================================================== --> <!-- ==================================================================== -->
<listener> <listener>
<listener-class>org.eclipse.jetty.servlet.listener.ELContextCleaner</listener-class> <listener-class>org.eclipse.jetty.servlet.listener.ELContextCleaner</listener-class>
</listener> </listener>
<!-- ==================================================================== --> <!-- ==================================================================== -->
<!-- Removes static cache of Methods from java.beans.Introspector to --> <!-- Removes static cache of Methods from java.beans.Introspector to -->
<!-- ensure webapp classloader can be released on undeploy --> <!-- ensure webapp classloader can be released on undeploy -->
<!-- ==================================================================== --> <!-- ==================================================================== -->
<listener> <listener>
<listener-class>org.eclipse.jetty.servlet.listener.IntrospectorCleaner</listener-class> <listener-class>org.eclipse.jetty.servlet.listener.IntrospectorCleaner</listener-class>
</listener> </listener>
<!-- ==================================================================== --> <!-- ==================================================================== -->
<!-- Context params to control Session Cookies --> <!-- Context params to control Session Cookies -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- UNCOMMENT TO ACTIVATE <context-param> <param-name>org.eclipse.jetty.servlet.SessionDomain</param-name> <!-- UNCOMMENT TO ACTIVATE <context-param> <param-name>org.eclipse.jetty.servlet.SessionDomain</param-name>
<param-value>127.0.0.1</param-value> </context-param> <context-param> <param-name>org.eclipse.jetty.servlet.SessionPath</param-name> <param-value>127.0.0.1</param-value> </context-param> <context-param> <param-name>org.eclipse.jetty.servlet.SessionPath</param-name>
<param-value>/</param-value> </context-param> <context-param> <param-name>org.eclipse.jetty.servlet.MaxAge</param-name> <param-value>/</param-value> </context-param> <context-param> <param-name>org.eclipse.jetty.servlet.MaxAge</param-name>
<param-value>-1</param-value> </context-param> --> <param-value>-1</param-value> </context-param> -->
<!-- ==================================================================== --> <!-- ==================================================================== -->
<!-- The default servlet. --> <!-- The default servlet. -->
<!-- This servlet, normally mapped to /, provides the handling for static --> <!-- This servlet, normally mapped to /, provides the handling for static -->
<!-- content, OPTIONS and TRACE methods for the context. --> <!-- content, OPTIONS and TRACE methods for the context. -->
<!-- The following initParameters are supported: --> <!-- The following initParameters are supported: -->
<!-- * acceptRanges If true, range requests and responses are * supported <!-- * acceptRanges If true, range requests and responses are * supported
* * dirAllowed If true, directory listings are returned if no * welcome file * * dirAllowed If true, directory listings are returned if no * welcome file
is found. Else 403 Forbidden. * * welcomeServlets If true, attempt to dispatch is found. Else 403 Forbidden. * * welcomeServlets If true, attempt to dispatch
to welcome files * that are servlets, but only after no matching static * to welcome files * that are servlets, but only after no matching static *
resources could be found. If false, then a welcome * file must exist on disk. resources could be found. If false, then a welcome * file must exist on disk.
If "exact", then exact * servlet matches are supported without an existing If "exact", then exact * servlet matches are supported without an existing
file. * Default is true. * * This must be false if you want directory listings, file. * Default is true. * * This must be false if you want directory listings,
* but have index.jsp in your welcome file list. * * redirectWelcome If true, * but have index.jsp in your welcome file list. * * redirectWelcome If true,
welcome files are redirected rather than * forwarded to. * * gzip If set welcome files are redirected rather than * forwarded to. * * gzip If set
to true, then static content will be served as * gzip content encoded if to true, then static content will be served as * gzip content encoded if
a matching resource is * found ending with ".gz" * * resourceBase Set to a matching resource is * found ending with ".gz" * * resourceBase Set to
replace the context resource base * * resourceCache If set, this is a context replace the context resource base * * resourceCache If set, this is a context
attribute name, which the servlet * will use to look for a shared ResourceCache attribute name, which the servlet * will use to look for a shared ResourceCache
instance. * * relativeResourceBase * Set with a pathname relative to the instance. * * relativeResourceBase * Set with a pathname relative to the
base of the * servlet context root. Useful for only serving static content base of the * servlet context root. Useful for only serving static content
out * of only specific subdirectories. * * pathInfoOnly If true, only the out * of only specific subdirectories. * * pathInfoOnly If true, only the
path info will be applied to the resourceBase * * stylesheet Set with the path info will be applied to the resourceBase * * stylesheet Set with the
location of an optional stylesheet that will be used * to decorate the directory location of an optional stylesheet that will be used * to decorate the directory
listing html. * * aliases If True, aliases of resources are allowed (eg. listing html. * * aliases If True, aliases of resources are allowed (eg.
symbolic * links and caps variations). May bypass security constraints. * symbolic * links and caps variations). May bypass security constraints. *
* etags If True, weak etags will be generated and handled. * * maxCacheSize * etags If True, weak etags will be generated and handled. * * maxCacheSize
The maximum total size of the cache or 0 for no cache. * maxCachedFileSize The maximum total size of the cache or 0 for no cache. * maxCachedFileSize
The maximum size of a file to cache * maxCachedFiles The maximum number of The maximum size of a file to cache * maxCachedFiles The maximum number of
files to cache * * useFileMappedBuffer * If set to true, it will use mapped files to cache * * useFileMappedBuffer * If set to true, it will use mapped
file buffer to serve static content * when using NIO connector. Setting this file buffer to serve static content * when using NIO connector. Setting this
value to false means that * a direct buffer will be used instead of a mapped value to false means that * a direct buffer will be used instead of a mapped
file buffer. * By default, this is set to true. * * cacheControl If set, file buffer. * By default, this is set to true. * * cacheControl If set,
all static content will have this value set as the cache-control * header. all static content will have this value set as the cache-control * header.
* --> * -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<servlet> <servlet>
<servlet-name>default</servlet-name> <servlet-name>default</servlet-name>
<servlet-class>org.eclipse.jetty.servlet.DefaultServlet</servlet-class> <servlet-class>org.eclipse.jetty.servlet.DefaultServlet</servlet-class>
<init-param> <init-param>
<param-name>aliases</param-name> <param-name>aliases</param-name>
<param-value>false</param-value> <param-value>false</param-value>
</init-param> </init-param>
<init-param> <init-param>
<param-name>acceptRanges</param-name> <param-name>acceptRanges</param-name>
<param-value>true</param-value> <param-value>true</param-value>
</init-param> </init-param>
<init-param> <init-param>
<param-name>dirAllowed</param-name> <param-name>dirAllowed</param-name>
<param-value>true</param-value> <param-value>true</param-value>
</init-param> </init-param>
<init-param> <init-param>
<param-name>welcomeServlets</param-name> <param-name>welcomeServlets</param-name>
<param-value>false</param-value> <param-value>false</param-value>
</init-param> </init-param>
<init-param> <init-param>
<param-name>redirectWelcome</param-name> <param-name>redirectWelcome</param-name>
<param-value>false</param-value> <param-value>false</param-value>
</init-param> </init-param>
<init-param> <init-param>
<param-name>maxCacheSize</param-name> <param-name>maxCacheSize</param-name>
<param-value>256000000</param-value> <param-value>256000000</param-value>
</init-param> </init-param>
<init-param> <init-param>
<param-name>maxCachedFileSize</param-name> <param-name>maxCachedFileSize</param-name>
<param-value>200000000</param-value> <param-value>200000000</param-value>
</init-param> </init-param>
<init-param> <init-param>
<param-name>maxCachedFiles</param-name> <param-name>maxCachedFiles</param-name>
<param-value>2048</param-value> <param-value>2048</param-value>
</init-param> </init-param>
<init-param> <init-param>
<param-name>gzip</param-name> <param-name>gzip</param-name>
<param-value>true</param-value> <param-value>true</param-value>
</init-param> </init-param>
<init-param> <init-param>
<param-name>etags</param-name> <param-name>etags</param-name>
<param-value>true</param-value> <param-value>true</param-value>
</init-param> </init-param>
<init-param> <init-param>
<param-name>useFileMappedBuffer</param-name> <param-name>useFileMappedBuffer</param-name>
<param-value>false</param-value> <param-value>false</param-value>
</init-param> </init-param>
<!-- <init-param> <param-name>resourceCache</param-name> <param-value>resourceCache</param-value> <!-- <init-param> <param-name>resourceCache</param-name> <param-value>resourceCache</param-value>
</init-param> --> </init-param> -->
<!-- <init-param> <param-name>cacheControl</param-name> <param-value>max-age=3600,public</param-value> <!-- <init-param> <param-name>cacheControl</param-name> <param-value>max-age=3600,public</param-value>
</init-param> --> </init-param> -->
<load-on-startup>0</load-on-startup> <load-on-startup>0</load-on-startup>
</servlet> </servlet>
<servlet-mapping> <servlet-mapping>
<servlet-name>default</servlet-name> <servlet-name>default</servlet-name>
<url-pattern>/</url-pattern> <url-pattern>/</url-pattern>
</servlet-mapping> </servlet-mapping>
<!-- ==================================================================== --> <!-- ==================================================================== -->
<!-- JSP Servlet --> <!-- JSP Servlet -->
<!-- This is the jasper JSP servlet from the jakarta project --> <!-- This is the jasper JSP servlet from the jakarta project -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- The JSP page compiler and execution servlet, which is the mechanism --> <!-- The JSP page compiler and execution servlet, which is the mechanism -->
<!-- used by Glassfish to support JSP pages. Traditionally, this servlet --> <!-- used by Glassfish to support JSP pages. Traditionally, this servlet -->
<!-- is mapped to URL patterh "*.jsp". This servlet supports the --> <!-- is mapped to URL patterh "*.jsp". This servlet supports the -->
<!-- following initialization parameters (default values are in square --> <!-- following initialization parameters (default values are in square -->
<!-- brackets): --> <!-- brackets): -->
<!-- --> <!-- -->
<!-- checkInterval If development is false and reloading is true, --> <!-- checkInterval If development is false and reloading is true, -->
<!-- background compiles are enabled. checkInterval --> <!-- background compiles are enabled. checkInterval -->
<!-- is the time in seconds between checks to see --> <!-- is the time in seconds between checks to see -->
<!-- if a JSP page needs to be recompiled. [300] --> <!-- if a JSP page needs to be recompiled. [300] -->
<!-- --> <!-- -->
<!-- compiler Which compiler Ant should use to compile JSP --> <!-- compiler Which compiler Ant should use to compile JSP -->
<!-- pages. See the Ant documenation for more --> <!-- pages. See the Ant documenation for more -->
<!-- information. [javac] --> <!-- information. [javac] -->
<!-- --> <!-- -->
<!-- classdebuginfo Should the class file be compiled with --> <!-- classdebuginfo Should the class file be compiled with -->
<!-- debugging information? [true] --> <!-- debugging information? [true] -->
<!-- --> <!-- -->
<!-- classpath What class path should I use while compiling --> <!-- classpath What class path should I use while compiling -->
<!-- generated servlets? [Created dynamically --> <!-- generated servlets? [Created dynamically -->
<!-- based on the current web application] --> <!-- based on the current web application] -->
<!-- Set to ? to make the container explicitly set --> <!-- Set to ? to make the container explicitly set -->
<!-- this parameter. --> <!-- this parameter. -->
<!-- --> <!-- -->
<!-- development Is Jasper used in development mode (will check --> <!-- development Is Jasper used in development mode (will check -->
<!-- for JSP modification on every access)? [true] --> <!-- for JSP modification on every access)? [true] -->
<!-- --> <!-- -->
<!-- enablePooling Determines whether tag handler pooling is --> <!-- enablePooling Determines whether tag handler pooling is -->
<!-- enabled [true] --> <!-- enabled [true] -->
<!-- --> <!-- -->
<!-- fork Tell Ant to fork compiles of JSP pages so that --> <!-- fork Tell Ant to fork compiles of JSP pages so that -->
<!-- a separate JVM is used for JSP page compiles --> <!-- a separate JVM is used for JSP page compiles -->
<!-- from the one Tomcat is running in. [true] --> <!-- from the one Tomcat is running in. [true] -->
<!-- --> <!-- -->
<!-- ieClassId The class-id value to be sent to Internet --> <!-- ieClassId The class-id value to be sent to Internet -->
<!-- Explorer when using <jsp:plugin> tags. --> <!-- Explorer when using <jsp:plugin> tags. -->
<!-- [clsid:8AD9C840-044E-11D1-B3E9-00805F499D93] --> <!-- [clsid:8AD9C840-044E-11D1-B3E9-00805F499D93] -->
<!-- --> <!-- -->
<!-- javaEncoding Java file encoding to use for generating java --> <!-- javaEncoding Java file encoding to use for generating java -->
<!-- source files. [UTF-8] --> <!-- source files. [UTF-8] -->
<!-- --> <!-- -->
<!-- keepgenerated Should we keep the generated Java source code --> <!-- keepgenerated Should we keep the generated Java source code -->
<!-- for each page instead of deleting it? [true] --> <!-- for each page instead of deleting it? [true] -->
<!-- --> <!-- -->
<!-- logVerbosityLevel The level of detailed messages to be produced --> <!-- logVerbosityLevel The level of detailed messages to be produced -->
<!-- by this servlet. Increasing levels cause the --> <!-- by this servlet. Increasing levels cause the -->
<!-- generation of more messages. Valid values are --> <!-- generation of more messages. Valid values are -->
<!-- FATAL, ERROR, WARNING, INFORMATION, and DEBUG. --> <!-- FATAL, ERROR, WARNING, INFORMATION, and DEBUG. -->
<!-- [WARNING] --> <!-- [WARNING] -->
<!-- --> <!-- -->
<!-- mappedfile Should we generate static content with one --> <!-- mappedfile Should we generate static content with one -->
<!-- print statement per input line, to ease --> <!-- print statement per input line, to ease -->
<!-- debugging? [false] --> <!-- debugging? [false] -->
<!-- --> <!-- -->
<!-- --> <!-- -->
<!-- reloading Should Jasper check for modified JSPs? [true] --> <!-- reloading Should Jasper check for modified JSPs? [true] -->
<!-- --> <!-- -->
<!-- suppressSmap Should the generation of SMAP info for JSR45 --> <!-- suppressSmap Should the generation of SMAP info for JSR45 -->
<!-- debugging be suppressed? [false] --> <!-- debugging be suppressed? [false] -->
<!-- --> <!-- -->
<!-- dumpSmap Should the SMAP info for JSR45 debugging be --> <!-- dumpSmap Should the SMAP info for JSR45 debugging be -->
<!-- dumped to a file? [false] --> <!-- dumped to a file? [false] -->
<!-- False if suppressSmap is true --> <!-- False if suppressSmap is true -->
<!-- --> <!-- -->
<!-- scratchdir What scratch directory should we use when --> <!-- scratchdir What scratch directory should we use when -->
<!-- compiling JSP pages? [default work directory --> <!-- compiling JSP pages? [default work directory -->
<!-- for the current web application] --> <!-- for the current web application] -->
<!-- --> <!-- -->
<!-- tagpoolMaxSize The maximum tag handler pool size [5] --> <!-- tagpoolMaxSize The maximum tag handler pool size [5] -->
<!-- --> <!-- -->
<!-- xpoweredBy Determines whether X-Powered-By response --> <!-- xpoweredBy Determines whether X-Powered-By response -->
<!-- header is added by generated servlet [false] --> <!-- header is added by generated servlet [false] -->
<!-- --> <!-- -->
<!-- If you wish to use Jikes to compile JSP pages: --> <!-- If you wish to use Jikes to compile JSP pages: -->
<!-- Set the init parameter "compiler" to "jikes". Define --> <!-- Set the init parameter "compiler" to "jikes". Define -->
<!-- the property "-Dbuild.compiler.emacs=true" when starting Jetty --> <!-- the property "-Dbuild.compiler.emacs=true" when starting Jetty -->
<!-- to cause Jikes to emit error messages in a format compatible with --> <!-- to cause Jikes to emit error messages in a format compatible with -->
<!-- Jasper. --> <!-- Jasper. -->
<!-- If you get an error reporting that jikes can't use UTF-8 encoding, --> <!-- If you get an error reporting that jikes can't use UTF-8 encoding, -->
<!-- try setting the init parameter "javaEncoding" to "ISO-8859-1". --> <!-- try setting the init parameter "javaEncoding" to "ISO-8859-1". -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<servlet id="jsp"> <servlet id="jsp">
<servlet-name>jsp</servlet-name> <servlet-name>jsp</servlet-name>
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class> <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
<init-param> <init-param>
<param-name>logVerbosityLevel</param-name> <param-name>logVerbosityLevel</param-name>
<param-value>DEBUG</param-value> <param-value>DEBUG</param-value>
</init-param> </init-param>
<init-param> <init-param>
<param-name>fork</param-name> <param-name>fork</param-name>
<param-value>false</param-value> <param-value>false</param-value>
</init-param> </init-param>
<init-param> <init-param>
<param-name>xpoweredBy</param-name> <param-name>xpoweredBy</param-name>
<param-value>false</param-value> <param-value>false</param-value>
</init-param> </init-param>
<!-- <init-param> <param-name>classpath</param-name> <param-value>?</param-value> <!-- <init-param> <param-name>classpath</param-name> <param-value>?</param-value>
</init-param> --> </init-param> -->
<load-on-startup>0</load-on-startup> <load-on-startup>0</load-on-startup>
</servlet> </servlet>
<servlet-mapping> <servlet-mapping>
<servlet-name>jsp</servlet-name> <servlet-name>jsp</servlet-name>
<url-pattern>*.jsp</url-pattern> <url-pattern>*.jsp</url-pattern>
<url-pattern>*.jspf</url-pattern> <url-pattern>*.jspf</url-pattern>
<url-pattern>*.jspx</url-pattern> <url-pattern>*.jspx</url-pattern>
<url-pattern>*.xsp</url-pattern> <url-pattern>*.xsp</url-pattern>
<url-pattern>*.JSP</url-pattern> <url-pattern>*.JSP</url-pattern>
<url-pattern>*.JSPF</url-pattern> <url-pattern>*.JSPF</url-pattern>
<url-pattern>*.JSPX</url-pattern> <url-pattern>*.JSPX</url-pattern>
<url-pattern>*.XSP</url-pattern> <url-pattern>*.XSP</url-pattern>
</servlet-mapping> </servlet-mapping>
<!-- ==================================================================== --> <!-- ==================================================================== -->
<session-config> <session-config>
<session-timeout>30</session-timeout> <session-timeout>30</session-timeout>
</session-config> </session-config>
<!-- ==================================================================== --> <!-- ==================================================================== -->
<!-- Default MIME mappings --> <!-- Default MIME mappings -->
<!-- The default MIME mappings are provided by the mime.properties --> <!-- The default MIME mappings are provided by the mime.properties -->
<!-- resource in the org.eclipse.jetty.server.jar file. Additional or modified --> <!-- resource in the org.eclipse.jetty.server.jar file. Additional or modified -->
<!-- mappings may be specified here --> <!-- mappings may be specified here -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- UNCOMMENT TO ACTIVATE <mime-mapping> <extension>mysuffix</extension> <!-- UNCOMMENT TO ACTIVATE <mime-mapping> <extension>mysuffix</extension>
<mime-type>mymime/type</mime-type> </mime-mapping> --> <mime-type>mymime/type</mime-type> </mime-mapping> -->
<!-- ==================================================================== --> <!-- ==================================================================== -->
<welcome-file-list> <welcome-file-list>
<welcome-file>index.html</welcome-file> <welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file> <welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file> <welcome-file>index.jsp</welcome-file>
</welcome-file-list> </welcome-file-list>
<!-- ==================================================================== --> <!-- ==================================================================== -->
<locale-encoding-mapping-list> <locale-encoding-mapping-list>
<locale-encoding-mapping> <locale-encoding-mapping>
<locale>ar</locale> <locale>ar</locale>
<encoding>ISO-8859-6</encoding> <encoding>ISO-8859-6</encoding>
</locale-encoding-mapping> </locale-encoding-mapping>
<locale-encoding-mapping> <locale-encoding-mapping>
<locale>be</locale> <locale>be</locale>
<encoding>ISO-8859-5</encoding> <encoding>ISO-8859-5</encoding>
</locale-encoding-mapping> </locale-encoding-mapping>
<locale-encoding-mapping> <locale-encoding-mapping>
<locale>bg</locale> <locale>bg</locale>
<encoding>ISO-8859-5</encoding> <encoding>ISO-8859-5</encoding>
</locale-encoding-mapping> </locale-encoding-mapping>
<locale-encoding-mapping> <locale-encoding-mapping>
<locale>ca</locale> <locale>ca</locale>
<encoding>ISO-8859-1</encoding> <encoding>ISO-8859-1</encoding>
</locale-encoding-mapping> </locale-encoding-mapping>
<locale-encoding-mapping> <locale-encoding-mapping>
<locale>cs</locale> <locale>cs</locale>
<encoding>ISO-8859-2</encoding> <encoding>ISO-8859-2</encoding>
</locale-encoding-mapping> </locale-encoding-mapping>
<locale-encoding-mapping> <locale-encoding-mapping>
<locale>da</locale> <locale>da</locale>
<encoding>ISO-8859-1</encoding> <encoding>ISO-8859-1</encoding>
</locale-encoding-mapping> </locale-encoding-mapping>
<locale-encoding-mapping> <locale-encoding-mapping>
<locale>de</locale> <locale>de</locale>
<encoding>ISO-8859-1</encoding> <encoding>ISO-8859-1</encoding>
</locale-encoding-mapping> </locale-encoding-mapping>
<locale-encoding-mapping> <locale-encoding-mapping>
<locale>el</locale> <locale>el</locale>
<encoding>ISO-8859-7</encoding> <encoding>ISO-8859-7</encoding>
</locale-encoding-mapping> </locale-encoding-mapping>
<locale-encoding-mapping> <locale-encoding-mapping>
<locale>en</locale> <locale>en</locale>
<encoding>ISO-8859-1</encoding> <encoding>ISO-8859-1</encoding>
</locale-encoding-mapping> </locale-encoding-mapping>
<locale-encoding-mapping> <locale-encoding-mapping>
<locale>es</locale> <locale>es</locale>
<encoding>ISO-8859-1</encoding> <encoding>ISO-8859-1</encoding>
</locale-encoding-mapping> </locale-encoding-mapping>
<locale-encoding-mapping> <locale-encoding-mapping>
<locale>et</locale> <locale>et</locale>
<encoding>ISO-8859-1</encoding> <encoding>ISO-8859-1</encoding>
</locale-encoding-mapping> </locale-encoding-mapping>
<locale-encoding-mapping> <locale-encoding-mapping>
<locale>fi</locale> <locale>fi</locale>
<encoding>ISO-8859-1</encoding> <encoding>ISO-8859-1</encoding>
</locale-encoding-mapping> </locale-encoding-mapping>
<locale-encoding-mapping> <locale-encoding-mapping>
<locale>fr</locale> <locale>fr</locale>
<encoding>ISO-8859-1</encoding> <encoding>ISO-8859-1</encoding>
</locale-encoding-mapping> </locale-encoding-mapping>
<locale-encoding-mapping> <locale-encoding-mapping>
<locale>hr</locale> <locale>hr</locale>
<encoding>ISO-8859-2</encoding> <encoding>ISO-8859-2</encoding>
</locale-encoding-mapping> </locale-encoding-mapping>
<locale-encoding-mapping> <locale-encoding-mapping>
<locale>hu</locale> <locale>hu</locale>
<encoding>ISO-8859-2</encoding> <encoding>ISO-8859-2</encoding>
</locale-encoding-mapping> </locale-encoding-mapping>
<locale-encoding-mapping> <locale-encoding-mapping>
<locale>is</locale> <locale>is</locale>
<encoding>ISO-8859-1</encoding> <encoding>ISO-8859-1</encoding>
</locale-encoding-mapping> </locale-encoding-mapping>
<locale-encoding-mapping> <locale-encoding-mapping>
<locale>it</locale> <locale>it</locale>
<encoding>ISO-8859-1</encoding> <encoding>ISO-8859-1</encoding>
</locale-encoding-mapping> </locale-encoding-mapping>
<locale-encoding-mapping> <locale-encoding-mapping>
<locale>iw</locale> <locale>iw</locale>
<encoding>ISO-8859-8</encoding> <encoding>ISO-8859-8</encoding>
</locale-encoding-mapping> </locale-encoding-mapping>
<locale-encoding-mapping> <locale-encoding-mapping>
<locale>ja</locale> <locale>ja</locale>
<encoding>Shift_JIS</encoding> <encoding>Shift_JIS</encoding>
</locale-encoding-mapping> </locale-encoding-mapping>
<locale-encoding-mapping> <locale-encoding-mapping>
<locale>ko</locale> <locale>ko</locale>
<encoding>EUC-KR</encoding> <encoding>EUC-KR</encoding>
</locale-encoding-mapping> </locale-encoding-mapping>
<locale-encoding-mapping> <locale-encoding-mapping>
<locale>lt</locale> <locale>lt</locale>
<encoding>ISO-8859-2</encoding> <encoding>ISO-8859-2</encoding>
</locale-encoding-mapping> </locale-encoding-mapping>
<locale-encoding-mapping> <locale-encoding-mapping>
<locale>lv</locale> <locale>lv</locale>
<encoding>ISO-8859-2</encoding> <encoding>ISO-8859-2</encoding>
</locale-encoding-mapping> </locale-encoding-mapping>
<locale-encoding-mapping> <locale-encoding-mapping>
<locale>mk</locale> <locale>mk</locale>
<encoding>ISO-8859-5</encoding> <encoding>ISO-8859-5</encoding>
</locale-encoding-mapping> </locale-encoding-mapping>
<locale-encoding-mapping> <locale-encoding-mapping>
<locale>nl</locale> <locale>nl</locale>
<encoding>ISO-8859-1</encoding> <encoding>ISO-8859-1</encoding>
</locale-encoding-mapping> </locale-encoding-mapping>
<locale-encoding-mapping> <locale-encoding-mapping>
<locale>no</locale> <locale>no</locale>
<encoding>ISO-8859-1</encoding> <encoding>ISO-8859-1</encoding>
</locale-encoding-mapping> </locale-encoding-mapping>
<locale-encoding-mapping> <locale-encoding-mapping>
<locale>pl</locale> <locale>pl</locale>
<encoding>ISO-8859-2</encoding> <encoding>ISO-8859-2</encoding>
</locale-encoding-mapping> </locale-encoding-mapping>
<locale-encoding-mapping> <locale-encoding-mapping>
<locale>pt</locale> <locale>pt</locale>
<encoding>ISO-8859-1</encoding> <encoding>ISO-8859-1</encoding>
</locale-encoding-mapping> </locale-encoding-mapping>
<locale-encoding-mapping> <locale-encoding-mapping>
<locale>ro</locale> <locale>ro</locale>
<encoding>ISO-8859-2</encoding> <encoding>ISO-8859-2</encoding>
</locale-encoding-mapping> </locale-encoding-mapping>
<locale-encoding-mapping> <locale-encoding-mapping>
<locale>ru</locale> <locale>ru</locale>
<encoding>ISO-8859-5</encoding> <encoding>ISO-8859-5</encoding>
</locale-encoding-mapping> </locale-encoding-mapping>
<locale-encoding-mapping> <locale-encoding-mapping>
<locale>sh</locale> <locale>sh</locale>
<encoding>ISO-8859-5</encoding> <encoding>ISO-8859-5</encoding>
</locale-encoding-mapping> </locale-encoding-mapping>
<locale-encoding-mapping> <locale-encoding-mapping>
<locale>sk</locale> <locale>sk</locale>
<encoding>ISO-8859-2</encoding> <encoding>ISO-8859-2</encoding>
</locale-encoding-mapping> </locale-encoding-mapping>
<locale-encoding-mapping> <locale-encoding-mapping>
<locale>sl</locale> <locale>sl</locale>
<encoding>ISO-8859-2</encoding> <encoding>ISO-8859-2</encoding>
</locale-encoding-mapping> </locale-encoding-mapping>
<locale-encoding-mapping> <locale-encoding-mapping>
<locale>sq</locale> <locale>sq</locale>
<encoding>ISO-8859-2</encoding> <encoding>ISO-8859-2</encoding>
</locale-encoding-mapping> </locale-encoding-mapping>
<locale-encoding-mapping> <locale-encoding-mapping>
<locale>sr</locale> <locale>sr</locale>
<encoding>ISO-8859-5</encoding> <encoding>ISO-8859-5</encoding>
</locale-encoding-mapping> </locale-encoding-mapping>
<locale-encoding-mapping> <locale-encoding-mapping>
<locale>sv</locale> <locale>sv</locale>
<encoding>ISO-8859-1</encoding> <encoding>ISO-8859-1</encoding>
</locale-encoding-mapping> </locale-encoding-mapping>
<locale-encoding-mapping> <locale-encoding-mapping>
<locale>tr</locale> <locale>tr</locale>
<encoding>ISO-8859-9</encoding> <encoding>ISO-8859-9</encoding>
</locale-encoding-mapping> </locale-encoding-mapping>
<locale-encoding-mapping> <locale-encoding-mapping>
<locale>uk</locale> <locale>uk</locale>
<encoding>ISO-8859-5</encoding> <encoding>ISO-8859-5</encoding>
</locale-encoding-mapping> </locale-encoding-mapping>
<locale-encoding-mapping> <locale-encoding-mapping>
<locale>zh</locale> <locale>zh</locale>
<encoding>GB2312</encoding> <encoding>GB2312</encoding>
</locale-encoding-mapping> </locale-encoding-mapping>
<locale-encoding-mapping> <locale-encoding-mapping>
<locale>zh_TW</locale> <locale>zh_TW</locale>
<encoding>Big5</encoding> <encoding>Big5</encoding>
</locale-encoding-mapping> </locale-encoding-mapping>
</locale-encoding-mapping-list> </locale-encoding-mapping-list>
<security-constraint> <security-constraint>
<web-resource-collection> <web-resource-collection>
<web-resource-name>Disable TRACE</web-resource-name> <web-resource-name>Disable TRACE</web-resource-name>
<url-pattern>/</url-pattern> <url-pattern>/</url-pattern>
<http-method>TRACE</http-method> <http-method>TRACE</http-method>
</web-resource-collection> </web-resource-collection>
<auth-constraint /> <auth-constraint />
</security-constraint> </security-constraint>
</web-app> </web-app>

View File

@ -1,134 +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.">
<link id="bs-css" href="lib/chrisma/css/bootstrap-cerulean.css"
rel="stylesheet">
<link href="lib/chrisma/css/opa-icons.css" rel="stylesheet">
<link
href="http://ajax.aspnetcdn.com/ajax/bootstrap/2.3.2/css/bootstrap-responsive.css"
rel="stylesheet">
<link href="lib/chrisma/css/charisma-app.css" rel="stylesheet">
<link rel="shortcut icon" href="images/bench4q.png">
<link href="css/bench4q.css" rel="stylesheet">
<style type="text/css">
body {
padding-bottom: 40px;
}
.sidebar-nav {
padding: 9px 0;
}
.btn{
margin-right:5px;
}
</style>
</head>
<body>
<fmt:bundle basename="i18n">
<jsp:include page="publiccontrol/navigatebar.jsp"></jsp:include>
<!-- topbar ends -->
<div class="container-fluid">
<div class="row-fluid">
<div id="content" class="span10 center ">
<!-- content starts -->
<div class="sortable row-fluid ui-sortable">
<a data-rel="tooltip" class="well span3 top-block" href="test.jsp"
data-original-title=<fmt:message key="creattestplan" />> <span
class="icon32 icon-red icon-plus"></span><br> <fmt:message
key="creattestplan" />
</a> <a data-rel="tooltip" class="well span3 top-block"
href="device.jsp"
data-original-title=<fmt:message key="home-devManage" />>
<span class="icon32 icon-color icon-edit"></span><br> <fmt:message
key="home-devManage" />
</a> <a data-rel="tooltip" class="well span3 top-block"
href="topologyManage.jsp"
data-original-title=<fmt:message key="home-devTop" />> <span
class="icon32 icon-green icon-envelope-closed"></span> <br>
<fmt:message key="home-devTop" />
</a> <a data-rel="tooltip" class="well span3 top-block"
href="testplans.jsp"
data-original-title=<fmt:message key="testhistory" />> <span
class="icon32 icon-blue icon-star-on"></span><br> <fmt:message
key="testhistory" />
</a>
</div>
<div class="row-fluid sortable">
<div class="box span12"></div>
<!-- content ends -->
</div>
<div class="row-fluid sortable">
<div class="box span12">
<div class="box-header well" data-original-title>
<h2>
<fmt:message key="latestTest" />
</h2>
<div class="box-icon">
<a href="#" class="btn btn-setting btn-round"><i
class="icon-cog"></i></a> <a href="#"
class="btn btn-minimize btn-round"><i
class="icon-chevron-up"></i></a> <a href="#"
class="btn btn-close btn-round"><i class="icon-remove"></i></a>
</div>
</div>
<div class="box-content">
<table class="table table-condensed " id="testPlanTab">
<thead>
<tr>
<th>ID</th>
<th><fmt:message key="name" /></th>
<th><fmt:message key="status" /></th>
<th><fmt:message key="createdatetime" /></th>
<th><fmt:message key="testPlan-view" /></th>
<th><fmt:message key="actions" /></th>
</tr>
</thead>
</table>
</div>
</div>
<!-- content ends -->
</div>
<!--/#content.span10-->
</div>
<!--/fluid-row-->
</div>
<hr>
<jsp:include page="publiccontrol/footer.jsp"></jsp:include>
</div>
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.1.0.js"></script>
<script
src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.10.4/jquery-ui.min.js"></script>
<script
src='http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/jquery.dataTables.js'></script>
<script src="lib/jqueryi18n/jquery.i18n.properties-1.0.9.js"></script>
<script
src="http://ajax.aspnetcdn.com/ajax/bootstrap/2.3.1/bootstrap.min.js"></script>
<script src="lib/chrisma/js/jquery.cookie.js"></script>
<script src="lib/chrisma/js/theme.js"></script>
<script src="script/base.js"></script>
<script src="script/share/TestStatusMap.js"></script>
<script src="script/scriptTable.js"></script>
<script src="script/bench4q.table.js"></script>
<script src="script/home.js"></script>
<script src="script/testPlans.js"></script>
</fmt:bundle>
</body>
</html>

View File

@ -1,159 +1,159 @@
<!DOCTYPE html> <!DOCTYPE html>
<%@ page language="java" contentType="text/html; charset=UTF-8" <%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%> pageEncoding="UTF-8"%>
<html> <html>
<head> <head>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> <%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<title>Bench4Q</title> <title>Bench4Q</title>
<link id="bs-css" href="lib/chrisma/css/bootstrap-cerulean.css" <link id="bs-css" href="lib/chrisma/css/bootstrap-cerulean.css"
rel="stylesheet"> rel="stylesheet">
<link href="lib/chrisma/css/opa-icons.css" rel="stylesheet"> <link href="lib/chrisma/css/opa-icons.css" rel="stylesheet">
<link <link
href="http://ajax.aspnetcdn.com/ajax/bootstrap/2.3.2/css/bootstrap-responsive.css" href="http://ajax.aspnetcdn.com/ajax/bootstrap/2.3.2/css/bootstrap-responsive.css"
rel="stylesheet"> rel="stylesheet">
<link href="lib/chrisma/css/charisma-app.css" rel="stylesheet"> <link href="lib/chrisma/css/charisma-app.css" rel="stylesheet">
<link rel="shortcut icon" href="images/bench4q.png"> <link rel="shortcut icon" href="images/bench4q.png">
<link href="lib/dataTable/css/jquery.dataTables.css" rel="stylesheet"> <link href="lib/dataTable/css/jquery.dataTables.css" rel="stylesheet">
</head> </head>
<style> <style>
body { body {
min-height: 600px; min-height: 600px;
padding-bottom: 40px; padding-bottom: 40px;
} }
.sidebar-nav { .sidebar-nav {
padding: 9px 0; padding: 9px 0;
} }
.btn { .btn {
margin-right: 5px; margin-right: 5px;
} }
</style> </style>
</head> </head>
<body> <body>
<fmt:bundle basename="i18n"> <fmt:bundle basename="i18n">
<jsp:include page="publiccontrol/navigatebar.jsp"></jsp:include> <jsp:include page="publiccontrol/navigatebar.jsp"></jsp:include>
<div class="container-fluid"> <div class="container-fluid">
<div class="row-fluid"> <div class="row-fluid">
<jsp:include page="publiccontrol/adminleftmenubar.jsp"></jsp:include> <jsp:include page="publiccontrol/adminleftmenubar.jsp"></jsp:include>
<div id="content" class="span10"> <div id="content" class="span10">
<div> <div>
<ul class="breadcrumb"> <ul class="breadcrumb">
<li><a href="homepage.jsp"><fmt:message key="home" /></a> <span <li><a href="homepage.jsp"><fmt:message key="home" /></a> <span
class="divider">/</span></li> class="divider">/</span></li>
<li><a href="#"><fmt:message key="agentmanagement" /></a></li> <li><a href="#"><fmt:message key="agentmanagement" /></a></li>
</ul> </ul>
</div> </div>
<div class="row-fluid sortable"> <div class="row-fluid sortable">
<div class="box span12 "> <div class="box span12 ">
<div class="box-header well" data-original-title> <div class="box-header well" data-original-title>
<h2> <h2>
<i><fmt:message key="agents" /></i> <i><fmt:message key="agents" /></i>
</h2> </h2>
<div class="box-icon"> <div class="box-icon">
<a class="btn btn-setting btn-round"><i class="icon-plus"></i></a> <a class="btn btn-setting btn-round"><i class="icon-plus"></i></a>
<a class="btn btn-round" id="agentList"><i <a class="btn btn-round" id="agentList"><i
class="icon-list"></i></a> <a class="btn btn-minimize btn-round"><i class="icon-list"></i></a> <a class="btn btn-minimize btn-round"><i
class="icon-chevron-up"></i></a> <a class="icon-chevron-up"></i></a> <a
class="btn btn-close btn-round"><i class="icon-remove"></i></a> class="btn btn-close btn-round"><i class="icon-remove"></i></a>
</div> </div>
</div> </div>
<div class="box-content"> <div class="box-content">
<table id="agents" <table id="agents"
class="table table-striped table-bordered bootstrap-datatable datatable"> class="table table-striped table-bordered bootstrap-datatable datatable">
<thead> <thead>
<tr> <tr>
<th><fmt:message key="hostname" /></th> <th><fmt:message key="hostname" /></th>
<th><fmt:message key="port" /></th> <th><fmt:message key="port" /></th>
<th><fmt:message key="status" /></th> <th><fmt:message key="status" /></th>
<th><fmt:message key="maxload" /></th> <th><fmt:message key="maxload" /></th>
<th><fmt:message key="remainload" /></th> <th><fmt:message key="remainload" /></th>
<th><fmt:message key="actions" /></th> <th><fmt:message key="actions" /></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<hr> <hr>
<div class="modal hide fade" id="agentParam"> <div class="modal hide fade" id="agentParam">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal">x</button> <button type="button" class="close" data-dismiss="modal">x</button>
<h3> <h3>
<fmt:message key="agentManage_jsp_addAgent" /> <fmt:message key="agentManage_jsp_addAgent" />
</h3> </h3>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<form class="form-horizontal"> <form class="form-horizontal">
<fieldset> <fieldset>
<div class="control-group"> <div class="control-group">
<label class="control-label" for="focusedInput"><fmt:message <label class="control-label" for="focusedInput"><fmt:message
key="hostname" /></label> key="hostname" /></label>
<div class="controls"> <div class="controls">
<input class="input-xlarge focused" id="hostName" type="text" <input class="input-xlarge focused" id="hostName" type="text"
value=""> value="">
<div id='hostName_error' style='display: none; color: red'> <div id='hostName_error' style='display: none; color: red'>
</div> </div>
</div> </div>
</div> </div>
<div class="control-group"> <div class="control-group">
<label class="control-label" for="focusedInput"><fmt:message <label class="control-label" for="focusedInput"><fmt:message
key="port" /></label> key="port" /></label>
<div class="controls"> <div class="controls">
<input class="input-xlarge focused" id="port" type="text" <input class="input-xlarge focused" id="port" type="text"
value=""> value="">
<div id='port_error' style='display: none; color: red'></div> <div id='port_error' style='display: none; color: red'></div>
</div> </div>
</div> </div>
<div class="control-group"> <div class="control-group">
<label class="control-label" for="focusedInput"><fmt:message <label class="control-label" for="focusedInput"><fmt:message
key="maxload" /></label> key="maxload" /></label>
<div class="controls"> <div class="controls">
<input class="input-xlarge focused" id="maxLoad" type="text" <input class="input-xlarge focused" id="maxLoad" type="text"
value=""> value="">
<div id='maxLoad_error' style='display: none; color: red'></div> <div id='maxLoad_error' style='display: none; color: red'></div>
</div> </div>
</div> </div>
</fieldset> </fieldset>
</form> </form>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal" <button type="button" class="btn btn-primary" data-dismiss="modal"
onClick="addAgentToDB()"> onClick="addAgentToDB()">
<fmt:message key="submit" /> <fmt:message key="submit" />
</button> </button>
<button type="button" class="btn btn-primary" data-dismiss="modal"> <button type="button" class="btn btn-primary" data-dismiss="modal">
<fmt:message key="cancel" /> <fmt:message key="cancel" />
</button> </button>
</div> </div>
</div> </div>
<div id="dialog" title="Message"></div> <div id="dialog" title="Message"></div>
<jsp:include page="publiccontrol/footer.jsp"></jsp:include> <jsp:include page="publiccontrol/footer.jsp"></jsp:include>
</div> </div>
<script <script
src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.1.0.min.js"></script> src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.1.0.min.js"></script>
<script <script
src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.10.4/jquery-ui.min.js"></script> src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.10.4/jquery-ui.min.js"></script>
<script src="lib/dataTable/js/jquery.dataTables.js"></script>> <script src="lib/dataTable/js/jquery.dataTables.js"></script>>
<script src="lib/bootstrap/js/bootstrap-modal.js"></script> <script src="lib/bootstrap/js/bootstrap-modal.js"></script>
<script <script
src="http://ajax.aspnetcdn.com/ajax/bootstrap/2.3.1/bootstrap.min.js"></script> src="http://ajax.aspnetcdn.com/ajax/bootstrap/2.3.1/bootstrap.min.js"></script>
<script src="lib/bootstrap/js/bootstrap-modal.js"></script> <script src="lib/bootstrap/js/bootstrap-modal.js"></script>
<script src="lib/chrisma/js/jquery.cookie.js"></script> <script src="lib/chrisma/js/jquery.cookie.js"></script>
<script src="lib/chrisma/js/theme.js"></script> <script src="lib/chrisma/js/theme.js"></script>
<script src="lib/jqueryi18n/jquery.i18n.properties-1.0.9.js"></script> <script src="lib/jqueryi18n/jquery.i18n.properties-1.0.9.js"></script>
<script src="http://malsup.github.com/jquery.form.js"></script> <script src="http://malsup.github.com/jquery.form.js"></script>
<script src="script/base.js"></script> <script src="script/base.js"></script>
<script src="script/bench4q.table.js"></script> <script src="script/bench4q.table.js"></script>
<script src="script/admin/agentManage.js"></script> <script src="script/admin/agentManage.js"></script>
</fmt:bundle> </fmt:bundle>
</body> </body>
</html> </html>

View File

@ -1,275 +1,275 @@
/* =========================================================== /* ===========================================================
* bootstrap-tooltip.js v2.0.4 * bootstrap-tooltip.js v2.0.4
* http://twitter.github.com/bootstrap/javascript.html#tooltips * http://twitter.github.com/bootstrap/javascript.html#tooltips
* Inspired by the original jQuery.tipsy by Jason Frame * Inspired by the original jQuery.tipsy by Jason Frame
* =========================================================== * ===========================================================
* Copyright 2012 Twitter, Inc. * Copyright 2012 Twitter, Inc.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
* ========================================================== */ * ========================================================== */
!function ($) { !function ($) {
"use strict"; // jshint ;_; "use strict"; // jshint ;_;
/* TOOLTIP PUBLIC CLASS DEFINITION /* TOOLTIP PUBLIC CLASS DEFINITION
* =============================== */ * =============================== */
var Tooltip = function (element, options) { var Tooltip = function (element, options) {
this.init('tooltip', element, options) this.init('tooltip', element, options)
} }
Tooltip.prototype = { Tooltip.prototype = {
constructor: Tooltip constructor: Tooltip
, init: function (type, element, options) { , init: function (type, element, options) {
var eventIn var eventIn
, eventOut , eventOut
this.type = type this.type = type
this.$element = $(element) this.$element = $(element)
this.options = this.getOptions(options) this.options = this.getOptions(options)
this.enabled = true this.enabled = true
if (this.options.trigger != 'manual') { if (this.options.trigger != 'manual') {
eventIn = this.options.trigger == 'hover' ? 'mouseenter' : 'focus' eventIn = this.options.trigger == 'hover' ? 'mouseenter' : 'focus'
eventOut = this.options.trigger == 'hover' ? 'mouseleave' : 'blur' eventOut = this.options.trigger == 'hover' ? 'mouseleave' : 'blur'
this.$element.on(eventIn, this.options.selector, $.proxy(this.enter, this)) this.$element.on(eventIn, this.options.selector, $.proxy(this.enter, this))
this.$element.on(eventOut, this.options.selector, $.proxy(this.leave, this)) this.$element.on(eventOut, this.options.selector, $.proxy(this.leave, this))
} }
this.options.selector ? this.options.selector ?
(this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) : (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
this.fixTitle() this.fixTitle()
} }
, getOptions: function (options) { , getOptions: function (options) {
options = $.extend({}, $.fn[this.type].defaults, options, this.$element.data()) options = $.extend({}, $.fn[this.type].defaults, options, this.$element.data())
if (options.delay && typeof options.delay == 'number') { if (options.delay && typeof options.delay == 'number') {
options.delay = { options.delay = {
show: options.delay show: options.delay
, hide: options.delay , hide: options.delay
} }
} }
return options return options
} }
, enter: function (e) { , enter: function (e) {
var self = $(e.currentTarget)[this.type](this._options).data(this.type) var self = $(e.currentTarget)[this.type](this._options).data(this.type)
if (!self.options.delay || !self.options.delay.show) return self.show() if (!self.options.delay || !self.options.delay.show) return self.show()
clearTimeout(this.timeout) clearTimeout(this.timeout)
self.hoverState = 'in' self.hoverState = 'in'
this.timeout = setTimeout(function() { this.timeout = setTimeout(function() {
if (self.hoverState == 'in') self.show() if (self.hoverState == 'in') self.show()
}, self.options.delay.show) }, self.options.delay.show)
} }
, leave: function (e) { , leave: function (e) {
var self = $(e.currentTarget)[this.type](this._options).data(this.type) var self = $(e.currentTarget)[this.type](this._options).data(this.type)
if (this.timeout) clearTimeout(this.timeout) if (this.timeout) clearTimeout(this.timeout)
if (!self.options.delay || !self.options.delay.hide) return self.hide() if (!self.options.delay || !self.options.delay.hide) return self.hide()
self.hoverState = 'out' self.hoverState = 'out'
this.timeout = setTimeout(function() { this.timeout = setTimeout(function() {
if (self.hoverState == 'out') self.hide() if (self.hoverState == 'out') self.hide()
}, self.options.delay.hide) }, self.options.delay.hide)
} }
, show: function () { , show: function () {
var $tip var $tip
, inside , inside
, pos , pos
, actualWidth , actualWidth
, actualHeight , actualHeight
, placement , placement
, tp , tp
if (this.hasContent() && this.enabled) { if (this.hasContent() && this.enabled) {
$tip = this.tip() $tip = this.tip()
this.setContent() this.setContent()
if (this.options.animation) { if (this.options.animation) {
$tip.addClass('fade') $tip.addClass('fade')
} }
placement = typeof this.options.placement == 'function' ? placement = typeof this.options.placement == 'function' ?
this.options.placement.call(this, $tip[0], this.$element[0]) : this.options.placement.call(this, $tip[0], this.$element[0]) :
this.options.placement this.options.placement
inside = /in/.test(placement) inside = /in/.test(placement)
$tip $tip
.remove() .remove()
.css({ top: 0, left: 0, display: 'block' }) .css({ top: 0, left: 0, display: 'block' })
.appendTo(inside ? this.$element : document.body) .appendTo(inside ? this.$element : document.body)
pos = this.getPosition(inside) pos = this.getPosition(inside)
actualWidth = $tip[0].offsetWidth actualWidth = $tip[0].offsetWidth
actualHeight = $tip[0].offsetHeight actualHeight = $tip[0].offsetHeight
switch (inside ? placement.split(' ')[1] : placement) { switch (inside ? placement.split(' ')[1] : placement) {
case 'bottom': case 'bottom':
tp = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2} tp = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2}
break break
case 'top': case 'top':
tp = {top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2} tp = {top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2}
break break
case 'left': case 'left':
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth} tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth}
break break
case 'right': case 'right':
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width} tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width}
break break
} }
$tip $tip
.css(tp) .css(tp)
.addClass(placement) .addClass(placement)
.addClass('in') .addClass('in')
} }
} }
, isHTML: function(text) { , isHTML: function(text) {
// html string detection logic adapted from jQuery // html string detection logic adapted from jQuery
return typeof text != 'string' return typeof text != 'string'
|| ( text.charAt(0) === "<" || ( text.charAt(0) === "<"
&& text.charAt( text.length - 1 ) === ">" && text.charAt( text.length - 1 ) === ">"
&& text.length >= 3 && text.length >= 3
) || /^(?:[^<]*<[\w\W]+>[^>]*$)/.exec(text) ) || /^(?:[^<]*<[\w\W]+>[^>]*$)/.exec(text)
} }
, setContent: function () { , setContent: function () {
var $tip = this.tip() var $tip = this.tip()
, title = this.getTitle() , title = this.getTitle()
$tip.find('.tooltip-inner')[this.isHTML(title) ? 'html' : 'text'](title) $tip.find('.tooltip-inner')[this.isHTML(title) ? 'html' : 'text'](title)
$tip.removeClass('fade in top bottom left right') $tip.removeClass('fade in top bottom left right')
} }
, hide: function () { , hide: function () {
var that = this var that = this
, $tip = this.tip() , $tip = this.tip()
$tip.removeClass('in') $tip.removeClass('in')
function removeWithAnimation() { function removeWithAnimation() {
var timeout = setTimeout(function () { var timeout = setTimeout(function () {
$tip.off($.support.transition.end).remove() $tip.off($.support.transition.end).remove()
}, 500) }, 500)
$tip.one($.support.transition.end, function () { $tip.one($.support.transition.end, function () {
clearTimeout(timeout) clearTimeout(timeout)
$tip.remove() $tip.remove()
}) })
} }
$.support.transition && this.$tip.hasClass('fade') ? $.support.transition && this.$tip.hasClass('fade') ?
removeWithAnimation() : removeWithAnimation() :
$tip.remove() $tip.remove()
} }
, fixTitle: function () { , fixTitle: function () {
var $e = this.$element var $e = this.$element
if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') { if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
$e.attr('data-original-title', $e.attr('title') || '').removeAttr('title') $e.attr('data-original-title', $e.attr('title') || '').removeAttr('title')
} }
} }
, hasContent: function () { , hasContent: function () {
return this.getTitle() return this.getTitle()
} }
, getPosition: function (inside) { , getPosition: function (inside) {
return $.extend({}, (inside ? {top: 0, left: 0} : this.$element.offset()), { return $.extend({}, (inside ? {top: 0, left: 0} : this.$element.offset()), {
width: this.$element[0].offsetWidth width: this.$element[0].offsetWidth
, height: this.$element[0].offsetHeight , height: this.$element[0].offsetHeight
}) })
} }
, getTitle: function () { , getTitle: function () {
var title var title
, $e = this.$element , $e = this.$element
, o = this.options , o = this.options
title = $e.attr('data-original-title') title = $e.attr('data-original-title')
|| (typeof o.title == 'function' ? o.title.call($e[0]) : o.title) || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
return title return title
} }
, tip: function () { , tip: function () {
return this.$tip = this.$tip || $(this.options.template) return this.$tip = this.$tip || $(this.options.template)
} }
, validate: function () { , validate: function () {
if (!this.$element[0].parentNode) { if (!this.$element[0].parentNode) {
this.hide() this.hide()
this.$element = null this.$element = null
this.options = null this.options = null
} }
} }
, enable: function () { , enable: function () {
this.enabled = true this.enabled = true
} }
, disable: function () { , disable: function () {
this.enabled = false this.enabled = false
} }
, toggleEnabled: function () { , toggleEnabled: function () {
this.enabled = !this.enabled this.enabled = !this.enabled
} }
, toggle: function () { , toggle: function () {
this[this.tip().hasClass('in') ? 'hide' : 'show']() this[this.tip().hasClass('in') ? 'hide' : 'show']()
} }
} }
/* TOOLTIP PLUGIN DEFINITION /* TOOLTIP PLUGIN DEFINITION
* ========================= */ * ========================= */
$.fn.tooltip = function ( option ) { $.fn.tooltip = function ( option ) {
return this.each(function () { return this.each(function () {
var $this = $(this) var $this = $(this)
, data = $this.data('tooltip') , data = $this.data('tooltip')
, options = typeof option == 'object' && option , options = typeof option == 'object' && option
if (!data) $this.data('tooltip', (data = new Tooltip(this, options))) if (!data) $this.data('tooltip', (data = new Tooltip(this, options)))
if (typeof option == 'string') data[option]() if (typeof option == 'string') data[option]()
}) })
} }
$.fn.tooltip.Constructor = Tooltip $.fn.tooltip.Constructor = Tooltip
$.fn.tooltip.defaults = { $.fn.tooltip.defaults = {
animation: true animation: true
, placement: 'top' , placement: 'top'
, selector: false , selector: false
, template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>' , template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
, trigger: 'hover' , trigger: 'hover'
, title: '' , title: ''
, delay: 0 , delay: 0
} }
}(window.jQuery); }(window.jQuery);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,213 +1,213 @@
<!DOCTYPE html> <!DOCTYPE html>
<%@ page language="java" contentType="text/html; charset=UTF-8" <%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%> pageEncoding="UTF-8"%>
<html> <html>
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css"> <style type="text/css">
body { body {
padding-bottom: 40px; padding-bottom: 40px;
} }
.sidebar-nav { .sidebar-nav {
padding: 9px 0; padding: 9px 0;
} }
</style> </style>
<title>Bench4Q</title> <title>Bench4Q</title>
<link id="bs-css" href="lib/chrisma/css/bootstrap-cerulean.css" <link id="bs-css" href="lib/chrisma/css/bootstrap-cerulean.css"
rel="stylesheet"> rel="stylesheet">
<link href="lib/chrisma/css/charisma-app.css" rel="stylesheet"> <link href="lib/chrisma/css/charisma-app.css" rel="stylesheet">
<link <link
href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.10/themes/redmond/jquery-ui.css" href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.10/themes/redmond/jquery-ui.css"
rel="stylesheet"> rel="stylesheet">
<link href='css/result.css' rel='stylesheet'> <link href='css/result.css' rel='stylesheet'>
<link rel="shortcut icon" href="images/bench4q.png"> <link rel="shortcut icon" href="images/bench4q.png">
</head> </head>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> <%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<body> <body>
<fmt:bundle basename="i18n"> <fmt:bundle basename="i18n">
<jsp:include page="publiccontrol/navigatebar.jsp"></jsp:include> <jsp:include page="publiccontrol/navigatebar.jsp"></jsp:include>
<div class="container-fluid"> <div class="container-fluid">
<div class="row-fluid"> <div class="row-fluid">
<jsp:include page="publiccontrol/leftmenubar.jsp"></jsp:include> <jsp:include page="publiccontrol/leftmenubar.jsp"></jsp:include>
<div id="content" class="span10 "> <div id="content" class="span10 ">
<!-- content starts --> <!-- content starts -->
<div> <div>
<ul class="breadcrumb"> <ul class="breadcrumb">
<li><a href="homepage.jsp"><fmt:message key="home" /></a> <span <li><a href="homepage.jsp"><fmt:message key="home" /></a> <span
class="divider">/</span></li> class="divider">/</span></li>
<li><a href="test.jsp"><fmt:message key="creatatest" /></a><span <li><a href="test.jsp"><fmt:message key="creatatest" /></a><span
class="divider">/</span></li> class="divider">/</span></li>
<li><a href="#"><fmt:message key="result" /></a></li> <li><a href="#"><fmt:message key="result" /></a></li>
</ul> </ul>
</div> </div>
<div class="row-fluid" id="test"> <div class="row-fluid" id="test">
<div class="span4 span-brief"> <div class="span4 span-brief">
<fmt:message key="result-testStatus" /> <fmt:message key="result-testStatus" />
<br> <br> <br> <br>
<div id="status"></div> <div id="status"></div>
</div> </div>
<div class="span4 span-brief"> <div class="span4 span-brief">
<fmt:message key="result-vuser" /> <fmt:message key="result-vuser" />
<br> <br> <br> <br>
<div> <div>
<span id="vu"></span> <span id="vu"></span>
</div> </div>
</div> </div>
<div class="span4 span-brief-last"> <div class="span4 span-brief-last">
<fmt:message key="result-request" /> <fmt:message key="result-request" />
<br> <br> <br> <br>
<div id="request"></div> <div id="request"></div>
</div> </div>
</div> </div>
<div class="row-fluid"> <div class="row-fluid">
<h4 class="pull-left"><fmt:message key="result-charts" /></h4> <h4 class="pull-left"><fmt:message key="result-charts" /></h4>
<div class="field-inline"> <div class="field-inline">
<button type="button" class="btn btn-primary " id="del-graph"> <button type="button" class="btn btn-primary " id="del-graph">
<fmt:message key="result-deleteGraph" /> <fmt:message key="result-deleteGraph" />
</button> </button>
</div> </div>
<div class="field-inline"> <div class="field-inline">
<button type="button" class="btn btn-primary " id="add-graph"> <button type="button" class="btn btn-primary " id="add-graph">
<fmt:message key="result-addGraph" /> <fmt:message key="result-addGraph" />
</button> </button>
</div> </div>
</div> </div>
<div class="app-container " id="chart"></div> <div class="app-container " id="chart"></div>
<div class="row-fluid"> <div class="row-fluid">
<h4 class="pull-left"><fmt:message key="result-pages" /></h4> <h4 class="pull-left"><fmt:message key="result-pages" /></h4>
</div> </div>
<div class="app-container"> <div class="app-container">
<table id="page" <table id="page"
class="table table-striped table-bordered bootstrap-datatable datatable"> class="table table-striped table-bordered bootstrap-datatable datatable">
<thead> <thead>
<tr> <tr>
<th><fmt:message key="result-pages-page" /></th> <th><fmt:message key="result-pages-page" /></th>
<th><fmt:message key="result-pages-script" /></th> <th><fmt:message key="result-pages-script" /></th>
<th><fmt:message key="result-pages-count" /></th> <th><fmt:message key="result-pages-count" /></th>
<th><fmt:message key="result-pages-testMin" /> </th> <th><fmt:message key="result-pages-testMin" /> </th>
<th><fmt:message key="result-pages-testMax" /></th> <th><fmt:message key="result-pages-testMax" /></th>
<th><fmt:message key="result-pages-average" /></th> <th><fmt:message key="result-pages-average" /></th>
<th><fmt:message key="result-pages-last" /></th> <th><fmt:message key="result-pages-last" /></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
</tbody> </tbody>
</table> </table>
</div> </div>
<div class="row-fluid"> <div class="row-fluid">
<h4 class="pull-left"><fmt:message key="result-urls" /></h4> <h4 class="pull-left"><fmt:message key="result-urls" /></h4>
</div> </div>
<div class="app-container dataTables_wrapper"> <div class="app-container dataTables_wrapper">
<table id="url" <table id="url"
class="table table-striped table-bordered bootstrap-datatable datatable"> class="table table-striped table-bordered bootstrap-datatable datatable">
<thead> <thead>
<tr> <tr>
<th></th> <th></th>
<th><fmt:message key="result-url-url" /></th> <th><fmt:message key="result-url-url" /></th>
<th><fmt:message key="result-url-script" /></th> <th><fmt:message key="result-url-script" /></th>
<th><fmt:message key="result-url-successful" /></th> <th><fmt:message key="result-url-successful" /></th>
<th><fmt:message key="result-url-total" /></th> <th><fmt:message key="result-url-total" /></th>
<th>details</th> <th>details</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
</tbody> </tbody>
</table> </table>
</div> </div>
<!-- <div class="app-container" id="url-distribution"></div> --> <!-- <div class="app-container" id="url-distribution"></div> -->
</div> </div>
</div> </div>
</div> </div>
<div class="modal hide fade" id="add-graph-modal"> <div class="modal hide fade" id="add-graph-modal">
<div class="modal-header"> <div class="modal-header">
<button type="button" id="myModal-close" class="close" <button type="button" id="myModal-close" class="close"
data-dismiss="modal">x</button> data-dismiss="modal">x</button>
<h3> <h3>
<fmt:message key="result-addGraph" /> <fmt:message key="result-addGraph" />
</h3> </h3>
</div> </div>
<div class="modal-body" id="add-graph-list"></div> <div class="modal-body" id="add-graph-list"></div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-primary" id="add-graph-add" <button type="button" class="btn btn-primary" id="add-graph-add"
data-dismiss="modal"> data-dismiss="modal">
<fmt:message key="add" /> <fmt:message key="add" />
</button> </button>
<button type="button" class="btn btn-primary" data-dismiss="modal"> <button type="button" class="btn btn-primary" data-dismiss="modal">
<fmt:message key="cancel" /> <fmt:message key="cancel" />
</button> </button>
</div> </div>
</div> </div>
<div class="modal hide fade" id="del-graph-modal"> <div class="modal hide fade" id="del-graph-modal">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal">x</button> <button type="button" class="close" data-dismiss="modal">x</button>
<h3> <h3>
<fmt:message key="result-deleteGraph" /> <fmt:message key="result-deleteGraph" />
</h3> </h3>
</div> </div>
<div class="modal-body" id="del-graph-list"></div> <div class="modal-body" id="del-graph-list"></div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-primary" id="del-graph-del" <button type="button" class="btn btn-primary" id="del-graph-del"
data-dismiss="modal"> data-dismiss="modal">
<fmt:message key="delete" /> <fmt:message key="delete" />
</button> </button>
<button type="button" class="btn btn-primary" data-dismiss="modal"> <button type="button" class="btn btn-primary" data-dismiss="modal">
<fmt:message key="cancel" /> <fmt:message key="cancel" />
</button> </button>
</div> </div>
</div> </div>
<div class="modal hide fade" id="load"> <div class="modal hide fade" id="load">
<div class="modal-header"> <div class="modal-header">
<h3>Please wait,loading result data...</h3> <h3>Please wait,loading result data...</h3>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<div id="loading"> <div id="loading">
<div></div> <div></div>
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" id="cancelLoading" class="btn btn-primary ">cancel</button> <button type="button" id="cancelLoading" class="btn btn-primary ">cancel</button>
</div> </div>
</div> </div>
<hr> <hr>
<jsp:include page="publiccontrol/footer.jsp"></jsp:include> <jsp:include page="publiccontrol/footer.jsp"></jsp:include>
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script> <script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="lib/jqueryi18n/jquery.i18n.properties-1.0.9.js"></script> <script src="lib/jqueryi18n/jquery.i18n.properties-1.0.9.js"></script>
<script src="lib/bootstrap/js/bootstrap-modal.js"></script> <script src="lib/bootstrap/js/bootstrap-modal.js"></script>
<script <script
src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.10.4/jquery-ui.min.js"></script> src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.10.4/jquery-ui.min.js"></script>
<script <script
src="http://ajax.aspnetcdn.com/ajax/bootstrap/2.3.1/bootstrap.min.js"></script> src="http://ajax.aspnetcdn.com/ajax/bootstrap/2.3.1/bootstrap.min.js"></script>
<script src="lib/chrisma/js/jquery.cookie.js"></script> <script src="lib/chrisma/js/jquery.cookie.js"></script>
<script <script
src='http://cdn.datatables.net/1.10.0/js/jquery.dataTables.min.js'></script> src='http://cdn.datatables.net/1.10.0/js/jquery.dataTables.min.js'></script>
<script src="lib/chrisma/js/theme.js"></script> <script src="lib/chrisma/js/theme.js"></script>
<script src="lib/chrisma/js/jquery.cookie.js"></script> <script src="lib/chrisma/js/jquery.cookie.js"></script>
<script src="script/base.js"></script> <script src="script/base.js"></script>
<script src="http://code.highcharts.com/highcharts.js"></script> <script src="http://code.highcharts.com/highcharts.js"></script>
<script src="script/testResult/charts.js"></script> <script src="script/testResult/charts.js"></script>
<script src="script/Share/TestStatusMap.js"></script> <script src="script/Share/TestStatusMap.js"></script>
<script src="script/testResult/testBriefResult.js"></script> <script src="script/testResult/testBriefResult.js"></script>
<script src="script/bench4q.table.js"></script> <script src="script/bench4q.table.js"></script>
<script src="script/testResult/highChartTheme.js"></script> <script src="script/testResult/highChartTheme.js"></script>
<script src="script/testResult/tree.js"></script> <script src="script/testResult/tree.js"></script>
<script src="lib/HashMap/HashMap.js"></script> <script src="lib/HashMap/HashMap.js"></script>
<script src="script/testResult/graphSelectorTree.js"></script> <script src="script/testResult/graphSelectorTree.js"></script>
<script src="script/testResult/graphSelector.js"></script> <script src="script/testResult/graphSelector.js"></script>
<script src="script/testResult/pieChart.js"></script> <script src="script/testResult/pieChart.js"></script>
<script src="script/testResult/loadProgress.js"></script> <script src="script/testResult/loadProgress.js"></script>
<script src="script/testResult/pageResult.js"></script> <script src="script/testResult/pageResult.js"></script>
<script src="script/testResult/behaviorResult.js"></script> <script src="script/testResult/behaviorResult.js"></script>
<script src="script/testResult/resultNew.js"></script> <script src="script/testResult/resultNew.js"></script>
</fmt:bundle> </fmt:bundle>
</body> </body>
</html> </html>

View File

@ -1,76 +1,76 @@
var ContainerFactory = function() { var ContainerFactory = function() {
}; };
ContainerFactory.prototype.createEditorContainer = function(header, id, ContainerFactory.prototype.createEditorContainer = function(header, id,
containerInfo) { containerInfo) {
var container = document.createElement("div"); var container = document.createElement("div");
$(container).addClass("containerBox"); $(container).addClass("containerBox");
if (id != null) { if (id != null) {
$(container).attr("id", id); $(container).attr("id", id);
} }
var containerHeader = document.createElement("p"); var containerHeader = document.createElement("p");
$(containerHeader).addClass("containerHeader"); $(containerHeader).addClass("containerHeader");
$(containerHeader).append(document.createTextNode(header)); $(containerHeader).append(document.createTextNode(header));
$(container).append(containerHeader); $(container).append(containerHeader);
for ( var i = 0; i < containerInfo.length; i++) { for ( var i = 0; i < containerInfo.length; i++) {
if (containerInfo[i].label == null) { if (containerInfo[i].label == null) {
containerInfo[i].label = ""; containerInfo[i].label = "";
} }
if (containerInfo[i].name == null) { if (containerInfo[i].name == null) {
containerInfo[i].name == ""; containerInfo[i].name == "";
} }
if (containerInfo[i].children == null) { if (containerInfo[i].children == null) {
this.appendEdtiors(container, containerInfo[i].label, this.appendEdtiors(container, containerInfo[i].label,
containerInfo[i].nameCN, containerInfo[i].name, containerInfo[i].nameCN, containerInfo[i].name,
containerInfo[i].paramTypeModel); containerInfo[i].paramTypeModel);
} else { } else {
$(container).append( $(container).append(
this.createEditorContainer(containerInfo[i].nameCN, null, this.createEditorContainer(containerInfo[i].nameCN, null,
containerInfo[i].children)); containerInfo[i].children));
} }
} }
return container; return container;
}; };
ContainerFactory.prototype.appendEdtiors = function(container, label, name, id, ContainerFactory.prototype.appendEdtiors = function(container, label, name, id,
editorInfo, value) { editorInfo, value) {
var editorFactory = new EditorFactory(); var editorFactory = new EditorFactory();
if (editorInfo.type.toLowerCase() == "field") { if (editorInfo.type.toLowerCase() == "field") {
$(container).append( $(container).append(
editorFactory.createField(label, name, editorInfo.size, id,value)); editorFactory.createField(label, name, editorInfo.size, id,value));
} else if (editorInfo.type.toLowerCase() == "nfield") { } else if (editorInfo.type.toLowerCase() == "nfield") {
$(container).append( $(container).append(
editorFactory editorFactory
.createMultiField(label, name, editorInfo.size, id,value)); .createMultiField(label, name, editorInfo.size, id,value));
} else if (editorInfo.type.toLowerCase() == "table") { } else if (editorInfo.type.toLowerCase() == "table") {
$(container).append( $(container).append(
editorFactory.createTable(label, name, editorInfo.cols, id,value)); editorFactory.createTable(label, name, editorInfo.cols, id,value));
} else if (editorInfo.type.toLowerCase() == "file") { } else if (editorInfo.type.toLowerCase() == "file") {
$(container).append( $(container).append(
editorFactory.createFile(lable, name, editorInfo.size, id,value)); editorFactory.createFile(lable, name, editorInfo.size, id,value));
} else if (editorInfo.type.toLowerCase() == "date") { } else if (editorInfo.type.toLowerCase() == "date") {
$(container).append( $(container).append(
editorFactory.createDate(label, name, editorInfo.size, id,value)); editorFactory.createDate(label, name, editorInfo.size, id,value));
} else if (editorInfo.type.toLowerCase() == "select") { } else if (editorInfo.type.toLowerCase() == "select") {
$(container).append( $(container).append(
editorFactory.createSelect(label, name, editorInfo.size, editorFactory.createSelect(label, name, editorInfo.size,
editorInfo.options, id,value)); editorInfo.options, id,value));
} else if (editorInfo.type.toLowerCase() == "checkbox") { } else if (editorInfo.type.toLowerCase() == "checkbox") {
$(container).append( $(container).append(
editorFactory.createCheckBox(label, name, editorFactory.createCheckBox(label, name,
editorInfo.choiceModels, id,value)); editorInfo.choiceModels, id,value));
} else { } else {
alert("no such editor type:" + editorInfo.type); alert("no such editor type:" + editorInfo.type);
} }
}; };

View File

@ -1,161 +1,161 @@
var Parameter = function(key, value) { var Parameter = function(key, value) {
this.key = key; this.key = key;
this.value = value; this.value = value;
} }
var DataCollector = function() { var DataCollector = function() {
}; };
DataCollector.prototype.validate = function(value) { DataCollector.prototype.validate = function(value) {
if (value == null || value == "") { if (value == null || value == "") {
alert($.i18n.prop('dataCollect-input')); alert($.i18n.prop('dataCollect-input'));
return false; return false;
} }
return true; return true;
} }
DataCollector.prototype.checkBoxData = function(editor) { DataCollector.prototype.checkBoxData = function(editor) {
var name = editor.attr("id"); var name = editor.attr("id");
var choice = editor.find("input[type='checkbox']"); var choice = editor.find("input[type='checkbox']");
var value = choice.is(':checked'); var value = choice.is(':checked');
return new Parameter(name, value); return new Parameter(name, value);
} }
DataCollector.prototype.fieldData = function(editor) { DataCollector.prototype.fieldData = function(editor) {
var name = $(editor).attr("id"); var name = $(editor).attr("id");
editor = $(editor.children('.field')); editor = $(editor.children('.field'));
var value = editor.children("input").val(); var value = editor.children("input").val();
// if (!this.validate(value)) { // if (!this.validate(value)) {
// return false; // return false;
// } // }
return new Parameter(name, value); return new Parameter(name, value);
}; };
DataCollector.prototype.dateData = function(editor) { DataCollector.prototype.dateData = function(editor) {
var name = editor.attr("id"); var name = editor.attr("id");
var value = editor.children("input").val(); var value = editor.children("input").val();
// if (!this.validate(value)) { // if (!this.validate(value)) {
// return false; // return false;
// } // }
return new Parameter(name, value); return new Parameter(name, value);
}; };
DataCollector.prototype.multiFieldData = function(editor) { DataCollector.prototype.multiFieldData = function(editor) {
var editorArray = editor.children(".field"); var editorArray = editor.children(".field");
if (editorArray.size == 0) { if (editorArray.size == 0) {
alert($.i18n.prop('dataCollect-input')); alert($.i18n.prop('dataCollect-input'));
return; return;
} }
var name = editor.attr("id") var name = editor.attr("id")
var value = ""; var value = "";
for ( var i = 0; i < editorArray.length; i++) { for ( var i = 0; i < editorArray.length; i++) {
var fieldValue = $(editorArray[i]).children("input").val(); var fieldValue = $(editorArray[i]).children("input").val();
if (fieldValue == "") { if (fieldValue == "") {
continue; continue;
} }
value += fieldValue + ";"; value += fieldValue + ";";
} }
value = value.substring(0, value.length - 1); value = value.substring(0, value.length - 1);
// if (!this.validate(value)) { // if (!this.validate(value)) {
// return false; // return false;
// } // }
return new Parameter(name, value); return new Parameter(name, value);
}; };
DataCollector.prototype.tableData = function(editor) { DataCollector.prototype.tableData = function(editor) {
var thArray = editor.find("thead").children("th"); var thArray = editor.find("thead").children("th");
var editorArray = editor.find("tbody").children("tr"); var editorArray = editor.find("tbody").children("tr");
var name = editor.attr("id"); var name = editor.attr("id");
var value = ""; var value = "";
for ( var i = 0; i < editorArray.length; i++) { for ( var i = 0; i < editorArray.length; i++) {
var tdArray = $(editorArray[i]).children("td"); var tdArray = $(editorArray[i]).children("td");
var trValue = ""; var trValue = "";
for ( var j = 1; j < tdArray.length; j++) { for ( var j = 1; j < tdArray.length; j++) {
if ($(tdArray[j]).children("input").val() == undefined if ($(tdArray[j]).children("input").val() == undefined
|| $(tdArray[j]).children("input").val() == "") { || $(tdArray[j]).children("input").val() == "") {
continue; continue;
} }
trValue += thArray[j] + "=" + $(tdArray[j]).children("input").val() trValue += thArray[j] + "=" + $(tdArray[j]).children("input").val()
+ "|"; + "|";
} }
trValue = trValue.substring(0, trValue.length - 1); trValue = trValue.substring(0, trValue.length - 1);
value += trValue + ";"; value += trValue + ";";
} }
value = value.substring(0, value.length - 1); value = value.substring(0, value.length - 1);
// if (!this.validate(value)) { // if (!this.validate(value)) {
// return false; // return false;
// } // }
return new Parameter(name, value); return new Parameter(name, value);
}; };
DataCollector.prototype.selectData = function(editor) { DataCollector.prototype.selectData = function(editor) {
var name = editor.attr("id"); var name = editor.attr("id");
var value = editor.children("select").val(); var value = editor.children("select").val();
// if (!this.validate(value)) { // if (!this.validate(value)) {
// return false; // return false;
// } // }
return new Parameter(name, value); return new Parameter(name, value);
}; };
DataCollector.prototype.getUnitParams = function(paramEditors) { DataCollector.prototype.getUnitParams = function(paramEditors) {
var params = new Array(); var params = new Array();
for ( var i = 0; i < paramEditors.length; i++) { for ( var i = 0; i < paramEditors.length; i++) {
var editor = $(paramEditors[i]); var editor = $(paramEditors[i]);
var editorType = editor.attr("editorType"); var editorType = editor.attr("editorType");
var data; var data;
if (editorType == "field") { if (editorType == "field") {
data = this.fieldData(editor); data = this.fieldData(editor);
if (!data) { if (!data) {
return; return;
} }
params.push(data); params.push(data);
} else if (editorType == "date") { } else if (editorType == "date") {
data = this.dateData(editor); data = this.dateData(editor);
if (!data) { if (!data) {
return; return;
} }
params.push(data); params.push(data);
} else if (editorType == "multiField") { } else if (editorType == "multiField") {
data = this.multiFieldData(editor) data = this.multiFieldData(editor)
if (!data) { if (!data) {
return; return;
} }
params.push(data); params.push(data);
} else if (editorType == "table") { } else if (editorType == "table") {
data = this.tableData(editor); data = this.tableData(editor);
if (!data) { if (!data) {
return; return;
} }
params.push(data); params.push(data);
} else if (editorType == "select") { } else if (editorType == "select") {
data = this.selectData(editor); data = this.selectData(editor);
if (!data) { if (!data) {
return; return;
} }
params.push(data); params.push(data);
} else if (editorType == "checkBox") { } else if (editorType == "checkBox") {
data = this.checkBoxData(editor); data = this.checkBoxData(editor);
if (!data) { if (!data) {
return; return;
} }
params.push(data); params.push(data);
} else { } else {
alert($.i18n.prop('dataCollect-errorType')); alert($.i18n.prop('dataCollect-errorType'));
} }
} }
return params; return params;
}; };
var UsePluginModel = function(id, name, parameters) { var UsePluginModel = function(id, name, parameters) {
this.id = id; this.id = id;
this.name = name; this.name = name;
this.parameters = parameters; this.parameters = parameters;
} }

View File

@ -1,274 +1,274 @@
var EditorFactory = function() { var EditorFactory = function() {
}; };
EditorFactory.prototype.createBaseEditor = function(label, id) { EditorFactory.prototype.createBaseEditor = function(label, id) {
if (label == null) { if (label == null) {
label = ""; label = "";
} }
var containerBox = document.createElement("div"); var containerBox = document.createElement("div");
$(containerBox).addClass("containerBox"); $(containerBox).addClass("containerBox");
var boxHeader = document.createElement("div"); var boxHeader = document.createElement("div");
var p = document.createElement("p") var p = document.createElement("p")
$(p).html(label) $(p).html(label)
$(boxHeader).append(p); $(boxHeader).append(p);
$(boxHeader).addClass("containerHeader") $(boxHeader).addClass("containerHeader")
$(containerBox).append(boxHeader); $(containerBox).append(boxHeader);
var boxBody = document.createElement("div"); var boxBody = document.createElement("div");
$(boxBody).addClass("editor"); $(boxBody).addClass("editor");
$(boxBody).attr("id", id); $(boxBody).attr("id", id);
$(containerBox).append(boxBody); $(containerBox).append(boxBody);
return containerBox; return containerBox;
} }
EditorFactory.prototype.createCheckBox = function(label, name, choices, id,value) { EditorFactory.prototype.createCheckBox = function(label, name, choices, id,value) {
var div = this.createBaseEditor(label, id); var div = this.createBaseEditor(label, id);
$(div).children(".editor").attr("editorType", "checkBox"); $(div).children(".editor").attr("editorType", "checkBox");
for ( var i = 0; i < choices.length; i++) { for ( var i = 0; i < choices.length; i++) {
var choice = this.createChoice(choices[i].value, var choice = this.createChoice(choices[i].value,
choices[i].defaultValue, name); choices[i].defaultValue, name);
$(div).children(".editor").append(choice); $(div).children(".editor").append(choice);
} }
return div; return div;
} }
EditorFactory.prototype.createChoice = function(value, defaultValue, name,value) { EditorFactory.prototype.createChoice = function(value, defaultValue, name,value) {
var div = document.createElement("div"); var div = document.createElement("div");
var input = document.createElement("input"); var input = document.createElement("input");
$(input).attr("type", "checkbox"); $(input).attr("type", "checkbox");
$(input).attr("name", name); $(input).attr("name", name);
if (defaultValue) { if (defaultValue) {
$(input).attr("checked", "checked"); $(input).attr("checked", "checked");
} }
$(div).append(input); $(div).append(input);
var label = document.createElement("label"); var label = document.createElement("label");
$(label).html(value); $(label).html(value);
$(div).append(label); $(div).append(label);
return div; return div;
} }
EditorFactory.prototype.createField = function(label, name, size, id, value) { EditorFactory.prototype.createField = function(label, name, size, id, value) {
var div = this.createBaseEditor(label, id); var div = this.createBaseEditor(label, id);
$(div).children(".editor").attr("editorType", "field"); $(div).children(".editor").attr("editorType", "field");
$(div).children(".editor").append(this.createFieldLine(size, name, value)); $(div).children(".editor").append(this.createFieldLine(size, name, value));
return div; return div;
} }
EditorFactory.prototype.createMultiField = function(label, name, size, id, EditorFactory.prototype.createMultiField = function(label, name, size, id,
value) { value) {
var div = this.createBaseEditor(label, id); var div = this.createBaseEditor(label, id);
$(div).children(".editor").attr("editorType", "multiField"); $(div).children(".editor").attr("editorType", "multiField");
var values = value.split(";"); var values = value.split(";");
for ( var i = 0; i < values / length; i++) { for ( var i = 0; i < values / length; i++) {
$(div).children(".editor").append( $(div).children(".editor").append(
this.createFieldLine(size, name, values[i])); this.createFieldLine(size, name, values[i]));
} }
var editorFactory = this; var editorFactory = this;
var addFieldButton = document.createElement("button"); var addFieldButton = document.createElement("button");
$(addFieldButton).html("add") $(addFieldButton).html("add")
$(addFieldButton).attr("type", "submit"); $(addFieldButton).attr("type", "submit");
$(addFieldButton).click( $(addFieldButton).click(
{ {
editorFactory : editorFactory editorFactory : editorFactory
}, },
function(event) { function(event) {
event.preventDefault() event.preventDefault()
$(event.data.editorFactory.createFieldLine(size, name)) $(event.data.editorFactory.createFieldLine(size, name))
.insertBefore($(this)); .insertBefore($(this));
}); });
var removeFieldButton = document.createElement("button"); var removeFieldButton = document.createElement("button");
$(removeFieldButton).html("remove") $(removeFieldButton).html("remove")
$(removeFieldButton).attr("type", "submit"); $(removeFieldButton).attr("type", "submit");
$(removeFieldButton).click(function(event) { $(removeFieldButton).click(function(event) {
event.preventDefault(); event.preventDefault();
$(this).parent().children(".field").last().remove(); $(this).parent().children(".field").last().remove();
}); });
$(div).children(".editor").append(addFieldButton).append(removeFieldButton); $(div).children(".editor").append(addFieldButton).append(removeFieldButton);
return div; return div;
} }
EditorFactory.prototype.createFieldLine = function(size, name, value) { EditorFactory.prototype.createFieldLine = function(size, name, value) {
size = 150; size = 150;
var fieldDiv = document.createElement("div"); var fieldDiv = document.createElement("div");
$(fieldDiv).addClass("field"); $(fieldDiv).addClass("field");
var fieldName = document.createElement("label"); var fieldName = document.createElement("label");
$(fieldName).html(name); $(fieldName).html(name);
var field = document.createElement("input"); var field = document.createElement("input");
$(field).attr("type", "text"); $(field).attr("type", "text");
$(field).val(value); $(field).val(value);
$(fieldDiv).append(fieldName.outerHTML + field.outerHTML); $(fieldDiv).append(fieldName.outerHTML + field.outerHTML);
return fieldDiv; return fieldDiv;
} }
EditorFactory.prototype.createFile = function(label, name, size, id,value) { EditorFactory.prototype.createFile = function(label, name, size, id,value) {
if (size == null || size <= 0) { if (size == null || size <= 0) {
size = 150; size = 150;
} }
var div = this.createBaseEditor(label, id); var div = this.createBaseEditor(label, id);
$(div).children(".editor").attr("editorType", "file"); $(div).children(".editor").attr("editorType", "file");
var fileEditor = document.createElement("div"); var fileEditor = document.createElement("div");
var fieldName = document.createElement("label"); var fieldName = document.createElement("label");
$(fieldName).html(name); $(fieldName).html(name);
var file = document.createElement("input"); var file = document.createElement("input");
$(file).attr("type", "file"); $(file).attr("type", "file");
$(fileEditor).append(fieldName.outerHTML + file.outerHTML); $(fileEditor).append(fieldName.outerHTML + file.outerHTML);
$(div).children(".editor").append(fileEditor); $(div).children(".editor").append(fileEditor);
return div; return div;
} }
EditorFactory.prototype.createTable = function(label, name, cols, id, value) { EditorFactory.prototype.createTable = function(label, name, cols, id, value) {
var values = value.split(";"); var values = value.split(";");
var div = this.createBaseEditor(label, id); var div = this.createBaseEditor(label, id);
$(div).children(".editor").attr("editorType", "table"); $(div).children(".editor").attr("editorType", "table");
var headers = getHeaders(cols); var headers = getHeaders(cols);
$(div).children(".editor").append( $(div).children(".editor").append(
createTable(cols, name, headers, values)); createTable(cols, name, headers, values));
var addButton = document.createElement("button"); var addButton = document.createElement("button");
$(addButton).html("add"); $(addButton).html("add");
$(addButton).click( $(addButton).click(
{ {
headers : headers, headers : headers,
fieldName : name fieldName : name
}, },
function(event) { function(event) {
event.preventDefault(); event.preventDefault();
$(this).parent().children("table").children("tbody").append( $(this).parent().children("table").children("tbody").append(
createTr(event.data.headers, event.data.fieldName)); createTr(event.data.headers, event.data.fieldName));
}); });
var deleteButton = document.createElement("button"); var deleteButton = document.createElement("button");
$(deleteButton).html("remove"); $(deleteButton).html("remove");
$(deleteButton).click( $(deleteButton).click(
function(event) { function(event) {
event.preventDefault(); event.preventDefault();
$(this).parent().children("table").children("tbody").children( $(this).parent().children("table").children("tbody").children(
"tr").last().remove(); "tr").last().remove();
}); });
$(div).children(".editor").append(addButton); $(div).children(".editor").append(addButton);
$(div).children(".editor").append(deleteButton); $(div).children(".editor").append(deleteButton);
return div; return div;
function getHeaders(col) { function getHeaders(col) {
var headers = new Array(); var headers = new Array();
headers.push("name:"); headers.push("name:");
var cols = col.split(";"); var cols = col.split(";");
for ( var i = 0; i < cols.length; i++) { for ( var i = 0; i < cols.length; i++) {
headers.push(cols[i]); headers.push(cols[i]);
} }
return headers; return headers;
} }
function createTable(cols, name, headers, values) { function createTable(cols, name, headers, values) {
var values = value.split(";"); var values = value.split(";");
var table = document.createElement("table"); var table = document.createElement("table");
var thead = document.createElement("thead"); var thead = document.createElement("thead");
var tbody = document.createElement("tbody"); var tbody = document.createElement("tbody");
$(thead).append(createHeader(headers)); $(thead).append(createHeader(headers));
for(var i=0;i<values.length;i++){ for(var i=0;i<values.length;i++){
$(tbody).append(createTr(headers, name,values[i])); $(tbody).append(createTr(headers, name,values[i]));
} }
$(table).append(thead); $(table).append(thead);
$(table).append(tbody); $(table).append(tbody);
return table; return table;
} }
function createHeader(headers) { function createHeader(headers) {
var tr = document.createElement("tr"); var tr = document.createElement("tr");
for ( var i = 0; i < headers.length; i++) { for ( var i = 0; i < headers.length; i++) {
var th = document.createElement("th"); var th = document.createElement("th");
$(th).append(document.createTextNode(headers[i])); $(th).append(document.createTextNode(headers[i]));
$(th).attr("style", "width:" + 100 / headers.length + "%") $(th).attr("style", "width:" + 100 / headers.length + "%")
$(tr).append(th); $(tr).append(th);
} }
return tr; return tr;
} }
function createTr(headers, name,value) { function createTr(headers, name,value) {
var values=value.split("|"); var values=value.split("|");
var tr = document.createElement("tr"); var tr = document.createElement("tr");
var td = document.createElement("td"); var td = document.createElement("td");
$(td).attr("style", "width:" + 100 / headers.length + "%") $(td).attr("style", "width:" + 100 / headers.length + "%")
$(td).html(name); $(td).html(name);
$(tr).append(td); $(tr).append(td);
for ( var i = 1; i < headers.length; i++) { for ( var i = 1; i < headers.length; i++) {
var input = document.createElement("input"); var input = document.createElement("input");
$(input).attr("type", "text"); $(input).attr("type", "text");
$(input).val(values[i]); $(input).val(values[i]);
var td = document.createElement("td"); var td = document.createElement("td");
$(td).attr("style", "width:" + 100 / headers.length + "%") $(td).attr("style", "width:" + 100 / headers.length + "%")
$(td).append(input); $(td).append(input);
$(tr).append(td); $(tr).append(td);
} }
return tr; return tr;
} }
} }
EditorFactory.prototype.createSelect = function(label, name, size, options, id,value) { EditorFactory.prototype.createSelect = function(label, name, size, options, id,value) {
if (size == null || size <= 0) { if (size == null || size <= 0) {
size = 150; size = 150;
} }
if (options == null || options.length <= 0) { if (options == null || options.length <= 0) {
alert("no options in:" + name); alert("no options in:" + name);
} }
var div = this.createBaseEditor(label, id); var div = this.createBaseEditor(label, id);
$(div).children(".editor").attr("editorType", "select"); $(div).children(".editor").attr("editorType", "select");
var nameLabel = document.createElement("label"); var nameLabel = document.createElement("label");
$(nameLabel).html(name); $(nameLabel).html(name);
$(div).children(".editor").append(nameLabel); $(div).children(".editor").append(nameLabel);
var select = document.createElement("select"); var select = document.createElement("select");
$(select).attr("style", "width:" + size + "px"); $(select).attr("style", "width:" + size + "px");
for ( var i = 0; i < options.length; i++) { for ( var i = 0; i < options.length; i++) {
var option = document.createElement("option"); var option = document.createElement("option");
$(option).attr("value", options[i]); $(option).attr("value", options[i]);
$(option).html(options[i]); $(option).html(options[i]);
$(select).append(option); $(select).append(option);
} }
$(div).children(".editor").append(select); $(div).children(".editor").append(select);
return div; return div;
} }
EditorFactory.prototype.createDate = function(label, name, size, id,value) { EditorFactory.prototype.createDate = function(label, name, size, id,value) {
if (size == null || size < 0) { if (size == null || size < 0) {
size = 150 size = 150
} }
var div = this.createBaseEditor(label, id); var div = this.createBaseEditor(label, id);
$(div).children(".editor").attr("editorType", "date"); $(div).children(".editor").attr("editorType", "date");
var dateLabel = document.createElement("label"); var dateLabel = document.createElement("label");
$(dateLabel).html(name); $(dateLabel).html(name);
var date = document.createElement("input"); var date = document.createElement("input");
$(date).attr("type", "date"); $(date).attr("type", "date");
$(div).children(".editor").append(dateLabel); $(div).children(".editor").append(dateLabel);
$(div).children(".editor").append(date); $(div).children(".editor").append(date);
return div; return div;
} }
function createContainer(id, name) { function createContainer(id, name) {
var edtiorFactory = new EditorFactory(); var edtiorFactory = new EditorFactory();
var div = document.createElement("div"); var div = document.createElement("div");
$(div).attr("id", id); $(div).attr("id", id);
$(div).append(edtiorFactory.createMultiField("test", "name", 150, "test")); $(div).append(edtiorFactory.createMultiField("test", "name", 150, "test"));
$(div).append(edtiorFactory.createFile("file", "file name", 150, "file")); $(div).append(edtiorFactory.createFile("file", "file name", 150, "file"));
$(div).append( $(div).append(
edtiorFactory.createField("field", "field name", 150, "field")); edtiorFactory.createField("field", "field name", 150, "field"));
$(div).append( $(div).append(
edtiorFactory.createTable("table", "input", "td1;td1;td3", "id")); edtiorFactory.createTable("table", "input", "td1;td1;td3", "id"));
$(div).append( $(div).append(
edtiorFactory.createSelect("select", "select", 150, [ 1, 2, 3 ], edtiorFactory.createSelect("select", "select", 150, [ 1, 2, 3 ],
"oo")); "oo"));
$(div).append(edtiorFactory.createDate("date", "date", 150, "dateid")); $(div).append(edtiorFactory.createDate("date", "date", 150, "dateid"));
return div; return div;
} }

View File

@ -1,5 +1,5 @@
$(document).ready(function() { $(document).ready(function() {
var table = $("#table").DataTable(); var table = $("#table").DataTable();
addEvent(table); addEvent(table);
loadTestPlans(table); loadTestPlans(table);
}); });

View File

@ -1,158 +1,158 @@
var intervalTime = 5000; var intervalTime = 5000;
var Chart = function() { var Chart = function() {
}; };
Chart.prototype.createChart = function(container) { Chart.prototype.createChart = function(container) {
container.highcharts({ container.highcharts({
chart : { chart : {
type : 'spline' type : 'spline'
}, },
tooltip : { tooltip : {
formatter : function() { formatter : function() {
return Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x) return Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x)
+ '<br/>' + '<b>' + this.series.name + ':' + '<br/>' + '<b>' + this.series.name + ':'
+ '</b><br/>' + Highcharts.numberFormat(this.y, 2); + '</b><br/>' + Highcharts.numberFormat(this.y, 2);
} }
}, },
}); });
var chart = container.highcharts(); var chart = container.highcharts();
chart.setTitle({ chart.setTitle({
text : "" text : ""
}); });
chart.xAxis[0].update({ chart.xAxis[0].update({
type : 'datetime', type : 'datetime',
tickInterval : 1000 * 60, tickInterval : 1000 * 60,
tickWidth : 0, tickWidth : 0,
gridLineWidth : 1, gridLineWidth : 1,
tickPixelInterval : 50 tickPixelInterval : 50
}); });
this.highChart = chart; this.highChart = chart;
this.modelArray = new Array(); this.modelArray = new Array();
}; };
Chart.prototype.addAxis = function(axis, seriesId,name, data) { Chart.prototype.addAxis = function(axis, seriesId,name, data) {
this.highChart.addAxis({ // Secondary yAxis this.highChart.addAxis({ // Secondary yAxis
id : axis, id : axis,
title : { title : {
text : name, text : name,
}, },
lineWidth : 2, lineWidth : 2,
opposite : true opposite : true
}); });
this.addSeries(axis, seriesId, data,name); this.addSeries(axis, seriesId, data,name);
}; };
Chart.prototype.addSeries = function(axis, seriesId, data,name) { Chart.prototype.addSeries = function(axis, seriesId, data,name) {
this.highChart.addSeries({ this.highChart.addSeries({
id : seriesId, id : seriesId,
name : name, name : name,
yAxis : axis, yAxis : axis,
data : data, data : data,
marker : { marker : {
enabled : true, enabled : true,
radius : 3 radius : 3
}, },
showInLegend : true showInLegend : true
}, true); }, true);
}; };
Chart.prototype.removeAxis = function(axisId) { Chart.prototype.removeAxis = function(axisId) {
this.highChart.get(axisId).remove(); this.highChart.get(axisId).remove();
}; };
Chart.prototype.addPoint = function(seriesId, point) { Chart.prototype.addPoint = function(seriesId, point) {
if (point.y == "NaN") if (point.y == "NaN")
point.y = 0; point.y = 0;
this.highChart.get(seriesId).addPoint([ point.x, point.y ]); this.highChart.get(seriesId).addPoint([ point.x, point.y ]);
}; };
Chart.prototype.addPoints = function(seriesId, data) { Chart.prototype.addPoints = function(seriesId, data) {
var chart = this; var chart = this;
for ( var i = 0; i < data.length; i++) { for ( var i = 0; i < data.length; i++) {
chart.addPoint(seriesId, data[i]); chart.addPoint(seriesId, data[i]);
} }
}; };
var Point = function(x, y) { var Point = function(x, y) {
this.x = x; this.x = x;
this.y = y; this.y = y;
}; };
var PointData=function(data,time){ var PointData=function(data,time){
this.data=data; this.data=data;
this.time=time; this.time=time;
} }
Chart.prototype.getGraphDataFirstly=function(model){ Chart.prototype.getGraphDataFirstly=function(model){
var chart=this; var chart=this;
chart.addAxis(model.axis, model.series, model.name,[]); chart.addAxis(model.axis, model.series, model.name,[]);
$.post(model.url + "/" + model.time, {}, function(data) { $.post(model.url + "/" + model.time, {}, function(data) {
loadItems.scriptBriefStatusAve = true; loadItems.scriptBriefStatusAve = true;
if (data==null||!data.success) { if (data==null||!data.success) {
return; return;
} }
data = data.result; data = data.result;
if (data instanceof Array) { if (data instanceof Array) {
for ( var i = 0; i < data.length; i++) { for ( var i = 0; i < data.length; i++) {
chart.addDataToGraph(chart, model, data[i]); chart.addDataToGraph(chart, model, data[i]);
} }
} else{ } else{
chart.addDataToGraph(chart, model, data); chart.addDataToGraph(chart, model, data);
} }
}, "json"); }, "json");
} }
Chart.prototype.addGraph = function(model) { Chart.prototype.addGraph = function(model) {
var chart = this; var chart = this;
this.getGraphDataFirstly(model,chart); this.getGraphDataFirstly(model,chart);
var intervalId = setInterval(function() { var intervalId = setInterval(function() {
$.post(model.url + "/" + model.time, {}, function(data) { $.post(model.url + "/" + model.time, {}, function(data) {
loadItems.scriptBriefStatusAve = true;// this need to change loadItems.scriptBriefStatusAve = true;// this need to change
if (data==null||!data.success) { if (data==null||!data.success) {
clearInterval(intervalId); clearInterval(intervalId);
return; return;
} }
data = data.result; data = data.result;
loadItems.scriptBriefStatusAve=true; loadItems.scriptBriefStatusAve=true;
if (data instanceof Array) { if (data instanceof Array) {
var points = new Array(); var points = new Array();
for ( var i = 0; i < data.length; i++) { for ( var i = 0; i < data.length; i++) {
chart.addDataToGraph(chart, model, data[i]); chart.addDataToGraph(chart, model, data[i]);
} }
} else{ } else{
chart.addDataToGraph(chart, model, data); chart.addDataToGraph(chart, model, data);
} }
}, "json"); }, "json");
if($("#status").attr("status")=="Complete"){ if($("#status").attr("status")=="Complete"){
clearInterval(intervalId); clearInterval(intervalId);
} }
}, intervalTime); }, intervalTime);
model.setIntervalId(intervalId); model.setIntervalId(intervalId);
this.modelArray.push(model); this.modelArray.push(model);
}; };
Chart.prototype.addDataToGraph = function(chart, model, data) { Chart.prototype.addDataToGraph = function(chart, model, data) {
var point = new Point(data.time, data.data); var point = new Point(data.time, data.data);
if (data.time > model.time){ if (data.time > model.time){
model.time = data.time; model.time = data.time;
} }
model.time++; model.time++;
chart.addPoint(model.series, point); chart.addPoint(model.series, point);
}; };
Chart.prototype.deleteGraph = function(model) { Chart.prototype.deleteGraph = function(model) {
for ( var i = 0; i < this.modelArray.length; i++) { for ( var i = 0; i < this.modelArray.length; i++) {
if (model.series == this.modelArray[i].series) { if (model.series == this.modelArray[i].series) {
clearInterval(this.modelArray[i].intervalId); clearInterval(this.modelArray[i].intervalId);
break; break;
} }
} }
this.removeAxis(model.axis); this.removeAxis(model.axis);
}; };
Chart.prototype.addModel = function(model) { Chart.prototype.addModel = function(model) {
this.modelArray.push(model); this.modelArray.push(model);
}; };

View File

@ -1,131 +1,131 @@
//function getResultInfoTree(testPlanId) { //function getResultInfoTree(testPlanId) {
// //
// var tree = new Tree(); // var tree = new Tree();
// tree.createRoot("Test Result","testPlan" ,testPlanId); // tree.createRoot("Test Result","testPlan" ,testPlanId);
// createScriptResultInfoTree(testPlanId, tree); // createScriptResultInfoTree(testPlanId, tree);
// var sutResultInfo = new SutResult(testPlanId); // var sutResultInfo = new SutResult(testPlanId);
// if (sutResultInfo.root != null) // if (sutResultInfo.root != null)
// tree.root.insertSingleNode(sutResultInfo.root); // tree.root.insertSingleNode(sutResultInfo.root);
// return tree; // return tree;
//} //}
function getResultTree(testPlanId) { function getResultTree(testPlanId) {
var tree = new Tree(); var tree = new Tree();
tree.createRoot("Test Result", "testPlan",testPlanId); tree.createRoot("Test Result", "testPlan",testPlanId);
$.ajax({ $.ajax({
type : "POST", type : "POST",
url : testPlanId + "/testResultHanadle", url : testPlanId + "/testResultHanadle",
dataType : "json", dataType : "json",
async : false, async : false,
success : function(data) { success : function(data) {
if (!data.success) { if (!data.success) {
tree=null; tree=null;
} else { } else {
data = data.resultHandle; data = data.resultHandle;
for ( var i = 0; i < data.length; i++) { for ( var i = 0; i < data.length; i++) {
tree.root.insertSingleNode(data[i]); tree.root.insertSingleNode(data[i]);
} }
} }
} }
}); });
return tree; return tree;
} }
//function createScriptResultInfoTree(testPlanId, tree) { //function createScriptResultInfoTree(testPlanId, tree) {
// var scriptResultTree = new Tree(); // var scriptResultTree = new Tree();
// scriptResultTree.createRoot("Script", "script"); // scriptResultTree.createRoot("Script", "script");
// //
// $.ajax({ // $.ajax({
// type : "POST", // type : "POST",
// url : testPlanId + "/runningScriptInfo", // url : testPlanId + "/runningScriptInfo",
// dataType : "json", // dataType : "json",
// async : false, // async : false,
// success : function(data) { // success : function(data) {
// if (!data.success) { // if (!data.success) {
// return; // return;
// } else // } else
// data = data.scriptInfo; // data = data.scriptInfo;
// createScriptTree(data, scriptResultTree); // createScriptTree(data, scriptResultTree);
// tree.root.insertSingleNode(scriptResultTree.root); // tree.root.insertSingleNode(scriptResultTree.root);
// } // }
// }); // });
//} //}
//function createScriptTree(scriptResultInfoList, tree) { //function createScriptTree(scriptResultInfoList, tree) {
// //
// if (scriptResultInfoList == null) // if (scriptResultInfoList == null)
// return; // return;
// for ( var i = 0; i < scriptResultInfoList.length; i++) { // for ( var i = 0; i < scriptResultInfoList.length; i++) {
// //
// var node = new TreeNode("Script Result", // var node = new TreeNode("Script Result",
// scriptResultInfoList[i].scriptName, null); // scriptResultInfoList[i].scriptName, null);
// tree.root.insertSingleNode(node); // tree.root.insertSingleNode(node);
// var nodeArray = insertResultList(scriptResultInfoList[i].childResults); // var nodeArray = insertResultList(scriptResultInfoList[i].childResults);
// for ( var j = 0; j < nodeArray.length; j++) { // for ( var j = 0; j < nodeArray.length; j++) {
// node.insertSingleNode(nodeArray[j]); // node.insertSingleNode(nodeArray[j]);
// } // }
// //
// } // }
// //
//}; //};
// //
//var SutResult = function(testPlanId) { //var SutResult = function(testPlanId) {
// var sutResultInfo = this; // var sutResultInfo = this;
// var scriptResultTree = new Tree(); // var scriptResultTree = new Tree();
// //
// $.ajax({ // $.ajax({
// type : "POST", // type : "POST",
// url : testPlanId + "/sutInfo", // url : testPlanId + "/sutInfo",
// dataType : "json", // dataType : "json",
// async : false, // async : false,
// success : function(data) { // success : function(data) {
// if (!data.success) { // if (!data.success) {
// sutResultInfo.root = null; // sutResultInfo.root = null;
// return; // return;
// } else // } else
// data = data.sutInfo; // data = data.sutInfo;
// scriptResultTree.createRoot("SUT", "SUT"); // scriptResultTree.createRoot("SUT", "SUT");
// sutResultInfo.root = scriptResultTree.root; // sutResultInfo.root = scriptResultTree.root;
// sutResultInfo.data = data; // sutResultInfo.data = data;
// sutResultInfo.createTree(data); // sutResultInfo.createTree(data);
// } // }
// }); // });
// //
//}; //};
//SutResult.prototype.createTree = function(sutResultInfoList) { //SutResult.prototype.createTree = function(sutResultInfoList) {
// for ( var i = 0; i < sutResultInfoList.length; i++) { // for ( var i = 0; i < sutResultInfoList.length; i++) {
// var ipNode = new TreeNode("port", sutResultInfoList[i].ip, null); // var ipNode = new TreeNode("port", sutResultInfoList[i].ip, null);
// this.root.insertSingleNode(ipNode); // this.root.insertSingleNode(ipNode);
// var portNode = new TreeNode("sut result", sutResultInfoList[i].port, // var portNode = new TreeNode("sut result", sutResultInfoList[i].port,
// null); // null);
// ipNode.insertSingleNode(portNode); // ipNode.insertSingleNode(portNode);
// var nodeArray = insertResultList(sutResultInfoList[i].childResults); // var nodeArray = insertResultList(sutResultInfoList[i].childResults);
// for ( var j = 0; j < nodeArray.length; j++) { // for ( var j = 0; j < nodeArray.length; j++) {
// portNode.insertSingleNode(nodeArray[j]); // portNode.insertSingleNode(nodeArray[j]);
// } // }
// } // }
//} //}
//function insertResultList(childResults) { //function insertResultList(childResults) {
// //
// if (childResults == null) // if (childResults == null)
// return null; // return null;
// else { // else {
// var nodeArray = new Array(); // var nodeArray = new Array();
// for ( var i = 0; i < childResults.length; i++) { // for ( var i = 0; i < childResults.length; i++) {
// var node = new TreeNode(childResults[i].result, // var node = new TreeNode(childResults[i].result,
// childResults[i].result, null); // childResults[i].result, null);
// var childNode = insertResultList(childResults[i].childResults); // var childNode = insertResultList(childResults[i].childResults);
// if (childNode !== null) { // if (childNode !== null) {
// for ( var j = 0; j < childNode.length; j++) { // for ( var j = 0; j < childNode.length; j++) {
// node.insertSingleNode(childNode[j]); // node.insertSingleNode(childNode[j]);
// } // }
// //
// } // }
// nodeArray.push(node); // nodeArray.push(node);
// } // }
// } // }
// return nodeArray; // return nodeArray;
//}; //};

View File

@ -1,93 +1,93 @@
Highcharts.theme = { Highcharts.theme = {
colors: ['#058DC7', '#50B432', '#ED561B', '#DDDF00', '#24CBE5', '#64E572', '#FF9655', '#FFF263', '#6AF9C4'], colors: ['#058DC7', '#50B432', '#ED561B', '#DDDF00', '#24CBE5', '#64E572', '#FF9655', '#FFF263', '#6AF9C4'],
chart: { chart: {
width:null, width:null,
backgroundColor: "#fff", backgroundColor: "#fff",
borderWidth: 0, borderWidth: 0,
plotBackgroundColor: 'rgba(255, 255, 255, .9)', plotBackgroundColor: 'rgba(255, 255, 255, .9)',
plotShadow: false, plotShadow: false,
plotBorderWidth: 1 plotBorderWidth: 1
}, },
title: { title: {
style: { style: {
color: '#000', color: '#000',
font: 'bold 16px "Trebuchet MS", Verdana, sans-serif' font: 'bold 16px "Trebuchet MS", Verdana, sans-serif'
} }
}, },
subtitle: { subtitle: {
style: { style: {
color: '#666666', color: '#666666',
font: 'bold 12px "Trebuchet MS", Verdana, sans-serif' font: 'bold 12px "Trebuchet MS", Verdana, sans-serif'
} }
}, },
xAxis: { xAxis: {
gridLineWidth: 1, gridLineWidth: 1,
lineColor: '#000', lineColor: '#000',
tickColor: '#000', tickColor: '#000',
labels: { labels: {
style: { style: {
color: '#000', color: '#000',
font: '11px Trebuchet MS, Verdana, sans-serif' font: '11px Trebuchet MS, Verdana, sans-serif'
} }
}, },
title: { title: {
style: { style: {
color: '#333', color: '#333',
fontWeight: 'bold', fontWeight: 'bold',
fontSize: '12px', fontSize: '12px',
fontFamily: 'Trebuchet MS, Verdana, sans-serif' fontFamily: 'Trebuchet MS, Verdana, sans-serif'
} }
} }
}, },
yAxis: { yAxis: {
lineColor: '#000', lineColor: '#000',
lineWidth: 0.5, lineWidth: 0.5,
tickWidth: 1, tickWidth: 1,
tickColor: '#000', tickColor: '#000',
labels: { labels: {
style: { style: {
color: '#000', color: '#000',
font: '12px Trebuchet MS, Verdana, sans-serif' font: '12px Trebuchet MS, Verdana, sans-serif'
} }
}, },
title: { title: {
style: { style: {
color: '#333', color: '#333',
fontWeight: 'normal', fontWeight: 'normal',
fontSize: '12px', fontSize: '12px',
fontFamily: 'Trebuchet MS, Verdana, sans-serif' fontFamily: 'Trebuchet MS, Verdana, sans-serif'
} }
} }
}, },
legend: { legend: {
itemStyle: { itemStyle: {
font: '9pt Trebuchet MS, Verdana, sans-serif', font: '9pt Trebuchet MS, Verdana, sans-serif',
color: 'black' color: 'black'
}, },
itemHoverStyle: { itemHoverStyle: {
color: '#039' color: '#039'
}, },
itemHiddenStyle: { itemHiddenStyle: {
color: 'gray' color: 'gray'
} }
}, },
labels: { labels: {
style: { style: {
color: '#99b' color: '#99b'
} }
}, },
navigation: { navigation: {
buttonOptions: { buttonOptions: {
theme: { theme: {
stroke: '#CCCCCC', stroke: '#CCCCCC',
} }
} }
} }
}; };
// Apply the theme // Apply the theme
var highchartsOptions = Highcharts.setOptions(Highcharts.theme); var highchartsOptions = Highcharts.setOptions(Highcharts.theme);

View File

@ -1,35 +1,35 @@
var progress_id = "loading"; var progress_id = "loading";
var loadItems = function() { var loadItems = function() {
this.scriptBriefStatusAve = false; this.scriptBriefStatusAve = false;
this.testBrief = false; this.testBrief = false;
}; };
function SetProgress(progress) { function SetProgress(progress) {
if (progress) { if (progress) {
$("#" + progress_id + " > div").css("width", String(progress) + "%"); // 控制#loading $("#" + progress_id + " > div").css("width", String(progress) + "%"); // 控制#loading
$("#" + progress_id + " > div").html(String(progress) + "%"); // 显示百分比 $("#" + progress_id + " > div").html(String(progress) + "%"); // 显示百分比
} }
} }
function doProgress() { function doProgress() {
var progress = getProgress(); var progress = getProgress();
SetProgress(progress); SetProgress(progress);
if (progress >= 100) { if (progress >= 100) {
$('#load').modal('hide'); $('#load').modal('hide');
return; return;
} }
if (progress < 100) { if (progress < 100) {
$('#load').modal('show'); $('#load').modal('show');
setTimeout("doProgress()", 1000); setTimeout("doProgress()", 1000);
} }
} }
function getProgress() { function getProgress() {
var progress = 0; var progress = 0;
for ( var key in loadItems) { for ( var key in loadItems) {
if (loadItems[key]) if (loadItems[key])
progress += (100 /2); progress += (100 /2);
} }
return progress; return progress;
} }
$('#cancelLoading').click(function() { $('#cancelLoading').click(function() {
window.location.replace("testplans.jsp"); window.location.replace("testplans.jsp");
}); });

View File

@ -1,50 +1,50 @@
function getTestBrief(testPlanId) { function getTestBrief(testPlanId) {
showTestPlanStatusAsync(testPlanId); showTestPlanStatusAsync(testPlanId);
showTestBriefStatus(testPlanId); showTestBriefStatus(testPlanId);
var intervalId = setInterval(function() { var intervalId = setInterval(function() {
showTestPlanStatusAsync(testPlanId); showTestPlanStatusAsync(testPlanId);
showTestBriefStatus(testPlanId); showTestBriefStatus(testPlanId);
loadItems.testBrief = true; loadItems.testBrief = true;
if ($('#status').attr("status") == "Complete") { if ($('#status').attr("status") == "Complete") {
clearInterval(intervalId); clearInterval(intervalId);
} }
$("#vu").html("<h4>" + 0 + "</h4>"); $("#vu").html("<h4>" + 0 + "</h4>");
}, 5000); }, 5000);
} }
function showTestPlanStatusAsync(testPlanId) { function showTestPlanStatusAsync(testPlanId) {
var urlAddress = testPlanId + "/runningInfo"; var urlAddress = testPlanId + "/runningInfo";
$.post(urlAddress, {}, function(data) { $.post(urlAddress, {}, function(data) {
if (!data.success) { if (!data.success) {
return; return;
} }
else { else {
data = data.testPlan; data = data.testPlan;
$('#status').attr("status", data.currentStatus); $('#status').attr("status", data.currentStatus);
var testStatus = testStatusMap(data.currentStatus); var testStatus = testStatusMap(data.currentStatus);
$('#status').html("<h4>" + testStatus + '</h4>'); $('#status').html("<h4>" + testStatus + '</h4>');
} }
}, "json"); }, "json");
} }
function showTestBriefStatus(testPlanId) { function showTestBriefStatus(testPlanId) {
var urlAddress = testPlanId + "/testBriefStatus"; var urlAddress = testPlanId + "/testBriefStatus";
$.post(urlAddress, {}, function(data) { $.post(urlAddress, {}, function(data) {
if (!data.success) { if (!data.success) {
return; return;
} }
else { else {
data = data.briefInfo; data = data.briefInfo;
} }
loadItems.testBrief = true; loadItems.testBrief = true;
startTime = data.time; startTime = data.time;
$("#vu").html("<h4>" + data.vus + "</h4>"); $("#vu").html("<h4>" + data.vus + "</h4>");
$("#request").html("<h4>" + data.requests + "</h4>") $("#request").html("<h4>" + data.requests + "</h4>")
if ($('#status').attr("status") == "Complete") { if ($('#status').attr("status") == "Complete") {
$("#vu").html("<h4>" + 0 + "</h4>"); $("#vu").html("<h4>" + 0 + "</h4>");
} }
}, "json"); }, "json");
} }

View File

@ -1,226 +1,226 @@
//Tree //Tree
var TreeNode = function(childClassName, name, value, childArray) { var TreeNode = function(childClassName, name, value, childArray) {
this.childClassName = childClassName; this.childClassName = childClassName;
this.name = name; this.name = name;
this.value = value; this.value = value;
this.children = childArray; this.children = childArray;
}; };
TreeNode.prototype.insertSingleNode = function(childNode) { TreeNode.prototype.insertSingleNode = function(childNode) {
if (childNode == null) if (childNode == null)
return; return;
if (this.children == null) if (this.children == null)
this.children = new Array(); this.children = new Array();
this.children.push(childNode); this.children.push(childNode);
}; };
TreeNode.prototype.insertNodes = function(childNodes) { TreeNode.prototype.insertNodes = function(childNodes) {
if (this.children == null) if (this.children == null)
this.children = new Array(); this.children = new Array();
if (childNodes == null) if (childNodes == null)
return; return;
for ( var i = 0; i < childNodes.length; i++) { for ( var i = 0; i < childNodes.length; i++) {
this.children.push(childNodes[i]); this.children.push(childNodes[i]);
} }
}; };
var Tree = function() { var Tree = function() {
this.root = null; this.root = null;
}; };
Tree.prototype.createRoot = function(rootChildrenClassName,name, value) { Tree.prototype.createRoot = function(rootChildrenClassName,name, value) {
this.root = new TreeNode(rootChildrenClassName,name, value, null); this.root = new TreeNode(rootChildrenClassName,name, value, null);
}; };
Tree.prototype.getClondSubTreeByValue = function(value) { Tree.prototype.getClondSubTreeByValue = function(value) {
if (value == null) if (value == null)
return null; return null;
if (this.root == null) if (this.root == null)
return null; return null;
var clonedTree = new Tree(); var clonedTree = new Tree();
clonedTree.createRoot(this.root.childClassName, this.root.name,this.root.value); clonedTree.createRoot(this.root.childClassName, this.root.name,this.root.value);
var parentNode = this.searchTreeNodeByValue(this.root, value); var parentNode = this.searchTreeNodeByValue(this.root, value);
clonedTree.root.childClassName = parentNode.childClassName; clonedTree.root.childClassName = parentNode.childClassName;
this.getClonedSubTree(parentNode, clonedTree.root);// 这个就把引用传递过去了,应该没什么影响,我再看看吧 this.getClonedSubTree(parentNode, clonedTree.root);// 这个就把引用传递过去了,应该没什么影响,我再看看吧
return clonedTree; return clonedTree;
}; };
Tree.prototype.searchTreeNodeByValue = function(parentNode, value) { Tree.prototype.searchTreeNodeByValue = function(parentNode, value) {
if (parentNode.children == null) if (parentNode.children == null)
return null; return null;
for ( var i = 0; i < parentNode.children.length; i++) { for ( var i = 0; i < parentNode.children.length; i++) {
if (value == parentNode.children[i].value) { if (value == parentNode.children[i].value) {
return parentNode.children[i]; return parentNode.children[i];
} }
var node = this.searchTreeNodeByValue(parentNode.children[i], value); var node = this.searchTreeNodeByValue(parentNode.children[i], value);
if (node != null) if (node != null)
return node; return node;
} }
}; };
Tree.prototype.getCloneTreeFromVlaue = function(pathValues) { Tree.prototype.getCloneTreeFromVlaue = function(pathValues) {
if (pathValues == null) if (pathValues == null)
return null; return null;
if (pathValues.length <= 0) if (pathValues.length <= 0)
return null; return null;
if (this.root == null) if (this.root == null)
return null; return null;
var clonedTree = new Tree(); var clonedTree = new Tree();
clonedTree.createRoot(this.root.childClassName,this.root.name, this.root.value); clonedTree.createRoot(this.root.childClassName,this.root.name, this.root.value);
var currentNode = this.root; var currentNode = this.root;
var clonedTreeCurrentNode = clonedTree.root; var clonedTreeCurrentNode = clonedTree.root;
for ( var i = 0; i < pathValues.length; i++) { for ( var i = 0; i < pathValues.length; i++) {
var flag = false; var flag = false;
for ( var j = 0; j < currentNode.children.length; j++) { for ( var j = 0; j < currentNode.children.length; j++) {
if (currentNode.children[j].value == pathValues[i]) { if (currentNode.children[j].value == pathValues[i]) {
var clonedNode = new TreeNode( var clonedNode = new TreeNode(
currentNode.children[j].childClassName,currentNode.children[j].name, currentNode.children[j].childClassName,currentNode.children[j].name,
currentNode.children[j].value, null); currentNode.children[j].value, null);
clonedTreeCurrentNode.insertSingleNode(clonedNode); clonedTreeCurrentNode.insertSingleNode(clonedNode);
clonedTreeCurrentNode = clonedNode; clonedTreeCurrentNode = clonedNode;
currentNode = currentNode.children[j]; currentNode = currentNode.children[j];
flag = true; flag = true;
break; break;
} }
} }
if (flag == false) { if (flag == false) {
return null; return null;
} }
} }
if (currentNode != null) if (currentNode != null)
this.getClonedSubTree(currentNode, clonedTreeCurrentNode);// 这个就把引用传递过去了,应该没什么影响,我再看看吧 this.getClonedSubTree(currentNode, clonedTreeCurrentNode);// 这个就把引用传递过去了,应该没什么影响,我再看看吧
return clonedTree; return clonedTree;
}; };
// no problem to copy the tree // no problem to copy the tree
Tree.prototype.getClonedSubTree = function(startNode, parentNode) { Tree.prototype.getClonedSubTree = function(startNode, parentNode) {
if (startNode == null) if (startNode == null)
return null; return null;
if (startNode.children == null) if (startNode.children == null)
return null; return null;
if (startNode.children.length <= 0) if (startNode.children.length <= 0)
return null; return null;
for ( var i = 0; i < startNode.children.length; i++) { for ( var i = 0; i < startNode.children.length; i++) {
var node = new TreeNode(startNode.children[i].childClassName,startNode.children[i].name, var node = new TreeNode(startNode.children[i].childClassName,startNode.children[i].name,
startNode.children[i].value, null); startNode.children[i].value, null);
parentNode.insertSingleNode(node); parentNode.insertSingleNode(node);
this.getClonedSubTree(startNode.children[i], node); this.getClonedSubTree(startNode.children[i], node);
} }
}; };
Tree.prototype.insertToTree = function(insertedTree, singlePathTree) { Tree.prototype.insertToTree = function(insertedTree, singlePathTree) {
if (singlePathTree == null) if (singlePathTree == null)
return; return;
if (singlePathTree.children == null) if (singlePathTree.children == null)
return; return;
if (singlePathTree.children.length < 1) if (singlePathTree.children.length < 1)
return; return;
if (insertedTree.children == null) { if (insertedTree.children == null) {
insertedTree.insertSingleNode(singlePathTree.children[0]); insertedTree.insertSingleNode(singlePathTree.children[0]);
} }
var children = insertedTree.children; var children = insertedTree.children;
var flag = false; var flag = false;
for ( var i = 0; i < children.length; i++) { for ( var i = 0; i < children.length; i++) {
if (children[i].value == singlePathTree.children[0].value) { if (children[i].value == singlePathTree.children[0].value) {
this.insertToTree(children[i], singlePathTree.children[0]); this.insertToTree(children[i], singlePathTree.children[0]);
flag = true; flag = true;
break; break;
} }
} }
if (!flag) if (!flag)
insertedTree.insertSingleNode(singlePathTree.children[0]); insertedTree.insertSingleNode(singlePathTree.children[0]);
}; };
Tree.prototype.deleteFromTree = function(pathValues) { Tree.prototype.deleteFromTree = function(pathValues) {
if (pathValues == null) if (pathValues == null)
return; return;
if (this.root == null) if (this.root == null)
return; return;
var nodeArray = this.getTreePathNodes(pathValues); var nodeArray = this.getTreePathNodes(pathValues);
var currentNode = nodeArray.pop(); var currentNode = nodeArray.pop();
var length = nodeArray.length; var length = nodeArray.length;
for ( var i = 0; i < length; i++) { for ( var i = 0; i < length; i++) {
var parent = nodeArray.pop(); var parent = nodeArray.pop();
if (parent.treeNode.children.length == 1 if (parent.treeNode.children.length == 1
&& currentNode.treeNode.children == null) && currentNode.treeNode.children == null)
parent.treeNode.children = null; parent.treeNode.children = null;
else if (parent.treeNode.children.length > 1 else if (parent.treeNode.children.length > 1
&& currentNode.treeNode.children == null) { && currentNode.treeNode.children == null) {
parent.treeNode.children.splice(currentNode.index, 1); parent.treeNode.children.splice(currentNode.index, 1);
} else } else
return; return;
currentNode = parent; currentNode = parent;
} }
; ;
}; };
Tree.prototype.getTreePathNodes = function(pathValues) { Tree.prototype.getTreePathNodes = function(pathValues) {
var DeleteNode = function(treeNode, index) { var DeleteNode = function(treeNode, index) {
this.treeNode = treeNode; this.treeNode = treeNode;
this.index = index; this.index = index;
}; };
if (pathValues == null) if (pathValues == null)
return; return;
if (this.root == null) { if (this.root == null) {
alert("error"); alert("error");
return; return;
} }
var currentNode = this.root; var currentNode = this.root;
var nodeArray = new Array(); var nodeArray = new Array();
nodeArray.push(new DeleteNode(this.root, 0)); nodeArray.push(new DeleteNode(this.root, 0));
for ( var i = 0; i < pathValues.length; i++) { for ( var i = 0; i < pathValues.length; i++) {
if (currentNode.children == null) { if (currentNode.children == null) {
alert("error"); alert("error");
return null; return null;
} }
for ( var j = 0; j < currentNode.children.length; j++) for ( var j = 0; j < currentNode.children.length; j++)
if (currentNode.children[j].value == pathValues[i]) { if (currentNode.children[j].value == pathValues[i]) {
nodeArray.push(new DeleteNode(currentNode.children[j], j)); nodeArray.push(new DeleteNode(currentNode.children[j], j));
currentNode = currentNode.children[j]; currentNode = currentNode.children[j];
break; break;
} }
} }
return nodeArray; return nodeArray;
}; };
Tree.prototype.getClonedTree = function(tree) { Tree.prototype.getClonedTree = function(tree) {
var clonedTree = new Tree(); var clonedTree = new Tree();
clonedTree.root = this.getClonedNode(tree.root); clonedTree.root = this.getClonedNode(tree.root);
return clonedTree; return clonedTree;
}; };
Tree.prototype.getClonedNode = function(node) { Tree.prototype.getClonedNode = function(node) {
if (node == null) if (node == null)
return null; return null;
var clonedNode = new TreeNode(node.childClassName, node.name,node.value, null); var clonedNode = new TreeNode(node.childClassName, node.name,node.value, null);
if (node.children != null && node.children.length > 0) { if (node.children != null && node.children.length > 0) {
for ( var i = 0; i < node.children.length; i++) { for ( var i = 0; i < node.children.length; i++) {
var childClonedNode = this.getClonedNode(node.children[i]); var childClonedNode = this.getClonedNode(node.children[i]);
if (childClonedNode != null) if (childClonedNode != null)
clonedNode.insertSingleNode(childClonedNode); clonedNode.insertSingleNode(childClonedNode);
} }
} }
return clonedNode; return clonedNode;
}; };
function getClonedSubTree(startNode, parentNode) { function getClonedSubTree(startNode, parentNode) {
if (startNode == null) if (startNode == null)
return null; return null;
if (startNode.children == null) if (startNode.children == null)
return null; return null;
if (startNode.children.length <= 0) if (startNode.children.length <= 0)
return null; return null;
for ( var i = 0; i < startNode.children.length; i++) { for ( var i = 0; i < startNode.children.length; i++) {
var node = new TreeNode(startNode.children[i].childClassName,startNode.children[i].name, var node = new TreeNode(startNode.children[i].childClassName,startNode.children[i].name,
startNode.children[i].value, null); startNode.children[i].value, null);
parentNode.insertSingleNode(node); parentNode.insertSingleNode(node);
this.getClonedSubTree(startNode.children[i], node); this.getClonedSubTree(startNode.children[i], node);
} }
}; };

View File

@ -1,139 +1,139 @@
<!DOCTYPE html> <!DOCTYPE html>
<%@ page language="java" contentType="text/html; charset=UTF-8" <%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%> pageEncoding="UTF-8"%>
<html> <html>
<head> <head>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> <%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<meta charset="utf-8"> <meta charset="utf-8">
<title>Bench4Q</title> <title>Bench4Q</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" <meta name="description"
content="Bench4Q, a new method for QOS benchmarking."> content="Bench4Q, a new method for QOS benchmarking.">
<link id="bs-css" href="lib/chrisma/css/bootstrap-cerulean.css" <link id="bs-css" href="lib/chrisma/css/bootstrap-cerulean.css"
rel="stylesheet"> rel="stylesheet">
<link href="lib/chrisma/css/opa-icons.css" rel="stylesheet"> <link href="lib/chrisma/css/opa-icons.css" rel="stylesheet">
<link <link
href="http://ajax.aspnetcdn.com/ajax/bootstrap/2.3.2/css/bootstrap-responsive.css" href="http://ajax.aspnetcdn.com/ajax/bootstrap/2.3.2/css/bootstrap-responsive.css"
rel="stylesheet"> rel="stylesheet">
<link href="lib/chrisma/css/charisma-app.css" rel="stylesheet"> <link href="lib/chrisma/css/charisma-app.css" rel="stylesheet">
<link href="lib/dataTable/css/jquery.dataTables.css" rel="stylesheet"> <link href="lib/dataTable/css/jquery.dataTables.css" rel="stylesheet">
<style type="text/css"> <style type="text/css">
body { body {
padding-bottom: 40px; padding-bottom: 40px;
} }
.sidebar-nav { .sidebar-nav {
padding: 9px 0; padding: 9px 0;
} }
.btn { .btn {
margin-right: 5px; margin-right: 5px;
} }
</style> </style>
<link <link
href="http://ajax.aspnetcdn.com/ajax/bootstrap/2.3.2/css/bootstrap-responsive.css" href="http://ajax.aspnetcdn.com/ajax/bootstrap/2.3.2/css/bootstrap-responsive.css"
rel="stylesheet"> rel="stylesheet">
<link href="lib/chrisma/css/charisma-app.css" rel="stylesheet"> <link href="lib/chrisma/css/charisma-app.css" rel="stylesheet">
<link <link
href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.10/themes/redmond/jquery-ui.css" href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.10/themes/redmond/jquery-ui.css"
rel="stylesheet"> rel="stylesheet">
<link rel="shortcut icon" href="images/bench4q.png"> <link rel="shortcut icon" href="images/bench4q.png">
</head> </head>
<body> <body>
<fmt:bundle basename="i18n"> <fmt:bundle basename="i18n">
<jsp:include page="publiccontrol/navigatebar.jsp"></jsp:include> <jsp:include page="publiccontrol/navigatebar.jsp"></jsp:include>
<div class="container-fluid"> <div class="container-fluid">
<div class="row-fluid"> <div class="row-fluid">
<jsp:include page="publiccontrol/leftmenubar.jsp"></jsp:include> <jsp:include page="publiccontrol/leftmenubar.jsp"></jsp:include>
<noscript> <noscript>
<div class="alert alert-block span10"> <div class="alert alert-block span10">
<h4 class="alert-heading"> <h4 class="alert-heading">
<fmt:message key="warning" /> <fmt:message key="warning" />
! !
</h4> </h4>
<p> <p>
<fmt:message key="warningcontent1" /> <fmt:message key="warningcontent1" />
<a href="http://en.wikipedia.org/wiki/JavaScript" target="_blank">JavaScript</a> <a href="http://en.wikipedia.org/wiki/JavaScript" target="_blank">JavaScript</a>
<fmt:message key="warningcontent2" /> <fmt:message key="warningcontent2" />
. .
</p> </p>
</div> </div>
</noscript> </noscript>
<div id="content" class="span10"> <div id="content" class="span10">
<!-- content starts --> <!-- content starts -->
<div> <div>
<ul class="breadcrumb"> <ul class="breadcrumb">
<li><a href="#"><fmt:message key="home" /></a> <span <li><a href="#"><fmt:message key="home" /></a> <span
class="divider">/</span></li> class="divider">/</span></li>
<li><a href="#"><fmt:message key="testplan" /></a></li> <li><a href="#"><fmt:message key="testplan" /></a></li>
</ul> </ul>
</div> </div>
<div class="row-fluid sortable"> <div class="row-fluid sortable">
<div class="box span12 "> <div class="box span12 ">
<div class="box-header well" data-original-title> <div class="box-header well" data-original-title>
<h2> <h2>
<i></i> <i></i>
<fmt:message key="testplan" /> <fmt:message key="testplan" />
</h2> </h2>
<div class="box-icon"> <div class="box-icon">
<a href="#" class="btn btn-minimize btn-round"><i <a href="#" class="btn btn-minimize btn-round"><i
class="icon-chevron-up"></i></a> <a href="#" class="icon-chevron-up"></i></a> <a href="#"
class="btn btn-close btn-round"><i class="icon-remove"></i></a> class="btn btn-close btn-round"><i class="icon-remove"></i></a>
<a href="#" class="btn btn-round" onClick="loadTestPlans()"><i <a href="#" class="btn btn-round" onClick="loadTestPlans()"><i
class="icon-list"></i></a> class="icon-list"></i></a>
</div> </div>
</div> </div>
<div class="box-content"> <div class="box-content">
<table id="table" <table id="table"
class="table table-striped table-bordered bootstrap-datatable datatable"> class="table table-striped table-bordered bootstrap-datatable datatable">
<thead> <thead>
<tr> <tr>
<th>ID</th> <th>ID</th>
<th><fmt:message key="name" /></th> <th><fmt:message key="name" /></th>
<th><fmt:message key="status" /></th> <th><fmt:message key="status" /></th>
<th><fmt:message key="createdatetime" /></th> <th><fmt:message key="createdatetime" /></th>
<th><fmt:message key="testPlan-view" /></th> <th><fmt:message key="testPlan-view" /></th>
<th><fmt:message key="actions" /></th> <th><fmt:message key="actions" /></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
<!--/span--> <!--/span-->
</div> </div>
<!--/row--> <!--/row-->
<!-- content ends --> <!-- content ends -->
</div> </div>
<!--/#content.span10--> <!--/#content.span10-->
</div> </div>
<jsp:include page="publiccontrol/footer.jsp"></jsp:include> <jsp:include page="publiccontrol/footer.jsp"></jsp:include>
</div> </div>
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script> <script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="lib/dataTable/js/jquery.dataTables.js"></script> <script src="lib/dataTable/js/jquery.dataTables.js"></script>
<script <script
src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.10.3/jquery-ui.min.js"></script> src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.10.3/jquery-ui.min.js"></script>
<script src="lib/jqueryi18n/jquery.i18n.properties-1.0.9.js"></script> <script src="lib/jqueryi18n/jquery.i18n.properties-1.0.9.js"></script>
<script <script
src="http://ajax.aspnetcdn.com/ajax/bootstrap/2.3.1/bootstrap.min.js"></script> src="http://ajax.aspnetcdn.com/ajax/bootstrap/2.3.1/bootstrap.min.js"></script>
<script src="lib/chrisma/js/jquery.cookie.js"></script> <script src="lib/chrisma/js/jquery.cookie.js"></script>
<script src="lib/chrisma/js/theme.js"></script> <script src="lib/chrisma/js/theme.js"></script>
<script src="script/base.js"></script> <script src="script/base.js"></script>
<script src="script/bench4q.table.js"></script> <script src="script/bench4q.table.js"></script>
<script src="script/testPlanListManage.js"></script> <script src="script/testPlanListManage.js"></script>
<script src="script/Share/TestStatusMap.js"></script> <script src="script/Share/TestStatusMap.js"></script>
<script src="script/testPlans.js"></script> <script src="script/testPlans.js"></script>
</fmt:bundle> </fmt:bundle>
</body> </body>
</html> </html>

View File

@ -1,29 +1,29 @@
package org.bench4q.web.test.masterMessager; package org.bench4q.web.test.masterMessager;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement @XmlRootElement
public class ParamInfoModel_Test { public class ParamInfoModel_Test {
private String label; private String label;
private String name; private String name;
@XmlElement @XmlElement
public String getLabel() { public String getLabel() {
return label; return label;
} }
public void setLable(String label) { public void setLable(String label) {
this.label = label; this.label = label;
} }
@XmlElement @XmlElement
public String getName() { public String getName() {
return name; return name;
} }
public void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
} }
} }

View File

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" <beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<context:component-scan base-package="org.bench4q.web,org.bench4q.share" /> <context:component-scan base-package="org.bench4q.web,org.bench4q.share" />
<mvc:annotation-driven /> <mvc:annotation-driven />
</beans> </beans>