refactor with the bench4q-share

This commit is contained in:
Tienan Chen 2013-11-28 18:28:20 +08:00
parent 0f363c990a
commit 42159df5e7
85 changed files with 129 additions and 2609 deletions

View File

@ -115,6 +115,11 @@
<version>2.2.2</version>
<type>maven-plugin</type>
</dependency>
<dependency>
<groupId>org.bench4q</groupId>
<artifactId>bench4q-share</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
<repositories>
<repository>

View File

@ -3,13 +3,13 @@ package org.bench4q.master.api;
import java.util.ArrayList;
import java.util.List;
import org.bench4q.master.api.model.AgentModel;
import org.bench4q.master.api.model.AgentResponseModel;
import org.bench4q.master.api.model.factory.BusinessModelMapFactory;
import org.bench4q.master.entity.db.Agent;
import org.bench4q.master.service.communication.AgentStateService;
import org.bench4q.master.service.db.AgentService;
import org.bench4q.master.service.db.UserService;
import org.bench4q.share.models.master.AgentModel;
import org.bench4q.share.models.master.AgentResponseModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestBody;

View File

@ -2,16 +2,16 @@ package org.bench4q.master.api;
import java.util.UUID;
import org.bench4q.master.api.model.MonitorLogicalDiskResponseModel;
import org.bench4q.master.api.model.MonitorMemoryResponseModel;
import org.bench4q.master.api.model.MonitorNetworkReponseModel;
import org.bench4q.master.api.model.MonitorProcessorResponseModel;
import org.bench4q.master.api.model.monitor.LogicalDiskModel;
import org.bench4q.master.api.model.monitor.MemoryModel;
import org.bench4q.master.api.model.monitor.NetworkInterfaceModel;
import org.bench4q.master.api.model.monitor.ProcessorModel;
import org.bench4q.master.service.communication.MonitorService;
import org.bench4q.master.service.db.UserService;
import org.bench4q.share.models.master.MonitorLogicalDiskResponseModel;
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.LogicalDiskModel;
import org.bench4q.share.models.monitor.MemoryModel;
import org.bench4q.share.models.monitor.NetworkInterfaceModel;
import org.bench4q.share.models.monitor.ProcessorModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

View File

@ -3,12 +3,12 @@ package org.bench4q.master.api;
import java.util.ArrayList;
import java.util.List;
import org.bench4q.master.api.model.OrganizeRecordPortResponseModel;
import org.bench4q.master.api.model.PortModel;
import org.bench4q.master.api.model.factory.BusinessModelMapFactory;
import org.bench4q.master.entity.db.Port;
import org.bench4q.master.service.db.PortPoolService;
import org.bench4q.master.service.db.UserService;
import org.bench4q.share.models.master.OrganizeRecordPortResponseModel;
import org.bench4q.share.models.master.PortModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

View File

@ -10,8 +10,6 @@ import java.util.UUID;
import org.apache.commons.io.FileUtils;
import org.apache.log4j.Logger;
import org.bench4q.master.api.model.OperateScriptServerResponseModel;
import org.bench4q.master.api.model.ScriptModel;
import org.bench4q.master.api.model.factory.BusinessModelMapFactory;
import org.bench4q.master.entity.db.Port;
import org.bench4q.master.entity.db.Script;
@ -19,6 +17,8 @@ import org.bench4q.master.scriptrecord.ScriptCapturer;
import org.bench4q.master.service.db.PortPoolService;
import org.bench4q.master.service.db.ScriptService;
import org.bench4q.master.service.db.UserService;
import org.bench4q.share.models.master.OperateScriptServerResponseModel;
import org.bench4q.share.models.master.ScriptModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

View File

@ -11,14 +11,6 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.commons.io.FileUtils;
import org.apache.log4j.Logger;
import org.bench4q.master.api.model.MonitorModel;
import org.bench4q.master.api.model.RunningScriptModel;
import org.bench4q.master.api.model.ScriptBriefResultModel;
import org.bench4q.master.api.model.TestPlanDBModel;
import org.bench4q.master.api.model.TestPlanResponseModel;
import org.bench4q.master.api.model.TestPlanBusinessModel;
import org.bench4q.master.api.model.TestPlanResultModel;
import org.bench4q.master.api.model.error.ErrorResponseModel;
import org.bench4q.master.api.model.factory.BusinessModelMapFactory;
import org.bench4q.master.entity.db.TestPlanDB;
import org.bench4q.master.exception.Bench4QException;
@ -29,9 +21,17 @@ import org.bench4q.master.service.db.UserService;
import org.bench4q.master.testplan.TestPlanContainer;
import org.bench4q.master.testplan.TestPlanContext;
import org.bench4q.master.testplan.TestPlanEngine;
import org.bench4q.master.testplan.TestPlanStatus;
import org.bench4q.master.testplan.entity.MonitorInBusiness;
import org.bench4q.master.testplan.entity.RunningScript;
import org.bench4q.share.enums.master.TestPlanStatus;
import org.bench4q.share.models.ErrorResponseModel;
import org.bench4q.share.models.master.MonitorModel;
import org.bench4q.share.models.master.RunningScriptModel;
import org.bench4q.share.models.master.ScriptBriefResultModel;
import org.bench4q.share.models.master.TestPlanBusinessModel;
import org.bench4q.share.models.master.TestPlanDBModel;
import org.bench4q.share.models.master.TestPlanResponseModel;
import org.bench4q.share.models.master.TestPlanResultModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;

View File

@ -1,11 +1,11 @@
package org.bench4q.master.api;
import org.bench4q.master.api.model.AuthorizeResponseModel;
import org.bench4q.master.api.model.RegisterResponseModel;
import org.bench4q.master.auth.AccessToken;
import org.bench4q.master.auth.AuthenticationManager;
import org.bench4q.master.entity.db.User;
import org.bench4q.master.service.db.UserService;
import org.bench4q.share.models.master.AuthorizeResponseModel;
import org.bench4q.share.models.master.RegisterResponseModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

View File

@ -1,69 +0,0 @@
package org.bench4q.master.api.model;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "agent")
public class AgentModel {
private int id;
private String hostName;
private int port;
private int maxLoad;
private int remainLoad;
private int currentStatus;
@XmlElement
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
@XmlElement
public String getHostName() {
return hostName;
}
public void setHostName(String hostName) {
this.hostName = hostName;
}
@XmlElement
public int getPort() {
return port;
}
public void setPort(int port) {
this.port = port;
}
@XmlElement
public int getMaxLoad() {
return maxLoad;
}
public void setMaxLoad(int maxLoad) {
this.maxLoad = maxLoad;
}
@XmlElement
public int getRemainLoad() {
return remainLoad;
}
public void setRemainLoad(int remainLoad) {
this.remainLoad = remainLoad;
}
@XmlElement
public int getCurrentStatus() {
return currentStatus;
}
public void setCurrentStatus(int currentStatus) {
this.currentStatus = currentStatus;
}
}

View File

@ -1,48 +0,0 @@
package org.bench4q.master.api.model;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
/**
* When administrator add or delete a agent,This model will be response
*
* @author coderfengyun
*
*/
@XmlRootElement(name = "agentResponse")
public class AgentResponseModel {
private boolean isSuccess;
private String failCauseString;
private List<AgentModel> agents;
@XmlElement
public boolean isSuccess() {
return isSuccess;
}
public void setSuccess(boolean isSuccess) {
this.isSuccess = isSuccess;
}
@XmlElement
public String getFailCauseString() {
return failCauseString;
}
public void setFailCauseString(String failCauseString) {
this.failCauseString = failCauseString;
}
@XmlElementWrapper(name = "AgentList")
@XmlElement(name = "agent")
public List<AgentModel> getAgents() {
return agents;
}
public void setAgents(List<AgentModel> agents) {
this.agents = agents;
}
}

View File

@ -1,46 +0,0 @@
package org.bench4q.master.api.model;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
/**
* When user login, this model will be response
*
* @author coderfengyun
*
*/
@XmlRootElement(name = "authorizeResponse")
public class AuthorizeResponseModel {
private boolean success;
private String accessToken;
private int expiresIn;
@XmlElement
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
@XmlElement
public String getAccessToken() {
return accessToken;
}
public void setAccessToken(String accessToken) {
this.accessToken = accessToken;
}
@XmlElement
public int getExpiresIn() {
return expiresIn;
}
public void setExpiresIn(int expiresIn) {
this.expiresIn = expiresIn;
}
}

View File

@ -1,58 +0,0 @@
package org.bench4q.master.api.model;
import java.util.Date;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import org.bench4q.master.api.model.monitor.LogicalDiskModel;
/**
* When asked for logicalDisk, this model will be response
*
* @author coderfengyun
*
*/
@XmlRootElement(name = "MonitorLogicalDiskResponseModel")
public class MonitorLogicalDiskResponseModel {
private boolean success;
private String failCause;
private LogicalDiskModel logicalDiskModel;
private Date createDatetime;
@XmlElement(name = "success")
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
@XmlElement(name = "failCause")
public String getFailCause() {
return failCause;
}
public void setFailCause(String failCause) {
this.failCause = failCause;
}
@XmlElement
public LogicalDiskModel getLogicalDiskModel() {
return logicalDiskModel;
}
public void setLogicalDiskModel(LogicalDiskModel logicalDiskModel) {
this.logicalDiskModel = logicalDiskModel;
}
public Date getCreateDatetime() {
return createDatetime;
}
public void setCreateDatetime(Date createDatetime) {
this.createDatetime = createDatetime;
}
}

View File

