Add briefCycleInMillis to bookTest
Add briefCycleInMillis to bookTest q
This commit is contained in:
parent
e0392650dd
commit
91a64883d0
|
@ -3,7 +3,6 @@ package org.bench4q.agent.api;
|
|||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bench4q.agent.plugin.ParameterFileCollector;
|
||||
|
@ -59,14 +58,11 @@ public class TestController {
|
|||
RequestMethod.GET, RequestMethod.POST })
|
||||
@ResponseBody
|
||||
public RunScenarioResultModel bookTest(@PathVariable int poolSize,
|
||||
@RequestParam(value = "briefCycle") int briefCycle,
|
||||
@RequestParam(value = "briefUnit") String briefUnit) {
|
||||
@RequestParam(value = "briefCycleInMillis") long briefCycleInMillis) {
|
||||
try {
|
||||
UUID runId = UUID.randomUUID();
|
||||
long sampleCycleInMillis = TimeUnit.valueOf(briefUnit).toMillis(
|
||||
briefCycle);
|
||||
this.getScenarioEngine().addRunningTestWithoutScenario(runId,
|
||||
poolSize);
|
||||
poolSize, briefCycleInMillis);
|
||||
RunScenarioResultModel runScenarioResultModel = new RunScenarioResultModel();
|
||||
runScenarioResultModel.setRunId(runId);
|
||||
return runScenarioResultModel;
|
||||
|
|
|
@ -30,20 +30,23 @@ import org.bench4q.share.models.agent.statistics.BehaviorBriefModel;
|
|||
public class ScenarioContext implements Observer {
|
||||
private static final long keepAliveTime = 10;
|
||||
private final UUID testId;
|
||||
private final long briefCycleInMillis;
|
||||
private final Date startDate;
|
||||
private Date endDate;
|
||||
private final ThreadPoolExecutor executor;
|
||||
private Scenario scenario;
|
||||
private final Scenario scenario;
|
||||
private boolean finished;
|
||||
private final DataCollector dataCollector;
|
||||
private final PluginManager pluginManager;
|
||||
private Schedule schedule;
|
||||
private Logger logger = Logger.getLogger(this.getClass());
|
||||
|
||||
private ScenarioContext(UUID testId, Date startDate,
|
||||
private ScenarioContext(UUID testId, Scenario scenario, Date startDate,
|
||||
ThreadPoolExecutor executor, DataCollector dataCollector,
|
||||
PluginManager pluginManager) {
|
||||
PluginManager pluginManager, long briefCycleInMillis) {
|
||||
this.testId = testId;
|
||||
this.briefCycleInMillis = briefCycleInMillis;
|
||||
this.scenario = scenario;
|
||||
this.startDate = startDate;
|
||||
this.executor = executor;
|
||||
this.dataCollector = dataCollector;
|
||||
|
@ -74,10 +77,6 @@ public class ScenarioContext implements Observer {
|
|||
return scenario;
|
||||
}
|
||||
|
||||
private void setScenario(Scenario scenario) {
|
||||
this.scenario = scenario;
|
||||
}
|
||||
|
||||
public boolean isFinished() {
|
||||
return finished;
|
||||
}
|
||||
|
@ -104,29 +103,29 @@ public class ScenarioContext implements Observer {
|
|||
|
||||
public static ScenarioContext buildScenarioContextWithoutScenario(
|
||||
UUID testId, int poolSize, PluginManager pluginManager,
|
||||
StorageHelper storageHelper) {
|
||||
StorageHelper storageHelper, long briefCycleInMillis) {
|
||||
final ArrayBlockingQueue<Runnable> workQueue = new ArrayBlockingQueue<Runnable>(
|
||||
poolSize);
|
||||
ThreadPoolExecutor executor = new ThreadPoolExecutor(poolSize,
|
||||
poolSize, keepAliveTime, TimeUnit.MINUTES, workQueue,
|
||||
new DiscardPolicy());
|
||||
ScenarioContext scenarioContext = new ScenarioContext(testId, new Date(
|
||||
System.currentTimeMillis()), executor, new DataCollectorImpl(
|
||||
testId, storageHelper), pluginManager);
|
||||
ScenarioContext scenarioContext = new ScenarioContext(testId, null,
|
||||
new Date(System.currentTimeMillis()), executor,
|
||||
new DataCollectorImpl(testId, storageHelper), pluginManager,
|
||||
briefCycleInMillis);
|
||||
return scenarioContext;
|
||||
}
|
||||
|
||||
public ScenarioContext addScenrio(final Scenario scenario,
|
||||
Schedule schedule, final long realStartTime) {
|
||||
ScenarioContext result = new ScenarioContext(this.testId, new Date(
|
||||
realStartTime), this.executor, this.dataCollector,
|
||||
this.pluginManager);
|
||||
ScenarioContext result = new ScenarioContext(this.testId, scenario,
|
||||
new Date(realStartTime), this.executor, this.dataCollector,
|
||||
this.pluginManager, this.briefCycleInMillis);
|
||||
result.setSchedule(schedule);
|
||||
result.setEndDate(new Date(result.getSchedule()
|
||||
.getScheduleRangeInMilliSecond()
|
||||
+ result.getStartDate().getTime()));
|
||||
result.setFinished(this.isFinished());
|
||||
result.setScenario(scenario);
|
||||
result.getSchedule().addObserver(result);
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -50,11 +50,13 @@ public class ScenarioEngine implements Observer {
|
|||
this.storageHelper = storageHelper;
|
||||
}
|
||||
|
||||
public void addRunningTestWithoutScenario(UUID runId, int poolSize) {
|
||||
public void addRunningTestWithoutScenario(UUID runId, int poolSize,
|
||||
long sampleCycleInMillis) {
|
||||
try {
|
||||
final ScenarioContext scenarioContext = ScenarioContext
|
||||
.buildScenarioContextWithoutScenario(runId, poolSize,
|
||||
getPluginManager(), this.getStorageHelper());
|
||||
getPluginManager(), this.getStorageHelper(),
|
||||
sampleCycleInMillis);
|
||||
this.getRunningTests().put(runId, scenarioContext);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.bench4q.share.models.agent.scriptrecord.ScheduleModel.PointModel;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
public abstract class TestBase {
|
||||
protected static final int BRIEF_CYCLE_IN_MILLIS = 3000;
|
||||
private ParameterBarn basePara;
|
||||
private PluginManager pluginManager;
|
||||
private StorageHelper storageHelper;
|
||||
|
@ -137,7 +138,7 @@ public abstract class TestBase {
|
|||
StorageHelper storageHelper) {
|
||||
ScenarioContext scenarioContext = ScenarioContext
|
||||
.buildScenarioContextWithoutScenario(testId, poolSize,
|
||||
pluginManager, storageHelper);
|
||||
pluginManager, storageHelper, BRIEF_CYCLE_IN_MILLIS);
|
||||
return scenarioContext.addScenrio(scenario,
|
||||
Schedule.build(buildScheduleModel()), new Date().getTime());
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import java.io.File;
|
|||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -191,8 +192,10 @@ public class TestWithScriptFile extends TestBase {
|
|||
+ "testForBrief.xml"));
|
||||
files.add(new File("Scripts" + System.getProperty("file.separator")
|
||||
+ "testJD.xml"));
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
params.put("briefCycleInMillis", String.valueOf(BRIEF_CYCLE_IN_MILLIS));
|
||||
HttpResponse httpResponse1 = this.getHttpRequester().sendPost(
|
||||
url + "/bookTest/20", null, null);
|
||||
url + "/bookTest/20", params, null);
|
||||
RunScenarioResultModel bookResponse = MarshalHelper.tryUnmarshal(
|
||||
RunScenarioResultModel.class, httpResponse1.getContent());
|
||||
assertNotNull(bookResponse);
|
||||
|
|
|
@ -49,7 +49,8 @@ public class Test_ScenarioContext extends TestBase {
|
|||
private ScenarioContext getScenarioWithScenarioAndSchedule() {
|
||||
ScenarioContext scenarioContext = ScenarioContext
|
||||
.buildScenarioContextWithoutScenario(UUID.randomUUID(), 100,
|
||||
pluginManager, this.storageHelper);
|
||||
pluginManager, this.storageHelper,
|
||||
BRIEF_CYCLE_IN_MILLIS);
|
||||
scenarioContext = scenarioContext
|
||||
.addScenrio(
|
||||
Scenario.scenarioCompiler(buildRunScenarioModelWith(new LinkedList<UsePluginModel>())),
|
||||
|
|
|
@ -17,6 +17,7 @@ public class Main {
|
|||
public static int PICK_CYCLE_IN_SECONDS = 60;
|
||||
public static String SCRIPT_PARAM_ROOT_FOLDER = "ScriptParameterization";
|
||||
public static String FILE_SEPARATOR = System.getProperty("file.separator");
|
||||
public static long briefCycleInMillis = 10000;
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
|
@ -47,6 +48,8 @@ public class Main {
|
|||
.getProperty("minSampleCycleInSeconds"));
|
||||
SCRIPT_PARAM_ROOT_FOLDER = prop
|
||||
.getProperty("scriptParamRootFolder");
|
||||
briefCycleInMillis = Long.parseLong(prop
|
||||
.getProperty("briefCycleInMillis"));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
MAX_FAIL_TIMES = 10;
|
||||
|
|
|
@ -5,7 +5,6 @@ import java.util.HashSet;
|
|||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
|
@ -25,7 +24,6 @@ import org.bench4q.master.domain.factory.TestPlanFactory;
|
|||
import org.bench4q.master.domain.valueobject.datastatistics.TestMonitorSampler;
|
||||
import org.bench4q.master.exception.ExceptionLog;
|
||||
import org.bench4q.master.helper.ApplicationContextHelper;
|
||||
import org.bench4q.master.infrastructure.communication.MonitorMessenger;
|
||||
import org.bench4q.share.helper.MarshalHelper;
|
||||
import org.bench4q.share.models.monitor.MemoryModel;
|
||||
import org.bench4q.share.models.monitor.MonitorMain;
|
||||
|
@ -35,7 +33,6 @@ import org.bench4q.share.models.monitor.ProcessModel;
|
|||
import org.bench4q.share.models.monitor.ProcessModelChild;
|
||||
import org.bench4q.share.models.monitor.ProcessorModel;
|
||||
import org.bench4q.share.models.monitor.ProcessorModelChild;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@Entity
|
||||
@Table(name = "monitor")
|
||||
|
@ -105,7 +102,7 @@ public class Monitor {
|
|||
return ApplicationContextHelper.getContext().getBean(
|
||||
TestMonitorSampler.class);
|
||||
}
|
||||
|
||||
|
||||
@Transient
|
||||
public TestPlanFactory getTestPlanFactory() {
|
||||
return testPlanFactory;
|
||||
|
@ -124,7 +121,7 @@ public class Monitor {
|
|||
MonitorMain monitorMain = getTestMonitorSampler().getMonitorResult(
|
||||
hostName, port, this.testPlan.getTestPlanRunId());
|
||||
System.out.println(MarshalHelper.tryMarshal(monitorMain));
|
||||
//tell test plan has to stop itself
|
||||
// tell test plan has to stop itself
|
||||
testPlan.setHasToStop(monitorMain.isTouchLimit());
|
||||
List<MonitorResult> monitorResults = this.getTestPlanFactory()
|
||||
.createMonitorResultListWithOutId(monitorMain, testPlan,
|
||||
|
@ -136,9 +133,11 @@ public class Monitor {
|
|||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void start(){
|
||||
this.getTestMonitorSampler().startMonitor(hostName, port, this.testPlan.getTestPlanRunId(), this.testPlan.getLimitModel());
|
||||
|
||||
public void start() {
|
||||
this.getTestMonitorSampler()
|
||||
.startMonitor(hostName, port, this.testPlan.getTestPlanRunId(),
|
||||
this.testPlan.getLimitModel());
|
||||
}
|
||||
|
||||
public List<MonitorResult> createFinishedResult() {
|
||||
|
|
|
@ -223,7 +223,7 @@ public class RunningAgentDB implements RunningAgentInterface {
|
|||
public boolean run() {
|
||||
// TODO: refactor this function to transaction
|
||||
RunScenarioResultModel runScenarioResultModel = this
|
||||
.getAgentMessenger().runWithParams(this.getAgent(),
|
||||
.getAgentMessenger().run(this.getAgent(),
|
||||
this.getAgentRunId());
|
||||
return runScenarioResultModel != null;
|
||||
}
|
||||
|
@ -253,7 +253,7 @@ public class RunningAgentDB implements RunningAgentInterface {
|
|||
// if (this.isStoped()) {
|
||||
// return null;
|
||||
// }
|
||||
return this.getAgentMessenger().scriptBriefAll(this.getAgent(),
|
||||
return this.getAgentMessenger().brief(this.getAgent(),
|
||||
this.getAgentRunId());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package org.bench4q.master.domain.service;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
@ -13,7 +11,6 @@ import org.bench4q.master.exception.Bench4QException;
|
|||
import org.bench4q.master.exception.ExceptionLog;
|
||||
import org.bench4q.master.helper.SessionHelper;
|
||||
import org.bench4q.master.infrastructure.communication.MonitorMessenger;
|
||||
import org.bench4q.recorder.httpcapture.generator.HtmlDocumentParser;
|
||||
import org.bench4q.share.helper.MarshalHelper;
|
||||
import org.bench4q.share.models.master.MonitorMemoryResponseModel;
|
||||
import org.bench4q.share.models.master.MonitorNetworkReponseModel;
|
||||
|
@ -29,7 +26,6 @@ import org.bench4q.share.models.monitor.ProcessorModel;
|
|||
import org.hibernate.Session;
|
||||
import org.hibernate.criterion.Order;
|
||||
import org.hibernate.criterion.Restrictions;
|
||||
import org.python.antlr.PythonParser.return_stmt_return;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
@ -37,7 +33,6 @@ import org.springframework.stereotype.Component;
|
|||
public class MonitorResultService {
|
||||
private TestPlanRepository testPlanRepository;
|
||||
private SessionHelper sessionHelper;
|
||||
private LimitableFieldsModel limitableField = null;
|
||||
@Autowired
|
||||
private MonitorMessenger monitorMessenger;
|
||||
private static Logger logger = Logger.getLogger(MonitorResult.class);
|
||||
|
@ -181,29 +176,7 @@ public class MonitorResultService {
|
|||
}
|
||||
}
|
||||
|
||||
private void initLimitableFields(){
|
||||
String pathSep = System.getProperty("file.separator");
|
||||
String limitableFieldsPath = "org" + pathSep + "bench4q" + pathSep
|
||||
+ "master" + pathSep + "config" + pathSep + "MonitorLimitableFields.xml";
|
||||
|
||||
InputStream is = HtmlDocumentParser.class.getClassLoader()
|
||||
.getResourceAsStream(limitableFieldsPath);
|
||||
if (is == null)
|
||||
return;
|
||||
StringBuffer out = new StringBuffer();
|
||||
byte[] b = new byte[4096];
|
||||
int n;
|
||||
try {
|
||||
while ((n = is.read(b)) != -1) {
|
||||
out.append(new String(b, 0, n));
|
||||
}
|
||||
limitableField = MarshalHelper.tryUnmarshal(LimitableFieldsModel.class, out.toString());
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
public LimitableFieldsModel getLimitableFields(String hostName, int port){
|
||||
public LimitableFieldsModel getLimitableFields(String hostName, int port) {
|
||||
return monitorMessenger.getLimitableFields(hostName, port);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,13 +22,13 @@ public interface AgentMessenger {
|
|||
final RunScenarioModel runScenarioModel,
|
||||
final ScheduleModel scheduleModel, Date realStartDate);
|
||||
|
||||
public RunScenarioResultModel runWithParams(Agent agent, UUID agentRunId);
|
||||
public RunScenarioResultModel run(Agent agent, UUID agentRunId);
|
||||
|
||||
public TestBriefStatusModel scriptBriefAll(Agent agent, UUID runId);
|
||||
public TestBriefStatusModel brief(Agent agent, UUID runId);
|
||||
|
||||
public StopTestModel stop(Agent agent, UUID runId);
|
||||
|
||||
public ServerStatusModel getStatus(Agent agent);
|
||||
public ServerStatusModel status(Agent agent);
|
||||
|
||||
public Future<ServerStatusModel> getStatusAsync(Agent agent);
|
||||
public Future<ServerStatusModel> statusAsync(Agent agent);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.bench4q.master.infrastructure.communication.impl;
|
|||
|
||||
import java.io.File;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -50,6 +51,8 @@ public class AgentMessengerImpl implements AgentMessenger {
|
|||
public RunScenarioResultModel bookTest(Agent agent, int requireLoad) {
|
||||
HttpResponse httpResponse = null;
|
||||
try {
|
||||
Map<String, String> parms = new HashMap<String, String>(1);
|
||||
parms.put("briefCycleInMillis", String.valueOf(3000));
|
||||
httpResponse = this.getHttpRequester().sendGet(
|
||||
buildBaseUrl(agent) + "/test/bookTest/" + requireLoad,
|
||||
null, null);
|
||||
|
@ -113,7 +116,7 @@ public class AgentMessengerImpl implements AgentMessenger {
|
|||
});
|
||||
}
|
||||
|
||||
public RunScenarioResultModel runWithParams(Agent agent, UUID agentRunId) {
|
||||
public RunScenarioResultModel run(Agent agent, UUID agentRunId) {
|
||||
HttpResponse httpResponse = null;
|
||||
try {
|
||||
if (agent == null || agentRunId == null) {
|
||||
|
@ -139,13 +142,13 @@ public class AgentMessengerImpl implements AgentMessenger {
|
|||
return this.executorService
|
||||
.submit(new Callable<RunScenarioResultModel>() {
|
||||
public RunScenarioResultModel call() throws Exception {
|
||||
return runWithParams(agent, agentRunId);
|
||||
return run(agent, agentRunId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// there is bug in here
|
||||
public TestBriefStatusModel scriptBriefAll(Agent agent, UUID runId) {
|
||||
public TestBriefStatusModel brief(Agent agent, UUID runId) {
|
||||
HttpResponse httpResponse = null;
|
||||
try {
|
||||
if (agent == null || runId == null) {
|
||||
|
@ -169,13 +172,13 @@ public class AgentMessengerImpl implements AgentMessenger {
|
|||
}
|
||||
}
|
||||
|
||||
public Future<TestBriefStatusModel> scriptBriefAsync(final Agent agent,
|
||||
public Future<TestBriefStatusModel> briefAsync(final Agent agent,
|
||||
final UUID runId) {
|
||||
return this.executorService
|
||||
.submit(new Callable<TestBriefStatusModel>() {
|
||||
|
||||
public TestBriefStatusModel call() throws Exception {
|
||||
return scriptBriefAll(agent, runId);
|
||||
return brief(agent, runId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -214,7 +217,7 @@ public class AgentMessengerImpl implements AgentMessenger {
|
|||
return agent.getHostName() + ":" + agent.getPort();
|
||||
}
|
||||
|
||||
public ServerStatusModel getStatus(Agent agent) {
|
||||
public ServerStatusModel status(Agent agent) {
|
||||
try {
|
||||
HttpResponse httpResponse = this.getHttpRequester().sendGet(
|
||||
agent.getHostName() + ":" + agent.getPort() + "/", null,
|
||||
|
@ -230,11 +233,11 @@ public class AgentMessengerImpl implements AgentMessenger {
|
|||
}
|
||||
}
|
||||
|
||||
public Future<ServerStatusModel> getStatusAsync(final Agent agent) {
|
||||
public Future<ServerStatusModel> statusAsync(final Agent agent) {
|
||||
return this.executorService.submit(new Callable<ServerStatusModel>() {
|
||||
|
||||
public ServerStatusModel call() throws Exception {
|
||||
return getStatus(agent);
|
||||
return status(agent);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -147,7 +147,7 @@ public class HighAvailablePoolImpl extends CurrentLoadSubject implements
|
|||
private void heartBeatsAndUpdateHAPool() {
|
||||
Map<Agent, Future<ServerStatusModel>> map = new HashMap<Agent, Future<ServerStatusModel>>();
|
||||
for (Agent agent : this.getPool().values()) {
|
||||
map.put(agent, this.getAgentMessenger().getStatusAsync(agent));
|
||||
map.put(agent, this.getAgentMessenger().statusAsync(agent));
|
||||
}
|
||||
this.updateAgentPoolByHeart(map);
|
||||
}
|
||||
|
@ -338,7 +338,7 @@ public class HighAvailablePoolImpl extends CurrentLoadSubject implements
|
|||
}
|
||||
|
||||
public ServerStatusModel queryAgentStatus(Agent agent) {
|
||||
return this.getAgentMessenger().getStatus(agent);
|
||||
return this.getAgentMessenger().status(agent);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,4 +3,5 @@ pickTestPlanCycleInSeconds=60
|
|||
maxFailTime=10
|
||||
minExcuteIntervalInSeconds=600
|
||||
minSampleCycleInSeconds=10
|
||||
scriptParamRootFolder=ScriptParameterization
|
||||
scriptParamRootFolder=ScriptParameterization
|
||||
briefCycleInMillis=3000
|
|
@ -54,7 +54,7 @@ public class Test_HighAvailableWithActualMessenger extends
|
|||
this.getHaPool().checkAllHeartBeat();
|
||||
for (RunningAgentInterface runingAgent : agentRunBlottersBeforeKill
|
||||
.values()) {
|
||||
while (this.getAgentMessenger().getStatus(runingAgent.getAgent()) != null) {
|
||||
while (this.getAgentMessenger().status(runingAgent.getAgent()) != null) {
|
||||
System.out.println("This need agent "
|
||||
+ runingAgent.getAgent().getHostName()
|
||||
+ " to be killed");
|
||||
|
|
|
@ -84,13 +84,13 @@ public class Test_AgentMessenger extends TestBase_MakeUpTestPlan {
|
|||
.submitScenrioWithParams(agent, model.getRunId(), paramFiles,
|
||||
inputModel, scheduleModel, new Date());
|
||||
assertEquals(model.getRunId(), modelAfter.getRunId());
|
||||
model = this.getAgentMessenger().runWithParams(agent, model.getRunId());
|
||||
model = this.getAgentMessenger().run(agent, model.getRunId());
|
||||
assertNotNull(model);
|
||||
assertNotNull(model.getRunId());
|
||||
System.out.println(model.getRunId());
|
||||
// Thread.sleep(2000);
|
||||
TestBriefStatusModel briefModel = this.getAgentMessenger()
|
||||
.scriptBriefAll(agent, model.getRunId());
|
||||
.brief(agent, model.getRunId());
|
||||
assertNotNull(briefModel);
|
||||
}
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ public class Test_MonitorResultService extends TestBase_MakeUpTestPlan {
|
|||
public void testLoadMemoryResults() throws InterruptedException,
|
||||
Bench4QException {
|
||||
assertNotNull(this.getAgentMessenger()
|
||||
.getStatus(
|
||||
.status(
|
||||
Agent.createAgentWithoutId(Test_AGENT_HOSTNAME,
|
||||
TEST_PORT, 500)));
|
||||
User user = this.getUserRepository().getUser("admin");
|
||||
|
|
|
@ -83,7 +83,7 @@ public class Test_TestPlanEngine extends TestBase_MakeUpTestPlan {
|
|||
@Test
|
||||
public void testRunTestPlanRightly() throws InterruptedException {
|
||||
assertNotNull(this.getAgentMessenger()
|
||||
.getStatus(
|
||||
.status(
|
||||
Agent.createAgentWithoutId(Test_AGENT_HOSTNAME,
|
||||
TEST_PORT, 500)));
|
||||
User user = this.getUserRepository().getUser("admin");
|
||||
|
|
|
@ -42,12 +42,12 @@ public class Mock_AgentMessenger implements AgentMessenger {
|
|||
}
|
||||
|
||||
|
||||
public RunScenarioResultModel runWithParams(Agent agent, UUID agentRunId) {
|
||||
public RunScenarioResultModel run(Agent agent, UUID agentRunId) {
|
||||
return new RunScenarioResultModel(this.testId);
|
||||
}
|
||||
|
||||
|
||||
public TestBriefStatusModel scriptBriefAll(Agent agent, UUID runId) {
|
||||
public TestBriefStatusModel brief(Agent agent, UUID runId) {
|
||||
if (isDead(agent)) {
|
||||
return null;
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ public class Mock_AgentMessenger implements AgentMessenger {
|
|||
}
|
||||
|
||||
|
||||
public ServerStatusModel getStatus(Agent agent) {
|
||||
public ServerStatusModel status(Agent agent) {
|
||||
ServerStatusModel result = new ServerStatusModel();
|
||||
if (agent.getCurrentEnumStatus() == AgentStatus.InIdle) {
|
||||
return result;
|
||||
|
@ -90,7 +90,7 @@ public class Mock_AgentMessenger implements AgentMessenger {
|
|||
}
|
||||
|
||||
|
||||
public Future<ServerStatusModel> getStatusAsync(Agent agent) {
|
||||
return new AsyncResult<ServerStatusModel>(getStatus(agent));
|
||||
public Future<ServerStatusModel> statusAsync(Agent agent) {
|
||||
return new AsyncResult<ServerStatusModel>(status(agent));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue