Search in sources :

Example 1 with TestPlanVo

use of com.ngtesting.platform.vo.TestPlanVo in project ngtesting-platform by aaronchen2k.

the class PlanServiceImpl method genVos.

@Override
public List<TestPlanVo> genVos(List<TestPlan> pos) {
    List<TestPlanVo> vos = new LinkedList<TestPlanVo>();
    for (TestPlan po : pos) {
        TestPlanVo vo = genVo(po);
        vos.add(vo);
    }
    return vos;
}
Also used : TestPlanVo(com.ngtesting.platform.vo.TestPlanVo) TestPlan(com.ngtesting.platform.entity.TestPlan) LinkedList(java.util.LinkedList)

Example 2 with TestPlanVo

use of com.ngtesting.platform.vo.TestPlanVo in project ngtesting-platform by aaronchen2k.

the class PlanServiceImpl method save.

@Override
public TestPlan save(JSONObject json, UserVo optUser) {
    Long id = json.getLong("id");
    TestPlan po;
    TestPlanVo vo = JSON.parseObject(JSON.toJSONString(json), TestPlanVo.class);
    Constant.MsgType action;
    if (id != null) {
        po = (TestPlan) get(TestPlan.class, id);
        action = Constant.MsgType.update;
    } else {
        po = new TestPlan();
        action = Constant.MsgType.create;
    }
    po.setName(vo.getName());
    po.setEstimate(vo.getEstimate());
    po.setStartTime(vo.getStartTime());
    po.setEndTime(vo.getEndTime());
    po.setDescr(vo.getDescr());
    po.setProjectId(vo.getProjectId());
    saveOrUpdate(po);
    historyService.create(po.getProjectId(), optUser, action.msg, TestHistory.TargetType.plan, po.getId(), po.getName());
    return po;
}
Also used : TestPlanVo(com.ngtesting.platform.vo.TestPlanVo) TestPlan(com.ngtesting.platform.entity.TestPlan) Constant(com.ngtesting.platform.config.Constant)

Example 3 with TestPlanVo

use of com.ngtesting.platform.vo.TestPlanVo 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 4 with TestPlanVo

use of com.ngtesting.platform.vo.TestPlanVo in project ngtesting-platform by aaronchen2k.

the class PlanAction 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);
    TestPlan po = planService.save(json, userVo);
    TestPlanVo vo = planService.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 : TestPlanVo(com.ngtesting.platform.vo.TestPlanVo) UserVo(com.ngtesting.platform.vo.UserVo) HashMap(java.util.HashMap) TestPlan(com.ngtesting.platform.entity.TestPlan) 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 TestPlanVo

use of com.ngtesting.platform.vo.TestPlanVo in project ngtesting-platform by aaronchen2k.

the class PlanServiceImpl method genVo.

@Override
public TestPlanVo genVo(TestPlan po) {
    TestPlanVo vo = new TestPlanVo();
    vo.setId(po.getId());
    vo.setName(po.getName());
    vo.setEstimate(po.getEstimate());
    vo.setStartTime(po.getStartTime());
    vo.setEndTime(po.getEndTime());
    vo.setDescr(po.getDescr());
    vo.setProjectId(po.getProjectId());
    vo.setStatus(po.getStatus().toString());
    for (TestRun run : po.getRuns()) {
        TestRunVo runVo = runService.genVo(run);
        vo.getRunVos().add(runVo);
    }
    return vo;
}
Also used : TestPlanVo(com.ngtesting.platform.vo.TestPlanVo) TestRun(com.ngtesting.platform.entity.TestRun) TestRunVo(com.ngtesting.platform.vo.TestRunVo)

Aggregations

TestPlanVo (com.ngtesting.platform.vo.TestPlanVo)6 TestPlan (com.ngtesting.platform.entity.TestPlan)4 JSONObject (com.alibaba.fastjson.JSONObject)2 AuthPassport (com.ngtesting.platform.util.AuthPassport)2 UserVo (com.ngtesting.platform.vo.UserVo)2 HashMap (java.util.HashMap)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)2 Constant (com.ngtesting.platform.config.Constant)1 TestRun (com.ngtesting.platform.entity.TestRun)1 TestSuite (com.ngtesting.platform.entity.TestSuite)1 TestRunVo (com.ngtesting.platform.vo.TestRunVo)1 TestSuiteVo (com.ngtesting.platform.vo.TestSuiteVo)1 LinkedList (java.util.LinkedList)1