Search in sources :

Example 76 with AuthPassport

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

the class CasePriorityAction method changeOrder.

@AuthPassport(validate = true)
@RequestMapping(value = "changeOrder", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> changeOrder(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 orgId = userVo.getDefaultOrgId();
    Long id = json.getLong("id");
    String act = json.getString("act");
    boolean success = casePriorityService.changeOrderPers(id, act, orgId);
    List<CasePriorityVo> vos = casePriorityService.listVos(orgId);
    ret.put("data", vos);
    ret.put("code", Constant.RespCode.SUCCESS.getCode());
    return ret;
}
Also used : UserVo(com.ngtesting.platform.vo.UserVo) HashMap(java.util.HashMap) CasePriorityVo(com.ngtesting.platform.vo.CasePriorityVo) 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 77 with AuthPassport

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

the class CasePriorityAction method list.

@AuthPassport(validate = true)
@RequestMapping(value = "list", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> list(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 orgId = userVo.getDefaultOrgId();
    List<CasePriorityVo> vos = casePriorityService.listVos(orgId);
    ret.put("data", vos);
    ret.put("code", Constant.RespCode.SUCCESS.getCode());
    return ret;
}
Also used : UserVo(com.ngtesting.platform.vo.UserVo) HashMap(java.util.HashMap) CasePriorityVo(com.ngtesting.platform.vo.CasePriorityVo) 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 78 with AuthPassport

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

the class CasePriorityAction 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");
    if (id == null) {
        ret.put("data", new CasePriorityVo());
        ret.put("code", Constant.RespCode.SUCCESS.getCode());
        return ret;
    }
    TestCasePriority po = (TestCasePriority) casePriorityService.get(TestCasePriority.class, id);
    CasePriorityVo vo = casePriorityService.genVo(po);
    ret.put("data", vo);
    ret.put("code", Constant.RespCode.SUCCESS.getCode());
    return ret;
}
Also used : TestCasePriority(com.ngtesting.platform.entity.TestCasePriority) UserVo(com.ngtesting.platform.vo.UserVo) HashMap(java.util.HashMap) CasePriorityVo(com.ngtesting.platform.vo.CasePriorityVo) 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 79 with AuthPassport

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

the class CaseStepAction method up.

@AuthPassport(validate = true)
@RequestMapping(value = "up", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> up(HttpServletRequest request, @RequestBody JSONObject json) {
    Map<String, Object> ret = new HashMap<String, Object>();
    UserVo userVo = (UserVo) request.getSession().getAttribute(Constant.HTTP_SESSION_USER_KEY);
    TestCaseStep po = caseStepService.changeOrderPers(json, "up", userVo.getId());
    TestCaseStepVo stepVo = caseStepService.genVo(po);
    ret.put("data", stepVo);
    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) TestCaseStep(com.ngtesting.platform.entity.TestCaseStep) TestCaseStepVo(com.ngtesting.platform.vo.TestCaseStepVo) AuthPassport(com.ngtesting.platform.util.AuthPassport) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 80 with AuthPassport

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

the class CaseStepAction method down.

@AuthPassport(validate = true)
@RequestMapping(value = "down", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> down(HttpServletRequest request, @RequestBody JSONObject json) {
    Map<String, Object> ret = new HashMap<String, Object>();
    UserVo userVo = (UserVo) request.getSession().getAttribute(Constant.HTTP_SESSION_USER_KEY);
    TestCaseStep po = caseStepService.changeOrderPers(json, "down", userVo.getId());
    TestCaseStepVo stepVo = caseStepService.genVo(po);
    ret.put("data", stepVo);
    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) TestCaseStep(com.ngtesting.platform.entity.TestCaseStep) TestCaseStepVo(com.ngtesting.platform.vo.TestCaseStepVo) 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