@ -1,58 +0,0 @@
package org.bench4q.master.api.model;
import java.util.Date;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import org.bench4q.master.api.model.monitor.MemoryModel;
/**
* When asked for memory, this will be response
*
* @author coderfengyun
*
*/
@XmlRootElement(name = "MonitorMemoryResponseModel")
public class MonitorMemoryResponseModel {
private boolean success;
private String failCause;
private MemoryModel memoryModel;
private Date createDatetime;
@XmlElement
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
@XmlElement
public String getFailCause() {
return failCause;
}
public void setFailCause(String failCause) {
this.failCause = failCause;
}
@XmlElement
public MemoryModel getMemoryModel() {
return memoryModel;
}
public void setMemoryModel(MemoryModel memoryModel) {
this.memoryModel = memoryModel;
}
public Date getCreateDatetime() {
return createDatetime;
}
public void setCreateDatetime(Date createDatetime) {
this.createDatetime = createDatetime;
}
}

View File

@ -1,35 +0,0 @@
package org.bench4q.master.api.model;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
/**
* record the system that the test plan want to monitor
*
* @author coderfengyun
*
*/
@XmlRootElement
public class MonitorModel {
private String hostName;
private int port;
@XmlElement
public String getHostName() {
return hostName;
}
public void setHostName(String hostName) {
this.hostName = hostName;
}
@XmlElement
public int getPort() {
return port;
}
public void setPort(int port) {
this.port = port;
}
}

View File

@ -1,57 +0,0 @@
package org.bench4q.master.api.model;
import java.util.Date;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import org.bench4q.master.api.model.monitor.NetworkInterfaceModel;
/**
* When asked for network, this will be response
*
* @author coderfengyun
*
*/
@XmlRootElement
public class MonitorNetworkReponseModel {
private boolean success;
private String failCause;
private NetworkInterfaceModel model;
private Date createDatetime;
@XmlElement
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
@XmlElement
public String getFailCause() {
return failCause;
}
public void setFailCause(String failCause) {
this.failCause = failCause;
}
@XmlElement
public NetworkInterfaceModel getModel() {
return model;
}
public void setModel(NetworkInterfaceModel model) {
this.model = model;
}
public Date getCreateDatetime() {
return createDatetime;
}
public void setCreateDatetime(Date createDatetime) {
this.createDatetime = createDatetime;
}
}

View File

@ -1,58 +0,0 @@
package org.bench4q.master.api.model;
import java.util.Date;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import org.bench4q.master.api.model.monitor.ProcessorModel;
/**
* when asked for processor, this will be response
*
* @author coderfengyun
*
*/
@XmlRootElement
public class MonitorProcessorResponseModel {
private boolean success;
private String failCause;
private ProcessorModel processorModel;
private Date createDatetime;
@XmlElement
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
@XmlElement
public String getFailCause() {
return failCause;
}
public void setFailCause(String failCause) {
this.failCause = failCause;
}
@XmlElement
public ProcessorModel getProcessorModel() {
return processorModel;
}
public void setProcessorModel(ProcessorModel processorModel) {
this.processorModel = processorModel;
}
public Date getCreateDatetime() {
return createDatetime;
}
public void setCreateDatetime(Date createDatetime) {
this.createDatetime = createDatetime;
}
}

View File

@ -1,54 +0,0 @@
package org.bench4q.master.api.model;
import java.util.ArrayList;
import java.util.List;
public class MonitorResultContainerModel {
private List<MonitorLogicalDiskResponseModel> logicalDiskResponseModels;
private List<MonitorMemoryResponseModel> memoryResponseModels;
private List<MonitorProcessorResponseModel> processorResponseModels;
private List<MonitorNetworkReponseModel> netWorkReponseModels;
public List<MonitorLogicalDiskResponseModel> getLogicalDiskResponseModels() {
return logicalDiskResponseModels;
}
public void setLogicalDiskResponseModels(
List<MonitorLogicalDiskResponseModel> logicalDiskResponseModels) {
this.logicalDiskResponseModels = logicalDiskResponseModels;
}
public List<MonitorMemoryResponseModel> getMemoryResponseModels() {
return memoryResponseModels;
}
public void setMemoryResponseModels(
List<MonitorMemoryResponseModel> memoryResponseModels) {
this.memoryResponseModels = memoryResponseModels;
}
public List<MonitorProcessorResponseModel> getProcessorResponseModels() {
return processorResponseModels;
}
public void setProcessorResponseModels(
List<MonitorProcessorResponseModel> processorResponseModels) {
this.processorResponseModels = processorResponseModels;
}
public List<MonitorNetworkReponseModel> getNetWorkReponseModels() {
return netWorkReponseModels;
}
public void setNetWorkReponseModels(
List<MonitorNetworkReponseModel> netWorkReponseModels) {
this.netWorkReponseModels = netWorkReponseModels;
}
public MonitorResultContainerModel() {
this.setLogicalDiskResponseModels(new ArrayList<MonitorLogicalDiskResponseModel>());
this.setMemoryResponseModels(new ArrayList<MonitorMemoryResponseModel>());
this.setProcessorResponseModels(new ArrayList<MonitorProcessorResponseModel>());
this.setNetWorkReponseModels(new ArrayList<MonitorNetworkReponseModel>());
}
}

View File

@ -1,77 +0,0 @@
package org.bench4q.master.api.model;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
/**
* When recording a script, this will be response of start or stop
*
* @author coderfengyun
*
*/
@XmlRootElement(name = "OperateScriptServerResponse")
public class OperateScriptServerResponseModel {
private boolean success;
private String failCauseString;
private String hostNameString;
private int port;
private String fileName;
private List<ScriptModel> scriptModels;
@XmlElement
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
@XmlElement
public String getFailCauseString() {
return failCauseString;
}
public void setFailCauseString(String failCauseString) {
this.failCauseString = failCauseString;
}
@XmlElement
public String getHostNameString() {
return hostNameString;
}
public void setHostName(String hostNameString) {
this.hostNameString = hostNameString;
}
@XmlElement
public int getPort() {
return port;
}
public void setPort(int port) {
this.port = port;
}
@XmlElement
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
@XmlElement
public List<ScriptModel> getScriptModels() {
return scriptModels;
}
public void setScriptModels(List<ScriptModel> scriptModels) {
this.scriptModels = scriptModels;
}
}

View File

@ -1,48 +0,0 @@
package org.bench4q.master.api.model;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
/**
* When administrator add or delete a port in the pool, this will be response
*
* @author coderfengyun
*
*/
@XmlRootElement(name = "OperateScriptServerResponse")
public class OrganizeRecordPortResponseModel {
private boolean success;
private String failCauseString;
private List<PortModel> portModels;
@XmlElement
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
@XmlElement
public String getFailCauseString() {
return failCauseString;
}
public void setFailCauseString(String failCauseString) {
this.failCauseString = failCauseString;
}
@XmlElementWrapper(name = "portList")
@XmlElement(name = "port")
public List<PortModel> getPortModels() {
return portModels;
}
public void setPortModels(List<PortModel> portModels) {
this.portModels = portModels;
}
}

View File

@ -1,39 +0,0 @@
package org.bench4q.master.api.model;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "port")
public class PortModel {
private int id;
private int port;
private boolean inUse;
@XmlElement
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
@XmlElement
public int getPort() {
return port;
}
public void setPort(int port) {
this.port = port;
}
@XmlElement
public boolean isInUse() {
return inUse;
}
public void setInUse(boolean inUse) {
this.inUse = inUse;
}
}

View File

@ -1,25 +0,0 @@
package org.bench4q.master.api.model;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
/**
* When a user register, this will be response
*
* @author coderfengyun
*
*/
@XmlRootElement(name = "registerResponse")
public class RegisterResponseModel {
private boolean success;
@XmlElement
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
}

View File

@ -1,56 +0,0 @@
package org.bench4q.master.api.model;
import java.util.UUID;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
/**
* When asked for script brief, this will be response
*
* @author coderfengyun
*
*/
@XmlRootElement
public class RunningAgentModel {
private AgentModel agent;
private int loadInUse;
private int scriptId;
private UUID agentRunId;
@XmlElement
public AgentModel getAgent() {
return agent;
}
public void setAgent(AgentModel agent) {
this.agent = agent;
}
@XmlElement
public int getLoadInUse() {
return loadInUse;
}
public void setLoadInUse(int loadInUse) {
this.loadInUse = loadInUse;
}
@XmlElement
public int getScriptId() {
return scriptId;
}
public void setScriptId(int scriptId) {
this.scriptId = scriptId;
}
@XmlElement
public UUID getAgentRunId() {
return agentRunId;
}
public void setAgentRunId(UUID agentRunId) {
this.agentRunId = agentRunId;
}
}

View File

@ -1,73 +0,0 @@
package org.bench4q.master.api.model;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "runningScripModel")
public class RunningScriptModel {
private int scriptId;
private int requireLoad;
private TestScriptConfig config;
private boolean finished;
private List<RunningAgentModel> runningAgentModels = new ArrayList<RunningAgentModel>();
private UUID testPlanID;
@XmlElement
public int getScriptId() {
return scriptId;
}
public void setScriptId(int scriptId) {
this.scriptId = scriptId;
}
@XmlElement
public int getRequireLoad() {
return requireLoad;
}
public void setRequireLoad(int requireLoad) {
this.requireLoad = requireLoad;
}
@XmlElement
public TestScriptConfig getConfig() {
return config;
}
public void setConfig(TestScriptConfig config) {
this.config = config;
}
@XmlElement
public boolean isFinished() {
return finished;
}
public void setFinished(boolean finished) {
this.finished = finished;
}
@XmlElementWrapper(name = "runningAgentList")
@XmlElement
public List<RunningAgentModel> getRunningAgentModels() {
return runningAgentModels;
}
public void setRunningAgentModels(List<RunningAgentModel> runningAgentModels) {
this.runningAgentModels = runningAgentModels;
}
public UUID getTestPlanID() {
return testPlanID;
}
public void setTestPlanID(UUID testPlanID) {
this.testPlanID = testPlanID;
}
}

