use of com.ngtesting.platform.vo.TestSuiteVo in project ngtesting-platform by aaronchen2k.
the class SuiteServiceImpl method save.
@Override
public TestSuite save(JSONObject json, UserVo optUser) {
Long id = json.getLong("id");
TestSuite po;
TestSuiteVo vo = JSON.parseObject(JSON.toJSONString(json), TestSuiteVo.class);
Constant.MsgType action;
if (id != null) {
po = (TestSuite) get(TestSuite.class, id);
action = Constant.MsgType.update;
} else {
po = new TestSuite();
action = Constant.MsgType.create;
}
po.setName(vo.getName());
po.setEstimate(vo.getEstimate());
po.setDescr(vo.getDescr());
po.setProjectId(vo.getProjectId());
po.setUserId(optUser.getId());
saveOrUpdate(po);
historyService.create(po.getProjectId(), optUser, action.msg, TestHistory.TargetType.suite, po.getId(), po.getName());
return po;
}
use of com.ngtesting.platform.vo.TestSuiteVo in project ngtesting-platform by aaronchen2k.
the class SuiteServiceImpl method genVo.
@Override
public TestSuiteVo genVo(TestSuite po, Boolean withCases) {
TestSuiteVo vo = new TestSuiteVo();
vo.setId(po.getId());
vo.setName(po.getName());
vo.setEstimate(po.getEstimate());
vo.setDescr(po.getDescr());
vo.setProjectId(po.getProjectId());
vo.setUserId(po.getUserId());
TestUser user = (TestUser) get(TestUser.class, po.getUserId());
vo.setUserName(user.getName());
vo.setCreateTime(po.getCreateTime());
vo.setUpdateTime(po.getUpdateTime());
int count = 0;
if (withCases) {
for (TestCaseInSuite p : po.getTestcases()) {
TestCaseInSuiteVo v = genCaseVo(p);
vo.getTestcases().add(v);
if (p.getLeaf()) {
count++;
}
}
} else {
vo.setCount(countCase(vo.getId()).intValue());
}
return vo;
}
use of com.ngtesting.platform.vo.TestSuiteVo in project ngtesting-platform by aaronchen2k.
the class SuiteServiceImpl method getById.
@Override
public TestSuiteVo getById(Long caseId) {
TestSuite po = (TestSuite) get(TestSuite.class, caseId);
TestSuiteVo vo = genVo(po);
return vo;
}
use of com.ngtesting.platform.vo.TestSuiteVo 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.TestSuiteVo in project ngtesting-platform by aaronchen2k.
the class SuiteAction 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 id = json.getLong("id");
TestSuiteVo vo = suiteService.getById(id, false);
ret.put("data", vo);
ret.put("code", Constant.RespCode.SUCCESS.getCode());
return ret;
}
Aggregations