Search in sources :

Example 6 with TestCaseStep

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

the class CaseStepAction 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);
    TestCaseStep po = caseStepService.save(json, 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 7 with TestCaseStep

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

the class CaseStepServiceImpl method save.

@Override
public TestCaseStep save(JSONObject json, Long userId) {
    TestCaseStepVo vo = JSON.parseObject(JSON.toJSONString(json), TestCaseStepVo.class);
    TestCaseStep po = new TestCaseStep();
    if (vo.getId() != null) {
        po = (TestCaseStep) get(TestCaseStep.class, vo.getId());
        BeanUtilEx.copyProperties(po, vo);
    } else {
        BeanUtilEx.copyProperties(po, vo);
        po.setId(null);
        moveOthersPers(vo.getTestCaseId(), vo.getOrdr(), "down");
    }
    saveOrUpdate(po);
    return po;
}
Also used : TestCaseStepVo(com.ngtesting.platform.vo.TestCaseStepVo) TestCaseStep(com.ngtesting.platform.entity.TestCaseStep)

Aggregations

TestCaseStep (com.ngtesting.platform.entity.TestCaseStep)7 TestCaseStepVo (com.ngtesting.platform.vo.TestCaseStepVo)4 JSONObject (com.alibaba.fastjson.JSONObject)3 AuthPassport (com.ngtesting.platform.util.AuthPassport)3 UserVo (com.ngtesting.platform.vo.UserVo)3 HashMap (java.util.HashMap)3 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)3