View File

@ -1,159 +0,0 @@
package org.bench4q.master.api.model;
import java.lang.reflect.Field;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class ScriptBriefResultModel {
private long totalSuccessCountFromBegin;
private long totalFailCountFromBegin;
private long averageResponseTime;
private long maxResponseTime;
private long minResponseTime;
private long successThroughputThisTime;
private long failThroughputThisTime;
private long responseTimeDeviationThisTime;
private long failRateThisTime;
private long averageElapsedTime;
private long planedRunningTime;
private boolean finished;
@XmlElement
public long getTotalSuccessCountFromBegin() {
return totalSuccessCountFromBegin;
}
public void setTotalSuccessCountFromBegin(long totalSuccessCountFromBegin) {
this.totalSuccessCountFromBegin = totalSuccessCountFromBegin;
}
@XmlElement
public long getTotalFailCountFromBegin() {
return totalFailCountFromBegin;
}
public void setTotalFailCountFromBegin(long totalFailCountFromBegin) {
this.totalFailCountFromBegin = totalFailCountFromBegin;
}
@XmlElement
public long getAverageResponseTime() {
return averageResponseTime;
}
public void setAverageResponseTime(long averageResponseTime) {
this.averageResponseTime = averageResponseTime;
}
@XmlElement
public long getMaxResponseTime() {
return maxResponseTime;
}
public void setMaxResponseTime(long maxResponseTime) {
this.maxResponseTime = maxResponseTime;
}
@XmlElement
public long getMinResponseTime() {
return minResponseTime;
}
public void setMinResponseTime(long minResponseTime) {
this.minResponseTime = minResponseTime;
}
@XmlElement
public long getSuccessThroughputThisTime() {
return successThroughputThisTime;
}
public void setSuccessThroughputThisTime(long successThroughputThisTime) {
this.successThroughputThisTime = successThroughputThisTime;
}
@XmlElement
public long getFailThroughputThisTime() {
return failThroughputThisTime;
}
public void setFailThroughputThisTime(long failThroughputThisTime) {
this.failThroughputThisTime = failThroughputThisTime;
}
@XmlElement
public long getResponseTimeDeviationThisTime() {
return responseTimeDeviationThisTime;
}
public void setResponseTimeDeviationThisTime(
long responseTimeDeviationThisTime) {
this.responseTimeDeviationThisTime = responseTimeDeviationThisTime;
}
@XmlElement
public long getFailRateThisTime() {
return failRateThisTime;
}
public void setFailRateThisTime(long failRateThisTime) {
this.failRateThisTime = failRateThisTime;
}
@XmlElement
public long getAverageElapsedTime() {
return averageElapsedTime;
}
public void setAverageElapsedTime(long averageElapsedTime) {
this.averageElapsedTime = averageElapsedTime;
}
@XmlElement
public long getPlanedRunningTime() {
return planedRunningTime;
}
public void setPlanedRunningTime(long planedRunningTime) {
this.planedRunningTime = planedRunningTime;
}
@XmlElement
public boolean isFinished() {
return finished;
}
public void setFinished(boolean finished) {
this.finished = finished;
}
@Override
public boolean equals(Object obj) {
if (!(obj instanceof ScriptBriefResultModel) || obj == null) {
return false;
}
boolean result = true;
Field[] fields = this.getClass().getDeclaredFields();
try {
for (Field field : fields) {
field.setAccessible(true);
if (field.getName() == "finished") {
continue;
}
if (field.getLong(this) != field.getLong(obj)) {
result = false;
System.out.println(field.getName() + "target :"
+ field.getLong(obj) + " , this "
+ field.getLong(this));
}
}
} catch (Exception e) {
e.printStackTrace();
result = false;
}
return result;
}
}

View File

@ -1,71 +0,0 @@
package org.bench4q.master.api.model;
import java.util.Date;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "script")
public class ScriptModel {
private int id;
private String name;
private String scriptContent;
private int behaviorCount;
private Date createDateTime;
private UserModel userModel;
@XmlElement
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
@XmlElement
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@XmlElement
public String getScriptContent() {
return scriptContent;
}
public void setScriptContent(String scriptContent) {
this.scriptContent = scriptContent;
}
@XmlElement
public int getBehaviorCount() {
return behaviorCount;
}
public void setBehaviorCount(int behaviorCount) {
this.behaviorCount = behaviorCount;
}
@XmlElement
public Date getCreateDateTime() {
return createDateTime;
}
public void setCreateDateTime(Date createDateTime) {
this.createDateTime = createDateTime;
}
@XmlElement
public UserModel getUserModel() {
return userModel;
}
public void setUserModel(UserModel userModel) {
this.userModel = userModel;
}
}

View File

@ -1,44 +0,0 @@
package org.bench4q.master.api.model;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "testPlanModel")
public class TestPlanBusinessModel {
private String name = "";
private List<RunningScriptModel> runningScriptModels;
private List<MonitorModel> monitorModels;
@XmlElement
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@XmlElementWrapper(name = "runningScriptModelList")
@XmlElement(name = "runningScriptModel")
public List<RunningScriptModel> getRunningScriptModels() {
return runningScriptModels;
}
public void setRunningScriptModels(
List<RunningScriptModel> runningScriptModels) {
this.runningScriptModels = runningScriptModels;
}
@XmlElementWrapper(name = "monitorModelList")
@XmlElement(name = "monitorModel")
public List<MonitorModel> getMonitorModels() {
return monitorModels;
}
public void setMonitorModels(List<MonitorModel> monitorModles) {
this.monitorModels = monitorModles;
}
}

View File

@ -1,101 +0,0 @@
package org.bench4q.master.api.model;
import java.util.Date;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "testplanDB")
public class TestPlanDBModel {
private int id;
private String name;
private Date createDateTime;
private UserModel userModel;
private String testPlanRunId;
private String testPlanModelContent;
private String currentStatus;
private int failTimes;
private boolean reportCreated;
@XmlElement
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
@XmlElement
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@XmlElement
public Date getCreateDateTime() {
return createDateTime;
}
public void setCreateDateTime(Date createDateTime) {
this.createDateTime = createDateTime;
}
@XmlElement
public UserModel getUserModel() {
return userModel;
}
public void setUserModel(UserModel userModel) {
this.userModel = userModel;
}
@XmlElement
public String getTestPlanRunId() {
return testPlanRunId;
}
public void setTestPlanRunId(String testPlanRunId) {
this.testPlanRunId = testPlanRunId;
}
@XmlElement
public String getTestPlanModelContent() {
return testPlanModelContent;
}
public void setTestPlanModelContent(String testPlanModelContent) {
this.testPlanModelContent = testPlanModelContent;
}
@XmlElement
public String getCurrentStatus() {
return currentStatus;
}
public void setCurrentStatus(String currentStatus) {
this.currentStatus = currentStatus;
}
@XmlElement
public int getFailTimes() {
return failTimes;
}
public void setFailTimes(int failTimes) {
this.failTimes = failTimes;
}
@XmlElement
public boolean isReportCreated() {
return reportCreated;
}
public void setReportCreated(boolean reportCreated) {
this.reportCreated = reportCreated;
}
}

View File

@ -1,43 +0,0 @@
package org.bench4q.master.api.model;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class TestPlanResponseModel {
private boolean success;
private String failCause;
private List<TestPlanDBModel> testPlanDBModels;
@XmlElement
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
@XmlElement
public String getFailCause() {
return failCause;
}
public void setFailCause(String failCause) {
this.failCause = failCause;
}
@XmlElementWrapper
@XmlElement
public List<TestPlanDBModel> getTestPlanDBModels() {
return testPlanDBModels;
}
public void setTestPlanDBModels(List<TestPlanDBModel> testPlanDBModels) {
this.testPlanDBModels = testPlanDBModels;
}
}

View File

@ -1,58 +0,0 @@
package org.bench4q.master.api.model;
import java.util.List;
import java.util.UUID;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import org.bench4q.master.testplan.TestPlanStatus;
@XmlRootElement(name = "RunTestPlanResultModel")
public class TestPlanResultModel {
private UUID testPlanId;
private TestPlanStatus currentStatus;
private List<RunningScriptModel> runningScriptModels;
private List<MonitorModel> monitorModels;
@XmlElement(name = "testPlanId")
public UUID getTestPlanId() {
return testPlanId;
}
public void setTestPlanId(UUID testPlanId) {
this.testPlanId = testPlanId;
}
@XmlElement(name = "currentStatus")
public TestPlanStatus getCurrentStatus() {
return currentStatus;
}
public void setCurrentStatus(TestPlanStatus currentStatus) {
this.currentStatus = currentStatus;
}
@XmlElementWrapper(name = "ScriptModelList")
@XmlElement(name = "RunningScriptModel")
public List<RunningScriptModel> getRunningScriptModels() {
return runningScriptModels;
}
public void setRunningScriptModels(
List<RunningScriptModel> runningScriptContextModels) {
this.runningScriptModels = runningScriptContextModels;
}
@XmlElementWrapper(name = "MonitorModelList")
@XmlElement(name = "MonitorModel")
public List<MonitorModel> getMonitorModels() {
return monitorModels;
}
public void setMonitorModels(List<MonitorModel> monitorModels) {
this.monitorModels = monitorModels;
}
}

View File

@ -1,39 +0,0 @@
package org.bench4q.master.api.model;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class TestScriptConfig {
private long warmUp;
private long executeRange;
private long coolDown;
@XmlElement
public long getWarmUp() {
return warmUp;
}
public void setWarmUp(long warmUp) {
this.warmUp = warmUp;
}
@XmlElement
public long getExecuteRange() {
return executeRange;
}
public void setExecuteRange(long executeRange) {
this.executeRange = executeRange;
}
@XmlElement
public long getCoolDown() {
return coolDown;
}
public void setCoolDown(long coolDown) {
this.coolDown = coolDown;
}
}

