Search in sources :

Example 16 with AuthPassport

use of com.ngtesting.platform.util.AuthPassport 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 17 with AuthPassport

use of com.ngtesting.platform.util.AuthPassport 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 18 with AuthPassport

use of com.ngtesting.platform.util.AuthPassport 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;
}
Also used : UserVo(com.ngtesting.platform.vo.UserVo) 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 19 with AuthPassport

use of com.ngtesting.platform.util.AuthPassport in project ngtesting-platform by aaronchen2k.

the class CaseAction 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);
    TestCase testCase = caseService.delete(id, userVo);
    caseService.updateParentIfNeededPers(testCase.getpId());
    ret.put("code", Constant.RespCode.SUCCESS.getCode());
    return ret;
}
Also used : HashMap(java.util.HashMap) TestCase(com.ngtesting.platform.entity.TestCase) 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 20 with AuthPassport

use of com.ngtesting.platform.util.AuthPassport in project ngtesting-platform by aaronchen2k.

the class CaseAction method changeContentType.

@AuthPassport(validate = true)
@RequestMapping(value = "changeContentType", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> changeContentType(HttpServletRequest request, @RequestBody JSONObject json) {
    Map<String, Object> ret = new HashMap<String, Object>();
    Long id = json.getLong("id");
    String contentType = json.getString("contentType");
    TestCase po = caseService.changeContentTypePers(id, contentType);
    ret.put("code", Constant.RespCode.SUCCESS.getCode());
    return ret;
}
Also used : HashMap(java.util.HashMap) TestCase(com.ngtesting.platform.entity.TestCase) 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)

Aggregations

AuthPassport (com.ngtesting.platform.util.AuthPassport)100 HashMap (java.util.HashMap)100 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)99 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)99 JSONObject (com.alibaba.fastjson.JSONObject)98 UserVo (com.ngtesting.platform.vo.UserVo)78 TestUser (com.ngtesting.platform.entity.TestUser)12 List (java.util.List)12 TestCase (com.ngtesting.platform.entity.TestCase)6 CasePriorityVo (com.ngtesting.platform.vo.CasePriorityVo)5 CaseTypeVo (com.ngtesting.platform.vo.CaseTypeVo)5 TestProject (com.ngtesting.platform.entity.TestProject)4 TestRun (com.ngtesting.platform.entity.TestRun)4 TestSuite (com.ngtesting.platform.entity.TestSuite)4 CustomFieldVo (com.ngtesting.platform.vo.CustomFieldVo)4 OrgGroupVo (com.ngtesting.platform.vo.OrgGroupVo)4 Page (com.ngtesting.platform.vo.Page)4 TestCaseInRunVo (com.ngtesting.platform.vo.TestCaseInRunVo)4 TestRunVo (com.ngtesting.platform.vo.TestRunVo)4 TestSuiteVo (com.ngtesting.platform.vo.TestSuiteVo)4