refactor
This commit is contained in:
coderfengyun 2014-09-09 17:44:44 +08:00
parent fc9222c104
commit 3c25415a9a
5 changed files with 6 additions and 7 deletions

View File

@ -24,7 +24,7 @@ public interface RunningScriptInterface {
public boolean stop();
public List<TestPlanScriptResult> doAfterRun(Date sampleTime);
public List<TestPlanScriptResult> sample(Date sampleTime);
public Date getStartTime();

View File

@ -285,7 +285,7 @@ public class TestPlan implements IAggregate {
List<Object> resultList = new LinkedList<Object>();
for (TestPlanScript testPlanScript : getTestPlanScripts()) {
List<TestPlanScriptResult> testPlanScriptResults = testPlanScript
.doAfterRun(sampleTime);
.sample(sampleTime);
if (testPlanScriptResults != null)
resultList.addAll(testPlanScriptResults);
}

View File

@ -220,7 +220,7 @@ public class TestPlanScript implements RunningScriptInterface {
.unmodifiableCollection(this.getRunningAgentsDB())));
}
public List<TestPlanScriptResult> doAfterRun(Date sampleTime) {
public List<TestPlanScriptResult> sample(Date sampleTime) {
try {
ScriptResultModel scriptResultModel = this.getSampler()
.getResultModelFromAgent();

View File

@ -106,7 +106,7 @@ public class Test_TestResultSave extends TestBase_MakeUpTestPlan {
testPlan.getCurrentStatus());
testPlanScript = getOneTestPlanScript(testPlan);
List<Object> resultList = new ArrayList<Object>();
resultList.addAll(testPlanScript.doAfterRun(new Date()));
resultList.addAll(testPlanScript.sample(new Date()));
this.getTestResultSave().update(testPlan, resultList);
testPlanFromRepo = this.getTestPlanRepository().getTestPlanInDomainBy(
this.getTestPlanRunIdUuid());

View File

@ -39,12 +39,11 @@ public class ScheduleModel {
if (this.points.size() == 0) {
return 0;
}
long startTime = this.points.get(0).getTimeInSecond(), endTime = startTime;
long endTime = this.points.get(0).getTimeInSecond();
for (PointModel point : this.getPoints()) {
startTime = Math.min(point.getTimeInSecond(), startTime);
endTime = Math.max(point.getTimeInSecond(), endTime);
}
return endTime - startTime;
return endTime;
}
public int getMaxLoad() {