View File

@ -1,49 +0,0 @@
package org.bench4q.master.api.model;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "user")
public class UserModel {
private int id;
private String userName;
private String password;
private byte scope;
@XmlElement
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
@XmlElement
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
@XmlElement
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
@XmlElement
public byte getScope() {
return scope;
}
public void setScope(byte scope) {
this.scope = scope;
}
}

View File

@ -1,151 +0,0 @@
package org.bench4q.master.api.model.agent;
import java.lang.reflect.Field;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class AgentBriefStatusModel {
private long timeFrame;
private long minResponseTime;
private long maxResponseTime;
private long successCountFromBegin;
private long successThroughputThisTime;
private long failCountFromBegin;
private long failThroughputThisTime;
private long successCountThisTime;
private long failCountThisTime;
private long totalResponseTimeThisTime;
private long totalSqureResponseTimeThisTime;
@XmlElement
public long getTimeFrame() {
return timeFrame;
}
public void setTimeFrame(long timeFrame) {
this.timeFrame = timeFrame;
}
@XmlElement
public long getMinResponseTime() {
return minResponseTime;
}
public void setMinResponseTime(long minResponseTime) {
this.minResponseTime = minResponseTime;
}
@XmlElement
public long getMaxResponseTime() {
return maxResponseTime;
}
public void setMaxResponseTime(long maxResponseTime) {
this.maxResponseTime = maxResponseTime;
}
@XmlElement
public long getSuccessThroughputThisTime() {
return successThroughputThisTime;
}
public void setSuccessThroughputThisTime(long successThroughputThisTime) {
this.successThroughputThisTime = successThroughputThisTime;
}
@XmlElement
public long getSuccessCountFromBegin() {
return successCountFromBegin;
}
public void setSuccessCountFromBegin(long successCountFromBegin) {
this.successCountFromBegin = successCountFromBegin;
}
@XmlElement
public long getFailCountFromBegin() {
return failCountFromBegin;
}
public void setFailCountFromBegin(long failCountFromBegin) {
this.failCountFromBegin = failCountFromBegin;
}
@XmlElement
public long getFailThroughputThisTime() {
return failThroughputThisTime;
}
public void setFailThroughputThisTime(long failThroughputThisTime) {
this.failThroughputThisTime = failThroughputThisTime;
}
@XmlElement
public long getSuccessCountThisTime() {
return successCountThisTime;
}
public void setSuccessCountThisTime(long successCountThisTime) {
this.successCountThisTime = successCountThisTime;
}
@XmlElement
public long getFailCountThisTime() {
return failCountThisTime;
}
public void setFailCountThisTime(long failCountThisTime) {
this.failCountThisTime = failCountThisTime;
}
@XmlElement
public long getTotalResponseTimeThisTime() {
return totalResponseTimeThisTime;
}
public void setTotalResponseTimeThisTime(long totalResponseTimeThisTime) {
this.totalResponseTimeThisTime = totalResponseTimeThisTime;
}
@XmlElement
public long getTotalSqureResponseTimeThisTime() {
return totalSqureResponseTimeThisTime;
}
public void setTotalSqureResponseTimeThisTime(
long totalSqureResponseTimeThisTime) {
this.totalSqureResponseTimeThisTime = totalSqureResponseTimeThisTime;
}
// if the all the fields of target object equals with this's except
// timeFrame,
// We call it equals.
@Override
public boolean equals(Object targetObj) {
if (!(targetObj instanceof AgentBriefStatusModel) || targetObj == null) {
return false;
}
boolean result = true;
AgentBriefStatusModel convertedObject = (AgentBriefStatusModel) targetObj;
Field[] fs = this.getClass().getDeclaredFields();
try {
for (Field field : fs) {
field.setAccessible(true);
if (field.getLong(this) != field.getLong(convertedObject)) {
System.out.println(field.getName()
+ " not equals! and the target is "
+ field.getLong(convertedObject) + " and this is "
+ field.getLong(this));
result = false;
}
}
} catch (Exception e) {
e.printStackTrace();
result = false;
}
return result;
}
}

View File

@ -1,29 +0,0 @@
package org.bench4q.master.api.model.agent;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "parameter")
public class ParameterModel {
private String key;
private String value;
@XmlElement
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
@XmlElement
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}

View File

@ -1,50 +0,0 @@
package org.bench4q.master.api.model.agent;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlElements;
import javax.xml.bind.annotation.XmlRootElement;
import org.bench4q.master.api.model.agent.scriptrecord.TimerBehaviorModel;
import org.bench4q.master.api.model.agent.scriptrecord.UsePluginModel;
import org.bench4q.master.api.model.agent.scriptrecord.UserBehaviorModel;
@XmlRootElement(name = "runScenario")
public class RunScenarioModel {
private int poolSize;
private List<UsePluginModel> usePlugins;
private List<Object> behaviors;
@XmlElement
public int getPoolSize() {
return poolSize;
}
public void setPoolSize(int poolSize) {
this.poolSize = poolSize;
}
@XmlElementWrapper(name = "usePlugins")
@XmlElement(name = "usePlugin")
public List<UsePluginModel> getUsePlugins() {
return usePlugins;
}
public void setUsePlugins(List<UsePluginModel> usePlugins) {
this.usePlugins = usePlugins;
}
@XmlElementWrapper(name = "behaviors")
@XmlElements(value = {
@XmlElement(name = "userBehavior", type = UserBehaviorModel.class),
@XmlElement(name = "timerBehavior", type = TimerBehaviorModel.class) })
public List<Object> getBehaviors() {
return behaviors;
}
public void setBehaviors(List<Object> behaviors) {
this.behaviors = behaviors;
}
}

View File

@ -1,21 +0,0 @@
package org.bench4q.master.api.model.agent;
import java.util.UUID;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "runScenarioResult")
public class RunScenarioResultModel {
private UUID runId;
@XmlElement
public UUID getRunId() {
return runId;
}
public void setRunId(UUID runId) {
this.runId = runId;
}
}

View File

@ -1,35 +0,0 @@
package org.bench4q.master.api.model.agent;
import java.util.List;
import java.util.UUID;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "serverStatus")
public class ServerStatusModel {
private List<UUID> runningTests;
private List<UUID> finishedTests;
@XmlElementWrapper(name = "runningTests")
@XmlElement(name = "runningTest")
public List<UUID> getRunningTests() {
return runningTests;
}
public void setRunningTests(List<UUID> runningTests) {
this.runningTests = runningTests;
}
@XmlElementWrapper(name = "finishedTests")
@XmlElement(name = "finishedTest")
public List<UUID> getFinishedTests() {
return finishedTests;
}
public void setFinishedTests(List<UUID> finishedTests) {
this.finishedTests = finishedTests;
}
}

View File

@ -1,19 +0,0 @@
package org.bench4q.master.api.model.agent;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "stopTest")
public class StopTestModel {
private boolean success;
@XmlElement
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
}

View File

@ -1,100 +0,0 @@
package org.bench4q.master.api.model.agent;
import java.util.Date;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "testBriefStatus")
public class TestBriefStatusModel {
private Date startDate;
private long elapsedTime;
private long runningTime;
private int successCount;
private int failCount;
private int finishedCount;
private int scenarioBehaviorCount;
private double averageResponseTime;
private boolean finished;
@XmlElement
public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
@XmlElement
public long getElapsedTime() {
return elapsedTime;
}
public void setElapsedTime(long elapsedTime) {
this.elapsedTime = elapsedTime;
}
@XmlElement
public long getRunningTime() {
return runningTime;
}
public void setRunningTime(long runningTime) {
this.runningTime = runningTime;
}
@XmlElement
public int getSuccessCount() {
return successCount;
}
public void setSuccessCount(int successCount) {
this.successCount = successCount;
}
@XmlElement
public int getFailCount() {
return failCount;
}
public void setFailCount(int failCount) {
this.failCount = failCount;
}
@XmlElement
public int getFinishedCount() {
return finishedCount;
}
public void setFinishedCount(int finishedCount) {
this.finishedCount = finishedCount;
}
@XmlElement
public double getAverageResponseTime() {
return averageResponseTime;
}
public void setAverageResponseTime(double averageResponseTime) {
this.averageResponseTime = averageResponseTime;
}
@XmlElement
public int getScenarioBehaviorCount() {
return scenarioBehaviorCount;
}
public void setScenarioBehaviorCount(int scenarioBehaviorCount) {
this.scenarioBehaviorCount = scenarioBehaviorCount;
}
@XmlElement
public boolean isFinished() {
return finished;
}
public void setFinished(boolean finished) {
this.finished = finished;
}
}

View File

@ -1,80 +0,0 @@
package org.bench4q.master.api.model.agent;
import java.util.Date;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "testDetail")
public class TestDetailModel {
private String pluginId;
private String pluginName;
private String behaviorName;
private Date startDate;
private Date endDate;
private long responseTime;
private boolean success;
@XmlElement
public String getPluginId() {
return pluginId;
}
public void setPluginId(String pluginId) {
this.pluginId = pluginId;
}
@XmlElement
public String getPluginName() {
return pluginName;
}
public void setPluginName(String pluginName) {
this.pluginName = pluginName;
}
@XmlElement
public String getBehaviorName() {
return behaviorName;
}
public void setBehaviorName(String behaviorName) {
this.behaviorName = behaviorName;
}
@XmlElement
public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
@XmlElement
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
@XmlElement
public long getResponseTime() {
return responseTime;
}
public void setResponseTime(long responseTime) {
this.responseTime = responseTime;
}
@XmlElement
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
}

View File

