This commit is contained in:
daisyonly 2014-09-01 14:38:19 +08:00
commit 7a04393a14
13 changed files with 1140 additions and 1048 deletions

View File

@ -82,13 +82,13 @@ public class TestController {
public String submitParams( public String submitParams(
@PathVariable UUID runId, @PathVariable UUID runId,
@RequestParam(value = "files[]", required = false) List<MultipartFile> files, @RequestParam(value = "files[]", required = false) List<MultipartFile> files,
@RequestParam("scenarioModel") String scenarioModel) { @RequestParam(value = "testShedule", required = false) String scheduleContent,
@RequestParam(value = "scenarioModel") String scenarioModel) {
try { try {
this.getParamFileCollector().collectParamFiles(files, runId); this.getParamFileCollector().collectParamFiles(files, runId);
System.out.println(scenarioModel); System.out.println(scenarioModel);
RunScenarioModel runScenarioModel = (RunScenarioModel) MarshalHelper RunScenarioModel runScenarioModel = (RunScenarioModel) MarshalHelper
.unmarshal(RunScenarioModel.class, scenarioModel); .unmarshal(RunScenarioModel.class, scenarioModel);
this.getScenarioEngine().submitScenario(runId, this.getScenarioEngine().submitScenario(runId,
Scenario.scenarioBuilderWithCompile(runScenarioModel)); Scenario.scenarioBuilderWithCompile(runScenarioModel));
return MarshalHelper.tryMarshal(buildWith(runId)); return MarshalHelper.tryMarshal(buildWith(runId));

View File

@ -16,6 +16,7 @@ public class Scenario {
private UsePlugin[] usePlugins; private UsePlugin[] usePlugins;
private Page[] pages; private Page[] pages;
private List<Behavior> behaviors; private List<Behavior> behaviors;
private TestSchedule schedule;
public UsePlugin[] getUsePlugins() { public UsePlugin[] getUsePlugins() {
return usePlugins; return usePlugins;
@ -41,6 +42,14 @@ public class Scenario {
this.behaviors = behaviors; this.behaviors = behaviors;
} }
public TestSchedule getSchedule() {
return schedule;
}
private void setSchedule(TestSchedule schedule) {
this.schedule = schedule;
}
public Scenario() { public Scenario() {
this.setBehaviors(new ArrayList<Behavior>()); this.setBehaviors(new ArrayList<Behavior>());
} }
@ -88,6 +97,7 @@ public class Scenario {
scenario.setPages(new Page[runScenarioModel.getPages().size()]); scenario.setPages(new Page[runScenarioModel.getPages().size()]);
extractUsePlugins(runScenarioModel, scenario); extractUsePlugins(runScenarioModel, scenario);
extractPages(runScenarioModel, scenario); extractPages(runScenarioModel, scenario);
scenario.setSchedule(TestSchedule.build(runScenarioModel.getScheduleModel()));
return scenario; return scenario;
} }

View File

@ -0,0 +1,63 @@
package org.bench4q.agent.scenario;
import java.util.LinkedList;
import java.util.List;
import org.bench4q.share.models.agent.scriptrecord.TestScheduleModel;
import org.bench4q.share.models.agent.scriptrecord.TestScheduleModel.PointModel;
public class TestSchedule {
private List<Segment> points;
public List<Segment> getPoints() {
return points;
}
public void setPoints(List<Segment> points) {
this.points = points;
}
public static class Segment {
private final Point start;
private final Point end;
private final int growthUnit;
public Segment(Point startPoint, Point endPoint) {
this.start = new Point(startPoint.time, startPoint.load);
}
}
public static class Point {
private final int time;
private final int load;
public int getTime() {
return time;
}
public int getLoad() {
return load;
}
public Point(int time, int load) {
// TODO Auto-generated constructor stub
this.time = time;
this.load = load;
}
}
public static TestSchedule build(TestScheduleModel scheduleModel) {
TestSchedule schedule = new TestSchedule();
// schedule.setPoints(extractPoints(scheduleModel.getPoints()));
return null;
}
private static List<Point> extractPoints(List<PointModel> points) {
List<Point> result = new LinkedList<TestSchedule.Point>();
for (PointModel model : points) {
result.add(new Point(model.getTime(), model.getLoad()));
}
return result;
}
}

View File

@ -1,149 +1,149 @@
package org.bench4q.agent.scenario.engine; package org.bench4q.agent.scenario.engine;
import java.util.Date; import java.util.Date;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.ThreadPoolExecutor.DiscardPolicy; import java.util.concurrent.ThreadPoolExecutor.DiscardPolicy;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.bench4q.agent.datacollector.DataCollector; import org.bench4q.agent.datacollector.DataCollector;
import org.bench4q.agent.datacollector.impl.ScenarioResultCollector; import org.bench4q.agent.datacollector.impl.ScenarioResultCollector;
import org.bench4q.agent.plugin.PluginManager; import org.bench4q.agent.plugin.PluginManager;
import org.bench4q.agent.scenario.Scenario; import org.bench4q.agent.scenario.Scenario;
public class ScenarioContext { public class ScenarioContext {
private static final long keepAliveTime = 10; private static final long keepAliveTime = 10;
private UUID testId; private UUID testId;
private Date startDate; private Date startDate;
private Date endDate; private Date endDate;
private ThreadPoolExecutor executor; private ThreadPoolExecutor executor;
private Scenario scenario; private Scenario scenario;
private boolean finished; private boolean finished;
private DataCollector dataStatistics; private DataCollector dataStatistics;
private PluginManager pluginManager; private PluginManager pluginManager;
public UUID getTestId() { public UUID getTestId() {
return testId; return testId;
} }
private void setTestId(UUID testId) { private void setTestId(UUID testId) {
this.testId = testId; this.testId = testId;
} }
public Date getStartDate() { public Date getStartDate() {
return startDate; return startDate;
} }
public void setStartDate(Date saveStartDate) { public void setStartDate(Date saveStartDate) {
this.startDate = saveStartDate; this.startDate = saveStartDate;
} }
public Date getEndDate() { public Date getEndDate() {
return endDate; return endDate;
} }
public void setEndDate(Date endDate) { public void setEndDate(Date endDate) {
this.endDate = endDate; this.endDate = endDate;
} }
public ThreadPoolExecutor getExecutor() { public ThreadPoolExecutor getExecutor() {
return executor; return executor;
} }
public void setExecutorService(ThreadPoolExecutor executor) { public void setExecutorService(ThreadPoolExecutor executor) {
this.executor = executor; this.executor = executor;
} }
public Scenario getScenario() { public Scenario getScenario() {
return scenario; return scenario;
} }
public void setScenario(Scenario scenario) { public void setScenario(Scenario scenario) {
this.scenario = scenario; this.scenario = scenario;
} }
public boolean isFinished() { public boolean isFinished() {
return finished; return finished;
} }
public void setFinished(boolean finished) { public void setFinished(boolean finished) {
this.finished = finished; this.finished = finished;
} }
public DataCollector getDataStatistics() { public DataCollector getDataStatistics() {
return dataStatistics; return dataStatistics;
} }
private void setDataStatistics(DataCollector dataStatistics) { private void setDataStatistics(DataCollector dataStatistics) {
this.dataStatistics = dataStatistics; this.dataStatistics = dataStatistics;
} }
private PluginManager getPluginManager() { private PluginManager getPluginManager() {
return pluginManager; return pluginManager;
} }
private void setPluginManager(PluginManager pluginManager) { private void setPluginManager(PluginManager pluginManager) {
this.pluginManager = pluginManager; this.pluginManager = pluginManager;
} }
private ScenarioContext() { private ScenarioContext() {
} }
public static ScenarioContext buildScenarioContext(UUID testId, public static ScenarioContext buildScenarioContext(UUID testId,
final Scenario scenario, int poolSize, PluginManager pluginManager) { final Scenario scenario, int poolSize, PluginManager pluginManager) {
ScenarioContext scenarioContext = buildScenarioContextWithoutScenario( ScenarioContext scenarioContext = buildScenarioContextWithoutScenario(
testId, poolSize, pluginManager); testId, poolSize, pluginManager);
scenarioContext.setScenario(scenario); scenarioContext.setScenario(scenario);
return scenarioContext; return scenarioContext;
} }
public static ScenarioContext buildScenarioContextWithoutScenario( public static ScenarioContext buildScenarioContextWithoutScenario(
UUID testId, int poolSize, PluginManager pluginManager) { UUID testId, int poolSize, PluginManager pluginManager) {
ScenarioContext scenarioContext = new ScenarioContext(); ScenarioContext scenarioContext = new ScenarioContext();
scenarioContext.setTestId(testId); scenarioContext.setTestId(testId);
scenarioContext.setPluginManager(pluginManager); scenarioContext.setPluginManager(pluginManager);
final ArrayBlockingQueue<Runnable> workQueue = new ArrayBlockingQueue<Runnable>( final ArrayBlockingQueue<Runnable> workQueue = new ArrayBlockingQueue<Runnable>(
poolSize); poolSize);
ThreadPoolExecutor executor = new ThreadPoolExecutor(poolSize, ThreadPoolExecutor executor = new ThreadPoolExecutor(poolSize,
poolSize, keepAliveTime, TimeUnit.MINUTES, workQueue, poolSize, keepAliveTime, TimeUnit.MINUTES, workQueue,
new DiscardPolicy()); new DiscardPolicy());
scenarioContext.setStartDate(new Date(System.currentTimeMillis())); scenarioContext.setStartDate(new Date(System.currentTimeMillis()));
scenarioContext.setExecutorService(executor); scenarioContext.setExecutorService(executor);
scenarioContext.setDataStatistics(new ScenarioResultCollector(testId)); scenarioContext.setDataStatistics(new ScenarioResultCollector(testId));
return scenarioContext; return scenarioContext;
} }
public ScenarioContext addScenrio(Scenario scenario) { public ScenarioContext addScenrio(Scenario scenario) {
this.setScenario(scenario); this.setScenario(scenario);
return this; return this;
} }
/** /**
* Now, I tolerate that if the requiredLoad < * Now, I tolerate that if the requiredLoad <
* this.getExecutor.getCorePoolSize(), then the excess threads will be * this.getExecutor.getCorePoolSize(), then the excess threads will be
* killed when its current task complete * killed when its current task complete
* *
* @param requiredLoad * @param requiredLoad
*/ */
void updatePopulation(int requiredLoad) { void updatePopulation(int requiredLoad) {
this.getExecutor().setCorePoolSize(requiredLoad); this.getExecutor().setCorePoolSize(requiredLoad);
this.getExecutor().setMaximumPoolSize(requiredLoad); this.getExecutor().setMaximumPoolSize(requiredLoad);
} }
public void addTask() { public void addTask() {
if (this.isFinished()) { if (this.isFinished()) {
return; return;
} }
this.getExecutor().execute(new VUser(this, 1, getPluginManager())); this.getExecutor().execute(new VUser(this, 1, getPluginManager()));
Logger.getLogger(this.getClass()).info( Logger.getLogger(this.getClass()).info(
this.getExecutor().getActiveCount()); this.getExecutor().getActiveCount());
} }
public void initTasks() { public void initTasks() {
for (int i = 0; i < this.getExecutor().getCorePoolSize(); i++) { for (int i = 0; i < this.getExecutor().getCorePoolSize(); i++) {
addTask(); addTask();
} }
} }
} }

View File

@ -1,79 +1,79 @@
package org.bench4q.agent.scenario.engine; package org.bench4q.agent.scenario.engine;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.bench4q.agent.plugin.PluginManager; import org.bench4q.agent.plugin.PluginManager;
import org.bench4q.agent.scenario.Scenario; import org.bench4q.agent.scenario.Scenario;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@Component @Component
public class ScenarioEngine { public class ScenarioEngine {
private Map<UUID, ScenarioContext> runningTests; private Map<UUID, ScenarioContext> runningTests;
private Logger logger = Logger.getLogger(ScenarioEngine.class); private Logger logger = Logger.getLogger(ScenarioEngine.class);
private PluginManager pluginManager; private PluginManager pluginManager;
public ScenarioEngine() { public ScenarioEngine() {
this.setRunningTests(new HashMap<UUID, ScenarioContext>()); this.setRunningTests(new HashMap<UUID, ScenarioContext>());
} }
public Map<UUID, ScenarioContext> getRunningTests() { public Map<UUID, ScenarioContext> getRunningTests() {
return runningTests; return runningTests;
} }
private void setRunningTests(Map<UUID, ScenarioContext> runningTests) { private void setRunningTests(Map<UUID, ScenarioContext> runningTests) {
this.runningTests = runningTests; this.runningTests = runningTests;
} }
private PluginManager getPluginManager() { private PluginManager getPluginManager() {
return pluginManager; return pluginManager;
} }
@Autowired @Autowired
private void setPluginManager(PluginManager pluginManager) { private void setPluginManager(PluginManager pluginManager) {
this.pluginManager = pluginManager; this.pluginManager = pluginManager;
} }
public void addRunningTestWithoutScenario(UUID runId, int poolSize) { public void addRunningTestWithoutScenario(UUID runId, int poolSize) {
try { try {
final ScenarioContext scenarioContext = ScenarioContext final ScenarioContext scenarioContext = ScenarioContext
.buildScenarioContextWithoutScenario(runId, poolSize, .buildScenarioContextWithoutScenario(runId, poolSize,
getPluginManager()); getPluginManager());
this.getRunningTests().put(runId, scenarioContext); this.getRunningTests().put(runId, scenarioContext);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
public void submitScenario(UUID runId, final Scenario scenario) { public void submitScenario(UUID runId, final Scenario scenario) {
try { try {
this.getRunningTests().get(runId).addScenrio(scenario); this.getRunningTests().get(runId).addScenrio(scenario);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
public boolean runWith(UUID runId) { public boolean runWith(UUID runId) {
if (!this.getRunningTests().containsKey(runId)) { if (!this.getRunningTests().containsKey(runId)) {
return false; return false;
} }
final ScenarioContext context = this.getRunningTests().get(runId); final ScenarioContext context = this.getRunningTests().get(runId);
return runWith(context); return runWith(context);
} }
private boolean runWith(final ScenarioContext scenarioContext) { private boolean runWith(final ScenarioContext scenarioContext) {
if (scenarioContext == null) { if (scenarioContext == null) {
logger.error("The context required is null"); logger.error("The context required is null");
return false; return false;
} }
scenarioContext.initTasks(); scenarioContext.initTasks();
return true; return true;
} }
public void updatePopulation(UUID testId, int requiredLoad) { public void updatePopulation(UUID testId, int requiredLoad) {
ScenarioContext context = this.getRunningTests().get(testId); ScenarioContext context = this.getRunningTests().get(testId);
context.updatePopulation(requiredLoad); context.updatePopulation(requiredLoad);
} }
} }

View File

@ -1,325 +1,325 @@
package org.bench4q.master.api; package org.bench4q.master.api;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.bench4q.master.domain.entity.TestPlan; import org.bench4q.master.domain.entity.TestPlan;
import org.bench4q.master.domain.factory.BusinessModelMapFactory; import org.bench4q.master.domain.factory.BusinessModelMapFactory;
import org.bench4q.master.domain.service.TestPlanEngine; import org.bench4q.master.domain.service.TestPlanEngine;
import org.bench4q.master.domain.service.TestPlanScriptResultService; import org.bench4q.master.domain.service.TestPlanScriptResultService;
import org.bench4q.master.domain.service.TestPlanService; import org.bench4q.master.domain.service.TestPlanService;
import org.bench4q.master.domain.service.UserService; import org.bench4q.master.domain.service.UserService;
import org.bench4q.master.domain.service.report.ReportService; import org.bench4q.master.domain.service.report.ReportService;
import org.bench4q.master.exception.Bench4QException; import org.bench4q.master.exception.Bench4QException;
import org.bench4q.master.exception.Bench4QRunTimeException; import org.bench4q.master.exception.Bench4QRunTimeException;
import org.bench4q.share.enums.master.TestPlanStatus; import org.bench4q.share.enums.master.TestPlanStatus;
import org.bench4q.share.models.master.MonitorModel; import org.bench4q.share.models.master.MonitorModel;
import org.bench4q.share.models.master.ScriptHandleModel; import org.bench4q.share.models.master.ScriptHandleModel;
import org.bench4q.share.models.master.TestPlanScriptBriefResultModel; import org.bench4q.share.models.master.TestPlanScriptBriefResultModel;
import org.bench4q.share.models.master.TestPlanModel; import org.bench4q.share.models.master.TestPlanModel;
import org.bench4q.share.models.master.TestPlanDBModel; import org.bench4q.share.models.master.TestPlanDBModel;
import org.bench4q.share.models.master.TestPlanResponseModel; import org.bench4q.share.models.master.TestPlanResponseModel;
import org.bench4q.share.models.master.TestPlanResultModel; import org.bench4q.share.models.master.TestPlanResultModel;
import org.bench4q.share.models.master.statistics.ScriptBehaviorsBriefModel; import org.bench4q.share.models.master.statistics.ScriptBehaviorsBriefModel;
import org.bench4q.share.models.master.statistics.ScriptBriefResultModel; import org.bench4q.share.models.master.statistics.ScriptBriefResultModel;
import org.bench4q.share.models.master.statistics.ScriptPagesBriefModel; import org.bench4q.share.models.master.statistics.ScriptPagesBriefModel;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.ResponseStatus;
@Controller @Controller
@RequestMapping("/testPlan") @RequestMapping("/testPlan")
public class TestPlanController extends BaseController { public class TestPlanController extends BaseController {
private TestPlanEngine testPlanRunner; private TestPlanEngine testPlanRunner;
private TestPlanService testPlanService; private TestPlanService testPlanService;
private ReportService reportService; private ReportService reportService;
private TestPlanScriptResultService testPlanScriptResultService; private TestPlanScriptResultService testPlanScriptResultService;
private BusinessModelMapFactory businessMapFactory; private BusinessModelMapFactory businessMapFactory;
private Logger logger = Logger.getLogger(TestPlanController.class); private Logger logger = Logger.getLogger(TestPlanController.class);
private TestPlanEngine getTestPlanRunner() { private TestPlanEngine getTestPlanRunner() {
return testPlanRunner; return testPlanRunner;
} }
@Autowired @Autowired
private void setTestPlanRunner(TestPlanEngine testPlanRunner) { private void setTestPlanRunner(TestPlanEngine testPlanRunner) {
this.testPlanRunner = testPlanRunner; this.testPlanRunner = testPlanRunner;
} }
private TestPlanService getTestPlanService() { private TestPlanService getTestPlanService() {
return this.testPlanService; return this.testPlanService;
} }
@Autowired @Autowired
private void setTestPlanService(TestPlanService testPlanService) { private void setTestPlanService(TestPlanService testPlanService) {
this.testPlanService = testPlanService; this.testPlanService = testPlanService;
} }
private ReportService getReportService() { private ReportService getReportService() {
return reportService; return reportService;
} }
@Autowired @Autowired
private void setReportService(ReportService reportService) { private void setReportService(ReportService reportService) {
this.reportService = reportService; this.reportService = reportService;
} }
private BusinessModelMapFactory getBusinessMapFactory() { private BusinessModelMapFactory getBusinessMapFactory() {
return businessMapFactory; return businessMapFactory;
} }
@Autowired @Autowired
private void setBusinessMapFactory( private void setBusinessMapFactory(
BusinessModelMapFactory businessMapFactory) { BusinessModelMapFactory businessMapFactory) {
this.businessMapFactory = businessMapFactory; this.businessMapFactory = businessMapFactory;
} }
private TestPlanScriptResultService getTestPlanScriptResultService() { private TestPlanScriptResultService getTestPlanScriptResultService() {
return testPlanScriptResultService; return testPlanScriptResultService;
} }
@Autowired @Autowired
private void setTestPlanScriptResultService( private void setTestPlanScriptResultService(
TestPlanScriptResultService testPlanScriptResultService) { TestPlanScriptResultService testPlanScriptResultService) {
this.testPlanScriptResultService = testPlanScriptResultService; this.testPlanScriptResultService = testPlanScriptResultService;
} }
@RequestMapping(value = "/runTestPlanWithTestPlanModel", method = { @RequestMapping(value = "/run", method = {
RequestMethod.POST, RequestMethod.GET }) RequestMethod.POST, RequestMethod.GET })
@ResponseStatus(value = HttpStatus.OK) @ResponseStatus(value = HttpStatus.OK)
@ResponseBody @ResponseBody
public TestPlanResultModel runTestPlanWithTestPlanModel( public TestPlanResultModel runTestPlanWithTestPlanModel(
@RequestBody TestPlanModel testPlanBusinessModel) @RequestBody TestPlanModel testPlanBusinessModel)
throws Bench4QException { throws Bench4QException {
if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) { if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) {
throw new Bench4QException(HAVE_NO_POWER, throw new Bench4QException(HAVE_NO_POWER,
"You don't have enough power to run a test plan!", "You don't have enough power to run a test plan!",
"/runTestPlanWithTestPlanModel"); "/run");
} }
UUID testPlanRunID = this.getTestPlanRunner().runWith( UUID testPlanRunID = this.getTestPlanRunner().runWith(
testPlanBusinessModel, this.getPrincipal()); testPlanBusinessModel, this.getPrincipal());
if (testPlanRunID == null) { if (testPlanRunID == null) {
throw new Bench4QException("TestPlan_Commit_Error", throw new Bench4QException("TestPlan_Commit_Error",
"There is an exception when commit the test plan", "There is an exception when commit the test plan",
"/runTestPlanWithTestPlanModel"); "/run");
} }
return buildResponseModel(this.getTestPlanService() return buildResponseModel(this.getTestPlanService()
.queryTestPlanStatus(testPlanRunID), testPlanRunID, null, .queryTestPlanStatus(testPlanRunID), testPlanRunID, null,
testPlanBusinessModel.getMonitorModels()); testPlanBusinessModel.getMonitorModels());
} }
private TestPlanResultModel buildResponseModel( private TestPlanResultModel buildResponseModel(
TestPlanStatus currentStatus, UUID testPlanId, TestPlanStatus currentStatus, UUID testPlanId,
List<ScriptHandleModel> scripts, List<MonitorModel> monitorModels) { List<ScriptHandleModel> scripts, List<MonitorModel> monitorModels) {
TestPlanResultModel result = new TestPlanResultModel(); TestPlanResultModel result = new TestPlanResultModel();
result.setCurrentStatus(currentStatus); result.setCurrentStatus(currentStatus);
result.setTestPlanId(testPlanId); result.setTestPlanId(testPlanId);
result.setScripts(scripts); result.setScripts(scripts);
result.setMonitorModels(monitorModels); result.setMonitorModels(monitorModels);
return result; return result;
} }
@RequestMapping(value = "/getRunningInfo", method = { RequestMethod.GET, @RequestMapping(value = "/getRunningInfo", method = { RequestMethod.GET,
RequestMethod.POST }) RequestMethod.POST })
@ResponseStatus(value = HttpStatus.OK) @ResponseStatus(value = HttpStatus.OK)
@ResponseBody @ResponseBody
public TestPlanResultModel getTestPlanRunningInfo( public TestPlanResultModel getTestPlanRunningInfo(
@RequestParam UUID testPlanId) throws Bench4QException { @RequestParam UUID testPlanId) throws Bench4QException {
if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) { if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) {
throw new Bench4QException(HAVE_NO_POWER, throw new Bench4QException(HAVE_NO_POWER,
"You have not power to get test plan running info", "You have not power to get test plan running info",
"/getRunningInfo"); "/getRunningInfo");
} }
return this.getTestPlanService().buildResultModel(testPlanId); return this.getTestPlanService().buildResultModel(testPlanId);
} }
@RequestMapping(value = "/scriptBrief/{testPlanId}/{scriptId}/{duationBegin}", method = RequestMethod.GET) @RequestMapping(value = "/scriptBrief/{testPlanId}/{scriptId}/{duationBegin}", method = RequestMethod.GET)
@ResponseStatus(value = HttpStatus.OK) @ResponseStatus(value = HttpStatus.OK)
@ResponseBody @ResponseBody
public TestPlanScriptBriefResultModel getScriptBrief( public TestPlanScriptBriefResultModel getScriptBrief(
@PathVariable UUID testPlanId, @PathVariable int scriptId, @PathVariable UUID testPlanId, @PathVariable int scriptId,
@PathVariable long duationBegin) throws Bench4QException, @PathVariable long duationBegin) throws Bench4QException,
NullPointerException { NullPointerException {
if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) { if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) {
throw new Bench4QException(HAVE_NO_POWER, throw new Bench4QException(HAVE_NO_POWER,
"You have not power to get test plan script brief", "You have not power to get test plan script brief",
"/getRunningInfo"); "/getRunningInfo");
} }
List<ScriptBriefResultModel> scriptBriefResultModels = this List<ScriptBriefResultModel> scriptBriefResultModels = this
.getTestPlanScriptResultService().loadScriptBriefWithDuation( .getTestPlanScriptResultService().loadScriptBriefWithDuation(
testPlanId, scriptId, duationBegin); testPlanId, scriptId, duationBegin);
System.out.println("Script Result Size : " System.out.println("Script Result Size : "
+ scriptBriefResultModels.size()); + scriptBriefResultModels.size());
TestPlanScriptBriefResultModel ret = new TestPlanScriptBriefResultModel(); TestPlanScriptBriefResultModel ret = new TestPlanScriptBriefResultModel();
ret.setScriptBriefResultModels(scriptBriefResultModels); ret.setScriptBriefResultModels(scriptBriefResultModels);
return ret; return ret;
} }
@RequestMapping(value = "/getBehaviorsBrief/{testPlanRunID}/{scriptId}") @RequestMapping(value = "/getBehaviorsBrief/{testPlanRunID}/{scriptId}")
@ResponseBody @ResponseBody
public ScriptBehaviorsBriefModel getBehaviorsBrief( public ScriptBehaviorsBriefModel getBehaviorsBrief(
@PathVariable UUID testPlanRunID, @PathVariable int scriptId) @PathVariable UUID testPlanRunID, @PathVariable int scriptId)
throws Bench4QException, NullPointerException { throws Bench4QException, NullPointerException {
if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) { if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) {
throw new Bench4QException(HAVE_NO_POWER, EXCEPTION_HAPPEND throw new Bench4QException(HAVE_NO_POWER, EXCEPTION_HAPPEND
+ "when get behaviors's brief", "/getBehaviorsBrief"); + "when get behaviors's brief", "/getBehaviorsBrief");
} }
ScriptBehaviorsBriefModel result = this ScriptBehaviorsBriefModel result = this
.getTestPlanScriptResultService() .getTestPlanScriptResultService()
.getLatestScriptBehaviorsBrief(testPlanRunID, scriptId); .getLatestScriptBehaviorsBrief(testPlanRunID, scriptId);
return result; return result;
} }
@RequestMapping(value = "/pagesBrief/{testPlanRunId}/{scriptId}") @RequestMapping(value = "/pagesBrief/{testPlanRunId}/{scriptId}")
@ResponseBody @ResponseBody
public ScriptPagesBriefModel getPagesBrief( public ScriptPagesBriefModel getPagesBrief(
@PathVariable UUID testPlanRunId, @PathVariable int scriptId) @PathVariable UUID testPlanRunId, @PathVariable int scriptId)
throws Bench4QException { throws Bench4QException {
if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) { if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) {
throw new Bench4QException(HAVE_NO_POWER, EXCEPTION_HAPPEND throw new Bench4QException(HAVE_NO_POWER, EXCEPTION_HAPPEND
+ "when get behaviors's brief", "/getBehaviorsBrief"); + "when get behaviors's brief", "/getBehaviorsBrief");
} }
ScriptPagesBriefModel pagesBriefModel = this ScriptPagesBriefModel pagesBriefModel = this
.getTestPlanScriptResultService().getLatestScriptPagesBrief( .getTestPlanScriptResultService().getLatestScriptPagesBrief(
testPlanRunId, scriptId); testPlanRunId, scriptId);
return pagesBriefModel; return pagesBriefModel;
} }
@RequestMapping(value = "/loadTestPlans", method = { RequestMethod.GET, @RequestMapping(value = "/loadTestPlans", method = { RequestMethod.GET,
RequestMethod.POST }) RequestMethod.POST })
@ResponseStatus(value = HttpStatus.OK) @ResponseStatus(value = HttpStatus.OK)
@ResponseBody @ResponseBody
public TestPlanResponseModel loadTestPlans() { public TestPlanResponseModel loadTestPlans() {
if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) { if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) {
return buildTestPlanResponseModel(false, "no scope", null); return buildTestPlanResponseModel(false, "no scope", null);
} }
List<TestPlan> testPlanDBs = this.testPlanService.loadTestPlans(this List<TestPlan> testPlanDBs = this.testPlanService.loadTestPlans(this
.getPrincipal()); .getPrincipal());
return testPlanDBs == null ? buildTestPlanResponseModel(false, return testPlanDBs == null ? buildTestPlanResponseModel(false,
"exception", null) : buildTestPlanResponseModel(true, null, "exception", null) : buildTestPlanResponseModel(true, null,
testPlanDBs); testPlanDBs);
} }
@RequestMapping(value = "/queryTestPlan/{runId}", method = RequestMethod.GET) @RequestMapping(value = "/queryTestPlan/{runId}", method = RequestMethod.GET)
@ResponseStatus(value = HttpStatus.OK) @ResponseStatus(value = HttpStatus.OK)
@ResponseBody @ResponseBody
public TestPlanDBModel queryTestPlan(@PathVariable UUID runId) public TestPlanDBModel queryTestPlan(@PathVariable UUID runId)
throws Bench4QException { throws Bench4QException {
if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) { if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) {
throw new Bench4QException(HAVE_NO_POWER, HAVE_NO_POWER, throw new Bench4QException(HAVE_NO_POWER, HAVE_NO_POWER,
"/queryTestPlan/{runId}"); "/queryTestPlan/{runId}");
} }
return this.getTestPlanService().getTestPlanDBModel(runId); return this.getTestPlanService().getTestPlanDBModel(runId);
} }
@RequestMapping(value = "/removeTestPlanFromPool", method = { @RequestMapping(value = "/removeTestPlanFromPool", method = {
RequestMethod.GET, RequestMethod.POST }) RequestMethod.GET, RequestMethod.POST })
@ResponseStatus(value = HttpStatus.OK) @ResponseStatus(value = HttpStatus.OK)
@ResponseBody @ResponseBody
public TestPlanResponseModel removeTestPlanFromPool(int testPlanId) { public TestPlanResponseModel removeTestPlanFromPool(int testPlanId) {
if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) { if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) {
return buildTestPlanResponseModel(false, "no scope", null); return buildTestPlanResponseModel(false, "no scope", null);
} }
return buildTestPlanResponseModel( return buildTestPlanResponseModel(
this.testPlanService.removeTestPlanInDB(testPlanId), null, null); this.testPlanService.removeTestPlanInDB(testPlanId), null, null);
} }
private TestPlanResponseModel buildTestPlanResponseModel(boolean success, private TestPlanResponseModel buildTestPlanResponseModel(boolean success,
String failCause, List<TestPlan> testPlanDBs) { String failCause, List<TestPlan> testPlanDBs) {
TestPlanResponseModel result = new TestPlanResponseModel(); TestPlanResponseModel result = new TestPlanResponseModel();
result.setSuccess(success); result.setSuccess(success);
result.setFailCause(failCause); result.setFailCause(failCause);
List<TestPlanDBModel> modelList = new ArrayList<TestPlanDBModel>(); List<TestPlanDBModel> modelList = new ArrayList<TestPlanDBModel>();
if (testPlanDBs != null) { if (testPlanDBs != null) {
for (TestPlan testPlanDB : testPlanDBs) { for (TestPlan testPlanDB : testPlanDBs) {
modelList.add(this.getBusinessMapFactory().toModel(testPlanDB)); modelList.add(this.getBusinessMapFactory().toModel(testPlanDB));
} }
} }
result.setTestPlanDBModels(modelList); result.setTestPlanDBModels(modelList);
return result; return result;
} }
@RequestMapping(value = "/getTestPlanReport", method = { RequestMethod.GET, @RequestMapping(value = "/getTestPlanReport", method = { RequestMethod.GET,
RequestMethod.POST }) RequestMethod.POST })
@ResponseStatus(value = HttpStatus.OK) @ResponseStatus(value = HttpStatus.OK)
@ResponseBody @ResponseBody
public void getTestPlanReport(HttpServletResponse response, public void getTestPlanReport(HttpServletResponse response,
@RequestParam UUID testPlanRunID) throws Bench4QException { @RequestParam UUID testPlanRunID) throws Bench4QException {
if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) { if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) {
throw new Bench4QException(HAVE_NO_POWER, throw new Bench4QException(HAVE_NO_POWER,
"You have no power to get test plan report", "You have no power to get test plan report",
"/getTestPlanReport"); "/getTestPlanReport");
} }
buildFileStream(response, testPlanRunID, this.getReportService() buildFileStream(response, testPlanRunID, this.getReportService()
.createReport(testPlanRunID)); .createReport(testPlanRunID));
} }
private void buildFileStream(HttpServletResponse response, private void buildFileStream(HttpServletResponse response,
UUID testPlanRunID, byte[] pdfBuffer) { UUID testPlanRunID, byte[] pdfBuffer) {
try { try {
ServletOutputStream outputStream = response.getOutputStream(); ServletOutputStream outputStream = response.getOutputStream();
response.reset(); response.reset();
response.setHeader("Content-disposition", "attachment; filename=\"" response.setHeader("Content-disposition", "attachment; filename=\""
+ testPlanRunID.toString() + ".pdf\""); + testPlanRunID.toString() + ".pdf\"");
response.addHeader("Content-Length", "" + pdfBuffer.length); response.addHeader("Content-Length", "" + pdfBuffer.length);
this.logger.info("report of test plan " + testPlanRunID.toString() this.logger.info("report of test plan " + testPlanRunID.toString()
+ " length is: " + pdfBuffer.length); + " length is: " + pdfBuffer.length);
response.setContentType("application/pdf"); response.setContentType("application/pdf");
outputStream.write(pdfBuffer); outputStream.write(pdfBuffer);
outputStream.flush(); outputStream.flush();
outputStream.close(); outputStream.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
@RequestMapping(value = "/scriptBrief/{testPlanId}/{scriptId}/latestResult") @RequestMapping(value = "/scriptBrief/{testPlanId}/{scriptId}/latestResult")
@ResponseStatus(value = HttpStatus.OK) @ResponseStatus(value = HttpStatus.OK)
@ResponseBody @ResponseBody
public ScriptBriefResultModel getLatestScriptResult( public ScriptBriefResultModel getLatestScriptResult(
@PathVariable UUID testPlanId, @PathVariable int scriptId) @PathVariable UUID testPlanId, @PathVariable int scriptId)
throws Bench4QException { throws Bench4QException {
guardHasAuthentication( guardHasAuthentication(
"You have not power to get test plan script brief", "You have not power to get test plan script brief",
"/getLatestScriptResult"); "/getLatestScriptResult");
return this.getTestPlanScriptResultService() return this.getTestPlanScriptResultService()
.getLatestScriptBriefResultModel(testPlanId, scriptId); .getLatestScriptBriefResultModel(testPlanId, scriptId);
} }
@RequestMapping(value = "/stop/{testPlanId}") @RequestMapping(value = "/stop/{testPlanId}")
@ResponseStatus(value = HttpStatus.OK) @ResponseStatus(value = HttpStatus.OK)
@ResponseBody @ResponseBody
public TestPlanResponseModel stop(@PathVariable UUID testPlanId) public TestPlanResponseModel stop(@PathVariable UUID testPlanId)
throws Bench4QException { throws Bench4QException {
guardHasAuthentication("You have no power to stop test plan", guardHasAuthentication("You have no power to stop test plan",
"/stop/{testPlanId}"); "/stop/{testPlanId}");
guardIsTheOwner(testPlanId); guardIsTheOwner(testPlanId);
return buildTestPlanResponseModel( return buildTestPlanResponseModel(
this.getTestPlanRunner().stop(testPlanId), "", this.getTestPlanRunner().stop(testPlanId), "",
Collections.<TestPlan> emptyList()); Collections.<TestPlan> emptyList());
} }
private void guardIsTheOwner(UUID testPlanId) { private void guardIsTheOwner(UUID testPlanId) {
if (!getPrincipal().getUserName().equals( if (!getPrincipal().getUserName().equals(
this.getTestPlanService().getTestPlanDBModel(testPlanId) this.getTestPlanService().getTestPlanDBModel(testPlanId)
.getUserModel().getUserName())) { .getUserModel().getUserName())) {
throw new Bench4QRunTimeException("You are not the owner"); throw new Bench4QRunTimeException("You are not the owner");
} }
} }
} }

View File

@ -29,13 +29,13 @@ public class ProxyServer implements Runnable {
public void removeObserver(Observer proxy) { public void removeObserver(Observer proxy) {
this.listeners.removeElement(proxy); this.listeners.removeElement(proxy);
} }
public void processRequest(HttpRequestHeader header, byte[] requestBody) public void processRequest(HttpRequestHeader header, byte[] requestBody)
throws Exception { throws Exception {
for (Enumeration<Observer> e = this.listeners.elements(); e for (Enumeration<Observer> e = this.listeners.elements(); e
.hasMoreElements();) { .hasMoreElements();) {
Observer pl = (Observer) e.nextElement(); Observer pl = (Observer) e.nextElement();
pl.processRequest(header, requestBody); pl.processRequest(header, requestBody);
} }
} }

View File

@ -8,6 +8,7 @@ import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import org.bench4q.share.models.agent.scriptrecord.PageModel; import org.bench4q.share.models.agent.scriptrecord.PageModel;
import org.bench4q.share.models.agent.scriptrecord.TestScheduleModel;
import org.bench4q.share.models.agent.scriptrecord.UsePluginModel; import org.bench4q.share.models.agent.scriptrecord.UsePluginModel;
@XmlRootElement(name = "runScenario") @XmlRootElement(name = "runScenario")
@ -15,6 +16,7 @@ public class RunScenarioModel {
private int poolSize; private int poolSize;
private List<UsePluginModel> usePlugins; private List<UsePluginModel> usePlugins;
private List<PageModel> pages; private List<PageModel> pages;
private TestScheduleModel scheduleModel;
@XmlElement @XmlElement
public int getPoolSize() { public int getPoolSize() {
@ -45,6 +47,15 @@ public class RunScenarioModel {
this.pages = pages; this.pages = pages;
} }
@XmlElement
public TestScheduleModel getScheduleModel() {
return scheduleModel;
}
public void setScheduleModel(TestScheduleModel scheduleModel) {
this.scheduleModel = scheduleModel;
}
public RunScenarioModel() { public RunScenarioModel() {
this.setUsePlugins(new LinkedList<UsePluginModel>()); this.setUsePlugins(new LinkedList<UsePluginModel>());
this.setPages(new LinkedList<PageModel>()); this.setPages(new LinkedList<PageModel>());

View File

@ -1,44 +0,0 @@
package org.bench4q.share.models.agent.scriptrecord;
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 RunScenarioModelNew {
private int poolSize;
private List<UsePluginModel> usePlugins;
private List<BehaviorModel> behaviors;
@XmlElement
public int getPoolSize() {
return poolSize;
}
public void setPoolSize(int poolSize) {
this.poolSize = poolSize;
}
@XmlElementWrapper(name = "plugins")
@XmlElement(name = "plugin")
public List<UsePluginModel> getUsePlugins() {
return usePlugins;
}
public void setUsePlugins(List<UsePluginModel> usePlugins) {
this.usePlugins = usePlugins;
}
@XmlElementWrapper(name = "behaviors")
@XmlElement(name = "behavior")
public List<BehaviorModel> getBehaviors() {
return behaviors;
}
public void setBehaviors(List<BehaviorModel> behaviors) {
this.behaviors = behaviors;
}
}

View File

@ -0,0 +1,52 @@
package org.bench4q.share.models.agent.scriptrecord;
import java.util.LinkedList;
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 TestScheduleModel {
private List<PointModel> points;
@XmlElementWrapper(name = "points")
@XmlElement(name = "point")
public List<PointModel> getPoints() {
return points;
}
public void setPoints(List<PointModel> points) {
this.points = points;
}
public TestScheduleModel() {
this.points = new LinkedList<PointModel>();
}
@XmlRootElement
public static class PointModel {
private int time;
private int load;
@XmlElement
public int getTime() {
return time;
}
public void setTime(int time) {
this.time = time;
}
@XmlElement
public int getLoad() {
return load;
}
public void setLoad(int load) {
this.load = load;
}
}
}

View File

@ -1,271 +1,271 @@
package org.bench4q.web.masterMessager; package org.bench4q.web.masterMessager;
import java.io.IOException; import java.io.IOException;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import javax.xml.bind.JAXBException; import javax.xml.bind.JAXBException;
import org.bench4q.share.communication.HttpRequester.HttpResponse; import org.bench4q.share.communication.HttpRequester.HttpResponse;
import org.bench4q.share.helper.MarshalHelper; import org.bench4q.share.helper.MarshalHelper;
import org.bench4q.share.models.master.TestPlanDBModel; import org.bench4q.share.models.master.TestPlanDBModel;
import org.bench4q.share.models.master.TestPlanResponseModel; import org.bench4q.share.models.master.TestPlanResponseModel;
import org.bench4q.share.models.master.TestPlanResultModel; import org.bench4q.share.models.master.TestPlanResultModel;
import org.bench4q.share.models.master.TestPlanScriptBriefResultModel; import org.bench4q.share.models.master.TestPlanScriptBriefResultModel;
import org.bench4q.share.models.master.statistics.ScriptBehaviorsBriefModel; import org.bench4q.share.models.master.statistics.ScriptBehaviorsBriefModel;
import org.bench4q.share.models.master.statistics.ScriptBriefResultModel; import org.bench4q.share.models.master.statistics.ScriptBriefResultModel;
import org.bench4q.share.models.master.statistics.ScriptPagesBriefModel; import org.bench4q.share.models.master.statistics.ScriptPagesBriefModel;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@Component @Component
public class TestPlanMessager extends MasterMessager { public class TestPlanMessager extends MasterMessager {
public TestPlanMessager() { public TestPlanMessager() {
super(MasterAddressManamger.getMasterAddress() + "/testPlan"); super(MasterAddressManamger.getMasterAddress() + "/testPlan");
} }
public HttpResponse loadReport(String accessToken, String testPlanId) { public HttpResponse loadReport(String accessToken, String testPlanId) {
String url = this.getBaseUrl() + "/getTestPlanReport"; String url = this.getBaseUrl() + "/getTestPlanReport";
HttpResponse httpResponse = null; HttpResponse httpResponse = null;
try { try {
Map<String, String> params = new HashMap<String, String>(); Map<String, String> params = new HashMap<String, String>();
params.put("testPlanRunID", testPlanId); params.put("testPlanRunID", testPlanId);
httpResponse = this.getHttpRequester().sendGet(url, params, httpResponse = this.getHttpRequester().sendGet(url, params,
makeAccessTockenMap(accessToken)); makeAccessTockenMap(accessToken));
if (!validateHttpResponse(httpResponse)) { if (!validateHttpResponse(httpResponse)) {
return null; return null;
} }
return httpResponse; return httpResponse;
} catch (Exception e) { } catch (Exception e) {
this.handleException(httpResponse, e); this.handleException(httpResponse, e);
return null; return null;
} }
} }
public TestPlanResultModel runTestPlan(String accessToken, public TestPlanResultModel runTestPlan(String accessToken,
String testPlanXmlContent) { String testPlanXmlContent) {
String url = this.getBaseUrl() + "/runTestPlanWithTestPlanModel"; String url = this.getBaseUrl() + "/run";
HttpResponse httpResponse = null; HttpResponse httpResponse = null;
try { try {
httpResponse = this.getHttpRequester().sendPostXml(url, httpResponse = this.getHttpRequester().sendPostXml(url,
testPlanXmlContent, makeAccessTockenMap(accessToken)); testPlanXmlContent, makeAccessTockenMap(accessToken));
if (!validateHttpResponse(httpResponse)) if (!validateHttpResponse(httpResponse))
return null; return null;
return extractTestPlanResultModel(httpResponse); return extractTestPlanResultModel(httpResponse);
} catch (Exception e) { } catch (Exception e) {
this.handleException(httpResponse, e); this.handleException(httpResponse, e);
return null; return null;
} }
} }
public TestPlanResultModel getRunningTestInfo(String accessToken, public TestPlanResultModel getRunningTestInfo(String accessToken,
String testPlanId) { String testPlanId) {
String url = this.getBaseUrl() + "/getRunningInfo"; String url = this.getBaseUrl() + "/getRunningInfo";
Map<String, String> params = new HashMap<String, String>(); Map<String, String> params = new HashMap<String, String>();
params.put("testPlanId", testPlanId); params.put("testPlanId", testPlanId);
return this.getTestPlanResultModelByPost(url, params, accessToken); return this.getTestPlanResultModelByPost(url, params, accessToken);
} }
public TestPlanScriptBriefResultModel getScriptBriefResult( public TestPlanScriptBriefResultModel getScriptBriefResult(
String accessToken, String testPlanId, String scriptId, String accessToken, String testPlanId, String scriptId,
String duationBegin) { String duationBegin) {
String url = this.getBaseUrl() + "/scriptBrief" + "/" + testPlanId String url = this.getBaseUrl() + "/scriptBrief" + "/" + testPlanId
+ "/" + scriptId + "/" + duationBegin; + "/" + scriptId + "/" + duationBegin;
HttpResponse httpResponse = null; HttpResponse httpResponse = null;
try { try {
httpResponse = this.getHttpRequester().sendGet(url, null, httpResponse = this.getHttpRequester().sendGet(url, null,
makeAccessTockenMap(accessToken)); makeAccessTockenMap(accessToken));
if (!validateHttpResponse(httpResponse)) { if (!validateHttpResponse(httpResponse)) {
handleInvalidatedResponse(url); handleInvalidatedResponse(url);
return null; return null;
} }
return (TestPlanScriptBriefResultModel) MarshalHelper.unmarshal( return (TestPlanScriptBriefResultModel) MarshalHelper.unmarshal(
TestPlanScriptBriefResultModel.class, TestPlanScriptBriefResultModel.class,
httpResponse.getContent()); httpResponse.getContent());
} catch (Exception e) { } catch (Exception e) {
this.handleException(httpResponse, e); this.handleException(httpResponse, e);
return null; return null;
} }
} }
public ScriptBehaviorsBriefModel getScriptBehaviorsBriefResult( public ScriptBehaviorsBriefModel getScriptBehaviorsBriefResult(
String accessToken, String testPlanId, String scriptId) { String accessToken, String testPlanId, String scriptId) {
String url = this.getBaseUrl() + "/getBehaviorsBrief" + "/" String url = this.getBaseUrl() + "/getBehaviorsBrief" + "/"
+ testPlanId + "/" + scriptId; + testPlanId + "/" + scriptId;
HttpResponse httpResponse = null; HttpResponse httpResponse = null;
try { try {
httpResponse = this.getHttpRequester().sendGet(url, null, httpResponse = this.getHttpRequester().sendGet(url, null,
makeAccessTockenMap(accessToken)); makeAccessTockenMap(accessToken));
if (!validateHttpResponse(httpResponse)) if (!validateHttpResponse(httpResponse))
return null; return null;
return (ScriptBehaviorsBriefModel) MarshalHelper.unmarshal( return (ScriptBehaviorsBriefModel) MarshalHelper.unmarshal(
ScriptBehaviorsBriefModel.class, httpResponse.getContent()); ScriptBehaviorsBriefModel.class, httpResponse.getContent());
} catch (Exception e) { } catch (Exception e) {
this.handleException(httpResponse, e); this.handleException(httpResponse, e);
return null; return null;
} }
} }
public TestPlanDBModel queryTestPlanById(String accessToken, public TestPlanDBModel queryTestPlanById(String accessToken,
String testPlanRunId) { String testPlanRunId) {
String url = this.getBaseUrl() + "/queryTestPlan" + "/" + testPlanRunId; String url = this.getBaseUrl() + "/queryTestPlan" + "/" + testPlanRunId;
HttpResponse httpResponse = null; HttpResponse httpResponse = null;
try { try {
httpResponse = this.getHttpRequester().sendGet(url, null, httpResponse = this.getHttpRequester().sendGet(url, null,
makeAccessTockenMap(accessToken)); makeAccessTockenMap(accessToken));
if (!validateHttpResponse(httpResponse)) { if (!validateHttpResponse(httpResponse)) {
handleInvalidatedResponse(url); handleInvalidatedResponse(url);
return null; return null;
} }
return (TestPlanDBModel) MarshalHelper.unmarshal( return (TestPlanDBModel) MarshalHelper.unmarshal(
TestPlanDBModel.class, httpResponse.getContent()); TestPlanDBModel.class, httpResponse.getContent());
} catch (Exception e) { } catch (Exception e) {
handleException(httpResponse, e); handleException(httpResponse, e);
return null; return null;
} }
} }
public TestPlanResponseModel deleteTestPlan(String accessToken, public TestPlanResponseModel deleteTestPlan(String accessToken,
String testPlanId) { String testPlanId) {
String url = this.getBaseUrl() + "/removeTestPlanFromPool"; String url = this.getBaseUrl() + "/removeTestPlanFromPool";
Map<String, String> params = new HashMap<String, String>(); Map<String, String> params = new HashMap<String, String>();
params.put("testPlanId", testPlanId); params.put("testPlanId", testPlanId);
return getTestPlanResponseModel(url, params, accessToken); return getTestPlanResponseModel(url, params, accessToken);
} }
public TestPlanResponseModel loadTestPlans(String accessToken) { public TestPlanResponseModel loadTestPlans(String accessToken) {
String url = this.getBaseUrl() + "/loadTestPlans"; String url = this.getBaseUrl() + "/loadTestPlans";
return getTestPlanResponseModel(url, null, accessToken); return getTestPlanResponseModel(url, null, accessToken);
} }
public HttpResponse getTestPlanReport(String accessToken, public HttpResponse getTestPlanReport(String accessToken,
String testPlanRunId) { String testPlanRunId) {
String url = this.getBaseUrl() + "/getTestPlanReport"; String url = this.getBaseUrl() + "/getTestPlanReport";
Map<String, String> params = new HashMap<String, String>(); Map<String, String> params = new HashMap<String, String>();
params.put("testPlanRunID", testPlanRunId); params.put("testPlanRunID", testPlanRunId);
HttpResponse httpResponse = null; HttpResponse httpResponse = null;
try { try {
httpResponse = this.getHttpRequester().sendPost(url, params, httpResponse = this.getHttpRequester().sendPost(url, params,
makeAccessTockenMap(accessToken)); makeAccessTockenMap(accessToken));
if (!validateHttpResponse(httpResponse)) if (!validateHttpResponse(httpResponse))
return null; return null;
return httpResponse; return httpResponse;
} catch (IOException e) { } catch (IOException e) {
this.handleException(httpResponse, e); this.handleException(httpResponse, e);
return null; return null;
} }
} }
private TestPlanResponseModel getTestPlanResponseModel(String url, private TestPlanResponseModel getTestPlanResponseModel(String url,
Map<String, String> params, String accessToken) { Map<String, String> params, String accessToken) {
HttpResponse httpResponse = null; HttpResponse httpResponse = null;
try { try {
httpResponse = this.getHttpRequester().sendPost(url, params, httpResponse = this.getHttpRequester().sendPost(url, params,
makeAccessTockenMap(accessToken)); makeAccessTockenMap(accessToken));
if (!validateHttpResponse(httpResponse)) { if (!validateHttpResponse(httpResponse)) {
handleInvalidatedResponse(url); handleInvalidatedResponse(url);
return null; return null;
} }
return extractTestPlanResponseModel(httpResponse); return extractTestPlanResponseModel(httpResponse);
} catch (Exception e) { } catch (Exception e) {
this.handleException(httpResponse, e); this.handleException(httpResponse, e);
return createFailTestPlanResponseModel(); return createFailTestPlanResponseModel();
} }
} }
private TestPlanResponseModel createFailTestPlanResponseModel() { private TestPlanResponseModel createFailTestPlanResponseModel() {
TestPlanResponseModel testPlanResponseModel = new TestPlanResponseModel(); TestPlanResponseModel testPlanResponseModel = new TestPlanResponseModel();
testPlanResponseModel.setSuccess(false); testPlanResponseModel.setSuccess(false);
testPlanResponseModel.setFailCause(""); testPlanResponseModel.setFailCause("");
return testPlanResponseModel; return testPlanResponseModel;
} }
private TestPlanResultModel getTestPlanResultModelByPost(String url, private TestPlanResultModel getTestPlanResultModelByPost(String url,
Map<String, String> params, String accessToken) { Map<String, String> params, String accessToken) {
HttpResponse httpResponse = null; HttpResponse httpResponse = null;
try { try {
httpResponse = this.getHttpRequester().sendPost(url, params, httpResponse = this.getHttpRequester().sendPost(url, params,
makeAccessTockenMap(accessToken)); makeAccessTockenMap(accessToken));
if (!validateHttpResponse(httpResponse)) if (!validateHttpResponse(httpResponse))
return null; return null;
return extractTestPlanResultModel(httpResponse); return extractTestPlanResultModel(httpResponse);
} catch (Exception e) { } catch (Exception e) {
this.handleException(httpResponse, e); this.handleException(httpResponse, e);
return null; return null;
} }
} }
private TestPlanResponseModel extractTestPlanResponseModel( private TestPlanResponseModel extractTestPlanResponseModel(
HttpResponse httpResponse) throws JAXBException, HttpResponse httpResponse) throws JAXBException,
UnsupportedEncodingException { UnsupportedEncodingException {
return (TestPlanResponseModel) MarshalHelper.unmarshal( return (TestPlanResponseModel) MarshalHelper.unmarshal(
TestPlanResponseModel.class, httpResponse.getContent()); TestPlanResponseModel.class, httpResponse.getContent());
} }
private TestPlanResultModel extractTestPlanResultModel( private TestPlanResultModel extractTestPlanResultModel(
HttpResponse httpResponse) throws JAXBException, HttpResponse httpResponse) throws JAXBException,
UnsupportedEncodingException { UnsupportedEncodingException {
return (TestPlanResultModel) MarshalHelper.unmarshal( return (TestPlanResultModel) MarshalHelper.unmarshal(
TestPlanResultModel.class, httpResponse.getContent()); TestPlanResultModel.class, httpResponse.getContent());
} }
public ScriptBriefResultModel getLatestScriptBriefResult( public ScriptBriefResultModel getLatestScriptBriefResult(
String accessToken, String testPlanId, String scriptId) { String accessToken, String testPlanId, String scriptId) {
String url = this.baseUrl + "/scriptBrief" + "/" + testPlanId + "/" String url = this.baseUrl + "/scriptBrief" + "/" + testPlanId + "/"
+ scriptId + "/latestResult"; + scriptId + "/latestResult";
HttpResponse httpResponse = null; HttpResponse httpResponse = null;
try { try {
httpResponse = this.getHttpRequester().sendGet(url, null, httpResponse = this.getHttpRequester().sendGet(url, null,
makeAccessTockenMap(accessToken)); makeAccessTockenMap(accessToken));
if (!validateHttpResponse(httpResponse)) { if (!validateHttpResponse(httpResponse)) {
handleInvalidatedResponse(url); handleInvalidatedResponse(url);
return null; return null;
} }
return (ScriptBriefResultModel) MarshalHelper.tryUnmarshal( return (ScriptBriefResultModel) MarshalHelper.tryUnmarshal(
ScriptBriefResultModel.class, httpResponse.getContent()); ScriptBriefResultModel.class, httpResponse.getContent());
} catch (Exception e) { } catch (Exception e) {
handleException(httpResponse, e); handleException(httpResponse, e);
return null; return null;
} }
} }
public ScriptPagesBriefModel getScriptPageBriefModel(String accessToken, public ScriptPagesBriefModel getScriptPageBriefModel(String accessToken,
String testPlanId, String scriptId) { String testPlanId, String scriptId) {
String url = this.baseUrl + "/pagesBrief" + "/" + testPlanId + "/" String url = this.baseUrl + "/pagesBrief" + "/" + testPlanId + "/"
+ scriptId; + scriptId;
HttpResponse httpResponse = null; HttpResponse httpResponse = null;
try { try {
httpResponse = this.getHttpRequester().sendGet(url, null, httpResponse = this.getHttpRequester().sendGet(url, null,
makeAccessTockenMap(accessToken)); makeAccessTockenMap(accessToken));
if (!validateHttpResponse(httpResponse)) { if (!validateHttpResponse(httpResponse)) {
handleInvalidatedResponse(url); handleInvalidatedResponse(url);
return null; return null;
} }
return (ScriptPagesBriefModel) MarshalHelper.unmarshal( return (ScriptPagesBriefModel) MarshalHelper.unmarshal(
ScriptPagesBriefModel.class, httpResponse.getContent()); ScriptPagesBriefModel.class, httpResponse.getContent());
} catch (Exception e) { } catch (Exception e) {
handleException(httpResponse, e); handleException(httpResponse, e);
return null; return null;
} }
} }
public TestPlanResponseModel stopTestPlan(String accessToken, public TestPlanResponseModel stopTestPlan(String accessToken,
String testPlanRunId) { String testPlanRunId) {
String url = this.baseUrl + "/stop" + "/" + testPlanRunId; String url = this.baseUrl + "/stop" + "/" + testPlanRunId;
return getTestPlanResponseModel(url, null, accessToken); return getTestPlanResponseModel(url, null, accessToken);
} }
} }

View File

@ -1 +1 @@
masterAddress=localhost:8901 masterAddress=133.133.2.105:8901

View File

@ -1,176 +1,176 @@
package org.bench4q.web.test.masterMessager; package org.bench4q.web.test.masterMessager;
import static com.github.tomakehurst.wiremock.client.WireMock.*; import static com.github.tomakehurst.wiremock.client.WireMock.*;
import static org.junit.Assert.*; import static org.junit.Assert.*;
import org.bench4q.share.helper.MarshalHelper; import org.bench4q.share.helper.MarshalHelper;
import org.bench4q.share.models.master.TestPlanResponseModel; import org.bench4q.share.models.master.TestPlanResponseModel;
import org.bench4q.share.models.master.TestPlanResultModel; import org.bench4q.share.models.master.TestPlanResultModel;
import org.bench4q.share.models.master.statistics.ScriptBehaviorsBriefModel; import org.bench4q.share.models.master.statistics.ScriptBehaviorsBriefModel;
import org.bench4q.web.masterMessager.TestPlanMessager; import org.bench4q.web.masterMessager.TestPlanMessager;
import org.junit.AfterClass; import org.junit.AfterClass;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class) @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("file:src/test/resources/bench4qweb-servlet.xml") @ContextConfiguration("file:src/test/resources/bench4qweb-servlet.xml")
public class TestPlanMessageTest extends MessagerTestBase { public class TestPlanMessageTest extends MessagerTestBase {
private TestPlanMessager testPlanMessager; private TestPlanMessager testPlanMessager;
private String baseUrl = "/testPlan"; private String baseUrl = "/testPlan";
private String testPlanId = "testPlanId"; private String testPlanId = "testPlanId";
private String scriptId = "scriptId"; private String scriptId = "scriptId";
public TestPlanMessager getTestPlanMessager() { public TestPlanMessager getTestPlanMessager() {
return testPlanMessager; return testPlanMessager;
} }
@Autowired @Autowired
public void setTestPlanMessager(TestPlanMessager testPlanMessager) { public void setTestPlanMessager(TestPlanMessager testPlanMessager) {
this.testPlanMessager = testPlanMessager; this.testPlanMessager = testPlanMessager;
} }
@BeforeClass @BeforeClass
public static void setUp() { public static void setUp() {
startServer(); startServer();
} }
@AfterClass @AfterClass
public static void clear() { public static void clear() {
stopServer(); stopServer();
} }
@Test @Test
public void test_runTestPlan() { public void test_runTestPlan() {
String url = baseUrl + "/runTestPlanWithTestPlanModel"; String url = baseUrl + "/run";
this.getWireMock().register( this.getWireMock().register(
post(urlEqualTo(url)).willReturn( post(urlEqualTo(url)).willReturn(
aResponse().withStatus(200) aResponse().withStatus(200)
.withHeader("Content-Type", "text/xml") .withHeader("Content-Type", "text/xml")
.withBody(this.createResponse()))); .withBody(this.createResponse())));
assertNotNull(this.testPlanMessager.runTestPlan(null, "")); assertNotNull(this.testPlanMessager.runTestPlan(null, ""));
} }
@Test @Test
public void test_getRunningTestInfo() { public void test_getRunningTestInfo() {
String url = baseUrl + "/getRunningInfo"; String url = baseUrl + "/getRunningInfo";
this.getWireMock().register( this.getWireMock().register(
post(urlEqualTo(url)).withRequestBody(containing("testPlanId")) post(urlEqualTo(url)).withRequestBody(containing("testPlanId"))
.willReturn( .willReturn(
aResponse().withStatus(200) aResponse().withStatus(200)
.withHeader("Content-Type", "text/xml") .withHeader("Content-Type", "text/xml")
.withBody(this.createResponse()))); .withBody(this.createResponse())));
assertNotNull(this.testPlanMessager.getRunningTestInfo(null, "")); assertNotNull(this.testPlanMessager.getRunningTestInfo(null, ""));
} }
// @Test // @Test
// public void test_getScriptBriefResult() { // public void test_getScriptBriefResult() {
// TestPlanScriptBriefResultModel testPlanScriptBriefResultModel = new // TestPlanScriptBriefResultModel testPlanScriptBriefResultModel = new
// TestPlanScriptBriefResultModel(); // TestPlanScriptBriefResultModel();
// String response = MarshalHelper // String response = MarshalHelper
// .tryMarshal(testPlanScriptBriefResultModel); // .tryMarshal(testPlanScriptBriefResultModel);
// String url = baseUrl + '/' + testPlanId + '/' + scriptId + '/' // String url = baseUrl + '/' + testPlanId + '/' + scriptId + '/'
// + duationBegin; // + duationBegin;
// System.out.println(url); // System.out.println(url);
// this.getWireMock().register( // this.getWireMock().register(
// get(urlEqualTo(url)).willReturn( // get(urlEqualTo(url)).willReturn(
// aResponse().withStatus(200) // aResponse().withStatus(200)
// .withHeader("Content-Type", "text/xml") // .withHeader("Content-Type", "text/xml")
// .withBody(response))); // .withBody(response)));
// assertNotNull(this.testPlanMessager.getScriptBriefResult(null, // assertNotNull(this.testPlanMessager.getScriptBriefResult(null,
// testPlanId, scriptId, duationBegin)); // testPlanId, scriptId, duationBegin));
// } // }
@Test @Test
public void test_getScriptBehaviorsBriefResult() { public void test_getScriptBehaviorsBriefResult() {
ScriptBehaviorsBriefModel scriptBehaviorsBriefModel = new ScriptBehaviorsBriefModel(); ScriptBehaviorsBriefModel scriptBehaviorsBriefModel = new ScriptBehaviorsBriefModel();
scriptBehaviorsBriefModel.setFinished(true); scriptBehaviorsBriefModel.setFinished(true);
String response = MarshalHelper.tryMarshal(scriptBehaviorsBriefModel); String response = MarshalHelper.tryMarshal(scriptBehaviorsBriefModel);
String url = baseUrl +"/getBehaviorsBrief"+ '/' + testPlanId + '/' + scriptId; String url = baseUrl +"/getBehaviorsBrief"+ '/' + testPlanId + '/' + scriptId;
this.getWireMock().register( this.getWireMock().register(
get(urlEqualTo(url)).willReturn( get(urlEqualTo(url)).willReturn(
aResponse().withStatus(200) aResponse().withStatus(200)
.withHeader("Content-Type", "text/xml") .withHeader("Content-Type", "text/xml")
.withBody(response))); .withBody(response)));
assertNotNull(this.testPlanMessager.getScriptBehaviorsBriefResult(null, assertNotNull(this.testPlanMessager.getScriptBehaviorsBriefResult(null,
testPlanId, scriptId)); testPlanId, scriptId));
assertTrue(this.testPlanMessager.getScriptBehaviorsBriefResult(null, assertTrue(this.testPlanMessager.getScriptBehaviorsBriefResult(null,
testPlanId, scriptId).isFinished()); testPlanId, scriptId).isFinished());
} }
// @Test // @Test
// public void test_getPageBriefResult() { // public void test_getPageBriefResult() {
// ScriptPagesBriefModel scriptPagesBriefModel = new ScriptPagesBriefModel(); // ScriptPagesBriefModel scriptPagesBriefModel = new ScriptPagesBriefModel();
// String response = MarshalHelper.tryMarshal(scriptPagesBriefModel); // String response = MarshalHelper.tryMarshal(scriptPagesBriefModel);
// String url = baseUrl + '/' + testPlanId + '/' + scriptId; // String url = baseUrl + '/' + testPlanId + '/' + scriptId;
// this.getWireMock().register( // this.getWireMock().register(
// get(urlEqualTo(url)).willReturn( // get(urlEqualTo(url)).willReturn(
// aResponse().withStatus(200) // aResponse().withStatus(200)
// .withHeader("Content-Type", "text/xml") // .withHeader("Content-Type", "text/xml")
// .withBody(response))); // .withBody(response)));
// assertNotNull(this.testPlanMessager.getPageBriefResult(null, // assertNotNull(this.testPlanMessager.getPageBriefResult(null,
// testPlanId, scriptId)); // testPlanId, scriptId));
// } // }
// @Test // @Test
// public void test_queryTestPlanById() { // public void test_queryTestPlanById() {
// String testPlanRunId = "testPlanRunId"; // String testPlanRunId = "testPlanRunId";
// String url = baseUrl + "/queryTestPlan/" + testPlanRunId; // String url = baseUrl + "/queryTestPlan/" + testPlanRunId;
// this.getWireMock().register( // this.getWireMock().register(
// get(urlEqualTo(url)).willReturn( // get(urlEqualTo(url)).willReturn(
// aResponse().withStatus(200) // aResponse().withStatus(200)
// .withHeader("Content-Type", "text/xml") // .withHeader("Content-Type", "text/xml")
// .withBody(this.createResponse()))); // .withBody(this.createResponse())));
// assertNotNull(this.testPlanMessager.queryTestPlanById(null, // assertNotNull(this.testPlanMessager.queryTestPlanById(null,
// testPlanRunId)); // testPlanRunId));
// } // }
@Test @Test
public void test_deleteTestPlan() { public void test_deleteTestPlan() {
TestPlanResponseModel testPlanResponseModel = new TestPlanResponseModel(); TestPlanResponseModel testPlanResponseModel = new TestPlanResponseModel();
testPlanResponseModel.setSuccess(true); testPlanResponseModel.setSuccess(true);
String response = MarshalHelper.tryMarshal(testPlanResponseModel); String response = MarshalHelper.tryMarshal(testPlanResponseModel);
String url = baseUrl + "/removeTestPlanFromPool"; String url = baseUrl + "/removeTestPlanFromPool";
this.getWireMock().register( this.getWireMock().register(
post(urlEqualTo(url)).withRequestBody(containing("testPlanId")) post(urlEqualTo(url)).withRequestBody(containing("testPlanId"))
.willReturn( .willReturn(
aResponse().withStatus(200) aResponse().withStatus(200)
.withHeader("Content-Type", "text/xml") .withHeader("Content-Type", "text/xml")
.withBody(response))); .withBody(response)));
assertNotNull(this.testPlanMessager.deleteTestPlan(null, testPlanId)); assertNotNull(this.testPlanMessager.deleteTestPlan(null, testPlanId));
assertTrue(this.testPlanMessager.deleteTestPlan(null, testPlanId) assertTrue(this.testPlanMessager.deleteTestPlan(null, testPlanId)
.isSuccess()); .isSuccess());
} }
@Test @Test
public void test_loadTestPlans() { public void test_loadTestPlans() {
String url = baseUrl + "/loadTestPlans"; String url = baseUrl + "/loadTestPlans";
TestPlanResponseModel testPlanResponseModel = new TestPlanResponseModel(); TestPlanResponseModel testPlanResponseModel = new TestPlanResponseModel();
testPlanResponseModel.setSuccess(true); testPlanResponseModel.setSuccess(true);
String response = MarshalHelper.tryMarshal(testPlanResponseModel); String response = MarshalHelper.tryMarshal(testPlanResponseModel);
this.getWireMock().register( this.getWireMock().register(
post(urlEqualTo(url)).willReturn( post(urlEqualTo(url)).willReturn(
aResponse().withStatus(200) aResponse().withStatus(200)
.withHeader("Content-Type", "text/xml") .withHeader("Content-Type", "text/xml")
.withBody(response))); .withBody(response)));
assertNotNull(this.testPlanMessager.loadTestPlans(null)); assertNotNull(this.testPlanMessager.loadTestPlans(null));
assertTrue(this.testPlanMessager.loadTestPlans(null).isSuccess()); assertTrue(this.testPlanMessager.loadTestPlans(null).isSuccess());
} }
@Test @Test
public void test_getTestPlanReport() { public void test_getTestPlanReport() {
} }
public String createResponse() { public String createResponse() {
TestPlanResultModel testPlanResultModel = new TestPlanResultModel(); TestPlanResultModel testPlanResultModel = new TestPlanResultModel();
return MarshalHelper.tryMarshal(testPlanResultModel); return MarshalHelper.tryMarshal(testPlanResultModel);
} }
} }