diff --git a/Bench4Q-Master/src/main/java/org/bench4q/master/domain/entity/RunningAgentDB.java b/Bench4Q-Master/src/main/java/org/bench4q/master/domain/entity/RunningAgentDB.java index 58008f33..7710de16 100644 --- a/Bench4Q-Master/src/main/java/org/bench4q/master/domain/entity/RunningAgentDB.java +++ b/Bench4Q-Master/src/main/java/org/bench4q/master/domain/entity/RunningAgentDB.java @@ -182,7 +182,9 @@ public class RunningAgentDB implements RunningAgentInterface { .tryUnmarshal(RunScenarioModel.class, this.getTestPlanScript() .getFilteredScriptCnt()); runScenarioModel.setPoolSize(getLoadInUse()); - ScheduleModel scheduleModel = generateScheduleModelWithRatio(); + ScheduleModel scheduleModel = generateScheduleModelWithRatio((ScheduleModel) MarshalHelper + .tryUnmarshal(ScheduleModel.class, this.getTestPlanScript() + .getScheduleContent())); RunScenarioResultModel runScenarioResultModel = this .getAgentMessenger().submitScenrioWithParams(this.getAgent(), this.getAgentRunId(), script2.loadParamFiles(), @@ -194,10 +196,17 @@ public class RunningAgentDB implements RunningAgentInterface { return true; } - private ScheduleModel generateScheduleModelWithRatio() { - ScheduleModel scheduleModel = (ScheduleModel) MarshalHelper - .tryUnmarshal(ScheduleModel.class, this.getTestPlanScript() - .getScheduleContent()); + /** + * + * @param scheduleModel + * , scheduleModel is the origin model from master. + * @return ScheduleModel which is generated with the {@scheduleModel}'s + * every point is multiplied with the ratio. The ratio is calculated + * in the way that the loadInUse divide totalRequiredLoad of the + * runningScript + */ + public ScheduleModel generateScheduleModelWithRatio( + ScheduleModel scheduleModel) { int totolRequireLoad = this.getTestPlanScript().getRequireLoad(); if (totolRequireLoad <= 0) { throw new IllegalArgumentException( diff --git a/Bench4Q-Master/src/test/java/org/bench4q/master/integrated/Test_HighAvailableWithActualMessenger.java b/Bench4Q-Master/src/test/java/org/bench4q/master/integrated/Test_HighAvailableWithActualMessenger.java index 38b9f158..d6a97dfc 100644 --- a/Bench4Q-Master/src/test/java/org/bench4q/master/integrated/Test_HighAvailableWithActualMessenger.java +++ b/Bench4Q-Master/src/test/java/org/bench4q/master/integrated/Test_HighAvailableWithActualMessenger.java @@ -33,7 +33,7 @@ public class Test_HighAvailableWithActualMessenger extends @Test public void testSubstituteOnBoard() throws InterruptedException { - submitATestPlanWithOneScript(); + submitATestPlanWithOneScript(EACH_SCRIPT_LOAD_SMALLSCALE); prepareForTestPlanRunning(); assertEquals(Long.valueOf(1000), this.getHaPool().getMaxAvailableLoad()); assertEquals(1000, this.getHaPool().getCurrentAvailableLoad()); diff --git a/Bench4Q-Master/src/test/java/org/bench4q/master/integrated/Test_LoadDistribute.java b/Bench4Q-Master/src/test/java/org/bench4q/master/integrated/Test_LoadDistribute.java index 970f9e8e..c7f9b298 100644 --- a/Bench4Q-Master/src/test/java/org/bench4q/master/integrated/Test_LoadDistribute.java +++ b/Bench4Q-Master/src/test/java/org/bench4q/master/integrated/Test_LoadDistribute.java @@ -35,7 +35,7 @@ public class Test_LoadDistribute extends TestBase_MakeUpTestPlan { @Before public void prepare() { prepareForTestPlanRunning(); - submitATestPlanWithOneScript(); + submitATestPlanWithOneScript(EACH_SCRIPT_LOAD_SMALLSCALE); } @After diff --git a/Bench4Q-Master/src/test/java/org/bench4q/master/integrated/Test_RunningScriptSampler.java b/Bench4Q-Master/src/test/java/org/bench4q/master/integrated/Test_RunningScriptSampler.java index 3d964792..5271c786 100644 --- a/Bench4Q-Master/src/test/java/org/bench4q/master/integrated/Test_RunningScriptSampler.java +++ b/Bench4Q-Master/src/test/java/org/bench4q/master/integrated/Test_RunningScriptSampler.java @@ -33,7 +33,7 @@ public class Test_RunningScriptSampler extends TestBase_MakeUpTestPlan { @Before public void prepare() { prepareForTestPlanRunning(); - this.submitATestPlanWithOneScript(); + this.submitATestPlanWithOneScript(EACH_SCRIPT_LOAD_SMALLSCALE); TestPlan testPlan = fetchTestPlan(); testPlan.run(); this.getTestPlanRepository().updateEntity(testPlan); diff --git a/Bench4Q-Master/src/test/java/org/bench4q/master/integrated/Test_TestPlan.java b/Bench4Q-Master/src/test/java/org/bench4q/master/integrated/Test_TestPlan.java index 0ec7b9d9..7dc02ae2 100644 --- a/Bench4Q-Master/src/test/java/org/bench4q/master/integrated/Test_TestPlan.java +++ b/Bench4Q-Master/src/test/java/org/bench4q/master/integrated/Test_TestPlan.java @@ -43,7 +43,7 @@ public class Test_TestPlan extends TestBase_MakeUpTestPlan { this.getAgentService().addAgentToPool(agent); } prepareForTestPlanRunning(); - submitATestPlanWithOneScript(); + submitATestPlanWithOneScript(EACH_SCRIPT_LOAD_SMALLSCALE); } @After diff --git a/Bench4Q-Master/src/test/java/org/bench4q/master/integrated/Test_TestResultSave.java b/Bench4Q-Master/src/test/java/org/bench4q/master/integrated/Test_TestResultSave.java index 848c4c94..20abd627 100644 --- a/Bench4Q-Master/src/test/java/org/bench4q/master/integrated/Test_TestResultSave.java +++ b/Bench4Q-Master/src/test/java/org/bench4q/master/integrated/Test_TestResultSave.java @@ -61,7 +61,7 @@ public class Test_TestResultSave extends TestBase_MakeUpTestPlan { @Before public void setUp() { this.prepareForTestPlanRunning(); - this.submitATestPlanWithOneScript(); + this.submitATestPlanWithOneScript(EACH_SCRIPT_LOAD_SMALLSCALE); } @After diff --git a/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/TestBase_MakeUpTestPlan.java b/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/TestBase_MakeUpTestPlan.java index ae294722..4d76e939 100644 --- a/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/TestBase_MakeUpTestPlan.java +++ b/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/TestBase_MakeUpTestPlan.java @@ -57,7 +57,7 @@ public class TestBase_MakeUpTestPlan extends TestBase { private int scriptId; private int scriptIdForSecond; private User testUser; - // private static int EACH_SCRIPT_LOAD_LargeSCALE = 12000; + protected static int EACH_SCRIPT_LOAD_LargeSCALE = 1200; protected static int EACH_SCRIPT_LOAD_SMALLSCALE = 10; // private static int EACH_SCRIPT_LOAD_MIDDLESCALE = 800; public static String Monitor_Host_Name = "133.133.12.3"; @@ -268,15 +268,15 @@ public class TestBase_MakeUpTestPlan extends TestBase { return null; } - protected UUID submitATestPlanWithOneScript() { - return submitATestPlan(1); + protected UUID submitATestPlanWithOneScript(int load) { + return submitATestPlan(1, load); } - protected UUID submitATestPlanWithTwoScript() { - return submitATestPlan(2); + protected UUID submitATestPlanWithTwoScript(int load) { + return submitATestPlan(2, load); } - private UUID submitATestPlan(int i) { + private UUID submitATestPlan(int i, int load) { UUID testPlanRunId = UUID.randomUUID(); User user = this.getUserRepository().getUser(Test_User_Name); int scriptOne = getUserFirstScript(user); @@ -286,9 +286,9 @@ public class TestBase_MakeUpTestPlan extends TestBase { if (i == 2) { scriptTwo = getUserSecondScript(user); this.setScriptIdForSecond(scriptTwo); - model = createATestPlanWithTwoScript(scriptOne, scriptTwo); + model = createATestPlanWithTwoScript(scriptOne, scriptTwo, load); } else { - model = createATestPlanWithOneScript(scriptOne); + model = createATestPlanWithOneScript(scriptOne, load); } try { this.getTestPlanEngine().submitTestPlan(model, user, testPlanRunId); @@ -300,51 +300,52 @@ public class TestBase_MakeUpTestPlan extends TestBase { return testPlanRunId; } - public TestPlanModel createATestPlanWithOneScript(int scriptId) { + public TestPlanModel createATestPlanWithOneScript(int scriptId, int load) { TestPlanModel testPlanBusinessModel = new TestPlanModel(); testPlanBusinessModel.setMonitorModels(createOneMonitorList()); - testPlanBusinessModel - .setRunningScriptModels(createOneScriptList(scriptId)); + testPlanBusinessModel.setRunningScriptModels(createOneScriptList( + scriptId, load)); this.setScriptId(scriptId); return testPlanBusinessModel; } - public UUID submitATestPlanWithScriptName() { + public UUID submitATestPlanWithScriptName(int load) { UUID testPlanRunId = UUID.randomUUID(); User user = this.getUserRepository().getUser("admin"); int scriptOne = getUserFirstScript(user); this.setScriptId(scriptOne); TestPlanModel model = null; - model = createAtestPlanWithOneScriptAndName(); + model = createAtestPlanWithOneScriptAndName(load); this.getTestPlanEngine().submitTestPlan(model, user, testPlanRunId); this.setTestPlanRunIdUuid(testPlanRunId); return testPlanRunId; } - public TestPlanModel createAtestPlanWithOneScriptAndName() { + public TestPlanModel createAtestPlanWithOneScriptAndName(int load) { TestPlanModel testPlanBusinessModel = new TestPlanModel(); testPlanBusinessModel.setName("testName"); testPlanBusinessModel.setMonitorModels(createOneMonitorList()); - testPlanBusinessModel - .setRunningScriptModels(createOneScriptList(scriptId)); + testPlanBusinessModel.setRunningScriptModels(createOneScriptList( + scriptId, load)); this.setScriptId(scriptId); return testPlanBusinessModel; } protected TestPlanModel createATestPlanWithTwoScript(int scriptIdForOne, - int scriptIdForTwo) { + int scriptIdForTwo, int load) { TestPlanModel testPlanBusinessModel = new TestPlanModel(); testPlanBusinessModel.setMonitorModels(createOneMonitorList()); testPlanBusinessModel.setRunningScriptModels(createTwoScriptList( - scriptIdForOne, scriptIdForTwo)); + scriptIdForOne, scriptIdForTwo, load)); return testPlanBusinessModel; } private List createTwoScriptList(int scriptIdForOne, - int scriptIdForTwo) { - List runningScriptModels = createOneScriptList(scriptIdForOne); - runningScriptModels.add(buildScriptModel(scriptIdForTwo)); + int scriptIdForTwo, int load) { + List runningScriptModels = createOneScriptList( + scriptIdForOne, load); + runningScriptModels.add(buildScriptModel(scriptIdForTwo, load)); return runningScriptModels; } @@ -386,21 +387,23 @@ public class TestBase_MakeUpTestPlan extends TestBase { return monitors; } - public static List createOneScriptList(int scriptId) { + public static List createOneScriptList(int scriptId, + int load) { List list = new ArrayList(); - list.add(buildScriptModel(scriptId)); + list.add(buildScriptModel(scriptId, load)); return list; } - public static RunningScriptModel buildScriptModel(int scriptID) { + public static RunningScriptModel buildScriptModel(int scriptID, int load) { RunningScriptModel model = new RunningScriptModel(); model.setScriptId(scriptID); model.setScriptFilterOptionsModel(new ScriptFilterOptionsModel()); - model.setRequireLoad(EACH_SCRIPT_LOAD_SMALLSCALE); + model.setRequireLoad(load); ScheduleModel schedule = new ScheduleModel(); schedule.getPoints().add(new PointModel(0, 0)); - schedule.getPoints().add(new PointModel(20, 10)); - schedule.getPoints().add(new PointModel(60, 10)); + schedule.getPoints().add(new PointModel(20, load)); + schedule.getPoints().add(new PointModel(60, load)); + schedule.getPoints().add(new PointModel(80, 0)); model.setScheduleModel(schedule); return model; } diff --git a/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/controller/TestPlanScriptResultControllerTest.java b/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/controller/TestPlanScriptResultControllerTest.java index 27221667..35900de5 100644 --- a/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/controller/TestPlanScriptResultControllerTest.java +++ b/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/controller/TestPlanScriptResultControllerTest.java @@ -47,7 +47,8 @@ public class TestPlanScriptResultControllerTest extends TestBase_MakeUpTestPlan UUID testPlanRunId = UUID.randomUUID(); User user = this.getUserRepository().getUser("admin"); this.setScriptId(this.getUserFirstScript(user)); - TestPlanModel model = createATestPlanWithOneScript(this.getScriptId()); + TestPlanModel model = createATestPlanWithOneScript(this.getScriptId(), + EACH_SCRIPT_LOAD_SMALLSCALE); // TestPlanInBusiness testPlan = // BusinessModelMapFactory.toBusiness(model); this.getTestPlanEngine().submitTestPlan(model, user, testPlanRunId); diff --git a/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/controller/Test_TestPlanController.java b/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/controller/Test_TestPlanController.java index 4c37ec91..b6c7b025 100644 --- a/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/controller/Test_TestPlanController.java +++ b/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/controller/Test_TestPlanController.java @@ -4,9 +4,7 @@ import static org.junit.Assert.*; import java.io.IOException; import java.io.StringWriter; -import java.util.ArrayList; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.UUID; @@ -20,8 +18,6 @@ import org.bench4q.share.communication.HttpRequester.HttpResponse; import org.bench4q.share.enums.master.TestPlanStatus; import org.bench4q.share.helper.MarshalHelper; import org.bench4q.share.models.master.MonitorPhysicalDiskResponseModel; -import org.bench4q.share.models.master.MonitorModel; -import org.bench4q.share.models.master.RunningScriptModel; import org.bench4q.share.models.master.TestPlanModel; import org.bench4q.share.models.master.TestPlanResultModel; import org.bench4q.share.models.master.TestPlanScriptBriefResultModel; @@ -41,7 +37,6 @@ public class Test_TestPlanController extends TestBase_MakeUpTestPlan { private String _url = TestBase.BASE_URL + "/testPlan"; private int scriptSumNum; public static int SCRIPTID1 = 26; - private static int SCRIPTID2 = 2; private static String Monitor_Host_Name = "133.133.12.3"; private static String monitor_port = "5556"; @@ -141,7 +136,6 @@ public class Test_TestPlanController extends TestBase_MakeUpTestPlan { public UUID testWithTestPlanModel() throws JAXBException, IOException { String content; TestPlanResultModel result = new TestPlanResultModel(); - this._createATestPlan(); content = marshalTestPlanToString(); @@ -163,29 +157,16 @@ public class Test_TestPlanController extends TestBase_MakeUpTestPlan { return stringWriter.toString(); } - public static TestPlanModel createATestPlanWithZeroMonitor(int scriptId) { - TestPlanModel testPlanBusinessModel = new TestPlanModel(); - testPlanBusinessModel.setMonitorModels(new ArrayList()); - testPlanBusinessModel - .setRunningScriptModels(createOneScriptList(SCRIPTID1)); - return testPlanBusinessModel; - } - - public static TestPlanModel createATestPlanWithNullMonitorList(int scriptId) { - TestPlanModel testPlanBusinessModel = new TestPlanModel(); - testPlanBusinessModel.setMonitorModels(null); - testPlanBusinessModel - .setRunningScriptModels(createOneScriptList(scriptId)); - return testPlanBusinessModel; - } - public TestPlanModel _createATestPlan() { if (this.getScriptSumNum() == 1) { - this.testPlanBusinessModel - .setRunningScriptModels(createOneScriptList(SCRIPTID1)); + this.testPlanBusinessModel = this.createATestPlanWithOneScript( + getUserFirstScript(getTestUser()), + EACH_SCRIPT_LOAD_SMALLSCALE); } else if (getScriptSumNum() == 2) { - this.testPlanBusinessModel - .setRunningScriptModels(createTowScriptList()); + this.testPlanBusinessModel = this.createATestPlanWithTwoScript( + getUserFirstScript(getTestUser()), + getUserFirstScript(getTestUser()), + EACH_SCRIPT_LOAD_SMALLSCALE); } else { return null; } @@ -193,13 +174,6 @@ public class Test_TestPlanController extends TestBase_MakeUpTestPlan { return this.testPlanBusinessModel; } - private List createTowScriptList() { - List list = new ArrayList(); - list.add(buildScriptModel(SCRIPTID1)); - list.add(buildScriptModel(SCRIPTID2)); - return list; - } - public TestPlanResultModel getRunningInfo(UUID testPlanId) throws IOException, JAXBException { Map params = new HashMap(); diff --git a/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/entity/Test_RunningAgent.java b/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/entity/Test_RunningAgent.java index d824793f..58c4d511 100644 --- a/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/entity/Test_RunningAgent.java +++ b/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/entity/Test_RunningAgent.java @@ -46,7 +46,7 @@ public class Test_RunningAgent extends TestBase_MakeUpTestPlan { this.getAgentService().addAgentToPool(agent); } this.getHaPool().checkAllHeartBeat(); - this.submitATestPlanWithOneScript(); + this.submitATestPlanWithOneScript(EACH_SCRIPT_LOAD_SMALLSCALE); } @Test diff --git a/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/entity/Test_RunningScript.java b/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/entity/Test_RunningScript.java index 696f81eb..c7bf778b 100644 --- a/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/entity/Test_RunningScript.java +++ b/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/entity/Test_RunningScript.java @@ -10,6 +10,8 @@ import org.bench4q.master.domain.entity.RunningAgentDB; import org.bench4q.master.domain.entity.TestPlan; import org.bench4q.master.domain.entity.TestPlanScript; import org.bench4q.master.unitTest.TestBase_MakeUpTestPlan; +import org.bench4q.share.helper.MarshalHelper; +import org.bench4q.share.models.agent.scriptrecord.ScheduleModel; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -24,12 +26,13 @@ public class Test_RunningScript extends TestBase_MakeUpTestPlan { { testcase2.add(Agent.createAgentWithoutId("127.0.0.1", 6565, 500)); testcase2.add(Agent.createAgentWithoutId("127.0.0.2", 6565, 500)); + testcase2.add(Agent.createAgentWithoutId("127.0.0.3", 6565, 500)); } @Before public void before() { this.getHaPool().checkAllHeartBeat(); - this.submitATestPlanWithOneScript(); + this.submitATestPlanWithOneScript(EACH_SCRIPT_LOAD_SMALLSCALE); for (Agent agent : this.testcase2) { this.getAgentService().addAgentToPool(agent); } @@ -70,6 +73,31 @@ public class Test_RunningScript extends TestBase_MakeUpTestPlan { @Test public void test_doAfterApplyLoad() { - + } + + @Test + public void test_distributeScriptAndLoadWithRatioIntoEffect() { + this.submitATestPlanWithOneScript(EACH_SCRIPT_LOAD_LargeSCALE); + for (Agent agent : this.testcase2) { + this.getAgentService().addAgentToPool(agent); + } + TestPlan testPlanInDomain = this.getTestPlanRepository() + .getTestPlanInDomainBy(getTestPlanRunIdUuid()); + TestPlanScript testPlanScript = testPlanInDomain + .extracSpecifiedScript(getUserFirstScript(getTestUser())); + assertTrue(testPlanScript.applyForLoad()); + testPlanScript.distributeScriptAndParams(); + assertEquals(3, testPlanScript.getRunningAgents().size()); + for (RunningAgentDB runningAgentDB : testPlanScript.getRunningAgents()) { + double ratio = (double) runningAgentDB.getLoadInUse() + / (double) testPlanScript.getRequireLoad(); + ScheduleModel scheduleModelInRunningAgent = runningAgentDB + .generateScheduleModelWithRatio((ScheduleModel) MarshalHelper + .tryUnmarshal(ScheduleModel.class, + testPlanScript.getScheduleContent())); + assertEquals(Math.round(ratio * testPlanScript.getRequireLoad()), + scheduleModelInRunningAgent.getMaxLoad()); + System.out.println(scheduleModelInRunningAgent.getMaxLoad()); + } } } diff --git a/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/entity/Test_TestPlan.java b/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/entity/Test_TestPlan.java index 334a6780..39169eb1 100644 --- a/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/entity/Test_TestPlan.java +++ b/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/entity/Test_TestPlan.java @@ -62,7 +62,7 @@ public class Test_TestPlan extends TestBase_MakeUpTestPlan { this.getAgentService().addAgentToPool(agent); } this.getHaPool().checkAllHeartBeat(); - submitATestPlanWithOneScript(); + submitATestPlanWithOneScript(EACH_SCRIPT_LOAD_SMALLSCALE); } @After diff --git a/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/infrastructure/ha/Test_highAvailableWithMockMessenger.java b/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/infrastructure/ha/Test_highAvailableWithMockMessenger.java index b43fc1e6..9626e19d 100644 --- a/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/infrastructure/ha/Test_highAvailableWithMockMessenger.java +++ b/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/infrastructure/ha/Test_highAvailableWithMockMessenger.java @@ -52,7 +52,7 @@ public class Test_highAvailableWithMockMessenger extends synchronized (this.ha) { assertEquals(1000, this.ha.getCurrentAvailableLoad()); } - this.submitATestPlanWithOneScript(); + this.submitATestPlanWithOneScript(EACH_SCRIPT_LOAD_SMALLSCALE); TestPlan testPlan = this.getTestPlanRepository().getTestPlanInDomainBy( getTestPlanRunIdUuid()); testPlan.run(); diff --git a/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/repository/Test_TestPlanRepository.java b/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/repository/Test_TestPlanRepository.java index 967035c6..7ca7a7b2 100644 --- a/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/repository/Test_TestPlanRepository.java +++ b/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/repository/Test_TestPlanRepository.java @@ -32,7 +32,7 @@ public class Test_TestPlanRepository extends TestBase_MakeUpTestPlan { .loadEntities(this.getUserRepository().getUser("admin")).size(); assertTrue(sizeBefore > 0); System.out.println(sizeBefore); - submitATestPlanWithOneScript(); + submitATestPlanWithOneScript(EACH_SCRIPT_LOAD_SMALLSCALE); int sizeAfter = this.getTestPlanRepository() .loadEntities(this.getUserRepository().getUser("admin")).size(); assertEquals(sizeBefore + 1, sizeAfter); @@ -55,7 +55,7 @@ public class Test_TestPlanRepository extends TestBase_MakeUpTestPlan { @Before public void prepare() { - this.submitATestPlanWithOneScript(); + this.submitATestPlanWithOneScript(EACH_SCRIPT_LOAD_SMALLSCALE); } @After diff --git a/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/service/Test_MonitorResultService.java b/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/service/Test_MonitorResultService.java index 5e862ffd..35bf6334 100644 --- a/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/service/Test_MonitorResultService.java +++ b/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/service/Test_MonitorResultService.java @@ -97,7 +97,8 @@ public class Test_MonitorResultService extends TestBase_MakeUpTestPlan { int scriptId = getUserFirstScript(user); this.getHaPool().checkAllHeartBeat(); this.setTestPlanRunIdUuid(this.getTestPlanEngine().runWith( - createATestPlanWithOneScript(scriptId), user)); + createATestPlanWithOneScript(scriptId, + EACH_SCRIPT_LOAD_SMALLSCALE), user)); Thread.sleep(500); TestPlan testPlanInDomain = this.getTestPlanFactory().convertToDomain( this.getTestPlanRepository().getTestPlanInDomainBy( diff --git a/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/service/Test_ReportService.java b/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/service/Test_ReportService.java index 4505863a..cd208ea4 100644 --- a/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/service/Test_ReportService.java +++ b/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/service/Test_ReportService.java @@ -26,7 +26,7 @@ public class Test_ReportService extends TestBase_MakeUpTestPlan { @Test public void testIsReportCreatedWhenActuallyNotCreated() { - submitATestPlanWithOneScript(); + submitATestPlanWithOneScript(EACH_SCRIPT_LOAD_SMALLSCALE); assertFalse(this.getReportService().isReportCreated( getTestPlanRunIdUuid())); } diff --git a/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/service/Test_TestPlanEngine.java b/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/service/Test_TestPlanEngine.java index 6d20fc27..0aa64312 100644 --- a/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/service/Test_TestPlanEngine.java +++ b/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/service/Test_TestPlanEngine.java @@ -52,7 +52,7 @@ public class Test_TestPlanEngine extends TestBase_MakeUpTestPlan { this.agentService.addAgentToPool(Agent.createAgentWithoutId( "147.0.0.1", 6565, 500)); prepareForTestPlanRunning(); - submitATestPlanWithOneScript(); + submitATestPlanWithOneScript(EACH_SCRIPT_LOAD_SMALLSCALE); } } @@ -91,7 +91,8 @@ public class Test_TestPlanEngine extends TestBase_MakeUpTestPlan { Date dateBeforeRun = new Date(); Thread.sleep(1000); this.setTestPlanRunIdUuid(this.getTestPlanEngine().runWith( - createATestPlanWithOneScript(scriptId), user)); + createATestPlanWithOneScript(scriptId, + EACH_SCRIPT_LOAD_SMALLSCALE), user)); assertNotNull(getTestPlanRunIdUuid()); Thread.sleep(10000); TestPlan testPlan = this.getTestPlanRepository().getTestPlanInDomainBy( @@ -115,7 +116,7 @@ public class Test_TestPlanEngine extends TestBase_MakeUpTestPlan { public void testRunWithWronglyWhenNoEnoughLoadInPool() throws InterruptedException { System.out.println("This need each agent not in running"); - this.submitATestPlanWithOneScript(); + this.submitATestPlanWithOneScript(EACH_SCRIPT_LOAD_SMALLSCALE); this.getHaPool().getPool().clear(); Thread.sleep(10000); TestPlan testPlan = this.getTestPlanRepository().getTestPlanInDomainBy( @@ -160,7 +161,7 @@ public class Test_TestPlanEngine extends TestBase_MakeUpTestPlan { // } private void testForStatus(TestPlanStatus status) throws Exception { - this.submitATestPlanWithOneScript(); + this.submitATestPlanWithOneScript(EACH_SCRIPT_LOAD_SMALLSCALE); TestPlan testPlan = this.getTestPlanRepository().getTestPlanInDomainBy( getTestPlanRunIdUuid()); testPlan.run(); diff --git a/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/service/Test_TestPlanScriptResultService.java b/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/service/Test_TestPlanScriptResultService.java index bf8e7a16..ec279c97 100644 --- a/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/service/Test_TestPlanScriptResultService.java +++ b/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/service/Test_TestPlanScriptResultService.java @@ -63,7 +63,8 @@ public class Test_TestPlanScriptResultService extends TestBase_MakeUpTestPlan { UUID testPlanRunId = UUID.randomUUID(); User user = this.getUserRepository().getUser("admin"); this.setScriptId(this.getUserFirstScript(user)); - TestPlanModel model = createATestPlanWithOneScript(this.getScriptId()); + TestPlanModel model = createATestPlanWithOneScript(this.getScriptId(), + EACH_SCRIPT_LOAD_SMALLSCALE); this.getTestPlanEngine().submitTestPlan(model, user, testPlanRunId); this.setTestPlanRunIdUuid(testPlanRunId); this.testPlanRepository.getTestPlanInDomainBy(getTestPlanRunIdUuid()); diff --git a/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/service/Test_TestPlanScriptService.java b/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/service/Test_TestPlanScriptService.java index 50f67b14..3a6d24fe 100644 --- a/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/service/Test_TestPlanScriptService.java +++ b/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/service/Test_TestPlanScriptService.java @@ -24,7 +24,7 @@ public class Test_TestPlanScriptService extends TestBase_MakeUpTestPlan { @Before public void prepare() { - submitATestPlanWithOneScript(); + submitATestPlanWithOneScript(EACH_SCRIPT_LOAD_SMALLSCALE); System.out.println(getScriptId()); } diff --git a/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/service/Test_TestPlanService.java b/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/service/Test_TestPlanService.java index 303525f3..febc8630 100644 --- a/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/service/Test_TestPlanService.java +++ b/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/service/Test_TestPlanService.java @@ -39,7 +39,7 @@ public class Test_TestPlanService extends TestBase_MakeUpTestPlan { public void testRemoveTestPlanInDB() { int planCountBeforeSubmit = this.getTestPlanRepository() .loadEntities(this.getUserRepository().getUser("admin")).size(); - submitATestPlanWithOneScript(); + submitATestPlanWithOneScript(EACH_SCRIPT_LOAD_SMALLSCALE); int planCountBetweenSubmitAndRemove = this.getTestPlanRepository() .loadEntities(this.getUserRepository().getUser("admin")).size(); assertEquals(planCountBeforeSubmit + 1, planCountBetweenSubmitAndRemove); @@ -53,8 +53,8 @@ public class Test_TestPlanService extends TestBase_MakeUpTestPlan { System.out.println(planCountBeforeSubmit); UUID randomUUID = UUID.randomUUID(); assertTrue(this.getTestPlanEngine().submitTestPlan( - createATestPlanWithOneScript(getUserFirstScript(user)), user, - randomUUID)); + createATestPlanWithOneScript(getUserFirstScript(user), + EACH_SCRIPT_LOAD_SMALLSCALE), user, randomUUID)); int planCountAfterSubmit = this.getTestPlanRepository() .loadEntities(user).size(); assertEquals(planCountBeforeSubmit + 1, planCountAfterSubmit); @@ -80,7 +80,7 @@ public class Test_TestPlanService extends TestBase_MakeUpTestPlan { User user = this.getUserRepository().getUser("admin"); int initialTestPlanSize = this.getTestPlanRepository() .loadEntities(user).size(); - submitATestPlanWithTwoScript(); + submitATestPlanWithTwoScript(EACH_SCRIPT_LOAD_SMALLSCALE); int sizeAfterSubmitTestPlanWithTwoScript = this.getTestPlanRepository() .loadEntities(user).size(); assertEquals(initialTestPlanSize + 1, @@ -98,7 +98,7 @@ public class Test_TestPlanService extends TestBase_MakeUpTestPlan { @Before public void prepare() { - submitATestPlanWithOneScript(); + submitATestPlanWithOneScript(EACH_SCRIPT_LOAD_SMALLSCALE); } @After diff --git a/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/transaction/Test_ScriptLoadCommand.java b/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/transaction/Test_ScriptLoadCommand.java index fd0df93c..742cb498 100644 --- a/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/transaction/Test_ScriptLoadCommand.java +++ b/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/transaction/Test_ScriptLoadCommand.java @@ -51,7 +51,7 @@ public class Test_ScriptLoadCommand extends TestBase_MakeUpTestPlan { @Test public void testExecuteWithTestPlanScript() { - submitATestPlanWithOneScript(); + submitATestPlanWithOneScript(EACH_SCRIPT_LOAD_SMALLSCALE); this.getHaPool().checkAllHeartBeat(); TestPlanScript testPlanScript = this.getTestPlanRepository() .getTestPlanInDomainBy(getTestPlanRunIdUuid())