@ -1,94 +0,0 @@
package org.bench4q.master.api.model.agent;
import java.util.Date;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "testDetailStatus")
public class TestDetailStatusModel {
private Date startDate;
private long elapsedTime;
private int successCount;
private int failCount;
private int finishedCount;
private int totalCount;
private double averageResponseTime;
private List<TestDetailModel> testDetailModels;
@XmlElement
public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
@XmlElement
public long getElapsedTime() {
return elapsedTime;
}
public void setElapsedTime(long elapsedTime) {
this.elapsedTime = elapsedTime;
}
@XmlElement
public int getSuccessCount() {
return successCount;
}
public void setSuccessCount(int successCount) {
this.successCount = successCount;
}
@XmlElement
public int getFailCount() {
return failCount;
}
public void setFailCount(int failCount) {
this.failCount = failCount;
}
@XmlElement
public int getFinishedCount() {
return finishedCount;
}
public void setFinishedCount(int finishedCount) {
this.finishedCount = finishedCount;
}
@XmlElement
public int getTotalCount() {
return totalCount;
}
public void setTotalCount(int totalCount) {
this.totalCount = totalCount;
}
@XmlElement
public double getAverageResponseTime() {
return averageResponseTime;
}
public void setAverageResponseTime(double averageResponseTime) {
this.averageResponseTime = averageResponseTime;
}
@XmlElementWrapper(name = "testDetails")
@XmlElement(name = "testDetail")
public List<TestDetailModel> getTestDetailModels() {
return testDetailModels;
}
public void setTestDetailModels(List<TestDetailModel> testDetailModels) {
this.testDetailModels = testDetailModels;
}
}

View File

@ -1,53 +0,0 @@
package org.bench4q.master.api.model.agent.scriptrecord;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import org.bench4q.master.api.model.agent.ParameterModel;
public abstract class BehaviorBaseModel {
private int id;
private String use;
private String name;
private List<ParameterModel> parameters;
@XmlElement
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
@XmlElement
public String getUse() {
return use;
}
public void setUse(String use) {
this.use = use;
}
@XmlElement
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@XmlElementWrapper(name = "parameters")
@XmlElement(name = "parameter")
public List<ParameterModel> getParameters() {
return parameters;
}
public void setParameters(List<ParameterModel> parameters) {
this.parameters = parameters;
}
}

View File

@ -1,24 +0,0 @@
package org.bench4q.master.api.model.agent.scriptrecord;
import java.io.ByteArrayOutputStream;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "timerBehavior")
public class TimerBehaviorModel extends BehaviorBaseModel {
public String getModelString() {
ByteArrayOutputStream os = new ByteArrayOutputStream();
try {
Marshaller marshaller = JAXBContext.newInstance(this.getClass())
.createMarshaller();
marshaller.marshal(this, os);
} catch (Exception e) {
e.printStackTrace();
}
return os.toString();
}
}

View File

@ -1,45 +0,0 @@
package org.bench4q.master.api.model.agent.scriptrecord;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import org.bench4q.master.api.model.agent.ParameterModel;
@XmlRootElement(name = "usePlugin")
public class UsePluginModel {
private String id;
private String name;
private List<ParameterModel> parameters;
@XmlElement
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
@XmlElement
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@XmlElementWrapper(name = "parameters")
@XmlElement(name = "parameter")
public List<ParameterModel> getParameters() {
return parameters;
}
public void setParameters(List<ParameterModel> parameters) {
this.parameters = parameters;
}
}

View File

@ -1,20 +0,0 @@
package org.bench4q.master.api.model.agent.scriptrecord;
import java.io.ByteArrayOutputStream;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "userBehavior")
public class UserBehaviorModel extends BehaviorBaseModel {
public String getModelString() throws JAXBException {
ByteArrayOutputStream os = new ByteArrayOutputStream();
Marshaller marshaller = JAXBContext.newInstance(this.getClass())
.createMarshaller();
marshaller.marshal(this, os);
return os.toString();
}
}

View File

@ -1,47 +0,0 @@
package org.bench4q.master.api.model.error;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "error")
public class ErrorResponseModel {
private String code;
private String message;
private String resource;
@XmlElement
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
@XmlElement
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
@XmlElement
public String getResource() {
return resource;
}
public void setResource(String resource) {
this.resource = resource;
}
public static ErrorResponseModel buildErrorResponse(String code, String message,
String resource) {
ErrorResponseModel errorResponse = new ErrorResponseModel();
errorResponse.setCode(code);
errorResponse.setMessage(message);
errorResponse.setResource(resource);
return errorResponse;
}
}

View File

@ -3,15 +3,6 @@ package org.bench4q.master.api.model.factory;
import java.util.ArrayList;
import java.util.List;
import org.bench4q.master.api.model.AgentModel;
import org.bench4q.master.api.model.MonitorModel;
import org.bench4q.master.api.model.PortModel;
import org.bench4q.master.api.model.RunningAgentModel;
import org.bench4q.master.api.model.RunningScriptModel;
import org.bench4q.master.api.model.ScriptModel;
import org.bench4q.master.api.model.TestPlanBusinessModel;
import org.bench4q.master.api.model.TestPlanDBModel;
import org.bench4q.master.api.model.UserModel;
import org.bench4q.master.entity.db.Agent;
import org.bench4q.master.entity.db.Port;
import org.bench4q.master.entity.db.Script;
@ -21,6 +12,15 @@ import org.bench4q.master.testplan.entity.MonitorInBusiness;
import org.bench4q.master.testplan.entity.RunningAgent;
import org.bench4q.master.testplan.entity.RunningScript;
import org.bench4q.master.testplan.entity.TestPlanInBusiness;
import org.bench4q.share.models.master.AgentModel;
import org.bench4q.share.models.master.MonitorModel;
import org.bench4q.share.models.master.PortModel;
import org.bench4q.share.models.master.RunningAgentModel;
import org.bench4q.share.models.master.RunningScriptModel;
import org.bench4q.share.models.master.ScriptModel;
import org.bench4q.share.models.master.TestPlanBusinessModel;
import org.bench4q.share.models.master.TestPlanDBModel;
import org.bench4q.share.models.master.UserModel;
public class BusinessModelMapFactory {

View File

@ -1,29 +0,0 @@
package org.bench4q.master.api.model.monitor;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "LogicalDisk")
public class LogicalDiskModel {
private List<LogicalDiskModelChild> logicalDiskList;
public LogicalDiskModel() {
this.logicalDiskList = new ArrayList<LogicalDiskModelChild>();
}
@XmlElementWrapper
@XmlElement(name = "Instance", type = LogicalDiskModelChild.class)
public List<LogicalDiskModelChild> getLogicalDiskList() {
return logicalDiskList;
}
public void setLogicalDiskList(
ArrayList<LogicalDiskModelChild> logicalDiskList) {
this.logicalDiskList = logicalDiskList;
}
}

View File

@ -1,129 +0,0 @@
package org.bench4q.master.api.model.monitor;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class LogicalDiskModelChild{
private String instance;
private double freeSpacePercent;
private double freeMegabytes;
// 锟斤拷锟教活动锟劫分憋拷
private double diskTimePercent;
private double diskReadTimePercent;
private double diskWriteTimePercent;
// 锟斤拷锟斤拷平锟斤拷疃<EFBFBD>憋拷锟?
private double averageDiskTransferTimeInSecond;
private double averageDiskReadTimeInSecond;
private double averageDiskWriteTimeInSecond;
// 锟斤拷锟斤拷平锟斤拷锟斤拷锟斤拷纸锟?
private double diskBytesPerSecond;
private double diskReadBytesPerSecond;
private double diskWriteBytesPerSecond;
// 锟斤拷锟叫百分憋拷
private double idleTimePercent;
// 平锟斤拷锟斤拷谐锟斤拷锟?
private double averageDiskQueueLength;
// 锟斤拷前锟斤拷锟叫筹拷锟斤拷
private double currentDiskQueueLength;
public String getInstance() {
return instance;
}
public void setInstance(String instance) {
this.instance = instance;
}
public double getFreeSpacePercent() {
return freeSpacePercent;
}
public void setFreeSpacePercent(double freeSpacePercent) {
this.freeSpacePercent = freeSpacePercent;
}
public double getFreeMegabytes() {
return freeMegabytes;
}
public void setFreeMegabytes(double freeMegabytes) {
this.freeMegabytes = freeMegabytes;
}
public double getDiskTimePercent() {
return diskTimePercent;
}
public void setDiskTimePercent(double diskTimePercent) {
this.diskTimePercent = diskTimePercent;
}
public double getDiskReadTimePercent() {
return diskReadTimePercent;
}
public void setDiskReadTimePercent(double diskReadTimePercent) {
this.diskReadTimePercent = diskReadTimePercent;
}
public double getDiskWriteTimePercent() {
return diskWriteTimePercent;
}
public void setDiskWriteTimePercent(double diskWriteTimePercent) {
this.diskWriteTimePercent = diskWriteTimePercent;
}
public double getAverageDiskTransferTimeInSecond() {
return averageDiskTransferTimeInSecond;
}
public void setAverageDiskTransferTimeInSecond(
double averageDiskTransferTimeInSecond) {
this.averageDiskTransferTimeInSecond = averageDiskTransferTimeInSecond;
}
public double getAverageDiskReadTimeInSecond() {
return averageDiskReadTimeInSecond;
}
public void setAverageDiskReadTimeInSecond(double averageDiskReadTimeInSecond) {
this.averageDiskReadTimeInSecond = averageDiskReadTimeInSecond;
}
public double getAverageDiskWriteTimeInSecond() {
return averageDiskWriteTimeInSecond;
}
public void setAverageDiskWriteTimeInSecond(double averageDiskWriteTimeInSecond) {
this.averageDiskWriteTimeInSecond = averageDiskWriteTimeInSecond;
}
public double getDiskBytesPerSecond() {
return diskBytesPerSecond;
}
public void setDiskBytesPerSecond(double diskBytesPerSecond) {
this.diskBytesPerSecond = diskBytesPerSecond;
}
public double getDiskReadBytesPerSecond() {
return diskReadBytesPerSecond;
}
public void setDiskReadBytesPerSecond(double diskReadBytesPerSecond) {
this.diskReadBytesPerSecond = diskReadBytesPerSecond;
}
public double getDiskWriteBytesPerSecond() {
return diskWriteBytesPerSecond;
}
public void setDiskWriteBytesPerSecond(double diskkWriteBytesPerSecond) {
this.diskWriteBytesPerSecond = diskkWriteBytesPerSecond;
}
public double getIdleTimePercent() {
return idleTimePercent;
}
public void setIdleTimePercent(double idleTimePercent) {
this.idleTimePercent = idleTimePercent;
}
public double getAverageDiskQueueLength() {
return averageDiskQueueLength;
}
public void setAverageDiskQueueLength(double averageDiskQueueLength) {
this.averageDiskQueueLength = averageDiskQueueLength;
}
public double getCurrentDiskQueueLength() {
return currentDiskQueueLength;
}
public void setCurrentDiskQueueLength(double currentDiskQueueLength) {
this.currentDiskQueueLength = currentDiskQueueLength;
}
}

