refactor, and add test for generateScheduleModel as ratio
refactor, and add test for generateScheduleModel as ratio
This commit is contained in:
parent
4bc29d84bd
commit
a04a075ffe
|
@ -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(
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -35,7 +35,7 @@ public class Test_LoadDistribute extends TestBase_MakeUpTestPlan {
|
|||
@Before
|
||||
public void prepare() {
|
||||
prepareForTestPlanRunning();
|
||||
submitATestPlanWithOneScript();
|
||||
submitATestPlanWithOneScript(EACH_SCRIPT_LOAD_SMALLSCALE);
|
||||
}
|
||||
|
||||
@After
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -43,7 +43,7 @@ public class Test_TestPlan extends TestBase_MakeUpTestPlan {
|
|||
this.getAgentService().addAgentToPool(agent);
|
||||
}
|
||||
prepareForTestPlanRunning();
|
||||
submitATestPlanWithOneScript();
|
||||
submitATestPlanWithOneScript(EACH_SCRIPT_LOAD_SMALLSCALE);
|
||||
}
|
||||
|
||||
@After
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<RunningScriptModel> createTwoScriptList(int scriptIdForOne,
|
||||
int scriptIdForTwo) {
|
||||
List<RunningScriptModel> runningScriptModels = createOneScriptList(scriptIdForOne);
|
||||
runningScriptModels.add(buildScriptModel(scriptIdForTwo));
|
||||
int scriptIdForTwo, int load) {
|
||||
List<RunningScriptModel> 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<RunningScriptModel> createOneScriptList(int scriptId) {
|
||||
public static List<RunningScriptModel> createOneScriptList(int scriptId,
|
||||
int load) {
|
||||
List<RunningScriptModel> list = new ArrayList<RunningScriptModel>();
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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<MonitorModel>());
|
||||
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<RunningScriptModel> createTowScriptList() {
|
||||
List<RunningScriptModel> list = new ArrayList<RunningScriptModel>();
|
||||
list.add(buildScriptModel(SCRIPTID1));
|
||||
list.add(buildScriptModel(SCRIPTID2));
|
||||
return list;
|
||||
}
|
||||
|
||||
public TestPlanResultModel getRunningInfo(UUID testPlanId)
|
||||
throws IOException, JAXBException {
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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()));
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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())
|
||||
|
|
Loading…
Reference in New Issue