From fcee93059850a82938909150d0c4245e0ef721d4 Mon Sep 17 00:00:00 2001 From: coderfengyun Date: Thu, 17 Apr 2014 15:14:41 +0800 Subject: [PATCH] refactor refactor --- .../org/bench4q/master/domain/entity/TestPlan.java | 13 ++++--------- .../master/domain/valueobject/LoadDistribute.java | 2 +- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/Bench4Q-Master/src/main/java/org/bench4q/master/domain/entity/TestPlan.java b/Bench4Q-Master/src/main/java/org/bench4q/master/domain/entity/TestPlan.java index e7d1b0b9..59fe05aa 100644 --- a/Bench4Q-Master/src/main/java/org/bench4q/master/domain/entity/TestPlan.java +++ b/Bench4Q-Master/src/main/java/org/bench4q/master/domain/entity/TestPlan.java @@ -158,7 +158,7 @@ public class TestPlan implements IAggregate { } @Transient - public LoadDistribute getLoadDistribute() { + private LoadDistribute getLoadDistribute() { return loadDistribute; } @@ -167,7 +167,7 @@ public class TestPlan implements IAggregate { } @Transient - public TestResultSave getTestResultSave() { + private TestResultSave getTestResultSave() { return testResultSave; } @@ -207,8 +207,7 @@ public class TestPlan implements IAggregate { if (isFinish()) { scheScheduledExecutorService.shutdown(); } - - doSaveResult(collectResult()); + getTestResultSave().update(TestPlan.this, collectResult()); } }, 0, this.getSampleCycleInSeconds(), TimeUnit.SECONDS); } catch (Exception e) { @@ -218,7 +217,7 @@ public class TestPlan implements IAggregate { } - public List collectResult() { + private List collectResult() { List resultList = new LinkedList(); for (TestPlanScript testPlanScript : getTestPlanScripts()) { List testPlanScriptResults = testPlanScript @@ -237,10 +236,6 @@ public class TestPlan implements IAggregate { } - public void doSaveResult(List results) { - this.getTestResultSave().update(this, results); - } - @Transient public boolean isFinish() { for (TestPlanScript testPlanScript : this.getTestPlanScripts()) { diff --git a/Bench4Q-Master/src/main/java/org/bench4q/master/domain/valueobject/LoadDistribute.java b/Bench4Q-Master/src/main/java/org/bench4q/master/domain/valueobject/LoadDistribute.java index da22683e..5e0d7cdf 100644 --- a/Bench4Q-Master/src/main/java/org/bench4q/master/domain/valueobject/LoadDistribute.java +++ b/Bench4Q-Master/src/main/java/org/bench4q/master/domain/valueobject/LoadDistribute.java @@ -75,7 +75,7 @@ public class LoadDistribute { testPlanInDomain.doAfterRun(); } - public boolean distributeLoadForScript(RunningScriptInterface runningScript) { + private boolean distributeLoadForScript(RunningScriptInterface runningScript) { return distributeLoadForScript(runningScript, runningScript.getRequireLoad()); }