Search in sources :

Example 1 with TestRun

use of com.ngtesting.platform.entity.TestRun in project ngtesting-platform by aaronchen2k.

the class RunAction method close.

@AuthPassport(validate = true)
@RequestMapping(value = "close", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> close(HttpServletRequest request, @RequestBody JSONObject json) {
    Map<String, Object> ret = new HashMap<String, Object>();
    Long id = json.getLong("id");
    UserVo userVo = (UserVo) request.getSession().getAttribute(Constant.HTTP_SESSION_USER_KEY);
    TestRun po = runService.closePers(id, userVo.getId());
    runService.closePlanIfAllRunClosedPers(po.getPlanId());
    TestRunVo vo = runService.genVo(po);
    ret.put("data", vo);
    ret.put("code", Constant.RespCode.SUCCESS.getCode());
    return ret;
}
Also used : UserVo(com.ngtesting.platform.vo.UserVo) HashMap(java.util.HashMap) TestRun(com.ngtesting.platform.entity.TestRun) TestRunVo(com.ngtesting.platform.vo.TestRunVo) JSONObject(com.alibaba.fastjson.JSONObject) AuthPassport(com.ngtesting.platform.util.AuthPassport) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 2 with TestRun

use of com.ngtesting.platform.entity.TestRun in project ngtesting-platform by aaronchen2k.

the class RunAction method delete.

@AuthPassport(validate = true)
@RequestMapping(value = "delete", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> delete(HttpServletRequest request, @RequestBody JSONObject json) {
    Map<String, Object> ret = new HashMap<String, Object>();
    Long id = json.getLong("id");
    UserVo userVo = (UserVo) request.getSession().getAttribute(Constant.HTTP_SESSION_USER_KEY);
    TestRun po = runService.delete(id, userVo.getId());
    ret.put("code", Constant.RespCode.SUCCESS.getCode());
    return ret;
}
Also used : UserVo(com.ngtesting.platform.vo.UserVo) HashMap(java.util.HashMap) TestRun(com.ngtesting.platform.entity.TestRun) JSONObject(com.alibaba.fastjson.JSONObject) AuthPassport(com.ngtesting.platform.util.AuthPassport) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 3 with TestRun

use of com.ngtesting.platform.entity.TestRun in project ngtesting-platform by aaronchen2k.

the class RunAction 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);
    TestRun po = runService.save(json, userVo);
    TestRunVo vo = runService.genVo(po);
    optFacade.opt(WsConstant.WS_TODO, userVo.getId().toString());
    ret.put("data", vo);
    ret.put("code", Constant.RespCode.SUCCESS.getCode());
    return ret;
}
Also used : UserVo(com.ngtesting.platform.vo.UserVo) HashMap(java.util.HashMap) TestRun(com.ngtesting.platform.entity.TestRun) TestRunVo(com.ngtesting.platform.vo.TestRunVo) JSONObject(com.alibaba.fastjson.JSONObject) AuthPassport(com.ngtesting.platform.util.AuthPassport) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 4 with TestRun

use of com.ngtesting.platform.entity.TestRun in project ngtesting-platform by aaronchen2k.

the class RunAction method saveCases.

@AuthPassport(validate = true)
@RequestMapping(value = "saveCases", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> saveCases(HttpServletRequest request, @RequestBody JSONObject json) {
    Map<String, Object> ret = new HashMap<String, Object>();
    UserVo userVo = (UserVo) request.getSession().getAttribute(Constant.HTTP_SESSION_USER_KEY);
    TestRun po = runService.saveCases(json, userVo);
    TestRunVo caseVo = runService.genVo(po);
    ret.put("data", caseVo);
    ret.put("code", Constant.RespCode.SUCCESS.getCode());
    return ret;
}
Also used : UserVo(com.ngtesting.platform.vo.UserVo) HashMap(java.util.HashMap) TestRun(com.ngtesting.platform.entity.TestRun) TestRunVo(com.ngtesting.platform.vo.TestRunVo) JSONObject(com.alibaba.fastjson.JSONObject) AuthPassport(com.ngtesting.platform.util.AuthPassport) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 5 with TestRun

use of com.ngtesting.platform.entity.TestRun 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;
}
Also used : TestPlanVo(com.ngtesting.platform.vo.TestPlanVo) TestRun(com.ngtesting.platform.entity.TestRun) TestRunVo(com.ngtesting.platform.vo.TestRunVo)

Aggregations

TestRun (com.ngtesting.platform.entity.TestRun)5 JSONObject (com.alibaba.fastjson.JSONObject)4 AuthPassport (com.ngtesting.platform.util.AuthPassport)4 TestRunVo (com.ngtesting.platform.vo.TestRunVo)4 UserVo (com.ngtesting.platform.vo.UserVo)4 HashMap (java.util.HashMap)4 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)4 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)4 TestPlanVo (com.ngtesting.platform.vo.TestPlanVo)1