merge Bench4Q-Web
This commit is contained in:
parent
96459a3844
commit
2ce58fc6cc
File diff suppressed because one or more lines are too long
|
@ -1,125 +1,125 @@
|
|||
package org.bench4q.web.TestPlan;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
||||
import org.bench4q.share.models.master.MonitorModel;
|
||||
import org.bench4q.share.models.master.RunningScriptModel;
|
||||
import org.bench4q.share.models.master.TestPlanModel;
|
||||
import org.bench4q.share.models.master.TestPlanResultModel;
|
||||
import org.bench4q.share.models.master.TestScriptConfig;
|
||||
import org.bench4q.web.exception.CustomGenericException;
|
||||
import org.bench4q.web.extractObjectFromXml.ObjectXmlExchange;
|
||||
import org.bench4q.web.model.WebScriptModel;
|
||||
import org.bench4q.web.model.TestPlanRequestModel;
|
||||
import org.bench4q.web.model.TestPlanTaskModel;
|
||||
import org.bench4q.web.service.BaseService;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.ui.ModelMap;
|
||||
|
||||
@Component
|
||||
public class RunTestPlan extends BaseService {
|
||||
public void runTestPlan(String accessToken,
|
||||
TestPlanRequestModel testPlanRequestModel, ModelMap model)
|
||||
throws CustomGenericException {
|
||||
String url = "testPlan" + "/runTestPlanWithTestPlanModel";
|
||||
String caller = "runTestPlan";
|
||||
try {
|
||||
TestPlanResultModel testPlanResultModel = (TestPlanResultModel) communicateWithMaster
|
||||
.getRespnseObjectByPostXml(accessToken, url,
|
||||
TestPlanResultModel.class, ObjectXmlExchange.toXml(
|
||||
TestPlanModel.class,
|
||||
createTestPlan(testPlanRequestModel,
|
||||
monitorPort)), caller);
|
||||
TestPlanTaskModel testPlanTaskModel = this
|
||||
.extractTestPlanTaskModel(testPlanRequestModel,
|
||||
testPlanResultModel);
|
||||
addToTestPlanTaskList(testPlanTaskModel, model);
|
||||
} catch (JAXBException e) {
|
||||
throw new CustomGenericException("0", e.getMessage(), caller);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private TestPlanModel createTestPlan(TestPlanRequestModel testPlan,
|
||||
int port) {
|
||||
TestPlanModel testPlanModel = new TestPlanModel();
|
||||
if (testPlan.getScriptList() != null
|
||||
&& testPlan.getScriptList().size() > 0) {
|
||||
List<RunningScriptModel> scriptList = createRunningScriptModel(testPlan
|
||||
.getScriptList());
|
||||
testPlanModel.setRunningScriptModels(scriptList);
|
||||
}
|
||||
if (testPlan.getIpList() != null && testPlan.getIpList().size() > 0) {
|
||||
List<MonitorModel> ipList = createMonitorModel(
|
||||
testPlan.getIpList(), port);
|
||||
testPlanModel.setMonitorModels(ipList);
|
||||
} else
|
||||
testPlanModel.setMonitorModels(new ArrayList<MonitorModel>());
|
||||
return testPlanModel;
|
||||
}
|
||||
|
||||
private List<RunningScriptModel> createRunningScriptModel(
|
||||
List<WebScriptModel> scriptParam) {
|
||||
|
||||
List<RunningScriptModel> scriptList = new ArrayList<RunningScriptModel>();
|
||||
|
||||
for (WebScriptModel scriptModel : scriptParam) {
|
||||
RunningScriptModel runnningScriptModel = new RunningScriptModel();
|
||||
runnningScriptModel.setScriptId(scriptModel.getId());
|
||||
runnningScriptModel.setRequireLoad(scriptModel.getLoad());
|
||||
TestScriptConfig testScriptConfig = new TestScriptConfig();
|
||||
testScriptConfig.setCoolDown(scriptModel.getCooldown());
|
||||
testScriptConfig.setExecuteRange(scriptModel.getExecuteRange());
|
||||
testScriptConfig.setWarmUp(scriptModel.getWarmup());
|
||||
runnningScriptModel.setConfig(testScriptConfig);
|
||||
scriptList.add(runnningScriptModel);
|
||||
}
|
||||
return scriptList;
|
||||
}
|
||||
|
||||
private List<MonitorModel> createMonitorModel(List<String> ipParam, int port) {
|
||||
List<MonitorModel> ipList = new ArrayList<MonitorModel>();
|
||||
MonitorModel monitorModel = new MonitorModel();
|
||||
for (String ip : ipParam) {
|
||||
monitorModel.setHostName(ip);
|
||||
monitorModel.setPort(port);
|
||||
ipList.add(monitorModel);
|
||||
}
|
||||
return ipList;
|
||||
}
|
||||
|
||||
private TestPlanTaskModel extractTestPlanTaskModel(
|
||||
TestPlanRequestModel testPlanRequestModel,
|
||||
TestPlanResultModel testPlanResultModel) {
|
||||
TestPlanTaskModel testPlanTaskModel;
|
||||
if (testPlanResultModel.getTestPlanId() != null)
|
||||
testPlanTaskModel = new TestPlanTaskModel(
|
||||
testPlanRequestModel.getTestPlanName(), testPlanResultModel
|
||||
.getTestPlanId().toString(), testPlanResultModel
|
||||
.getCurrentStatus().toString());
|
||||
else
|
||||
testPlanTaskModel = new TestPlanTaskModel(
|
||||
testPlanRequestModel.getTestPlanName(), "-1",
|
||||
testPlanResultModel.getCurrentStatus().toString());
|
||||
return testPlanTaskModel;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void addToTestPlanTaskList(TestPlanTaskModel testPlanTaskModel,
|
||||
ModelMap model) {
|
||||
if (model.get("testPlanTaskList") == null) {
|
||||
List<TestPlanTaskModel> testPlanTaskModels = new ArrayList<TestPlanTaskModel>();
|
||||
testPlanTaskModels.add(testPlanTaskModel);
|
||||
model.put("testPlanTaskList", testPlanTaskModels);
|
||||
System.out.println("add the test task!");
|
||||
System.out.println(model.get("testPlanTaskList"));
|
||||
} else {
|
||||
((List<TestPlanTaskModel>) model.get("testPlanTaskList"))
|
||||
.add(testPlanTaskModel);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
package org.bench4q.web.TestPlan;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
||||
import org.bench4q.share.models.master.MonitorModel;
|
||||
import org.bench4q.share.models.master.RunningScriptModel;
|
||||
import org.bench4q.share.models.master.TestPlanModel;
|
||||
import org.bench4q.share.models.master.TestPlanResultModel;
|
||||
import org.bench4q.share.models.master.TestScriptConfig;
|
||||
import org.bench4q.web.exception.CustomGenericException;
|
||||
import org.bench4q.web.extractObjectFromXml.ObjectXmlExchange;
|
||||
import org.bench4q.web.model.WebScriptModel;
|
||||
import org.bench4q.web.model.TestPlanRequestModel;
|
||||
import org.bench4q.web.model.TestPlanTaskModel;
|
||||
import org.bench4q.web.service.BaseService;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.ui.ModelMap;
|
||||
|
||||
@Component
|
||||
public class RunTestPlan extends BaseService {
|
||||
public void runTestPlan(String accessToken,
|
||||
TestPlanRequestModel testPlanRequestModel, ModelMap model)
|
||||
throws CustomGenericException {
|
||||
String url = "testPlan" + "/runTestPlanWithTestPlanModel";
|
||||
String caller = "runTestPlan";
|
||||
try {
|
||||
TestPlanResultModel testPlanResultModel = (TestPlanResultModel) communicateWithMaster
|
||||
.getRespnseObjectByPostXml(accessToken, url,
|
||||
TestPlanResultModel.class, ObjectXmlExchange.toXml(
|
||||
TestPlanModel.class,
|
||||
createTestPlan(testPlanRequestModel,
|
||||
monitorPort)), caller);
|
||||
TestPlanTaskModel testPlanTaskModel = this
|
||||
.extractTestPlanTaskModel(testPlanRequestModel,
|
||||
testPlanResultModel);
|
||||
addToTestPlanTaskList(testPlanTaskModel, model);
|
||||
} catch (JAXBException e) {
|
||||
throw new CustomGenericException("0", e.getMessage(), caller);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private TestPlanModel createTestPlan(TestPlanRequestModel testPlan,
|
||||
int port) {
|
||||
TestPlanModel testPlanModel = new TestPlanModel();
|
||||
if (testPlan.getScriptList() != null
|
||||
&& testPlan.getScriptList().size() > 0) {
|
||||
List<RunningScriptModel> scriptList = createRunningScriptModel(testPlan
|
||||
.getScriptList());
|
||||
testPlanModel.setRunningScriptModels(scriptList);
|
||||
}
|
||||
if (testPlan.getIpList() != null && testPlan.getIpList().size() > 0) {
|
||||
List<MonitorModel> ipList = createMonitorModel(
|
||||
testPlan.getIpList(), port);
|
||||
testPlanModel.setMonitorModels(ipList);
|
||||
} else
|
||||
testPlanModel.setMonitorModels(new ArrayList<MonitorModel>());
|
||||
return testPlanModel;
|
||||
}
|
||||
|
||||
private List<RunningScriptModel> createRunningScriptModel(
|
||||
List<WebScriptModel> scriptParam) {
|
||||
|
||||
List<RunningScriptModel> scriptList = new ArrayList<RunningScriptModel>();
|
||||
|
||||
for (WebScriptModel scriptModel : scriptParam) {
|
||||
RunningScriptModel runnningScriptModel = new RunningScriptModel();
|
||||
runnningScriptModel.setScriptId(scriptModel.getId());
|
||||
runnningScriptModel.setRequireLoad(scriptModel.getLoad());
|
||||
TestScriptConfig testScriptConfig = new TestScriptConfig();
|
||||
testScriptConfig.setCoolDown(scriptModel.getCooldown());
|
||||
testScriptConfig.setExecuteRange(scriptModel.getExecuteRange());
|
||||
testScriptConfig.setWarmUp(scriptModel.getWarmup());
|
||||
runnningScriptModel.setConfig(testScriptConfig);
|
||||
scriptList.add(runnningScriptModel);
|
||||
}
|
||||
return scriptList;
|
||||
}
|
||||
|
||||
private List<MonitorModel> createMonitorModel(List<String> ipParam, int port) {
|
||||
List<MonitorModel> ipList = new ArrayList<MonitorModel>();
|
||||
MonitorModel monitorModel = new MonitorModel();
|
||||
for (String ip : ipParam) {
|
||||
monitorModel.setHostName(ip);
|
||||
monitorModel.setPort(port);
|
||||
ipList.add(monitorModel);
|
||||
}
|
||||
return ipList;
|
||||
}
|
||||
|
||||
private TestPlanTaskModel extractTestPlanTaskModel(
|
||||
TestPlanRequestModel testPlanRequestModel,
|
||||
TestPlanResultModel testPlanResultModel) {
|
||||
TestPlanTaskModel testPlanTaskModel;
|
||||
if (testPlanResultModel.getTestPlanId() != null)
|
||||
testPlanTaskModel = new TestPlanTaskModel(
|
||||
testPlanRequestModel.getTestPlanName(), testPlanResultModel
|
||||
.getTestPlanId().toString(), testPlanResultModel
|
||||
.getCurrentStatus().toString());
|
||||
else
|
||||
testPlanTaskModel = new TestPlanTaskModel(
|
||||
testPlanRequestModel.getTestPlanName(), "-1",
|
||||
testPlanResultModel.getCurrentStatus().toString());
|
||||
return testPlanTaskModel;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void addToTestPlanTaskList(TestPlanTaskModel testPlanTaskModel,
|
||||
ModelMap model) {
|
||||
if (model.get("testPlanTaskList") == null) {
|
||||
List<TestPlanTaskModel> testPlanTaskModels = new ArrayList<TestPlanTaskModel>();
|
||||
testPlanTaskModels.add(testPlanTaskModel);
|
||||
model.put("testPlanTaskList", testPlanTaskModels);
|
||||
System.out.println("add the test task!");
|
||||
System.out.println(model.get("testPlanTaskList"));
|
||||
} else {
|
||||
((List<TestPlanTaskModel>) model.get("testPlanTaskList"))
|
||||
.add(testPlanTaskModel);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,71 +1,71 @@
|
|||
package org.bench4q.web.TestPlan;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
||||
import org.bench4q.share.models.master.ScriptModel;
|
||||
import org.bench4q.share.models.master.TestPlanResultModel;
|
||||
import org.bench4q.web.exception.CustomGenericException;
|
||||
import org.bench4q.web.model.WebTestPlanResultModel;
|
||||
import org.bench4q.web.service.BaseService;
|
||||
import org.bench4q.web.service.CommunicateWithMaster;
|
||||
import org.bench4q.web.service.ScriptService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class TestPlanFeature {
|
||||
private CommunicateWithMaster communicateWithMaster;
|
||||
private String baseUrl ="testPlan";
|
||||
private ScriptService scriptService;
|
||||
|
||||
private CommunicateWithMaster getCommunicateWithMaster() {
|
||||
return communicateWithMaster;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private void setCommunicateWithMaster(
|
||||
CommunicateWithMaster communicateWithMaster) {
|
||||
this.communicateWithMaster = communicateWithMaster;
|
||||
}
|
||||
|
||||
public ScriptService getScriptService() {
|
||||
return scriptService;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setScriptService(ScriptService scriptService) {
|
||||
this.scriptService = scriptService;
|
||||
}
|
||||
public TestPlanResultModel getRunningTestPlanModel(String accessToken,
|
||||
String testPlanId, String caller) throws CustomGenericException {
|
||||
String url = this.baseUrl + "/getRunningInfo";
|
||||
caller = "getRunningTestPlanModel";
|
||||
Map<String, String> params = BaseService.makeParamsMap("testPlanId",
|
||||
testPlanId);
|
||||
return (TestPlanResultModel) this.getCommunicateWithMaster()
|
||||
.getResponseModel(accessToken, url, TestPlanResultModel.class,
|
||||
params, caller);
|
||||
}
|
||||
|
||||
public WebTestPlanResultModel getTestPlanInfo(String accessToken,
|
||||
String testPlanId, String caller) throws CustomGenericException,
|
||||
JAXBException {
|
||||
caller = caller + "_TestPlanFeature:getTestPlanInfo";
|
||||
String url = this.baseUrl + "/getRunningInfo";
|
||||
Map<String, String> params = BaseService.makeParamsMap("testPlanId",
|
||||
testPlanId);
|
||||
TestPlanResultModel testPlanResultModel = (TestPlanResultModel) this
|
||||
.getCommunicateWithMaster().getResponseModel(accessToken, url,
|
||||
TestPlanResultModel.class, params, caller);
|
||||
WebTestPlanResultModel webTestPlanResultModel = new WebTestPlanResultModel(
|
||||
testPlanResultModel);
|
||||
List<ScriptModel> scriptModels = this.getScriptService().queryScripts(
|
||||
testPlanResultModel.getScriptIds(), accessToken);
|
||||
webTestPlanResultModel.setScriptIdNameMap(this.getScriptService()
|
||||
.getScriptIdNameMap(scriptModels));
|
||||
return webTestPlanResultModel;
|
||||
}
|
||||
}
|
||||
package org.bench4q.web.TestPlan;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
||||
import org.bench4q.share.models.master.ScriptModel;
|
||||
import org.bench4q.share.models.master.TestPlanResultModel;
|
||||
import org.bench4q.web.exception.CustomGenericException;
|
||||
import org.bench4q.web.model.WebTestPlanResultModel;
|
||||
import org.bench4q.web.service.BaseService;
|
||||
import org.bench4q.web.service.CommunicateWithMaster;
|
||||
import org.bench4q.web.service.ScriptService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class TestPlanFeature {
|
||||
private CommunicateWithMaster communicateWithMaster;
|
||||
private String baseUrl ="testPlan";
|
||||
private ScriptService scriptService;
|
||||
|
||||
private CommunicateWithMaster getCommunicateWithMaster() {
|
||||
return communicateWithMaster;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private void setCommunicateWithMaster(
|
||||
CommunicateWithMaster communicateWithMaster) {
|
||||
this.communicateWithMaster = communicateWithMaster;
|
||||
}
|
||||
|
||||
public ScriptService getScriptService() {
|
||||
return scriptService;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setScriptService(ScriptService scriptService) {
|
||||
this.scriptService = scriptService;
|
||||
}
|
||||
public TestPlanResultModel getRunningTestPlanModel(String accessToken,
|
||||
String testPlanId, String caller) throws CustomGenericException {
|
||||
String url = this.baseUrl + "/getRunningInfo";
|
||||
caller = "getRunningTestPlanModel";
|
||||
Map<String, String> params = BaseService.makeParamsMap("testPlanId",
|
||||
testPlanId);
|
||||
return (TestPlanResultModel) this.getCommunicateWithMaster()
|
||||
.getResponseModel(accessToken, url, TestPlanResultModel.class,
|
||||
params, caller);
|
||||
}
|
||||
|
||||
public WebTestPlanResultModel getTestPlanInfo(String accessToken,
|
||||
String testPlanId, String caller) throws CustomGenericException,
|
||||
JAXBException {
|
||||
caller = caller + "_TestPlanFeature:getTestPlanInfo";
|
||||
String url = this.baseUrl + "/getRunningInfo";
|
||||
Map<String, String> params = BaseService.makeParamsMap("testPlanId",
|
||||
testPlanId);
|
||||
TestPlanResultModel testPlanResultModel = (TestPlanResultModel) this
|
||||
.getCommunicateWithMaster().getResponseModel(accessToken, url,
|
||||
TestPlanResultModel.class, params, caller);
|
||||
WebTestPlanResultModel webTestPlanResultModel = new WebTestPlanResultModel(
|
||||
testPlanResultModel);
|
||||
List<ScriptModel> scriptModels = this.getScriptService().queryScripts(
|
||||
testPlanResultModel.getScriptIds(), accessToken);
|
||||
webTestPlanResultModel.setScriptIdNameMap(this.getScriptService()
|
||||
.getScriptIdNameMap(scriptModels));
|
||||
return webTestPlanResultModel;
|
||||
}
|
||||
}
|
|
@ -1,186 +1,186 @@
|
|||
package org.bench4q.web.api;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.JAXBException;
|
||||
import javax.xml.bind.Unmarshaller;
|
||||
|
||||
import org.bench4q.share.communication.HttpRequester;
|
||||
import org.bench4q.share.communication.HttpRequester.HttpResponse;
|
||||
import org.bench4q.share.models.master.AgentModel;
|
||||
import org.bench4q.share.models.master.AgentResponseModel;
|
||||
import org.bench4q.web.extractObjectFromXml.ObjectXmlExchange;
|
||||
import org.bench4q.web.model.AgentListModel;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.SessionAttributes;
|
||||
|
||||
@Controller
|
||||
@SessionAttributes("accessToken")
|
||||
public class AgentActionController extends BaseControllerService {
|
||||
private final String baseUrl =this.masterIp+ "agentManage";
|
||||
public static int IN_IDLE = 1;
|
||||
|
||||
private String getBaseUrl() {
|
||||
return baseUrl;
|
||||
}
|
||||
|
||||
@RequestMapping("addAgentToPool")
|
||||
@ResponseBody
|
||||
// change to true or false
|
||||
public Boolean addAgenttoPool(HttpServletRequest request,
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@RequestParam String hostName, @RequestParam String maxLoad,
|
||||
@RequestParam String port) {
|
||||
if (!validateInput(hostName))
|
||||
return false;
|
||||
if (!validateInput(maxLoad))
|
||||
return false;
|
||||
if (!validateInput(port))
|
||||
return false;
|
||||
String content;
|
||||
HttpResponse httpResponse;
|
||||
try {
|
||||
content = ObjectXmlExchange.toXml(AgentModel.class,
|
||||
buildAgent(hostName, maxLoad, port, IN_IDLE));
|
||||
System.out.println(content);
|
||||
httpResponse = this.getHttpRequester().sendPostXml(
|
||||
this.getBaseUrl() + "/addAgentToPool", content,
|
||||
makeAccessTockenMap(accessToken));
|
||||
if (HttpRequester.isInvalidResponse(httpResponse)) {
|
||||
System.out.println(httpResponseNull);
|
||||
return false;
|
||||
}
|
||||
System.out.println(httpResponse.getContent());
|
||||
AgentResponseModel agentResponseModel = extractAgentResponseModel(httpResponse
|
||||
.getContent());
|
||||
if (agentResponseModel.isSuccess()) {
|
||||
System.out.println(SUCCESS);
|
||||
|
||||
return true;
|
||||
} else {
|
||||
System.out.println(FAIL);
|
||||
System.err.println(agentResponseModel.getFailCauseString());
|
||||
return false;
|
||||
}
|
||||
} catch (JAXBException e) {
|
||||
System.err.println(FAIL);
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private AgentModel buildAgent(String hostName, String maxLoad, String port,
|
||||
int currentStatus) {
|
||||
AgentModel agent = new AgentModel();
|
||||
agent.setHostName(hostName);
|
||||
agent.setPort(Integer.parseInt(port));
|
||||
agent.setCurrentStatus(currentStatus);
|
||||
agent.setMaxLoad(Integer.parseInt(maxLoad));
|
||||
agent.setRemainLoad(Integer.parseInt(maxLoad));
|
||||
return agent;
|
||||
}
|
||||
|
||||
@RequestMapping("removeAgentFromPool")
|
||||
@ResponseBody
|
||||
public Boolean removeAgentfromPool(HttpServletRequest request,
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@RequestParam String hostName, @RequestParam String id) {
|
||||
System.out.println("enter remove agent");
|
||||
if (!validateInput(hostName))
|
||||
return false;
|
||||
if (!validateInput(id))
|
||||
return false;
|
||||
Map<String, String> params = this.makeParamsMap("agentId", id);
|
||||
params.put("hostName", hostName);
|
||||
try {
|
||||
HttpResponse httpResponse = this.getHttpRequester().sendGet(
|
||||
this.getBaseUrl() + "/removeAgentFromPool", params,
|
||||
this.makeAccessTockenMap(accessToken));
|
||||
if (HttpRequester.isInvalidResponse(httpResponse)) {
|
||||
System.out.println(httpResponseNull);
|
||||
return false;
|
||||
}
|
||||
System.out.println(httpResponse.getContent());
|
||||
AgentResponseModel agentResponseModel = extractAgentResponseModel(httpResponse
|
||||
.getContent());
|
||||
if (agentResponseModel.isSuccess()) {
|
||||
System.out.println(SUCCESS);
|
||||
return true;
|
||||
} else {
|
||||
System.out.println(FAIL);
|
||||
System.out.println(agentResponseModel.getFailCauseString());
|
||||
return false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.err.println(FAIL);
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "loadAgents", method = { RequestMethod.POST,
|
||||
RequestMethod.GET })
|
||||
@ResponseBody
|
||||
public AgentListModel loadAgentsFromPool(HttpServletRequest request,
|
||||
@ModelAttribute("accessToken") String accessToken) {
|
||||
System.out.println("enter load Agent");
|
||||
try {
|
||||
HttpResponse httpResponse = this.getHttpRequester().sendPost(
|
||||
this.getBaseUrl() + "/queryAgentList", null,
|
||||
this.makeAccessTockenMap(accessToken));
|
||||
if (HttpRequester.isInvalidResponse(httpResponse)) {
|
||||
System.out.println("reponse is null");
|
||||
return null;
|
||||
}
|
||||
System.out.println(httpResponse.getContent());
|
||||
AgentResponseModel agentResponseModel = this
|
||||
.extractAgentResponseModel(httpResponse.getContent());
|
||||
if (agentResponseModel.isSuccess()) {
|
||||
System.out.println(SUCCESS);
|
||||
return buildAgentListModel(agentResponseModel.getAgents());
|
||||
} else {
|
||||
System.out.println(FAIL);
|
||||
System.out.println(agentResponseModel.getFailCauseString());
|
||||
return null;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println(FAIL);
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private AgentListModel buildAgentListModel(List<AgentModel> agents) {
|
||||
AgentListModel listModel = new AgentListModel();
|
||||
listModel.setList(agents);
|
||||
return listModel;
|
||||
}
|
||||
|
||||
private AgentResponseModel extractAgentResponseModel(String content)
|
||||
throws JAXBException {
|
||||
AgentResponseModel resultModel = new AgentResponseModel();
|
||||
Unmarshaller ummarshaller = JAXBContext.newInstance(
|
||||
resultModel.getClass()).createUnmarshaller();
|
||||
resultModel = (AgentResponseModel) ummarshaller
|
||||
.unmarshal(new ByteArrayInputStream(content.getBytes()));
|
||||
return resultModel;
|
||||
}
|
||||
|
||||
}
|
||||
package org.bench4q.web.api;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.JAXBException;
|
||||
import javax.xml.bind.Unmarshaller;
|
||||
|
||||
import org.bench4q.share.communication.HttpRequester;
|
||||
import org.bench4q.share.communication.HttpRequester.HttpResponse;
|
||||
import org.bench4q.share.models.master.AgentModel;
|
||||
import org.bench4q.share.models.master.AgentResponseModel;
|
||||
import org.bench4q.web.extractObjectFromXml.ObjectXmlExchange;
|
||||
import org.bench4q.web.model.AgentListModel;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.SessionAttributes;
|
||||
|
||||
@Controller
|
||||
@SessionAttributes("accessToken")
|
||||
public class AgentActionController extends BaseControllerService {
|
||||
private final String baseUrl =this.masterIp+ "agentManage";
|
||||
public static int IN_IDLE = 1;
|
||||
|
||||
private String getBaseUrl() {
|
||||
return baseUrl;
|
||||
}
|
||||
|
||||
@RequestMapping("addAgentToPool")
|
||||
@ResponseBody
|
||||
// change to true or false
|
||||
public Boolean addAgenttoPool(HttpServletRequest request,
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@RequestParam String hostName, @RequestParam String maxLoad,
|
||||
@RequestParam String port) {
|
||||
if (!validateInput(hostName))
|
||||
return false;
|
||||
if (!validateInput(maxLoad))
|
||||
return false;
|
||||
if (!validateInput(port))
|
||||
return false;
|
||||
String content;
|
||||
HttpResponse httpResponse;
|
||||
try {
|
||||
content = ObjectXmlExchange.toXml(AgentModel.class,
|
||||
buildAgent(hostName, maxLoad, port, IN_IDLE));
|
||||
System.out.println(content);
|
||||
httpResponse = this.getHttpRequester().sendPostXml(
|
||||
this.getBaseUrl() + "/addAgentToPool", content,
|
||||
makeAccessTockenMap(accessToken));
|
||||
if (HttpRequester.isInvalidResponse(httpResponse)) {
|
||||
System.out.println(httpResponseNull);
|
||||
return false;
|
||||
}
|
||||
System.out.println(httpResponse.getContent());
|
||||
AgentResponseModel agentResponseModel = extractAgentResponseModel(httpResponse
|
||||
.getContent());
|
||||
if (agentResponseModel.isSuccess()) {
|
||||
System.out.println(SUCCESS);
|
||||
|
||||
return true;
|
||||
} else {
|
||||
System.out.println(FAIL);
|
||||
System.err.println(agentResponseModel.getFailCauseString());
|
||||
return false;
|
||||
}
|
||||
} catch (JAXBException e) {
|
||||
System.err.println(FAIL);
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private AgentModel buildAgent(String hostName, String maxLoad, String port,
|
||||
int currentStatus) {
|
||||
AgentModel agent = new AgentModel();
|
||||
agent.setHostName(hostName);
|
||||
agent.setPort(Integer.parseInt(port));
|
||||
agent.setCurrentStatus(currentStatus);
|
||||
agent.setMaxLoad(Integer.parseInt(maxLoad));
|
||||
agent.setRemainLoad(Integer.parseInt(maxLoad));
|
||||
return agent;
|
||||
}
|
||||
|
||||
@RequestMapping("removeAgentFromPool")
|
||||
@ResponseBody
|
||||
public Boolean removeAgentfromPool(HttpServletRequest request,
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@RequestParam String hostName, @RequestParam String id) {
|
||||
System.out.println("enter remove agent");
|
||||
if (!validateInput(hostName))
|
||||
return false;
|
||||
if (!validateInput(id))
|
||||
return false;
|
||||
Map<String, String> params = this.makeParamsMap("agentId", id);
|
||||
params.put("hostName", hostName);
|
||||
try {
|
||||
HttpResponse httpResponse = this.getHttpRequester().sendGet(
|
||||
this.getBaseUrl() + "/removeAgentFromPool", params,
|
||||
this.makeAccessTockenMap(accessToken));
|
||||
if (HttpRequester.isInvalidResponse(httpResponse)) {
|
||||
System.out.println(httpResponseNull);
|
||||
return false;
|
||||
}
|
||||
System.out.println(httpResponse.getContent());
|
||||
AgentResponseModel agentResponseModel = extractAgentResponseModel(httpResponse
|
||||
.getContent());
|
||||
if (agentResponseModel.isSuccess()) {
|
||||
System.out.println(SUCCESS);
|
||||
return true;
|
||||
} else {
|
||||
System.out.println(FAIL);
|
||||
System.out.println(agentResponseModel.getFailCauseString());
|
||||
return false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.err.println(FAIL);
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "loadAgents", method = { RequestMethod.POST,
|
||||
RequestMethod.GET })
|
||||
@ResponseBody
|
||||
public AgentListModel loadAgentsFromPool(HttpServletRequest request,
|
||||
@ModelAttribute("accessToken") String accessToken) {
|
||||
System.out.println("enter load Agent");
|
||||
try {
|
||||
HttpResponse httpResponse = this.getHttpRequester().sendPost(
|
||||
this.getBaseUrl() + "/queryAgentList", null,
|
||||
this.makeAccessTockenMap(accessToken));
|
||||
if (HttpRequester.isInvalidResponse(httpResponse)) {
|
||||
System.out.println("reponse is null");
|
||||
return null;
|
||||
}
|
||||
System.out.println(httpResponse.getContent());
|
||||
AgentResponseModel agentResponseModel = this
|
||||
.extractAgentResponseModel(httpResponse.getContent());
|
||||
if (agentResponseModel.isSuccess()) {
|
||||
System.out.println(SUCCESS);
|
||||
return buildAgentListModel(agentResponseModel.getAgents());
|
||||
} else {
|
||||
System.out.println(FAIL);
|
||||
System.out.println(agentResponseModel.getFailCauseString());
|
||||
return null;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println(FAIL);
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private AgentListModel buildAgentListModel(List<AgentModel> agents) {
|
||||
AgentListModel listModel = new AgentListModel();
|
||||
listModel.setList(agents);
|
||||
return listModel;
|
||||
}
|
||||
|
||||
private AgentResponseModel extractAgentResponseModel(String content)
|
||||
throws JAXBException {
|
||||
AgentResponseModel resultModel = new AgentResponseModel();
|
||||
Unmarshaller ummarshaller = JAXBContext.newInstance(
|
||||
resultModel.getClass()).createUnmarshaller();
|
||||
resultModel = (AgentResponseModel) ummarshaller
|
||||
.unmarshal(new ByteArrayInputStream(content.getBytes()));
|
||||
return resultModel;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,157 +1,157 @@
|
|||
package org.bench4q.web.api;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bench4q.share.communication.HttpRequester;
|
||||
import org.bench4q.share.communication.HttpRequester.HttpResponse;
|
||||
import org.bench4q.share.models.master.AuthorizeResponseModel;
|
||||
import org.bench4q.share.models.master.RegisterResponseModel;
|
||||
import org.bench4q.share.models.master.UserModel;
|
||||
import org.bench4q.web.exception.CustomGenericException;
|
||||
import org.bench4q.web.extractObjectFromXml.ObjectXmlExchange;
|
||||
import org.bench4q.web.model.BaseResponseModel;
|
||||
import org.bench4q.web.model.TestPlanTaskModel;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.SessionAttributes;
|
||||
|
||||
@Controller
|
||||
@SessionAttributes({ "accessToken", "username", "testPlanTaskList" })
|
||||
public class AuthorizeActionController extends BaseControllerService {
|
||||
private Logger logger = Logger.getLogger(AuthorizeActionController.class);
|
||||
private String baseUrl = this.masterIp+"user";
|
||||
private String INVALIDATE_INPUT = "invalidate input";
|
||||
|
||||
@RequestMapping("login")
|
||||
public @ResponseBody
|
||||
BaseResponseModel login(UserModel user, ModelMap model)
|
||||
throws CustomGenericException {
|
||||
isValidate(user);
|
||||
AuthorizeResponseModel authorizeResponseModel = authorize(baseUrl
|
||||
+ "/normalAuthorize", user);
|
||||
return extractAuthorizeResponseModel(authorizeResponseModel, user,
|
||||
model);
|
||||
}
|
||||
|
||||
@RequestMapping("adminLogin")
|
||||
public @ResponseBody
|
||||
BaseResponseModel adminLogin(UserModel user, ModelMap model)
|
||||
throws CustomGenericException {
|
||||
isValidate(user);
|
||||
|
||||
AuthorizeResponseModel authorizeResponseModel = authorize(baseUrl
|
||||
+ "/adminAuthorize", user);
|
||||
return extractAuthorizeResponseModel(authorizeResponseModel, user,
|
||||
model);
|
||||
}
|
||||
|
||||
@RequestMapping("register")
|
||||
@ResponseBody
|
||||
public BaseResponseModel register(UserModel user)
|
||||
throws CustomGenericException {
|
||||
System.out.println("enter register!!");
|
||||
isValidate(user);
|
||||
Map<String, String> params = this.makeParamsMap("userName",
|
||||
user.getUserName());
|
||||
params.put("password", user.getPassword());
|
||||
try {
|
||||
HttpResponse httpResponse = this.getHttpRequester().sendGet(
|
||||
baseUrl + "/register", params, null);
|
||||
if (HttpRequester.isInvalidResponse(httpResponse)) {
|
||||
throw new CustomGenericException("0",
|
||||
"invalidate httpResponse",
|
||||
"AuthorizeActionController_register");
|
||||
}
|
||||
RegisterResponseModel registerResponseModel = (RegisterResponseModel) ObjectXmlExchange
|
||||
.fromXml(RegisterResponseModel.class,
|
||||
httpResponse.getContent());
|
||||
return extractRegisterModel(registerResponseModel);
|
||||
} catch (IOException e) {
|
||||
logger.info(e,e.fillInStackTrace());
|
||||
throw new CustomGenericException("1",
|
||||
"invalidate httpresponse:io exception", this.baseUrl
|
||||
+ "/register");
|
||||
} catch (JAXBException e) {
|
||||
// TODO Auto-generated catch block
|
||||
logger.info(e,e.fillInStackTrace());
|
||||
throw new CustomGenericException("1",
|
||||
"invalidate httpresponse:JAXBException", this.baseUrl
|
||||
+ "/register");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private AuthorizeResponseModel authorize(String url, UserModel user)
|
||||
throws CustomGenericException {
|
||||
try {
|
||||
Map<String, String> params = this.makeParamsMap("userName",
|
||||
user.getUserName());
|
||||
params.put("password", user.getPassword());
|
||||
HttpResponse httpResponse = this.getHttpRequester().sendGet(url,
|
||||
params, null);
|
||||
if (HttpRequester.isInvalidResponse(httpResponse)) {
|
||||
throw new CustomGenericException("1",
|
||||
"network error:",
|
||||
"AuthorizeActionController_authorize");
|
||||
}
|
||||
|
||||
return (AuthorizeResponseModel) ObjectXmlExchange.fromXml(
|
||||
AuthorizeResponseModel.class, httpResponse.getContent());
|
||||
} catch (IOException e) {
|
||||
logger.info(e,e.fillInStackTrace());
|
||||
throw new CustomGenericException("1",
|
||||
"invalidate httpResponse:IOException",
|
||||
"AuthorizeActionController_authorize");
|
||||
} catch (JAXBException e) {
|
||||
logger.info(e,e.fillInStackTrace());
|
||||
throw new CustomGenericException("1",
|
||||
"invalidate httpResponse:JAXBException",
|
||||
"AuthorizeActionController_authorize");
|
||||
}
|
||||
}
|
||||
|
||||
private BaseResponseModel extractAuthorizeResponseModel(
|
||||
AuthorizeResponseModel authorizeResponseModel, UserModel user,
|
||||
ModelMap model) {
|
||||
|
||||
if (!authorizeResponseModel.isSuccess()) {
|
||||
logger.info("user name:" + user.getUserName());
|
||||
logger.info("user password:" + user.getPassword());
|
||||
logger.info("password or name wrong");
|
||||
return new BaseResponseModel(false, "password or name wrong!");
|
||||
} else {
|
||||
model.addAttribute("accessToken",
|
||||
authorizeResponseModel.getAccessToken());
|
||||
model.addAttribute("username", user.getUserName());
|
||||
List<TestPlanTaskModel> testPlanTaskModels = new ArrayList<TestPlanTaskModel>();
|
||||
model.addAttribute("testPlanTaskList", testPlanTaskModels);
|
||||
return new BaseResponseModel(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private BaseResponseModel extractRegisterModel(
|
||||
RegisterResponseModel registerResponseModel) {
|
||||
|
||||
if (registerResponseModel.isSuccess())
|
||||
return new BaseResponseModel(true);
|
||||
|
||||
else
|
||||
return new BaseResponseModel(false, "");
|
||||
}
|
||||
|
||||
private void isValidate(UserModel user) throws CustomGenericException {
|
||||
if (user.getPassword() == null || user.getUserName() == null
|
||||
|| user.getPassword().equals("")
|
||||
|| user.getUserName().equals(""))
|
||||
throw new CustomGenericException("0", INVALIDATE_INPUT, "");
|
||||
}
|
||||
|
||||
}
|
||||
package org.bench4q.web.api;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bench4q.share.communication.HttpRequester;
|
||||
import org.bench4q.share.communication.HttpRequester.HttpResponse;
|
||||
import org.bench4q.share.models.master.AuthorizeResponseModel;
|
||||
import org.bench4q.share.models.master.RegisterResponseModel;
|
||||
import org.bench4q.share.models.master.UserModel;
|
||||
import org.bench4q.web.exception.CustomGenericException;
|
||||
import org.bench4q.web.extractObjectFromXml.ObjectXmlExchange;
|
||||
import org.bench4q.web.model.BaseResponseModel;
|
||||
import org.bench4q.web.model.TestPlanTaskModel;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.SessionAttributes;
|
||||
|
||||
@Controller
|
||||
@SessionAttributes({ "accessToken", "username", "testPlanTaskList" })
|
||||
public class AuthorizeActionController extends BaseControllerService {
|
||||
private Logger logger = Logger.getLogger(AuthorizeActionController.class);
|
||||
private String baseUrl = this.masterIp+"user";
|
||||
private String INVALIDATE_INPUT = "invalidate input";
|
||||
|
||||
@RequestMapping("login")
|
||||
public @ResponseBody
|
||||
BaseResponseModel login(UserModel user, ModelMap model)
|
||||
throws CustomGenericException {
|
||||
isValidate(user);
|
||||
AuthorizeResponseModel authorizeResponseModel = authorize(baseUrl
|
||||
+ "/normalAuthorize", user);
|
||||
return extractAuthorizeResponseModel(authorizeResponseModel, user,
|
||||
model);
|
||||
}
|
||||
|
||||
@RequestMapping("adminLogin")
|
||||
public @ResponseBody
|
||||
BaseResponseModel adminLogin(UserModel user, ModelMap model)
|
||||
throws CustomGenericException {
|
||||
isValidate(user);
|
||||
|
||||
AuthorizeResponseModel authorizeResponseModel = authorize(baseUrl
|
||||
+ "/adminAuthorize", user);
|
||||
return extractAuthorizeResponseModel(authorizeResponseModel, user,
|
||||
model);
|
||||
}
|
||||
|
||||
@RequestMapping("register")
|
||||
@ResponseBody
|
||||
public BaseResponseModel register(UserModel user)
|
||||
throws CustomGenericException {
|
||||
System.out.println("enter register!!");
|
||||
isValidate(user);
|
||||
Map<String, String> params = this.makeParamsMap("userName",
|
||||
user.getUserName());
|
||||
params.put("password", user.getPassword());
|
||||
try {
|
||||
HttpResponse httpResponse = this.getHttpRequester().sendGet(
|
||||
baseUrl + "/register", params, null);
|
||||
if (HttpRequester.isInvalidResponse(httpResponse)) {
|
||||
throw new CustomGenericException("0",
|
||||
"invalidate httpResponse",
|
||||
"AuthorizeActionController_register");
|
||||
}
|
||||
RegisterResponseModel registerResponseModel = (RegisterResponseModel) ObjectXmlExchange
|
||||
.fromXml(RegisterResponseModel.class,
|
||||
httpResponse.getContent());
|
||||
return extractRegisterModel(registerResponseModel);
|
||||
} catch (IOException e) {
|
||||
logger.info(e,e.fillInStackTrace());
|
||||
throw new CustomGenericException("1",
|
||||
"invalidate httpresponse:io exception", this.baseUrl
|
||||
+ "/register");
|
||||
} catch (JAXBException e) {
|
||||
// TODO Auto-generated catch block
|
||||
logger.info(e,e.fillInStackTrace());
|
||||
throw new CustomGenericException("1",
|
||||
"invalidate httpresponse:JAXBException", this.baseUrl
|
||||
+ "/register");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private AuthorizeResponseModel authorize(String url, UserModel user)
|
||||
throws CustomGenericException {
|
||||
try {
|
||||
Map<String, String> params = this.makeParamsMap("userName",
|
||||
user.getUserName());
|
||||
params.put("password", user.getPassword());
|
||||
HttpResponse httpResponse = this.getHttpRequester().sendGet(url,
|
||||
params, null);
|
||||
if (HttpRequester.isInvalidResponse(httpResponse)) {
|
||||
throw new CustomGenericException("1",
|
||||
"network error:",
|
||||
"AuthorizeActionController_authorize");
|
||||
}
|
||||
|
||||
return (AuthorizeResponseModel) ObjectXmlExchange.fromXml(
|
||||
AuthorizeResponseModel.class, httpResponse.getContent());
|
||||
} catch (IOException e) {
|
||||
logger.info(e,e.fillInStackTrace());
|
||||
throw new CustomGenericException("1",
|
||||
"invalidate httpResponse:IOException",
|
||||
"AuthorizeActionController_authorize");
|
||||
} catch (JAXBException e) {
|
||||
logger.info(e,e.fillInStackTrace());
|
||||
throw new CustomGenericException("1",
|
||||
"invalidate httpResponse:JAXBException",
|
||||
"AuthorizeActionController_authorize");
|
||||
}
|
||||
}
|
||||
|
||||
private BaseResponseModel extractAuthorizeResponseModel(
|
||||
AuthorizeResponseModel authorizeResponseModel, UserModel user,
|
||||
ModelMap model) {
|
||||
|
||||
if (!authorizeResponseModel.isSuccess()) {
|
||||
logger.info("user name:" + user.getUserName());
|
||||
logger.info("user password:" + user.getPassword());
|
||||
logger.info("password or name wrong");
|
||||
return new BaseResponseModel(false, "password or name wrong!");
|
||||
} else {
|
||||
model.addAttribute("accessToken",
|
||||
authorizeResponseModel.getAccessToken());
|
||||
model.addAttribute("username", user.getUserName());
|
||||
List<TestPlanTaskModel> testPlanTaskModels = new ArrayList<TestPlanTaskModel>();
|
||||
model.addAttribute("testPlanTaskList", testPlanTaskModels);
|
||||
return new BaseResponseModel(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private BaseResponseModel extractRegisterModel(
|
||||
RegisterResponseModel registerResponseModel) {
|
||||
|
||||
if (registerResponseModel.isSuccess())
|
||||
return new BaseResponseModel(true);
|
||||
|
||||
else
|
||||
return new BaseResponseModel(false, "");
|
||||
}
|
||||
|
||||
private void isValidate(UserModel user) throws CustomGenericException {
|
||||
if (user.getPassword() == null || user.getUserName() == null
|
||||
|| user.getPassword().equals("")
|
||||
|| user.getUserName().equals(""))
|
||||
throw new CustomGenericException("0", INVALIDATE_INPUT, "");
|
||||
}
|
||||
|
||||
}
|
|
@ -1,69 +1,69 @@
|
|||
package org.bench4q.web.api;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.bench4q.share.communication.HttpRequester;
|
||||
import org.bench4q.web.service.CommunicateWithMaster;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public abstract class BaseControllerService {
|
||||
private HttpRequester httpRequester;
|
||||
protected final int NETWORKERROR = 1;
|
||||
protected final int DOMAINERROR = 2;
|
||||
public static String SUCCESS = "success";
|
||||
public static String FAIL = "fail";
|
||||
public static String httpResponseNull = "http response is null";
|
||||
public static String FAIL_WITH_EXCEPTION = "fail with exception";
|
||||
protected final String AUTH_HEADER_PROPERTY = "Authorization";
|
||||
protected final String ACCES_TOCKEN_STARTER = "Bearer ";
|
||||
protected final int monitorPort = 5556;
|
||||
protected String masterIp=CommunicateWithMaster.getMasterAddress();
|
||||
public static final Properties prop = new Properties();
|
||||
|
||||
|
||||
|
||||
public HttpRequester getHttpRequester() {
|
||||
return httpRequester;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setHttpRequester(HttpRequester httpRequester) {
|
||||
this.httpRequester = httpRequester;
|
||||
}
|
||||
|
||||
|
||||
public Map<String, String> makeAccessTockenMap(String accessToken) {
|
||||
Map<String, String> properties = new HashMap<String, String>();
|
||||
properties
|
||||
.put(AUTH_HEADER_PROPERTY, ACCES_TOCKEN_STARTER + accessToken);
|
||||
|
||||
return properties;
|
||||
}
|
||||
|
||||
public Map<String, String> makeParamsMap(String key, String value) {
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
params.put(key, value);
|
||||
return params;
|
||||
}
|
||||
|
||||
public static Boolean validateInput(String input) {
|
||||
if (input == null || input.equals("")) {
|
||||
System.err.println("input is invalidate");
|
||||
return false;
|
||||
} else
|
||||
return true;
|
||||
}
|
||||
|
||||
public String generateUrl(String[] pathValues, String hostName, String port) {
|
||||
String url = hostName + port;
|
||||
for (String pathValue : pathValues) {
|
||||
url += "/" + pathValue;
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
}
|
||||
package org.bench4q.web.api;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.bench4q.share.communication.HttpRequester;
|
||||
import org.bench4q.web.service.CommunicateWithMaster;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public abstract class BaseControllerService {
|
||||
private HttpRequester httpRequester;
|
||||
protected final int NETWORKERROR = 1;
|
||||
protected final int DOMAINERROR = 2;
|
||||
public static String SUCCESS = "success";
|
||||
public static String FAIL = "fail";
|
||||
public static String httpResponseNull = "http response is null";
|
||||
public static String FAIL_WITH_EXCEPTION = "fail with exception";
|
||||
protected final String AUTH_HEADER_PROPERTY = "Authorization";
|
||||
protected final String ACCES_TOCKEN_STARTER = "Bearer ";
|
||||
protected final int monitorPort = 5556;
|
||||
protected String masterIp=CommunicateWithMaster.getMasterAddress();
|
||||
public static final Properties prop = new Properties();
|
||||
|
||||
|
||||
|
||||
public HttpRequester getHttpRequester() {
|
||||
return httpRequester;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setHttpRequester(HttpRequester httpRequester) {
|
||||
this.httpRequester = httpRequester;
|
||||
}
|
||||
|
||||
|
||||
public Map<String, String> makeAccessTockenMap(String accessToken) {
|
||||
Map<String, String> properties = new HashMap<String, String>();
|
||||
properties
|
||||
.put(AUTH_HEADER_PROPERTY, ACCES_TOCKEN_STARTER + accessToken);
|
||||
|
||||
return properties;
|
||||
}
|
||||
|
||||
public Map<String, String> makeParamsMap(String key, String value) {
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
params.put(key, value);
|
||||
return params;
|
||||
}
|
||||
|
||||
public static Boolean validateInput(String input) {
|
||||
if (input == null || input.equals("")) {
|
||||
System.err.println("input is invalidate");
|
||||
return false;
|
||||
} else
|
||||
return true;
|
||||
}
|
||||
|
||||
public String generateUrl(String[] pathValues, String hostName, String port) {
|
||||
String url = hostName + port;
|
||||
for (String pathValue : pathValues) {
|
||||
url += "/" + pathValue;
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,244 +1,244 @@
|
|||
package org.bench4q.web.api;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bench4q.share.models.master.MonitorMemoryResponseModel;
|
||||
import org.bench4q.share.models.master.MonitorProcessorResponseModel;
|
||||
import org.bench4q.share.models.monitor.MemoryModel;
|
||||
import org.bench4q.share.models.monitor.ProcessorModel;
|
||||
import org.bench4q.share.models.monitor.ProcessorModelChild;
|
||||
import org.bench4q.web.exception.CustomGenericException;
|
||||
import org.bench4q.web.model.BaseResponseModel;
|
||||
import org.bench4q.web.model.ResultModel;
|
||||
import org.bench4q.web.service.ChangeToResultModel;
|
||||
import org.bench4q.web.service.MonitorService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.SessionAttributes;
|
||||
|
||||
@Controller
|
||||
@SessionAttributes({ "accessToken" })
|
||||
public class MonitorController {
|
||||
private Logger logger = Logger.getLogger(MonitorService.class);
|
||||
private MonitorService monitorService;
|
||||
|
||||
public MonitorService getMonitorService() {
|
||||
return monitorService;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setMonitorService(MonitorService monitorService) {
|
||||
this.monitorService = monitorService;
|
||||
}
|
||||
|
||||
@RequestMapping("/{testPlanId}/SUT/{ip}/{port}/cpu/{cpuInstance}/{fieldName}/{startTime}")
|
||||
@ResponseBody
|
||||
public BaseResponseModel getCpuResult(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@PathVariable("testPlanId") String testplanID,
|
||||
@PathVariable String ip, @PathVariable String port,
|
||||
@PathVariable String cpuInstance, @PathVariable String fieldName,
|
||||
@PathVariable String startTime) throws CustomGenericException {
|
||||
MonitorProcessorResponseModel monitorProcessorResponseModel = this
|
||||
.getMonitorService().getCpus(accessToken, testplanID, ip, port,
|
||||
startTime);
|
||||
String source = "MonitorController:getCpuResult";
|
||||
try {
|
||||
List<ResultModel> resultModels = extractCpuResultModelList(
|
||||
monitorProcessorResponseModel.getProcessorModels(),
|
||||
cpuInstance, fieldName);
|
||||
if (resultModels == null)
|
||||
return new BaseResponseModel(false, "empty data");
|
||||
else {
|
||||
return new BaseResponseModel(true, resultModels);
|
||||
}
|
||||
} catch (NoSuchFieldException e) {
|
||||
logger.info(e.getStackTrace());
|
||||
logger.info("get cpu info error :no such field:" + e.getCause());
|
||||
logger.info("monitorController:getCpu_" + fieldName);
|
||||
throw new CustomGenericException("5",
|
||||
"get cpu info error :no such field:" + fieldName,
|
||||
"monitorController:getCpu_" + fieldName);
|
||||
} catch (IllegalArgumentException e) {
|
||||
|
||||
throw new CustomGenericException("5", e.getMessage(), source);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping("/testPlanId/SUT/{ip}/{port}/memory/{fieldName}/{startTime}")
|
||||
@ResponseBody
|
||||
public BaseResponseModel geMemoryStatus(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@PathVariable("testPlanId") String testPlanId,
|
||||
@RequestParam String ip, @RequestParam String port,
|
||||
@PathVariable String fieldName, @PathVariable String startTime)
|
||||
throws CustomGenericException {
|
||||
|
||||
String source = "MonitorController:getMemoryStatus";
|
||||
try {
|
||||
|
||||
MonitorMemoryResponseModel monitorMemoryResponseModel = this
|
||||
.getMonitorService().getMemoryResponseModel(accessToken,
|
||||
testPlanId, ip, port, startTime);
|
||||
List<ResultModel> resultModels = extractResultModelList(
|
||||
monitorMemoryResponseModel.getMemoryModels(), fieldName);
|
||||
if (resultModels == null)
|
||||
return new BaseResponseModel(false, "empty data");
|
||||
else
|
||||
return new BaseResponseModel(true, resultModels);
|
||||
} catch (NoSuchFieldException e) {
|
||||
logger.info(e.getStackTrace());
|
||||
logger.info("get Memory info error :no such field:" + e.getCause());
|
||||
logger.info(source + "_" + fieldName);
|
||||
throw new CustomGenericException("5",
|
||||
"get memory info error :no such field:" + fieldName, source
|
||||
+ "_" + fieldName);
|
||||
}
|
||||
}
|
||||
|
||||
// @RequestMapping("/testPlanIds/SUT/{ip}/{port}/network/{instance}/{fieldName}/{startTime}")
|
||||
// @ResponseBody
|
||||
// public BaseResponseModel getNetwor(
|
||||
// @ModelAttribute("accessToken") String accessToken,
|
||||
// @PathVariable("testPlanId") String testplanID,
|
||||
// @PathVariable String ip, @PathVariable String port,
|
||||
// @PathVariable String instance, @PathVariable String fieldName,
|
||||
// @PathVariable String startTime) throws CustomGenericException{
|
||||
// String source = "MonitorController:getNetwork";
|
||||
// try {
|
||||
// MonitorNetworkReponseModel monitorResponseModel = this
|
||||
// .getMonitorService().getNetworks(accessToken, testplanID,
|
||||
// ip, port, startTime);
|
||||
//
|
||||
// List<ResultModel> resultModels = extractNetworkResultModelList(
|
||||
// monitorResponseModel.getModels(), instance, fieldName);
|
||||
// if (resultModels == null)
|
||||
// return new BaseResponseModel(false, "empty data");
|
||||
// else
|
||||
// return new BaseResponseModel(true, resultModels);
|
||||
// } catch (NoSuchFieldException e) {
|
||||
// logger.info("get network info error :no such field:" + e.getCause());
|
||||
// logger.info(source + "_" + fieldName);
|
||||
// throw new CustomGenericException("5",
|
||||
// "get network info error :no such field:" + fieldName,
|
||||
// source + "_" + fieldName);
|
||||
// } catch (IllegalArgumentException e) {
|
||||
// throw new CustomGenericException("5", e.getMessage(), source);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
private List<ResultModel> extractCpuResultModelList(
|
||||
List<ProcessorModel> processorModels, String instance,
|
||||
String fieldName) throws NoSuchFieldException,
|
||||
IllegalArgumentException {
|
||||
if (processorModels == null)
|
||||
return null;
|
||||
List<ResultModel> resultModels = new ArrayList<ResultModel>();
|
||||
for (ProcessorModel processorModel : processorModels) {
|
||||
if (processorModel != null) {
|
||||
ResultModel resultModel = extractResultModel(processorModel,
|
||||
instance, fieldName);
|
||||
if (resultModel != null)
|
||||
resultModels.add(resultModel);
|
||||
}
|
||||
|
||||
}
|
||||
return resultModels;
|
||||
}
|
||||
|
||||
private List<ResultModel> extractResultModelList(
|
||||
List<MemoryModel> memoryModels, String fieldName)
|
||||
throws NoSuchFieldException {
|
||||
if (memoryModels == null)
|
||||
return null;
|
||||
List<ResultModel> resultModels = new ArrayList<ResultModel>();
|
||||
List<String> fieldNames = new ArrayList<String>();
|
||||
fieldNames.add(fieldName);
|
||||
for (MemoryModel memoryModel : memoryModels) {
|
||||
if (memoryModel != null) {
|
||||
ResultModel resultModel = ChangeToResultModel.getResultModel(
|
||||
MemoryModel.class, fieldNames);
|
||||
resultModel.setTime(memoryModel.getSamplingTime());
|
||||
resultModels.add(resultModel);
|
||||
}
|
||||
}
|
||||
return resultModels;
|
||||
}
|
||||
|
||||
// private List<ResultModel> extractNetworkResultModelList(
|
||||
// List<NetworkInterfaceModel> networkInterfaceModels,
|
||||
// String instance, String fieldName) throws NoSuchFieldException,
|
||||
// IllegalArgumentException {
|
||||
// if (networkInterfaceModels == null)
|
||||
// return null;
|
||||
// List<ResultModel> resultModels = new ArrayList<ResultModel>();
|
||||
//
|
||||
// for (NetworkInterfaceModel networkInterfaceModel :
|
||||
// networkInterfaceModels) {
|
||||
// if (networkInterfaceModel != null) {
|
||||
// ResultModel resultModel = extractResultModel(
|
||||
// networkInterfaceModel, instance, fieldName);
|
||||
// if (resultModel != null)
|
||||
// resultModels.add(resultModel);
|
||||
// }
|
||||
// }
|
||||
// return resultModels;
|
||||
// }
|
||||
|
||||
private ResultModel extractResultModel(ProcessorModel processorModel,
|
||||
String instance, String fieldName) throws NoSuchFieldException,
|
||||
IllegalArgumentException {
|
||||
String source = "MonitorController:extractResultModel";
|
||||
List<String> fieldNames = new ArrayList<String>();
|
||||
fieldNames.add(fieldName);
|
||||
|
||||
for (ProcessorModelChild processorModelChild : processorModel
|
||||
.getProcessorModelList()) {
|
||||
|
||||
if (processorModelChild.getInstance().equalsIgnoreCase(instance)) {
|
||||
ResultModel resultModel = ChangeToResultModel.getResultModel(
|
||||
processorModelChild, fieldNames);
|
||||
resultModel.setFinished(false);
|
||||
resultModel.setTime(processorModel.getSamplingTime());
|
||||
return resultModel;
|
||||
}
|
||||
}
|
||||
logger.info("no such cpu instance:" + instance + "_" + source);
|
||||
throw new IllegalArgumentException("no such cpu instance:" + instance);
|
||||
}
|
||||
|
||||
// private ResultModel extractResultModel(
|
||||
// NetworkInterfaceModel networkInterfaceModel, String instance,
|
||||
// String fieldName) throws NoSuchFieldException {
|
||||
//
|
||||
// String source = "MonitorController:extractResultModel";
|
||||
// List<String> fieldNames = new ArrayList<String>();
|
||||
// fieldNames.add(fieldName);
|
||||
//
|
||||
// for (NetworkInterfaceModelChild networkInterfaceModelChild :
|
||||
// networkInterfaceModel
|
||||
// .getNetworkList()) {
|
||||
//
|
||||
// if (networkInterfaceModelChild.getInstance().equalsIgnoreCase(
|
||||
// instance)) {
|
||||
// ResultModel resultModel = ChangeToResultModel.getResultModel(
|
||||
// networkInterfaceModelChild, fieldNames);
|
||||
// resultModel.setFinished(false);
|
||||
// resultModel.setTime(networkInterfaceModel.getSamplingTime());
|
||||
// return resultModel;
|
||||
// }
|
||||
// }
|
||||
// logger.info("no such network instance:" + instance + "_" + source);
|
||||
// throw new IllegalArgumentException("no such network instance:"
|
||||
// + instance);
|
||||
// }
|
||||
|
||||
}
|
||||
package org.bench4q.web.api;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bench4q.share.models.master.MonitorMemoryResponseModel;
|
||||
import org.bench4q.share.models.master.MonitorProcessorResponseModel;
|
||||
import org.bench4q.share.models.monitor.MemoryModel;
|
||||
import org.bench4q.share.models.monitor.ProcessorModel;
|
||||
import org.bench4q.share.models.monitor.ProcessorModelChild;
|
||||
import org.bench4q.web.exception.CustomGenericException;
|
||||
import org.bench4q.web.model.BaseResponseModel;
|
||||
import org.bench4q.web.model.ResultModel;
|
||||
import org.bench4q.web.service.ChangeToResultModel;
|
||||
import org.bench4q.web.service.MonitorService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.SessionAttributes;
|
||||
|
||||
@Controller
|
||||
@SessionAttributes({ "accessToken" })
|
||||
public class MonitorController {
|
||||
private Logger logger = Logger.getLogger(MonitorService.class);
|
||||
private MonitorService monitorService;
|
||||
|
||||
public MonitorService getMonitorService() {
|
||||
return monitorService;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setMonitorService(MonitorService monitorService) {
|
||||
this.monitorService = monitorService;
|
||||
}
|
||||
|
||||
@RequestMapping("/{testPlanId}/SUT/{ip}/{port}/cpu/{cpuInstance}/{fieldName}/{startTime}")
|
||||
@ResponseBody
|
||||
public BaseResponseModel getCpuResult(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@PathVariable("testPlanId") String testplanID,
|
||||
@PathVariable String ip, @PathVariable String port,
|
||||
@PathVariable String cpuInstance, @PathVariable String fieldName,
|
||||
@PathVariable String startTime) throws CustomGenericException {
|
||||
MonitorProcessorResponseModel monitorProcessorResponseModel = this
|
||||
.getMonitorService().getCpus(accessToken, testplanID, ip, port,
|
||||
startTime);
|
||||
String source = "MonitorController:getCpuResult";
|
||||
try {
|
||||
List<ResultModel> resultModels = extractCpuResultModelList(
|
||||
monitorProcessorResponseModel.getProcessorModels(),
|
||||
cpuInstance, fieldName);
|
||||
if (resultModels == null)
|
||||
return new BaseResponseModel(false, "empty data");
|
||||
else {
|
||||
return new BaseResponseModel(true, resultModels);
|
||||
}
|
||||
} catch (NoSuchFieldException e) {
|
||||
logger.info(e.getStackTrace());
|
||||
logger.info("get cpu info error :no such field:" + e.getCause());
|
||||
logger.info("monitorController:getCpu_" + fieldName);
|
||||
throw new CustomGenericException("5",
|
||||
"get cpu info error :no such field:" + fieldName,
|
||||
"monitorController:getCpu_" + fieldName);
|
||||
} catch (IllegalArgumentException e) {
|
||||
|
||||
throw new CustomGenericException("5", e.getMessage(), source);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping("/testPlanId/SUT/{ip}/{port}/memory/{fieldName}/{startTime}")
|
||||
@ResponseBody
|
||||
public BaseResponseModel geMemoryStatus(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@PathVariable("testPlanId") String testPlanId,
|
||||
@RequestParam String ip, @RequestParam String port,
|
||||
@PathVariable String fieldName, @PathVariable String startTime)
|
||||
throws CustomGenericException {
|
||||
|
||||
String source = "MonitorController:getMemoryStatus";
|
||||
try {
|
||||
|
||||
MonitorMemoryResponseModel monitorMemoryResponseModel = this
|
||||
.getMonitorService().getMemoryResponseModel(accessToken,
|
||||
testPlanId, ip, port, startTime);
|
||||
List<ResultModel> resultModels = extractResultModelList(
|
||||
monitorMemoryResponseModel.getMemoryModels(), fieldName);
|
||||
if (resultModels == null)
|
||||
return new BaseResponseModel(false, "empty data");
|
||||
else
|
||||
return new BaseResponseModel(true, resultModels);
|
||||
} catch (NoSuchFieldException e) {
|
||||
logger.info(e.getStackTrace());
|
||||
logger.info("get Memory info error :no such field:" + e.getCause());
|
||||
logger.info(source + "_" + fieldName);
|
||||
throw new CustomGenericException("5",
|
||||
"get memory info error :no such field:" + fieldName, source
|
||||
+ "_" + fieldName);
|
||||
}
|
||||
}
|
||||
|
||||
// @RequestMapping("/testPlanIds/SUT/{ip}/{port}/network/{instance}/{fieldName}/{startTime}")
|
||||
// @ResponseBody
|
||||
// public BaseResponseModel getNetwor(
|
||||
// @ModelAttribute("accessToken") String accessToken,
|
||||
// @PathVariable("testPlanId") String testplanID,
|
||||
// @PathVariable String ip, @PathVariable String port,
|
||||
// @PathVariable String instance, @PathVariable String fieldName,
|
||||
// @PathVariable String startTime) throws CustomGenericException{
|
||||
// String source = "MonitorController:getNetwork";
|
||||
// try {
|
||||
// MonitorNetworkReponseModel monitorResponseModel = this
|
||||
// .getMonitorService().getNetworks(accessToken, testplanID,
|
||||
// ip, port, startTime);
|
||||
//
|
||||
// List<ResultModel> resultModels = extractNetworkResultModelList(
|
||||
// monitorResponseModel.getModels(), instance, fieldName);
|
||||
// if (resultModels == null)
|
||||
// return new BaseResponseModel(false, "empty data");
|
||||
// else
|
||||
// return new BaseResponseModel(true, resultModels);
|
||||
// } catch (NoSuchFieldException e) {
|
||||
// logger.info("get network info error :no such field:" + e.getCause());
|
||||
// logger.info(source + "_" + fieldName);
|
||||
// throw new CustomGenericException("5",
|
||||
// "get network info error :no such field:" + fieldName,
|
||||
// source + "_" + fieldName);
|
||||
// } catch (IllegalArgumentException e) {
|
||||
// throw new CustomGenericException("5", e.getMessage(), source);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
private List<ResultModel> extractCpuResultModelList(
|
||||
List<ProcessorModel> processorModels, String instance,
|
||||
String fieldName) throws NoSuchFieldException,
|
||||
IllegalArgumentException {
|
||||
if (processorModels == null)
|
||||
return null;
|
||||
List<ResultModel> resultModels = new ArrayList<ResultModel>();
|
||||
for (ProcessorModel processorModel : processorModels) {
|
||||
if (processorModel != null) {
|
||||
ResultModel resultModel = extractResultModel(processorModel,
|
||||
instance, fieldName);
|
||||
if (resultModel != null)
|
||||
resultModels.add(resultModel);
|
||||
}
|
||||
|
||||
}
|
||||
return resultModels;
|
||||
}
|
||||
|
||||
private List<ResultModel> extractResultModelList(
|
||||
List<MemoryModel> memoryModels, String fieldName)
|
||||
throws NoSuchFieldException {
|
||||
if (memoryModels == null)
|
||||
return null;
|
||||
List<ResultModel> resultModels = new ArrayList<ResultModel>();
|
||||
List<String> fieldNames = new ArrayList<String>();
|
||||
fieldNames.add(fieldName);
|
||||
for (MemoryModel memoryModel : memoryModels) {
|
||||
if (memoryModel != null) {
|
||||
ResultModel resultModel = ChangeToResultModel.getResultModel(
|
||||
MemoryModel.class, fieldNames);
|
||||
resultModel.setTime(memoryModel.getSamplingTime());
|
||||
resultModels.add(resultModel);
|
||||
}
|
||||
}
|
||||
return resultModels;
|
||||
}
|
||||
|
||||
// private List<ResultModel> extractNetworkResultModelList(
|
||||
// List<NetworkInterfaceModel> networkInterfaceModels,
|
||||
// String instance, String fieldName) throws NoSuchFieldException,
|
||||
// IllegalArgumentException {
|
||||
// if (networkInterfaceModels == null)
|
||||
// return null;
|
||||
// List<ResultModel> resultModels = new ArrayList<ResultModel>();
|
||||
//
|
||||
// for (NetworkInterfaceModel networkInterfaceModel :
|
||||
// networkInterfaceModels) {
|
||||
// if (networkInterfaceModel != null) {
|
||||
// ResultModel resultModel = extractResultModel(
|
||||
// networkInterfaceModel, instance, fieldName);
|
||||
// if (resultModel != null)
|
||||
// resultModels.add(resultModel);
|
||||
// }
|
||||
// }
|
||||
// return resultModels;
|
||||
// }
|
||||
|
||||
private ResultModel extractResultModel(ProcessorModel processorModel,
|
||||
String instance, String fieldName) throws NoSuchFieldException,
|
||||
IllegalArgumentException {
|
||||
String source = "MonitorController:extractResultModel";
|
||||
List<String> fieldNames = new ArrayList<String>();
|
||||
fieldNames.add(fieldName);
|
||||
|
||||
for (ProcessorModelChild processorModelChild : processorModel
|
||||
.getProcessorModelList()) {
|
||||
|
||||
if (processorModelChild.getInstance().equalsIgnoreCase(instance)) {
|
||||
ResultModel resultModel = ChangeToResultModel.getResultModel(
|
||||
processorModelChild, fieldNames);
|
||||
resultModel.setFinished(false);
|
||||
resultModel.setTime(processorModel.getSamplingTime());
|
||||
return resultModel;
|
||||
}
|
||||
}
|
||||
logger.info("no such cpu instance:" + instance + "_" + source);
|
||||
throw new IllegalArgumentException("no such cpu instance:" + instance);
|
||||
}
|
||||
|
||||
// private ResultModel extractResultModel(
|
||||
// NetworkInterfaceModel networkInterfaceModel, String instance,
|
||||
// String fieldName) throws NoSuchFieldException {
|
||||
//
|
||||
// String source = "MonitorController:extractResultModel";
|
||||
// List<String> fieldNames = new ArrayList<String>();
|
||||
// fieldNames.add(fieldName);
|
||||
//
|
||||
// for (NetworkInterfaceModelChild networkInterfaceModelChild :
|
||||
// networkInterfaceModel
|
||||
// .getNetworkList()) {
|
||||
//
|
||||
// if (networkInterfaceModelChild.getInstance().equalsIgnoreCase(
|
||||
// instance)) {
|
||||
// ResultModel resultModel = ChangeToResultModel.getResultModel(
|
||||
// networkInterfaceModelChild, fieldNames);
|
||||
// resultModel.setFinished(false);
|
||||
// resultModel.setTime(networkInterfaceModel.getSamplingTime());
|
||||
// return resultModel;
|
||||
// }
|
||||
// }
|
||||
// logger.info("no such network instance:" + instance + "_" + source);
|
||||
// throw new IllegalArgumentException("no such network instance:"
|
||||
// + instance);
|
||||
// }
|
||||
|
||||
}
|
|
@ -1,171 +1,171 @@
|
|||
package org.bench4q.web.api;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bench4q.share.helper.MarshalHelper;
|
||||
import org.bench4q.share.models.master.plugin.MethodParamModel;
|
||||
import org.bench4q.share.models.master.plugin.PluginResponseModel;
|
||||
import org.bench4q.web.exception.CustomGenericException;
|
||||
import org.bench4q.web.model.BaseResponseModel;
|
||||
import org.bench4q.web.model.UploadBehaviorRequestModel;
|
||||
import org.bench4q.web.service.BaseService;
|
||||
import org.bench4q.web.service.CommunicateWithMaster;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.SessionAttributes;
|
||||
|
||||
@Controller
|
||||
@SessionAttributes({"accessToken","loadMethod"})
|
||||
public class PluginActionController {
|
||||
|
||||
private final String baseUrl = "plugin";
|
||||
private final String BASECALLER = "PluginActionController:";
|
||||
private CommunicateWithMaster communicateWithMaster;
|
||||
|
||||
public CommunicateWithMaster getCommunicateWithMaster() {
|
||||
return communicateWithMaster;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setCommunicateWithMaster(
|
||||
CommunicateWithMaster communicateWithMaster) {
|
||||
this.communicateWithMaster = communicateWithMaster;
|
||||
}
|
||||
|
||||
public String getBaseUrl() {
|
||||
return baseUrl;
|
||||
}
|
||||
|
||||
public String getBASECALLER() {
|
||||
return BASECALLER;
|
||||
}
|
||||
|
||||
@RequestMapping("loadPlugin")
|
||||
public @ResponseBody
|
||||
BaseResponseModel loadPlugin(HttpServletRequest request,
|
||||
@ModelAttribute("accessToken") String accessToken)
|
||||
throws CustomGenericException {
|
||||
System.out.println("loadPluginList!!");
|
||||
String caller = new String("PluginActionController:loadPlugin");
|
||||
String url = this.getBaseUrl() + "/loadPluginList";
|
||||
PluginResponseModel pluginResponseModel = (PluginResponseModel) this
|
||||
.getCommunicateWithMaster().getResponseModel(accessToken, url,
|
||||
PluginResponseModel.class, null, caller);
|
||||
try {
|
||||
Logger.getLogger(PluginActionController.class).info(MarshalHelper.marshal(PluginResponseModel.class, pluginResponseModel));
|
||||
} catch (JAXBException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (pluginResponseModel.isSuccess()) {
|
||||
System.out.println("pluginResponseModel has been used");
|
||||
List<String> pluginList = pluginResponseModel.getPluginList();
|
||||
//System.out.println(pluginList.size());
|
||||
if (pluginList == null) {
|
||||
pluginList = new ArrayList<String>();
|
||||
System.out.println("pluginList is empty");
|
||||
}
|
||||
return new BaseResponseModel(true, pluginList);
|
||||
} else {
|
||||
return new BaseResponseModel(false,
|
||||
pluginResponseModel.getFailMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping("loadMethod")
|
||||
public @ResponseBody
|
||||
BaseResponseModel loadMethod(HttpServletRequest request,
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@RequestParam String pluginName) throws CustomGenericException {
|
||||
|
||||
System.out.println("loadMethodList!!");
|
||||
String caller = new String("PluginActionController:loadMethodList");
|
||||
String url = this.getBaseUrl() + "/loadMethodList/" + pluginName;
|
||||
Map<String, String> params = BaseService.makeParamsMap("pluginName",
|
||||
pluginName);
|
||||
PluginResponseModel pluginResponseModel = (PluginResponseModel) this
|
||||
.getCommunicateWithMaster().getResponseModel(accessToken, url,
|
||||
PluginResponseModel.class, params, caller);
|
||||
|
||||
try {
|
||||
Logger.getLogger(PluginActionController.class).info(MarshalHelper.marshal(PluginResponseModel.class, pluginResponseModel));
|
||||
} catch (JAXBException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (pluginResponseModel.isSuccess()) {
|
||||
System.out.println("pluginResponseModel has been used");
|
||||
List<String> methodList = pluginResponseModel.getMethodList();
|
||||
if (methodList == null) {
|
||||
methodList = new ArrayList<String>();
|
||||
System.out.println("methodList is empty");
|
||||
}
|
||||
return new BaseResponseModel(true, methodList);
|
||||
} else {
|
||||
return new BaseResponseModel(false,
|
||||
pluginResponseModel.getFailMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping("loadMethodParameters")
|
||||
public @ResponseBody
|
||||
BaseResponseModel loadMethodParameters(HttpServletRequest request,
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@RequestParam String pluginName, @RequestParam String methodName)
|
||||
throws CustomGenericException {
|
||||
|
||||
System.out.println("loadMethodParameters!!");
|
||||
String caller = new String(
|
||||
"PluginActionController:loadMethodParameters");
|
||||
String url = this.getBaseUrl() + "/loadMethodParams/" + pluginName
|
||||
+ "/" + methodName;
|
||||
|
||||
Map<String, String> params = BaseService.makeParamsMap("pluginName",
|
||||
pluginName);
|
||||
params.put("methodName", methodName);
|
||||
|
||||
PluginResponseModel pluginResponseModel = (PluginResponseModel) this
|
||||
.getCommunicateWithMaster().getResponseModel(accessToken, url,
|
||||
PluginResponseModel.class, params, caller);
|
||||
|
||||
if (pluginResponseModel.isSuccess()) {
|
||||
System.out.println("pluginResponseModel has been used");
|
||||
Set<MethodParamModel> methodParamSet = pluginResponseModel
|
||||
.getMethosMethodParamModels();
|
||||
if (methodParamSet == null) {
|
||||
methodParamSet = new HashSet<MethodParamModel>();
|
||||
}
|
||||
return new BaseResponseModel(true, methodParamSet);
|
||||
} else {
|
||||
return new BaseResponseModel(false,
|
||||
pluginResponseModel.getFailMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "uploadBehavior", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public BaseResponseModel runTestPlan(
|
||||
@ModelAttribute("accessToken") String accessToken, ModelMap model,
|
||||
@RequestBody UploadBehaviorRequestModel uploadBehaviorRequestModel)
|
||||
throws CustomGenericException {
|
||||
|
||||
|
||||
return new BaseResponseModel(true);
|
||||
}
|
||||
|
||||
}
|
||||
package org.bench4q.web.api;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bench4q.share.helper.MarshalHelper;
|
||||
import org.bench4q.share.models.master.plugin.MethodParamModel;
|
||||
import org.bench4q.share.models.master.plugin.PluginResponseModel;
|
||||
import org.bench4q.web.exception.CustomGenericException;
|
||||
import org.bench4q.web.model.BaseResponseModel;
|
||||
import org.bench4q.web.model.UploadBehaviorRequestModel;
|
||||
import org.bench4q.web.service.BaseService;
|
||||
import org.bench4q.web.service.CommunicateWithMaster;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.SessionAttributes;
|
||||
|
||||
@Controller
|
||||
@SessionAttributes({"accessToken","loadMethod"})
|
||||
public class PluginActionController {
|
||||
|
||||
private final String baseUrl = "plugin";
|
||||
private final String BASECALLER = "PluginActionController:";
|
||||
private CommunicateWithMaster communicateWithMaster;
|
||||
|
||||
public CommunicateWithMaster getCommunicateWithMaster() {
|
||||
return communicateWithMaster;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setCommunicateWithMaster(
|
||||
CommunicateWithMaster communicateWithMaster) {
|
||||
this.communicateWithMaster = communicateWithMaster;
|
||||
}
|
||||
|
||||
public String getBaseUrl() {
|
||||
return baseUrl;
|
||||
}
|
||||
|
||||
public String getBASECALLER() {
|
||||
return BASECALLER;
|
||||
}
|
||||
|
||||
@RequestMapping("loadPlugin")
|
||||
public @ResponseBody
|
||||
BaseResponseModel loadPlugin(HttpServletRequest request,
|
||||
@ModelAttribute("accessToken") String accessToken)
|
||||
throws CustomGenericException {
|
||||
System.out.println("loadPluginList!!");
|
||||
String caller = new String("PluginActionController:loadPlugin");
|
||||
String url = this.getBaseUrl() + "/loadPluginList";
|
||||
PluginResponseModel pluginResponseModel = (PluginResponseModel) this
|
||||
.getCommunicateWithMaster().getResponseModel(accessToken, url,
|
||||
PluginResponseModel.class, null, caller);
|
||||
try {
|
||||
Logger.getLogger(PluginActionController.class).info(MarshalHelper.marshal(PluginResponseModel.class, pluginResponseModel));
|
||||
} catch (JAXBException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (pluginResponseModel.isSuccess()) {
|
||||
System.out.println("pluginResponseModel has been used");
|
||||
List<String> pluginList = pluginResponseModel.getPluginList();
|
||||
//System.out.println(pluginList.size());
|
||||
if (pluginList == null) {
|
||||
pluginList = new ArrayList<String>();
|
||||
System.out.println("pluginList is empty");
|
||||
}
|
||||
return new BaseResponseModel(true, pluginList);
|
||||
} else {
|
||||
return new BaseResponseModel(false,
|
||||
pluginResponseModel.getFailMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping("loadMethod")
|
||||
public @ResponseBody
|
||||
BaseResponseModel loadMethod(HttpServletRequest request,
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@RequestParam String pluginName) throws CustomGenericException {
|
||||
|
||||
System.out.println("loadMethodList!!");
|
||||
String caller = new String("PluginActionController:loadMethodList");
|
||||
String url = this.getBaseUrl() + "/loadMethodList/" + pluginName;
|
||||
Map<String, String> params = BaseService.makeParamsMap("pluginName",
|
||||
pluginName);
|
||||
PluginResponseModel pluginResponseModel = (PluginResponseModel) this
|
||||
.getCommunicateWithMaster().getResponseModel(accessToken, url,
|
||||
PluginResponseModel.class, params, caller);
|
||||
|
||||
try {
|
||||
Logger.getLogger(PluginActionController.class).info(MarshalHelper.marshal(PluginResponseModel.class, pluginResponseModel));
|
||||
} catch (JAXBException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (pluginResponseModel.isSuccess()) {
|
||||
System.out.println("pluginResponseModel has been used");
|
||||
List<String> methodList = pluginResponseModel.getMethodList();
|
||||
if (methodList == null) {
|
||||
methodList = new ArrayList<String>();
|
||||
System.out.println("methodList is empty");
|
||||
}
|
||||
return new BaseResponseModel(true, methodList);
|
||||
} else {
|
||||
return new BaseResponseModel(false,
|
||||
pluginResponseModel.getFailMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping("loadMethodParameters")
|
||||
public @ResponseBody
|
||||
BaseResponseModel loadMethodParameters(HttpServletRequest request,
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@RequestParam String pluginName, @RequestParam String methodName)
|
||||
throws CustomGenericException {
|
||||
|
||||
System.out.println("loadMethodParameters!!");
|
||||
String caller = new String(
|
||||
"PluginActionController:loadMethodParameters");
|
||||
String url = this.getBaseUrl() + "/loadMethodParams/" + pluginName
|
||||
+ "/" + methodName;
|
||||
|
||||
Map<String, String> params = BaseService.makeParamsMap("pluginName",
|
||||
pluginName);
|
||||
params.put("methodName", methodName);
|
||||
|
||||
PluginResponseModel pluginResponseModel = (PluginResponseModel) this
|
||||
.getCommunicateWithMaster().getResponseModel(accessToken, url,
|
||||
PluginResponseModel.class, params, caller);
|
||||
|
||||
if (pluginResponseModel.isSuccess()) {
|
||||
System.out.println("pluginResponseModel has been used");
|
||||
Set<MethodParamModel> methodParamSet = pluginResponseModel
|
||||
.getMethosMethodParamModels();
|
||||
if (methodParamSet == null) {
|
||||
methodParamSet = new HashSet<MethodParamModel>();
|
||||
}
|
||||
return new BaseResponseModel(true, methodParamSet);
|
||||
} else {
|
||||
return new BaseResponseModel(false,
|
||||
pluginResponseModel.getFailMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "uploadBehavior", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public BaseResponseModel runTestPlan(
|
||||
@ModelAttribute("accessToken") String accessToken, ModelMap model,
|
||||
@RequestBody UploadBehaviorRequestModel uploadBehaviorRequestModel)
|
||||
throws CustomGenericException {
|
||||
|
||||
|
||||
return new BaseResponseModel(true);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,353 +1,353 @@
|
|||
package org.bench4q.web.api;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.xml.bind.JAXBException;
|
||||
import javax.xml.transform.Source;
|
||||
import javax.xml.transform.stream.StreamSource;
|
||||
import javax.xml.validation.Schema;
|
||||
import javax.xml.validation.SchemaFactory;
|
||||
import javax.xml.validation.Validator;
|
||||
|
||||
import org.bench4q.share.models.agent.RunScenarioModel;
|
||||
import org.bench4q.share.models.master.OperateScriptServerResponseModel;
|
||||
import org.bench4q.share.models.master.ScriptModel;
|
||||
import org.bench4q.web.exception.CustomGenericException;
|
||||
import org.bench4q.web.extractObjectFromXml.ObjectXmlExchange;
|
||||
import org.bench4q.web.model.BaseResponseModel;
|
||||
import org.bench4q.web.service.BaseService;
|
||||
import org.bench4q.web.service.ScriptService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.SessionAttributes;
|
||||
import org.springframework.web.multipart.commons.CommonsMultipartFile;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
|
||||
@Controller
|
||||
@SessionAttributes("accessToken")
|
||||
public class ScriptActionController {
|
||||
|
||||
private final String baseUrl = "RecordScript";
|
||||
private ScriptService scriptService;
|
||||
private final String BASECALLER = "ScriptActionController:";
|
||||
|
||||
private String getBaseUrl() {
|
||||
return baseUrl;
|
||||
}
|
||||
|
||||
private ScriptService getScriptService() {
|
||||
return scriptService;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private void setScriptService(ScriptService scriptService) {
|
||||
this.scriptService = scriptService;
|
||||
}
|
||||
|
||||
@RequestMapping("loadScript")
|
||||
public @ResponseBody
|
||||
BaseResponseModel loadScript(
|
||||
@ModelAttribute("accessToken") String accessToken)
|
||||
throws CustomGenericException {
|
||||
String caller = "ScriptActionController:loadScripts";
|
||||
OperateScriptServerResponseModel operateScriptServerResponseModel = (OperateScriptServerResponseModel) this
|
||||
.getScriptService()
|
||||
.getCommunicateWithMaster()
|
||||
.getResponseModel(accessToken,
|
||||
this.getBaseUrl() + "/loadScriptList",
|
||||
OperateScriptServerResponseModel.class, null, caller);
|
||||
|
||||
if (operateScriptServerResponseModel.isSuccess()) {
|
||||
List<ScriptModel> scripts = operateScriptServerResponseModel
|
||||
.getScriptModels();
|
||||
if(scripts==null)
|
||||
scripts=new ArrayList<ScriptModel>();
|
||||
return new BaseResponseModel(true, scripts);
|
||||
} else {
|
||||
|
||||
return new BaseResponseModel(false,
|
||||
operateScriptServerResponseModel.getFailCauseString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping("deleteScript")
|
||||
public @ResponseBody
|
||||
BaseResponseModel deletescript(HttpServletRequest request,
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@RequestParam String scriptId) throws CustomGenericException {
|
||||
String caller = new String("ScriptActionComntroller:deleteScript");
|
||||
String url = this.getBaseUrl() + "/deleteScript";
|
||||
Map<String, String> params = BaseService.makeParamsMap("scriptId", scriptId);
|
||||
OperateScriptServerResponseModel operateScriptServerResponseModel = (OperateScriptServerResponseModel) this
|
||||
.getScriptService()
|
||||
.getCommunicateWithMaster()
|
||||
.getResponseModel(accessToken, url,
|
||||
OperateScriptServerResponseModel.class, params, caller);
|
||||
if (operateScriptServerResponseModel.isSuccess()) {
|
||||
return new BaseResponseModel(true);
|
||||
} else
|
||||
return new BaseResponseModel(false,
|
||||
operateScriptServerResponseModel.getFailCauseString());
|
||||
}
|
||||
|
||||
@RequestMapping("editScript")
|
||||
public @ResponseBody
|
||||
BaseResponseModel editScript(HttpServletRequest request,
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@RequestParam String scriptId) throws CustomGenericException {
|
||||
String caller = this.BASECALLER + "editScript";
|
||||
String url = this.getBaseUrl() + "/queryScriptById";
|
||||
Map<String, String> params = BaseService.makeParamsMap("scriptId", scriptId);
|
||||
OperateScriptServerResponseModel operateScriptServerResponseModel = (OperateScriptServerResponseModel) this
|
||||
.getScriptService()
|
||||
.getCommunicateWithMaster()
|
||||
.getResponseModel(accessToken, url,
|
||||
OperateScriptServerResponseModel.class, params, caller);
|
||||
|
||||
if (operateScriptServerResponseModel.isSuccess()) {
|
||||
List<ScriptModel> scripts = operateScriptServerResponseModel
|
||||
.getScriptModels();
|
||||
if (scripts == null || scripts.isEmpty())
|
||||
return new BaseResponseModel(false, "data empty");
|
||||
else {
|
||||
Iterator<ScriptModel> it = scripts.iterator();
|
||||
ScriptModel script = it.next();
|
||||
if (script.getScriptContent() == null
|
||||
|| script.getScriptContent().isEmpty())
|
||||
return new BaseResponseModel(false, "data empty");
|
||||
else {
|
||||
try {
|
||||
RunScenarioModel result = (RunScenarioModel) ObjectXmlExchange
|
||||
.fromXml(RunScenarioModel.class,
|
||||
script.getScriptContent());
|
||||
Gson gson = new Gson();
|
||||
String scriptContent = null;
|
||||
scriptContent = gson.toJson(result);
|
||||
return new BaseResponseModel(true,
|
||||
(Object) scriptContent);
|
||||
} catch (JAXBException e) {
|
||||
throw new CustomGenericException("1",
|
||||
"script content is invalidate", caller);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else
|
||||
return new BaseResponseModel(false,
|
||||
operateScriptServerResponseModel.getFailCauseString());
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping("saveEditScript")
|
||||
public @ResponseBody
|
||||
BaseResponseModel saveScript(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@RequestParam String scriptId, @RequestParam String script)
|
||||
throws CustomGenericException {
|
||||
String url = this.getBaseUrl() + "/updateScript";
|
||||
String caller = this.BASECALLER + "saveScript";
|
||||
Gson gson = new Gson();
|
||||
RunScenarioModel scriptModel = gson.fromJson(script,
|
||||
RunScenarioModel.class);
|
||||
try{
|
||||
String scriptContent = ObjectXmlExchange.toXml(RunScenarioModel.class,
|
||||
scriptModel);
|
||||
Map<String, String> params = BaseService.makeParamsMap("scriptId", scriptId);
|
||||
params.put("content", scriptContent);
|
||||
|
||||
OperateScriptServerResponseModel operateScriptServerResponseModel = (OperateScriptServerResponseModel) this
|
||||
.getScriptService()
|
||||
.getCommunicateWithMaster()
|
||||
.getResponseModel(accessToken, url,
|
||||
OperateScriptServerResponseModel.class, params, caller);
|
||||
if (operateScriptServerResponseModel.isSuccess()) {
|
||||
return new BaseResponseModel(true);
|
||||
} else
|
||||
return new BaseResponseModel(false,
|
||||
operateScriptServerResponseModel.getFailCauseString());
|
||||
}
|
||||
catch(JAXBException e){
|
||||
return new BaseResponseModel(false,e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping("startRecordServer")
|
||||
public @ResponseBody
|
||||
BaseResponseModel startRecordServer(
|
||||
@ModelAttribute("accessToken") String accessToken)
|
||||
throws JAXBException, CustomGenericException {
|
||||
String url = this.getBaseUrl() + "/startScriptRecordServer";
|
||||
String caller = BASECALLER + "startRecordServer";
|
||||
OperateScriptServerResponseModel operateScriptServerResponseModel = (OperateScriptServerResponseModel) this
|
||||
.getScriptService()
|
||||
.getCommunicateWithMaster()
|
||||
.getResponseModel(accessToken, url,
|
||||
OperateScriptServerResponseModel.class, null, caller);
|
||||
|
||||
if (operateScriptServerResponseModel.isSuccess())
|
||||
return new BaseResponseModel(true,
|
||||
operateScriptServerResponseModel);
|
||||
else
|
||||
return new BaseResponseModel(false,
|
||||
operateScriptServerResponseModel.getFailCauseString());
|
||||
}
|
||||
|
||||
@RequestMapping("stopRecordServer")
|
||||
public @ResponseBody
|
||||
BaseResponseModel stopRecordServer(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@RequestParam String port, @RequestParam String fileNameUUID)
|
||||
throws CustomGenericException {
|
||||
String caller = BASECALLER + "stopeRecordServer";
|
||||
String url = this.getBaseUrl() + "/stopScriptRecordServer";
|
||||
Map<String, String> params = BaseService.makeParamsMap("port", port);
|
||||
params.put("fileNameUUID", fileNameUUID);
|
||||
OperateScriptServerResponseModel operateScriptServerResponseModel = (OperateScriptServerResponseModel) this
|
||||
.getScriptService()
|
||||
.getCommunicateWithMaster()
|
||||
.getResponseModel(accessToken, url,
|
||||
OperateScriptServerResponseModel.class, params, caller);
|
||||
if (operateScriptServerResponseModel.isSuccess())
|
||||
return new BaseResponseModel(true);
|
||||
else
|
||||
return new BaseResponseModel(false,
|
||||
operateScriptServerResponseModel.getFailCauseString());
|
||||
}
|
||||
|
||||
@RequestMapping("saveRecordScript")
|
||||
public @ResponseBody
|
||||
BaseResponseModel saveScriptToDB(HttpServletRequest request,
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@RequestParam String port, @RequestParam String scriptName,
|
||||
@RequestParam String fileNameUUID) throws CustomGenericException {
|
||||
String caller = BASECALLER + "saveRecordScript";
|
||||
String url = this.getBaseUrl() + "/saveScriptToDB";
|
||||
Map<String, String> params = BaseService.makeParamsMap("scriptName",
|
||||
scriptName);
|
||||
params.put("port", port);
|
||||
params.put("fileNameUUID", fileNameUUID);
|
||||
|
||||
OperateScriptServerResponseModel operateScriptServerResponseModel = (OperateScriptServerResponseModel) this
|
||||
.getScriptService()
|
||||
.getCommunicateWithMaster()
|
||||
.getResponseModel(accessToken, url,
|
||||
OperateScriptServerResponseModel.class, params, caller);
|
||||
if (operateScriptServerResponseModel.isSuccess())
|
||||
return new BaseResponseModel(true);
|
||||
else
|
||||
return new BaseResponseModel(false,
|
||||
operateScriptServerResponseModel.getFailCauseString());
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping("uploadScript")
|
||||
@ResponseBody
|
||||
public BaseResponseModel uploadScript(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@RequestParam("script") CommonsMultipartFile script,
|
||||
@RequestParam String scriptName) throws CustomGenericException {
|
||||
String caller=BASECALLER+"uploadScript";
|
||||
String url=this.getBaseUrl()+"/uploadScript"+"/"+scriptName;
|
||||
if (script.isEmpty()) {
|
||||
return new BaseResponseModel(false,"empty file");
|
||||
}
|
||||
if (scriptName == null || scriptName.equals(""))
|
||||
return new BaseResponseModel(false,"empty file name");
|
||||
try{
|
||||
String scenarioModel = new String(script.getBytes());
|
||||
ObjectXmlExchange.fromXml(RunScenarioModel.class, scenarioModel);
|
||||
OperateScriptServerResponseModel operateScriptServerResponseModel=
|
||||
(OperateScriptServerResponseModel)this.getScriptService().
|
||||
getCommunicateWithMaster().getResponseModelByPut(accessToken, url, scenarioModel, OperateScriptServerResponseModel.class, caller);
|
||||
if (operateScriptServerResponseModel.isSuccess())
|
||||
return new BaseResponseModel(true,(Object)new String("upload script:" + scriptName + " success!"));
|
||||
|
||||
else
|
||||
return new BaseResponseModel(false,operateScriptServerResponseModel.getFailCauseString());
|
||||
} catch (JAXBException e) {
|
||||
return new BaseResponseModel(false,"Failed:invalidated script file!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping("validateScript")
|
||||
public @ResponseBody
|
||||
String validateScript(@ModelAttribute("accessToken") String accessToken,
|
||||
@RequestParam String content) {
|
||||
String result;
|
||||
String message = "";
|
||||
String schemaFileName = "src/main/webapp/WEB-INF/validateScript.xsd";
|
||||
content = content.replace("runScenario", "runscenario")
|
||||
.replace("poolSize", "poolsize")
|
||||
.replace("usePlugin", "useplugin")
|
||||
.replace("userBehavior", "userbehavior")
|
||||
.replace("timerBehavior", "timerbehavior")
|
||||
.replace("userbehaviors", "behaviors");
|
||||
try {
|
||||
result = validateXmlWithSchema(schemaFileName, content);
|
||||
if (result == "true") {
|
||||
message = "Success";
|
||||
} else {
|
||||
message = URLEncoder.encode(result, "UTF-8").replace("+", "");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("analysis of failure:" + e.toString());
|
||||
message = "failed to read schema file";
|
||||
}
|
||||
// System.out.println(message);
|
||||
return message;
|
||||
}
|
||||
|
||||
private String validateXmlWithSchema(String schemaFileName, String xmlScript)
|
||||
throws SAXException, IOException {
|
||||
String validationResult = "";
|
||||
SchemaFactory schemaFactory = SchemaFactory
|
||||
.newInstance("http://www.w3.org/2001/XMLSchema");
|
||||
File schemaFile = new File(schemaFileName);
|
||||
Schema schema = schemaFactory.newSchema(schemaFile);
|
||||
Validator validator = schema.newValidator();
|
||||
InputStream script = new ByteArrayInputStream(xmlScript.getBytes());
|
||||
Source source = new StreamSource(script);
|
||||
try {
|
||||
// System.out.println("enter validateXmlWithSchema");
|
||||
validator.validate(source);
|
||||
validationResult = "true";
|
||||
} catch (Exception ex) {
|
||||
validationResult = ex.toString();
|
||||
}
|
||||
return validationResult;
|
||||
}
|
||||
|
||||
@RequestMapping("readSchemaContent")
|
||||
public @ResponseBody
|
||||
String readSchemaContent() throws Exception {
|
||||
String schema = "";
|
||||
FileReader fr = new FileReader("src/main/webapp/WEB-INF/schema.json");
|
||||
BufferedReader br = new BufferedReader(fr);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
while ((schema = br.readLine()) != null) {
|
||||
sb.append(schema);
|
||||
}
|
||||
br.close();
|
||||
String str = sb.toString();
|
||||
return str;
|
||||
}
|
||||
|
||||
}
|
||||
package org.bench4q.web.api;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.xml.bind.JAXBException;
|
||||
import javax.xml.transform.Source;
|
||||
import javax.xml.transform.stream.StreamSource;
|
||||
import javax.xml.validation.Schema;
|
||||
import javax.xml.validation.SchemaFactory;
|
||||
import javax.xml.validation.Validator;
|
||||
|
||||
import org.bench4q.share.models.agent.RunScenarioModel;
|
||||
import org.bench4q.share.models.master.OperateScriptServerResponseModel;
|
||||
import org.bench4q.share.models.master.ScriptModel;
|
||||
import org.bench4q.web.exception.CustomGenericException;
|
||||
import org.bench4q.web.extractObjectFromXml.ObjectXmlExchange;
|
||||
import org.bench4q.web.model.BaseResponseModel;
|
||||
import org.bench4q.web.service.BaseService;
|
||||
import org.bench4q.web.service.ScriptService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.SessionAttributes;
|
||||
import org.springframework.web.multipart.commons.CommonsMultipartFile;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
|
||||
@Controller
|
||||
@SessionAttributes("accessToken")
|
||||
public class ScriptActionController {
|
||||
|
||||
private final String baseUrl = "RecordScript";
|
||||
private ScriptService scriptService;
|
||||
private final String BASECALLER = "ScriptActionController:";
|
||||
|
||||
private String getBaseUrl() {
|
||||
return baseUrl;
|
||||
}
|
||||
|
||||
private ScriptService getScriptService() {
|
||||
return scriptService;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private void setScriptService(ScriptService scriptService) {
|
||||
this.scriptService = scriptService;
|
||||
}
|
||||
|
||||
@RequestMapping("loadScript")
|
||||
public @ResponseBody
|
||||
BaseResponseModel loadScript(
|
||||
@ModelAttribute("accessToken") String accessToken)
|
||||
throws CustomGenericException {
|
||||
String caller = "ScriptActionController:loadScripts";
|
||||
OperateScriptServerResponseModel operateScriptServerResponseModel = (OperateScriptServerResponseModel) this
|
||||
.getScriptService()
|
||||
.getCommunicateWithMaster()
|
||||
.getResponseModel(accessToken,
|
||||
this.getBaseUrl() + "/loadScriptList",
|
||||
OperateScriptServerResponseModel.class, null, caller);
|
||||
|
||||
if (operateScriptServerResponseModel.isSuccess()) {
|
||||
List<ScriptModel> scripts = operateScriptServerResponseModel
|
||||
.getScriptModels();
|
||||
if(scripts==null)
|
||||
scripts=new ArrayList<ScriptModel>();
|
||||
return new BaseResponseModel(true, scripts);
|
||||
} else {
|
||||
|
||||
return new BaseResponseModel(false,
|
||||
operateScriptServerResponseModel.getFailCauseString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping("deleteScript")
|
||||
public @ResponseBody
|
||||
BaseResponseModel deletescript(HttpServletRequest request,
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@RequestParam String scriptId) throws CustomGenericException {
|
||||
String caller = new String("ScriptActionComntroller:deleteScript");
|
||||
String url = this.getBaseUrl() + "/deleteScript";
|
||||
Map<String, String> params = BaseService.makeParamsMap("scriptId", scriptId);
|
||||
OperateScriptServerResponseModel operateScriptServerResponseModel = (OperateScriptServerResponseModel) this
|
||||
.getScriptService()
|
||||
.getCommunicateWithMaster()
|
||||
.getResponseModel(accessToken, url,
|
||||
OperateScriptServerResponseModel.class, params, caller);
|
||||
if (operateScriptServerResponseModel.isSuccess()) {
|
||||
return new BaseResponseModel(true);
|
||||
} else
|
||||
return new BaseResponseModel(false,
|
||||
operateScriptServerResponseModel.getFailCauseString());
|
||||
}
|
||||
|
||||
@RequestMapping("editScript")
|
||||
public @ResponseBody
|
||||
BaseResponseModel editScript(HttpServletRequest request,
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@RequestParam String scriptId) throws CustomGenericException {
|
||||
String caller = this.BASECALLER + "editScript";
|
||||
String url = this.getBaseUrl() + "/queryScriptById";
|
||||
Map<String, String> params = BaseService.makeParamsMap("scriptId", scriptId);
|
||||
OperateScriptServerResponseModel operateScriptServerResponseModel = (OperateScriptServerResponseModel) this
|
||||
.getScriptService()
|
||||
.getCommunicateWithMaster()
|
||||
.getResponseModel(accessToken, url,
|
||||
OperateScriptServerResponseModel.class, params, caller);
|
||||
|
||||
if (operateScriptServerResponseModel.isSuccess()) {
|
||||
List<ScriptModel> scripts = operateScriptServerResponseModel
|
||||
.getScriptModels();
|
||||
if (scripts == null || scripts.isEmpty())
|
||||
return new BaseResponseModel(false, "data empty");
|
||||
else {
|
||||
Iterator<ScriptModel> it = scripts.iterator();
|
||||
ScriptModel script = it.next();
|
||||
if (script.getScriptContent() == null
|
||||
|| script.getScriptContent().isEmpty())
|
||||
return new BaseResponseModel(false, "data empty");
|
||||
else {
|
||||
try {
|
||||
RunScenarioModel result = (RunScenarioModel) ObjectXmlExchange
|
||||
.fromXml(RunScenarioModel.class,
|
||||
script.getScriptContent());
|
||||
Gson gson = new Gson();
|
||||
String scriptContent = null;
|
||||
scriptContent = gson.toJson(result);
|
||||
return new BaseResponseModel(true,
|
||||
(Object) scriptContent);
|
||||
} catch (JAXBException e) {
|
||||
throw new CustomGenericException("1",
|
||||
"script content is invalidate", caller);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else
|
||||
return new BaseResponseModel(false,
|
||||
operateScriptServerResponseModel.getFailCauseString());
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping("saveEditScript")
|
||||
public @ResponseBody
|
||||
BaseResponseModel saveScript(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@RequestParam String scriptId, @RequestParam String script)
|
||||
throws CustomGenericException {
|
||||
String url = this.getBaseUrl() + "/updateScript";
|
||||
String caller = this.BASECALLER + "saveScript";
|
||||
Gson gson = new Gson();
|
||||
RunScenarioModel scriptModel = gson.fromJson(script,
|
||||
RunScenarioModel.class);
|
||||
try{
|
||||
String scriptContent = ObjectXmlExchange.toXml(RunScenarioModel.class,
|
||||
scriptModel);
|
||||
Map<String, String> params = BaseService.makeParamsMap("scriptId", scriptId);
|
||||
params.put("content", scriptContent);
|
||||
|
||||
OperateScriptServerResponseModel operateScriptServerResponseModel = (OperateScriptServerResponseModel) this
|
||||
.getScriptService()
|
||||
.getCommunicateWithMaster()
|
||||
.getResponseModel(accessToken, url,
|
||||
OperateScriptServerResponseModel.class, params, caller);
|
||||
if (operateScriptServerResponseModel.isSuccess()) {
|
||||
return new BaseResponseModel(true);
|
||||
} else
|
||||
return new BaseResponseModel(false,
|
||||
operateScriptServerResponseModel.getFailCauseString());
|
||||
}
|
||||
catch(JAXBException e){
|
||||
return new BaseResponseModel(false,e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping("startRecordServer")
|
||||
public @ResponseBody
|
||||
BaseResponseModel startRecordServer(
|
||||
@ModelAttribute("accessToken") String accessToken)
|
||||
throws JAXBException, CustomGenericException {
|
||||
String url = this.getBaseUrl() + "/startScriptRecordServer";
|
||||
String caller = BASECALLER + "startRecordServer";
|
||||
OperateScriptServerResponseModel operateScriptServerResponseModel = (OperateScriptServerResponseModel) this
|
||||
.getScriptService()
|
||||
.getCommunicateWithMaster()
|
||||
.getResponseModel(accessToken, url,
|
||||
OperateScriptServerResponseModel.class, null, caller);
|
||||
|
||||
if (operateScriptServerResponseModel.isSuccess())
|
||||
return new BaseResponseModel(true,
|
||||
operateScriptServerResponseModel);
|
||||
else
|
||||
return new BaseResponseModel(false,
|
||||
operateScriptServerResponseModel.getFailCauseString());
|
||||
}
|
||||
|
||||
@RequestMapping("stopRecordServer")
|
||||
public @ResponseBody
|
||||
BaseResponseModel stopRecordServer(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@RequestParam String port, @RequestParam String fileNameUUID)
|
||||
throws CustomGenericException {
|
||||
String caller = BASECALLER + "stopeRecordServer";
|
||||
String url = this.getBaseUrl() + "/stopScriptRecordServer";
|
||||
Map<String, String> params = BaseService.makeParamsMap("port", port);
|
||||
params.put("fileNameUUID", fileNameUUID);
|
||||
OperateScriptServerResponseModel operateScriptServerResponseModel = (OperateScriptServerResponseModel) this
|
||||
.getScriptService()
|
||||
.getCommunicateWithMaster()
|
||||
.getResponseModel(accessToken, url,
|
||||
OperateScriptServerResponseModel.class, params, caller);
|
||||
if (operateScriptServerResponseModel.isSuccess())
|
||||
return new BaseResponseModel(true);
|
||||
else
|
||||
return new BaseResponseModel(false,
|
||||
operateScriptServerResponseModel.getFailCauseString());
|
||||
}
|
||||
|
||||
@RequestMapping("saveRecordScript")
|
||||
public @ResponseBody
|
||||
BaseResponseModel saveScriptToDB(HttpServletRequest request,
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@RequestParam String port, @RequestParam String scriptName,
|
||||
@RequestParam String fileNameUUID) throws CustomGenericException {
|
||||
String caller = BASECALLER + "saveRecordScript";
|
||||
String url = this.getBaseUrl() + "/saveScriptToDB";
|
||||
Map<String, String> params = BaseService.makeParamsMap("scriptName",
|
||||
scriptName);
|
||||
params.put("port", port);
|
||||
params.put("fileNameUUID", fileNameUUID);
|
||||
|
||||
OperateScriptServerResponseModel operateScriptServerResponseModel = (OperateScriptServerResponseModel) this
|
||||
.getScriptService()
|
||||
.getCommunicateWithMaster()
|
||||
.getResponseModel(accessToken, url,
|
||||
OperateScriptServerResponseModel.class, params, caller);
|
||||
if (operateScriptServerResponseModel.isSuccess())
|
||||
return new BaseResponseModel(true);
|
||||
else
|
||||
return new BaseResponseModel(false,
|
||||
operateScriptServerResponseModel.getFailCauseString());
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping("uploadScript")
|
||||
@ResponseBody
|
||||
public BaseResponseModel uploadScript(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@RequestParam("script") CommonsMultipartFile script,
|
||||
@RequestParam String scriptName) throws CustomGenericException {
|
||||
String caller=BASECALLER+"uploadScript";
|
||||
String url=this.getBaseUrl()+"/uploadScript"+"/"+scriptName;
|
||||
if (script.isEmpty()) {
|
||||
return new BaseResponseModel(false,"empty file");
|
||||
}
|
||||
if (scriptName == null || scriptName.equals(""))
|
||||
return new BaseResponseModel(false,"empty file name");
|
||||
try{
|
||||
String scenarioModel = new String(script.getBytes());
|
||||
ObjectXmlExchange.fromXml(RunScenarioModel.class, scenarioModel);
|
||||
OperateScriptServerResponseModel operateScriptServerResponseModel=
|
||||
(OperateScriptServerResponseModel)this.getScriptService().
|
||||
getCommunicateWithMaster().getResponseModelByPut(accessToken, url, scenarioModel, OperateScriptServerResponseModel.class, caller);
|
||||
if (operateScriptServerResponseModel.isSuccess())
|
||||
return new BaseResponseModel(true,(Object)new String("upload script:" + scriptName + " success!"));
|
||||
|
||||
else
|
||||
return new BaseResponseModel(false,operateScriptServerResponseModel.getFailCauseString());
|
||||
} catch (JAXBException e) {
|
||||
return new BaseResponseModel(false,"Failed:invalidated script file!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping("validateScript")
|
||||
public @ResponseBody
|
||||
String validateScript(@ModelAttribute("accessToken") String accessToken,
|
||||
@RequestParam String content) {
|
||||
String result;
|
||||
String message = "";
|
||||
String schemaFileName = "src/main/webapp/WEB-INF/validateScript.xsd";
|
||||
content = content.replace("runScenario", "runscenario")
|
||||
.replace("poolSize", "poolsize")
|
||||
.replace("usePlugin", "useplugin")
|
||||
.replace("userBehavior", "userbehavior")
|
||||
.replace("timerBehavior", "timerbehavior")
|
||||
.replace("userbehaviors", "behaviors");
|
||||
try {
|
||||
result = validateXmlWithSchema(schemaFileName, content);
|
||||
if (result == "true") {
|
||||
message = "Success";
|
||||
} else {
|
||||
message = URLEncoder.encode(result, "UTF-8").replace("+", "");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("analysis of failure:" + e.toString());
|
||||
message = "failed to read schema file";
|
||||
}
|
||||
// System.out.println(message);
|
||||
return message;
|
||||
}
|
||||
|
||||
private String validateXmlWithSchema(String schemaFileName, String xmlScript)
|
||||
throws SAXException, IOException {
|
||||
String validationResult = "";
|
||||
SchemaFactory schemaFactory = SchemaFactory
|
||||
.newInstance("http://www.w3.org/2001/XMLSchema");
|
||||
File schemaFile = new File(schemaFileName);
|
||||
Schema schema = schemaFactory.newSchema(schemaFile);
|
||||
Validator validator = schema.newValidator();
|
||||
InputStream script = new ByteArrayInputStream(xmlScript.getBytes());
|
||||
Source source = new StreamSource(script);
|
||||
try {
|
||||
// System.out.println("enter validateXmlWithSchema");
|
||||
validator.validate(source);
|
||||
validationResult = "true";
|
||||
} catch (Exception ex) {
|
||||
validationResult = ex.toString();
|
||||
}
|
||||
return validationResult;
|
||||
}
|
||||
|
||||
@RequestMapping("readSchemaContent")
|
||||
public @ResponseBody
|
||||
String readSchemaContent() throws Exception {
|
||||
String schema = "";
|
||||
FileReader fr = new FileReader("src/main/webapp/WEB-INF/schema.json");
|
||||
BufferedReader br = new BufferedReader(fr);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
while ((schema = br.readLine()) != null) {
|
||||
sb.append(schema);
|
||||
}
|
||||
br.close();
|
||||
String str = sb.toString();
|
||||
return str;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,489 +1,489 @@
|
|||
package org.bench4q.web.api;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
||||
import org.bench4q.share.models.agent.BehaviorStatusCodeResultModel;
|
||||
import org.bench4q.share.models.master.MonitorModel;
|
||||
import org.bench4q.share.models.master.ScriptModel;
|
||||
import org.bench4q.share.models.master.TestPlanScriptBriefResultModel;
|
||||
import org.bench4q.share.models.master.statistics.ScriptBehaviorsBriefModel;
|
||||
import org.bench4q.share.models.master.statistics.ScriptBriefResultModel;
|
||||
import org.bench4q.share.models.master.statistics.ScriptPagesBriefModel;
|
||||
import org.bench4q.web.TestPlan.RunTestPlan;
|
||||
import org.bench4q.web.TestPlan.TestPlanFeature;
|
||||
import org.bench4q.web.exception.CustomGenericException;
|
||||
import org.bench4q.web.model.*;
|
||||
import org.bench4q.web.service.CommunicateWithMaster;
|
||||
import org.bench4q.web.service.MonitorDescriptionInfoService;
|
||||
import org.bench4q.web.service.ScriptService;
|
||||
import org.bench4q.web.service.TestPlanService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.SessionAttributes;
|
||||
|
||||
@Controller
|
||||
@SessionAttributes({ "accessToken", "testPlanTaskList" })
|
||||
public class TestPlanActionController {
|
||||
private final String baseUrl = "testPlan";
|
||||
private final String BASECALLER = "TestPlanActionController:";
|
||||
private TestPlanService testPlanService;
|
||||
private CommunicateWithMaster communicateWithMaster;
|
||||
private MonitorDescriptionInfoService monitorDescriptionInfoService;
|
||||
private RunTestPlan runTestPlan;
|
||||
private TestPlanFeature testPlanInfo;
|
||||
|
||||
private ScriptService scriptService;
|
||||
|
||||
public ScriptService getScriptService() {
|
||||
return scriptService;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setScriptService(ScriptService scriptService) {
|
||||
this.scriptService = scriptService;
|
||||
}
|
||||
|
||||
private TestPlanFeature getTestPlanInfo() {
|
||||
return testPlanInfo;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private void setTestPlanInfo(TestPlanFeature testPlanInfo) {
|
||||
this.testPlanInfo = testPlanInfo;
|
||||
}
|
||||
|
||||
private RunTestPlan getRunTestPlan() {
|
||||
return runTestPlan;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private void setRunTestPlan(RunTestPlan runTestPlan) {
|
||||
this.runTestPlan = runTestPlan;
|
||||
}
|
||||
|
||||
private CommunicateWithMaster getCommunicateWithMaster() {
|
||||
return this.communicateWithMaster;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private void setCommunicateWithMaster(
|
||||
CommunicateWithMaster communicateWithMaster) {
|
||||
this.communicateWithMaster = communicateWithMaster;
|
||||
}
|
||||
|
||||
private String getBaseUrl() {
|
||||
return baseUrl;
|
||||
}
|
||||
|
||||
private TestPlanService getTestPlanService() {
|
||||
return testPlanService;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private void setTestPlanService(TestPlanService testPlanService) {
|
||||
this.testPlanService = testPlanService;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private void setMonitorDescriptionInfoService(
|
||||
MonitorDescriptionInfoService monitorDescriptionInfoService) {
|
||||
this.monitorDescriptionInfoService = monitorDescriptionInfoService;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "runTestPlan", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public BaseResponseModel runTestPlan(
|
||||
@ModelAttribute("accessToken") String accessToken, ModelMap model,
|
||||
@RequestBody TestPlanRequestModel testPlanRequestModel)
|
||||
throws CustomGenericException {
|
||||
String caller = this.BASECALLER + "runTestPlan";
|
||||
if (this.getTestPlanService().isValidateTestRunModel(
|
||||
testPlanRequestModel)) {
|
||||
throw new CustomGenericException("0",
|
||||
"run testplan request model is invalidate", caller);
|
||||
}
|
||||
this.getRunTestPlan().runTestPlan(accessToken, testPlanRequestModel,
|
||||
model);
|
||||
return new BaseResponseModel(true);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "testPlanTaskList", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public BaseResponseModel getTestPlanTaskList(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@ModelAttribute("testPlanTaskList") List<TestPlanTaskModel> testPlanTaskModels,
|
||||
ModelMap model) throws CustomGenericException, JAXBException {
|
||||
String caller = this.BASECALLER + "testPlanTaskList";
|
||||
Iterator<TestPlanTaskModel> iterator = testPlanTaskModels.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
TestPlanTaskModel testPlanTaskModel = iterator.next();
|
||||
WebTestPlanResultModel testPlanResultModel = this.getTestPlanInfo()
|
||||
.getTestPlanInfo(accessToken,
|
||||
testPlanTaskModel.getId().toString(), caller);
|
||||
if (testPlanResultModel.getCurrentStatus() == null)
|
||||
testPlanTaskModel.setStatus("-1");
|
||||
else
|
||||
testPlanTaskModel.setStatus(testPlanResultModel
|
||||
.getCurrentStatus().toString());
|
||||
}
|
||||
return new BaseResponseModel(true, testPlanTaskModels);
|
||||
}
|
||||
|
||||
@RequestMapping("/{testPlanId}/runningInfo")
|
||||
@ResponseBody
|
||||
public BaseResponseModel getRunningInfo(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@PathVariable String testPlanId) throws CustomGenericException {
|
||||
String caller = this.BASECALLER + "getRunningInfo";
|
||||
return new BaseResponseModel(true, (Object) this.getTestPlanInfo()
|
||||
.getRunningTestPlanModel(accessToken, testPlanId, caller));
|
||||
|
||||
}
|
||||
|
||||
// get the test plan run info (running,finished)
|
||||
@RequestMapping(value = "/{testPlanId}/queryTestPlan")
|
||||
@ResponseBody
|
||||
public BaseResponseModel queryTestPlan(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@PathVariable String testPlanId) throws CustomGenericException,
|
||||
JAXBException {
|
||||
String caller = "TestPlanActionController:queryTestPlan";
|
||||
if (!BaseControllerService.validateInput(testPlanId))
|
||||
throw new CustomGenericException("0", "invalidate testplan id",
|
||||
caller);
|
||||
return new BaseResponseModel(true, this.getTestPlanInfo()
|
||||
.getTestPlanInfo(accessToken, testPlanId, caller));
|
||||
}
|
||||
|
||||
@RequestMapping("/{testPlanId}/runningScriptInfo")
|
||||
@ResponseBody
|
||||
public BaseResponseModel getTestPlanScriptInfo(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@PathVariable String testPlanId) throws CustomGenericException,
|
||||
JAXBException {
|
||||
String caller = this.BASECALLER + "getTestPlanScriptInfo";
|
||||
List<RunningScriptInfoModel> runningScriptInfoModels = new ArrayList<RunningScriptInfoModel>();
|
||||
WebTestPlanResultModel testPlanResultModel = this.getTestPlanInfo()
|
||||
.getTestPlanInfo(accessToken, testPlanId, caller);
|
||||
Set<Integer> scriptIdList = testPlanResultModel.getScriptIdNameMap()
|
||||
.keySet();
|
||||
if (scriptIdList == null) {
|
||||
throw new CustomGenericException("5",
|
||||
"empty runningScript in test plan:" + testPlanId, caller);
|
||||
}
|
||||
for (Integer scriptId : scriptIdList) {
|
||||
RunningScriptInfoModel runningScriptInfoModel = new RunningScriptInfoModel();
|
||||
runningScriptInfoModel.setScriptId(scriptId);
|
||||
String scriptName = this.getScriptService()
|
||||
.queryScript(scriptId, accessToken).getName();
|
||||
runningScriptInfoModel.setScriptName(scriptName);
|
||||
runningScriptInfoModel
|
||||
.setChildResults(new ArrayList<ResultInfoModel>());
|
||||
runningScriptInfoModel.getChildResults().add(
|
||||
this.getTestPlanService().getScriptBriefStatusResultInfo());
|
||||
runningScriptInfoModels.add(runningScriptInfoModel);
|
||||
}
|
||||
return new BaseResponseModel(true, runningScriptInfoModels);
|
||||
}
|
||||
|
||||
@RequestMapping("/{testPlanId}/mapInfo")
|
||||
@ResponseBody
|
||||
public BaseResponseModel getReplaceList(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@PathVariable String testPlanId) throws CustomGenericException,
|
||||
JAXBException {
|
||||
String caller = this.BASECALLER + "getReplaceList";
|
||||
Map<String, Integer> map = new HashMap<String, Integer>();
|
||||
WebTestPlanResultModel testPlanResultModel = this.getTestPlanInfo()
|
||||
.getTestPlanInfo(accessToken, testPlanId, caller);
|
||||
if (testPlanResultModel.getScriptIds() != null) {
|
||||
List<ScriptModel> scriptModels = this.getScriptService()
|
||||
.queryScripts(testPlanResultModel.getScriptIds(),
|
||||
accessToken);
|
||||
Map<String, Integer> scriptNameAndIdMap = this.getScriptService()
|
||||
.getScriptNameIdMap(scriptModels);
|
||||
map.putAll(scriptNameAndIdMap);
|
||||
Map<String, Integer> pageNameAndIdMap = this.getScriptService()
|
||||
.getPageNameAndIdMap(scriptModels);
|
||||
map.putAll(pageNameAndIdMap);
|
||||
Map<String, Integer> behaviorMap = this.getScriptService()
|
||||
.getBehaviorNameAndIdMap(scriptModels);
|
||||
map.putAll(behaviorMap);
|
||||
return new BaseResponseModel(true, (Object) map);
|
||||
} else
|
||||
return new BaseResponseModel(false, "empty script in testPlan:"
|
||||
+ testPlanId);
|
||||
}
|
||||
|
||||
@RequestMapping("/{testPlanId}/sutInfo")
|
||||
@ResponseBody
|
||||
public BaseResponseModel getSutInfo(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@PathVariable String testPlanId) throws CustomGenericException,
|
||||
JAXBException {
|
||||
String caller = this.BASECALLER + "getSutInfo";
|
||||
WebTestPlanResultModel testPlanResultModel = this.getTestPlanInfo()
|
||||
.getTestPlanInfo(accessToken, testPlanId, caller);
|
||||
List<MonitorModel> monitorModels = testPlanResultModel
|
||||
.getMonitorModels();
|
||||
if (monitorModels != null) {
|
||||
List<SutInfo> sutInfos = new ArrayList<SutInfo>();
|
||||
for (MonitorModel monitorModel : monitorModels) {
|
||||
SutInfo sutInfo = this.monitorDescriptionInfoService
|
||||
.getSutInfo(monitorModel.getHostName(), new Integer(
|
||||
monitorModel.getPort()).toString(),
|
||||
accessToken, testPlanId);
|
||||
sutInfos.add(sutInfo);
|
||||
}
|
||||
return new BaseResponseModel(true, sutInfos);
|
||||
} else
|
||||
return new BaseResponseModel(false, caller
|
||||
+ ":monitor info in testPlan is empty:" + testPlanId);
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping("/{testPlanId}/script/{scriptId}/briefStatus/{fieldName}/{startTime}")
|
||||
@ResponseBody
|
||||
public BaseResponseModel getScriptBriefStatus(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@PathVariable String testPlanId, @PathVariable String scriptId,
|
||||
@PathVariable String fieldName, @PathVariable String startTime)
|
||||
throws CustomGenericException, NoSuchFieldException {
|
||||
String caller = "TestPlanActionController:getScriptBriefStatus";
|
||||
if (!BaseControllerService.validateInput(testPlanId)
|
||||
|| !BaseControllerService.validateInput(scriptId)) {
|
||||
return new BaseResponseModel(false, caller
|
||||
+ "invalidate scriptid or testplanid");
|
||||
}
|
||||
String url = this.getBaseUrl() + "/scriptBrief" + "/" + testPlanId
|
||||
+ "/" + scriptId + "/" + startTime;
|
||||
TestPlanScriptBriefResultModel testPlanScriptBriefResultModel = (TestPlanScriptBriefResultModel) this
|
||||
.getCommunicateWithMaster().getResponseModel(accessToken, url,
|
||||
TestPlanScriptBriefResultModel.class, null, caller);
|
||||
return new BaseResponseModel(true, this.getTestPlanService()
|
||||
.extractResultModelList(testPlanScriptBriefResultModel,
|
||||
fieldName));
|
||||
}
|
||||
|
||||
@RequestMapping("/{testPlanId}/script/{scriptId}/behaviors")
|
||||
@ResponseBody
|
||||
public BaseResponseModel getScriptBehaviorBriefModel(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@PathVariable String testPlanId, @PathVariable String scriptId)
|
||||
throws CustomGenericException {
|
||||
String caller = this.BASECALLER + "getScriptBehaviorBriefModel";
|
||||
String url = this.getBaseUrl() + "/getBehaviorsBrief" + "/"
|
||||
+ testPlanId + "/" + scriptId;
|
||||
if (!BaseControllerService.validateInput(testPlanId)
|
||||
|| !BaseControllerService.validateInput(scriptId)) {
|
||||
return new BaseResponseModel(false, caller
|
||||
+ ":invalidate scriptid or testplanid:");
|
||||
}
|
||||
ScriptBehaviorsBriefModel scriptBehaviorsBriefModel = (ScriptBehaviorsBriefModel) this
|
||||
.getCommunicateWithMaster().getResponseModel(accessToken, url,
|
||||
ScriptBehaviorsBriefModel.class, null, caller);
|
||||
return new BaseResponseModel(true, scriptBehaviorsBriefModel);
|
||||
}
|
||||
|
||||
@RequestMapping("/{testPlanId}/script/{scriptId}/page")
|
||||
@ResponseBody
|
||||
public BaseResponseModel getScriptPageBriefModel(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@PathVariable String testPlanId, @PathVariable String scriptId)
|
||||
throws CustomGenericException {
|
||||
String caller = this.BASECALLER + "getScriptPageBriefModel";
|
||||
String url = this.getBaseUrl() + "/pagesBrief" + "/" + testPlanId + "/"
|
||||
+ scriptId;
|
||||
ScriptPagesBriefModel scriptPagesBriefModel = (ScriptPagesBriefModel) this
|
||||
.getTestPlanService()
|
||||
.getCommunicateWithMaster()
|
||||
.getResponseModel(accessToken, url,
|
||||
ScriptPagesBriefModel.class, null, caller);
|
||||
return new BaseResponseModel(true, scriptPagesBriefModel);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@RequestMapping("/{testPlanId}/urlContentTypeDistribution")
|
||||
@ResponseBody
|
||||
public BaseResponseModel getUrlContentTypeDistribution(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@PathVariable String testPlanId) throws CustomGenericException,
|
||||
JAXBException {
|
||||
List<UrlContentTypeDistributionModel> urlContentTypeDistributionModels = new ArrayList<UrlContentTypeDistributionModel>();
|
||||
Map<String, Long> urlContentTypeCountMap = (Map<String, Long>) getUrlContentTypeCount(
|
||||
accessToken, testPlanId).getData();
|
||||
long totalCount = this.getTestPlanService().getTotalCount(
|
||||
urlContentTypeCountMap);
|
||||
Map<String, Double> urlContentTypePercentMap = this
|
||||
.getTestPlanService().getUrlContentTypePercent(
|
||||
urlContentTypeCountMap, totalCount);
|
||||
Set<String> keys = urlContentTypeCountMap.keySet();
|
||||
Iterator<String> iterator = keys.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
String key = iterator.next();
|
||||
urlContentTypeDistributionModels
|
||||
.add(new UrlContentTypeDistributionModel(key,
|
||||
urlContentTypeCountMap.get(key),
|
||||
urlContentTypePercentMap.get(key)));
|
||||
}
|
||||
return new BaseResponseModel(true, urlContentTypeDistributionModels);
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@RequestMapping("/{testPlanId}/urlContentTypePercent")
|
||||
@ResponseBody
|
||||
public BaseResponseModel getUrlContentTypePercent(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@PathVariable String testPlanId) throws CustomGenericException,
|
||||
JAXBException {
|
||||
Map<String, Long> urlContentTypeCountMap = (Map<String, Long>) getUrlContentTypeCount(
|
||||
accessToken, testPlanId).getData();
|
||||
long totalCount = this.getTestPlanService().getTotalCount(
|
||||
urlContentTypeCountMap);
|
||||
|
||||
return new BaseResponseModel(true, this.getTestPlanService()
|
||||
.getUrlContentTypePercent(urlContentTypeCountMap, totalCount));
|
||||
}
|
||||
|
||||
@RequestMapping("/{testPlanId}/urlContentTypeCount")
|
||||
@ResponseBody
|
||||
public BaseResponseModel getUrlContentTypeCount(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@PathVariable String testPlanId) throws CustomGenericException,
|
||||
JAXBException {
|
||||
Map<String, Long> urlContentCountMap = new HashMap<String, Long>();
|
||||
|
||||
for (BehaviorStatusCodeResultModel behaviorStatusCodeResultModel : getBehaviorStatusCodeResultModels(
|
||||
accessToken, testPlanId)) {
|
||||
if (urlContentCountMap.get(behaviorStatusCodeResultModel
|
||||
.getContentType()) == null)
|
||||
urlContentCountMap.put(
|
||||
behaviorStatusCodeResultModel.getContentType(),
|
||||
behaviorStatusCodeResultModel.getCount());
|
||||
else {
|
||||
long originalValue = urlContentCountMap
|
||||
.get(behaviorStatusCodeResultModel.getContentType());
|
||||
urlContentCountMap.put(
|
||||
behaviorStatusCodeResultModel.getContentType(),
|
||||
originalValue
|
||||
+ behaviorStatusCodeResultModel.getCount());
|
||||
}
|
||||
|
||||
}
|
||||
return new BaseResponseModel(true, urlContentCountMap);
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping("/{testPlanId}/testBriefStatus/{startTime}")
|
||||
@ResponseBody
|
||||
public BaseResponseModel getTotalRequest(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@PathVariable String testPlanId, @PathVariable String startTime)
|
||||
throws CustomGenericException, JAXBException {
|
||||
String caller = this.BASECALLER + "getTotalRequest";
|
||||
if (!BaseControllerService.validateInput(testPlanId)) {
|
||||
return new BaseResponseModel(false, caller
|
||||
+ " :testplanId is invalidate:" + testPlanId);
|
||||
}
|
||||
TestBriefStatusModel testBriefStatusModel = new TestBriefStatusModel();
|
||||
long vus = 0;
|
||||
long requests = 0;
|
||||
Date time = new Date(0);
|
||||
if (this.getTestPlanInfo()
|
||||
.getTestPlanInfo(accessToken, testPlanId, caller)
|
||||
.getScriptIds() == null)
|
||||
throw new CustomGenericException("5", caller
|
||||
+ " :scripts in testPlan is empty", caller);
|
||||
for (Integer scriptId : this.getTestPlanInfo()
|
||||
.getTestPlanInfo(accessToken, testPlanId, caller)
|
||||
.getScriptIds()) {
|
||||
ScriptBriefResultModel lastScriptBriefResultModel = getLastScriptBriefModel(
|
||||
accessToken, testPlanId, startTime, scriptId);
|
||||
requests += lastScriptBriefResultModel.getTotalFailCountFromBegin()
|
||||
+ lastScriptBriefResultModel
|
||||
.getTotalSuccessCountFromBegin();
|
||||
vus += lastScriptBriefResultModel.getvUserCount();
|
||||
if (lastScriptBriefResultModel.getSamplingTime().after(time))
|
||||
time = lastScriptBriefResultModel.getSamplingTime();
|
||||
}
|
||||
testBriefStatusModel.setRequests(requests);
|
||||
testBriefStatusModel.setVus(vus);
|
||||
testBriefStatusModel.setTime(time);
|
||||
return new BaseResponseModel(true, testBriefStatusModel);
|
||||
|
||||
}
|
||||
|
||||
private ScriptBriefResultModel getLastScriptBriefModel(String accessToken,
|
||||
String testPlanId, String startTime, Integer scriptId)
|
||||
throws CustomGenericException {
|
||||
String caller = "TestPlanActionController:getLastScriptBriefModel";
|
||||
String[] paths = new String[] { "scriptBrief", testPlanId,
|
||||
new Integer(scriptId).toString(), startTime };
|
||||
String url = generateUrl(this.getBaseUrl(), paths);
|
||||
TestPlanScriptBriefResultModel testPlanScriptBriefResultModel = (TestPlanScriptBriefResultModel) this
|
||||
.getTestPlanService()
|
||||
.getCommunicateWithMaster()
|
||||
.getResponseModel(accessToken, url,
|
||||
TestPlanScriptBriefResultModel.class, null, caller);
|
||||
if (testPlanScriptBriefResultModel.getScriptBriefResultModels() == null)
|
||||
throw new CustomGenericException("5", "script result empty", caller);
|
||||
int lastScriptBriefResultIndex = testPlanScriptBriefResultModel
|
||||
.getScriptBriefResultModels().size();
|
||||
if (lastScriptBriefResultIndex == 0)
|
||||
throw new CustomGenericException("5", "script result empty", caller);
|
||||
ScriptBriefResultModel lastScriptBriefResultModel = testPlanScriptBriefResultModel
|
||||
.getScriptBriefResultModels().get(
|
||||
lastScriptBriefResultIndex - 1);
|
||||
return lastScriptBriefResultModel;
|
||||
|
||||
}
|
||||
|
||||
private String generateUrl(String baseUrl, String[] paths) {
|
||||
String url = baseUrl;
|
||||
for (String path : paths) {
|
||||
url += "/" + path;
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
private List<BehaviorStatusCodeResultModel> getBehaviorStatusCodeResultModels(
|
||||
String accessToken, String testPlanId)
|
||||
throws CustomGenericException, JAXBException {
|
||||
String caller = "getBehaviorStatusCodeResultModels";
|
||||
List<BehaviorStatusCodeResultModel> behaviorStatusCodeResultModels = new ArrayList<BehaviorStatusCodeResultModel>();
|
||||
List<Integer> scriptIdList = this.getTestPlanInfo()
|
||||
.getTestPlanInfo(accessToken, testPlanId, caller)
|
||||
.getScriptIds();
|
||||
if (scriptIdList == null)
|
||||
throw new CustomGenericException("5",
|
||||
"scripts in testPlan is empty", caller);
|
||||
for (Integer scriptId : scriptIdList) {
|
||||
ScriptBehaviorsBriefModel scriptBehaviorBriefModel = (ScriptBehaviorsBriefModel) getScriptBehaviorBriefModel(
|
||||
accessToken, testPlanId, new Integer(scriptId).toString())
|
||||
.getData();
|
||||
behaviorStatusCodeResultModels
|
||||
.addAll(this.getTestPlanService()
|
||||
.getBehaviorStatusCodeResultModels(
|
||||
scriptBehaviorBriefModel));
|
||||
|
||||
}
|
||||
return behaviorStatusCodeResultModels;
|
||||
|
||||
}
|
||||
}
|
||||
package org.bench4q.web.api;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
||||
import org.bench4q.share.models.agent.BehaviorStatusCodeResultModel;
|
||||
import org.bench4q.share.models.master.MonitorModel;
|
||||
import org.bench4q.share.models.master.ScriptModel;
|
||||
import org.bench4q.share.models.master.TestPlanScriptBriefResultModel;
|
||||
import org.bench4q.share.models.master.statistics.ScriptBehaviorsBriefModel;
|
||||
import org.bench4q.share.models.master.statistics.ScriptBriefResultModel;
|
||||
import org.bench4q.share.models.master.statistics.ScriptPagesBriefModel;
|
||||
import org.bench4q.web.TestPlan.RunTestPlan;
|
||||
import org.bench4q.web.TestPlan.TestPlanFeature;
|
||||
import org.bench4q.web.exception.CustomGenericException;
|
||||
import org.bench4q.web.model.*;
|
||||
import org.bench4q.web.service.CommunicateWithMaster;
|
||||
import org.bench4q.web.service.MonitorDescriptionInfoService;
|
||||
import org.bench4q.web.service.ScriptService;
|
||||
import org.bench4q.web.service.TestPlanService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.SessionAttributes;
|
||||
|
||||
@Controller
|
||||
@SessionAttributes({ "accessToken", "testPlanTaskList" })
|
||||
public class TestPlanActionController {
|
||||
private final String baseUrl = "testPlan";
|
||||
private final String BASECALLER = "TestPlanActionController:";
|
||||
private TestPlanService testPlanService;
|
||||
private CommunicateWithMaster communicateWithMaster;
|
||||
private MonitorDescriptionInfoService monitorDescriptionInfoService;
|
||||
private RunTestPlan runTestPlan;
|
||||
private TestPlanFeature testPlanInfo;
|
||||
|
||||
private ScriptService scriptService;
|
||||
|
||||
public ScriptService getScriptService() {
|
||||
return scriptService;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setScriptService(ScriptService scriptService) {
|
||||
this.scriptService = scriptService;
|
||||
}
|
||||
|
||||
private TestPlanFeature getTestPlanInfo() {
|
||||
return testPlanInfo;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private void setTestPlanInfo(TestPlanFeature testPlanInfo) {
|
||||
this.testPlanInfo = testPlanInfo;
|
||||
}
|
||||
|
||||
private RunTestPlan getRunTestPlan() {
|
||||
return runTestPlan;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private void setRunTestPlan(RunTestPlan runTestPlan) {
|
||||
this.runTestPlan = runTestPlan;
|
||||
}
|
||||
|
||||
private CommunicateWithMaster getCommunicateWithMaster() {
|
||||
return this.communicateWithMaster;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private void setCommunicateWithMaster(
|
||||
CommunicateWithMaster communicateWithMaster) {
|
||||
this.communicateWithMaster = communicateWithMaster;
|
||||
}
|
||||
|
||||
private String getBaseUrl() {
|
||||
return baseUrl;
|
||||
}
|
||||
|
||||
private TestPlanService getTestPlanService() {
|
||||
return testPlanService;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private void setTestPlanService(TestPlanService testPlanService) {
|
||||
this.testPlanService = testPlanService;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private void setMonitorDescriptionInfoService(
|
||||
MonitorDescriptionInfoService monitorDescriptionInfoService) {
|
||||
this.monitorDescriptionInfoService = monitorDescriptionInfoService;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "runTestPlan", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public BaseResponseModel runTestPlan(
|
||||
@ModelAttribute("accessToken") String accessToken, ModelMap model,
|
||||
@RequestBody TestPlanRequestModel testPlanRequestModel)
|
||||
throws CustomGenericException {
|
||||
String caller = this.BASECALLER + "runTestPlan";
|
||||
if (this.getTestPlanService().isValidateTestRunModel(
|
||||
testPlanRequestModel)) {
|
||||
throw new CustomGenericException("0",
|
||||
"run testplan request model is invalidate", caller);
|
||||
}
|
||||
this.getRunTestPlan().runTestPlan(accessToken, testPlanRequestModel,
|
||||
model);
|
||||
return new BaseResponseModel(true);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "testPlanTaskList", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public BaseResponseModel getTestPlanTaskList(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@ModelAttribute("testPlanTaskList") List<TestPlanTaskModel> testPlanTaskModels,
|
||||
ModelMap model) throws CustomGenericException, JAXBException {
|
||||
String caller = this.BASECALLER + "testPlanTaskList";
|
||||
Iterator<TestPlanTaskModel> iterator = testPlanTaskModels.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
TestPlanTaskModel testPlanTaskModel = iterator.next();
|
||||
WebTestPlanResultModel testPlanResultModel = this.getTestPlanInfo()
|
||||
.getTestPlanInfo(accessToken,
|
||||
testPlanTaskModel.getId().toString(), caller);
|
||||
if (testPlanResultModel.getCurrentStatus() == null)
|
||||
testPlanTaskModel.setStatus("-1");
|
||||
else
|
||||
testPlanTaskModel.setStatus(testPlanResultModel
|
||||
.getCurrentStatus().toString());
|
||||
}
|
||||
return new BaseResponseModel(true, testPlanTaskModels);
|
||||
}
|
||||
|
||||
@RequestMapping("/{testPlanId}/runningInfo")
|
||||
@ResponseBody
|
||||
public BaseResponseModel getRunningInfo(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@PathVariable String testPlanId) throws CustomGenericException {
|
||||
String caller = this.BASECALLER + "getRunningInfo";
|
||||
return new BaseResponseModel(true, (Object) this.getTestPlanInfo()
|
||||
.getRunningTestPlanModel(accessToken, testPlanId, caller));
|
||||
|
||||
}
|
||||
|
||||
// get the test plan run info (running,finished)
|
||||
@RequestMapping(value = "/{testPlanId}/queryTestPlan")
|
||||
@ResponseBody
|
||||
public BaseResponseModel queryTestPlan(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@PathVariable String testPlanId) throws CustomGenericException,
|
||||
JAXBException {
|
||||
String caller = "TestPlanActionController:queryTestPlan";
|
||||
if (!BaseControllerService.validateInput(testPlanId))
|
||||
throw new CustomGenericException("0", "invalidate testplan id",
|
||||
caller);
|
||||
return new BaseResponseModel(true, this.getTestPlanInfo()
|
||||
.getTestPlanInfo(accessToken, testPlanId, caller));
|
||||
}
|
||||
|
||||
@RequestMapping("/{testPlanId}/runningScriptInfo")
|
||||
@ResponseBody
|
||||
public BaseResponseModel getTestPlanScriptInfo(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@PathVariable String testPlanId) throws CustomGenericException,
|
||||
JAXBException {
|
||||
String caller = this.BASECALLER + "getTestPlanScriptInfo";
|
||||
List<RunningScriptInfoModel> runningScriptInfoModels = new ArrayList<RunningScriptInfoModel>();
|
||||
WebTestPlanResultModel testPlanResultModel = this.getTestPlanInfo()
|
||||
.getTestPlanInfo(accessToken, testPlanId, caller);
|
||||
Set<Integer> scriptIdList = testPlanResultModel.getScriptIdNameMap()
|
||||
.keySet();
|
||||
if (scriptIdList == null) {
|
||||
throw new CustomGenericException("5",
|
||||
"empty runningScript in test plan:" + testPlanId, caller);
|
||||
}
|
||||
for (Integer scriptId : scriptIdList) {
|
||||
RunningScriptInfoModel runningScriptInfoModel = new RunningScriptInfoModel();
|
||||
runningScriptInfoModel.setScriptId(scriptId);
|
||||
String scriptName = this.getScriptService()
|
||||
.queryScript(scriptId, accessToken).getName();
|
||||
runningScriptInfoModel.setScriptName(scriptName);
|
||||
runningScriptInfoModel
|
||||
.setChildResults(new ArrayList<ResultInfoModel>());
|
||||
runningScriptInfoModel.getChildResults().add(
|
||||
this.getTestPlanService().getScriptBriefStatusResultInfo());
|
||||
runningScriptInfoModels.add(runningScriptInfoModel);
|
||||
}
|
||||
return new BaseResponseModel(true, runningScriptInfoModels);
|
||||
}
|
||||
|
||||
@RequestMapping("/{testPlanId}/mapInfo")
|
||||
@ResponseBody
|
||||
public BaseResponseModel getReplaceList(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@PathVariable String testPlanId) throws CustomGenericException,
|
||||
JAXBException {
|
||||
String caller = this.BASECALLER + "getReplaceList";
|
||||
Map<String, Integer> map = new HashMap<String, Integer>();
|
||||
WebTestPlanResultModel testPlanResultModel = this.getTestPlanInfo()
|
||||
.getTestPlanInfo(accessToken, testPlanId, caller);
|
||||
if (testPlanResultModel.getScriptIds() != null) {
|
||||
List<ScriptModel> scriptModels = this.getScriptService()
|
||||
.queryScripts(testPlanResultModel.getScriptIds(),
|
||||
accessToken);
|
||||
Map<String, Integer> scriptNameAndIdMap = this.getScriptService()
|
||||
.getScriptNameIdMap(scriptModels);
|
||||
map.putAll(scriptNameAndIdMap);
|
||||
Map<String, Integer> pageNameAndIdMap = this.getScriptService()
|
||||
.getPageNameAndIdMap(scriptModels);
|
||||
map.putAll(pageNameAndIdMap);
|
||||
Map<String, Integer> behaviorMap = this.getScriptService()
|
||||
.getBehaviorNameAndIdMap(scriptModels);
|
||||
map.putAll(behaviorMap);
|
||||
return new BaseResponseModel(true, (Object) map);
|
||||
} else
|
||||
return new BaseResponseModel(false, "empty script in testPlan:"
|
||||
+ testPlanId);
|
||||
}
|
||||
|
||||
@RequestMapping("/{testPlanId}/sutInfo")
|
||||
@ResponseBody
|
||||
public BaseResponseModel getSutInfo(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@PathVariable String testPlanId) throws CustomGenericException,
|
||||
JAXBException {
|
||||
String caller = this.BASECALLER + "getSutInfo";
|
||||
WebTestPlanResultModel testPlanResultModel = this.getTestPlanInfo()
|
||||
.getTestPlanInfo(accessToken, testPlanId, caller);
|
||||
List<MonitorModel> monitorModels = testPlanResultModel
|
||||
.getMonitorModels();
|
||||
if (monitorModels != null) {
|
||||
List<SutInfo> sutInfos = new ArrayList<SutInfo>();
|
||||
for (MonitorModel monitorModel : monitorModels) {
|
||||
SutInfo sutInfo = this.monitorDescriptionInfoService
|
||||
.getSutInfo(monitorModel.getHostName(), new Integer(
|
||||
monitorModel.getPort()).toString(),
|
||||
accessToken, testPlanId);
|
||||
sutInfos.add(sutInfo);
|
||||
}
|
||||
return new BaseResponseModel(true, sutInfos);
|
||||
} else
|
||||
return new BaseResponseModel(false, caller
|
||||
+ ":monitor info in testPlan is empty:" + testPlanId);
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping("/{testPlanId}/script/{scriptId}/briefStatus/{fieldName}/{startTime}")
|
||||
@ResponseBody
|
||||
public BaseResponseModel getScriptBriefStatus(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@PathVariable String testPlanId, @PathVariable String scriptId,
|
||||
@PathVariable String fieldName, @PathVariable String startTime)
|
||||
throws CustomGenericException, NoSuchFieldException {
|
||||
String caller = "TestPlanActionController:getScriptBriefStatus";
|
||||
if (!BaseControllerService.validateInput(testPlanId)
|
||||
|| !BaseControllerService.validateInput(scriptId)) {
|
||||
return new BaseResponseModel(false, caller
|
||||
+ "invalidate scriptid or testplanid");
|
||||
}
|
||||
String url = this.getBaseUrl() + "/scriptBrief" + "/" + testPlanId
|
||||
+ "/" + scriptId + "/" + startTime;
|
||||
TestPlanScriptBriefResultModel testPlanScriptBriefResultModel = (TestPlanScriptBriefResultModel) this
|
||||
.getCommunicateWithMaster().getResponseModel(accessToken, url,
|
||||
TestPlanScriptBriefResultModel.class, null, caller);
|
||||
return new BaseResponseModel(true, this.getTestPlanService()
|
||||
.extractResultModelList(testPlanScriptBriefResultModel,
|
||||
fieldName));
|
||||
}
|
||||
|
||||
@RequestMapping("/{testPlanId}/script/{scriptId}/behaviors")
|
||||
@ResponseBody
|
||||
public BaseResponseModel getScriptBehaviorBriefModel(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@PathVariable String testPlanId, @PathVariable String scriptId)
|
||||
throws CustomGenericException {
|
||||
String caller = this.BASECALLER + "getScriptBehaviorBriefModel";
|
||||
String url = this.getBaseUrl() + "/getBehaviorsBrief" + "/"
|
||||
+ testPlanId + "/" + scriptId;
|
||||
if (!BaseControllerService.validateInput(testPlanId)
|
||||
|| !BaseControllerService.validateInput(scriptId)) {
|
||||
return new BaseResponseModel(false, caller
|
||||
+ ":invalidate scriptid or testplanid:");
|
||||
}
|
||||
ScriptBehaviorsBriefModel scriptBehaviorsBriefModel = (ScriptBehaviorsBriefModel) this
|
||||
.getCommunicateWithMaster().getResponseModel(accessToken, url,
|
||||
ScriptBehaviorsBriefModel.class, null, caller);
|
||||
return new BaseResponseModel(true, scriptBehaviorsBriefModel);
|
||||
}
|
||||
|
||||
@RequestMapping("/{testPlanId}/script/{scriptId}/page")
|
||||
@ResponseBody
|
||||
public BaseResponseModel getScriptPageBriefModel(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@PathVariable String testPlanId, @PathVariable String scriptId)
|
||||
throws CustomGenericException {
|
||||
String caller = this.BASECALLER + "getScriptPageBriefModel";
|
||||
String url = this.getBaseUrl() + "/pagesBrief" + "/" + testPlanId + "/"
|
||||
+ scriptId;
|
||||
ScriptPagesBriefModel scriptPagesBriefModel = (ScriptPagesBriefModel) this
|
||||
.getTestPlanService()
|
||||
.getCommunicateWithMaster()
|
||||
.getResponseModel(accessToken, url,
|
||||
ScriptPagesBriefModel.class, null, caller);
|
||||
return new BaseResponseModel(true, scriptPagesBriefModel);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@RequestMapping("/{testPlanId}/urlContentTypeDistribution")
|
||||
@ResponseBody
|
||||
public BaseResponseModel getUrlContentTypeDistribution(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@PathVariable String testPlanId) throws CustomGenericException,
|
||||
JAXBException {
|
||||
List<UrlContentTypeDistributionModel> urlContentTypeDistributionModels = new ArrayList<UrlContentTypeDistributionModel>();
|
||||
Map<String, Long> urlContentTypeCountMap = (Map<String, Long>) getUrlContentTypeCount(
|
||||
accessToken, testPlanId).getData();
|
||||
long totalCount = this.getTestPlanService().getTotalCount(
|
||||
urlContentTypeCountMap);
|
||||
Map<String, Double> urlContentTypePercentMap = this
|
||||
.getTestPlanService().getUrlContentTypePercent(
|
||||
urlContentTypeCountMap, totalCount);
|
||||
Set<String> keys = urlContentTypeCountMap.keySet();
|
||||
Iterator<String> iterator = keys.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
String key = iterator.next();
|
||||
urlContentTypeDistributionModels
|
||||
.add(new UrlContentTypeDistributionModel(key,
|
||||
urlContentTypeCountMap.get(key),
|
||||
urlContentTypePercentMap.get(key)));
|
||||
}
|
||||
return new BaseResponseModel(true, urlContentTypeDistributionModels);
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@RequestMapping("/{testPlanId}/urlContentTypePercent")
|
||||
@ResponseBody
|
||||
public BaseResponseModel getUrlContentTypePercent(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@PathVariable String testPlanId) throws CustomGenericException,
|
||||
JAXBException {
|
||||
Map<String, Long> urlContentTypeCountMap = (Map<String, Long>) getUrlContentTypeCount(
|
||||
accessToken, testPlanId).getData();
|
||||
long totalCount = this.getTestPlanService().getTotalCount(
|
||||
urlContentTypeCountMap);
|
||||
|
||||
return new BaseResponseModel(true, this.getTestPlanService()
|
||||
.getUrlContentTypePercent(urlContentTypeCountMap, totalCount));
|
||||
}
|
||||
|
||||
@RequestMapping("/{testPlanId}/urlContentTypeCount")
|
||||
@ResponseBody
|
||||
public BaseResponseModel getUrlContentTypeCount(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@PathVariable String testPlanId) throws CustomGenericException,
|
||||
JAXBException {
|
||||
Map<String, Long> urlContentCountMap = new HashMap<String, Long>();
|
||||
|
||||
for (BehaviorStatusCodeResultModel behaviorStatusCodeResultModel : getBehaviorStatusCodeResultModels(
|
||||
accessToken, testPlanId)) {
|
||||
if (urlContentCountMap.get(behaviorStatusCodeResultModel
|
||||
.getContentType()) == null)
|
||||
urlContentCountMap.put(
|
||||
behaviorStatusCodeResultModel.getContentType(),
|
||||
behaviorStatusCodeResultModel.getCount());
|
||||
else {
|
||||
long originalValue = urlContentCountMap
|
||||
.get(behaviorStatusCodeResultModel.getContentType());
|
||||
urlContentCountMap.put(
|
||||
behaviorStatusCodeResultModel.getContentType(),
|
||||
originalValue
|
||||
+ behaviorStatusCodeResultModel.getCount());
|
||||
}
|
||||
|
||||
}
|
||||
return new BaseResponseModel(true, urlContentCountMap);
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping("/{testPlanId}/testBriefStatus/{startTime}")
|
||||
@ResponseBody
|
||||
public BaseResponseModel getTotalRequest(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@PathVariable String testPlanId, @PathVariable String startTime)
|
||||
throws CustomGenericException, JAXBException {
|
||||
String caller = this.BASECALLER + "getTotalRequest";
|
||||
if (!BaseControllerService.validateInput(testPlanId)) {
|
||||
return new BaseResponseModel(false, caller
|
||||
+ " :testplanId is invalidate:" + testPlanId);
|
||||
}
|
||||
TestBriefStatusModel testBriefStatusModel = new TestBriefStatusModel();
|
||||
long vus = 0;
|
||||
long requests = 0;
|
||||
Date time = new Date(0);
|
||||
if (this.getTestPlanInfo()
|
||||
.getTestPlanInfo(accessToken, testPlanId, caller)
|
||||
.getScriptIds() == null)
|
||||
throw new CustomGenericException("5", caller
|
||||
+ " :scripts in testPlan is empty", caller);
|
||||
for (Integer scriptId : this.getTestPlanInfo()
|
||||
.getTestPlanInfo(accessToken, testPlanId, caller)
|
||||
.getScriptIds()) {
|
||||
ScriptBriefResultModel lastScriptBriefResultModel = getLastScriptBriefModel(
|
||||
accessToken, testPlanId, startTime, scriptId);
|
||||
requests += lastScriptBriefResultModel.getTotalFailCountFromBegin()
|
||||
+ lastScriptBriefResultModel
|
||||
.getTotalSuccessCountFromBegin();
|
||||
vus += lastScriptBriefResultModel.getvUserCount();
|
||||
if (lastScriptBriefResultModel.getSamplingTime().after(time))
|
||||
time = lastScriptBriefResultModel.getSamplingTime();
|
||||
}
|
||||
testBriefStatusModel.setRequests(requests);
|
||||
testBriefStatusModel.setVus(vus);
|
||||
testBriefStatusModel.setTime(time);
|
||||
return new BaseResponseModel(true, testBriefStatusModel);
|
||||
|
||||
}
|
||||
|
||||
private ScriptBriefResultModel getLastScriptBriefModel(String accessToken,
|
||||
String testPlanId, String startTime, Integer scriptId)
|
||||
throws CustomGenericException {
|
||||
String caller = "TestPlanActionController:getLastScriptBriefModel";
|
||||
String[] paths = new String[] { "scriptBrief", testPlanId,
|
||||
new Integer(scriptId).toString(), startTime };
|
||||
String url = generateUrl(this.getBaseUrl(), paths);
|
||||
TestPlanScriptBriefResultModel testPlanScriptBriefResultModel = (TestPlanScriptBriefResultModel) this
|
||||
.getTestPlanService()
|
||||
.getCommunicateWithMaster()
|
||||
.getResponseModel(accessToken, url,
|
||||
TestPlanScriptBriefResultModel.class, null, caller);
|
||||
if (testPlanScriptBriefResultModel.getScriptBriefResultModels() == null)
|
||||
throw new CustomGenericException("5", "script result empty", caller);
|
||||
int lastScriptBriefResultIndex = testPlanScriptBriefResultModel
|
||||
.getScriptBriefResultModels().size();
|
||||
if (lastScriptBriefResultIndex == 0)
|
||||
throw new CustomGenericException("5", "script result empty", caller);
|
||||
ScriptBriefResultModel lastScriptBriefResultModel = testPlanScriptBriefResultModel
|
||||
.getScriptBriefResultModels().get(
|
||||
lastScriptBriefResultIndex - 1);
|
||||
return lastScriptBriefResultModel;
|
||||
|
||||
}
|
||||
|
||||
private String generateUrl(String baseUrl, String[] paths) {
|
||||
String url = baseUrl;
|
||||
for (String path : paths) {
|
||||
url += "/" + path;
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
private List<BehaviorStatusCodeResultModel> getBehaviorStatusCodeResultModels(
|
||||
String accessToken, String testPlanId)
|
||||
throws CustomGenericException, JAXBException {
|
||||
String caller = "getBehaviorStatusCodeResultModels";
|
||||
List<BehaviorStatusCodeResultModel> behaviorStatusCodeResultModels = new ArrayList<BehaviorStatusCodeResultModel>();
|
||||
List<Integer> scriptIdList = this.getTestPlanInfo()
|
||||
.getTestPlanInfo(accessToken, testPlanId, caller)
|
||||
.getScriptIds();
|
||||
if (scriptIdList == null)
|
||||
throw new CustomGenericException("5",
|
||||
"scripts in testPlan is empty", caller);
|
||||
for (Integer scriptId : scriptIdList) {
|
||||
ScriptBehaviorsBriefModel scriptBehaviorBriefModel = (ScriptBehaviorsBriefModel) getScriptBehaviorBriefModel(
|
||||
accessToken, testPlanId, new Integer(scriptId).toString())
|
||||
.getData();
|
||||
behaviorStatusCodeResultModels
|
||||
.addAll(this.getTestPlanService()
|
||||
.getBehaviorStatusCodeResultModels(
|
||||
scriptBehaviorBriefModel));
|
||||
|
||||
}
|
||||
return behaviorStatusCodeResultModels;
|
||||
|
||||
}
|
||||
}
|
|
@ -1,164 +1,164 @@
|
|||
package org.bench4q.web.api;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
||||
import org.bench4q.share.communication.HttpRequester.HttpResponse;
|
||||
import org.bench4q.share.models.ErrorResponseModel;
|
||||
import org.bench4q.share.models.master.TestPlanDBModel;
|
||||
import org.bench4q.share.models.master.TestPlanResponseModel;
|
||||
import org.bench4q.web.exception.CustomGenericException;
|
||||
import org.bench4q.web.extractObjectFromXml.ObjectXmlExchange;
|
||||
import org.bench4q.web.model.BaseResponseModel;
|
||||
import org.bench4q.web.model.TestPlanListModel;
|
||||
import org.bench4q.web.service.CommunicateWithMaster;
|
||||
import org.bench4q.web.service.TestPlanService;
|
||||
import org.eclipse.jetty.http.HttpStatus;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.SessionAttributes;
|
||||
|
||||
@Controller
|
||||
@SessionAttributes({ "accessToken", "testPlanTaskList" })
|
||||
public class TestPlanHistoryResult extends BaseControllerService {
|
||||
private String baseUrl = CommunicateWithMaster.getMasterAddress()+"testPlan";
|
||||
private TestPlanService testPlanService;
|
||||
private CommunicateWithMaster communicateWithMaster;
|
||||
private CommunicateWithMaster getCommunicateWithMaster() {
|
||||
return communicateWithMaster;
|
||||
}
|
||||
@Autowired
|
||||
private void setCommunicateWithMaster(CommunicateWithMaster communicateWithMaster) {
|
||||
this.communicateWithMaster = communicateWithMaster;
|
||||
}
|
||||
|
||||
public String getBaseUrl() {
|
||||
return baseUrl;
|
||||
}
|
||||
|
||||
public void setBaseUrl(String baseUrl) {
|
||||
this.baseUrl = baseUrl;
|
||||
}
|
||||
|
||||
public TestPlanService getTestPlanService() {
|
||||
return testPlanService;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setTestPlanService(TestPlanService testPlanService) {
|
||||
this.testPlanService = testPlanService;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "loadTestPlans", method = { RequestMethod.GET,
|
||||
RequestMethod.POST })
|
||||
@ResponseBody
|
||||
public BaseResponseModel
|
||||
loadTestPlans(
|
||||
@ModelAttribute("accessToken") String accessToken)
|
||||
throws CustomGenericException {
|
||||
String caller = "TestPlanHistoryResult:loadTestPlans";
|
||||
String url = "testPlan"+ "/loadTestPlans";
|
||||
TestPlanResponseModel testPlanResponseModel = (TestPlanResponseModel) this
|
||||
.getTestPlanService()
|
||||
.getCommunicateWithMaster()
|
||||
.getResponseModel(accessToken, url,
|
||||
TestPlanResponseModel.class, null, caller);
|
||||
if (testPlanResponseModel.isSuccess()) {
|
||||
return new BaseResponseModel(true,buildTestPlanListModel(testPlanResponseModel
|
||||
.getTestPlanDBModels()));
|
||||
} else {
|
||||
return new BaseResponseModel(false,testPlanResponseModel.getFailCause());
|
||||
}
|
||||
}
|
||||
|
||||
private TestPlanListModel buildTestPlanListModel(List<TestPlanDBModel> list) {
|
||||
TestPlanListModel result = new TestPlanListModel();
|
||||
result.setList(list);
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "downloadReport", method = { RequestMethod.GET,
|
||||
RequestMethod.POST })
|
||||
public BaseResponseModel downloadReport(HttpServletResponse response,
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@RequestParam String testPlanId) throws CustomGenericException {
|
||||
String caller="TestPlanHistory:downloadReport";
|
||||
try {
|
||||
HttpResponse httpResponse = this.getHttpRequester().sendGet(
|
||||
this.getBaseUrl() + "/getTestPlanReport",
|
||||
makeParamsMap("testPlanRunID", testPlanId),
|
||||
this.makeAccessTockenMap(accessToken));
|
||||
if (httpResponse == null ) {
|
||||
|
||||
throw new CustomGenericException("1", "invalidate http response", caller);
|
||||
}
|
||||
if(httpResponse.getContent().isEmpty())
|
||||
throw new CustomGenericException("5", "report data empty","");
|
||||
/*if(httpResponse.getContent().isEmpty())
|
||||
throw new CustomGenericException(errCode, errMsg, source)*/
|
||||
if (httpResponse.getCode() == HttpStatus.BAD_REQUEST_400) {
|
||||
ErrorResponseModel errorResponseModel = (ErrorResponseModel) ObjectXmlExchange
|
||||
.fromXml(ErrorResponseModel.class,
|
||||
httpResponse.getContent());
|
||||
this.getCommunicateWithMaster().logException(errorResponseModel);
|
||||
throw new CustomGenericException("2", FAIL_WITH_EXCEPTION + "_"
|
||||
+ errorResponseModel.getMessage(), caller + "_"
|
||||
+ errorResponseModel.getResource());
|
||||
}
|
||||
byte[] pdfBuffer = httpResponse.getContent().getBytes();
|
||||
ServletOutputStream outputStream = response.getOutputStream();
|
||||
response.reset();
|
||||
response.setHeader("Content-disposition", "attachment; filename=\""
|
||||
+ testPlanId.toString() + ".pdf\"");
|
||||
response.addHeader("Content-Length", "" + pdfBuffer.length);
|
||||
response.setContentType("application/pdf");
|
||||
System.out.println("set response contentType:"
|
||||
+ response.getContentType());
|
||||
outputStream.write(pdfBuffer);
|
||||
outputStream.flush();
|
||||
outputStream.close();
|
||||
return new BaseResponseModel(true);
|
||||
} catch (IOException e) {
|
||||
throw new CustomGenericException("1", "exception:io exception", caller);
|
||||
} catch (JAXBException e) {
|
||||
// TODO Auto-generated catch block
|
||||
throw new CustomGenericException("1", "exception:io exception", caller);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "deleteTest", method = { RequestMethod.GET,
|
||||
RequestMethod.POST })
|
||||
@ResponseBody
|
||||
public BaseResponseModel deleteTest(HttpServletResponse response,
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@RequestParam String testPlanId) throws CustomGenericException {
|
||||
String url = "testPlan" + "/removeTestPlanFromPool";
|
||||
String caller = "TestPlanHistoryController:deleteTest";
|
||||
Map<String, String> params = this.makeParamsMap("testPlanId",
|
||||
testPlanId);
|
||||
TestPlanResponseModel testPlanResponseModel = (TestPlanResponseModel) this
|
||||
.getTestPlanService()
|
||||
.getCommunicateWithMaster()
|
||||
.getResponseModel(accessToken, url,
|
||||
TestPlanResponseModel.class, params, caller);
|
||||
|
||||
if (testPlanResponseModel.isSuccess()) {
|
||||
|
||||
return new BaseResponseModel(true);
|
||||
} else {
|
||||
|
||||
return new BaseResponseModel(false,testPlanResponseModel.getFailCause());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
package org.bench4q.web.api;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
||||
import org.bench4q.share.communication.HttpRequester.HttpResponse;
|
||||
import org.bench4q.share.models.ErrorResponseModel;
|
||||
import org.bench4q.share.models.master.TestPlanDBModel;
|
||||
import org.bench4q.share.models.master.TestPlanResponseModel;
|
||||
import org.bench4q.web.exception.CustomGenericException;
|
||||
import org.bench4q.web.extractObjectFromXml.ObjectXmlExchange;
|
||||
import org.bench4q.web.model.BaseResponseModel;
|
||||
import org.bench4q.web.model.TestPlanListModel;
|
||||
import org.bench4q.web.service.CommunicateWithMaster;
|
||||
import org.bench4q.web.service.TestPlanService;
|
||||
import org.eclipse.jetty.http.HttpStatus;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.SessionAttributes;
|
||||
|
||||
@Controller
|
||||
@SessionAttributes({ "accessToken", "testPlanTaskList" })
|
||||
public class TestPlanHistoryResult extends BaseControllerService {
|
||||
private String baseUrl = CommunicateWithMaster.getMasterAddress()+"testPlan";
|
||||
private TestPlanService testPlanService;
|
||||
private CommunicateWithMaster communicateWithMaster;
|
||||
private CommunicateWithMaster getCommunicateWithMaster() {
|
||||
return communicateWithMaster;
|
||||
}
|
||||
@Autowired
|
||||
private void setCommunicateWithMaster(CommunicateWithMaster communicateWithMaster) {
|
||||
this.communicateWithMaster = communicateWithMaster;
|
||||
}
|
||||
|
||||
public String getBaseUrl() {
|
||||
return baseUrl;
|
||||
}
|
||||
|
||||
public void setBaseUrl(String baseUrl) {
|
||||
this.baseUrl = baseUrl;
|
||||
}
|
||||
|
||||
public TestPlanService getTestPlanService() {
|
||||
return testPlanService;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setTestPlanService(TestPlanService testPlanService) {
|
||||
this.testPlanService = testPlanService;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "loadTestPlans", method = { RequestMethod.GET,
|
||||
RequestMethod.POST })
|
||||
@ResponseBody
|
||||
public BaseResponseModel
|
||||
loadTestPlans(
|
||||
@ModelAttribute("accessToken") String accessToken)
|
||||
throws CustomGenericException {
|
||||
String caller = "TestPlanHistoryResult:loadTestPlans";
|
||||
String url = "testPlan"+ "/loadTestPlans";
|
||||
TestPlanResponseModel testPlanResponseModel = (TestPlanResponseModel) this
|
||||
.getTestPlanService()
|
||||
.getCommunicateWithMaster()
|
||||
.getResponseModel(accessToken, url,
|
||||
TestPlanResponseModel.class, null, caller);
|
||||
if (testPlanResponseModel.isSuccess()) {
|
||||
return new BaseResponseModel(true,buildTestPlanListModel(testPlanResponseModel
|
||||
.getTestPlanDBModels()));
|
||||
} else {
|
||||
return new BaseResponseModel(false,testPlanResponseModel.getFailCause());
|
||||
}
|
||||
}
|
||||
|
||||
private TestPlanListModel buildTestPlanListModel(List<TestPlanDBModel> list) {
|
||||
TestPlanListModel result = new TestPlanListModel();
|
||||
result.setList(list);
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "downloadReport", method = { RequestMethod.GET,
|
||||
RequestMethod.POST })
|
||||
public BaseResponseModel downloadReport(HttpServletResponse response,
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@RequestParam String testPlanId) throws CustomGenericException {
|
||||
String caller="TestPlanHistory:downloadReport";
|
||||
try {
|
||||
HttpResponse httpResponse = this.getHttpRequester().sendGet(
|
||||
this.getBaseUrl() + "/getTestPlanReport",
|
||||
makeParamsMap("testPlanRunID", testPlanId),
|
||||
this.makeAccessTockenMap(accessToken));
|
||||
if (httpResponse == null ) {
|
||||
|
||||
throw new CustomGenericException("1", "invalidate http response", caller);
|
||||
}
|
||||
if(httpResponse.getContent().isEmpty())
|
||||
throw new CustomGenericException("5", "report data empty","");
|
||||
/*if(httpResponse.getContent().isEmpty())
|
||||
throw new CustomGenericException(errCode, errMsg, source)*/
|
||||
if (httpResponse.getCode() == HttpStatus.BAD_REQUEST_400) {
|
||||
ErrorResponseModel errorResponseModel = (ErrorResponseModel) ObjectXmlExchange
|
||||
.fromXml(ErrorResponseModel.class,
|
||||
httpResponse.getContent());
|
||||
this.getCommunicateWithMaster().logException(errorResponseModel);
|
||||
throw new CustomGenericException("2", FAIL_WITH_EXCEPTION + "_"
|
||||
+ errorResponseModel.getMessage(), caller + "_"
|
||||
+ errorResponseModel.getResource());
|
||||
}
|
||||
byte[] pdfBuffer = httpResponse.getContent().getBytes();
|
||||
ServletOutputStream outputStream = response.getOutputStream();
|
||||
response.reset();
|
||||
response.setHeader("Content-disposition", "attachment; filename=\""
|
||||
+ testPlanId.toString() + ".pdf\"");
|
||||
response.addHeader("Content-Length", "" + pdfBuffer.length);
|
||||
response.setContentType("application/pdf");
|
||||
System.out.println("set response contentType:"
|
||||
+ response.getContentType());
|
||||
outputStream.write(pdfBuffer);
|
||||
outputStream.flush();
|
||||
outputStream.close();
|
||||
return new BaseResponseModel(true);
|
||||
} catch (IOException e) {
|
||||
throw new CustomGenericException("1", "exception:io exception", caller);
|
||||
} catch (JAXBException e) {
|
||||
// TODO Auto-generated catch block
|
||||
throw new CustomGenericException("1", "exception:io exception", caller);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "deleteTest", method = { RequestMethod.GET,
|
||||
RequestMethod.POST })
|
||||
@ResponseBody
|
||||
public BaseResponseModel deleteTest(HttpServletResponse response,
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@RequestParam String testPlanId) throws CustomGenericException {
|
||||
String url = "testPlan" + "/removeTestPlanFromPool";
|
||||
String caller = "TestPlanHistoryController:deleteTest";
|
||||
Map<String, String> params = this.makeParamsMap("testPlanId",
|
||||
testPlanId);
|
||||
TestPlanResponseModel testPlanResponseModel = (TestPlanResponseModel) this
|
||||
.getTestPlanService()
|
||||
.getCommunicateWithMaster()
|
||||
.getResponseModel(accessToken, url,
|
||||
TestPlanResponseModel.class, params, caller);
|
||||
|
||||
if (testPlanResponseModel.isSuccess()) {
|
||||
|
||||
return new BaseResponseModel(true);
|
||||
} else {
|
||||
|
||||
return new BaseResponseModel(false,testPlanResponseModel.getFailCause());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,38 +1,38 @@
|
|||
package org.bench4q.web.exception;
|
||||
|
||||
public class CustomGenericException extends Exception {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String errorCode;
|
||||
private String errorMessage;
|
||||
private String source;
|
||||
|
||||
public String getErrorCode() {
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
public void setErrorCode(String errorCode) {
|
||||
this.errorCode = errorCode;
|
||||
}
|
||||
|
||||
public String getErrorMessage() {
|
||||
return errorMessage;
|
||||
}
|
||||
|
||||
public void setErrorMessage(String errorMessage) {
|
||||
this.errorMessage = errorMessage;
|
||||
}
|
||||
|
||||
public String getSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
public void setSource(String source) {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
public CustomGenericException(String errCode, String errMsg,String source) {
|
||||
this.errorCode = errCode;
|
||||
this.errorMessage = errMsg;
|
||||
this.source=source;
|
||||
}
|
||||
}
|
||||
package org.bench4q.web.exception;
|
||||
|
||||
public class CustomGenericException extends Exception {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String errorCode;
|
||||
private String errorMessage;
|
||||
private String source;
|
||||
|
||||
public String getErrorCode() {
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
public void setErrorCode(String errorCode) {
|
||||
this.errorCode = errorCode;
|
||||
}
|
||||
|
||||
public String getErrorMessage() {
|
||||
return errorMessage;
|
||||
}
|
||||
|
||||
public void setErrorMessage(String errorMessage) {
|
||||
this.errorMessage = errorMessage;
|
||||
}
|
||||
|
||||
public String getSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
public void setSource(String source) {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
public CustomGenericException(String errCode, String errMsg,String source) {
|
||||
this.errorCode = errCode;
|
||||
this.errorMessage = errMsg;
|
||||
this.source=source;
|
||||
}
|
||||
}
|
|
@ -1,43 +1,43 @@
|
|||
package org.bench4q.web.exception;
|
||||
|
||||
|
||||
public class ExceptionResponseModel {
|
||||
private final boolean success=false;
|
||||
private String failedMessage;
|
||||
private String failedCode;
|
||||
private String resource;
|
||||
public ExceptionResponseModel(String failedCode,String failedMessage,String resource) {
|
||||
this.failedCode=failedCode;
|
||||
this.failedMessage=failedMessage;
|
||||
this.resource=resource;
|
||||
}
|
||||
|
||||
public String getFailedMessage() {
|
||||
return failedMessage;
|
||||
}
|
||||
|
||||
public void setFailedMessage(String failedMessage) {
|
||||
this.failedMessage = failedMessage;
|
||||
}
|
||||
|
||||
public String getFailedCode() {
|
||||
return failedCode;
|
||||
}
|
||||
|
||||
public void setFailedCode(String failedCode) {
|
||||
this.failedCode = failedCode;
|
||||
}
|
||||
|
||||
public boolean isSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public String getResource() {
|
||||
return resource;
|
||||
}
|
||||
|
||||
public void setResource(String resource) {
|
||||
this.resource = resource;
|
||||
}
|
||||
|
||||
}
|
||||
package org.bench4q.web.exception;
|
||||
|
||||
|
||||
public class ExceptionResponseModel {
|
||||
private final boolean success=false;
|
||||
private String failedMessage;
|
||||
private String failedCode;
|
||||
private String resource;
|
||||
public ExceptionResponseModel(String failedCode,String failedMessage,String resource) {
|
||||
this.failedCode=failedCode;
|
||||
this.failedMessage=failedMessage;
|
||||
this.resource=resource;
|
||||
}
|
||||
|
||||
public String getFailedMessage() {
|
||||
return failedMessage;
|
||||
}
|
||||
|
||||
public void setFailedMessage(String failedMessage) {
|
||||
this.failedMessage = failedMessage;
|
||||
}
|
||||
|
||||
public String getFailedCode() {
|
||||
return failedCode;
|
||||
}
|
||||
|
||||
public void setFailedCode(String failedCode) {
|
||||
this.failedCode = failedCode;
|
||||
}
|
||||
|
||||
public boolean isSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public String getResource() {
|
||||
return resource;
|
||||
}
|
||||
|
||||
public void setResource(String resource) {
|
||||
this.resource = resource;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,44 +1,44 @@
|
|||
package org.bench4q.web.exception;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bench4q.web.model.BaseResponseModel;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
|
||||
@ControllerAdvice
|
||||
public class GlobalExceptionController {
|
||||
private Logger logger = Logger.getLogger(GlobalExceptionController.class);
|
||||
|
||||
@ExceptionHandler(CustomGenericException.class)
|
||||
@ResponseBody
|
||||
public BaseResponseModel handleCustomException(CustomGenericException ex) {
|
||||
logger.error(ex,ex.fillInStackTrace());
|
||||
BaseResponseModel responseModel = new BaseResponseModel(false,
|
||||
ex.getErrorMessage() + "source:" + ex.getSource());
|
||||
return responseModel;
|
||||
}
|
||||
|
||||
// 处理所有异常,自定义异常之外的异常都执行到这里.
|
||||
|
||||
@ExceptionHandler(JAXBException.class)
|
||||
public BaseResponseModel handleJAXBExceptionException(JAXBException ex) {
|
||||
logger.error(ex,ex.fillInStackTrace());
|
||||
BaseResponseModel responseModel = new BaseResponseModel(false,
|
||||
ex.getMessage());
|
||||
return responseModel;
|
||||
|
||||
}
|
||||
|
||||
@ExceptionHandler(Exception.class)
|
||||
@ResponseStatus(value=HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
public void handleAllException(Exception e) {
|
||||
|
||||
logger.error(e,e.fillInStackTrace());
|
||||
}
|
||||
|
||||
}
|
||||
package org.bench4q.web.exception;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bench4q.web.model.BaseResponseModel;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
|
||||
@ControllerAdvice
|
||||
public class GlobalExceptionController {
|
||||
private Logger logger = Logger.getLogger(GlobalExceptionController.class);
|
||||
|
||||
@ExceptionHandler(CustomGenericException.class)
|
||||
@ResponseBody
|
||||
public BaseResponseModel handleCustomException(CustomGenericException ex) {
|
||||
logger.error(ex,ex.fillInStackTrace());
|
||||
BaseResponseModel responseModel = new BaseResponseModel(false,
|
||||
ex.getErrorMessage() + "source:" + ex.getSource());
|
||||
return responseModel;
|
||||
}
|
||||
|
||||
// 处理所有异常,自定义异常之外的异常都执行到这里.
|
||||
|
||||
@ExceptionHandler(JAXBException.class)
|
||||
public BaseResponseModel handleJAXBExceptionException(JAXBException ex) {
|
||||
logger.error(ex,ex.fillInStackTrace());
|
||||
BaseResponseModel responseModel = new BaseResponseModel(false,
|
||||
ex.getMessage());
|
||||
return responseModel;
|
||||
|
||||
}
|
||||
|
||||
@ExceptionHandler(Exception.class)
|
||||
@ResponseStatus(value=HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
public void handleAllException(Exception e) {
|
||||
|
||||
logger.error(e,e.fillInStackTrace());
|
||||
}
|
||||
|
||||
}
|
|
@ -1,30 +1,30 @@
|
|||
package org.bench4q.web.extractObjectFromXml;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.JAXBException;
|
||||
import javax.xml.bind.Marshaller;
|
||||
import javax.xml.bind.Unmarshaller;
|
||||
|
||||
|
||||
public class ObjectXmlExchange {
|
||||
public static Object fromXml(Class<?> objectClass, String content) throws JAXBException {
|
||||
if(content==null)
|
||||
return null;
|
||||
Unmarshaller unmarshaller;
|
||||
unmarshaller = JAXBContext.newInstance(objectClass)
|
||||
.createUnmarshaller();
|
||||
return unmarshaller.unmarshal(new ByteArrayInputStream(content
|
||||
.getBytes()));
|
||||
}
|
||||
public static String toXml(Class<?> classToMarshal, Object input) throws JAXBException {
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
Marshaller marshaller;
|
||||
marshaller = JAXBContext.newInstance(classToMarshal)
|
||||
.createMarshaller();
|
||||
marshaller.marshal(input, os);
|
||||
return os.toString();
|
||||
}
|
||||
}
|
||||
package org.bench4q.web.extractObjectFromXml;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.JAXBException;
|
||||
import javax.xml.bind.Marshaller;
|
||||
import javax.xml.bind.Unmarshaller;
|
||||
|
||||
|
||||
public class ObjectXmlExchange {
|
||||
public static Object fromXml(Class<?> objectClass, String content) throws JAXBException {
|
||||
if(content==null)
|
||||
return null;
|
||||
Unmarshaller unmarshaller;
|
||||
unmarshaller = JAXBContext.newInstance(objectClass)
|
||||
.createUnmarshaller();
|
||||
return unmarshaller.unmarshal(new ByteArrayInputStream(content
|
||||
.getBytes()));
|
||||
}
|
||||
public static String toXml(Class<?> classToMarshal, Object input) throws JAXBException {
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
Marshaller marshaller;
|
||||
marshaller = JAXBContext.newInstance(classToMarshal)
|
||||
.createMarshaller();
|
||||
marshaller.marshal(input, os);
|
||||
return os.toString();
|
||||
}
|
||||
}
|
|
@ -1,18 +1,18 @@
|
|||
package org.bench4q.web.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bench4q.share.models.master.AgentModel;
|
||||
|
||||
public class AgentListModel {
|
||||
private List<AgentModel> list;
|
||||
|
||||
public List<AgentModel> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
public void setList(List<AgentModel> list) {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
}
|
||||
package org.bench4q.web.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bench4q.share.models.master.AgentModel;
|
||||
|
||||
public class AgentListModel {
|
||||
private List<AgentModel> list;
|
||||
|
||||
public List<AgentModel> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
public void setList(List<AgentModel> list) {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,38 +1,38 @@
|
|||
package org.bench4q.web.model;
|
||||
|
||||
|
||||
public class BaseResponseModel {
|
||||
private boolean success ;
|
||||
private String failedMessage;
|
||||
private Object data;
|
||||
public BaseResponseModel(boolean success){
|
||||
this.success=success;
|
||||
|
||||
}
|
||||
public BaseResponseModel(boolean success,String failedMessage){
|
||||
this.success=success;
|
||||
this.failedMessage=failedMessage;
|
||||
}
|
||||
public BaseResponseModel(boolean success,Object data){
|
||||
this.success=success;
|
||||
this.data=data;
|
||||
}
|
||||
public boolean isSuccess() {
|
||||
return success;
|
||||
}
|
||||
public void setSuccess(boolean success) {
|
||||
this.success = success;
|
||||
}
|
||||
public String getFailedMessage() {
|
||||
return failedMessage;
|
||||
}
|
||||
public void setFailedMessage(String failedMessage) {
|
||||
this.failedMessage = failedMessage;
|
||||
}
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
public void setData(Object data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
package org.bench4q.web.model;
|
||||
|
||||
|
||||
public class BaseResponseModel {
|
||||
private boolean success ;
|
||||
private String failedMessage;
|
||||
private Object data;
|
||||
public BaseResponseModel(boolean success){
|
||||
this.success=success;
|
||||
|
||||
}
|
||||
public BaseResponseModel(boolean success,String failedMessage){
|
||||
this.success=success;
|
||||
this.failedMessage=failedMessage;
|
||||
}
|
||||
public BaseResponseModel(boolean success,Object data){
|
||||
this.success=success;
|
||||
this.data=data;
|
||||
}
|
||||
public boolean isSuccess() {
|
||||
return success;
|
||||
}
|
||||
public void setSuccess(boolean success) {
|
||||
this.success = success;
|
||||
}
|
||||
public String getFailedMessage() {
|
||||
return failedMessage;
|
||||
}
|
||||
public void setFailedMessage(String failedMessage) {
|
||||
this.failedMessage = failedMessage;
|
||||
}
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
public void setData(Object data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
|
@ -1,43 +1,43 @@
|
|||
package org.bench4q.web.model;
|
||||
|
||||
import org.bench4q.share.models.ErrorResponseModel;
|
||||
|
||||
|
||||
public class Bench4qWebException extends Exception{
|
||||
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String code;
|
||||
private String message;
|
||||
private String resource;
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public String getResource() {
|
||||
return resource;
|
||||
}
|
||||
|
||||
public void setResource(String resource) {
|
||||
this.resource = resource;
|
||||
}
|
||||
|
||||
public Bench4qWebException(ErrorResponseModel errorReponseModel){
|
||||
this.code=errorReponseModel.getCode();
|
||||
this.message=errorReponseModel.getMessage();
|
||||
this.resource=errorReponseModel.getResource();
|
||||
}
|
||||
}
|
||||
package org.bench4q.web.model;
|
||||
|
||||
import org.bench4q.share.models.ErrorResponseModel;
|
||||
|
||||
|
||||
public class Bench4qWebException extends Exception{
|
||||
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String code;
|
||||
private String message;
|
||||
private String resource;
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public String getResource() {
|
||||
return resource;
|
||||
}
|
||||
|
||||
public void setResource(String resource) {
|
||||
this.resource = resource;
|
||||
}
|
||||
|
||||
public Bench4qWebException(ErrorResponseModel errorReponseModel){
|
||||
this.code=errorReponseModel.getCode();
|
||||
this.message=errorReponseModel.getMessage();
|
||||
this.resource=errorReponseModel.getResource();
|
||||
}
|
||||
}
|
|
@ -1,11 +1,11 @@
|
|||
package org.bench4q.web.model;
|
||||
|
||||
public class CheckBox extends ParamTypeModel {
|
||||
|
||||
public CheckBox(String type, String valueSeperator, String fieldSeperator,
|
||||
int size, String cols, String rows) {
|
||||
super(type, valueSeperator, fieldSeperator, size, cols, rows);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
}
|
||||
package org.bench4q.web.model;
|
||||
|
||||
public class CheckBox extends ParamTypeModel {
|
||||
|
||||
public CheckBox(String type, String valueSeperator, String fieldSeperator,
|
||||
int size, String cols, String rows) {
|
||||
super(type, valueSeperator, fieldSeperator, size, cols, rows);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
}
|
|
@ -1,13 +1,13 @@
|
|||
package org.bench4q.web.model;
|
||||
|
||||
public class Field extends ParamTypeModel{
|
||||
|
||||
public Field(String type, String valueSeperator, String fieldSeperator,
|
||||
int size, String cols, String rows) {
|
||||
super(type, valueSeperator, fieldSeperator, size, cols, rows);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
package org.bench4q.web.model;
|
||||
|
||||
public class Field extends ParamTypeModel{
|
||||
|
||||
public Field(String type, String valueSeperator, String fieldSeperator,
|
||||
int size, String cols, String rows) {
|
||||
super(type, valueSeperator, fieldSeperator, size, cols, rows);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,35 +1,35 @@
|
|||
package org.bench4q.web.model;
|
||||
|
||||
|
||||
public class MethodParamModel {
|
||||
|
||||
private String name;
|
||||
private String label;
|
||||
private ParamTypeModel paramTypeModel;
|
||||
|
||||
public MethodParamModel(String name, String label, ParamTypeModel paramTypeModel){
|
||||
this.name=name;
|
||||
this.label=label;
|
||||
this.paramTypeModel=paramTypeModel;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
public ParamTypeModel getParamTypeModel() {
|
||||
return paramTypeModel;
|
||||
}
|
||||
public void setParamTypeModel(ParamTypeModel paramTypeModel) {
|
||||
this.paramTypeModel = paramTypeModel;
|
||||
}
|
||||
|
||||
}
|
||||
package org.bench4q.web.model;
|
||||
|
||||
|
||||
public class MethodParamModel {
|
||||
|
||||
private String name;
|
||||
private String label;
|
||||
private ParamTypeModel paramTypeModel;
|
||||
|
||||
public MethodParamModel(String name, String label, ParamTypeModel paramTypeModel){
|
||||
this.name=name;
|
||||
this.label=label;
|
||||
this.paramTypeModel=paramTypeModel;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
public ParamTypeModel getParamTypeModel() {
|
||||
return paramTypeModel;
|
||||
}
|
||||
public void setParamTypeModel(ParamTypeModel paramTypeModel) {
|
||||
this.paramTypeModel = paramTypeModel;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,12 +1,12 @@
|
|||
package org.bench4q.web.model;
|
||||
|
||||
public class MultiField extends ParamTypeModel {
|
||||
|
||||
public MultiField(String type, String valueSeperator,
|
||||
String fieldSeperator, int size, String cols, String rows) {
|
||||
super(type, valueSeperator, fieldSeperator, size, cols, rows);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
package org.bench4q.web.model;
|
||||
|
||||
public class MultiField extends ParamTypeModel {
|
||||
|
||||
public MultiField(String type, String valueSeperator,
|
||||
String fieldSeperator, int size, String cols, String rows) {
|
||||
super(type, valueSeperator, fieldSeperator, size, cols, rows);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,70 +1,70 @@
|
|||
package org.bench4q.web.model;
|
||||
|
||||
public class ParamTypeModel {
|
||||
|
||||
private String type;
|
||||
private String valueSeperator;
|
||||
private String fieldSeperator;
|
||||
private int size;
|
||||
private String cols;
|
||||
private String rows;
|
||||
|
||||
public ParamTypeModel(String type,String valueSeperator,String fieldSeperator,int size,String cols,String rows){
|
||||
this.type=type;
|
||||
this.valueSeperator=valueSeperator;
|
||||
this.fieldSeperator=fieldSeperator;
|
||||
this.size=size;
|
||||
this.cols=cols;
|
||||
this.rows=rows;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getValueSeperator() {
|
||||
return valueSeperator;
|
||||
}
|
||||
|
||||
public void setValueSeperator(String valueSeperator) {
|
||||
this.valueSeperator = valueSeperator;
|
||||
}
|
||||
|
||||
public String getFieldSeperator() {
|
||||
return fieldSeperator;
|
||||
}
|
||||
|
||||
public void setFieldSeperator(String fieldSeperator) {
|
||||
this.fieldSeperator = fieldSeperator;
|
||||
}
|
||||
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public void setSize(int size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public String getCols() {
|
||||
return cols;
|
||||
}
|
||||
|
||||
public void setCols(String cols) {
|
||||
this.cols = cols;
|
||||
}
|
||||
|
||||
public String getRows() {
|
||||
return rows;
|
||||
}
|
||||
|
||||
public void setRows(String rows) {
|
||||
this.rows = rows;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
package org.bench4q.web.model;
|
||||
|
||||
public class ParamTypeModel {
|
||||
|
||||
private String type;
|
||||
private String valueSeperator;
|
||||
private String fieldSeperator;
|
||||
private int size;
|
||||
private String cols;
|
||||
private String rows;
|
||||
|
||||
public ParamTypeModel(String type,String valueSeperator,String fieldSeperator,int size,String cols,String rows){
|
||||
this.type=type;
|
||||
this.valueSeperator=valueSeperator;
|
||||
this.fieldSeperator=fieldSeperator;
|
||||
this.size=size;
|
||||
this.cols=cols;
|
||||
this.rows=rows;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getValueSeperator() {
|
||||
return valueSeperator;
|
||||
}
|
||||
|
||||
public void setValueSeperator(String valueSeperator) {
|
||||
this.valueSeperator = valueSeperator;
|
||||
}
|
||||
|
||||
public String getFieldSeperator() {
|
||||
return fieldSeperator;
|
||||
}
|
||||
|
||||
public void setFieldSeperator(String fieldSeperator) {
|
||||
this.fieldSeperator = fieldSeperator;
|
||||
}
|
||||
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public void setSize(int size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public String getCols() {
|
||||
return cols;
|
||||
}
|
||||
|
||||
public void setCols(String cols) {
|
||||
this.cols = cols;
|
||||
}
|
||||
|
||||
public String getRows() {
|
||||
return rows;
|
||||
}
|
||||
|
||||
public void setRows(String rows) {
|
||||
this.rows = rows;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,27 +1,27 @@
|
|||
package org.bench4q.web.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class PluginMethodListModel {
|
||||
|
||||
private String pluginName;
|
||||
private List<String> methodList;
|
||||
|
||||
public PluginMethodListModel(String pluginName,List<String> methodList){
|
||||
this.pluginName=pluginName;
|
||||
this.methodList=methodList;
|
||||
}
|
||||
|
||||
public String getPluginName() {
|
||||
return pluginName;
|
||||
}
|
||||
public void setPluginName(String pluginName) {
|
||||
this.pluginName = pluginName;
|
||||
}
|
||||
public List<String> getMethodList() {
|
||||
return methodList;
|
||||
}
|
||||
public void setMethodList(List<String> methodList) {
|
||||
this.methodList = methodList;
|
||||
}
|
||||
}
|
||||
package org.bench4q.web.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class PluginMethodListModel {
|
||||
|
||||
private String pluginName;
|
||||
private List<String> methodList;
|
||||
|
||||
public PluginMethodListModel(String pluginName,List<String> methodList){
|
||||
this.pluginName=pluginName;
|
||||
this.methodList=methodList;
|
||||
}
|
||||
|
||||
public String getPluginName() {
|
||||
return pluginName;
|
||||
}
|
||||
public void setPluginName(String pluginName) {
|
||||
this.pluginName = pluginName;
|
||||
}
|
||||
public List<String> getMethodList() {
|
||||
return methodList;
|
||||
}
|
||||
public void setMethodList(List<String> methodList) {
|
||||
this.methodList = methodList;
|
||||
}
|
||||
}
|
|
@ -1,18 +1,18 @@
|
|||
package org.bench4q.web.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bench4q.share.models.master.PortModel;
|
||||
|
||||
public class PortListModel {
|
||||
private List<PortModel> list;
|
||||
|
||||
public List<PortModel> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
public void setList(List<PortModel> list) {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
}
|
||||
package org.bench4q.web.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bench4q.share.models.master.PortModel;
|
||||
|
||||
public class PortListModel {
|
||||
private List<PortModel> list;
|
||||
|
||||
public List<PortModel> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
public void setList(List<PortModel> list) {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,32 +1,32 @@
|
|||
package org.bench4q.web.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ResultInfoModel {
|
||||
|
||||
private String result;
|
||||
private List<ResultInfoModel> childResults;
|
||||
public ResultInfoModel(){
|
||||
|
||||
}
|
||||
public ResultInfoModel(String result) {
|
||||
this.result=result;
|
||||
}
|
||||
public ResultInfoModel(String result,List<ResultInfoModel> resultInfoModels){
|
||||
this.result=result;
|
||||
this.childResults=resultInfoModels;
|
||||
}
|
||||
public String getResult() {
|
||||
return result;
|
||||
}
|
||||
public void setResult(String result) {
|
||||
this.result = result;
|
||||
}
|
||||
public List<ResultInfoModel> getChildResults() {
|
||||
return childResults;
|
||||
}
|
||||
public void setChildResults(List<ResultInfoModel> childResults) {
|
||||
this.childResults = childResults;
|
||||
}
|
||||
|
||||
}
|
||||
package org.bench4q.web.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ResultInfoModel {
|
||||
|
||||
private String result;
|
||||
private List<ResultInfoModel> childResults;
|
||||
public ResultInfoModel(){
|
||||
|
||||
}
|
||||
public ResultInfoModel(String result) {
|
||||
this.result=result;
|
||||
}
|
||||
public ResultInfoModel(String result,List<ResultInfoModel> resultInfoModels){
|
||||
this.result=result;
|
||||
this.childResults=resultInfoModels;
|
||||
}
|
||||
public String getResult() {
|
||||
return result;
|
||||
}
|
||||
public void setResult(String result) {
|
||||
this.result = result;
|
||||
}
|
||||
public List<ResultInfoModel> getChildResults() {
|
||||
return childResults;
|
||||
}
|
||||
public void setChildResults(List<ResultInfoModel> childResults) {
|
||||
this.childResults = childResults;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,27 +1,27 @@
|
|||
package org.bench4q.web.model;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class ResultModel {
|
||||
private boolean finished;
|
||||
private Object data;
|
||||
private Date time;
|
||||
public boolean isFinished() {
|
||||
return finished;
|
||||
}
|
||||
public void setFinished(boolean finished) {
|
||||
this.finished = finished;
|
||||
}
|
||||
public Date getTime() {
|
||||
return time;
|
||||
}
|
||||
public void setTime(Date time) {
|
||||
this.time = time;
|
||||
}
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
public void setData(Object data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
package org.bench4q.web.model;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class ResultModel {
|
||||
private boolean finished;
|
||||
private Object data;
|
||||
private Date time;
|
||||
public boolean isFinished() {
|
||||
return finished;
|
||||
}
|
||||
public void setFinished(boolean finished) {
|
||||
this.finished = finished;
|
||||
}
|
||||
public Date getTime() {
|
||||
return time;
|
||||
}
|
||||
public void setTime(Date time) {
|
||||
this.time = time;
|
||||
}
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
public void setData(Object data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
|
@ -1,30 +1,30 @@
|
|||
package org.bench4q.web.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class RunningScriptInfoModel {
|
||||
|
||||
private int scriptId;
|
||||
private String scriptName;
|
||||
private List<ResultInfoModel> childResults;
|
||||
|
||||
public int getScriptId() {
|
||||
return scriptId;
|
||||
}
|
||||
public void setScriptId(int scriptId) {
|
||||
this.scriptId = scriptId;
|
||||
}
|
||||
public String getScriptName() {
|
||||
return scriptName;
|
||||
}
|
||||
public void setScriptName(String scriptName) {
|
||||
this.scriptName = scriptName;
|
||||
}
|
||||
public List<ResultInfoModel> getChildResults() {
|
||||
return childResults;
|
||||
}
|
||||
public void setChildResults(List<ResultInfoModel> childResults) {
|
||||
this.childResults = childResults;
|
||||
}
|
||||
|
||||
}
|
||||
package org.bench4q.web.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class RunningScriptInfoModel {
|
||||
|
||||
private int scriptId;
|
||||
private String scriptName;
|
||||
private List<ResultInfoModel> childResults;
|
||||
|
||||
public int getScriptId() {
|
||||
return scriptId;
|
||||
}
|
||||
public void setScriptId(int scriptId) {
|
||||
this.scriptId = scriptId;
|
||||
}
|
||||
public String getScriptName() {
|
||||
return scriptName;
|
||||
}
|
||||
public void setScriptName(String scriptName) {
|
||||
this.scriptName = scriptName;
|
||||
}
|
||||
public List<ResultInfoModel> getChildResults() {
|
||||
return childResults;
|
||||
}
|
||||
public void setChildResults(List<ResultInfoModel> childResults) {
|
||||
this.childResults = childResults;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,60 +1,60 @@
|
|||
package org.bench4q.web.model;
|
||||
|
||||
public class ScriptModel {
|
||||
private int id;
|
||||
private int load;
|
||||
private long warmup;
|
||||
private long executeRange;
|
||||
private long cooldown;
|
||||
public ScriptModel() {
|
||||
}
|
||||
public ScriptModel(int id,int load,long warmup,long executeRange,long cooldown){
|
||||
this.id=id;
|
||||
this.load=load;
|
||||
this.warmup=warmup;
|
||||
this.executeRange=executeRange;
|
||||
this.cooldown=cooldown;
|
||||
|
||||
}
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getLoad() {
|
||||
return load;
|
||||
}
|
||||
|
||||
public void setLoad(int load) {
|
||||
this.load = load;
|
||||
}
|
||||
|
||||
public long getWarmup() {
|
||||
return warmup;
|
||||
}
|
||||
|
||||
public void setWarmup(long warmup) {
|
||||
this.warmup = warmup;
|
||||
}
|
||||
|
||||
public long getExecuteRange() {
|
||||
return executeRange;
|
||||
}
|
||||
|
||||
public void setExecuteRange(long executeRange) {
|
||||
this.executeRange = executeRange;
|
||||
}
|
||||
|
||||
public long getCooldown() {
|
||||
return cooldown;
|
||||
}
|
||||
|
||||
public void setCooldown(long cooldown) {
|
||||
this.cooldown = cooldown;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
package org.bench4q.web.model;
|
||||
|
||||
public class ScriptModel {
|
||||
private int id;
|
||||
private int load;
|
||||
private long warmup;
|
||||
private long executeRange;
|
||||
private long cooldown;
|
||||
public ScriptModel() {
|
||||
}
|
||||
public ScriptModel(int id,int load,long warmup,long executeRange,long cooldown){
|
||||
this.id=id;
|
||||
this.load=load;
|
||||
this.warmup=warmup;
|
||||
this.executeRange=executeRange;
|
||||
this.cooldown=cooldown;
|
||||
|
||||
}
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getLoad() {
|
||||
return load;
|
||||
}
|
||||
|
||||
public void setLoad(int load) {
|
||||
this.load = load;
|
||||
}
|
||||
|
||||
public long getWarmup() {
|
||||
return warmup;
|
||||
}
|
||||
|
||||
public void setWarmup(long warmup) {
|
||||
this.warmup = warmup;
|
||||
}
|
||||
|
||||
public long getExecuteRange() {
|
||||
return executeRange;
|
||||
}
|
||||
|
||||
public void setExecuteRange(long executeRange) {
|
||||
this.executeRange = executeRange;
|
||||
}
|
||||
|
||||
public long getCooldown() {
|
||||
return cooldown;
|
||||
}
|
||||
|
||||
public void setCooldown(long cooldown) {
|
||||
this.cooldown = cooldown;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,39 +1,39 @@
|
|||
package org.bench4q.web.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SutInfo {
|
||||
|
||||
private String ip;
|
||||
private String port;
|
||||
|
||||
private List<ResultInfoModel> childResults;
|
||||
/*private List<String> cpu;
|
||||
private List<String> network;
|
||||
private final String mem=new String ("Memory");
|
||||
*/
|
||||
|
||||
public String getIp() {
|
||||
return ip;
|
||||
}
|
||||
|
||||
public void setIp(String ip) {
|
||||
this.ip = ip;
|
||||
}
|
||||
|
||||
public String getPort() {
|
||||
return port;
|
||||
}
|
||||
|
||||
public void setPort(String port) {
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
public List<ResultInfoModel> getChildResults() {
|
||||
return childResults;
|
||||
}
|
||||
|
||||
public void setChildResults(List<ResultInfoModel> childResults) {
|
||||
this.childResults = childResults;
|
||||
}
|
||||
package org.bench4q.web.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SutInfo {
|
||||
|
||||
private String ip;
|
||||
private String port;
|
||||
|
||||
private List<ResultInfoModel> childResults;
|
||||
/*private List<String> cpu;
|
||||
private List<String> network;
|
||||
private final String mem=new String ("Memory");
|
||||
*/
|
||||
|
||||
public String getIp() {
|
||||
return ip;
|
||||
}
|
||||
|
||||
public void setIp(String ip) {
|
||||
this.ip = ip;
|
||||
}
|
||||
|
||||
public String getPort() {
|
||||
return port;
|
||||
}
|
||||
|
||||
public void setPort(String port) {
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
public List<ResultInfoModel> getChildResults() {
|
||||
return childResults;
|
||||
}
|
||||
|
||||
public void setChildResults(List<ResultInfoModel> childResults) {
|
||||
this.childResults = childResults;
|
||||
}
|
||||
}
|
|
@ -1,13 +1,13 @@
|
|||
package org.bench4q.web.model;
|
||||
|
||||
public class Table extends ParamTypeModel {
|
||||
|
||||
public Table(String type, String valueSeperator, String fieldSeperator,
|
||||
int size, String cols, String rows) {
|
||||
super(type, valueSeperator, fieldSeperator, size, cols, rows);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
package org.bench4q.web.model;
|
||||
|
||||
public class Table extends ParamTypeModel {
|
||||
|
||||
public Table(String type, String valueSeperator, String fieldSeperator,
|
||||
int size, String cols, String rows) {
|
||||
super(type, valueSeperator, fieldSeperator, size, cols, rows);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,29 +1,29 @@
|
|||
package org.bench4q.web.model;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
public class TestBriefStatusModel {
|
||||
private long vus;
|
||||
private long requests;
|
||||
private Date time;
|
||||
public long getVus() {
|
||||
return vus;
|
||||
}
|
||||
public void setVus(long vus) {
|
||||
this.vus = vus;
|
||||
}
|
||||
public long getRequests() {
|
||||
return requests;
|
||||
}
|
||||
public void setRequests(long requests) {
|
||||
this.requests = requests;
|
||||
}
|
||||
public Date getTime() {
|
||||
return time;
|
||||
}
|
||||
public void setTime(Date time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
}
|
||||
package org.bench4q.web.model;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
public class TestBriefStatusModel {
|
||||
private long vus;
|
||||
private long requests;
|
||||
private Date time;
|
||||
public long getVus() {
|
||||
return vus;
|
||||
}
|
||||
public void setVus(long vus) {
|
||||
this.vus = vus;
|
||||
}
|
||||
public long getRequests() {
|
||||
return requests;
|
||||
}
|
||||
public void setRequests(long requests) {
|
||||
this.requests = requests;
|
||||
}
|
||||
public Date getTime() {
|
||||
return time;
|
||||
}
|
||||
public void setTime(Date time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,19 +1,19 @@
|
|||
package org.bench4q.web.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bench4q.share.models.master.TestPlanDBModel;
|
||||
|
||||
public class TestPlanListModel {
|
||||
|
||||
private List<TestPlanDBModel> list;
|
||||
|
||||
public List<TestPlanDBModel> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
public void setList(List<TestPlanDBModel> list) {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
}
|
||||
package org.bench4q.web.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bench4q.share.models.master.TestPlanDBModel;
|
||||
|
||||
public class TestPlanListModel {
|
||||
|
||||
private List<TestPlanDBModel> list;
|
||||
|
||||
public List<TestPlanDBModel> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
public void setList(List<TestPlanDBModel> list) {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,51 +1,51 @@
|
|||
package org.bench4q.web.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class TestPlanRequestModel {
|
||||
|
||||
private List<String> ipList;
|
||||
private List<WebScriptModel> scriptList;
|
||||
private String testPlanName;
|
||||
|
||||
public TestPlanRequestModel() {
|
||||
|
||||
}
|
||||
|
||||
public TestPlanRequestModel(String testPlanName,
|
||||
List<WebScriptModel> scriptList) {
|
||||
this.testPlanName = testPlanName;
|
||||
this.scriptList = scriptList;
|
||||
}
|
||||
|
||||
public TestPlanRequestModel(String testPlanName,
|
||||
List<WebScriptModel> scriptList, List<String> ipList) {
|
||||
this.ipList = ipList;
|
||||
}
|
||||
|
||||
public String getTestPlanName() {
|
||||
return testPlanName;
|
||||
}
|
||||
|
||||
public void setTestPlanName(String testPlanName) {
|
||||
this.testPlanName = testPlanName;
|
||||
}
|
||||
|
||||
public List<String> getIpList() {
|
||||
return ipList;
|
||||
}
|
||||
|
||||
public void setIpList(List<String> ipList) {
|
||||
this.ipList = ipList;
|
||||
}
|
||||
|
||||
public List<WebScriptModel> getScriptList() {
|
||||
return scriptList;
|
||||
}
|
||||
|
||||
public void setScriptList(List<WebScriptModel> scriptList) {
|
||||
this.scriptList = scriptList;
|
||||
}
|
||||
|
||||
}
|
||||
package org.bench4q.web.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class TestPlanRequestModel {
|
||||
|
||||
private List<String> ipList;
|
||||
private List<WebScriptModel> scriptList;
|
||||
private String testPlanName;
|
||||
|
||||
public TestPlanRequestModel() {
|
||||
|
||||
}
|
||||
|
||||
public TestPlanRequestModel(String testPlanName,
|
||||
List<WebScriptModel> scriptList) {
|
||||
this.testPlanName = testPlanName;
|
||||
this.scriptList = scriptList;
|
||||
}
|
||||
|
||||
public TestPlanRequestModel(String testPlanName,
|
||||
List<WebScriptModel> scriptList, List<String> ipList) {
|
||||
this.ipList = ipList;
|
||||
}
|
||||
|
||||
public String getTestPlanName() {
|
||||
return testPlanName;
|
||||
}
|
||||
|
||||
public void setTestPlanName(String testPlanName) {
|
||||
this.testPlanName = testPlanName;
|
||||
}
|
||||
|
||||
public List<String> getIpList() {
|
||||
return ipList;
|
||||
}
|
||||
|
||||
public void setIpList(List<String> ipList) {
|
||||
this.ipList = ipList;
|
||||
}
|
||||
|
||||
public List<WebScriptModel> getScriptList() {
|
||||
return scriptList;
|
||||
}
|
||||
|
||||
public void setScriptList(List<WebScriptModel> scriptList) {
|
||||
this.scriptList = scriptList;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,38 +1,38 @@
|
|||
package org.bench4q.web.model;
|
||||
|
||||
public class TestPlanTaskModel {
|
||||
private String name;
|
||||
private String id;
|
||||
private String status;
|
||||
public TestPlanTaskModel(String name,String id,String status){
|
||||
this.name=name;
|
||||
this.id=id;
|
||||
this.status=status;
|
||||
}
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
package org.bench4q.web.model;
|
||||
|
||||
public class TestPlanTaskModel {
|
||||
private String name;
|
||||
private String id;
|
||||
private String status;
|
||||
public TestPlanTaskModel(String name,String id,String status){
|
||||
this.name=name;
|
||||
this.id=id;
|
||||
this.status=status;
|
||||
}
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,52 +1,52 @@
|
|||
package org.bench4q.web.model;
|
||||
|
||||
public class UploadBehaviorRequestModel {
|
||||
|
||||
private String tableList;
|
||||
private String checkList;
|
||||
private String fieldList;
|
||||
private String multiList;
|
||||
|
||||
public UploadBehaviorRequestModel(String tableList, String checkList, String fieldList, String multiList){
|
||||
this.tableList=tableList;
|
||||
this.checkList=checkList;
|
||||
this.fieldList=fieldList;
|
||||
this.multiList=multiList;
|
||||
}
|
||||
|
||||
public String getTableList() {
|
||||
return tableList;
|
||||
}
|
||||
|
||||
public void setTableList(String tableList) {
|
||||
this.tableList = tableList;
|
||||
}
|
||||
|
||||
public String getCheckList() {
|
||||
return checkList;
|
||||
}
|
||||
|
||||
public void setCheckList(String checkList) {
|
||||
this.checkList = checkList;
|
||||
}
|
||||
|
||||
public String getFieldList() {
|
||||
return fieldList;
|
||||
}
|
||||
|
||||
public void setFieldList(String fieldList) {
|
||||
this.fieldList = fieldList;
|
||||
}
|
||||
|
||||
public String getMultiList() {
|
||||
return multiList;
|
||||
}
|
||||
|
||||
public void setMultiList(String multiList) {
|
||||
this.multiList = multiList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
package org.bench4q.web.model;
|
||||
|
||||
public class UploadBehaviorRequestModel {
|
||||
|
||||
private String tableList;
|
||||
private String checkList;
|
||||
private String fieldList;
|
||||
private String multiList;
|
||||
|
||||
public UploadBehaviorRequestModel(String tableList, String checkList, String fieldList, String multiList){
|
||||
this.tableList=tableList;
|
||||
this.checkList=checkList;
|
||||
this.fieldList=fieldList;
|
||||
this.multiList=multiList;
|
||||
}
|
||||
|
||||
public String getTableList() {
|
||||
return tableList;
|
||||
}
|
||||
|
||||
public void setTableList(String tableList) {
|
||||
this.tableList = tableList;
|
||||
}
|
||||
|
||||
public String getCheckList() {
|
||||
return checkList;
|
||||
}
|
||||
|
||||
public void setCheckList(String checkList) {
|
||||
this.checkList = checkList;
|
||||
}
|
||||
|
||||
public String getFieldList() {
|
||||
return fieldList;
|
||||
}
|
||||
|
||||
public void setFieldList(String fieldList) {
|
||||
this.fieldList = fieldList;
|
||||
}
|
||||
|
||||
public String getMultiList() {
|
||||
return multiList;
|
||||
}
|
||||
|
||||
public void setMultiList(String multiList) {
|
||||
this.multiList = multiList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,36 +1,36 @@
|
|||
package org.bench4q.web.model;
|
||||
|
||||
public class UrlContentTypeDistributionModel {
|
||||
|
||||
private String contentType;
|
||||
private long count;
|
||||
private double percentage;
|
||||
public UrlContentTypeDistributionModel(){
|
||||
|
||||
}
|
||||
public UrlContentTypeDistributionModel(String contentType,long count,double percentage){
|
||||
this.contentType=contentType;
|
||||
this.count=count;
|
||||
this.percentage=percentage;
|
||||
}
|
||||
|
||||
public String getContentType() {
|
||||
return contentType;
|
||||
}
|
||||
public void setContentType(String contentType) {
|
||||
this.contentType = contentType;
|
||||
}
|
||||
public long getCount() {
|
||||
return count;
|
||||
}
|
||||
public void setCount(long count) {
|
||||
this.count = count;
|
||||
}
|
||||
public double getPercentage() {
|
||||
return percentage;
|
||||
}
|
||||
public void setPercentage(double percentage) {
|
||||
this.percentage = percentage;
|
||||
}
|
||||
|
||||
}
|
||||
package org.bench4q.web.model;
|
||||
|
||||
public class UrlContentTypeDistributionModel {
|
||||
|
||||
private String contentType;
|
||||
private long count;
|
||||
private double percentage;
|
||||
public UrlContentTypeDistributionModel(){
|
||||
|
||||
}
|
||||
public UrlContentTypeDistributionModel(String contentType,long count,double percentage){
|
||||
this.contentType=contentType;
|
||||
this.count=count;
|
||||
this.percentage=percentage;
|
||||
}
|
||||
|
||||
public String getContentType() {
|
||||
return contentType;
|
||||
}
|
||||
public void setContentType(String contentType) {
|
||||
this.contentType = contentType;
|
||||
}
|
||||
public long getCount() {
|
||||
return count;
|
||||
}
|
||||
public void setCount(long count) {
|
||||
this.count = count;
|
||||
}
|
||||
public double getPercentage() {
|
||||
return percentage;
|
||||
}
|
||||
public void setPercentage(double percentage) {
|
||||
this.percentage = percentage;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,60 +1,60 @@
|
|||
package org.bench4q.web.model;
|
||||
|
||||
public class WebScriptModel {
|
||||
private int id;
|
||||
private int load;
|
||||
private long warmup;
|
||||
private long executeRange;
|
||||
private long cooldown;
|
||||
public WebScriptModel() {
|
||||
}
|
||||
public WebScriptModel(int id,int load,long warmup,long executeRange,long cooldown){
|
||||
this.id=id;
|
||||
this.load=load;
|
||||
this.warmup=warmup;
|
||||
this.executeRange=executeRange;
|
||||
this.cooldown=cooldown;
|
||||
|
||||
}
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getLoad() {
|
||||
return load;
|
||||
}
|
||||
|
||||
public void setLoad(int load) {
|
||||
this.load = load;
|
||||
}
|
||||
|
||||
public long getWarmup() {
|
||||
return warmup;
|
||||
}
|
||||
|
||||
public void setWarmup(long warmup) {
|
||||
this.warmup = warmup;
|
||||
}
|
||||
|
||||
public long getExecuteRange() {
|
||||
return executeRange;
|
||||
}
|
||||
|
||||
public void setExecuteRange(long executeRange) {
|
||||
this.executeRange = executeRange;
|
||||
}
|
||||
|
||||
public long getCooldown() {
|
||||
return cooldown;
|
||||
}
|
||||
|
||||
public void setCooldown(long cooldown) {
|
||||
this.cooldown = cooldown;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
package org.bench4q.web.model;
|
||||
|
||||
public class WebScriptModel {
|
||||
private int id;
|
||||
private int load;
|
||||
private long warmup;
|
||||
private long executeRange;
|
||||
private long cooldown;
|
||||
public WebScriptModel() {
|
||||
}
|
||||
public WebScriptModel(int id,int load,long warmup,long executeRange,long cooldown){
|
||||
this.id=id;
|
||||
this.load=load;
|
||||
this.warmup=warmup;
|
||||
this.executeRange=executeRange;
|
||||
this.cooldown=cooldown;
|
||||
|
||||
}
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getLoad() {
|
||||
return load;
|
||||
}
|
||||
|
||||
public void setLoad(int load) {
|
||||
this.load = load;
|
||||
}
|
||||
|
||||
public long getWarmup() {
|
||||
return warmup;
|
||||
}
|
||||
|
||||
public void setWarmup(long warmup) {
|
||||
this.warmup = warmup;
|
||||
}
|
||||
|
||||
public long getExecuteRange() {
|
||||
return executeRange;
|
||||
}
|
||||
|
||||
public void setExecuteRange(long executeRange) {
|
||||
this.executeRange = executeRange;
|
||||
}
|
||||
|
||||
public long getCooldown() {
|
||||
return cooldown;
|
||||
}
|
||||
|
||||
public void setCooldown(long cooldown) {
|
||||
this.cooldown = cooldown;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,55 +1,55 @@
|
|||
package org.bench4q.web.model;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bench4q.share.enums.master.TestPlanStatus;
|
||||
import org.bench4q.share.models.master.MonitorModel;
|
||||
import org.bench4q.share.models.master.TestPlanResultModel;
|
||||
|
||||
public class WebTestPlanResultModel {
|
||||
private UUID testPlanId;
|
||||
private TestPlanStatus currentStatus;
|
||||
private Map<Integer,String> scriptIdNameMap;
|
||||
private List<MonitorModel> monitorModels;
|
||||
private List<Integer> scriptIds;
|
||||
public WebTestPlanResultModel(TestPlanResultModel testPlanResultModel){
|
||||
this.testPlanId=testPlanResultModel.getTestPlanId();
|
||||
this.currentStatus=testPlanResultModel.getCurrentStatus();
|
||||
this.monitorModels=testPlanResultModel.getMonitorModels();
|
||||
this.scriptIds=testPlanResultModel.getScriptIds();
|
||||
}
|
||||
public UUID getTestPlanId() {
|
||||
return testPlanId;
|
||||
}
|
||||
public void setTestPlanId(UUID testPlanId) {
|
||||
this.testPlanId = testPlanId;
|
||||
}
|
||||
public TestPlanStatus getCurrentStatus() {
|
||||
return currentStatus;
|
||||
}
|
||||
public void setCurrentStatus(TestPlanStatus currentStatus) {
|
||||
this.currentStatus = currentStatus;
|
||||
}
|
||||
public Map<Integer, String> getScriptIdNameMap() {
|
||||
return scriptIdNameMap;
|
||||
}
|
||||
public void setScriptIdNameMap(Map<Integer, String> scriptIdNameMap) {
|
||||
this.scriptIdNameMap = scriptIdNameMap;
|
||||
}
|
||||
public List<MonitorModel> getMonitorModels() {
|
||||
return monitorModels;
|
||||
}
|
||||
public void setMonitorModels(List<MonitorModel> monitorModels) {
|
||||
this.monitorModels = monitorModels;
|
||||
}
|
||||
public List<Integer> getScriptIds() {
|
||||
return scriptIds;
|
||||
}
|
||||
public void setScriptIds(List<Integer> scriptIds) {
|
||||
this.scriptIds = scriptIds;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
package org.bench4q.web.model;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bench4q.share.enums.master.TestPlanStatus;
|
||||
import org.bench4q.share.models.master.MonitorModel;
|
||||
import org.bench4q.share.models.master.TestPlanResultModel;
|
||||
|
||||
public class WebTestPlanResultModel {
|
||||
private UUID testPlanId;
|
||||
private TestPlanStatus currentStatus;
|
||||
private Map<Integer,String> scriptIdNameMap;
|
||||
private List<MonitorModel> monitorModels;
|
||||
private List<Integer> scriptIds;
|
||||
public WebTestPlanResultModel(TestPlanResultModel testPlanResultModel){
|
||||
this.testPlanId=testPlanResultModel.getTestPlanId();
|
||||
this.currentStatus=testPlanResultModel.getCurrentStatus();
|
||||
this.monitorModels=testPlanResultModel.getMonitorModels();
|
||||
this.scriptIds=testPlanResultModel.getScriptIds();
|
||||
}
|
||||
public UUID getTestPlanId() {
|
||||
return testPlanId;
|
||||
}
|
||||
public void setTestPlanId(UUID testPlanId) {
|
||||
this.testPlanId = testPlanId;
|
||||
}
|
||||
public TestPlanStatus getCurrentStatus() {
|
||||
return currentStatus;
|
||||
}
|
||||
public void setCurrentStatus(TestPlanStatus currentStatus) {
|
||||
this.currentStatus = currentStatus;
|
||||
}
|
||||
public Map<Integer, String> getScriptIdNameMap() {
|
||||
return scriptIdNameMap;
|
||||
}
|
||||
public void setScriptIdNameMap(Map<Integer, String> scriptIdNameMap) {
|
||||
this.scriptIdNameMap = scriptIdNameMap;
|
||||
}
|
||||
public List<MonitorModel> getMonitorModels() {
|
||||
return monitorModels;
|
||||
}
|
||||
public void setMonitorModels(List<MonitorModel> monitorModels) {
|
||||
this.monitorModels = monitorModels;
|
||||
}
|
||||
public List<Integer> getScriptIds() {
|
||||
return scriptIds;
|
||||
}
|
||||
public void setScriptIds(List<Integer> scriptIds) {
|
||||
this.scriptIds = scriptIds;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,46 +1,46 @@
|
|||
package org.bench4q.web.security;
|
||||
|
||||
import java.io.IOException;
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.web.filter.OncePerRequestFilter;
|
||||
|
||||
public class SessionFilter extends OncePerRequestFilter {
|
||||
|
||||
@Override
|
||||
protected void doFilterInternal(HttpServletRequest request,
|
||||
HttpServletResponse response, FilterChain filterChain)
|
||||
throws ServletException, IOException {
|
||||
String[] notFilter = new String[] { "/index", "/css/", "/script/",
|
||||
"/i18n/", "/images/", "/publiccontrol/", "/img/", "/login", "/adminLogin","/js","/register","/result"};
|
||||
|
||||
// 请求的uri
|
||||
String uri = request.getRequestURI();
|
||||
String user = (String) request.getSession().getAttribute("username");
|
||||
if (filterChain == null) {
|
||||
return;
|
||||
}
|
||||
if (user == null || user.equals("")) {
|
||||
// uri中包含background时才进行过滤
|
||||
for (String s : notFilter) {
|
||||
if (uri.contains(s)) {
|
||||
filterChain.doFilter(request, response);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (uri.equals("/")) {
|
||||
filterChain.doFilter(request, response);
|
||||
return;
|
||||
} else {
|
||||
response.sendRedirect("index.jsp");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
filterChain.doFilter(request, response);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
package org.bench4q.web.security;
|
||||
|
||||
import java.io.IOException;
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.web.filter.OncePerRequestFilter;
|
||||
|
||||
public class SessionFilter extends OncePerRequestFilter {
|
||||
|
||||
@Override
|
||||
protected void doFilterInternal(HttpServletRequest request,
|
||||
HttpServletResponse response, FilterChain filterChain)
|
||||
throws ServletException, IOException {
|
||||
String[] notFilter = new String[] { "/index", "/css/", "/script/",
|
||||
"/i18n/", "/images/", "/publiccontrol/", "/img/", "/login", "/adminLogin","/js","/register","/result"};
|
||||
|
||||
// 请求的uri
|
||||
String uri = request.getRequestURI();
|
||||
String user = (String) request.getSession().getAttribute("username");
|
||||
if (filterChain == null) {
|
||||
return;
|
||||
}
|
||||
if (user == null || user.equals("")) {
|
||||
// uri中包含background时才进行过滤
|
||||
for (String s : notFilter) {
|
||||
if (uri.contains(s)) {
|
||||
filterChain.doFilter(request, response);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (uri.equals("/")) {
|
||||
filterChain.doFilter(request, response);
|
||||
return;
|
||||
} else {
|
||||
response.sendRedirect("index.jsp");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
filterChain.doFilter(request, response);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,58 +1,58 @@
|
|||
package org.bench4q.web.service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import org.bench4q.web.model.ResultInfoModel;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class BaseService {
|
||||
protected final int monitorPort = 5556;
|
||||
protected CommunicateWithMaster communicateWithMaster;
|
||||
private static String CONFIG_FILE_NAME = "ipConfig.properties";
|
||||
public static final Properties prop = new Properties();
|
||||
|
||||
public BaseService() {
|
||||
|
||||
}
|
||||
|
||||
public String getCONFIG_FILE_NAME() {
|
||||
return CONFIG_FILE_NAME;
|
||||
}
|
||||
|
||||
public CommunicateWithMaster getCommunicateWithMaster() {
|
||||
return communicateWithMaster;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setCommunicateWithMaster(
|
||||
CommunicateWithMaster communicateWithMaster) {
|
||||
this.communicateWithMaster = communicateWithMaster;
|
||||
}
|
||||
|
||||
public static Map<String, String> makeParamsMap(String key, String value) {
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
params.put(key, value);
|
||||
return params;
|
||||
}
|
||||
|
||||
public ResultInfoModel getResultInfoModel(String result, String[] fields) {
|
||||
ResultInfoModel resultInfoModel = new ResultInfoModel();
|
||||
resultInfoModel.setResult(result);
|
||||
if (fields.length <= 0)
|
||||
return resultInfoModel;
|
||||
|
||||
resultInfoModel.setChildResults(new ArrayList<ResultInfoModel>());
|
||||
for (String field : fields) {
|
||||
ResultInfoModel scriptResultInfoModelChild = new ResultInfoModel();
|
||||
|
||||
scriptResultInfoModelChild.setResult(field);
|
||||
resultInfoModel.getChildResults().add(scriptResultInfoModelChild);
|
||||
}
|
||||
return resultInfoModel;
|
||||
}
|
||||
|
||||
}
|
||||
package org.bench4q.web.service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import org.bench4q.web.model.ResultInfoModel;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class BaseService {
|
||||
protected final int monitorPort = 5556;
|
||||
protected CommunicateWithMaster communicateWithMaster;
|
||||
private static String CONFIG_FILE_NAME = "ipConfig.properties";
|
||||
public static final Properties prop = new Properties();
|
||||
|
||||
public BaseService() {
|
||||
|
||||
}
|
||||
|
||||
public String getCONFIG_FILE_NAME() {
|
||||
return CONFIG_FILE_NAME;
|
||||
}
|
||||
|
||||
public CommunicateWithMaster getCommunicateWithMaster() {
|
||||
return communicateWithMaster;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setCommunicateWithMaster(
|
||||
CommunicateWithMaster communicateWithMaster) {
|
||||
this.communicateWithMaster = communicateWithMaster;
|
||||
}
|
||||
|
||||
public static Map<String, String> makeParamsMap(String key, String value) {
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
params.put(key, value);
|
||||
return params;
|
||||
}
|
||||
|
||||
public ResultInfoModel getResultInfoModel(String result, String[] fields) {
|
||||
ResultInfoModel resultInfoModel = new ResultInfoModel();
|
||||
resultInfoModel.setResult(result);
|
||||
if (fields.length <= 0)
|
||||
return resultInfoModel;
|
||||
|
||||
resultInfoModel.setChildResults(new ArrayList<ResultInfoModel>());
|
||||
for (String field : fields) {
|
||||
ResultInfoModel scriptResultInfoModelChild = new ResultInfoModel();
|
||||
|
||||
scriptResultInfoModelChild.setResult(field);
|
||||
resultInfoModel.getChildResults().add(scriptResultInfoModelChild);
|
||||
}
|
||||
return resultInfoModel;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,35 +1,35 @@
|
|||
package org.bench4q.web.service;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.List;
|
||||
|
||||
import org.bench4q.web.model.ResultModel;
|
||||
|
||||
public class ChangeToResultModel {
|
||||
public static ResultModel getResultModel(Object object, List<String> fieldNames) throws NoSuchFieldException {
|
||||
ResultModel resultModel = new ResultModel();
|
||||
|
||||
for (String fieldName : fieldNames)
|
||||
resultModel.setData(getSpecificFieldValue(object,
|
||||
fieldName));
|
||||
|
||||
|
||||
return resultModel;
|
||||
}
|
||||
private static Object getSpecificFieldValue(Object object, String fieldName)
|
||||
throws NoSuchFieldException {
|
||||
try {
|
||||
Field field = getFieldAndSetAccessible(object, fieldName);
|
||||
return field.get(object);
|
||||
} catch (Exception e) {
|
||||
throw new NoSuchFieldException();
|
||||
}
|
||||
}
|
||||
private static Field getFieldAndSetAccessible(Object object, String fieldName)
|
||||
throws NoSuchFieldException, SecurityException {
|
||||
Field field = object.getClass().getDeclaredField(fieldName);
|
||||
field.setAccessible(true);
|
||||
return field;
|
||||
}
|
||||
|
||||
}
|
||||
package org.bench4q.web.service;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.List;
|
||||
|
||||
import org.bench4q.web.model.ResultModel;
|
||||
|
||||
public class ChangeToResultModel {
|
||||
public static ResultModel getResultModel(Object object, List<String> fieldNames) throws NoSuchFieldException {
|
||||
ResultModel resultModel = new ResultModel();
|
||||
|
||||
for (String fieldName : fieldNames)
|
||||
resultModel.setData(getSpecificFieldValue(object,
|
||||
fieldName));
|
||||
|
||||
|
||||
return resultModel;
|
||||
}
|
||||
private static Object getSpecificFieldValue(Object object, String fieldName)
|
||||
throws NoSuchFieldException {
|
||||
try {
|
||||
Field field = getFieldAndSetAccessible(object, fieldName);
|
||||
return field.get(object);
|
||||
} catch (Exception e) {
|
||||
throw new NoSuchFieldException();
|
||||
}
|
||||
}
|
||||
private static Field getFieldAndSetAccessible(Object object, String fieldName)
|
||||
throws NoSuchFieldException, SecurityException {
|
||||
Field field = object.getClass().getDeclaredField(fieldName);
|
||||
field.setAccessible(true);
|
||||
return field;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,207 +1,207 @@
|
|||
package org.bench4q.web.service;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bench4q.share.communication.HttpRequester;
|
||||
import org.bench4q.share.communication.HttpRequester.HttpResponse;
|
||||
import org.bench4q.share.models.ErrorResponseModel;
|
||||
import org.bench4q.web.api.BaseControllerService;
|
||||
import org.bench4q.web.exception.CustomGenericException;
|
||||
import org.bench4q.web.extractObjectFromXml.ObjectXmlExchange;
|
||||
import org.eclipse.jetty.http.HttpStatus;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class CommunicateWithMaster {
|
||||
private Logger logger = Logger.getLogger(CommunicateWithMaster.class);
|
||||
private HttpRequester httpRequester;
|
||||
private final String HTTPRSEPONSE_INVALIDATE = "network error!";
|
||||
public final String FAIL_WITH_EXCEPTION = "fail with exception from master";
|
||||
private final String AUTH_HEADER_PROPERTY = "Authorization";
|
||||
private final String ACCES_TOCKEN_STARTER = "Bearer ";
|
||||
private final String IOEXCEPTION = "io exception: get httpresponse from master";
|
||||
private final String JAXBEXCEPTION = "JAXBException exception :get httpresponse from master";
|
||||
private final String BADHTTPRESPONSE = "bad response";
|
||||
private static final Properties prop = new Properties();
|
||||
private static final String CONFIG_FILE_NAME = "ipConfig.properties";
|
||||
private static String masterAddress = "";
|
||||
|
||||
private HttpRequester getHttpRequester() {
|
||||
return httpRequester;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private void setHttpRequester(HttpRequester httpRequester) {
|
||||
this.httpRequester = httpRequester;
|
||||
}
|
||||
|
||||
public static String getMasterAddress() {
|
||||
return masterAddress;
|
||||
}
|
||||
|
||||
private String addMaseterAddressToUrl(String url) {
|
||||
return masterAddress + url;
|
||||
}
|
||||
|
||||
static {
|
||||
String masterIpFilePath;
|
||||
try {
|
||||
masterIpFilePath = BaseControllerService.class.getClassLoader()
|
||||
.getResource("").toURI().getPath()
|
||||
+ CONFIG_FILE_NAME;
|
||||
FileInputStream inputStream = new FileInputStream(new File(
|
||||
masterIpFilePath));
|
||||
prop.load(inputStream);
|
||||
inputStream.close();
|
||||
masterAddress = prop.getProperty("masterAddress");
|
||||
} catch (Exception e1) {
|
||||
masterAddress = "133.133.12.1:7979";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Object getRespnseObjectByPostXml(String accessToken, String url,
|
||||
Class<?> objectClass, String content, String caller)
|
||||
throws CustomGenericException {
|
||||
try {
|
||||
url = this.addMaseterAddressToUrl(url);
|
||||
HttpResponse httpResponse = this.getHttpRequester().sendPostXml(
|
||||
url, content, this.makeAccessTockenMap(accessToken));
|
||||
if (HttpRequester.isInvalidResponse(httpResponse)) {
|
||||
logger.info(HTTPRSEPONSE_INVALIDATE);
|
||||
throw new CustomGenericException("1", HTTPRSEPONSE_INVALIDATE,
|
||||
caller);
|
||||
}
|
||||
if (httpResponse.getCode() == HttpStatus.BAD_REQUEST_400) {
|
||||
ErrorResponseModel errorResponseModel = (ErrorResponseModel) ObjectXmlExchange
|
||||
.fromXml(ErrorResponseModel.class,
|
||||
httpResponse.getContent());
|
||||
logException(errorResponseModel);
|
||||
throw new CustomGenericException("2", FAIL_WITH_EXCEPTION + "_"
|
||||
+ errorResponseModel.getMessage(), caller + "_"
|
||||
+ errorResponseModel.getResource());
|
||||
}
|
||||
if (httpResponse.getCode() != 200) {
|
||||
logger.info(caller + " get httpResponse code is not 200:");
|
||||
logger.info(httpResponse.getContent());
|
||||
throw new CustomGenericException("1", BADHTTPRESPONSE, caller);
|
||||
}
|
||||
Object responseObject = ObjectXmlExchange.fromXml(objectClass,
|
||||
httpResponse.getContent());
|
||||
return responseObject;
|
||||
} catch (IOException e) {
|
||||
logger.error(e, e.fillInStackTrace());
|
||||
throw new CustomGenericException("1", this.IOEXCEPTION, caller);
|
||||
} catch (JAXBException e) {
|
||||
logger.error(e, e.fillInStackTrace());
|
||||
throw new CustomGenericException("1", this.JAXBEXCEPTION,
|
||||
"get networks_" + caller);
|
||||
}
|
||||
}
|
||||
|
||||
public Object getResponseModel(String accessToken, String url,
|
||||
Class<?> objectClass, Map<String, String> params, String caller)
|
||||
throws CustomGenericException {
|
||||
try {
|
||||
url = this.addMaseterAddressToUrl(url);
|
||||
HttpResponse httpResponse = this.getHttpRequester().sendGet(url,
|
||||
params, this.makeAccessTockenMap(accessToken));
|
||||
if (HttpRequester.isInvalidResponse(httpResponse)) {
|
||||
logger.info(HTTPRSEPONSE_INVALIDATE);
|
||||
throw new CustomGenericException("1", HTTPRSEPONSE_INVALIDATE,
|
||||
caller);
|
||||
}
|
||||
if (httpResponse.getCode() == HttpStatus.BAD_REQUEST_400) {
|
||||
ErrorResponseModel errorResponseModel = (ErrorResponseModel) ObjectXmlExchange
|
||||
.fromXml(ErrorResponseModel.class,
|
||||
httpResponse.getContent());
|
||||
logException(errorResponseModel);
|
||||
throw new CustomGenericException("2", FAIL_WITH_EXCEPTION + "_"
|
||||
+ errorResponseModel.getMessage(), caller + "_"
|
||||
+ errorResponseModel.getResource());
|
||||
}
|
||||
if (httpResponse.getCode() != 200) {
|
||||
logger.info(caller + " get httpResponse code is not 200:");
|
||||
logger.info(httpResponse.getContent());
|
||||
throw new CustomGenericException("1", BADHTTPRESPONSE, caller);
|
||||
}
|
||||
Object responseObject = ObjectXmlExchange.fromXml(objectClass,
|
||||
httpResponse.getContent());
|
||||
return responseObject;
|
||||
} catch (IOException e) {
|
||||
logger.error(e, e.fillInStackTrace());
|
||||
throw new CustomGenericException("1", this.IOEXCEPTION, caller);
|
||||
} catch (JAXBException e) {
|
||||
logger.error(e, e.fillInStackTrace());
|
||||
throw new CustomGenericException("1", this.JAXBEXCEPTION,
|
||||
"get networks_" + caller);
|
||||
}
|
||||
}
|
||||
|
||||
public Object getResponseModelByPut(String accessToken, String url,
|
||||
String content, Class<?> objectClass, String caller)
|
||||
throws CustomGenericException {
|
||||
try {
|
||||
url = this.addMaseterAddressToUrl(url);
|
||||
HttpResponse httpResponse = this.getHttpRequester().sendPutXml(url,
|
||||
content, this.makeAccessTockenMap(accessToken));
|
||||
if (HttpRequester.isInvalidResponse(httpResponse)) {
|
||||
|
||||
throw new CustomGenericException("1", HTTPRSEPONSE_INVALIDATE,
|
||||
caller);
|
||||
}
|
||||
System.out.println(httpResponse.getContent());
|
||||
if (httpResponse.getCode() == HttpStatus.BAD_REQUEST_400) {
|
||||
ErrorResponseModel errorResponseModel = (ErrorResponseModel) ObjectXmlExchange
|
||||
.fromXml(ErrorResponseModel.class,
|
||||
httpResponse.getContent());
|
||||
logException(errorResponseModel);
|
||||
throw new CustomGenericException("2", FAIL_WITH_EXCEPTION + "_"
|
||||
+ errorResponseModel.getMessage(), caller + "_"
|
||||
+ errorResponseModel.getResource());
|
||||
}
|
||||
if (httpResponse.getCode() != 200) {
|
||||
logger.info(caller + " get httpResponse code is not 200:");
|
||||
logger.info(httpResponse.getContent());
|
||||
throw new CustomGenericException("1", BADHTTPRESPONSE, caller);
|
||||
}
|
||||
Object responseObject = ObjectXmlExchange.fromXml(objectClass,
|
||||
httpResponse.getContent());
|
||||
|
||||
return responseObject;
|
||||
} catch (IOException e) {
|
||||
logger.error(e, e.fillInStackTrace());
|
||||
throw new CustomGenericException("1", this.IOEXCEPTION, caller);
|
||||
} catch (JAXBException e) {
|
||||
logger.error(e, e.fillInStackTrace());
|
||||
throw new CustomGenericException("1", this.JAXBEXCEPTION,
|
||||
"get networks_" + caller);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private Map<String, String> makeAccessTockenMap(String accessToken) {
|
||||
Map<String, String> properties = new HashMap<String, String>();
|
||||
properties
|
||||
.put(AUTH_HEADER_PROPERTY, ACCES_TOCKEN_STARTER + accessToken);
|
||||
return properties;
|
||||
}
|
||||
|
||||
public void logException(ErrorResponseModel errorResponseModel) {
|
||||
logger.info(FAIL_WITH_EXCEPTION);
|
||||
logger.info("Exception code:" + errorResponseModel.getCode());
|
||||
logger.info("Exception message:" + errorResponseModel.getMessage());
|
||||
logger.info("Exception resource:" + errorResponseModel.getResource());
|
||||
}
|
||||
|
||||
}
|
||||
package org.bench4q.web.service;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bench4q.share.communication.HttpRequester;
|
||||
import org.bench4q.share.communication.HttpRequester.HttpResponse;
|
||||
import org.bench4q.share.models.ErrorResponseModel;
|
||||
import org.bench4q.web.api.BaseControllerService;
|
||||
import org.bench4q.web.exception.CustomGenericException;
|
||||
import org.bench4q.web.extractObjectFromXml.ObjectXmlExchange;
|
||||
import org.eclipse.jetty.http.HttpStatus;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class CommunicateWithMaster {
|
||||
private Logger logger = Logger.getLogger(CommunicateWithMaster.class);
|
||||
private HttpRequester httpRequester;
|
||||
private final String HTTPRSEPONSE_INVALIDATE = "network error!";
|
||||
public final String FAIL_WITH_EXCEPTION = "fail with exception from master";
|
||||
private final String AUTH_HEADER_PROPERTY = "Authorization";
|
||||
private final String ACCES_TOCKEN_STARTER = "Bearer ";
|
||||
private final String IOEXCEPTION = "io exception: get httpresponse from master";
|
||||
private final String JAXBEXCEPTION = "JAXBException exception :get httpresponse from master";
|
||||
private final String BADHTTPRESPONSE = "bad response";
|
||||
private static final Properties prop = new Properties();
|
||||
private static final String CONFIG_FILE_NAME = "ipConfig.properties";
|
||||
private static String masterAddress = "";
|
||||
|
||||
private HttpRequester getHttpRequester() {
|
||||
return httpRequester;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private void setHttpRequester(HttpRequester httpRequester) {
|
||||
this.httpRequester = httpRequester;
|
||||
}
|
||||
|
||||
public static String getMasterAddress() {
|
||||
return masterAddress;
|
||||
}
|
||||
|
||||
private String addMaseterAddressToUrl(String url) {
|
||||
return masterAddress + url;
|
||||
}
|
||||
|
||||
static {
|
||||
String masterIpFilePath;
|
||||
try {
|
||||
masterIpFilePath = BaseControllerService.class.getClassLoader()
|
||||
.getResource("").toURI().getPath()
|
||||
+ CONFIG_FILE_NAME;
|
||||
FileInputStream inputStream = new FileInputStream(new File(
|
||||
masterIpFilePath));
|
||||
prop.load(inputStream);
|
||||
inputStream.close();
|
||||
masterAddress = prop.getProperty("masterAddress");
|
||||
} catch (Exception e1) {
|
||||
masterAddress = "133.133.12.1:7979";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Object getRespnseObjectByPostXml(String accessToken, String url,
|
||||
Class<?> objectClass, String content, String caller)
|
||||
throws CustomGenericException {
|
||||
try {
|
||||
url = this.addMaseterAddressToUrl(url);
|
||||
HttpResponse httpResponse = this.getHttpRequester().sendPostXml(
|
||||
url, content, this.makeAccessTockenMap(accessToken));
|
||||
if (HttpRequester.isInvalidResponse(httpResponse)) {
|
||||
logger.info(HTTPRSEPONSE_INVALIDATE);
|
||||
throw new CustomGenericException("1", HTTPRSEPONSE_INVALIDATE,
|
||||
caller);
|
||||
}
|
||||
if (httpResponse.getCode() == HttpStatus.BAD_REQUEST_400) {
|
||||
ErrorResponseModel errorResponseModel = (ErrorResponseModel) ObjectXmlExchange
|
||||
.fromXml(ErrorResponseModel.class,
|
||||
httpResponse.getContent());
|
||||
logException(errorResponseModel);
|
||||
throw new CustomGenericException("2", FAIL_WITH_EXCEPTION + "_"
|
||||
+ errorResponseModel.getMessage(), caller + "_"
|
||||
+ errorResponseModel.getResource());
|
||||
}
|
||||
if (httpResponse.getCode() != 200) {
|
||||
logger.info(caller + " get httpResponse code is not 200:");
|
||||
logger.info(httpResponse.getContent());
|
||||
throw new CustomGenericException("1", BADHTTPRESPONSE, caller);
|
||||
}
|
||||
Object responseObject = ObjectXmlExchange.fromXml(objectClass,
|
||||
httpResponse.getContent());
|
||||
return responseObject;
|
||||
} catch (IOException e) {
|
||||
logger.error(e, e.fillInStackTrace());
|
||||
throw new CustomGenericException("1", this.IOEXCEPTION, caller);
|
||||
} catch (JAXBException e) {
|
||||
logger.error(e, e.fillInStackTrace());
|
||||
throw new CustomGenericException("1", this.JAXBEXCEPTION,
|
||||
"get networks_" + caller);
|
||||
}
|
||||
}
|
||||
|
||||
public Object getResponseModel(String accessToken, String url,
|
||||
Class<?> objectClass, Map<String, String> params, String caller)
|
||||
throws CustomGenericException {
|
||||
try {
|
||||
url = this.addMaseterAddressToUrl(url);
|
||||
HttpResponse httpResponse = this.getHttpRequester().sendGet(url,
|
||||
params, this.makeAccessTockenMap(accessToken));
|
||||
if (HttpRequester.isInvalidResponse(httpResponse)) {
|
||||
logger.info(HTTPRSEPONSE_INVALIDATE);
|
||||
throw new CustomGenericException("1", HTTPRSEPONSE_INVALIDATE,
|
||||
caller);
|
||||
}
|
||||
if (httpResponse.getCode() == HttpStatus.BAD_REQUEST_400) {
|
||||
ErrorResponseModel errorResponseModel = (ErrorResponseModel) ObjectXmlExchange
|
||||
.fromXml(ErrorResponseModel.class,
|
||||
httpResponse.getContent());
|
||||
logException(errorResponseModel);
|
||||
throw new CustomGenericException("2", FAIL_WITH_EXCEPTION + "_"
|
||||
+ errorResponseModel.getMessage(), caller + "_"
|
||||
+ errorResponseModel.getResource());
|
||||
}
|
||||
if (httpResponse.getCode() != 200) {
|
||||
logger.info(caller + " get httpResponse code is not 200:");
|
||||
logger.info(httpResponse.getContent());
|
||||
throw new CustomGenericException("1", BADHTTPRESPONSE, caller);
|
||||
}
|
||||
Object responseObject = ObjectXmlExchange.fromXml(objectClass,
|
||||
httpResponse.getContent());
|
||||
return responseObject;
|
||||
} catch (IOException e) {
|
||||
logger.error(e, e.fillInStackTrace());
|
||||
throw new CustomGenericException("1", this.IOEXCEPTION, caller);
|
||||
} catch (JAXBException e) {
|
||||
logger.error(e, e.fillInStackTrace());
|
||||
throw new CustomGenericException("1", this.JAXBEXCEPTION,
|
||||
"get networks_" + caller);
|
||||
}
|
||||
}
|
||||
|
||||
public Object getResponseModelByPut(String accessToken, String url,
|
||||
String content, Class<?> objectClass, String caller)
|
||||
throws CustomGenericException {
|
||||
try {
|
||||
url = this.addMaseterAddressToUrl(url);
|
||||
HttpResponse httpResponse = this.getHttpRequester().sendPutXml(url,
|
||||
content, this.makeAccessTockenMap(accessToken));
|
||||
if (HttpRequester.isInvalidResponse(httpResponse)) {
|
||||
|
||||
throw new CustomGenericException("1", HTTPRSEPONSE_INVALIDATE,
|
||||
caller);
|
||||
}
|
||||
System.out.println(httpResponse.getContent());
|
||||
if (httpResponse.getCode() == HttpStatus.BAD_REQUEST_400) {
|
||||
ErrorResponseModel errorResponseModel = (ErrorResponseModel) ObjectXmlExchange
|
||||
.fromXml(ErrorResponseModel.class,
|
||||
httpResponse.getContent());
|
||||
logException(errorResponseModel);
|
||||
throw new CustomGenericException("2", FAIL_WITH_EXCEPTION + "_"
|
||||
+ errorResponseModel.getMessage(), caller + "_"
|
||||
+ errorResponseModel.getResource());
|
||||
}
|
||||
if (httpResponse.getCode() != 200) {
|
||||
logger.info(caller + " get httpResponse code is not 200:");
|
||||
logger.info(httpResponse.getContent());
|
||||
throw new CustomGenericException("1", BADHTTPRESPONSE, caller);
|
||||
}
|
||||
Object responseObject = ObjectXmlExchange.fromXml(objectClass,
|
||||
httpResponse.getContent());
|
||||
|
||||
return responseObject;
|
||||
} catch (IOException e) {
|
||||
logger.error(e, e.fillInStackTrace());
|
||||
throw new CustomGenericException("1", this.IOEXCEPTION, caller);
|
||||
} catch (JAXBException e) {
|
||||
logger.error(e, e.fillInStackTrace());
|
||||
throw new CustomGenericException("1", this.JAXBEXCEPTION,
|
||||
"get networks_" + caller);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private Map<String, String> makeAccessTockenMap(String accessToken) {
|
||||
Map<String, String> properties = new HashMap<String, String>();
|
||||
properties
|
||||
.put(AUTH_HEADER_PROPERTY, ACCES_TOCKEN_STARTER + accessToken);
|
||||
return properties;
|
||||
}
|
||||
|
||||
public void logException(ErrorResponseModel errorResponseModel) {
|
||||
logger.info(FAIL_WITH_EXCEPTION);
|
||||
logger.info("Exception code:" + errorResponseModel.getCode());
|
||||
logger.info("Exception message:" + errorResponseModel.getMessage());
|
||||
logger.info("Exception resource:" + errorResponseModel.getResource());
|
||||
}
|
||||
|
||||
}
|
|
@ -1,103 +1,103 @@
|
|||
package org.bench4q.web.service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bench4q.web.exception.CustomGenericException;
|
||||
import org.bench4q.web.model.ResultInfoModel;
|
||||
import org.bench4q.web.model.SutInfo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class MonitorDescriptionInfoService extends BaseService {
|
||||
private MonitorService monitorService;
|
||||
|
||||
// private MonitorService getMonitorService() {
|
||||
// return monitorService;
|
||||
// }
|
||||
|
||||
@Autowired
|
||||
private void setMonitorService(MonitorService monitorService) {
|
||||
this.monitorService = monitorService;
|
||||
}
|
||||
|
||||
public SutInfo getSutInfo(String ip, String port, String accessToken,
|
||||
String testPlanId) throws CustomGenericException {
|
||||
SutInfo sutInfo = new SutInfo();
|
||||
sutInfo.setIp(ip);
|
||||
sutInfo.setPort(port);
|
||||
List<ResultInfoModel> resultInfoModels = new ArrayList<ResultInfoModel>();
|
||||
ResultInfoModel cpuInfoModel = createCpuResultInfoModel("cpu",
|
||||
this.monitorService.getCpuList(accessToken, testPlanId, ip,
|
||||
port));
|
||||
if (cpuInfoModel != null)
|
||||
resultInfoModels.add(cpuInfoModel);
|
||||
System.out.println("ok");
|
||||
// ResultInfoModel networkInfoModel = createNetworkResultInfoModel(
|
||||
// "network",
|
||||
// this.getMonitorService().getNetworkList(accessToken,
|
||||
// testPlanId, ip, port));
|
||||
// if (networkInfoModel != null)
|
||||
// resultInfoModels.add(networkInfoModel);
|
||||
resultInfoModels.add(createMemoryResultInfoModel("Memory"));
|
||||
|
||||
sutInfo.setChildResults(resultInfoModels);
|
||||
return sutInfo;
|
||||
|
||||
}
|
||||
|
||||
// private ResultInfoModel createNetworkResultInfoModel(String resultName,
|
||||
// List<String> results) {
|
||||
// if (results.size() <= 0)
|
||||
// return null;
|
||||
// ResultInfoModel resultInfoModel = new ResultInfoModel(resultName,
|
||||
// new ArrayList<ResultInfoModel>());
|
||||
// for (String result : results) {
|
||||
// resultInfoModel.getChildResults().add(getNetworkResultInfo(result));
|
||||
// }
|
||||
// return resultInfoModel;
|
||||
// }
|
||||
|
||||
private ResultInfoModel createMemoryResultInfoModel(String resultName) {
|
||||
|
||||
ResultInfoModel resultInfoModel = new ResultInfoModel(resultName,
|
||||
new ArrayList<ResultInfoModel>());
|
||||
|
||||
resultInfoModel.getChildResults().add(getMemoryResultInfo());
|
||||
|
||||
return resultInfoModel;
|
||||
}
|
||||
|
||||
private ResultInfoModel createCpuResultInfoModel(String resultName,
|
||||
List<String> results) {
|
||||
if (results.size() <= 0)
|
||||
return null;
|
||||
ResultInfoModel resultInfoModel = new ResultInfoModel(resultName,
|
||||
new ArrayList<ResultInfoModel>());
|
||||
for (String result : results) {
|
||||
resultInfoModel.getChildResults().add(getCpuResultInfo(result));
|
||||
}
|
||||
return resultInfoModel;
|
||||
}
|
||||
|
||||
private ResultInfoModel getCpuResultInfo(String result) {
|
||||
String[] fields = new String[] { "processorTimePercent",
|
||||
"processorTimePercent", "privilegedTimePercent" };
|
||||
return getResultInfoModel(result, fields);
|
||||
}
|
||||
|
||||
// private ResultInfoModel getNetworkResultInfo(String result) {
|
||||
// String[] fields = new String[] { "bytesTotalPerSecond",
|
||||
// "bytesReceivedPerSecond", "bytesReceivedPerSecond" };
|
||||
// return getResultInfoModel(result, fields);
|
||||
// }
|
||||
|
||||
private ResultInfoModel getMemoryResultInfo() {
|
||||
String result = "Result";
|
||||
String[] fields = new String[] { "pagesPerSecond",
|
||||
"pagesInputPerSecond", "pagesOutputPerSecond", "cacheBytes",
|
||||
"committedBytes", "availableKiloBytes" };
|
||||
return getResultInfoModel(result, fields);
|
||||
}
|
||||
}
|
||||
package org.bench4q.web.service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bench4q.web.exception.CustomGenericException;
|
||||
import org.bench4q.web.model.ResultInfoModel;
|
||||
import org.bench4q.web.model.SutInfo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class MonitorDescriptionInfoService extends BaseService {
|
||||
private MonitorService monitorService;
|
||||
|
||||
// private MonitorService getMonitorService() {
|
||||
// return monitorService;
|
||||
// }
|
||||
|
||||
@Autowired
|
||||
private void setMonitorService(MonitorService monitorService) {
|
||||
this.monitorService = monitorService;
|
||||
}
|
||||
|
||||
public SutInfo getSutInfo(String ip, String port, String accessToken,
|
||||
String testPlanId) throws CustomGenericException {
|
||||
SutInfo sutInfo = new SutInfo();
|
||||
sutInfo.setIp(ip);
|
||||
sutInfo.setPort(port);
|
||||
List<ResultInfoModel> resultInfoModels = new ArrayList<ResultInfoModel>();
|
||||
ResultInfoModel cpuInfoModel = createCpuResultInfoModel("cpu",
|
||||
this.monitorService.getCpuList(accessToken, testPlanId, ip,
|
||||
port));
|
||||
if (cpuInfoModel != null)
|
||||
resultInfoModels.add(cpuInfoModel);
|
||||
System.out.println("ok");
|
||||
// ResultInfoModel networkInfoModel = createNetworkResultInfoModel(
|
||||
// "network",
|
||||
// this.getMonitorService().getNetworkList(accessToken,
|
||||
// testPlanId, ip, port));
|
||||
// if (networkInfoModel != null)
|
||||
// resultInfoModels.add(networkInfoModel);
|
||||
resultInfoModels.add(createMemoryResultInfoModel("Memory"));
|
||||
|
||||
sutInfo.setChildResults(resultInfoModels);
|
||||
return sutInfo;
|
||||
|
||||
}
|
||||
|
||||
// private ResultInfoModel createNetworkResultInfoModel(String resultName,
|
||||
// List<String> results) {
|
||||
// if (results.size() <= 0)
|
||||
// return null;
|
||||
// ResultInfoModel resultInfoModel = new ResultInfoModel(resultName,
|
||||
// new ArrayList<ResultInfoModel>());
|
||||
// for (String result : results) {
|
||||
// resultInfoModel.getChildResults().add(getNetworkResultInfo(result));
|
||||
// }
|
||||
// return resultInfoModel;
|
||||
// }
|
||||
|
||||
private ResultInfoModel createMemoryResultInfoModel(String resultName) {
|
||||
|
||||
ResultInfoModel resultInfoModel = new ResultInfoModel(resultName,
|
||||
new ArrayList<ResultInfoModel>());
|
||||
|
||||
resultInfoModel.getChildResults().add(getMemoryResultInfo());
|
||||
|
||||
return resultInfoModel;
|
||||
}
|
||||
|
||||
private ResultInfoModel createCpuResultInfoModel(String resultName,
|
||||
List<String> results) {
|
||||
if (results.size() <= 0)
|
||||
return null;
|
||||
ResultInfoModel resultInfoModel = new ResultInfoModel(resultName,
|
||||
new ArrayList<ResultInfoModel>());
|
||||
for (String result : results) {
|
||||
resultInfoModel.getChildResults().add(getCpuResultInfo(result));
|
||||
}
|
||||
return resultInfoModel;
|
||||
}
|
||||
|
||||
private ResultInfoModel getCpuResultInfo(String result) {
|
||||
String[] fields = new String[] { "processorTimePercent",
|
||||
"processorTimePercent", "privilegedTimePercent" };
|
||||
return getResultInfoModel(result, fields);
|
||||
}
|
||||
|
||||
// private ResultInfoModel getNetworkResultInfo(String result) {
|
||||
// String[] fields = new String[] { "bytesTotalPerSecond",
|
||||
// "bytesReceivedPerSecond", "bytesReceivedPerSecond" };
|
||||
// return getResultInfoModel(result, fields);
|
||||
// }
|
||||
|
||||
private ResultInfoModel getMemoryResultInfo() {
|
||||
String result = "Result";
|
||||
String[] fields = new String[] { "pagesPerSecond",
|
||||
"pagesInputPerSecond", "pagesOutputPerSecond", "cacheBytes",
|
||||
"committedBytes", "availableKiloBytes" };
|
||||
return getResultInfoModel(result, fields);
|
||||
}
|
||||
}
|
|
@ -1,129 +1,129 @@
|
|||
package org.bench4q.web.service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bench4q.share.models.master.MonitorMemoryResponseModel;
|
||||
import org.bench4q.share.models.master.MonitorNetworkReponseModel;
|
||||
import org.bench4q.share.models.master.MonitorProcessorResponseModel;
|
||||
import org.bench4q.share.models.monitor.ProcessorModel;
|
||||
import org.bench4q.share.models.monitor.ProcessorModelChild;
|
||||
import org.bench4q.web.exception.CustomGenericException;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
@Component
|
||||
public class MonitorService extends BaseService {
|
||||
private String baseUrl = "monitorController";
|
||||
private Logger logger = Logger.getLogger(MonitorService.class);
|
||||
public String getBaseUrl() {
|
||||
return baseUrl;
|
||||
}
|
||||
|
||||
public void setBaseUrl(String baseUrl) {
|
||||
this.baseUrl = baseUrl;
|
||||
}
|
||||
|
||||
public List<String> getCpuList(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@RequestParam("testPlanId") String testPlanId,
|
||||
@RequestParam String ip, String port) throws CustomGenericException {
|
||||
String scource = "MonitorService:getCpuList";
|
||||
try {
|
||||
MonitorProcessorResponseModel monitorProcessorResponseModel = getCpus(
|
||||
accessToken, testPlanId, ip, port, "0");
|
||||
ProcessorModel processorModel = monitorProcessorResponseModel
|
||||
.getProcessorModels().get(0);
|
||||
List<String> cpuList = new ArrayList<String>();
|
||||
for (ProcessorModelChild processorModelChild : processorModel
|
||||
.getProcessorModelList()) {
|
||||
cpuList.add(processorModelChild.getInstance());
|
||||
}
|
||||
return cpuList;
|
||||
} catch (NullPointerException e) {
|
||||
logger.info(e.getStackTrace());
|
||||
throw new CustomGenericException("1", "error cpu list info"
|
||||
+ e.getCause(), scource);
|
||||
}
|
||||
}
|
||||
|
||||
public MonitorMemoryResponseModel getMemoryResponseModel(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
String testPlanId, String ip, String port, String startTime)
|
||||
throws CustomGenericException {
|
||||
String url = this.getBaseUrl() + "/memorySUTInfo";
|
||||
String caller = "MonitorService:getMemoryResponse";
|
||||
Map<String, String> params = makeParamsMap(ip, port, testPlanId,
|
||||
startTime);
|
||||
|
||||
return (MonitorMemoryResponseModel)this.getCommunicateWithMaster()
|
||||
.getResponseModel(accessToken, url,
|
||||
MonitorMemoryResponseModel.class, params, caller);
|
||||
}
|
||||
|
||||
public MonitorProcessorResponseModel getCpus(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
String testPlanId, String ip, String port, String startTime)
|
||||
throws CustomGenericException {
|
||||
Map<String, String> params = makeParamsMap(ip, port, testPlanId,
|
||||
startTime);
|
||||
String url = this.getBaseUrl() + "/processorSUTInfo";
|
||||
String caller = "MonitorService:getCpus";
|
||||
|
||||
return (MonitorProcessorResponseModel) this.getCommunicateWithMaster()
|
||||
.getResponseModel(accessToken, url,
|
||||
MonitorProcessorResponseModel.class, params, caller);
|
||||
|
||||
}
|
||||
|
||||
// public List<String> getNetworkList(String accessToken, String testplanId,
|
||||
// String ip, String port) throws CustomGenericException {
|
||||
// String scource = "MonitorService:getNetworkList";
|
||||
// try {
|
||||
// MonitorNetworkReponseModel monitorNetworkReponseModel = getNetworks(
|
||||
// accessToken, testplanId, ip, port, "0");
|
||||
// NetworkInterfaceModel networkInterfaceModel = monitorNetworkReponseModel
|
||||
// .getModels().get(0);
|
||||
// List<String> networkList = new ArrayList<String>();
|
||||
// for (NetworkInterfaceModelChild networkInterfaceModelChild : networkInterfaceModel
|
||||
// .getNetworkList()) {
|
||||
// networkList.add(networkInterfaceModelChild.getInstance());
|
||||
// }
|
||||
// return networkList;
|
||||
// } catch (NullPointerException e) {
|
||||
// logger.info(e.getStackTrace());
|
||||
// throw new CustomGenericException("1", "error network list info"
|
||||
// + e.getCause(), scource);
|
||||
// }
|
||||
// }
|
||||
|
||||
public MonitorNetworkReponseModel getNetworks(String accessToken,
|
||||
String testplanId, String ip, String port, String startTime)
|
||||
throws CustomGenericException {
|
||||
|
||||
Map<String, String> params = makeParamsMap(ip, port, testplanId,
|
||||
startTime);
|
||||
String url = this.getBaseUrl() + "/networkInfo";
|
||||
String caller = "MonitorService:getNetworks";
|
||||
|
||||
return (MonitorNetworkReponseModel) this.getCommunicateWithMaster()
|
||||
.getResponseModel(accessToken, url,
|
||||
MonitorNetworkReponseModel.class, params, caller);
|
||||
|
||||
}
|
||||
|
||||
private Map<String, String> makeParamsMap(String ip, String port,
|
||||
String testPlanId, String startTime) {
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
params.put("hostName", ip);
|
||||
params.put("port", port);
|
||||
params.put("testPlanRunId", testPlanId);
|
||||
params.put("duationBegin", startTime);
|
||||
return params;
|
||||
}
|
||||
|
||||
}
|
||||
package org.bench4q.web.service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bench4q.share.models.master.MonitorMemoryResponseModel;
|
||||
import org.bench4q.share.models.master.MonitorNetworkReponseModel;
|
||||
import org.bench4q.share.models.master.MonitorProcessorResponseModel;
|
||||
import org.bench4q.share.models.monitor.ProcessorModel;
|
||||
import org.bench4q.share.models.monitor.ProcessorModelChild;
|
||||
import org.bench4q.web.exception.CustomGenericException;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
@Component
|
||||
public class MonitorService extends BaseService {
|
||||
private String baseUrl = "monitorController";
|
||||
private Logger logger = Logger.getLogger(MonitorService.class);
|
||||
public String getBaseUrl() {
|
||||
return baseUrl;
|
||||
}
|
||||
|
||||
public void setBaseUrl(String baseUrl) {
|
||||
this.baseUrl = baseUrl;
|
||||
}
|
||||
|
||||
public List<String> getCpuList(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@RequestParam("testPlanId") String testPlanId,
|
||||
@RequestParam String ip, String port) throws CustomGenericException {
|
||||
String scource = "MonitorService:getCpuList";
|
||||
try {
|
||||
MonitorProcessorResponseModel monitorProcessorResponseModel = getCpus(
|
||||
accessToken, testPlanId, ip, port, "0");
|
||||
ProcessorModel processorModel = monitorProcessorResponseModel
|
||||
.getProcessorModels().get(0);
|
||||
List<String> cpuList = new ArrayList<String>();
|
||||
for (ProcessorModelChild processorModelChild : processorModel
|
||||
.getProcessorModelList()) {
|
||||
cpuList.add(processorModelChild.getInstance());
|
||||
}
|
||||
return cpuList;
|
||||
} catch (NullPointerException e) {
|
||||
logger.info(e.getStackTrace());
|
||||
throw new CustomGenericException("1", "error cpu list info"
|
||||
+ e.getCause(), scource);
|
||||
}
|
||||
}
|
||||
|
||||
public MonitorMemoryResponseModel getMemoryResponseModel(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
String testPlanId, String ip, String port, String startTime)
|
||||
throws CustomGenericException {
|
||||
String url = this.getBaseUrl() + "/memorySUTInfo";
|
||||
String caller = "MonitorService:getMemoryResponse";
|
||||
Map<String, String> params = makeParamsMap(ip, port, testPlanId,
|
||||
startTime);
|
||||
|
||||
return (MonitorMemoryResponseModel)this.getCommunicateWithMaster()
|
||||
.getResponseModel(accessToken, url,
|
||||
MonitorMemoryResponseModel.class, params, caller);
|
||||
}
|
||||
|
||||
public MonitorProcessorResponseModel getCpus(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
String testPlanId, String ip, String port, String startTime)
|
||||
throws CustomGenericException {
|
||||
Map<String, String> params = makeParamsMap(ip, port, testPlanId,
|
||||
startTime);
|
||||
String url = this.getBaseUrl() + "/processorSUTInfo";
|
||||
String caller = "MonitorService:getCpus";
|
||||
|
||||
return (MonitorProcessorResponseModel) this.getCommunicateWithMaster()
|
||||
.getResponseModel(accessToken, url,
|
||||
MonitorProcessorResponseModel.class, params, caller);
|
||||
|
||||
}
|
||||
|
||||
// public List<String> getNetworkList(String accessToken, String testplanId,
|
||||
// String ip, String port) throws CustomGenericException {
|
||||
// String scource = "MonitorService:getNetworkList";
|
||||
// try {
|
||||
// MonitorNetworkReponseModel monitorNetworkReponseModel = getNetworks(
|
||||
// accessToken, testplanId, ip, port, "0");
|
||||
// NetworkInterfaceModel networkInterfaceModel = monitorNetworkReponseModel
|
||||
// .getModels().get(0);
|
||||
// List<String> networkList = new ArrayList<String>();
|
||||
// for (NetworkInterfaceModelChild networkInterfaceModelChild : networkInterfaceModel
|
||||
// .getNetworkList()) {
|
||||
// networkList.add(networkInterfaceModelChild.getInstance());
|
||||
// }
|
||||
// return networkList;
|
||||
// } catch (NullPointerException e) {
|
||||
// logger.info(e.getStackTrace());
|
||||
// throw new CustomGenericException("1", "error network list info"
|
||||
// + e.getCause(), scource);
|
||||
// }
|
||||
// }
|
||||
|
||||
public MonitorNetworkReponseModel getNetworks(String accessToken,
|
||||
String testplanId, String ip, String port, String startTime)
|
||||
throws CustomGenericException {
|
||||
|
||||
Map<String, String> params = makeParamsMap(ip, port, testplanId,
|
||||
startTime);
|
||||
String url = this.getBaseUrl() + "/networkInfo";
|
||||
String caller = "MonitorService:getNetworks";
|
||||
|
||||
return (MonitorNetworkReponseModel) this.getCommunicateWithMaster()
|
||||
.getResponseModel(accessToken, url,
|
||||
MonitorNetworkReponseModel.class, params, caller);
|
||||
|
||||
}
|
||||
|
||||
private Map<String, String> makeParamsMap(String ip, String port,
|
||||
String testPlanId, String startTime) {
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
params.put("hostName", ip);
|
||||
params.put("port", port);
|
||||
params.put("testPlanRunId", testPlanId);
|
||||
params.put("duationBegin", startTime);
|
||||
return params;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,245 +1,245 @@
|
|||
package org.bench4q.web.service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
||||
import org.bench4q.share.models.agent.ParameterModel;
|
||||
import org.bench4q.share.models.agent.RunScenarioModel;
|
||||
import org.bench4q.share.models.agent.scriptrecord.BatchModel;
|
||||
import org.bench4q.share.models.agent.scriptrecord.BehaviorModel;
|
||||
import org.bench4q.share.models.agent.scriptrecord.PageModel;
|
||||
import org.bench4q.share.models.master.OperateScriptServerResponseModel;
|
||||
import org.bench4q.share.models.master.ScriptModel;
|
||||
import org.bench4q.web.exception.CustomGenericException;
|
||||
import org.bench4q.web.extractObjectFromXml.ObjectXmlExchange;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class ScriptService extends BaseService {
|
||||
private String baseUrl = "RecordScript";
|
||||
|
||||
public String getBaseUrl() {
|
||||
return baseUrl;
|
||||
}
|
||||
|
||||
public void setBaseUrl(String baseUrl) {
|
||||
this.baseUrl = baseUrl;
|
||||
}
|
||||
|
||||
public ScriptModel queryScript(int id, String accessToken)
|
||||
throws CustomGenericException {
|
||||
// check script id and return throw exception
|
||||
String caller = "ScriptService:queryScript";
|
||||
|
||||
OperateScriptServerResponseModel operateScriptServerResponseModel = (OperateScriptServerResponseModel) this
|
||||
.getCommunicateWithMaster().getResponseModel(accessToken,
|
||||
this.getBaseUrl() + "/queryScriptById",
|
||||
OperateScriptServerResponseModel.class,
|
||||
makeParamsMap("scriptId", String.valueOf(id)), caller);
|
||||
if (operateScriptServerResponseModel.isSuccess())
|
||||
return operateScriptServerResponseModel.getScriptModels().get(0);
|
||||
else
|
||||
throw new CustomGenericException("5", "query script failed", caller
|
||||
+ ":" + id);
|
||||
}
|
||||
|
||||
public List<ScriptModel> queryScripts(List<Integer> scriptIds,
|
||||
String accessToken) throws CustomGenericException {
|
||||
String caller = "ScriptService:queryScript";
|
||||
List<ScriptModel> scriptModels = new ArrayList<ScriptModel>();
|
||||
for (Integer scriptId : scriptIds) {
|
||||
OperateScriptServerResponseModel operateScriptServerResponseModel = (OperateScriptServerResponseModel) this
|
||||
.getCommunicateWithMaster()
|
||||
.getResponseModel(
|
||||
accessToken,
|
||||
this.getBaseUrl() + "/queryScriptById",
|
||||
OperateScriptServerResponseModel.class,
|
||||
makeParamsMap("scriptId", String.valueOf(scriptId)),
|
||||
caller);
|
||||
if (operateScriptServerResponseModel.isSuccess())
|
||||
scriptModels.add(operateScriptServerResponseModel
|
||||
.getScriptModels().get(0));
|
||||
else
|
||||
throw new CustomGenericException("5", "query script failed",
|
||||
caller + ":" + scriptId);
|
||||
}
|
||||
return scriptModels;
|
||||
}
|
||||
|
||||
public Map<String, Integer> getScriptNameIdMap(
|
||||
List<ScriptModel> scriptModels) throws CustomGenericException {
|
||||
Map<String, Integer> map = new HashMap<String, Integer>();
|
||||
for (ScriptModel scriptModel : scriptModels) {
|
||||
map.put(scriptModel.getName(), scriptModel.getId());
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
public Map<Integer, String> getScriptIdNameMap(
|
||||
List<ScriptModel> scriptModels) throws CustomGenericException {
|
||||
Map<Integer, String> map = new HashMap<Integer, String>();
|
||||
for (ScriptModel scriptModel : scriptModels) {
|
||||
map.put(scriptModel.getId(), scriptModel.getName());
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
public Map<String, Integer> getPageNameAndIdMap(
|
||||
List<ScriptModel> scriptModels) throws JAXBException {
|
||||
try {
|
||||
Map<String, Integer> map = new HashMap<String, Integer>();
|
||||
for (ScriptModel scriptModel : scriptModels) {
|
||||
Map<String, Integer> pageMap = getPageNameAndIdMap((RunScenarioModel)
|
||||
ObjectXmlExchange.fromXml(RunScenarioModel.class,
|
||||
scriptModel.getScriptContent()));
|
||||
if (pageMap != null)
|
||||
map.putAll(pageMap);
|
||||
}
|
||||
return map;
|
||||
} catch (NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, Integer> getPageNameAndIdMap(
|
||||
RunScenarioModel runScenarioModel) {
|
||||
|
||||
List<PageModel> pageModels = runScenarioModel.getPages();
|
||||
try {
|
||||
Map<String, Integer> map = new HashMap<String, Integer>();
|
||||
for (int i = 0; i < pageModels.size(); i++) {
|
||||
map.put("page_" + i, i);
|
||||
}
|
||||
return map;
|
||||
} catch (NullPointerException e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Map<String, Integer> getBehaviorNameAndIdMap(
|
||||
List<ScriptModel> scriptModels) throws JAXBException {
|
||||
try {
|
||||
Map<String, Integer> map = new HashMap<String, Integer>();
|
||||
for (ScriptModel scriptModel: scriptModels) {
|
||||
Map<String, Integer> behaviorMap = getBehaviorNameAndIdMap((RunScenarioModel)
|
||||
ObjectXmlExchange.fromXml(RunScenarioModel.class,
|
||||
scriptModel.getScriptContent()));
|
||||
if (behaviorMap != null)
|
||||
map.putAll(behaviorMap);
|
||||
}
|
||||
return map;
|
||||
} catch (NullPointerException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public List<String> getScriptPages(RunScenarioModel runScenarioModel) {
|
||||
try {
|
||||
List<String> scriptPages = new ArrayList<String>();
|
||||
for (int i = 1; i < scriptPages.size(); i++) {
|
||||
scriptPages.add("page_" + i);
|
||||
}
|
||||
return scriptPages;
|
||||
} catch (NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public List<String> getScriptBehaviorUrl(RunScenarioModel runScenarioModel) {
|
||||
|
||||
List<BehaviorModel> behaviorModelsWithUrl = getBehaviorModelsHasUrl(runScenarioModel);
|
||||
if (behaviorModelsWithUrl == null)
|
||||
return null;
|
||||
List<String> urList = new ArrayList<String>();
|
||||
for (BehaviorModel behaviorModelWithUrl : behaviorModelsWithUrl) {
|
||||
String url = generateUrl(behaviorModelWithUrl.getParameters());
|
||||
urList.add(url);
|
||||
}
|
||||
return urList;
|
||||
}
|
||||
|
||||
public Map<String, Integer> getBehaviorNameAndIdMap(
|
||||
RunScenarioModel runScenarioModel) {
|
||||
try {
|
||||
Map<String, Integer> map = new HashMap<String, Integer>();
|
||||
List<BehaviorModel> behaviorModels = this
|
||||
.getBehaviorModelsHasUrl(runScenarioModel);
|
||||
if (behaviorModels == null)
|
||||
return null;
|
||||
for (BehaviorModel behaviorModel : behaviorModels) {
|
||||
String url = this.generateUrl(behaviorModel.getParameters());
|
||||
if (url != null)
|
||||
map.put(url, behaviorModel.getId());
|
||||
}
|
||||
return map;
|
||||
|
||||
} catch (NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private String generateUrl(List<ParameterModel> parameterModels) {
|
||||
String url = new String("");
|
||||
int i = 0;
|
||||
for (ParameterModel parameterModel : parameterModels) {
|
||||
if (i == 1 && parameterModel.getValue() != null)
|
||||
url += "?" + parameterModel.getValue();
|
||||
if (i > 1 && parameterModel.getValue() != null)
|
||||
url += "&" + parameterModel.getValue();
|
||||
i++;
|
||||
}
|
||||
if (url.length() <= 0)
|
||||
return null;
|
||||
return url;
|
||||
}
|
||||
|
||||
private List<BehaviorModel> getBehaviorModelsHasUrl(
|
||||
RunScenarioModel runScenarioModel) {
|
||||
try {
|
||||
|
||||
List<BehaviorModel> behaviorModels = getBehaviorModels(runScenarioModel);
|
||||
if (behaviorModels == null)
|
||||
return null;
|
||||
List<BehaviorModel> behaviorModelsWithUrl = new ArrayList<BehaviorModel>();
|
||||
for (BehaviorModel behaviorModel : behaviorModels) {
|
||||
List<ParameterModel> parameterModels = new ArrayList<ParameterModel>();
|
||||
parameterModels.addAll(behaviorModel.getParameters());
|
||||
for (ParameterModel parameterModel : parameterModels) {
|
||||
if (parameterModel.getKey().equals("url"))
|
||||
behaviorModelsWithUrl.add(behaviorModel);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return behaviorModelsWithUrl;
|
||||
} catch (NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private List<BehaviorModel> getBehaviorModels(
|
||||
RunScenarioModel runScenarioModel) {
|
||||
try {
|
||||
List<BatchModel> batchModels = new ArrayList<BatchModel>();
|
||||
for (PageModel pageModel : runScenarioModel.getPages())
|
||||
batchModels.addAll(pageModel.getBatches());
|
||||
List<BehaviorModel> behaviorModels = new ArrayList<BehaviorModel>();
|
||||
for (BatchModel batchModel : batchModels)
|
||||
behaviorModels.addAll(batchModel.getBehaviors());
|
||||
return behaviorModels;
|
||||
} catch (NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
package org.bench4q.web.service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
||||
import org.bench4q.share.models.agent.ParameterModel;
|
||||
import org.bench4q.share.models.agent.RunScenarioModel;
|
||||
import org.bench4q.share.models.agent.scriptrecord.BatchModel;
|
||||
import org.bench4q.share.models.agent.scriptrecord.BehaviorModel;
|
||||
import org.bench4q.share.models.agent.scriptrecord.PageModel;
|
||||
import org.bench4q.share.models.master.OperateScriptServerResponseModel;
|
||||
import org.bench4q.share.models.master.ScriptModel;
|
||||
import org.bench4q.web.exception.CustomGenericException;
|
||||
import org.bench4q.web.extractObjectFromXml.ObjectXmlExchange;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class ScriptService extends BaseService {
|
||||
private String baseUrl = "RecordScript";
|
||||
|
||||
public String getBaseUrl() {
|
||||
return baseUrl;
|
||||
}
|
||||
|
||||
public void setBaseUrl(String baseUrl) {
|
||||
this.baseUrl = baseUrl;
|
||||
}
|
||||
|
||||
public ScriptModel queryScript(int id, String accessToken)
|
||||
throws CustomGenericException {
|
||||
// check script id and return throw exception
|
||||
String caller = "ScriptService:queryScript";
|
||||
|
||||
OperateScriptServerResponseModel operateScriptServerResponseModel = (OperateScriptServerResponseModel) this
|
||||
.getCommunicateWithMaster().getResponseModel(accessToken,
|
||||
this.getBaseUrl() + "/queryScriptById",
|
||||
OperateScriptServerResponseModel.class,
|
||||
makeParamsMap("scriptId", String.valueOf(id)), caller);
|
||||
if (operateScriptServerResponseModel.isSuccess())
|
||||
return operateScriptServerResponseModel.getScriptModels().get(0);
|
||||
else
|
||||
throw new CustomGenericException("5", "query script failed", caller
|
||||
+ ":" + id);
|
||||
}
|
||||
|
||||
public List<ScriptModel> queryScripts(List<Integer> scriptIds,
|
||||
String accessToken) throws CustomGenericException {
|
||||
String caller = "ScriptService:queryScript";
|
||||
List<ScriptModel> scriptModels = new ArrayList<ScriptModel>();
|
||||
for (Integer scriptId : scriptIds) {
|
||||
OperateScriptServerResponseModel operateScriptServerResponseModel = (OperateScriptServerResponseModel) this
|
||||
.getCommunicateWithMaster()
|
||||
.getResponseModel(
|
||||
accessToken,
|
||||
this.getBaseUrl() + "/queryScriptById",
|
||||
OperateScriptServerResponseModel.class,
|
||||
makeParamsMap("scriptId", String.valueOf(scriptId)),
|
||||
caller);
|
||||
if (operateScriptServerResponseModel.isSuccess())
|
||||
scriptModels.add(operateScriptServerResponseModel
|
||||
.getScriptModels().get(0));
|
||||
else
|
||||
throw new CustomGenericException("5", "query script failed",
|
||||
caller + ":" + scriptId);
|
||||
}
|
||||
return scriptModels;
|
||||
}
|
||||
|
||||
public Map<String, Integer> getScriptNameIdMap(
|
||||
List<ScriptModel> scriptModels) throws CustomGenericException {
|
||||
Map<String, Integer> map = new HashMap<String, Integer>();
|
||||
for (ScriptModel scriptModel : scriptModels) {
|
||||
map.put(scriptModel.getName(), scriptModel.getId());
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
public Map<Integer, String> getScriptIdNameMap(
|
||||
List<ScriptModel> scriptModels) throws CustomGenericException {
|
||||
Map<Integer, String> map = new HashMap<Integer, String>();
|
||||
for (ScriptModel scriptModel : scriptModels) {
|
||||
map.put(scriptModel.getId(), scriptModel.getName());
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
public Map<String, Integer> getPageNameAndIdMap(
|
||||
List<ScriptModel> scriptModels) throws JAXBException {
|
||||
try {
|
||||
Map<String, Integer> map = new HashMap<String, Integer>();
|
||||
for (ScriptModel scriptModel : scriptModels) {
|
||||
Map<String, Integer> pageMap = getPageNameAndIdMap((RunScenarioModel)
|
||||
ObjectXmlExchange.fromXml(RunScenarioModel.class,
|
||||
scriptModel.getScriptContent()));
|
||||
if (pageMap != null)
|
||||
map.putAll(pageMap);
|
||||
}
|
||||
return map;
|
||||
} catch (NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, Integer> getPageNameAndIdMap(
|
||||
RunScenarioModel runScenarioModel) {
|
||||
|
||||
List<PageModel> pageModels = runScenarioModel.getPages();
|
||||
try {
|
||||
Map<String, Integer> map = new HashMap<String, Integer>();
|
||||
for (int i = 0; i < pageModels.size(); i++) {
|
||||
map.put("page_" + i, i);
|
||||
}
|
||||
return map;
|
||||
} catch (NullPointerException e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Map<String, Integer> getBehaviorNameAndIdMap(
|
||||
List<ScriptModel> scriptModels) throws JAXBException {
|
||||
try {
|
||||
Map<String, Integer> map = new HashMap<String, Integer>();
|
||||
for (ScriptModel scriptModel: scriptModels) {
|
||||
Map<String, Integer> behaviorMap = getBehaviorNameAndIdMap((RunScenarioModel)
|
||||
ObjectXmlExchange.fromXml(RunScenarioModel.class,
|
||||
scriptModel.getScriptContent()));
|
||||
if (behaviorMap != null)
|
||||
map.putAll(behaviorMap);
|
||||
}
|
||||
return map;
|
||||
} catch (NullPointerException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public List<String> getScriptPages(RunScenarioModel runScenarioModel) {
|
||||
try {
|
||||
List<String> scriptPages = new ArrayList<String>();
|
||||
for (int i = 1; i < scriptPages.size(); i++) {
|
||||
scriptPages.add("page_" + i);
|
||||
}
|
||||
return scriptPages;
|
||||
} catch (NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public List<String> getScriptBehaviorUrl(RunScenarioModel runScenarioModel) {
|
||||
|
||||
List<BehaviorModel> behaviorModelsWithUrl = getBehaviorModelsHasUrl(runScenarioModel);
|
||||
if (behaviorModelsWithUrl == null)
|
||||
return null;
|
||||
List<String> urList = new ArrayList<String>();
|
||||
for (BehaviorModel behaviorModelWithUrl : behaviorModelsWithUrl) {
|
||||
String url = generateUrl(behaviorModelWithUrl.getParameters());
|
||||
urList.add(url);
|
||||
}
|
||||
return urList;
|
||||
}
|
||||
|
||||
public Map<String, Integer> getBehaviorNameAndIdMap(
|
||||
RunScenarioModel runScenarioModel) {
|
||||
try {
|
||||
Map<String, Integer> map = new HashMap<String, Integer>();
|
||||
List<BehaviorModel> behaviorModels = this
|
||||
.getBehaviorModelsHasUrl(runScenarioModel);
|
||||
if (behaviorModels == null)
|
||||
return null;
|
||||
for (BehaviorModel behaviorModel : behaviorModels) {
|
||||
String url = this.generateUrl(behaviorModel.getParameters());
|
||||
if (url != null)
|
||||
map.put(url, behaviorModel.getId());
|
||||
}
|
||||
return map;
|
||||
|
||||
} catch (NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private String generateUrl(List<ParameterModel> parameterModels) {
|
||||
String url = new String("");
|
||||
int i = 0;
|
||||
for (ParameterModel parameterModel : parameterModels) {
|
||||
if (i == 1 && parameterModel.getValue() != null)
|
||||
url += "?" + parameterModel.getValue();
|
||||
if (i > 1 && parameterModel.getValue() != null)
|
||||
url += "&" + parameterModel.getValue();
|
||||
i++;
|
||||
}
|
||||
if (url.length() <= 0)
|
||||
return null;
|
||||
return url;
|
||||
}
|
||||
|
||||
private List<BehaviorModel> getBehaviorModelsHasUrl(
|
||||
RunScenarioModel runScenarioModel) {
|
||||
try {
|
||||
|
||||
List<BehaviorModel> behaviorModels = getBehaviorModels(runScenarioModel);
|
||||
if (behaviorModels == null)
|
||||
return null;
|
||||
List<BehaviorModel> behaviorModelsWithUrl = new ArrayList<BehaviorModel>();
|
||||
for (BehaviorModel behaviorModel : behaviorModels) {
|
||||
List<ParameterModel> parameterModels = new ArrayList<ParameterModel>();
|
||||
parameterModels.addAll(behaviorModel.getParameters());
|
||||
for (ParameterModel parameterModel : parameterModels) {
|
||||
if (parameterModel.getKey().equals("url"))
|
||||
behaviorModelsWithUrl.add(behaviorModel);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return behaviorModelsWithUrl;
|
||||
} catch (NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private List<BehaviorModel> getBehaviorModels(
|
||||
RunScenarioModel runScenarioModel) {
|
||||
try {
|
||||
List<BatchModel> batchModels = new ArrayList<BatchModel>();
|
||||
for (PageModel pageModel : runScenarioModel.getPages())
|
||||
batchModels.addAll(pageModel.getBatches());
|
||||
List<BehaviorModel> behaviorModels = new ArrayList<BehaviorModel>();
|
||||
for (BatchModel batchModel : batchModels)
|
||||
behaviorModels.addAll(batchModel.getBehaviors());
|
||||
return behaviorModels;
|
||||
} catch (NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,206 +1,206 @@
|
|||
package org.bench4q.web.service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bench4q.share.models.agent.BehaviorBriefModel;
|
||||
import org.bench4q.share.models.agent.BehaviorStatusCodeResultModel;
|
||||
import org.bench4q.share.models.agent.RunScenarioModel;
|
||||
import org.bench4q.share.models.master.TestPlanScriptBriefResultModel;
|
||||
import org.bench4q.share.models.master.statistics.ScriptBehaviorsBriefModel;
|
||||
import org.bench4q.share.models.master.statistics.ScriptBriefResultModel;
|
||||
import org.bench4q.web.exception.CustomGenericException;
|
||||
import org.bench4q.web.model.ResultInfoModel;
|
||||
import org.bench4q.web.model.ResultModel;
|
||||
import org.bench4q.web.model.TestPlanRequestModel;
|
||||
import org.bench4q.web.model.WebScriptModel;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.SessionAttributes;
|
||||
|
||||
@Component
|
||||
@SessionAttributes({ "accessToken", "testPlanTaskList" })
|
||||
public class TestPlanService extends BaseService {
|
||||
private ScriptService scriptService;
|
||||
|
||||
public ScriptService getScriptService() {
|
||||
return scriptService;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setScriptService(ScriptService scriptService) {
|
||||
this.scriptService = scriptService;
|
||||
}
|
||||
|
||||
public TestPlanService() {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public ResultInfoModel getScriptBriefStatusResultInfo() {
|
||||
String result = "briefStatus";
|
||||
|
||||
String[] fields = new String[] { "averageResponseTime",
|
||||
"maxResponseTime", "minResponseTime", "averageElapsedTime",
|
||||
"successThroughputThisTime", "failThroughputThisTime",
|
||||
"failRateThisTime", "totalFailCountFromBegin",
|
||||
"responseTimeDeviationThisTime" };
|
||||
return getResultInfoModel(result, fields);
|
||||
}
|
||||
|
||||
public ResultInfoModel getScriptBehaviorBriefResultInfo(
|
||||
RunScenarioModel runScenarioModel) {
|
||||
String behaviroResult = "behaviors";
|
||||
|
||||
ResultInfoModel behaviorResultInfoModel = new ResultInfoModel();
|
||||
behaviorResultInfoModel
|
||||
.setChildResults(new ArrayList<ResultInfoModel>());
|
||||
behaviorResultInfoModel.setResult(behaviroResult);
|
||||
|
||||
String[] fields = new String[] { "minResponseTime", "maxResponseTime",
|
||||
"totalResponseTimeThisTime" };
|
||||
for (String url : this.getScriptService().getScriptBehaviorUrl(
|
||||
runScenarioModel)) {
|
||||
ResultInfoModel urlResultInfoModel =
|
||||
|
||||
getResultInfoModel(url, fields);
|
||||
behaviorResultInfoModel.getChildResults().add(urlResultInfoModel);
|
||||
}
|
||||
|
||||
return behaviorResultInfoModel;
|
||||
}
|
||||
|
||||
public ResultInfoModel getScriptPageBriefResultInfo(
|
||||
RunScenarioModel runScenarioModel) {
|
||||
|
||||
ResultInfoModel pageInfoModel = new ResultInfoModel();
|
||||
pageInfoModel.setChildResults(new ArrayList<ResultInfoModel>());
|
||||
pageInfoModel.setResult("Pages");
|
||||
String[] fields = new String[] { "averageResponseTimeThisTime",
|
||||
"latestResponseTime", "throughputThisTime" };
|
||||
for (String page : this.getScriptService().getScriptPages(
|
||||
runScenarioModel)) {
|
||||
|
||||
pageInfoModel.getChildResults().add(
|
||||
getResultInfoModel(page, fields));
|
||||
}
|
||||
return pageInfoModel;
|
||||
}
|
||||
|
||||
public ResultInfoModel getResultInfoModel(String result, List<String> fields) {
|
||||
ResultInfoModel resultInfoModel = new ResultInfoModel();
|
||||
resultInfoModel.setResult(result);
|
||||
if (fields.size() <= 0)
|
||||
return resultInfoModel;
|
||||
|
||||
resultInfoModel.setChildResults(new ArrayList<ResultInfoModel>());
|
||||
for (String field : fields) {
|
||||
ResultInfoModel scriptResultInfoModelChild = new ResultInfoModel();
|
||||
|
||||
scriptResultInfoModelChild.setResult(field);
|
||||
resultInfoModel.getChildResults().add(scriptResultInfoModelChild);
|
||||
}
|
||||
return resultInfoModel;
|
||||
}
|
||||
|
||||
public List<ResultModel> extractResultModelList(
|
||||
TestPlanScriptBriefResultModel testPlanScriptBriefResultModel,
|
||||
String fieldName) throws CustomGenericException,
|
||||
NoSuchFieldException {
|
||||
if (testPlanScriptBriefResultModel.getScriptBriefResultModels() == null)
|
||||
throw new CustomGenericException(
|
||||
"5",
|
||||
"testPlanScriptBriefResultModel:scriptBriefResultModels empty data",
|
||||
"");
|
||||
List<ResultModel> resultModels = new ArrayList<ResultModel>();
|
||||
for (ScriptBriefResultModel scriptBriefResultModel : testPlanScriptBriefResultModel
|
||||
.getScriptBriefResultModels()) {
|
||||
|
||||
List<String> fieldNames = new ArrayList<String>();
|
||||
fieldNames.add(fieldName);
|
||||
ResultModel resultModel = ChangeToResultModel.getResultModel(
|
||||
scriptBriefResultModel, fieldNames);
|
||||
resultModel.setFinished(scriptBriefResultModel.isFinished());
|
||||
resultModel.setTime(scriptBriefResultModel.getSamplingTime());
|
||||
resultModels.add(resultModel);
|
||||
}
|
||||
return resultModels;
|
||||
|
||||
}
|
||||
|
||||
public boolean isValidateTestRunModel(
|
||||
TestPlanRequestModel testPlanRequestModel) {
|
||||
|
||||
if (testPlanRequestModel.getScriptList() == null
|
||||
|| testPlanRequestModel.getScriptList().size() == 0)
|
||||
return true;
|
||||
if (testPlanRequestModel.getTestPlanName() == null
|
||||
|| testPlanRequestModel.getTestPlanName().equals(""))
|
||||
testPlanRequestModel.setTestPlanName("default");
|
||||
for (WebScriptModel scriptModel : testPlanRequestModel.getScriptList()) {
|
||||
if (isValidateScriptModel(scriptModel))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isValidateScriptModel(WebScriptModel scriptModel) {
|
||||
if (scriptModel.getId() == 0)
|
||||
return true;
|
||||
if (scriptModel.getLoad() == 0)
|
||||
return true;
|
||||
if (scriptModel.getExecuteRange() == 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public Map<String, Double> getUrlContentTypePercent(
|
||||
Map<String, Long> urlContentTypeCountMap, long totalCount) {
|
||||
if (urlContentTypeCountMap == null)
|
||||
return null;
|
||||
|
||||
if (totalCount == 0)
|
||||
return null;
|
||||
Map<String, Double> urlContentTypePercentMap = new HashMap<String, Double>();
|
||||
Set<String> keys = urlContentTypeCountMap.keySet();
|
||||
Iterator<String> iterator = keys.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
String key = iterator.next();
|
||||
double percent = (double) urlContentTypeCountMap.get(key)
|
||||
/ (double) totalCount * 100;
|
||||
urlContentTypePercentMap.put(key, new Double(percent));
|
||||
}
|
||||
return urlContentTypePercentMap;
|
||||
|
||||
}
|
||||
|
||||
public long getTotalCount(Map<String, Long> urlContentTypeCountMap) {
|
||||
|
||||
Set<String> keys = urlContentTypeCountMap.keySet();
|
||||
Iterator<String> iterator = keys.iterator();
|
||||
long totalCount = 0;
|
||||
while (iterator.hasNext()) {
|
||||
totalCount += urlContentTypeCountMap.get(iterator.next());
|
||||
}
|
||||
return totalCount;
|
||||
}
|
||||
|
||||
public List<BehaviorStatusCodeResultModel> getBehaviorStatusCodeResultModels(
|
||||
ScriptBehaviorsBriefModel scriptBehaviorsBriefModel) {
|
||||
List<BehaviorStatusCodeResultModel> behaviorStatusCodeResultModels = new ArrayList<BehaviorStatusCodeResultModel>();
|
||||
for (BehaviorBriefModel behaviorBriefModel : scriptBehaviorsBriefModel
|
||||
.getTestBehaviorsBriefModel().getBehaviorBriefModels()) {
|
||||
|
||||
if (behaviorBriefModel.getDetailStatusCodeResultModels() != null)
|
||||
behaviorStatusCodeResultModels.addAll(behaviorBriefModel
|
||||
.getDetailStatusCodeResultModels());
|
||||
}
|
||||
return behaviorStatusCodeResultModels;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
package org.bench4q.web.service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bench4q.share.models.agent.BehaviorBriefModel;
|
||||
import org.bench4q.share.models.agent.BehaviorStatusCodeResultModel;
|
||||
import org.bench4q.share.models.agent.RunScenarioModel;
|
||||
import org.bench4q.share.models.master.TestPlanScriptBriefResultModel;
|
||||
import org.bench4q.share.models.master.statistics.ScriptBehaviorsBriefModel;
|
||||
import org.bench4q.share.models.master.statistics.ScriptBriefResultModel;
|
||||
import org.bench4q.web.exception.CustomGenericException;
|
||||
import org.bench4q.web.model.ResultInfoModel;
|
||||
import org.bench4q.web.model.ResultModel;
|
||||
import org.bench4q.web.model.TestPlanRequestModel;
|
||||
import org.bench4q.web.model.WebScriptModel;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.SessionAttributes;
|
||||
|
||||
@Component
|
||||
@SessionAttributes({ "accessToken", "testPlanTaskList" })
|
||||
public class TestPlanService extends BaseService {
|
||||
private ScriptService scriptService;
|
||||
|
||||
public ScriptService getScriptService() {
|
||||
return scriptService;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setScriptService(ScriptService scriptService) {
|
||||
this.scriptService = scriptService;
|
||||
}
|
||||
|
||||
public TestPlanService() {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public ResultInfoModel getScriptBriefStatusResultInfo() {
|
||||
String result = "briefStatus";
|
||||
|
||||
String[] fields = new String[] { "averageResponseTime",
|
||||
"maxResponseTime", "minResponseTime", "averageElapsedTime",
|
||||
"successThroughputThisTime", "failThroughputThisTime",
|
||||
"failRateThisTime", "totalFailCountFromBegin",
|
||||
"responseTimeDeviationThisTime" };
|
||||
return getResultInfoModel(result, fields);
|
||||
}
|
||||
|
||||
public ResultInfoModel getScriptBehaviorBriefResultInfo(
|
||||
RunScenarioModel runScenarioModel) {
|
||||
String behaviroResult = "behaviors";
|
||||
|
||||
ResultInfoModel behaviorResultInfoModel = new ResultInfoModel();
|
||||
behaviorResultInfoModel
|
||||
.setChildResults(new ArrayList<ResultInfoModel>());
|
||||
behaviorResultInfoModel.setResult(behaviroResult);
|
||||
|
||||
String[] fields = new String[] { "minResponseTime", "maxResponseTime",
|
||||
"totalResponseTimeThisTime" };
|
||||
for (String url : this.getScriptService().getScriptBehaviorUrl(
|
||||
runScenarioModel)) {
|
||||
ResultInfoModel urlResultInfoModel =
|
||||
|
||||
getResultInfoModel(url, fields);
|
||||
behaviorResultInfoModel.getChildResults().add(urlResultInfoModel);
|
||||
}
|
||||
|
||||
return behaviorResultInfoModel;
|
||||
}
|
||||
|
||||
public ResultInfoModel getScriptPageBriefResultInfo(
|
||||
RunScenarioModel runScenarioModel) {
|
||||
|
||||
ResultInfoModel pageInfoModel = new ResultInfoModel();
|
||||
pageInfoModel.setChildResults(new ArrayList<ResultInfoModel>());
|
||||
pageInfoModel.setResult("Pages");
|
||||
String[] fields = new String[] { "averageResponseTimeThisTime",
|
||||
"latestResponseTime", "throughputThisTime" };
|
||||
for (String page : this.getScriptService().getScriptPages(
|
||||
runScenarioModel)) {
|
||||
|
||||
pageInfoModel.getChildResults().add(
|
||||
getResultInfoModel(page, fields));
|
||||
}
|
||||
return pageInfoModel;
|
||||
}
|
||||
|
||||
public ResultInfoModel getResultInfoModel(String result, List<String> fields) {
|
||||
ResultInfoModel resultInfoModel = new ResultInfoModel();
|
||||
resultInfoModel.setResult(result);
|
||||
if (fields.size() <= 0)
|
||||
return resultInfoModel;
|
||||
|
||||
resultInfoModel.setChildResults(new ArrayList<ResultInfoModel>());
|
||||
for (String field : fields) {
|
||||
ResultInfoModel scriptResultInfoModelChild = new ResultInfoModel();
|
||||
|
||||
scriptResultInfoModelChild.setResult(field);
|
||||
resultInfoModel.getChildResults().add(scriptResultInfoModelChild);
|
||||
}
|
||||
return resultInfoModel;
|
||||
}
|
||||
|
||||
public List<ResultModel> extractResultModelList(
|
||||
TestPlanScriptBriefResultModel testPlanScriptBriefResultModel,
|
||||
String fieldName) throws CustomGenericException,
|
||||
NoSuchFieldException {
|
||||
if (testPlanScriptBriefResultModel.getScriptBriefResultModels() == null)
|
||||
throw new CustomGenericException(
|
||||
"5",
|
||||
"testPlanScriptBriefResultModel:scriptBriefResultModels empty data",
|
||||
"");
|
||||
List<ResultModel> resultModels = new ArrayList<ResultModel>();
|
||||
for (ScriptBriefResultModel scriptBriefResultModel : testPlanScriptBriefResultModel
|
||||
.getScriptBriefResultModels()) {
|
||||
|
||||
List<String> fieldNames = new ArrayList<String>();
|
||||
fieldNames.add(fieldName);
|
||||
ResultModel resultModel = ChangeToResultModel.getResultModel(
|
||||
scriptBriefResultModel, fieldNames);
|
||||
resultModel.setFinished(scriptBriefResultModel.isFinished());
|
||||
resultModel.setTime(scriptBriefResultModel.getSamplingTime());
|
||||
resultModels.add(resultModel);
|
||||
}
|
||||
return resultModels;
|
||||
|
||||
}
|
||||
|
||||
public boolean isValidateTestRunModel(
|
||||
TestPlanRequestModel testPlanRequestModel) {
|
||||
|
||||
if (testPlanRequestModel.getScriptList() == null
|
||||
|| testPlanRequestModel.getScriptList().size() == 0)
|
||||
return true;
|
||||
if (testPlanRequestModel.getTestPlanName() == null
|
||||
|| testPlanRequestModel.getTestPlanName().equals(""))
|
||||
testPlanRequestModel.setTestPlanName("default");
|
||||
for (WebScriptModel scriptModel : testPlanRequestModel.getScriptList()) {
|
||||
if (isValidateScriptModel(scriptModel))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isValidateScriptModel(WebScriptModel scriptModel) {
|
||||
if (scriptModel.getId() == 0)
|
||||
return true;
|
||||
if (scriptModel.getLoad() == 0)
|
||||
return true;
|
||||
if (scriptModel.getExecuteRange() == 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public Map<String, Double> getUrlContentTypePercent(
|
||||
Map<String, Long> urlContentTypeCountMap, long totalCount) {
|
||||
if (urlContentTypeCountMap == null)
|
||||
return null;
|
||||
|
||||
if (totalCount == 0)
|
||||
return null;
|
||||
Map<String, Double> urlContentTypePercentMap = new HashMap<String, Double>();
|
||||
Set<String> keys = urlContentTypeCountMap.keySet();
|
||||
Iterator<String> iterator = keys.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
String key = iterator.next();
|
||||
double percent = (double) urlContentTypeCountMap.get(key)
|
||||
/ (double) totalCount * 100;
|
||||
urlContentTypePercentMap.put(key, new Double(percent));
|
||||
}
|
||||
return urlContentTypePercentMap;
|
||||
|
||||
}
|
||||
|
||||
public long getTotalCount(Map<String, Long> urlContentTypeCountMap) {
|
||||
|
||||
Set<String> keys = urlContentTypeCountMap.keySet();
|
||||
Iterator<String> iterator = keys.iterator();
|
||||
long totalCount = 0;
|
||||
while (iterator.hasNext()) {
|
||||
totalCount += urlContentTypeCountMap.get(iterator.next());
|
||||
}
|
||||
return totalCount;
|
||||
}
|
||||
|
||||
public List<BehaviorStatusCodeResultModel> getBehaviorStatusCodeResultModels(
|
||||
ScriptBehaviorsBriefModel scriptBehaviorsBriefModel) {
|
||||
List<BehaviorStatusCodeResultModel> behaviorStatusCodeResultModels = new ArrayList<BehaviorStatusCodeResultModel>();
|
||||
for (BehaviorBriefModel behaviorBriefModel : scriptBehaviorsBriefModel
|
||||
.getTestBehaviorsBriefModel().getBehaviorBriefModels()) {
|
||||
|
||||
if (behaviorBriefModel.getDetailStatusCodeResultModels() != null)
|
||||
behaviorStatusCodeResultModels.addAll(behaviorBriefModel
|
||||
.getDetailStatusCodeResultModels());
|
||||
}
|
||||
return behaviorStatusCodeResultModels;
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,28 +1,28 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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: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
|
||||
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">
|
||||
<context:component-scan base-package="org.bench4q" />
|
||||
<mvc:annotation-driven />
|
||||
<mvc:resources mapping="/images/**" location="/images/" />
|
||||
<mvc:resources mapping="/style/**" location="/style/" />
|
||||
<mvc:resources mapping="/script/**" location="/script/" />
|
||||
<mvc:resources mapping="/css/**" location="/css/" />
|
||||
<mvc:resources mapping="/static/**" location="/static/" />
|
||||
<mvc:resources mapping="/img/**" location="/img/" />
|
||||
<mvc:resources mapping="/i18n/**" location="/i18n/" />
|
||||
<mvc:default-servlet-handler />
|
||||
|
||||
<!-- ③:对模型视图名称的解析,即在模型视图名称添加前后缀 -->
|
||||
<bean
|
||||
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
|
||||
<property name="suffix" value=".jsp" />
|
||||
</bean>
|
||||
<!-- file uploads starts -->
|
||||
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"></bean>
|
||||
|
||||
</beans>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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: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
|
||||
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">
|
||||
<context:component-scan base-package="org.bench4q" />
|
||||
<mvc:annotation-driven />
|
||||
<mvc:resources mapping="/images/**" location="/images/" />
|
||||
<mvc:resources mapping="/style/**" location="/style/" />
|
||||
<mvc:resources mapping="/script/**" location="/script/" />
|
||||
<mvc:resources mapping="/css/**" location="/css/" />
|
||||
<mvc:resources mapping="/static/**" location="/static/" />
|
||||
<mvc:resources mapping="/img/**" location="/img/" />
|
||||
<mvc:resources mapping="/i18n/**" location="/i18n/" />
|
||||
<mvc:default-servlet-handler />
|
||||
|
||||
<!-- ③:对模型视图名称的解析,即在模型视图名称添加前后缀 -->
|
||||
<bean
|
||||
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
|
||||
<property name="suffix" value=".jsp" />
|
||||
</bean>
|
||||
<!-- file uploads starts -->
|
||||
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"></bean>
|
||||
|
||||
</beans>
|
||||
<!-- file uploads ends -->
|
|
@ -1,107 +1,107 @@
|
|||
login=login
|
||||
sign=sign
|
||||
loginwith=Please login with your Username and Password.
|
||||
welcometo=Welcome to Bench4Q
|
||||
creattestplan=Creat TestPlan
|
||||
scriptmanagement=Script Management
|
||||
testhistory=Test History
|
||||
creat=Creat
|
||||
testplan=TestPlan
|
||||
script=Script
|
||||
management=Management
|
||||
test=Test
|
||||
history=History
|
||||
creattestplanhead=Here you can run testplans and get the result!
|
||||
creattestplancontent1=1.Create new scripts or load scripts to organize a testplan.
|
||||
creattestplancontent2=2.Config the address of the systems under test.
|
||||
startTest=Start Test
|
||||
scriptmanagementhead=Here you can manage the scripts!
|
||||
scriptmanagementcontent1=1.Create a new script and save it.
|
||||
scriptmanagementcontent2=2.Edit a script in the scripts pool.
|
||||
scriptmanagementcontent3=3.Delete a script in the scripts pool.
|
||||
testhistoryhead=Here are the test history!
|
||||
testhistorycontent1=Select a record ,you can view the scripts it contains,
|
||||
testhistorycontent2=and,view the test result of it.
|
||||
poweredby=Powered by
|
||||
registerhead=Register your account.
|
||||
registerbutton=Register
|
||||
topfullwidth=Top Full Width
|
||||
home=Home
|
||||
creatatest=creat a test
|
||||
charts=Charts
|
||||
main=MAIN
|
||||
chartwithpoints=Chart with points
|
||||
scriptname=Script Name
|
||||
datecreated=Date created
|
||||
actions=Actions
|
||||
settings=Add Script
|
||||
configuredmessage=Here settings can be configured
|
||||
startserver=Start Server
|
||||
stopserver=Stop Server
|
||||
savefile=Save File
|
||||
editscript=Edit Script
|
||||
savechanges=Save
|
||||
cancel=Cancel
|
||||
close=Close
|
||||
viewscript=View Script
|
||||
creatascript=Creat a script
|
||||
loadascript=Load a script
|
||||
startthetest=Start the test
|
||||
configthecluster=Config the System Under Test
|
||||
systemundertest=System under test
|
||||
inputip=please input the ip
|
||||
add=Add
|
||||
submit=Submit
|
||||
selectparams=Select params
|
||||
choosethescriptrecorded=Please choose the scripts from your script library .
|
||||
selectascript=Select a script
|
||||
choose=choose
|
||||
testplanrunid=TestPlanRunId
|
||||
createdatetime=Create
|
||||
agentmanagement=Agent Management
|
||||
agents=Agents
|
||||
hostname=HostName
|
||||
port=Port
|
||||
status=Status
|
||||
maxload=MaxLoad
|
||||
remainload=RemainLoad
|
||||
warning=Warning
|
||||
warningcontent1=You need to have
|
||||
warningcontent2=enabled to use this site
|
||||
agentmanage=Agent Manage
|
||||
portmanage=Port Manage
|
||||
homepage=Homepage
|
||||
changetheme=Change Theme / Skin
|
||||
classic=Classic
|
||||
cerulean=Cerulean
|
||||
cyborg=Cyborg
|
||||
journal=Journal
|
||||
profile=Profile
|
||||
logout=Logout
|
||||
visitsite=Visit Site
|
||||
testResult=TestResult
|
||||
scipt=Script
|
||||
sut=SUT
|
||||
selectscripts=Select Script
|
||||
selectedScripts=Selected Scripts
|
||||
next=Next
|
||||
add=Add
|
||||
clear=Clear
|
||||
number=Number
|
||||
testQueue=TestPlan Task
|
||||
name=Name
|
||||
nameTest=Input Testplan Name
|
||||
admin=admin
|
||||
result=test result
|
||||
validate=validate
|
||||
uploadScript=upload script
|
||||
latestTest=Latest Tests
|
||||
testName=Test Plan Name
|
||||
empty=Can not be empty!
|
||||
testPlanConfig=Load test execution plan
|
||||
allocation=Allocation
|
||||
total=Total
|
||||
sutIp=SUT IP
|
||||
addScript=Add Script
|
||||
addIp=Add IP
|
||||
login=login
|
||||
sign=sign
|
||||
loginwith=Please login with your Username and Password.
|
||||
welcometo=Welcome to Bench4Q
|
||||
creattestplan=Creat TestPlan
|
||||
scriptmanagement=Script Management
|
||||
testhistory=Test History
|
||||
creat=Creat
|
||||
testplan=TestPlan
|
||||
script=Script
|
||||
management=Management
|
||||
test=Test
|
||||
history=History
|
||||
creattestplanhead=Here you can run testplans and get the result!
|
||||
creattestplancontent1=1.Create new scripts or load scripts to organize a testplan.
|
||||
creattestplancontent2=2.Config the address of the systems under test.
|
||||
startTest=Start Test
|
||||
scriptmanagementhead=Here you can manage the scripts!
|
||||
scriptmanagementcontent1=1.Create a new script and save it.
|
||||
scriptmanagementcontent2=2.Edit a script in the scripts pool.
|
||||
scriptmanagementcontent3=3.Delete a script in the scripts pool.
|
||||
testhistoryhead=Here are the test history!
|
||||
testhistorycontent1=Select a record ,you can view the scripts it contains,
|
||||
testhistorycontent2=and,view the test result of it.
|
||||
poweredby=Powered by
|
||||
registerhead=Register your account.
|
||||
registerbutton=Register
|
||||
topfullwidth=Top Full Width
|
||||
home=Home
|
||||
creatatest=creat a test
|
||||
charts=Charts
|
||||
main=MAIN
|
||||
chartwithpoints=Chart with points
|
||||
scriptname=Script Name
|
||||
datecreated=Date created
|
||||
actions=Actions
|
||||
settings=Add Script
|
||||
configuredmessage=Here settings can be configured
|
||||
startserver=Start Server
|
||||
stopserver=Stop Server
|
||||
savefile=Save File
|
||||
editscript=Edit Script
|
||||
savechanges=Save
|
||||
cancel=Cancel
|
||||
close=Close
|
||||
viewscript=View Script
|
||||
creatascript=Creat a script
|
||||
loadascript=Load a script
|
||||
startthetest=Start the test
|
||||
configthecluster=Config the System Under Test
|
||||
systemundertest=System under test
|
||||
inputip=please input the ip
|
||||
add=Add
|
||||
submit=Submit
|
||||
selectparams=Select params
|
||||
choosethescriptrecorded=Please choose the scripts from your script library .
|
||||
selectascript=Select a script
|
||||
choose=choose
|
||||
testplanrunid=TestPlanRunId
|
||||
createdatetime=Create
|
||||
agentmanagement=Agent Management
|
||||
agents=Agents
|
||||
hostname=HostName
|
||||
port=Port
|
||||
status=Status
|
||||
maxload=MaxLoad
|
||||
remainload=RemainLoad
|
||||
warning=Warning
|
||||
warningcontent1=You need to have
|
||||
warningcontent2=enabled to use this site
|
||||
agentmanage=Agent Manage
|
||||
portmanage=Port Manage
|
||||
homepage=Homepage
|
||||
changetheme=Change Theme / Skin
|
||||
classic=Classic
|
||||
cerulean=Cerulean
|
||||
cyborg=Cyborg
|
||||
journal=Journal
|
||||
profile=Profile
|
||||
logout=Logout
|
||||
visitsite=Visit Site
|
||||
testResult=TestResult
|
||||
scipt=Script
|
||||
sut=SUT
|
||||
selectscripts=Select Script
|
||||
selectedScripts=Selected Scripts
|
||||
next=Next
|
||||
add=Add
|
||||
clear=Clear
|
||||
number=Number
|
||||
testQueue=TestPlan Task
|
||||
name=Name
|
||||
nameTest=Input Testplan Name
|
||||
admin=admin
|
||||
result=test result
|
||||
validate=validate
|
||||
uploadScript=upload script
|
||||
latestTest=Latest Tests
|
||||
testName=Test Plan Name
|
||||
empty=Can not be empty!
|
||||
testPlanConfig=Load test execution plan
|
||||
allocation=Allocation
|
||||
total=Total
|
||||
sutIp=SUT IP
|
||||
addScript=Add Script
|
||||
addIp=Add IP
|
||||
testPlanName=Test Plan Name
|
|
@ -1,108 +1,108 @@
|
|||
login=\u767B\u5F55
|
||||
sign=\u6CE8\u518C
|
||||
loginwith=\u8BF7\u8F93\u5165\u7528\u6237\u540D\u548C\u5BC6\u7801\u767B\u5F55\u7CFB\u7EDF
|
||||
welcometo=\u6B22\u8FCE\u4F7F\u7528Bench4Q
|
||||
creattestplan=\u65B0\u5EFA\u6D4B\u8BD5\u8BA1\u5212
|
||||
scriptmanagement=\u811A\u672C\u7BA1\u7406
|
||||
testhistory=\u6D4B\u8BD5\u5386\u53F2\u8BB0\u5F55
|
||||
creat=\u65B0\u5EFA
|
||||
testplan=\u6D4B\u8BD5\u8BA1\u5212
|
||||
script=\u811A\u672C
|
||||
management=\u7BA1\u7406
|
||||
test=\u6D4B\u8BD5
|
||||
history=\u5386\u53F2\u8BB0\u5F55
|
||||
creattestplanhead=\u53EF\u6267\u884C\u6D4B\u8BD5\u8BA1\u5212\u5E76\u5F97\u5230\u6D4B\u8BD5\u7ED3\u679C\uFF01
|
||||
creattestplancontent1=1.\u65B0\u5EFA\u6216\u8F7D\u5165\u811A\u672C\u521B\u5EFA\u6D4B\u8BD5\u8BA1\u5212\u3002
|
||||
creattestplancontent2=2.\u914D\u7F6E\u5F85\u6D4B\u7CFB\u7EDF\u5730\u5740\u3002
|
||||
creattestplancontent3=3.\u6267\u884C\u6D4B\u8BD5\u8BA1\u5212\u5E76\u5F97\u5230\u6D4B\u8BD5\u7ED3\u679C\u3002
|
||||
scriptmanagementhead=\u53EF\u7BA1\u7406\u6D4B\u8BD5\u811A\u672C\uFF01
|
||||
scriptmanagementcontent1=1.\u65B0\u5EFA\u5E76\u4FDD\u5B58\u4E00\u4E2A\u811A\u672C\u3002
|
||||
scriptmanagementcontent2=2.\u5728\u811A\u672C\u6C60\u4E2D\u7F16\u8F91\u811A\u672C\u3002
|
||||
scriptmanagementcontent3=3.\u4ECE\u811A\u672C\u6C60\u4E2D\u5220\u9664\u811A\u672C\u3002
|
||||
testhistoryhead=\u53EF\u6D4F\u89C8\u6D4B\u8BD5\u5386\u53F2\u8BB0\u5F55\uFF01
|
||||
testhistorycontent1=\u9009\u62E9\u4E00\u6761\u8BB0\u5F55\uFF0C\u53EF\u6D4F\u89C8\u5176\u4E2D\u6240\u5305\u542B\u811A\u672C\uFF0C
|
||||
testhistorycontent2=\u53CA\u76F8\u5E94\u6D4B\u8BD5\u7ED3\u679C\u3002
|
||||
poweredby=\u6280\u672F\u652F\u6301
|
||||
registerhead=\u6CE8\u518C\u4E2A\u4EBA\u8D26\u6237
|
||||
registerbutton=\u6CE8\u518C
|
||||
topfullwidth=\u5C55\u5F00\u9875\u9762\u9876\u90E8
|
||||
home=\u4E3B\u9875
|
||||
creatatest=\u65B0\u5EFA\u6D4B\u8BD5
|
||||
charts=\u56FE\u8868
|
||||
main=\u4E3B\u83DC\u5355
|
||||
chartwithpoints=\u6563\u70B9\u56FE\u8868
|
||||
scriptname=\u811A\u672C\u540D\u79F0
|
||||
datecreated=\u521B\u5EFA\u65E5\u671F
|
||||
actions=\u64CD\u4F5C
|
||||
settings=\u6DFB\u52A0\u811A\u672C
|
||||
configuredmessage=\u5728\u8FD9\u91CC\u53EF\u4EE5\u914D\u7F6E
|
||||
startserver=\u542F\u52A8\u670D\u52A1\u5668
|
||||
stopserver=\u505C\u6B62\u670D\u52A1\u5668
|
||||
savefile=\u4FDD\u5B58\u6587\u4EF6
|
||||
editscript=\u7F16\u8F91\u811A\u672C
|
||||
savechanges=\u4FDD\u5B58
|
||||
cancel=\u53D6\u6D88
|
||||
close=\u5173\u95ED
|
||||
viewscript=\u6D4F\u89C8\u811A\u672C
|
||||
creatascript=\u65B0\u5EFA\u811A\u672C
|
||||
loadascript=\u52A0\u8F7D\u5DF2\u6709\u811A\u672C
|
||||
startthetest=\u5F00\u59CB\u6D4B\u8BD5
|
||||
configthecluster=\u914D\u7F6E\u5F85\u6D4B\u7CFB\u7EDF
|
||||
systemundertest=\u88AB\u6D4B\u7CFB\u7EDF
|
||||
inputip=\u8BF7\u8F93\u5165ip\u5730\u5740
|
||||
add=\u589E\u52A0
|
||||
submit=\u786E\u8BA4
|
||||
selectparams=\u9009\u62E9\u53C2\u6570
|
||||
choosethescriptrecorded=\u8BF7\u9009\u62E9\u811A\u672C
|
||||
selectascript=\u9009\u62E9\u4E00\u4E2A\u811A\u672C
|
||||
choose=\u9009\u62E9
|
||||
testplanrunid=\u8FD0\u884CID
|
||||
createdatetime=\u521B\u5EFA
|
||||
agentmanagement=\u4EE3\u7406\u7BA1\u7406
|
||||
agents=\u4EE3\u7406
|
||||
hostname=\u4E3B\u673A\u540D
|
||||
port=\u7AEF\u53E3
|
||||
status=\u72B6\u6001
|
||||
maxload=\u6700\u5927\u8D1F\u8F7D
|
||||
remainload=\u5269\u4F59\u8D1F\u8F7D
|
||||
warning=\u63D0\u793A
|
||||
warningcontent1=\u9700\u8981\u652F\u6301
|
||||
warningcontent2=\u4F7F\u7F51\u9875\u53EF\u4EE5\u6B63\u5E38\u663E\u793A
|
||||
agentmanage=\u4EE3\u7406\u7BA1\u7406
|
||||
portmanage=\u7AEF\u53E3\u7BA1\u7406
|
||||
homepage=\u4E3B\u9875
|
||||
changetheme=\u66F4\u6362\u4E3B\u9898\ / \u76AE\u80A4
|
||||
classic=\u7ECF\u5178\u6837\u5F0F
|
||||
cerulean=\u5929\u84DD\u8272
|
||||
cyborg=\u7535\u5B50
|
||||
journal=\u65E5\u5FD7
|
||||
profile=\u5F62\u8C61
|
||||
logout=\u6CE8\u9500
|
||||
visitsite=\u8BBF\u95EE\u7AD9\u70B9
|
||||
testResult=\u6D4B\u8BD5\u7ED3\u679C
|
||||
script=\u811A\u672C
|
||||
sut=\u5F85\u6D4B\u7CFB\u7EDF
|
||||
selectscripts=\u9009\u62E9\u811A\u672C
|
||||
selectedScripts=\u5DF2\u9009\u811A\u672C
|
||||
next=\u4E0B\u4E00\u6B65
|
||||
add=\u6DFB\u52A0
|
||||
clear=\u6E05\u9664
|
||||
number=\u5E8F\u53F7
|
||||
testQueue=\u6D4B\u8BD5\u4EFB\u52A1
|
||||
name=\u540D\u5B57
|
||||
nameTest=\u8F93\u5165\u6D4B\u8BD5\u8BA1\u5212\u540D\u79F0
|
||||
admin=\u7BA1\u7406\u5458
|
||||
result=\u6D4B\u8BD5\u7ED3\u679C
|
||||
validate=\u9A8C\u8BC1
|
||||
uploadScript=\u4E0A\u4F20\u811A\u672C
|
||||
latestTest=\u6700\u8FD1\u6D4B\u8BD5
|
||||
testName=\u6D4B\u8BD5\u8BA1\u5212\u540D\u79F0
|
||||
empty=\u4E0D\u80FD\u4E3A\u7A7A
|
||||
testPlanConfig=\u914D\u7F6E\u6D4B\u8BD5\u8BA1\u5212
|
||||
allocation=\u6BD4\u4F8B
|
||||
total=\u603B\u5171
|
||||
sutIp=\u5F85\u6D4B\u7CFB\u7EDFIP
|
||||
addScript=\u6DFB\u52A0\u811A\u672C
|
||||
addIp=\u6DFB\u52A0\IP
|
||||
startTest=\u5F00\u59CB\u6D4B\u8BD5
|
||||
login=\u767B\u5F55
|
||||
sign=\u6CE8\u518C
|
||||
loginwith=\u8BF7\u8F93\u5165\u7528\u6237\u540D\u548C\u5BC6\u7801\u767B\u5F55\u7CFB\u7EDF
|
||||
welcometo=\u6B22\u8FCE\u4F7F\u7528Bench4Q
|
||||
creattestplan=\u65B0\u5EFA\u6D4B\u8BD5\u8BA1\u5212
|
||||
scriptmanagement=\u811A\u672C\u7BA1\u7406
|
||||
testhistory=\u6D4B\u8BD5\u5386\u53F2\u8BB0\u5F55
|
||||
creat=\u65B0\u5EFA
|
||||
testplan=\u6D4B\u8BD5\u8BA1\u5212
|
||||
script=\u811A\u672C
|
||||
management=\u7BA1\u7406
|
||||
test=\u6D4B\u8BD5
|
||||
history=\u5386\u53F2\u8BB0\u5F55
|
||||
creattestplanhead=\u53EF\u6267\u884C\u6D4B\u8BD5\u8BA1\u5212\u5E76\u5F97\u5230\u6D4B\u8BD5\u7ED3\u679C\uFF01
|
||||
creattestplancontent1=1.\u65B0\u5EFA\u6216\u8F7D\u5165\u811A\u672C\u521B\u5EFA\u6D4B\u8BD5\u8BA1\u5212\u3002
|
||||
creattestplancontent2=2.\u914D\u7F6E\u5F85\u6D4B\u7CFB\u7EDF\u5730\u5740\u3002
|
||||
creattestplancontent3=3.\u6267\u884C\u6D4B\u8BD5\u8BA1\u5212\u5E76\u5F97\u5230\u6D4B\u8BD5\u7ED3\u679C\u3002
|
||||
scriptmanagementhead=\u53EF\u7BA1\u7406\u6D4B\u8BD5\u811A\u672C\uFF01
|
||||
scriptmanagementcontent1=1.\u65B0\u5EFA\u5E76\u4FDD\u5B58\u4E00\u4E2A\u811A\u672C\u3002
|
||||
scriptmanagementcontent2=2.\u5728\u811A\u672C\u6C60\u4E2D\u7F16\u8F91\u811A\u672C\u3002
|
||||
scriptmanagementcontent3=3.\u4ECE\u811A\u672C\u6C60\u4E2D\u5220\u9664\u811A\u672C\u3002
|
||||
testhistoryhead=\u53EF\u6D4F\u89C8\u6D4B\u8BD5\u5386\u53F2\u8BB0\u5F55\uFF01
|
||||
testhistorycontent1=\u9009\u62E9\u4E00\u6761\u8BB0\u5F55\uFF0C\u53EF\u6D4F\u89C8\u5176\u4E2D\u6240\u5305\u542B\u811A\u672C\uFF0C
|
||||
testhistorycontent2=\u53CA\u76F8\u5E94\u6D4B\u8BD5\u7ED3\u679C\u3002
|
||||
poweredby=\u6280\u672F\u652F\u6301
|
||||
registerhead=\u6CE8\u518C\u4E2A\u4EBA\u8D26\u6237
|
||||
registerbutton=\u6CE8\u518C
|
||||
topfullwidth=\u5C55\u5F00\u9875\u9762\u9876\u90E8
|
||||
home=\u4E3B\u9875
|
||||
creatatest=\u65B0\u5EFA\u6D4B\u8BD5
|
||||
charts=\u56FE\u8868
|
||||
main=\u4E3B\u83DC\u5355
|
||||
chartwithpoints=\u6563\u70B9\u56FE\u8868
|
||||
scriptname=\u811A\u672C\u540D\u79F0
|
||||
datecreated=\u521B\u5EFA\u65E5\u671F
|
||||
actions=\u64CD\u4F5C
|
||||
settings=\u6DFB\u52A0\u811A\u672C
|
||||
configuredmessage=\u5728\u8FD9\u91CC\u53EF\u4EE5\u914D\u7F6E
|
||||
startserver=\u542F\u52A8\u670D\u52A1\u5668
|
||||
stopserver=\u505C\u6B62\u670D\u52A1\u5668
|
||||
savefile=\u4FDD\u5B58\u6587\u4EF6
|
||||
editscript=\u7F16\u8F91\u811A\u672C
|
||||
savechanges=\u4FDD\u5B58
|
||||
cancel=\u53D6\u6D88
|
||||
close=\u5173\u95ED
|
||||
viewscript=\u6D4F\u89C8\u811A\u672C
|
||||
creatascript=\u65B0\u5EFA\u811A\u672C
|
||||
loadascript=\u52A0\u8F7D\u5DF2\u6709\u811A\u672C
|
||||
startthetest=\u5F00\u59CB\u6D4B\u8BD5
|
||||
configthecluster=\u914D\u7F6E\u5F85\u6D4B\u7CFB\u7EDF
|
||||
systemundertest=\u88AB\u6D4B\u7CFB\u7EDF
|
||||
inputip=\u8BF7\u8F93\u5165ip\u5730\u5740
|
||||
add=\u589E\u52A0
|
||||
submit=\u786E\u8BA4
|
||||
selectparams=\u9009\u62E9\u53C2\u6570
|
||||
choosethescriptrecorded=\u8BF7\u9009\u62E9\u811A\u672C
|
||||
selectascript=\u9009\u62E9\u4E00\u4E2A\u811A\u672C
|
||||
choose=\u9009\u62E9
|
||||
testplanrunid=\u8FD0\u884CID
|
||||
createdatetime=\u521B\u5EFA
|
||||
agentmanagement=\u4EE3\u7406\u7BA1\u7406
|
||||
agents=\u4EE3\u7406
|
||||
hostname=\u4E3B\u673A\u540D
|
||||
port=\u7AEF\u53E3
|
||||
status=\u72B6\u6001
|
||||
maxload=\u6700\u5927\u8D1F\u8F7D
|
||||
remainload=\u5269\u4F59\u8D1F\u8F7D
|
||||
warning=\u63D0\u793A
|
||||
warningcontent1=\u9700\u8981\u652F\u6301
|
||||
warningcontent2=\u4F7F\u7F51\u9875\u53EF\u4EE5\u6B63\u5E38\u663E\u793A
|
||||
agentmanage=\u4EE3\u7406\u7BA1\u7406
|
||||
portmanage=\u7AEF\u53E3\u7BA1\u7406
|
||||
homepage=\u4E3B\u9875
|
||||
changetheme=\u66F4\u6362\u4E3B\u9898\ / \u76AE\u80A4
|
||||
classic=\u7ECF\u5178\u6837\u5F0F
|
||||
cerulean=\u5929\u84DD\u8272
|
||||
cyborg=\u7535\u5B50
|
||||
journal=\u65E5\u5FD7
|
||||
profile=\u5F62\u8C61
|
||||
logout=\u6CE8\u9500
|
||||
visitsite=\u8BBF\u95EE\u7AD9\u70B9
|
||||
testResult=\u6D4B\u8BD5\u7ED3\u679C
|
||||
script=\u811A\u672C
|
||||
sut=\u5F85\u6D4B\u7CFB\u7EDF
|
||||
selectscripts=\u9009\u62E9\u811A\u672C
|
||||
selectedScripts=\u5DF2\u9009\u811A\u672C
|
||||
next=\u4E0B\u4E00\u6B65
|
||||
add=\u6DFB\u52A0
|
||||
clear=\u6E05\u9664
|
||||
number=\u5E8F\u53F7
|
||||
testQueue=\u6D4B\u8BD5\u4EFB\u52A1
|
||||
name=\u540D\u5B57
|
||||
nameTest=\u8F93\u5165\u6D4B\u8BD5\u8BA1\u5212\u540D\u79F0
|
||||
admin=\u7BA1\u7406\u5458
|
||||
result=\u6D4B\u8BD5\u7ED3\u679C
|
||||
validate=\u9A8C\u8BC1
|
||||
uploadScript=\u4E0A\u4F20\u811A\u672C
|
||||
latestTest=\u6700\u8FD1\u6D4B\u8BD5
|
||||
testName=\u6D4B\u8BD5\u8BA1\u5212\u540D\u79F0
|
||||
empty=\u4E0D\u80FD\u4E3A\u7A7A
|
||||
testPlanConfig=\u914D\u7F6E\u6D4B\u8BD5\u8BA1\u5212
|
||||
allocation=\u6BD4\u4F8B
|
||||
total=\u603B\u5171
|
||||
sutIp=\u5F85\u6D4B\u7CFB\u7EDFIP
|
||||
addScript=\u6DFB\u52A0\u811A\u672C
|
||||
addIp=\u6DFB\u52A0\IP
|
||||
startTest=\u5F00\u59CB\u6D4B\u8BD5
|
||||
testPlanName=\u6D4B\u8BD5\u540D\u79F0
|
|
@ -1,248 +1,248 @@
|
|||
{
|
||||
"$schema": "http://json-schema.org/draft-03/schema",
|
||||
"id": "http://jsonschema.net",
|
||||
"required": true,
|
||||
"type": "object" ,
|
||||
"properties": {
|
||||
"runScenario" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario",
|
||||
"required": true,
|
||||
"type": "object" ,
|
||||
"properties": {
|
||||
"pages":
|
||||
{
|
||||
"id":"http://jsonschema.net/runScenario/pages",
|
||||
"required":true,
|
||||
"type":"object",
|
||||
"properties":{
|
||||
"page":
|
||||
{
|
||||
"id":"http://jsonschema.net/runScenario/pages/page",
|
||||
"required":true,
|
||||
"type":"object",
|
||||
"properties":
|
||||
{
|
||||
"batches" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/pages/page/batches",
|
||||
"required": true,
|
||||
"type": "object" ,
|
||||
"properties": {
|
||||
"batch" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/pages/page/batches/batch",
|
||||
"required": true,
|
||||
"type": "array" ,
|
||||
"items":
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/pages/page/batches/batch/0",
|
||||
"required": true,
|
||||
"type": "object" ,
|
||||
"properties": {
|
||||
"behaviors" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/pages/page/batches/batch/0/behaviors",
|
||||
"required": true,
|
||||
"type": "object" ,
|
||||
"properties": {
|
||||
"userBehavior" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/pages/page/batches/batch/0/behaviors/userBehavior",
|
||||
|
||||
"type": "object" ,
|
||||
"optional":true,
|
||||
"properties": {
|
||||
"id" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/pages/page/batches/batch/0/behaviors/userBehavior/id",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
|
||||
},
|
||||
"name" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/pages/page/batches/batch/0/behaviors/userBehavior/name",
|
||||
"required": true,
|
||||
"type": "string" ,
|
||||
"enum":["Get","Post","Put","Delete","Sleep","Log","Command"]
|
||||
},
|
||||
"parameters" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/pages/page/batches/batch/0/behaviors/userBehavior/parameters",
|
||||
"required": true,
|
||||
"type": "object" ,
|
||||
"properties": {
|
||||
"parameter" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/pages/page/batches/batch/0/behaviors/userBehavior/parameters/parameter",
|
||||
"required": true,
|
||||
"type": "array" ,
|
||||
"items": [
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/pages/page/batches/batch/0/behaviors/userBehavior/parameters/parameter/0",
|
||||
"required": true,
|
||||
"type": "object" ,
|
||||
"properties": {
|
||||
"key" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/pages/page/batches/batch/0/behaviors/userBehavior/parameters/parameter/0/key",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
"value" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/pages/page/batches/batch/0/behaviors/userBehavior/parameters/parameter/0/value",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"use" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/pages/page/batches/batch/0/behaviors/userBehavior/use",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"timerBehavior" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/pages/page/batches/batch/0/behaviors/timerBehavior",
|
||||
|
||||
"type": "object" ,
|
||||
"optional":true,
|
||||
"properties": {
|
||||
"id" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/pages/page/batches/batch/0/behaviors/timerBehavior/id",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
|
||||
},
|
||||
"name" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/pages/page/batches/batch/0/behaviors/timerBehavior/name",
|
||||
"required": true,
|
||||
"type": "string" ,
|
||||
"enum":["Get","Post","Put","Delete","Sleep","Log","Command"]
|
||||
},
|
||||
"parameters" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/pages/page/batches/batch/0/behaviors/timerBehavior/parameters",
|
||||
"required": true,
|
||||
"type": "object" ,
|
||||
"properties": {
|
||||
"parameter" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/pages/page/batches/batch/0/behaviors/timerBehavior/parameters/parameter",
|
||||
"required": true,
|
||||
"type": "object" ,
|
||||
"properties": {
|
||||
"key" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/pages/page/batches/batch/0/behaviors/timerBehavior/parameters/parameter/key",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
"value" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/pages/page/batches/batch/0/behaviors/timerBehavior/parameters/parameter/value",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
"use" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/pages/page/batches/batch/0/behaviors/timerBehavior/use",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"childId" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/pages/page/batches/batch/0/childId",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
"id" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/pages/page/batches/batch/0/id",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
|
||||
},
|
||||
"parentId" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/pages/page/batches/batch/0/parentId",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"poolSize" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/poolSize",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
|
||||
},
|
||||
"usePlugins" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/usePlugins",
|
||||
"required": true,
|
||||
"type": "object" ,
|
||||
"properties": {
|
||||
"usePlugin" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/usePlugins/usePlugin",
|
||||
"required": true,
|
||||
"type": "array" ,
|
||||
"items":
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/usePlugins/usePlugin/0",
|
||||
"required": true,
|
||||
"type": "object" ,
|
||||
"properties": {
|
||||
"id" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/usePlugins/usePlugin/0/id",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
"name" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/usePlugins/usePlugin/0/name",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"enum":["Http","ConstantTimer","Log","CommandLine"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-03/schema",
|
||||
"id": "http://jsonschema.net",
|
||||
"required": true,
|
||||
"type": "object" ,
|
||||
"properties": {
|
||||
"runScenario" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario",
|
||||
"required": true,
|
||||
"type": "object" ,
|
||||
"properties": {
|
||||
"pages":
|
||||
{
|
||||
"id":"http://jsonschema.net/runScenario/pages",
|
||||
"required":true,
|
||||
"type":"object",
|
||||
"properties":{
|
||||
"page":
|
||||
{
|
||||
"id":"http://jsonschema.net/runScenario/pages/page",
|
||||
"required":true,
|
||||
"type":"object",
|
||||
"properties":
|
||||
{
|
||||
"batches" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/pages/page/batches",
|
||||
"required": true,
|
||||
"type": "object" ,
|
||||
"properties": {
|
||||
"batch" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/pages/page/batches/batch",
|
||||
"required": true,
|
||||
"type": "array" ,
|
||||
"items":
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/pages/page/batches/batch/0",
|
||||
"required": true,
|
||||
"type": "object" ,
|
||||
"properties": {
|
||||
"behaviors" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/pages/page/batches/batch/0/behaviors",
|
||||
"required": true,
|
||||
"type": "object" ,
|
||||
"properties": {
|
||||
"userBehavior" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/pages/page/batches/batch/0/behaviors/userBehavior",
|
||||
|
||||
"type": "object" ,
|
||||
"optional":true,
|
||||
"properties": {
|
||||
"id" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/pages/page/batches/batch/0/behaviors/userBehavior/id",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
|
||||
},
|
||||
"name" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/pages/page/batches/batch/0/behaviors/userBehavior/name",
|
||||
"required": true,
|
||||
"type": "string" ,
|
||||
"enum":["Get","Post","Put","Delete","Sleep","Log","Command"]
|
||||
},
|
||||
"parameters" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/pages/page/batches/batch/0/behaviors/userBehavior/parameters",
|
||||
"required": true,
|
||||
"type": "object" ,
|
||||
"properties": {
|
||||
"parameter" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/pages/page/batches/batch/0/behaviors/userBehavior/parameters/parameter",
|
||||
"required": true,
|
||||
"type": "array" ,
|
||||
"items": [
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/pages/page/batches/batch/0/behaviors/userBehavior/parameters/parameter/0",
|
||||
"required": true,
|
||||
"type": "object" ,
|
||||
"properties": {
|
||||
"key" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/pages/page/batches/batch/0/behaviors/userBehavior/parameters/parameter/0/key",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
"value" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/pages/page/batches/batch/0/behaviors/userBehavior/parameters/parameter/0/value",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"use" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/pages/page/batches/batch/0/behaviors/userBehavior/use",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"timerBehavior" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/pages/page/batches/batch/0/behaviors/timerBehavior",
|
||||
|
||||
"type": "object" ,
|
||||
"optional":true,
|
||||
"properties": {
|
||||
"id" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/pages/page/batches/batch/0/behaviors/timerBehavior/id",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
|
||||
},
|
||||
"name" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/pages/page/batches/batch/0/behaviors/timerBehavior/name",
|
||||
"required": true,
|
||||
"type": "string" ,
|
||||
"enum":["Get","Post","Put","Delete","Sleep","Log","Command"]
|
||||
},
|
||||
"parameters" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/pages/page/batches/batch/0/behaviors/timerBehavior/parameters",
|
||||
"required": true,
|
||||
"type": "object" ,
|
||||
"properties": {
|
||||
"parameter" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/pages/page/batches/batch/0/behaviors/timerBehavior/parameters/parameter",
|
||||
"required": true,
|
||||
"type": "object" ,
|
||||
"properties": {
|
||||
"key" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/pages/page/batches/batch/0/behaviors/timerBehavior/parameters/parameter/key",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
"value" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/pages/page/batches/batch/0/behaviors/timerBehavior/parameters/parameter/value",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
"use" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/pages/page/batches/batch/0/behaviors/timerBehavior/use",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"childId" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/pages/page/batches/batch/0/childId",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
"id" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/pages/page/batches/batch/0/id",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
|
||||
},
|
||||
"parentId" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/pages/page/batches/batch/0/parentId",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"poolSize" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/poolSize",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
|
||||
},
|
||||
"usePlugins" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/usePlugins",
|
||||
"required": true,
|
||||
"type": "object" ,
|
||||
"properties": {
|
||||
"usePlugin" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/usePlugins/usePlugin",
|
||||
"required": true,
|
||||
"type": "array" ,
|
||||
"items":
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/usePlugins/usePlugin/0",
|
||||
"required": true,
|
||||
"type": "object" ,
|
||||
"properties": {
|
||||
"id" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/usePlugins/usePlugin/0/id",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
"name" :
|
||||
{
|
||||
"id": "http://jsonschema.net/runScenario/usePlugins/usePlugin/0/name",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"enum":["Http","ConstantTimer","Log","CommandLine"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,126 +1,126 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
elementFormDefault="qualified">
|
||||
|
||||
<xsd:group name="usertimer">
|
||||
<xsd:sequence>
|
||||
<xsd:element name='userbehavior' minOccurs='0'>
|
||||
<xsd:complexType>
|
||||
<xsd:all>
|
||||
<xsd:element name='name' type='xsd:string' />
|
||||
<xsd:element name='parameters'>
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name='parameter' maxOccurs="unbounded">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name='key' type='xsd:string' />
|
||||
<xsd:element name='value' minOccurs='0' />
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name='use' type='xsd:string' />
|
||||
<xsd:element name='id' >
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:integer">
|
||||
<xsd:minInclusive value="0" />
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:element>
|
||||
</xsd:all>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name='timerbehavior' minOccurs='0'>
|
||||
<xsd:complexType>
|
||||
<xsd:all>
|
||||
<xsd:element name='id'>
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:integer">
|
||||
<xsd:minInclusive value="0" />
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:element>
|
||||
<xsd:element name='name' type='xsd:string' />
|
||||
<xsd:element name='parameters'>
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name='parameter' maxOccurs="unbounded">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name='key' type='xsd:string' />
|
||||
<xsd:element name='value' type='xsd:positiveInteger' />
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name='use' type='xsd:string' />
|
||||
</xsd:all>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:group>
|
||||
|
||||
<xsd:element name="runscenario">
|
||||
<xsd:complexType>
|
||||
<xsd:all>
|
||||
<xsd:element name='poolsize'>
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:integer">
|
||||
<xsd:minInclusive value="0" />
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:element>
|
||||
<xsd:element name='useplugins'>
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name='useplugin' maxOccurs="unbounded">
|
||||
<xsd:complexType>
|
||||
<xsd:all>
|
||||
<xsd:element name='id' type='xsd:string' />
|
||||
<xsd:element name='name'>
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:token">
|
||||
<xsd:enumeration value="CommandLine"/>
|
||||
<xsd:enumeration value="ConstantTimer"/>
|
||||
<xsd:enumeration value="Http"/>
|
||||
<xsd:enumeration value="Log"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:element>
|
||||
<xsd:element name='parameters'>
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name='parameter' minOccurs='0'
|
||||
maxOccurs="unbounded">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name='key' type='xsd:string' />
|
||||
<xsd:element name='value' minOccurs='0' />
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:all>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name='behaviors'>
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:group ref="usertimer" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:all>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
elementFormDefault="qualified">
|
||||
|
||||
<xsd:group name="usertimer">
|
||||
<xsd:sequence>
|
||||
<xsd:element name='userbehavior' minOccurs='0'>
|
||||
<xsd:complexType>
|
||||
<xsd:all>
|
||||
<xsd:element name='name' type='xsd:string' />
|
||||
<xsd:element name='parameters'>
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name='parameter' maxOccurs="unbounded">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name='key' type='xsd:string' />
|
||||
<xsd:element name='value' minOccurs='0' />
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name='use' type='xsd:string' />
|
||||
<xsd:element name='id' >
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:integer">
|
||||
<xsd:minInclusive value="0" />
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:element>
|
||||
</xsd:all>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name='timerbehavior' minOccurs='0'>
|
||||
<xsd:complexType>
|
||||
<xsd:all>
|
||||
<xsd:element name='id'>
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:integer">
|
||||
<xsd:minInclusive value="0" />
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:element>
|
||||
<xsd:element name='name' type='xsd:string' />
|
||||
<xsd:element name='parameters'>
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name='parameter' maxOccurs="unbounded">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name='key' type='xsd:string' />
|
||||
<xsd:element name='value' type='xsd:positiveInteger' />
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name='use' type='xsd:string' />
|
||||
</xsd:all>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:group>
|
||||
|
||||
<xsd:element name="runscenario">
|
||||
<xsd:complexType>
|
||||
<xsd:all>
|
||||
<xsd:element name='poolsize'>
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:integer">
|
||||
<xsd:minInclusive value="0" />
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:element>
|
||||
<xsd:element name='useplugins'>
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name='useplugin' maxOccurs="unbounded">
|
||||
<xsd:complexType>
|
||||
<xsd:all>
|
||||
<xsd:element name='id' type='xsd:string' />
|
||||
<xsd:element name='name'>
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:token">
|
||||
<xsd:enumeration value="CommandLine"/>
|
||||
<xsd:enumeration value="ConstantTimer"/>
|
||||
<xsd:enumeration value="Http"/>
|
||||
<xsd:enumeration value="Log"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:element>
|
||||
<xsd:element name='parameters'>
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name='parameter' minOccurs='0'
|
||||
maxOccurs="unbounded">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name='key' type='xsd:string' />
|
||||
<xsd:element name='value' minOccurs='0' />
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:all>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name='behaviors'>
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:group ref="usertimer" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:all>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
|
@ -1,37 +1,37 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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_3_0.xsd"
|
||||
version="3.0">
|
||||
<display-name>bench4qweb</display-name>
|
||||
<listener>
|
||||
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
|
||||
</listener>
|
||||
<filter>
|
||||
<filter-name>sessionFilter</filter-name>
|
||||
<filter-class>org.bench4q.web.security.SessionFilter</filter-class>
|
||||
</filter>
|
||||
<filter-mapping>
|
||||
<filter-name>sessionFilter</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
<servlet>
|
||||
<servlet-name>dispatcherServlet</servlet-name>
|
||||
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
|
||||
<init-param>
|
||||
<param-name>contextConfigLocation</param-name>
|
||||
<param-value>
|
||||
/WEB-INF/bench4qweb-servlet.xml
|
||||
</param-value>
|
||||
</init-param>
|
||||
<load-on-startup>1</load-on-startup>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>dispatcherServlet</servlet-name>
|
||||
<url-pattern>/</url-pattern>
|
||||
</servlet-mapping>
|
||||
<context-param>
|
||||
<param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
|
||||
<param-value>i18n</param-value>
|
||||
</context-param>
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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_3_0.xsd"
|
||||
version="3.0">
|
||||
<display-name>bench4qweb</display-name>
|
||||
<listener>
|
||||
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
|
||||
</listener>
|
||||
<filter>
|
||||
<filter-name>sessionFilter</filter-name>
|
||||
<filter-class>org.bench4q.web.security.SessionFilter</filter-class>
|
||||
</filter>
|
||||
<filter-mapping>
|
||||
<filter-name>sessionFilter</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
<servlet>
|
||||
<servlet-name>dispatcherServlet</servlet-name>
|
||||
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
|
||||
<init-param>
|
||||
<param-name>contextConfigLocation</param-name>
|
||||
<param-value>
|
||||
/WEB-INF/bench4qweb-servlet.xml
|
||||
</param-value>
|
||||
</init-param>
|
||||
<load-on-startup>1</load-on-startup>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>dispatcherServlet</servlet-name>
|
||||
<url-pattern>/</url-pattern>
|
||||
</servlet-mapping>
|
||||
<context-param>
|
||||
<param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
|
||||
<param-value>i18n</param-value>
|
||||
</context-param>
|
||||
|
||||
</web-app>
|
|
@ -1,148 +1,148 @@
|
|||
<!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"%>
|
||||
<title>Agent manage</title>
|
||||
<link id="bs-css" href="css/bootstrap-cerulean.css" rel="stylesheet">
|
||||
<link rel="shortcut icon" href="img/bench4q.png">
|
||||
<link href="css/bootstrap-responsive.css" rel="stylesheet">
|
||||
<link href="css/charisma-app.css" rel="stylesheet">
|
||||
<link href="css/jquery-ui-1.8.21.custom.css" rel="stylesheet">
|
||||
<link href='css/jquery.noty.css' rel='stylesheet'>
|
||||
<link href='css/noty_theme_default.css' rel='stylesheet'>
|
||||
<link href='css/opa-icons.css' rel='stylesheet'>
|
||||
</head>
|
||||
<!-- <body class="logged_out wider windows env-production"> -->
|
||||
<body>
|
||||
<fmt:bundle basename="i18n">
|
||||
<jsp:include page="publiccontrol/navigatebar.jsp"></jsp:include>
|
||||
<div class="container-fluid">
|
||||
<div class="row-fluid">
|
||||
<jsp:include page="publiccontrol/adminleftmenubar.jsp"></jsp:include>
|
||||
<div id="content" class="span10">
|
||||
<div>
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="#"><fmt:message key="home" /></a> <span
|
||||
class="divider">/</span></li>
|
||||
<li><a href="#"><fmt:message key="agentmanagement" /></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="row-fluid sortable">
|
||||
<div class="box span12 center">
|
||||
<div class="box-header well" data-original-title>
|
||||
<h2>
|
||||
<i><fmt:message key="agents" /></i>
|
||||
</h2>
|
||||
<div class="box-icon">
|
||||
<a class="btn btn-setting btn-round"><i
|
||||
class="icon-plus"></i></a>
|
||||
<a class="btn btn-round" id="agentList"><i
|
||||
class="icon-list"></i></a> <a
|
||||
class="btn btn-minimize btn-round"><i
|
||||
class="icon-chevron-up"></i></a> <a
|
||||
class="btn btn-close btn-round"><i class="icon-remove"></i></a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-content">
|
||||
<table id="agents"
|
||||
class="table table-striped table-bordered bootstrap-datatable datatable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><fmt:message key="hostname" /></th>
|
||||
<th>ID</th>
|
||||
<th><fmt:message key="port" /></th>
|
||||
<th><fmt:message key="status" /></th>
|
||||
<th><fmt:message key="maxload" /></th>
|
||||
<th><fmt:message key="remainload" /></th>
|
||||
<th><fmt:message key="actions" /></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="modal hide fade" id="agentParam">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">x</button>
|
||||
<h3>
|
||||
<fmt:message key="settings" />
|
||||
</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form class="form-horizontal">
|
||||
<fieldset>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="focusedInput">HostName</label>
|
||||
<div class="controls">
|
||||
<input class="input-xlarge focused" id="hostName" type="text"
|
||||
value="">
|
||||
<div id='hostName_error' style='display: none; color: red'>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="focusedInput">Port</label>
|
||||
<div class="controls">
|
||||
<input class="input-xlarge focused" id="port" type="text"
|
||||
value="">
|
||||
<div id='port_error' style='display: none; color: red'></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="focusedInput">MaxLoad</label>
|
||||
<div class="controls">
|
||||
<input class="input-xlarge focused" id="maxLoad" type="text"
|
||||
value="">
|
||||
<div id='maxLoad_error' style='display: none; color: red'></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="focusedInput">RemainLoad</label>
|
||||
<div class="controls">
|
||||
<input class="input-xlarge focused" id="remainLoad" type="text"
|
||||
value="">
|
||||
<div id='remainLoad_error' style='display: none; color: red'>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-primary" data-dismiss="modal"
|
||||
onClick="addAgentToDB()">
|
||||
<fmt:message key="submit" />
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary" data-dismiss="modal">
|
||||
<fmt:message key="cancel" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<jsp:include page="publiccontrol/footer.jsp"></jsp:include>
|
||||
|
||||
</div>
|
||||
<script src="js/jquery-1.8.2.min.js"></script>
|
||||
<script src="js/jquery-ui-1.8.21.custom.min.js"></script>
|
||||
<script src='js/jquery.dataTables.min.js'></script>
|
||||
<script src="js/bootstrap-modal.js"></script>
|
||||
<script src="js/bootstrap-dropdown.js"></script>
|
||||
<script src="js/bootstrap-modal.js"></script>
|
||||
<script src="js/jquery.cookie.js"></script>
|
||||
<script src="js/theme.js"></script>
|
||||
<script src="js/jquery.i18n.properties-1.0.9.js"></script>
|
||||
<script src="script/base.js"></script>
|
||||
<script src="script/bench4q.table.js"></script>
|
||||
<script src="script/agentManage.js"></script>
|
||||
</fmt:bundle>
|
||||
</body>
|
||||
</html>
|
||||
<!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"%>
|
||||
<title>Agent manage</title>
|
||||
<link id="bs-css" href="css/bootstrap-cerulean.css" rel="stylesheet">
|
||||
<link rel="shortcut icon" href="img/bench4q.png">
|
||||
<link href="css/bootstrap-responsive.css" rel="stylesheet">
|
||||
<link href="css/charisma-app.css" rel="stylesheet">
|
||||
<link href="css/jquery-ui-1.8.21.custom.css" rel="stylesheet">
|
||||
<link href='css/jquery.noty.css' rel='stylesheet'>
|
||||
<link href='css/noty_theme_default.css' rel='stylesheet'>
|
||||
<link href='css/opa-icons.css' rel='stylesheet'>
|
||||
</head>
|
||||
<!-- <body class="logged_out wider windows env-production"> -->
|
||||
<body>
|
||||
<fmt:bundle basename="i18n">
|
||||
<jsp:include page="publiccontrol/navigatebar.jsp"></jsp:include>
|
||||
<div class="container-fluid">
|
||||
<div class="row-fluid">
|
||||
<jsp:include page="publiccontrol/adminleftmenubar.jsp"></jsp:include>
|
||||
<div id="content" class="span10">
|
||||
<div>
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="#"><fmt:message key="home" /></a> <span
|
||||
class="divider">/</span></li>
|
||||
<li><a href="#"><fmt:message key="agentmanagement" /></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="row-fluid sortable">
|
||||
<div class="box span12 center">
|
||||
<div class="box-header well" data-original-title>
|
||||
<h2>
|
||||
<i><fmt:message key="agents" /></i>
|
||||
</h2>
|
||||
<div class="box-icon">
|
||||
<a class="btn btn-setting btn-round"><i
|
||||
class="icon-plus"></i></a>
|
||||
<a class="btn btn-round" id="agentList"><i
|
||||
class="icon-list"></i></a> <a
|
||||
class="btn btn-minimize btn-round"><i
|
||||
class="icon-chevron-up"></i></a> <a
|
||||
class="btn btn-close btn-round"><i class="icon-remove"></i></a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-content">
|
||||
<table id="agents"
|
||||
class="table table-striped table-bordered bootstrap-datatable datatable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><fmt:message key="hostname" /></th>
|
||||
<th>ID</th>
|
||||
<th><fmt:message key="port" /></th>
|
||||
<th><fmt:message key="status" /></th>
|
||||
<th><fmt:message key="maxload" /></th>
|
||||
<th><fmt:message key="remainload" /></th>
|
||||
<th><fmt:message key="actions" /></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="modal hide fade" id="agentParam">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">x</button>
|
||||
<h3>
|
||||
<fmt:message key="settings" />
|
||||
</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form class="form-horizontal">
|
||||
<fieldset>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="focusedInput">HostName</label>
|
||||
<div class="controls">
|
||||
<input class="input-xlarge focused" id="hostName" type="text"
|
||||
value="">
|
||||
<div id='hostName_error' style='display: none; color: red'>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="focusedInput">Port</label>
|
||||
<div class="controls">
|
||||
<input class="input-xlarge focused" id="port" type="text"
|
||||
value="">
|
||||
<div id='port_error' style='display: none; color: red'></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="focusedInput">MaxLoad</label>
|
||||
<div class="controls">
|
||||
<input class="input-xlarge focused" id="maxLoad" type="text"
|
||||
value="">
|
||||
<div id='maxLoad_error' style='display: none; color: red'></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="focusedInput">RemainLoad</label>
|
||||
<div class="controls">
|
||||
<input class="input-xlarge focused" id="remainLoad" type="text"
|
||||
value="">
|
||||
<div id='remainLoad_error' style='display: none; color: red'>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-primary" data-dismiss="modal"
|
||||
onClick="addAgentToDB()">
|
||||
<fmt:message key="submit" />
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary" data-dismiss="modal">
|
||||
<fmt:message key="cancel" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<jsp:include page="publiccontrol/footer.jsp"></jsp:include>
|
||||
|
||||
</div>
|
||||
<script src="js/jquery-1.8.2.min.js"></script>
|
||||
<script src="js/jquery-ui-1.8.21.custom.min.js"></script>
|
||||
<script src='js/jquery.dataTables.min.js'></script>
|
||||
<script src="js/bootstrap-modal.js"></script>
|
||||
<script src="js/bootstrap-dropdown.js"></script>
|
||||
<script src="js/bootstrap-modal.js"></script>
|
||||
<script src="js/jquery.cookie.js"></script>
|
||||
<script src="js/theme.js"></script>
|
||||
<script src="js/jquery.i18n.properties-1.0.9.js"></script>
|
||||
<script src="script/base.js"></script>
|
||||
<script src="script/bench4q.table.js"></script>
|
||||
<script src="script/agentManage.js"></script>
|
||||
</fmt:bundle>
|
||||
</body>
|
||||
</html>
|
|
@ -1,88 +1,88 @@
|
|||
|
||||
.table-body {
|
||||
overflow-y: auto;
|
||||
max-height: 400px;
|
||||
padding: 15px;
|
||||
}
|
||||
.marginButton{
|
||||
margin-left:10px;
|
||||
margin-right:10px;
|
||||
}
|
||||
.div-distance{
|
||||
margin-top:30px;
|
||||
}
|
||||
.nextButton{
|
||||
margin-top:20px;
|
||||
margin-left:auto;
|
||||
margin-right:auto;
|
||||
width:100px;
|
||||
}
|
||||
|
||||
.hide{
|
||||
display:none;
|
||||
}
|
||||
.right{
|
||||
font-size:13px;
|
||||
|
||||
}
|
||||
.ip-div{
|
||||
margin-top:10px;
|
||||
margin-bottom:10px;
|
||||
margin-left:auto;
|
||||
margin-right:auto;
|
||||
width:300px;
|
||||
|
||||
}
|
||||
.ip-lable{
|
||||
padding-right:5px;
|
||||
}
|
||||
|
||||
.div-left{
|
||||
float:left;
|
||||
|
||||
}
|
||||
|
||||
.div-right{
|
||||
float:right;
|
||||
|
||||
}
|
||||
.nameInput{
|
||||
margin-top : 30px;
|
||||
margin-left:200px;
|
||||
}
|
||||
.message-left{
|
||||
font-size:20px;
|
||||
text-align:center;
|
||||
width:32%;
|
||||
height:168px;
|
||||
float:left;
|
||||
|
||||
}
|
||||
.message-right{
|
||||
padding-left: 8px;
|
||||
padding-top:8px;
|
||||
text-align:left;
|
||||
float: right;
|
||||
width: 65%;
|
||||
height:160px;
|
||||
font-size:13px;
|
||||
|
||||
|
||||
}
|
||||
.xmlName_background{
|
||||
|
||||
|
||||
font-size:15px;
|
||||
border:medium double black;
|
||||
|
||||
}
|
||||
.text-left{
|
||||
text-align:left;
|
||||
}
|
||||
.text-right{
|
||||
text-align:right;
|
||||
}
|
||||
.frameBodyNav {height:46px;-moz-box-shadow:rgba(0,0,0,.3) 0 .3em .5em;-webkit-box-shadow:rgba(0,0,0,.3) 0 .3em .5em;
|
||||
box-shadow:rgba(0,0,0,.3) 0 .3em .5em;-moz-border-top-left-radius: 8px;
|
||||
-webkit-border-top-left-radius: 8px;-khtml-border-top-left-radius: 8px;-o-border-top-left-radius: 8px;border-top-left-radius: 8px;-moz-border-top-right-radius: 8px;-webkit-border-top-right-radius: 8px;-khtml-border-top-right-radius: 8px;-o-border-top-right-radius: 8px;
|
||||
border-top-right-radius: 8px;background:#f2f2f2;border-top:.1em solid #fff;}
|
||||
|
||||
.table-body {
|
||||
overflow-y: auto;
|
||||
max-height: 400px;
|
||||
padding: 15px;
|
||||
}
|
||||
.marginButton{
|
||||
margin-left:10px;
|
||||
margin-right:10px;
|
||||
}
|
||||
.div-distance{
|
||||
margin-top:30px;
|
||||
}
|
||||
.nextButton{
|
||||
margin-top:20px;
|
||||
margin-left:auto;
|
||||
margin-right:auto;
|
||||
width:100px;
|
||||
}
|
||||
|
||||
.hide{
|
||||
display:none;
|
||||
}
|
||||
.right{
|
||||
font-size:13px;
|
||||
|
||||
}
|
||||
.ip-div{
|
||||
margin-top:10px;
|
||||
margin-bottom:10px;
|
||||
margin-left:auto;
|
||||
margin-right:auto;
|
||||
width:300px;
|
||||
|
||||
}
|
||||
.ip-lable{
|
||||
padding-right:5px;
|
||||
}
|
||||
|
||||
.div-left{
|
||||
float:left;
|
||||
|
||||
}
|
||||
|
||||
.div-right{
|
||||
float:right;
|
||||
|
||||
}
|
||||
.nameInput{
|
||||
margin-top : 30px;
|
||||
margin-left:200px;
|
||||
}
|
||||
.message-left{
|
||||
font-size:20px;
|
||||
text-align:center;
|
||||
width:32%;
|
||||
height:168px;
|
||||
float:left;
|
||||
|
||||
}
|
||||
.message-right{
|
||||
padding-left: 8px;
|
||||
padding-top:8px;
|
||||
text-align:left;
|
||||
float: right;
|
||||
width: 65%;
|
||||
height:160px;
|
||||
font-size:13px;
|
||||
|
||||
|
||||
}
|
||||
.xmlName_background{
|
||||
|
||||
|
||||
font-size:15px;
|
||||
border:medium double black;
|
||||
|
||||
}
|
||||
.text-left{
|
||||
text-align:left;
|
||||
}
|
||||
.text-right{
|
||||
text-align:right;
|
||||
}
|
||||
.frameBodyNav {height:46px;-moz-box-shadow:rgba(0,0,0,.3) 0 .3em .5em;-webkit-box-shadow:rgba(0,0,0,.3) 0 .3em .5em;
|
||||
box-shadow:rgba(0,0,0,.3) 0 .3em .5em;-moz-border-top-left-radius: 8px;
|
||||
-webkit-border-top-left-radius: 8px;-khtml-border-top-left-radius: 8px;-o-border-top-left-radius: 8px;border-top-left-radius: 8px;-moz-border-top-right-radius: 8px;-webkit-border-top-right-radius: 8px;-khtml-border-top-right-radius: 8px;-o-border-top-right-radius: 8px;
|
||||
border-top-right-radius: 8px;background:#f2f2f2;border-top:.1em solid #fff;}
|
|
@ -1,15 +1,15 @@
|
|||
#loading{
|
||||
width:397px;
|
||||
height:49px;
|
||||
background:url(/images/bak.png) no-repeat;
|
||||
}
|
||||
#loading div{
|
||||
width:0px;
|
||||
height:48px;
|
||||
background:url(/images/pro.png) no-repeat;
|
||||
color:#fff;
|
||||
text-align:center;
|
||||
font-family:Tahoma;
|
||||
font-size:18px;
|
||||
line-height:48px;
|
||||
}
|
||||
#loading{
|
||||
width:397px;
|
||||
height:49px;
|
||||
background:url(/images/bak.png) no-repeat;
|
||||
}
|
||||
#loading div{
|
||||
width:0px;
|
||||
height:48px;
|
||||
background:url(/images/pro.png) no-repeat;
|
||||
color:#fff;
|
||||
text-align:center;
|
||||
font-family:Tahoma;
|
||||
font-size:18px;
|
||||
line-height:48px;
|
||||
}
|
|
@ -1,167 +1,167 @@
|
|||
#codeEditor {
|
||||
height: 450px;
|
||||
width: 95%;
|
||||
-moz-box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box
|
||||
}
|
||||
|
||||
#codeEditor {
|
||||
float: left;
|
||||
padding: 0px 0px 15px 15px
|
||||
}
|
||||
|
||||
#treeEditor {
|
||||
float: left;
|
||||
padding: 0px 15px 15px 0
|
||||
}
|
||||
|
||||
#splitter {
|
||||
text-align: center;
|
||||
float: left;
|
||||
height: 100%;
|
||||
padding: 15px;
|
||||
-moz-box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box
|
||||
}
|
||||
|
||||
#splitter #drag {
|
||||
font-size: 32px;
|
||||
color: #d3d3d3;
|
||||
border-radius: 3px;
|
||||
min-width: 24px;
|
||||
cursor: col-resize
|
||||
}
|
||||
|
||||
#splitter #drag.active,#splitter #drag:hover {
|
||||
color: gray;
|
||||
background-color: #f5f5f5
|
||||
}
|
||||
|
||||
button.convert {
|
||||
cursor: default;
|
||||
padding: 2px
|
||||
}
|
||||
|
||||
div.convert-right {
|
||||
background: url(../images/jsoneditor-icons.png) -0 -48px
|
||||
}
|
||||
|
||||
div.convert-left {
|
||||
background: url(../images/jsoneditor-icons.png) -24px -48px
|
||||
}
|
||||
|
||||
div.convert-left,div.convert-right {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
margin: 0
|
||||
}
|
||||
|
||||
#splitter #toTree {
|
||||
margin: 40px 0 0;
|
||||
}
|
||||
|
||||
#splitter #toCode {
|
||||
margin: 20px 0 0;
|
||||
}
|
||||
|
||||
#action {
|
||||
margin-top: 10px;
|
||||
margin-right: 100px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.api {
|
||||
height:30px;
|
||||
float:right;
|
||||
cursor: pointer;
|
||||
border-bottom: 1px solid #8CBA2E;
|
||||
}
|
||||
|
||||
.apiShow {
|
||||
height:300px;
|
||||
cursor: auto;
|
||||
display: none;
|
||||
background-color: #EDF1DE;
|
||||
width: 255px;
|
||||
margin: 0px;
|
||||
float: right;
|
||||
border-size: 1;
|
||||
position: absolute;
|
||||
overflow-x: hidden;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
#apiHeader1 #apiHeader2 #apiHeader3 {
|
||||
height:18px;
|
||||
align: right;
|
||||
}
|
||||
|
||||
#sidebar {
|
||||
height: 400px;
|
||||
}
|
||||
|
||||
#nav-tab {
|
||||
margin-right: -5px;
|
||||
margin-left: -5px;
|
||||
}
|
||||
|
||||
.line {
|
||||
size=2;
|
||||
color:#86B32E;
|
||||
align:right;
|
||||
width:255px;
|
||||
margin:0px;
|
||||
}
|
||||
|
||||
.imaginary-line {
|
||||
width: 255px;
|
||||
size: 2;
|
||||
color: #5151A2;
|
||||
border: 1px dashed #CCCCCC;
|
||||
margin-top:15px;
|
||||
margin-bottom:15px;
|
||||
}
|
||||
|
||||
.title{
|
||||
margin-bottom: 6px;
|
||||
margin-top: 4px;
|
||||
color: #E25500;
|
||||
text-shadow: 0px 1px 0px #FFF;
|
||||
display: inline-block;
|
||||
font-size: 14px;
|
||||
line-height: 1.4;
|
||||
}
|
||||
.title_style{
|
||||
margin-left:-5px;
|
||||
height:30px;
|
||||
width:260px;
|
||||
line-height:18px;
|
||||
border:1px solid #CCCCCC;
|
||||
background-color:#F5F5F5;
|
||||
text-align: center;
|
||||
color: #369BD7;
|
||||
}
|
||||
.arguments {
|
||||
display: block;
|
||||
border-bottom: 1px dashed #AAA;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
padding: 5px 0px 2px;
|
||||
}
|
||||
|
||||
.details {
|
||||
font: 13px Arial,Helvetica,sans-serif;
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0px;
|
||||
}
|
||||
|
||||
td {
|
||||
padding-right: 15px;
|
||||
padding-bottom: 5px;
|
||||
padding-top: 8px;
|
||||
font-weight: normal;
|
||||
vertical-align: top;
|
||||
text-align: left;
|
||||
}
|
||||
#codeEditor {
|
||||
height: 450px;
|
||||
width: 95%;
|
||||
-moz-box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box
|
||||
}
|
||||
|
||||
#codeEditor {
|
||||
float: left;
|
||||
padding: 0px 0px 15px 15px
|
||||
}
|
||||
|
||||
#treeEditor {
|
||||
float: left;
|
||||
padding: 0px 15px 15px 0
|
||||
}
|
||||
|
||||
#splitter {
|
||||
text-align: center;
|
||||
float: left;
|
||||
height: 100%;
|
||||
padding: 15px;
|
||||
-moz-box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box
|
||||
}
|
||||
|
||||
#splitter #drag {
|
||||
font-size: 32px;
|
||||
color: #d3d3d3;
|
||||
border-radius: 3px;
|
||||
min-width: 24px;
|
||||
cursor: col-resize
|
||||
}
|
||||
|
||||
#splitter #drag.active,#splitter #drag:hover {
|
||||
color: gray;
|
||||
background-color: #f5f5f5
|
||||
}
|
||||
|
||||
button.convert {
|
||||
cursor: default;
|
||||
padding: 2px
|
||||
}
|
||||
|
||||
div.convert-right {
|
||||
background: url(../images/jsoneditor-icons.png) -0 -48px
|
||||
}
|
||||
|
||||
div.convert-left {
|
||||
background: url(../images/jsoneditor-icons.png) -24px -48px
|
||||
}
|
||||
|
||||
div.convert-left,div.convert-right {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
margin: 0
|
||||
}
|
||||
|
||||
#splitter #toTree {
|
||||
margin: 40px 0 0;
|
||||
}
|
||||
|
||||
#splitter #toCode {
|
||||
margin: 20px 0 0;
|
||||
}
|
||||
|
||||
#action {
|
||||
margin-top: 10px;
|
||||
margin-right: 100px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.api {
|
||||
height:30px;
|
||||
float:right;
|
||||
cursor: pointer;
|
||||
border-bottom: 1px solid #8CBA2E;
|
||||
}
|
||||
|
||||
.apiShow {
|
||||
height:300px;
|
||||
cursor: auto;
|
||||
display: none;
|
||||
background-color: #EDF1DE;
|
||||
width: 255px;
|
||||
margin: 0px;
|
||||
float: right;
|
||||
border-size: 1;
|
||||
position: absolute;
|
||||
overflow-x: hidden;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
#apiHeader1 #apiHeader2 #apiHeader3 {
|
||||
height:18px;
|
||||
align: right;
|
||||
}
|
||||
|
||||
#sidebar {
|
||||
height: 400px;
|
||||
}
|
||||
|
||||
#nav-tab {
|
||||
margin-right: -5px;
|
||||
margin-left: -5px;
|
||||
}
|
||||
|
||||
.line {
|
||||
size=2;
|
||||
color:#86B32E;
|
||||
align:right;
|
||||
width:255px;
|
||||
margin:0px;
|
||||
}
|
||||
|
||||
.imaginary-line {
|
||||
width: 255px;
|
||||
size: 2;
|
||||
color: #5151A2;
|
||||
border: 1px dashed #CCCCCC;
|
||||
margin-top:15px;
|
||||
margin-bottom:15px;
|
||||
}
|
||||
|
||||
.title{
|
||||
margin-bottom: 6px;
|
||||
margin-top: 4px;
|
||||
color: #E25500;
|
||||
text-shadow: 0px 1px 0px #FFF;
|
||||
display: inline-block;
|
||||
font-size: 14px;
|
||||
line-height: 1.4;
|
||||
}
|
||||
.title_style{
|
||||
margin-left:-5px;
|
||||
height:30px;
|
||||
width:260px;
|
||||
line-height:18px;
|
||||
border:1px solid #CCCCCC;
|
||||
background-color:#F5F5F5;
|
||||
text-align: center;
|
||||
color: #369BD7;
|
||||
}
|
||||
.arguments {
|
||||
display: block;
|
||||
border-bottom: 1px dashed #AAA;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
padding: 5px 0px 2px;
|
||||
}
|
||||
|
||||
.details {
|
||||
font: 13px Arial,Helvetica,sans-serif;
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0px;
|
||||
}
|
||||
|
||||
td {
|
||||
padding-right: 15px;
|
||||
padding-bottom: 5px;
|
||||
padding-top: 8px;
|
||||
font-weight: normal;
|
||||
vertical-align: top;
|
||||
text-align: left;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,18 +1,18 @@
|
|||
.G-frameHead {background: #47a1ca url(images/topBannerBg.jpg) 0 0 repeat-x;height:46px;}
|
||||
.G-frameHead h1 {float:left;color:#fff;text-shadow:rgba(0, 0, 0,.25) 0 0 .1em;padding:0;width:150px;height:37px;overflow:hidden;font-size:2em;line-height:4.5em;font-family:Microsoft YaHei,sans-serif;font-weight:normal;}
|
||||
.G-frameHead h1 a {display:block;}
|
||||
.G-frameHead h1 a:link ,.G-frameHead h1 a:visited,.G-frameHead h1 a:hover,.G-frameHead h1 a:active {color:#fff;text-decoration:none;}
|
||||
.G-frameHead h1 img {vertical-align:top;}
|
||||
.G-frameHead .nav {top:-2px;margin:0;width:420px;height:40px;display: block;float: left;position: relative; left: 0;}
|
||||
.G-frameHead .nav a{display: block;float: none;padding: 12px 10px 12px;line-height: 15px;text-decoration: none;}
|
||||
.G-frameHead .nav ul {overflow:hidden;float:left}
|
||||
.G-frameHead .nav ul:after ,.G-frameHead .nav:after, .G-frameHead .G-innerHead .usertoolbar:after, .G-frameHead .G-innerHead .usertoolbar ul:after {content:"."; display:block; clear:both; visibility:hidden; height:0;}
|
||||
.G-frameHead .nav ul li{list-style:none; float:left;padding:0 12px 0 0;font-size:1.2em;color:#FFF;/*text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);*/text-decoration: none; line-height:20px;}
|
||||
.G-frameHead .nav ul .main { padding:0 1em;background:#307fa4;border-left:.1em solid #60a8ca;border-right:.1em solid #60a8ca;}
|
||||
.G-frameHead .nav a:hover{color:#fff;}
|
||||
.G-frameHead p {text-align:right;padding:0;margin:1em 0 0;color:#fff; font-size: 13px;font-weight: normal;line-height: 18px;margin-bottom: 9px;float:right;}
|
||||
.G-frameHead a {color: #FFF;/*text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);*/text-decoration: none;}
|
||||
.G-frameHead span {padding-left:10px;font-family:Microsoft YaHei,sans-serif;}
|
||||
.G-frameHead em {color:#fc0;}
|
||||
.G-frameHead input {}
|
||||
.G-frameHead {background: #47a1ca url(images/topBannerBg.jpg) 0 0 repeat-x;height:46px;}
|
||||
.G-frameHead h1 {float:left;color:#fff;text-shadow:rgba(0, 0, 0,.25) 0 0 .1em;padding:0;width:150px;height:37px;overflow:hidden;font-size:2em;line-height:4.5em;font-family:Microsoft YaHei,sans-serif;font-weight:normal;}
|
||||
.G-frameHead h1 a {display:block;}
|
||||
.G-frameHead h1 a:link ,.G-frameHead h1 a:visited,.G-frameHead h1 a:hover,.G-frameHead h1 a:active {color:#fff;text-decoration:none;}
|
||||
.G-frameHead h1 img {vertical-align:top;}
|
||||
.G-frameHead .nav {top:-2px;margin:0;width:420px;height:40px;display: block;float: left;position: relative; left: 0;}
|
||||
.G-frameHead .nav a{display: block;float: none;padding: 12px 10px 12px;line-height: 15px;text-decoration: none;}
|
||||
.G-frameHead .nav ul {overflow:hidden;float:left}
|
||||
.G-frameHead .nav ul:after ,.G-frameHead .nav:after, .G-frameHead .G-innerHead .usertoolbar:after, .G-frameHead .G-innerHead .usertoolbar ul:after {content:"."; display:block; clear:both; visibility:hidden; height:0;}
|
||||
.G-frameHead .nav ul li{list-style:none; float:left;padding:0 12px 0 0;font-size:1.2em;color:#FFF;/*text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);*/text-decoration: none; line-height:20px;}
|
||||
.G-frameHead .nav ul .main { padding:0 1em;background:#307fa4;border-left:.1em solid #60a8ca;border-right:.1em solid #60a8ca;}
|
||||
.G-frameHead .nav a:hover{color:#fff;}
|
||||
.G-frameHead p {text-align:right;padding:0;margin:1em 0 0;color:#fff; font-size: 13px;font-weight: normal;line-height: 18px;margin-bottom: 9px;float:right;}
|
||||
.G-frameHead a {color: #FFF;/*text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);*/text-decoration: none;}
|
||||
.G-frameHead span {padding-left:10px;font-family:Microsoft YaHei,sans-serif;}
|
||||
.G-frameHead em {color:#fc0;}
|
||||
.G-frameHead input {}
|
||||
.G-frameHead .G-innerHead {margin:0 auto;width:960px;}
|
|
@ -1,78 +1,78 @@
|
|||
|
||||
.inset{
|
||||
width:85% ;
|
||||
height:80%;
|
||||
align:center;
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
.scroll{
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color:#ECE9D8;
|
||||
}
|
||||
|
||||
|
||||
.behavior_box{
|
||||
border:1px inset;
|
||||
width:200px;
|
||||
height:300px;
|
||||
margin-right:0px;
|
||||
margin-left:0px;
|
||||
}
|
||||
|
||||
.sample_frame{
|
||||
margin-bottom:0px;
|
||||
border:#3689BB solid thin;
|
||||
}
|
||||
|
||||
.sample_sub_frame{
|
||||
border:#F0ECE0 solid thin;
|
||||
margin-top:5px;
|
||||
margin-bottom:5px;
|
||||
margin-left:10px;
|
||||
margin-right:10px;
|
||||
}
|
||||
|
||||
table, th, td,thead,tbody
|
||||
{
|
||||
border: 1px solid #FFE37E;
|
||||
width:40px;
|
||||
height:18px;
|
||||
|
||||
}
|
||||
|
||||
#pluginArea{
|
||||
width:280px;
|
||||
height:340px;
|
||||
border:solid #A0D0EC thin ;
|
||||
margin-bottom:15px;
|
||||
outline-style: outset;
|
||||
|
||||
}
|
||||
|
||||
#behaviorArea{
|
||||
width:280px;
|
||||
height:340px;
|
||||
border:solid #A0D0EC thin ;
|
||||
margin-bottom:15px;
|
||||
outline-style: inset;
|
||||
}
|
||||
|
||||
.behavior-box{
|
||||
width:180px;
|
||||
height:200px;
|
||||
border:solid thin #F0ECE0;
|
||||
margin-left:5px;
|
||||
outline-style:inset;
|
||||
}
|
||||
|
||||
.pluginChoosedList{
|
||||
border-bottom:1px solid #F0ECE0 ;
|
||||
color: #4E9BCB ;
|
||||
width:220px;
|
||||
height:32px;
|
||||
|
||||
.inset{
|
||||
width:85% ;
|
||||
height:80%;
|
||||
align:center;
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
.scroll{
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color:#ECE9D8;
|
||||
}
|
||||
|
||||
|
||||
.behavior_box{
|
||||
border:1px inset;
|
||||
width:200px;
|
||||
height:300px;
|
||||
margin-right:0px;
|
||||
margin-left:0px;
|
||||
}
|
||||
|
||||
.sample_frame{
|
||||
margin-bottom:0px;
|
||||
border:#3689BB solid thin;
|
||||
}
|
||||
|
||||
.sample_sub_frame{
|
||||
border:#F0ECE0 solid thin;
|
||||
margin-top:5px;
|
||||
margin-bottom:5px;
|
||||
margin-left:10px;
|
||||
margin-right:10px;
|
||||
}
|
||||
|
||||
table, th, td,thead,tbody
|
||||
{
|
||||
border: 1px solid #FFE37E;
|
||||
width:40px;
|
||||
height:18px;
|
||||
|
||||
}
|
||||
|
||||
#pluginArea{
|
||||
width:280px;
|
||||
height:340px;
|
||||
border:solid #A0D0EC thin ;
|
||||
margin-bottom:15px;
|
||||
outline-style: outset;
|
||||
|
||||
}
|
||||
|
||||
#behaviorArea{
|
||||
width:280px;
|
||||
height:340px;
|
||||
border:solid #A0D0EC thin ;
|
||||
margin-bottom:15px;
|
||||
outline-style: inset;
|
||||
}
|
||||
|
||||
.behavior-box{
|
||||
width:180px;
|
||||
height:200px;
|
||||
border:solid thin #F0ECE0;
|
||||
margin-left:5px;
|
||||
outline-style:inset;
|
||||
}
|
||||
|
||||
.pluginChoosedList{
|
||||
border-bottom:1px solid #F0ECE0 ;
|
||||
color: #4E9BCB ;
|
||||
width:220px;
|
||||
height:32px;
|
||||
}
|
|
@ -1,106 +1,106 @@
|
|||
|
||||
.app-container {
|
||||
padding:10px;
|
||||
margin-top:20px;
|
||||
margin-bottom:20px;
|
||||
background: linear-gradient(to bottom, #fcfcfc, #f3f3f3);
|
||||
border-top: 3px solid #ccc;
|
||||
border-bottom: 1px solid #ccc;
|
||||
clear:both;
|
||||
}
|
||||
|
||||
.field-inline{
|
||||
float: right;
|
||||
margin-left:15px;
|
||||
}
|
||||
#add-graph-form-wrapper, #del-graph-form-wrapper {
|
||||
background-color: #eee;
|
||||
-ms-filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fcfcfc', endColorstr='#eeeeee');
|
||||
background: -webkit-gradient(linear,left top,left bottom,from(#fcfcfc),to(#eee));
|
||||
background: -moz-linear-gradient(top,#fcfcfc,#eee);
|
||||
background: -o-linear-gradient(top,#fcfcfc,#eee);
|
||||
background: linear-gradient(to bottom,#fcfcfc,#eee);
|
||||
padding: 10px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 0 0 5px 5px;
|
||||
-moz-border-radius: 0 0 5px 5px;
|
||||
-moz-box-shadow: 0px 4px 12px #ddd;
|
||||
-webkit-box-shadow: 0px 4px 12px 0px #ddd;
|
||||
-o-box-shadow: 0px 4px 12px #ddd;
|
||||
box-shadow: 0px 4px 12px #ddd;
|
||||
|
||||
display: none;
|
||||
|
||||
right: 0;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
#add-graph-form-wrapper label, #del-graph-form-wrapper label {
|
||||
font-weight: bold;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.table-bordered thead:first-child tr:first-child th{
|
||||
border-top: 3px solid #369bd7;
|
||||
border-bottom:1px solid #eee;
|
||||
}
|
||||
.table th {
|
||||
|
||||
font-weight:300;
|
||||
background-color: #fff;
|
||||
}
|
||||
.detail-picture{
|
||||
width:16 ,
|
||||
height:16,
|
||||
}
|
||||
.span-brief{
|
||||
font-weight:400;
|
||||
padding:10px;
|
||||
text-align:center;
|
||||
border-right:1px dotted #ccc;
|
||||
}
|
||||
.span-brief-last{
|
||||
font-weight:500;
|
||||
padding:10px;
|
||||
text-align:center
|
||||
}
|
||||
|
||||
#test{
|
||||
margin-top:20px;
|
||||
margin-bottom:20px;
|
||||
background-color: #fff;
|
||||
border: 1px solid #ccc;
|
||||
border-bottom: 1px solid #ccc;
|
||||
border-top: 3px solid #ccc;
|
||||
}
|
||||
.innerTable{
|
||||
margin:0;
|
||||
padding:0;
|
||||
background-color: #fff;
|
||||
border: 1px solid #ccc;
|
||||
width:130%;
|
||||
|
||||
}
|
||||
.innerTable thead:first-child tr:first-child th{
|
||||
border-top: 1px solid #ccc;
|
||||
border-bottom:1px solid #ccc;
|
||||
}
|
||||
#loading{
|
||||
width:397px;
|
||||
height:49px;
|
||||
background:url(../images/bak.png) no-repeat;
|
||||
}
|
||||
#loading div{
|
||||
width:0px;
|
||||
height:48px;
|
||||
background:url(../images/pro.png) no-repeat;
|
||||
color:#fff;
|
||||
text-align:center;
|
||||
font-family:Tahoma;
|
||||
font-size:18px;
|
||||
line-height:48px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.app-container {
|
||||
padding:10px;
|
||||
margin-top:20px;
|
||||
margin-bottom:20px;
|
||||
background: linear-gradient(to bottom, #fcfcfc, #f3f3f3);
|
||||
border-top: 3px solid #ccc;
|
||||
border-bottom: 1px solid #ccc;
|
||||
clear:both;
|
||||
}
|
||||
|
||||
.field-inline{
|
||||
float: right;
|
||||
margin-left:15px;
|
||||
}
|
||||
#add-graph-form-wrapper, #del-graph-form-wrapper {
|
||||
background-color: #eee;
|
||||
-ms-filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fcfcfc', endColorstr='#eeeeee');
|
||||
background: -webkit-gradient(linear,left top,left bottom,from(#fcfcfc),to(#eee));
|
||||
background: -moz-linear-gradient(top,#fcfcfc,#eee);
|
||||
background: -o-linear-gradient(top,#fcfcfc,#eee);
|
||||
background: linear-gradient(to bottom,#fcfcfc,#eee);
|
||||
padding: 10px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 0 0 5px 5px;
|
||||
-moz-border-radius: 0 0 5px 5px;
|
||||
-moz-box-shadow: 0px 4px 12px #ddd;
|
||||
-webkit-box-shadow: 0px 4px 12px 0px #ddd;
|
||||
-o-box-shadow: 0px 4px 12px #ddd;
|
||||
box-shadow: 0px 4px 12px #ddd;
|
||||
|
||||
display: none;
|
||||
|
||||
right: 0;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
#add-graph-form-wrapper label, #del-graph-form-wrapper label {
|
||||
font-weight: bold;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.table-bordered thead:first-child tr:first-child th{
|
||||
border-top: 3px solid #369bd7;
|
||||
border-bottom:1px solid #eee;
|
||||
}
|
||||
.table th {
|
||||
|
||||
font-weight:300;
|
||||
background-color: #fff;
|
||||
}
|
||||
.detail-picture{
|
||||
width:16 ,
|
||||
height:16,
|
||||
}
|
||||
.span-brief{
|
||||
font-weight:400;
|
||||
padding:10px;
|
||||
text-align:center;
|
||||
border-right:1px dotted #ccc;
|
||||
}
|
||||
.span-brief-last{
|
||||
font-weight:500;
|
||||
padding:10px;
|
||||
text-align:center
|
||||
}
|
||||
|
||||
#test{
|
||||
margin-top:20px;
|
||||
margin-bottom:20px;
|
||||
background-color: #fff;
|
||||
border: 1px solid #ccc;
|
||||
border-bottom: 1px solid #ccc;
|
||||
border-top: 3px solid #ccc;
|
||||
}
|
||||
.innerTable{
|
||||
margin:0;
|
||||
padding:0;
|
||||
background-color: #fff;
|
||||
border: 1px solid #ccc;
|
||||
width:130%;
|
||||
|
||||
}
|
||||
.innerTable thead:first-child tr:first-child th{
|
||||
border-top: 1px solid #ccc;
|
||||
border-bottom:1px solid #ccc;
|
||||
}
|
||||
#loading{
|
||||
width:397px;
|
||||
height:49px;
|
||||
background:url(../images/bak.png) no-repeat;
|
||||
}
|
||||
#loading div{
|
||||
width:0px;
|
||||
height:48px;
|
||||
background:url(../images/pro.png) no-repeat;
|
||||
color:#fff;
|
||||
text-align:center;
|
||||
font-family:Tahoma;
|
||||
font-size:18px;
|
||||
line-height:48px;
|
||||
}
|
||||
|
||||
|
|
@ -1,116 +1,116 @@
|
|||
h3,h4,h5{
|
||||
color:#000;
|
||||
}
|
||||
|
||||
.test-name-frame{
|
||||
padding:15px;
|
||||
background-color:#f5f5f5;
|
||||
border-top-style:solid;
|
||||
border-top-color:#369bd7;
|
||||
margin-top:10px;
|
||||
}
|
||||
.test-name-title{
|
||||
margin-top:10px;
|
||||
}
|
||||
.hide{
|
||||
display:none;
|
||||
}
|
||||
.show{
|
||||
display:block;
|
||||
color:red;
|
||||
}
|
||||
.title-frame{
|
||||
margin-top:30px;
|
||||
}
|
||||
i{
|
||||
float:left;
|
||||
}
|
||||
.title{
|
||||
font-size:15px;
|
||||
margin-left:30px;
|
||||
}
|
||||
.content-frame{
|
||||
/* display:none;
|
||||
padding:15px; */
|
||||
background-color:#f5f5f5;
|
||||
border-top-style:solid;
|
||||
border-top-color:#dcdcdc;
|
||||
padding-left:10px;
|
||||
margin-bottom:20px;
|
||||
}
|
||||
.float-left{
|
||||
float:left;
|
||||
}
|
||||
.script-button{
|
||||
|
||||
height:75%;
|
||||
width:90%;
|
||||
padding:0;
|
||||
}
|
||||
.table-margin-top{
|
||||
margin-top:15px;
|
||||
/* margin-left:20px; */
|
||||
width:100%;
|
||||
|
||||
}
|
||||
|
||||
#userConfig{
|
||||
width:60%;
|
||||
}
|
||||
#userConfig td,th{
|
||||
text-align:left;
|
||||
}
|
||||
select{
|
||||
margin-bottom:0px;
|
||||
}
|
||||
#highchartsPlot{
|
||||
margin-top:10px;
|
||||
margin-bottom:10px;
|
||||
width:85%;
|
||||
|
||||
}
|
||||
.centre{
|
||||
margin:20px;
|
||||
margin-left:290px;
|
||||
}
|
||||
|
||||
.add-button{
|
||||
margin-top:20px;
|
||||
}
|
||||
|
||||
.total-right{
|
||||
color:green;
|
||||
}
|
||||
.total-false{
|
||||
color:red;
|
||||
font-size:20px;
|
||||
}
|
||||
.name-input{
|
||||
width:200px;
|
||||
}
|
||||
.name-input-alert{
|
||||
width:200px;
|
||||
border:red 2px solid;
|
||||
}
|
||||
.load-config-input{
|
||||
width:100px;
|
||||
}
|
||||
.load-config-input-alert{
|
||||
width:100px;
|
||||
|
||||
border:red 2px solid;
|
||||
}
|
||||
.allocation-input{
|
||||
width:100px;
|
||||
}
|
||||
.allocation-input-alert{
|
||||
width:100px;
|
||||
border:red 2px solid;
|
||||
}
|
||||
.ip-input{
|
||||
width:150px;
|
||||
}
|
||||
.ip-input-alert{
|
||||
width:150px;
|
||||
border:red 2px solid;
|
||||
h3,h4,h5{
|
||||
color:#000;
|
||||
}
|
||||
|
||||
.test-name-frame{
|
||||
padding:15px;
|
||||
background-color:#f5f5f5;
|
||||
border-top-style:solid;
|
||||
border-top-color:#369bd7;
|
||||
margin-top:10px;
|
||||
}
|
||||
.test-name-title{
|
||||
margin-top:10px;
|
||||
}
|
||||
.hide{
|
||||
display:none;
|
||||
}
|
||||
.show{
|
||||
display:block;
|
||||
color:red;
|
||||
}
|
||||
.title-frame{
|
||||
margin-top:30px;
|
||||
}
|
||||
i{
|
||||
float:left;
|
||||
}
|
||||
.title{
|
||||
font-size:15px;
|
||||
margin-left:30px;
|
||||
}
|
||||
.content-frame{
|
||||
/* display:none;
|
||||
padding:15px; */
|
||||
background-color:#f5f5f5;
|
||||
border-top-style:solid;
|
||||
border-top-color:#dcdcdc;
|
||||
padding-left:10px;
|
||||
margin-bottom:20px;
|
||||
}
|
||||
.float-left{
|
||||
float:left;
|
||||
}
|
||||
.script-button{
|
||||
|
||||
height:75%;
|
||||
width:90%;
|
||||
padding:0;
|
||||
}
|
||||
.table-margin-top{
|
||||
margin-top:15px;
|
||||
/* margin-left:20px; */
|
||||
width:100%;
|
||||
|
||||
}
|
||||
|
||||
#userConfig{
|
||||
width:60%;
|
||||
}
|
||||
#userConfig td,th{
|
||||
text-align:left;
|
||||
}
|
||||
select{
|
||||
margin-bottom:0px;
|
||||
}
|
||||
#highchartsPlot{
|
||||
margin-top:10px;
|
||||
margin-bottom:10px;
|
||||
width:85%;
|
||||
|
||||
}
|
||||
.centre{
|
||||
margin:20px;
|
||||
margin-left:290px;
|
||||
}
|
||||
|
||||
.add-button{
|
||||
margin-top:20px;
|
||||
}
|
||||
|
||||
.total-right{
|
||||
color:green;
|
||||
}
|
||||
.total-false{
|
||||
color:red;
|
||||
font-size:20px;
|
||||
}
|
||||
.name-input{
|
||||
width:200px;
|
||||
}
|
||||
.name-input-alert{
|
||||
width:200px;
|
||||
border:red 2px solid;
|
||||
}
|
||||
.load-config-input{
|
||||
width:100px;
|
||||
}
|
||||
.load-config-input-alert{
|
||||
width:100px;
|
||||
|
||||
border:red 2px solid;
|
||||
}
|
||||
.allocation-input{
|
||||
width:100px;
|
||||
}
|
||||
.allocation-input-alert{
|
||||
width:100px;
|
||||
border:red 2px solid;
|
||||
}
|
||||
.ip-input{
|
||||
width:150px;
|
||||
}
|
||||
.ip-input-alert{
|
||||
width:150px;
|
||||
border:red 2px solid;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue