use of com.ngtesting.platform.vo.TestPlanVo in project ngtesting-platform by aaronchen2k.
the class PlanServiceImpl method genVos.
@Override
public List<TestPlanVo> genVos(List<TestPlan> pos) {
List<TestPlanVo> vos = new LinkedList<TestPlanVo>();
for (TestPlan po : pos) {
TestPlanVo vo = genVo(po);
vos.add(vo);
}
return vos;
}
use of com.ngtesting.platform.vo.TestPlanVo in project ngtesting-platform by aaronchen2k.
the class PlanServiceImpl method save.
@Override
public TestPlan save(JSONObject json, UserVo optUser) {
Long id = json.getLong("id");
TestPlan po;
TestPlanVo vo = JSON.parseObject(JSON.toJSONString(json), TestPlanVo.class);
Constant.MsgType action;
if (id != null) {
po = (TestPlan) get(TestPlan.class, id);
action = Constant.MsgType.update;
} else {
po = new TestPlan();
action = Constant.MsgType.create;
}
po.setName(vo.getName());
po.setEstimate(vo.getEstimate());
po.setStartTime(vo.getStartTime());
po.setEndTime(vo.getEndTime());
po.setDescr(vo.getDescr());
po.setProjectId(vo.getProjectId());
saveOrUpdate(po);
historyService.create(po.getProjectId(), optUser, action.msg, TestHistory.TargetType.plan, po.getId(), po.getName());
return po;
}
use of com.ngtesting.platform.vo.TestPlanVo in project ngtesting-platform by aaronchen2k.
the class PlanAction method get.
@AuthPassport(validate = true)
@RequestMapping(value = "get", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> get(HttpServletRequest request, @RequestBody JSONObject json) {
Map<String, Object> ret = new HashMap<String, Object>();
UserVo userVo = (UserVo) request.getSession().getAttribute(Constant.HTTP_SESSION_USER_KEY);
Long projectId = json.getLong("projectId");
Long id = json.getLong("id");
TestPlanVo vo = planService.getById(id);
List<TestSuite> ls = suiteService.query(projectId, null, null);
List<TestSuiteVo> suites = suiteService.genVos(ls);
ret.put("data", vo);
ret.put("suites", suites);
ret.put("code", Constant.RespCode.SUCCESS.getCode());
return ret;
}
use of com.ngtesting.platform.vo.TestPlanVo in project ngtesting-platform by aaronchen2k.
the class PlanAction method save.
@AuthPassport(validate = true)
@RequestMapping(value = "save", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> save(HttpServletRequest request, @RequestBody JSONObject json) {
Map<String, Object> ret = new HashMap<String, Object>();
UserVo userVo = (UserVo) request.getSession().getAttribute(Constant.HTTP_SESSION_USER_KEY);
TestPlan po = planService.save(json, userVo);
TestPlanVo vo = planService.genVo(po);
optFacade.opt(WsConstant.WS_TODO, userVo.getId().toString());
ret.put("data", vo);
ret.put("code", Constant.RespCode.SUCCESS.getCode());
return ret;
}
use of com.ngtesting.platform.vo.TestPlanVo in project ngtesting-platform by aaronchen2k.
the class PlanServiceImpl method genVo.
@Override
public TestPlanVo genVo(TestPlan po) {
TestPlanVo vo = new TestPlanVo();
vo.setId(po.getId());
vo.setName(po.getName());
vo.setEstimate(po.getEstimate());
vo.setStartTime(po.getStartTime());
vo.setEndTime(po.getEndTime());
vo.setDescr(po.getDescr());
vo.setProjectId(po.getProjectId());
vo.setStatus(po.getStatus().toString());
for (TestRun run : po.getRuns()) {
TestRunVo runVo = runService.genVo(run);
vo.getRunVos().add(runVo);
}
return vo;
}
Aggregations