Search in sources :

Example 1 with TestCase

use of com.ngtesting.platform.entity.TestCase 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 2 with TestCase

use of com.ngtesting.platform.entity.TestCase 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)

Example 3 with TestCase

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

the class CaseAction 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);
    TestCase po = caseService.save(json, userVo);
    TestCaseVo caseVo = caseService.genVo(po, true);
    ret.put("data", caseVo);
    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 4 with TestCase

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

the class CaseAction method saveField.

@AuthPassport(validate = true)
@RequestMapping(value = "saveField", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> saveField(HttpServletRequest request, @RequestBody JSONObject json) {
    Map<String, Object> ret = new HashMap<String, Object>();
    UserVo userVo = (UserVo) request.getSession().getAttribute(Constant.HTTP_SESSION_USER_KEY);
    TestCase po = caseService.saveField(json, userVo);
    TestCaseVo caseVo = caseService.genVo(po);
    ret.put("data", caseVo);
    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 5 with TestCase

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

the class CaseAction method reviewPass.

@AuthPassport(validate = true)
@RequestMapping(value = "reviewPass", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> reviewPass(HttpServletRequest request, @RequestBody JSONObject json) {
    Map<String, Object> ret = new HashMap<String, Object>();
    Long id = json.getLong("id");
    Boolean pass = json.getBoolean("pass");
    TestCase po = caseService.reviewPassPers(id, pass);
    TestCaseVo caseVo = caseService.genVo(po);
    ret.put("reviewResult", caseVo);
    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

JSONObject (com.alibaba.fastjson.JSONObject)6 TestCase (com.ngtesting.platform.entity.TestCase)6 AuthPassport (com.ngtesting.platform.util.AuthPassport)6 HashMap (java.util.HashMap)6 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)6 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)6