refactor and add new Tests about loadDistribute
This commit is contained in:
parent
d5521595a8
commit
afc70a74f6
|
@ -43,6 +43,7 @@ public class LoadDistribute {
|
|||
for (RunningScript scriptInput : testPlanContext.getAllScript()) {
|
||||
Transaction scriptLoadCommand = new ScriptLoadCommand(
|
||||
scriptInput, testPlanId);
|
||||
// TODO: there is a problem
|
||||
RunningScript scriptOutput = (RunningScript) scriptLoadCommand
|
||||
.execute();
|
||||
if (scriptOutput == null) {
|
||||
|
@ -54,7 +55,6 @@ public class LoadDistribute {
|
|||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,7 +90,11 @@ public abstract class ScriptLoadBase implements Transaction {
|
|||
ScriptLoadBase.logger = logger;
|
||||
}
|
||||
|
||||
protected void initialize(RunningScript runningScript, UUID testPlanID) {
|
||||
public ScriptLoadBase(RunningScript runningScript, UUID testPlanID) {
|
||||
initialize(runningScript, testPlanID);
|
||||
}
|
||||
|
||||
private void initialize(RunningScript runningScript, UUID testPlanID) {
|
||||
this.setRunningScript(runningScript);
|
||||
this.setTestPlanRunID(testPlanID);
|
||||
this.setRunningAgentService(ApplicationContextHelper.getContext()
|
||||
|
|
|
@ -7,7 +7,7 @@ import org.bench4q.master.domain.RunningScript;
|
|||
public class ScriptLoadCommand extends ScriptLoadBase {
|
||||
|
||||
public ScriptLoadCommand(RunningScript runningScript, UUID testPlanID) {
|
||||
initialize(runningScript, testPlanID);
|
||||
super(runningScript, testPlanID);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -21,7 +21,7 @@ public class ScriptLoadSubstitute extends ScriptLoadBase {
|
|||
|
||||
public ScriptLoadSubstitute(RunningScript runningScript,
|
||||
AgentRunBlotter deadAgentBlotter) {
|
||||
initialize(runningScript, deadAgentBlotter.getTestPlanId());
|
||||
super(runningScript, deadAgentBlotter.getTestPlanId());
|
||||
this.setDeadAgentBlotter(deadAgentBlotter);
|
||||
this.setLoadToRecover(deadAgentBlotter.getRunningAgent().getLoadInUse());
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package org.bench4q.master.test.testplan;
|
||||
package org.bench4q.master.test.domain;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
|
@ -48,4 +48,8 @@ public class Test_RunningScript extends TestBase_MakeUpTestPlan {
|
|||
assertEquals(true, this.getRunningScript().isFinished());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testForBriefByCycle() {
|
||||
|
||||
}
|
||||
}
|
|
@ -1,10 +1,11 @@
|
|||
package org.bench4q.master.test.testplan;
|
||||
package org.bench4q.master.test.domain;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bench4q.master.api.modelfactory.BusinessModelMapFactory;
|
||||
import org.bench4q.master.domain.TestPlanContext;
|
||||
import org.bench4q.master.test.TestBase_MakeUpTestPlan;
|
||||
import org.bench4q.master.test.testplan.TestPlanTester;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
|
@ -0,0 +1,15 @@
|
|||
package org.bench4q.master.test.testplan;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import org.bench4q.master.test.TestBase_MakeUpTestPlan;
|
||||
import org.junit.Test;
|
||||
|
||||
public class Test_LoadDistribute extends TestBase_MakeUpTestPlan {
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue