Search in sources :

Example 1 with TestSuite

use of com.ngtesting.platform.entity.TestSuite 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;
}
Also used : TestPlanVo(com.ngtesting.platform.vo.TestPlanVo) UserVo(com.ngtesting.platform.vo.UserVo) TestSuite(com.ngtesting.platform.entity.TestSuite) HashMap(java.util.HashMap) JSONObject(com.alibaba.fastjson.JSONObject) TestSuiteVo(com.ngtesting.platform.vo.TestSuiteVo) AuthPassport(com.ngtesting.platform.util.AuthPassport) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 2 with TestSuite

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

the class SuiteAction 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);
    TestSuite po = suiteService.delete(id, userVo.getId());
    ret.put("code", Constant.RespCode.SUCCESS.getCode());
    return ret;
}
Also used : UserVo(com.ngtesting.platform.vo.UserVo) TestSuite(com.ngtesting.platform.entity.TestSuite) HashMap(java.util.HashMap) 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 TestSuite

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

the class SuiteAction 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);
    TestSuite po = suiteService.saveCases(json, userVo);
    TestSuiteVo runVo = suiteService.genVo(po);
    ret.put("data", runVo);
    ret.put("code", Constant.RespCode.SUCCESS.getCode());
    return ret;
}
Also used : UserVo(com.ngtesting.platform.vo.UserVo) TestSuite(com.ngtesting.platform.entity.TestSuite) HashMap(java.util.HashMap) JSONObject(com.alibaba.fastjson.JSONObject) TestSuiteVo(com.ngtesting.platform.vo.TestSuiteVo) AuthPassport(com.ngtesting.platform.util.AuthPassport) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 4 with TestSuite

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

the class SuiteAction 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);
    TestSuite po = suiteService.save(json, userVo);
    TestSuiteVo vo = suiteService.genVo(po);
    ret.put("data", vo);
    ret.put("code", Constant.RespCode.SUCCESS.getCode());
    return ret;
}
Also used : UserVo(com.ngtesting.platform.vo.UserVo) TestSuite(com.ngtesting.platform.entity.TestSuite) HashMap(java.util.HashMap) JSONObject(com.alibaba.fastjson.JSONObject) TestSuiteVo(com.ngtesting.platform.vo.TestSuiteVo) AuthPassport(com.ngtesting.platform.util.AuthPassport) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

JSONObject (com.alibaba.fastjson.JSONObject)4 TestSuite (com.ngtesting.platform.entity.TestSuite)4 AuthPassport (com.ngtesting.platform.util.AuthPassport)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 TestSuiteVo (com.ngtesting.platform.vo.TestSuiteVo)3 TestPlanVo (com.ngtesting.platform.vo.TestPlanVo)1