View File

@ -1,70 +0,0 @@
package org.bench4q.master.api.model.monitor;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "Memory")
public class MemoryModel {
// private double pageFaultsPerSecond;//占쏙옙占쏙옙占쏙옙袒홧女
private double pagesPerSecond;
private double pagesInputPerSecond;
private double pagesOutputPerSecond;
private double cacheBytes;
private double committedBytes;// 欖占시듸옙占쏙옙占쏙옙占쌘댐옙占쏙옙笭占?
private double availableKiloBytes;
@XmlElement
public double getPagesPerSecond() {
return pagesPerSecond;
}
public void setPagesPerSecond(double pagesPerSecond) {
this.pagesPerSecond = pagesPerSecond;
}
@XmlElement
public double getPagesInputPerSecond() {
return pagesInputPerSecond;
}
public void setPagesInputPerSecond(double pagesInputPerSecond) {
this.pagesInputPerSecond = pagesInputPerSecond;
}
@XmlElement
public double getCacheBytes() {
return cacheBytes;
}
public void setCacheBytes(double cacheBytes) {
this.cacheBytes = cacheBytes;
}
@XmlElement
public double getCommittedBytes() {
return committedBytes;
}
public void setCommittedBytes(double committedBytes) {
this.committedBytes = committedBytes;
}
@XmlElement
public double getPagesOutputPerSecond() {
return pagesOutputPerSecond;
}
public void setPagesOutputPerSecond(double pagesOutputPerSecond) {
this.pagesOutputPerSecond = pagesOutputPerSecond;
}
@XmlElement
public double getAvailableKiloBytes() {
return availableKiloBytes;
}
public void setAvailableKiloBytes(double availableKiloBytes) {
this.availableKiloBytes = availableKiloBytes;
}
}

View File

@ -1,26 +0,0 @@
package org.bench4q.master.api.model.monitor;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "NetworkInterface")
public class NetworkInterfaceModel {
private List<NetworkInterfaceModelChild> networkList;
@XmlElementWrapper
@XmlElement(name="Instance",type=NetworkInterfaceModelChild.class)
public List<NetworkInterfaceModelChild> getNetworkList() {
return networkList;
}
public void setNetworkList(List<NetworkInterfaceModelChild> networkList) {
this.networkList = networkList;
}
public NetworkInterfaceModel(){
this.networkList=new ArrayList<NetworkInterfaceModelChild>();
}
}

View File

@ -1,44 +0,0 @@
package org.bench4q.master.api.model.monitor;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class NetworkInterfaceModelChild {
private double bytesTotalPerSecond;
private double bytesReceivedPerSecond;
private double bytesSentPerSecond;
private String instance;
public double getBytesReceivedPerSecond() {
return bytesReceivedPerSecond;
}
public void setBytesReceivedPerSecond(double bytesReceivedPerSecond) {
this.bytesReceivedPerSecond = bytesReceivedPerSecond;
}
public double getBytesSentPerSecond() {
return bytesSentPerSecond;
}
public void setBytesSentPerSecond(double bytesSentPerSecond) {
this.bytesSentPerSecond = bytesSentPerSecond;
}
public String getInstance() {
return instance;
}
public void setInstance(String instance) {
this.instance = instance;
}
public double getBytesTotalPerSecond() {
return bytesTotalPerSecond;
}
public void setBytesTotalPerSecond(double bytesTotalPerSecond) {
this.bytesTotalPerSecond = bytesTotalPerSecond;
}
}

View File

@ -1,23 +0,0 @@
package org.bench4q.master.api.model.monitor;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name="Processor")
public class ProcessorModel {
private List<ProcessorModelChild> processorModelList;
public ProcessorModel(){
processorModelList=new ArrayList<ProcessorModelChild>();
}
@XmlElementWrapper
@XmlElement(name="processorModelChild",type=ProcessorModelChild.class)
public List<ProcessorModelChild> getProcessorModelList() {
return processorModelList;
}
public void setProcessorModelList(List<ProcessorModelChild> processorModelList) {
this.processorModelList = processorModelList;
}
}

View File

@ -1,37 +0,0 @@
package org.bench4q.master.api.model.monitor;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class ProcessorModelChild {
private String instance;
private Double processorTimePercent;
private Double userTimePercent;
private Double privilegedTimePercent;
public String getInstance() {
return instance;
}
public void setInstance(String instance) {
this.instance = instance;
}
public Double getProcessorTimePercent() {
return processorTimePercent;
}
public void setProcessorTimePercent(Double processorTimePercent) {
this.processorTimePercent = processorTimePercent;
}
public Double getUserTimePercent() {
return userTimePercent;
}
public void setUserTimePercent(Double userTimePercent) {
this.userTimePercent = userTimePercent;
}
public Double getPrivilegedTimePercent() {
return privilegedTimePercent;
}
public void setPrivilegedTimePercent(Double privilegedTimePercent) {
this.privilegedTimePercent = privilegedTimePercent;
}
}

View File

