/** * This method gets execution results for Test Execution Results tab on clicking show results. * * @param dbName * @param projectName * @param stageName * @return * @throws QueryException */ public static TestExecResultListDTO getTestExecResults( String dbName, String projectName, String stageName) throws QueryException { if (logger.isDebugEnabled()) { logger.debug("start readTotalActiveOverAllDefectDensityDetails/getTestExecResults"); } final TestExecResultListDTO testExeclistDTO = new TestExecResultListDTO(); final List<TestExecResultsDTO> TestExecDTOasList = new ArrayList<TestExecResultsDTO>(); MapStream inputs = null; List<Object> inputBugStatusList = null; if (stageName != null && stageName.equalsIgnoreCase(GlobalConstants.ALL_STAGES)) { if (logger.isDebugEnabled()) { logger.info("Test Execution Results Query for All Stages."); } inputs = new MapStream("readTotalActiveOverAllDefectDensityDetails"); inputs.put("qcrDatabaseName", dbName); inputBugStatusList = new ArrayList<Object>(); inputBugStatusList.add(GlobalConstants.CLOSED); inputBugStatusList.add(GlobalConstants.CLOSED); inputs.put("bugStatusList", inputBugStatusList); inputs.put("releaseName1", projectName); inputs.put("releaseName2", projectName); inputs.put("releaseName3", projectName); inputs.put("releaseName4", projectName); inputs.put("releaseName5", projectName); inputs.put("releaseName6", projectName); } else { if (logger.isDebugEnabled()) { logger.info("Test Execution Results Query for Particular Stage."); } inputs = new MapStream("readTotalActiveOverAllDefectDensityDetails"); inputs.put("qcrDatabaseName", dbName); inputBugStatusList = new ArrayList<Object>(); inputs.put("releaseName1", projectName); inputs.put("releaseCyclesName1", stageName); // optional inputs.put("releaseName2", projectName); inputs.put("releaseCyclesName2", stageName); // optional inputs.put("releaseName3", projectName); inputs.put("releaseCyclesName3", stageName); // optional inputs.put("releaseName4", projectName); inputs.put("releaseCyclesName4", stageName); // optional inputs.put("releaseName5", projectName); inputs.put("releaseCyclesName5", stageName); // optional inputBugStatusList.add(GlobalConstants.CLOSED); inputBugStatusList.add(GlobalConstants.CLOSED); inputs.put("bugStatusList", inputBugStatusList); inputs.put("releaseName6", projectName); inputs.put("releaseCyclesName6", stageName); // optional } if (logger.isDebugEnabled()) { logger.debug("executing the query"); } try { BasicDAO.getResult( GlobalConstants.CONTRACT_NAME, GlobalConstants.BUSINESS_USE_ID, GlobalConstants.CONTRACT_VERSION, inputs, new ResultsReader() { public void readResults(Results results, Query query, Inputs inputs) throws QueryException { TestExecResultsDTO testExecDetailDTO = null; String testType = null; while (results.next()) { testType = results.getString("testType"); if (testType != null && testType.length() > 0) { testExecDetailDTO = new TestExecResultsDTO(); if (testType != null && testType.contains("&")) testType = testType.replace("&", "and"); testExecDetailDTO.setTestType(testType); testExecDetailDTO.setPlanned(results.getInt("planned")); testExecDetailDTO.setPassed(results.getInt("passed")); testExecDetailDTO.setFailed(results.getInt("failed")); testExecDetailDTO.setInProgress(results.getInt("inProgress")); testExecDetailDTO.setNoRun(results.getInt("noRun")); testExecDetailDTO.setBlocked(results.getInt("blocked")); testExecDetailDTO.setDescoped(results.getInt("descoped")); testExecDetailDTO.setTotActive(results.getInt("totalActive")); testExecDetailDTO.setTotOverall(results.getInt("totalOverall")); testExecDetailDTO.setDefectDensity(results.getInt("defectDensity")); TestExecDTOasList.add(testExecDetailDTO); } } testExeclistDTO.setTestExecDTO(TestExecDTOasList); } }); } catch (Exception e) { logger.fatal("Error occured while getting exection details", e); } if (logger.isDebugEnabled()) { logger.debug("finish readTotalActiveOverAllDefectDensityDetails/getTestExecResults"); logger.debug("returning " + TestExecDTOasList.size() + " item(s)"); } return testExeclistDTO; }
/** * This method gets active defects for given inputs with release cycle(s) Release cycle as All * Stages and for selected cycle or stage. * * @param projName * @param stageName * @param dbName * @return * @throws QueryException */ public static ActiveDefectsListDTO getActiveDefects( final String projName, final String stageName, final String dbName) throws QueryException { if (logger.isDebugEnabled()) { logger.debug("start readBugDefectDetailsByInputList/getActiveDefects"); } final ActiveDefectsListDTO activeDeflistDTO = new ActiveDefectsListDTO(); final List<ActiveDefectsDTO> activeDefectDTOasList = new ArrayList<ActiveDefectsDTO>(); MapStream inputs = new MapStream("readBugDefectDetailsByInputList"); List<Object> inputBugStatusList = null; inputs.put("qcrDatabaseName", dbName); if (stageName != null && stageName.equalsIgnoreCase(GlobalConstants.ALL_STAGES)) { // GET_ACTIVE_DEFECTS inputBugStatusList = new ArrayList<Object>(); inputBugStatusList.add(GlobalConstants.CLOSED); inputs.put("bugStatusList", inputBugStatusList); inputs.put("releaseName", projName); } else { // GET_ACTIVE_DEFECTS_STAGE inputBugStatusList = new ArrayList<Object>(); inputBugStatusList.add(GlobalConstants.CLOSED); inputs.put("bugStatusList", inputBugStatusList); inputs.put("releaseName", projName); inputs.put("releaseCyclesName", stageName); // optional } if (logger.isDebugEnabled()) { logger.debug("executing the query"); } BasicDAO.getResult( GlobalConstants.CONTRACT_NAME, GlobalConstants.BUSINESS_USE_ID, GlobalConstants.CONTRACT_VERSION, inputs, new ResultsReader() { public void readResults(Results results, Query query, Inputs inputs) throws QueryException { ActiveDefectsDTO activeDefectDetailDTO = null; while (results.next()) { activeDefectDetailDTO = new ActiveDefectsDTO(); String businessImpact = null; activeDefectDetailDTO.setSerialNumber(results.getInt("serialNumber")); activeDefectDetailDTO.setDefectNumber(results.getInt("defectNumber")); activeDefectDetailDTO.setSeverity(results.getString("severity")); activeDefectDetailDTO.setDefectDescription(results.getString("defectDescription")); activeDefectDetailDTO.setStatus(results.getString("status")); if (results.getString("businessImpact") != null) { businessImpact = results.getString("businessImpact"); if (businessImpact != null && businessImpact.trim().length() > 0) { businessImpact = AppUtil.clearHTMLTags(businessImpact, -1); activeDefectDetailDTO.setBusinessImpact(businessImpact.trim()); } } else { activeDefectDetailDTO.setBusinessImpact(""); } activeDefectDTOasList.add(activeDefectDetailDTO); } activeDeflistDTO.setActiveDefectsDTO(activeDefectDTOasList); } }); if (logger.isDebugEnabled()) { logger.debug("finish readBugDefectDetailsByInputList"); logger.debug("returning " + activeDefectDTOasList.size() + " item(s)"); } return activeDeflistDTO; }