Search in sources :

Example 6 with TestPlan

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

the class PlanAction 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);
    TestPlan po = planService.delete(id, userVo.getId());
    ret.put("code", Constant.RespCode.SUCCESS.getCode());
    return ret;
}
Also used : 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 7 with TestPlan

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

the class PlanServiceImpl method list.

@Override
public List<TestPlan> list(Long projectId, String projectType) {
    DetachedCriteria dc = DetachedCriteria.forClass(TestPlan.class);
    dc.add(Restrictions.eq("deleted", Boolean.FALSE));
    dc.add(Restrictions.eq("disabled", Boolean.FALSE));
    if (projectType.equals(TestProject.ProjectType.project.toString())) {
        dc.add(Restrictions.eq("projectId", projectId));
    } else {
        dc.createAlias("project", "project");
        dc.add(Restrictions.eq("project.parentId", projectId));
    }
    dc.addOrder(Order.asc("createTime"));
    List<TestPlan> ls = findAllByCriteria(dc);
    return ls;
}
Also used : TestPlan(com.ngtesting.platform.entity.TestPlan) DetachedCriteria(org.hibernate.criterion.DetachedCriteria)

Example 8 with TestPlan

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

the class PlanServiceImpl method getById.

@Override
public TestPlanVo getById(Long caseId) {
    TestPlan po = (TestPlan) get(TestPlan.class, caseId);
    TestPlanVo vo = genVo(po);
    return vo;
}
Also used : TestPlanVo(com.ngtesting.platform.vo.TestPlanVo) TestPlan(com.ngtesting.platform.entity.TestPlan)

Example 9 with TestPlan

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

the class PlanServiceImpl method updatePo.

@Override
public TestPlan updatePo(TestPlanVo vo) {
    TestPlan po = new TestPlan();
    po.setName(vo.getName());
    po.setName(vo.getName());
    po.setEstimate(vo.getEstimate());
    po.setStartTime(vo.getStartTime());
    po.setEndTime(vo.getEndTime());
    po.setDescr(vo.getDescr());
    po.setProjectId(vo.getProjectId());
    return po;
}
Also used : TestPlan(com.ngtesting.platform.entity.TestPlan)

Example 10 with TestPlan

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

the class AlertServiceImpl method saveAlert.

@Override
public void saveAlert(TestRun run) {
    for (TestUser user : run.getAssignees()) {
        TestAlert po = getByRun(run.getId());
        ;
        if (po == null) {
            po = new TestAlert();
        }
        po.setType("run");
        po.setDescr(run.getDescr());
        po.setEntityId(run.getId());
        po.setEntityName(run.getName());
        po.setStatus(run.getStatus().toString());
        po.setRead(false);
        po.setUserId(run.getUserId());
        po.setAssigneeId(user.getId());
        TestPlan plan = run.getPlan();
        if (plan == null || plan.getId() == null) {
            plan = (TestPlan) get(TestPlan.class, run.getPlanId());
        }
        po.setStartTime(plan.getStartTime());
        po.setEndTime(plan.getEndTime());
        saveOrUpdate(po);
    }
}
Also used : TestPlan(com.ngtesting.platform.entity.TestPlan) TestAlert(com.ngtesting.platform.entity.TestAlert) TestUser(com.ngtesting.platform.entity.TestUser)

Aggregations

TestPlan (com.ngtesting.platform.entity.TestPlan)10 TestPlanVo (com.ngtesting.platform.vo.TestPlanVo)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 DetachedCriteria (org.hibernate.criterion.DetachedCriteria)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)2 Constant (com.ngtesting.platform.config.Constant)1 TestAlert (com.ngtesting.platform.entity.TestAlert)1 TestUser (com.ngtesting.platform.entity.TestUser)1 LinkedList (java.util.LinkedList)1