refactor
This commit is contained in:
parent
0cbffbc270
commit
acca5e1cbd
|
@ -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<Integer, DetailStatusCodeResult> 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<Integer, DetailStatusCodeResult> map = scenarioContext
|
||||
.getDataStatistics().getDetailStatistics(behaviorId);
|
||||
if (map == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
behaviorBriefModels.add(buildBehaviorBrief(runId, behaviorId, map));
|
||||
}
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
ret.setBehaviorBriefModels(behaviorBriefModels);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -93,27 +93,21 @@ public class ScenarioEngine {
|
|||
public void doRunScenario(ScenarioContext context) {
|
||||
Map<String, Object> plugins = new HashMap<String, Object>();
|
||||
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<String, String> 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<String, String> 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<String, Object> plugins) {
|
||||
private void preparePlugins(Scenario scenario, Map<String, Object> plugins) {
|
||||
for (UsePlugin usePlugin : scenario.getUsePlugins()) {
|
||||
String pluginId = usePlugin.getId();
|
||||
Class<?> pluginClass = this.getPluginManager().getPlugins()
|
||||
|
|
Loading…
Reference in New Issue