diff --git a/src/main/java/org/bench4q/agent/api/TestController.java b/src/main/java/org/bench4q/agent/api/TestController.java index 0b786edd..aad36353 100644 --- a/src/main/java/org/bench4q/agent/api/TestController.java +++ b/src/main/java/org/bench4q/agent/api/TestController.java @@ -202,23 +202,23 @@ public class TestController { if (scenarioContext == null || scenarioContext.isFinished()) { return null; } - for (Page page : scenarioContext.getScenario().getPages()) { - for (Batch batch : page.getBatches()) { - for (Behavior behavior : batch.getBehaviors()) { - int behaviorId = behavior.getId(); - Map map = scenarioContext - .getDataStatistics() - .getDetailStatistics(behaviorId); - if (map == null) { - continue; - } - behaviorBriefModels.add(buildBehaviorBrief(runId, - behaviorId, map)); - - } + // for (Page page : scenarioContext.getScenario().getPages()) { + // for (Batch batch : page.getBatches()) { + // for (Behavior behavior : batch.getBehaviors()) { + for (Behavior behavior : scenarioContext.getScenario() + .getAllBehaviorsInScenario()) { + int behaviorId = behavior.getId(); + Map map = scenarioContext + .getDataStatistics().getDetailStatistics(behaviorId); + if (map == null) { + continue; } - + behaviorBriefModels.add(buildBehaviorBrief(runId, behaviorId, map)); } + // } + // } + // + // } ret.setBehaviorBriefModels(behaviorBriefModels); return ret; } diff --git a/src/main/java/org/bench4q/agent/scenario/ScenarioEngine.java b/src/main/java/org/bench4q/agent/scenario/ScenarioEngine.java index be60a69d..dd149a1e 100644 --- a/src/main/java/org/bench4q/agent/scenario/ScenarioEngine.java +++ b/src/main/java/org/bench4q/agent/scenario/ScenarioEngine.java @@ -93,27 +93,21 @@ public class ScenarioEngine { public void doRunScenario(ScenarioContext context) { Map plugins = new HashMap(); preparePlugins(context.getScenario(), plugins); - - for (Page page : context.getScenario().getPages()) { - for (Batch batch : page.getBatches()) { - for (Behavior behavior : batch.getBehaviors()) { - Object plugin = plugins.get(behavior.getUse()); - Map behaviorParameters = prepareBehaviorParameters(behavior); - Date startDate = new Date(System.currentTimeMillis()); - PluginReturn pluginReturn = (PluginReturn) this - .getPluginManager().doBehavior(plugin, - behavior.getName(), behaviorParameters); - Date endDate = new Date(System.currentTimeMillis()); - if (!behavior.shouldBeCountResponseTime()) { - continue; - } - context.getDataStatistics().add( - buildBehaviorResult(behavior, plugin, startDate, - pluginReturn, endDate)); - } + for (Behavior behavior : context.getScenario() + .getAllBehaviorsInScenario()) { + Object plugin = plugins.get(behavior.getUse()); + Map behaviorParameters = prepareBehaviorParameters(behavior); + Date startDate = new Date(System.currentTimeMillis()); + PluginReturn pluginReturn = (PluginReturn) this.getPluginManager() + .doBehavior(plugin, behavior.getName(), behaviorParameters); + Date endDate = new Date(System.currentTimeMillis()); + if (!behavior.shouldBeCountResponseTime()) { + continue; } + context.getDataStatistics().add( + buildBehaviorResult(behavior, plugin, startDate, + pluginReturn, endDate)); } - } private BehaviorResult buildBehaviorResult(Behavior behavior, @@ -148,8 +142,7 @@ public class ScenarioEngine { return behaviorParameters; } - private void preparePlugins(Scenario scenario, - Map plugins) { + private void preparePlugins(Scenario scenario, Map plugins) { for (UsePlugin usePlugin : scenario.getUsePlugins()) { String pluginId = usePlugin.getId(); Class pluginClass = this.getPluginManager().getPlugins()