refactor, and move judging the script isFinish method to ExecuteOverTask
This commit is contained in:
parent
8aaa832226
commit
d7a4d6441d
|
@ -7,7 +7,6 @@ import org.bench4q.master.communication.AgentStateService;
|
|||
import org.bench4q.master.entity.db.Agent;
|
||||
import org.bench4q.master.service.AgentService;
|
||||
import org.bench4q.master.service.UserService;
|
||||
import org.bench4q.master.testPlan.highavailable.HighAvailablePool;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
@ -21,7 +20,6 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
|||
public class AgentController extends BaseController {
|
||||
private AgentService agentPoolService;
|
||||
private AgentStateService agentStateService;
|
||||
private HighAvailablePool highAvailablePool;
|
||||
|
||||
public AgentStateService getAgentStateService() {
|
||||
return agentStateService;
|
||||
|
@ -41,15 +39,6 @@ public class AgentController extends BaseController {
|
|||
this.agentPoolService = agentPoolService;
|
||||
}
|
||||
|
||||
public HighAvailablePool getHighAvailablePool() {
|
||||
return highAvailablePool;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setHighAvailablePool(HighAvailablePool highAvailablePool) {
|
||||
this.highAvailablePool = highAvailablePool;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/addAgentToPool", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public AgentResponseModel addAgentToPool(@RequestBody Agent agent) {
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.bench4q.master.api.model;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||
|
@ -14,6 +15,7 @@ public class RunningScriptModel {
|
|||
private TestScriptConfig config;
|
||||
private boolean finish;
|
||||
private List<RunningAgentModel> runningAgents = new ArrayList<RunningAgentModel>();
|
||||
private UUID testPlanID;
|
||||
|
||||
@XmlElement
|
||||
public int getScriptId() {
|
||||
|
@ -61,4 +63,12 @@ public class RunningScriptModel {
|
|||
this.runningAgents = runningAgents;
|
||||
}
|
||||
|
||||
public UUID getTestPlanID() {
|
||||
return testPlanID;
|
||||
}
|
||||
|
||||
public void setTestPlanID(UUID testPlanID) {
|
||||
this.testPlanID = testPlanID;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -49,20 +49,4 @@ public class TestPlanContainer {
|
|||
}
|
||||
return finish;
|
||||
}
|
||||
|
||||
// @Scheduled(cron = "15 */1 * * * *")
|
||||
// public void queryFinished() {
|
||||
// if (this.getTaskQueue().isEmpty()) {
|
||||
// return;
|
||||
// }
|
||||
// for (UUID testPlanId : this.getTaskQueue().keySet()) {
|
||||
// TestPlanContext testPlanContext = this.getTaskQueue().get(
|
||||
// testPlanId);
|
||||
// if (testPlanContext == null) {
|
||||
// return;
|
||||
// }
|
||||
// testPlanContext.executeScriptsBrief();
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
|
@ -67,7 +67,6 @@ public class TestPlanContext {
|
|||
int result = 0;
|
||||
for (RunningScriptModel runningScriptModel : this.getRunningScriptMap()
|
||||
.values()) {
|
||||
|
||||
result += runningScriptModel.getRequireLoad();
|
||||
}
|
||||
return result;
|
||||
|
|
|
@ -121,7 +121,6 @@ public class HighAvailablePool {
|
|||
_doForBreakDown(model, agents.get(i).getHostName());
|
||||
continue;
|
||||
}
|
||||
|
||||
_doForHealth(model, agents.get(i));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -119,6 +119,7 @@ public abstract class ScriptLoadBase implements LoadTransaction {
|
|||
}
|
||||
result.setRequireLoad(this.getRunningScriptModel().getRequireLoad());
|
||||
result.setConfig(this.getRunningScriptModel().getConfig());
|
||||
result.setTestPlanID(this.getTestPlanRunID());
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ public class ExecutionOverTask extends TimerTask {
|
|||
this.agentService.stop(runningAgentModel.getAgent(),
|
||||
runningAgentModel.getAgentRunId());
|
||||
}
|
||||
this.getRunningScriptModel().setFinish(true);
|
||||
System.out.println("execute ExecutionOverTask");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue