add server status to master,

make it easy for admin to control the test
This commit is contained in:
coderfengyun 2014-08-21 14:23:14 +08:00
parent 87d700e462
commit e8f6444084
2 changed files with 7 additions and 1 deletions

View File

@ -6,6 +6,7 @@ import java.util.UUID;
import org.bench4q.master.domain.entity.TestPlan;
import org.bench4q.master.domain.service.TestPlanService;
import org.bench4q.share.models.master.ServerStatusModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@ -28,11 +29,14 @@ public class HomeController extends BaseController {
@RequestMapping(value = { "/" }, method = RequestMethod.GET)
@ResponseBody
public void currentTasks() {
public ServerStatusModel currentTasks() {
List<UUID> tasks = new LinkedList<UUID>();
for (TestPlan testPlan : this.getTestPlanService()
.loadAllRunningTestPlans()) {
tasks.add(UUID.fromString(testPlan.getTestPlanRunId()));
}
ServerStatusModel result = new ServerStatusModel();
result.setRunningTests(tasks);
return result;
}
}

View File

@ -103,6 +103,8 @@ public class Test_TestPlanEngine extends TestBase_MakeUpTestPlan {
TestPlanStatus.valueOf(getTestPlanRepository()
.getRunningTestPlanBy(getTestPlanRunIdUuid())
.getCurrentStatus()));
assertNotNull(this.getTestPlanRepository().getRunningTestPlanBy(
getTestPlanRunIdUuid()));
for (TestPlanScript testPlanScript : testPlan.getTestPlanScripts()) {
testPlanScript.stop();
}