@ -1,7 +1,7 @@
package org.bench4q.master.datastatistics;
import org.bench4q.master.api.model.ScriptBriefResultModel;
import org.bench4q.master.api.model.agent.AgentBriefStatusModel;
import org.bench4q.share.models.agent.AgentBriefStatusModel;
import org.bench4q.share.models.master.ScriptBriefResultModel;
public class ScriptBriefStatistics {
private long totalFailCountThisTime;

View File

@ -1,7 +1,7 @@
package org.bench4q.master.exception.sweeper;
import org.bench4q.master.api.model.error.ErrorResponseModel;
import org.bench4q.master.exception.Bench4QException;
import org.bench4q.share.models.ErrorResponseModel;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.ExceptionHandler;

View File

@ -5,20 +5,20 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.bench4q.master.api.model.MonitorLogicalDiskResponseModel;
import org.bench4q.master.api.model.MonitorMemoryResponseModel;
import org.bench4q.master.api.model.MonitorNetworkReponseModel;
import org.bench4q.master.api.model.MonitorProcessorResponseModel;
import org.bench4q.master.api.model.MonitorResultContainerModel;
import org.bench4q.master.api.model.monitor.LogicalDiskModel;
import org.bench4q.master.api.model.monitor.MemoryModel;
import org.bench4q.master.api.model.monitor.NetworkInterfaceModel;
import org.bench4q.master.api.model.monitor.ProcessorModel;
import org.bench4q.master.entity.db.MonitorResult;
import org.bench4q.master.helper.MarshalHelper;
import org.bench4q.master.service.db.MonitorResultService;
import org.bench4q.master.service.db.TestPlanScriptService;
import org.bench4q.master.service.db.TestPlanService;
import org.bench4q.share.models.master.MonitorLogicalDiskResponseModel;
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.master.MonitorResultContainerModel;
import org.bench4q.share.models.monitor.LogicalDiskModel;
import org.bench4q.share.models.monitor.MemoryModel;
import org.bench4q.share.models.monitor.NetworkInterfaceModel;
import org.bench4q.share.models.monitor.ProcessorModel;
import org.jfree.data.time.Second;
import org.jfree.data.time.TimeSeries;
import org.springframework.beans.factory.annotation.Autowired;

View File

@ -7,10 +7,11 @@ import java.util.List;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import org.bench4q.master.api.model.agent.RunScenarioModel;
import org.bench4q.master.api.model.agent.scriptrecord.BehaviorBaseModel;
import org.bench4q.master.api.model.agent.scriptrecord.UsePluginModel;
import org.bench4q.master.helper.MarshalHelper;
import org.bench4q.share.models.agent.RunScenarioModel;
import org.bench4q.share.models.agent.scriptrecord.BehaviorBaseModel;
import org.bench4q.share.models.agent.scriptrecord.UsePluginModel;
public class Bench4qTestScriptAdapter implements IScriptAdapter {
private RunScenarioModel runScenarioModel;

View File

@ -8,7 +8,7 @@ import java.util.concurrent.Executors;
import javax.swing.JTextArea;
import org.apache.log4j.Logger;
import org.bench4q.master.api.model.agent.RunScenarioModel;
import org.bench4q.share.models.agent.RunScenarioModel;
public class HttpCapture {
private int localport;

View File

@ -2,9 +2,9 @@ package org.bench4q.master.scriptrecord.httpcapture;
import java.util.List;
import org.bench4q.master.api.model.agent.RunScenarioModel;
import org.bench4q.master.api.model.agent.scriptrecord.BehaviorBaseModel;
import org.bench4q.master.api.model.agent.scriptrecord.UsePluginModel;
import org.bench4q.share.models.agent.RunScenarioModel;
import org.bench4q.share.models.agent.scriptrecord.BehaviorBaseModel;
import org.bench4q.share.models.agent.scriptrecord.UsePluginModel;
public interface IScriptAdapter {

View File

@ -19,8 +19,6 @@ import javax.xml.bind.Marshaller;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.bench4q.master.api.model.agent.RunScenarioModel;
import org.bench4q.master.api.model.agent.scriptrecord.BehaviorBaseModel;
import org.bench4q.master.scriptrecord.httpcapture.Action;
import org.bench4q.master.scriptrecord.httpcapture.Config;
import org.bench4q.master.scriptrecord.httpcapture.HeaderValue;
@ -30,6 +28,8 @@ import org.bench4q.master.scriptrecord.httpcapture.IScriptAdapter;
import org.bench4q.master.scriptrecord.httpcapture.Param;
import org.bench4q.master.scriptrecord.httpcapture.ProxyServer;
import org.bench4q.master.scriptrecord.httpcapture.Utils;
import org.bench4q.share.models.agent.RunScenarioModel;
import org.bench4q.share.models.agent.scriptrecord.BehaviorBaseModel;
public abstract class AbstractCodeGenerator implements IScriptGenerator,
ProxyServer.Observer, Runnable {

View File

@ -4,16 +4,16 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger;
import org.bench4q.master.api.model.agent.ParameterModel;
import org.bench4q.master.api.model.agent.scriptrecord.BehaviorBaseModel;
import org.bench4q.master.api.model.agent.scriptrecord.TimerBehaviorModel;
import org.bench4q.master.api.model.agent.scriptrecord.UsePluginModel;
import org.bench4q.master.api.model.agent.scriptrecord.UserBehaviorModel;
import org.bench4q.master.scriptrecord.httpcapture.Config;
import org.bench4q.master.scriptrecord.httpcapture.HeaderValue;
import org.bench4q.master.scriptrecord.httpcapture.IScriptAdapter;
import org.bench4q.master.scriptrecord.httpcapture.Param;
import org.bench4q.master.scriptrecord.httpcapture.Utils;
import org.bench4q.share.models.agent.ParameterModel;
import org.bench4q.share.models.agent.scriptrecord.BehaviorBaseModel;
import org.bench4q.share.models.agent.scriptrecord.TimerBehaviorModel;
import org.bench4q.share.models.agent.scriptrecord.UsePluginModel;
import org.bench4q.share.models.agent.scriptrecord.UserBehaviorModel;
public class Bench4qCodeGenerator extends AbstractCodeGenerator {
static final String TIMER_PROP = "generator.isac.timer";

View File

@ -3,9 +3,9 @@ package org.bench4q.master.service.communication;
import java.io.IOException;
import org.apache.log4j.Logger;
import org.bench4q.master.api.model.agent.ServerStatusModel;
import org.bench4q.master.helper.MarshalHelper;
import org.bench4q.master.service.communication.HttpRequester.HttpResponse;
import org.bench4q.share.models.agent.ServerStatusModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

View File

@ -6,13 +6,13 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import org.apache.log4j.Logger;
import org.bench4q.master.api.model.monitor.LogicalDiskModel;
import org.bench4q.master.api.model.monitor.MemoryModel;
import org.bench4q.master.api.model.monitor.NetworkInterfaceModel;
import org.bench4q.master.api.model.monitor.ProcessorModel;
import org.bench4q.master.helper.MarshalHelper;
import org.bench4q.master.service.communication.HttpRequester.HttpResponse;
import org.bench4q.master.service.db.MonitorResultService;
import org.bench4q.share.models.monitor.LogicalDiskModel;
import org.bench4q.share.models.monitor.MemoryModel;
import org.bench4q.share.models.monitor.NetworkInterfaceModel;
import org.bench4q.share.models.monitor.ProcessorModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

View File

@ -9,14 +9,14 @@ import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import org.apache.log4j.Logger;
import org.bench4q.master.api.model.agent.AgentBriefStatusModel;
import org.bench4q.master.api.model.agent.RunScenarioModel;
import org.bench4q.master.api.model.agent.RunScenarioResultModel;
import org.bench4q.master.api.model.agent.StopTestModel;
import org.bench4q.master.entity.db.Agent;
import org.bench4q.master.helper.MarshalHelper;
import org.bench4q.master.service.communication.HttpRequester.HttpResponse;
import org.bench4q.master.testplan.highavailable.faultolerence.BriefAgentFault;
import org.bench4q.share.models.agent.AgentBriefStatusModel;
import org.bench4q.share.models.agent.RunScenarioModel;
import org.bench4q.share.models.agent.RunScenarioResultModel;
import org.bench4q.share.models.agent.StopTestModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

View File

@ -2,12 +2,12 @@ package org.bench4q.master.service.communication;
import java.util.UUID;
import org.bench4q.master.api.model.ScriptBriefResultModel;
import org.bench4q.master.api.model.agent.AgentBriefStatusModel;
import org.bench4q.master.datastatistics.ScriptBriefStatistics;
import org.bench4q.master.service.db.TestPlanScriptService;
import org.bench4q.master.testplan.entity.RunningAgent;
import org.bench4q.master.testplan.entity.RunningScript;
import org.bench4q.share.models.agent.AgentBriefStatusModel;
import org.bench4q.share.models.master.ScriptBriefResultModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

View File

@ -4,12 +4,13 @@ import java.util.Date;
import java.util.List;
import javax.xml.bind.JAXBException;
import org.apache.log4j.Logger;
import org.bench4q.master.api.model.agent.RunScenarioModel;
import org.bench4q.master.entity.db.Script;
import org.bench4q.master.entity.db.User;
import org.bench4q.master.helper.MarshalHelper;
import org.bench4q.master.helper.SessionHelper;
import org.bench4q.share.models.agent.RunScenarioModel;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.criterion.Restrictions;

View File

@ -6,12 +6,12 @@ import java.util.UUID;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import org.bench4q.master.api.model.ScriptBriefResultModel;
import org.bench4q.master.entity.db.Script;
import org.bench4q.master.entity.db.TestPlanDB;
import org.bench4q.master.entity.db.TestPlanScript;
import org.bench4q.master.entity.db.TestPlanScriptResult;
import org.bench4q.master.helper.SessionHelper;
import org.bench4q.share.models.master.ScriptBriefResultModel;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.criterion.Restrictions;

View File

@ -6,8 +6,6 @@ import java.util.List;
import java.util.UUID;
import org.apache.log4j.Logger;
import org.bench4q.master.api.model.TestPlanBusinessModel;
import org.bench4q.master.api.model.TestScriptConfig;
import org.bench4q.master.api.model.factory.BusinessModelMapFactory;
import org.bench4q.master.entity.db.PlanedConfig;
import org.bench4q.master.entity.db.Script;
@ -16,9 +14,11 @@ import org.bench4q.master.entity.db.TestPlanScript;
import org.bench4q.master.entity.db.User;
import org.bench4q.master.helper.MarshalHelper;
import org.bench4q.master.helper.SessionHelper;
import org.bench4q.master.testplan.TestPlanStatus;
import org.bench4q.master.testplan.entity.RunningScript;
import org.bench4q.master.testplan.entity.TestPlanInBusiness;
import org.bench4q.share.enums.master.TestPlanStatus;
import org.bench4q.share.models.master.TestPlanBusinessModel;
import org.bench4q.share.models.master.TestScriptConfig;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.criterion.Restrictions;

View File

@ -7,7 +7,6 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import org.apache.log4j.Logger;
import org.bench4q.master.api.model.TestScriptConfig;
import org.bench4q.master.entity.db.User;
import org.bench4q.master.service.db.TestPlanService;
import org.bench4q.master.testplan.entity.RunningAgent;
@ -18,6 +17,7 @@ import org.bench4q.master.testplan.highavailable.HighAvailablePool;
import org.bench4q.master.testplan.schedulscript.ExecutionOverTask;
import org.bench4q.master.testplan.schedulscript.TaskCompleteCallback;
import org.bench4q.master.testplan.schedulscript.WarmUpOverTask;
import org.bench4q.share.models.master.TestScriptConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

View File

@ -1,5 +0,0 @@
package org.bench4q.master.testplan;
public enum TestPlanStatus {
NotStart, InRunning, Complete, PendingNoEnoughMaxLoad, PendingNoEnoughCurrentLoad, Error, ErrorInSubmitTask
}

View File

@ -4,7 +4,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.bench4q.master.api.model.TestScriptConfig;
import org.bench4q.share.models.master.TestScriptConfig;
public class RunningScript {
private int scriptId;

View File

@ -6,7 +6,6 @@ import java.util.Map;
import java.util.UUID;
import org.apache.log4j.Logger;
import org.bench4q.master.api.model.agent.ServerStatusModel;
import org.bench4q.master.entity.db.Agent;
import org.bench4q.master.service.communication.AgentStateService;
import org.bench4q.master.service.db.AgentService;
@ -15,6 +14,7 @@ import org.bench4q.master.testplan.TestPlanContext;
import org.bench4q.master.testplan.entity.RunningScript;
import org.bench4q.master.testplan.transaction.script.ScriptLoadBase;
import org.bench4q.master.testplan.transaction.script.ScriptLoadSubstitute;
import org.bench4q.share.models.agent.ServerStatusModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

View File

@ -3,7 +3,6 @@ package org.bench4q.master.testplan.schedulscript;
import java.util.TimerTask;
import org.apache.log4j.Logger;
import org.bench4q.master.api.model.agent.StopTestModel;
import org.bench4q.master.helper.ApplicationContextHelper;
import org.bench4q.master.service.communication.RunningAgentService;
import org.bench4q.master.service.db.AgentService;
@ -11,6 +10,7 @@ import org.bench4q.master.testplan.entity.RunningAgent;
import org.bench4q.master.testplan.entity.RunningScript;
import org.bench4q.master.testplan.highavailable.AgentRunBlotter;
import org.bench4q.master.testplan.highavailable.faultolerence.StopAgentFault;
import org.bench4q.share.models.agent.StopTestModel;
public class ExecutionOverTask extends TimerTask {
private AgentService agentService;

View File

@ -3,14 +3,14 @@ package org.bench4q.master.testplan.transaction.agent;
import java.io.IOException;
import org.apache.log4j.Logger;
import org.bench4q.master.api.model.agent.RunScenarioModel;
import org.bench4q.master.api.model.agent.RunScenarioResultModel;
import org.bench4q.master.entity.db.Agent;
import org.bench4q.master.exception.DealWithLog;
import org.bench4q.master.helper.ApplicationContextHelper;
import org.bench4q.master.service.communication.RunningAgentService;
import org.bench4q.master.service.db.AgentService;
import org.bench4q.master.testplan.transaction.Transaction;
import org.bench4q.share.models.agent.RunScenarioModel;
import org.bench4q.share.models.agent.RunScenarioResultModel;
public class AgentTransaction implements Transaction {

View File

@ -7,9 +7,6 @@ import java.util.UUID;
import javax.xml.bind.JAXBException;
import org.apache.log4j.Logger;
import org.bench4q.master.api.model.agent.RunScenarioModel;
import org.bench4q.master.api.model.agent.RunScenarioResultModel;
import org.bench4q.master.api.model.agent.StopTestModel;
import org.bench4q.master.entity.db.Agent;
import org.bench4q.master.exception.DealWithLog;
import org.bench4q.master.helper.ApplicationContextHelper;
@ -23,6 +20,9 @@ import org.bench4q.master.testplan.highavailable.HighAvailablePool;
import org.bench4q.master.testplan.transaction.Transaction;
import org.bench4q.master.testplan.transaction.agent.AgentRunException;
import org.bench4q.master.testplan.transaction.agent.AgentTransaction;
import org.bench4q.share.models.agent.RunScenarioModel;
import org.bench4q.share.models.agent.RunScenarioResultModel;
import org.bench4q.share.models.agent.StopTestModel;
public abstract class ScriptLoadBase implements Transaction {
private RunningScript runningScript;

View File

@ -4,8 +4,8 @@ import javax.xml.bind.JAXBException;
import static org.junit.Assert.*;
import org.bench4q.master.api.model.RunningAgentModel;
import org.bench4q.master.helper.MarshalHelper;
import org.bench4q.share.models.master.RunningAgentModel;
import org.junit.Test;
public class MarshallerTest {

View File

@ -5,10 +5,11 @@ import java.util.HashMap;
import java.util.Map;
import javax.xml.bind.JAXBException;
import org.bench4q.master.api.model.AgentModel;
import org.bench4q.master.api.model.AgentResponseModel;
import org.bench4q.master.helper.MarshalHelper;
import org.bench4q.master.service.communication.HttpRequester.HttpResponse;
import org.bench4q.share.models.master.AgentModel;
import org.bench4q.share.models.master.AgentResponseModel;
import org.junit.Test;
public class AgentPoolControllerTest extends TestBase {

View File

@ -2,10 +2,10 @@ package org.bench4q.master.test;
import java.io.IOException;
import org.bench4q.master.api.model.RegisterResponseModel;
import org.bench4q.master.helper.MarshalHelper;
import org.bench4q.master.service.communication.HttpRequester;
import org.bench4q.master.service.communication.HttpRequester.HttpResponse;
import org.bench4q.share.models.master.RegisterResponseModel;
public class AuthTest {
private HttpRequester httpRequester;

View File

@ -2,10 +2,10 @@ package org.bench4q.master.test;
import java.io.IOException;
import org.bench4q.master.api.model.TestPlanBusinessModel;
import org.bench4q.master.helper.MarshalHelper;
import org.bench4q.master.service.communication.HttpRequester;
import org.bench4q.master.service.communication.HttpRequester.HttpResponse;
import org.bench4q.share.models.master.TestPlanBusinessModel;
import org.junit.Test;
public class HttpRequestTest {

View File

@ -7,12 +7,13 @@ import java.util.List;
import java.util.Map;
import javax.xml.bind.JAXBException;
import org.bench4q.master.api.model.MonitorLogicalDiskResponseModel;
import org.bench4q.master.api.model.monitor.LogicalDiskModel;
import org.bench4q.master.api.model.monitor.LogicalDiskModelChild;
import org.bench4q.master.helper.MarshalHelper;
import org.bench4q.master.service.communication.HttpRequester;
import org.bench4q.master.service.communication.HttpRequester.HttpResponse;
import org.bench4q.share.models.master.MonitorLogicalDiskResponseModel;
import org.bench4q.share.models.monitor.LogicalDiskModel;
import org.bench4q.share.models.monitor.LogicalDiskModelChild;
import org.springframework.stereotype.Component;
@Component(value = "monitorCotrollerTest")

View File

@ -5,9 +5,10 @@ import java.util.HashMap;
import java.util.Map;
import javax.xml.bind.JAXBException;
import org.bench4q.master.api.model.OperateScriptServerResponseModel;
import org.bench4q.master.helper.MarshalHelper;
import org.bench4q.master.service.communication.HttpRequester.HttpResponse;
import org.bench4q.share.models.master.OperateScriptServerResponseModel;
public class RecordScriptControllerTest extends TestBase {
private final String SCRIPT_URL = TestBase.BASE_URL + "/RecordScript";

View File

@ -2,9 +2,9 @@ package org.bench4q.master.test;
import static org.junit.Assert.*;
import org.bench4q.master.api.model.ScriptBriefResultModel;
import org.bench4q.master.api.model.agent.AgentBriefStatusModel;
import org.bench4q.master.datastatistics.ScriptBriefStatistics;
import org.bench4q.share.models.agent.AgentBriefStatusModel;
import org.bench4q.share.models.master.ScriptBriefResultModel;
import org.junit.Test;
public class ScriptBriefStatisticsTest {

View File

@ -6,10 +6,10 @@ import java.io.IOException;
import javax.xml.bind.JAXBException;
import org.bench4q.master.api.model.OperateScriptServerResponseModel;
import org.bench4q.master.helper.MarshalHelper;
import org.bench4q.master.service.communication.HttpRequester;
import org.bench4q.master.service.communication.HttpRequester.HttpResponse;
import org.bench4q.share.models.master.OperateScriptServerResponseModel;
import org.junit.Test;
public class ScriptControllerTest extends TestBase {

View File

@ -5,10 +5,11 @@ import java.util.HashMap;
import java.util.Map;
import javax.xml.bind.JAXBException;
import org.bench4q.master.api.model.AuthorizeResponseModel;
import org.bench4q.master.helper.MarshalHelper;
import org.bench4q.master.service.communication.HttpRequester;
import org.bench4q.master.service.communication.HttpRequester.HttpResponse;
import org.bench4q.share.models.master.AuthorizeResponseModel;
public class TestBase {
protected HttpRequester httpRequester = new HttpRequester();

View File

@ -1,8 +1,8 @@
package org.bench4q.master.test;
import org.bench4q.master.api.TestPlanController;
import org.bench4q.master.api.model.TestPlanBusinessModel;
import org.bench4q.master.exception.Bench4QException;
import org.bench4q.share.models.master.TestPlanBusinessModel;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

View File

@ -12,15 +12,16 @@ import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import org.bench4q.master.api.model.MonitorModel;
import org.bench4q.master.api.model.RunningScriptModel;
import org.bench4q.master.api.model.ScriptBriefResultModel;
import org.bench4q.master.api.model.TestScriptConfig;
import org.bench4q.master.api.model.TestPlanBusinessModel;
import org.bench4q.master.api.model.TestPlanResultModel;
import org.bench4q.master.helper.MarshalHelper;
import org.bench4q.master.service.communication.HttpRequester.HttpResponse;
import org.bench4q.master.testplan.TestPlanStatus;
import org.bench4q.share.enums.master.TestPlanStatus;
import org.bench4q.share.models.master.MonitorModel;
import org.bench4q.share.models.master.RunningScriptModel;
import org.bench4q.share.models.master.ScriptBriefResultModel;
import org.bench4q.share.models.master.TestPlanBusinessModel;
import org.bench4q.share.models.master.TestPlanResultModel;
import org.bench4q.share.models.master.TestScriptConfig;
import org.junit.Test;
public class TestPlanTester extends TestBase {
private TestPlanBusinessModel testPlanBusinessModel = new TestPlanBusinessModel();
@ -51,13 +52,15 @@ public class TestPlanTester extends TestBase {
this.scriptSumNum = scriptSumNum;
}
public TestPlanTester(int scriptSumNum) {
this.setScriptSumNum(scriptSumNum);
public TestPlanTester() {
}
public static void main(String[] args) throws JAXBException, IOException,
@Test
public void testAll() throws JAXBException, IOException,
InterruptedException {
TestPlanTester tester = new TestPlanTester(1);
TestPlanTester tester = new TestPlanTester();
tester.setScriptSumNum(1);
tester.setAccessTocken(tester.login());
tester.runAndGetBrief();
// tester.loadTestPlans();
@ -191,9 +194,11 @@ public class TestPlanTester extends TestBase {
params.put("scriptId", String.valueOf(scriptId));
HttpResponse httpResponse = this.httpRequester.sendGet(this._url
+ "/getScriptBrief", params, createAccessTokenMap());
System.out.println(httpResponse.getContent());
return (ScriptBriefResultModel) MarshalHelper.unmarshal(
ScriptBriefResultModel.class, httpResponse.getContent());
ScriptBriefResultModel ret = (ScriptBriefResultModel) MarshalHelper
.unmarshal(ScriptBriefResultModel.class,
httpResponse.getContent());
System.out.println(ret.getAverageResponseTime());
return ret;
}
private Map<String, String> createAccessTokenMap() {