modify the api, and need to be tested
modify the api, and need to be tested
This commit is contained in:
parent
9157b793fc
commit
6c19a07c61
|
@ -61,7 +61,7 @@ public class TestController {
|
|||
@RequestMapping(value = "/bookTest/{poolSize}", method = {
|
||||
RequestMethod.GET, RequestMethod.POST })
|
||||
@ResponseBody
|
||||
public RunScenarioResultModel bookTest(@PathVariable int poolSize, @RequestParam long startTime) {
|
||||
public RunScenarioResultModel bookTest(@PathVariable int poolSize) {
|
||||
try {
|
||||
UUID runId = UUID.randomUUID();
|
||||
this.getScenarioEngine().addRunningTestWithoutScenario(runId,
|
||||
|
@ -75,10 +75,11 @@ public class TestController {
|
|||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/submitScenarioWithParams/{runId}", method = RequestMethod.POST)
|
||||
@RequestMapping(value = "/submitScenarioWithParams/{runId}/{realStartTime}", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public String submitParams(
|
||||
@PathVariable UUID runId,
|
||||
@PathVariable long realStartTime,
|
||||
@RequestParam(value = "files[]", required = false) List<MultipartFile> files,
|
||||
@RequestParam(value = "testShedule", required = false) String scheduleContent,
|
||||
@RequestParam(value = "scenarioModel") String scenarioModel) {
|
||||
|
@ -88,7 +89,7 @@ public class TestController {
|
|||
RunScenarioModel runScenarioModel = (RunScenarioModel) MarshalHelper
|
||||
.unmarshal(RunScenarioModel.class, scenarioModel);
|
||||
this.getScenarioEngine().submitScenario(runId,
|
||||
Scenario.scenarioBuilderWithCompile(runScenarioModel));
|
||||
Scenario.scenarioBuilderWithCompile(runScenarioModel), realStartTime);
|
||||
return MarshalHelper.tryMarshal(buildWith(runId));
|
||||
} catch (Exception e) {
|
||||
logger.error("/submitScenarioWithParams", e);
|
||||
|
|
|
@ -28,7 +28,6 @@ import com.mongodb.ServerAddress;
|
|||
@Plugin("MongoDBPlugin")
|
||||
public class MongoDBPlugin {
|
||||
private final String hostName;
|
||||
private final int port;
|
||||
private final String dbName;
|
||||
private final String tableUnderTest = "users";
|
||||
|
||||
|
@ -38,7 +37,6 @@ public class MongoDBPlugin {
|
|||
@Parameter(value = "port", type = SupportTypes.Field) int port,
|
||||
@Parameter(value = "dbName", type = SupportTypes.Field) String dbName) {
|
||||
this.hostName = hostName;
|
||||
this.port = port;
|
||||
this.dbName = dbName;
|
||||
}
|
||||
|
||||
|
|
|
@ -101,8 +101,8 @@ public class ScenarioContext implements Observer {
|
|||
return scenarioContext;
|
||||
}
|
||||
|
||||
public ScenarioContext addScenrio(final Scenario scenario) {
|
||||
ScenarioContext result = new ScenarioContext(this.testId, startDate, executor, this.dataCollector, pluginManager);
|
||||
public ScenarioContext addScenrio(final Scenario scenario, final long realStartTime) {
|
||||
ScenarioContext result = new ScenarioContext(this.testId, new Date(realStartTime), executor, this.dataCollector, pluginManager);
|
||||
result.setEndDate(new Date(scenario.getSchedule().getScheduleRange() + this.getStartDate().getTime()));
|
||||
result.setFinished(this.isFinished());
|
||||
result.setScenario(scenario);
|
||||
|
|
|
@ -50,10 +50,10 @@ public class ScenarioEngine implements Observer {
|
|||
}
|
||||
}
|
||||
|
||||
public void submitScenario(UUID runId, final Scenario scenario) {
|
||||
public void submitScenario(final UUID runId, final Scenario scenario, final long realStartTime) {
|
||||
try {
|
||||
ScenarioContext old = this.getRunningTests().get(runId);
|
||||
this.getRunningTests().put(runId, old.addScenrio(scenario));
|
||||
this.getRunningTests().put(runId, old.addScenrio(scenario, realStartTime));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue