refactor
This commit is contained in:
coderfengyun 2014-09-26 17:02:02 +08:00
parent ef5571feae
commit 13e83c16df
2 changed files with 11 additions and 4 deletions

View File

@ -1,6 +1,7 @@
package org.bench4q.agent.api; package org.bench4q.agent.api;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
@ -87,6 +88,7 @@ public class TestController {
try { try {
this.getParamFileCollector().collectParamFiles(files, runId); this.getParamFileCollector().collectParamFiles(files, runId);
System.out.println(scenarioModel); System.out.println(scenarioModel);
logger.info("Real start time is:" + new Date(realStartTime));
RunScenarioModel runScenarioModel = MarshalHelper.unmarshal( RunScenarioModel runScenarioModel = MarshalHelper.unmarshal(
RunScenarioModel.class, scenarioModel); RunScenarioModel.class, scenarioModel);
System.out.println(scheduleContent); System.out.println(scheduleContent);
@ -166,6 +168,9 @@ public class TestController {
.getBehaviorBriefResult(scenarioContext .getBehaviorBriefResult(scenarioContext
.getDataCollector()); .getDataCollector());
logger.info(pluginImplementBehavior.getId()); logger.info(pluginImplementBehavior.getId());
if (briefModel == null) {
continue;
}
briefModel.setBehaviorUrl(pluginImplementBehavior briefModel.setBehaviorUrl(pluginImplementBehavior
.getSpecificParamValue("url")); .getSpecificParamValue("url"));
behaviorBriefModels.add(briefModel); behaviorBriefModels.add(briefModel);

View File

@ -91,13 +91,15 @@ public class Schedule extends Observable {
* @return get the segment by binary search * @return get the segment by binary search
*/ */
public Segment getSegment(long timeInMilliSecond) { public Segment getSegment(long timeInMilliSecond) {
if (this.getSegments() == null if (this.getSegments() == null || this.getSegments().size() < 1) {
|| this.getSegments().size() < 1
|| timeInMilliSecond < this.getSegments().get(0).start
.getTimeInMilliSecond()) {
throw new Bench4QRunTimeException( throw new Bench4QRunTimeException(
"can't getSegment when segments' size is LT 1"); "can't getSegment when segments' size is LT 1");
} }
if (timeInMilliSecond < this.getSegments().get(0).start
.getTimeInMilliSecond()) {
throw new Bench4QRunTimeException(
"can't getSegment when timeInMilliSecond LT 0-segment's start");
}
if (timeInMilliSecond >= this.getSegments().get( if (timeInMilliSecond >= this.getSegments().get(
this.getSegments().size() - 1).end.getTimeInMilliSecond()) { this.getSegments().size() - 1).end.getTimeInMilliSecond()) {
this.reachEnd(); this.reachEnd();