@Override public Map<String, Object> handleController(HttpServletRequest request) throws Exception { Map<String, Object> model = new HashMap<String, Object>(); Long id = Long.parseLong(request.getPathInfo().substring(8)); TestRun testRun = testRunDAO.getRunById(id); if (testRun == null) { throw new UnexistentResource("Test run with id = " + id + " doesn't exist"); } Long projectId = testRun.getProjectId(); Long testId = testRun.getTestId(); Long suiteRunId = testRun.getSuiteRunId(); model.put("testRun", testRun); if (projectId != null && projectId > 0) { model.put("project", projectDAO.getProject(projectId)); } if (testId != null && testId > 0) { model.put("test", testDAO.getTest(testId)); } if (suiteRunId != null && suiteRunId > 0) { model.put("suiteRun", testRunDAO.getSuiteRun(suiteRunId)); } model.put("testRunParameters", testRunDAO.getTestRunParameters(testRun.getId())); if (testRun.getIssueId() != null && testRun.getIssueId() > 0) { model.put("issue", issueDAO.getIssue(testRun.getIssueId())); } XmlReportRender reportRender = new XmlReportRender(); ReportNode reportNode = reportRender.decode(testRun.getReport()); updateReport(reportNode, 0, new IdGenerator()); JSONValue jsonValue = JSONMapper.toJSON(reportNode); String jsonString = jsonValue.render(false); model.put("report", reportNode); model.put("json", jsonString); return model; }
@SuppressWarnings({"unchecked", "rawtypes"}) @Override protected Map referenceData(HttpServletRequest request, Object command, Errors errors) throws Exception { SearchFilter filter = (SearchFilter) command; filter.setColumnList(columnFactory.getColumnList()); TestRunSearchResult searchResult = testRunDAO.browseRuns(filter); searchResult.handleTheList(); searchResult.setColumns(columnFactory.getColumnList()); searchResult.setPage(filter.getPageOffset()); if (filter.getPageLimit() >= 0 && filter.getPageLimit() < filter.getPageLimitArray().length) { searchResult.setDisplayRows(filter.getPageLimitArray()[filter.getPageLimit()]); } else searchResult.setDisplayRows(filter.getPageLimitArray()[0]); Map referenceData = new HashMap(); referenceData.put("searchResult", searchResult); return referenceData; }