@Test public void testGetResultByThemeCount() { Theme theme1 = themeDAO.read(Long.valueOf(1)); Theme theme2 = themeDAO.read(Long.valueOf(2)); WebResource wa = webresourceDAO.read(Long.valueOf(1)); assertEquals(1, processResultDAO.getResultByThemeCount (wa, TestSolution.PASSED, theme1)); assertEquals(0, processResultDAO.getResultByThemeCount (wa, TestSolution.FAILED, theme1)); assertEquals(1, processResultDAO.getResultByThemeCount (wa, TestSolution.NEED_MORE_INFO, theme1)); assertEquals(0, processResultDAO.getResultByThemeCount (wa, TestSolution.NOT_APPLICABLE, theme1)); assertEquals(1, processResultDAO.getResultByThemeCount (wa, TestSolution.PASSED, theme2)); assertEquals(2, processResultDAO.getResultByThemeCount (wa, TestSolution.FAILED, theme2)); assertEquals(1, processResultDAO.getResultByThemeCount (wa, TestSolution.NEED_MORE_INFO, theme2)); assertEquals(0, processResultDAO.getResultByThemeCount (wa, TestSolution.NOT_APPLICABLE, theme2)); assertEquals(2, processResultDAO.getResultByThemeCount (wa, TestSolution.PASSED, null)); assertEquals(2, processResultDAO.getResultByThemeCount (wa, TestSolution.FAILED, null)); assertEquals(2, processResultDAO.getResultByThemeCount (wa, TestSolution.NEED_MORE_INFO, null)); assertEquals(0, processResultDAO.getResultByThemeCount (wa, TestSolution.NOT_APPLICABLE, null)); }
@Override public int getResultByThemeCount(WebResource webresource, TestSolution testSolution, Theme theme) { StringBuilder queryStr = new StringBuilder(); queryStr.append("SELECT COUNT(pr) FROM "); queryStr.append(getDefitiniteResultClass().getName()); queryStr.append(" pr WHERE "); queryStr.append("pr.subject = :webresource AND "); queryStr.append("pr.definiteValue = :definiteValue"); if (theme != null) { queryStr.append(" AND pr.test.criterion.theme = :theme"); } Query query = entityManager.createQuery(queryStr.toString()); query.setParameter("definiteValue", testSolution); query.setParameter("webresource", webresource); if (theme != null) { query.setParameter("theme", theme); } return ((Long) query.getSingleResult()).intValue(); }
ProcessResultDAOImpl extends AbstractJPADAO<ProcessResult, Long> implements ProcessResultDAO { @Override public int getResultByThemeCount(WebResource webresource, TestSolution testSolution, Theme theme) { StringBuilder queryStr = new StringBuilder(); queryStr.append("SELECT COUNT(pr) FROM "); queryStr.append(getDefitiniteResultClass().getName()); queryStr.append(" pr WHERE "); queryStr.append("pr.subject = :webresource AND "); queryStr.append("pr.definiteValue = :definiteValue"); if (theme != null) { queryStr.append(" AND pr.test.criterion.theme = :theme"); } Query query = entityManager.createQuery(queryStr.toString()); query.setParameter("definiteValue", testSolution); query.setParameter("webresource", webresource); if (theme != null) { query.setParameter("theme", theme); } return ((Long) query.getSingleResult()).intValue(); } }
ProcessResultDAOImpl extends AbstractJPADAO<ProcessResult, Long> implements ProcessResultDAO { @Override public int getResultByThemeCount(WebResource webresource, TestSolution testSolution, Theme theme) { StringBuilder queryStr = new StringBuilder(); queryStr.append("SELECT COUNT(pr) FROM "); queryStr.append(getDefitiniteResultClass().getName()); queryStr.append(" pr WHERE "); queryStr.append("pr.subject = :webresource AND "); queryStr.append("pr.definiteValue = :definiteValue"); if (theme != null) { queryStr.append(" AND pr.test.criterion.theme = :theme"); } Query query = entityManager.createQuery(queryStr.toString()); query.setParameter("definiteValue", testSolution); query.setParameter("webresource", webresource); if (theme != null) { query.setParameter("theme", theme); } return ((Long) query.getSingleResult()).intValue(); } ProcessResultDAOImpl(); }
ProcessResultDAOImpl extends AbstractJPADAO<ProcessResult, Long> implements ProcessResultDAO { @Override public int getResultByThemeCount(WebResource webresource, TestSolution testSolution, Theme theme) { StringBuilder queryStr = new StringBuilder(); queryStr.append("SELECT COUNT(pr) FROM "); queryStr.append(getDefitiniteResultClass().getName()); queryStr.append(" pr WHERE "); queryStr.append("pr.subject = :webresource AND "); queryStr.append("pr.definiteValue = :definiteValue"); if (theme != null) { queryStr.append(" AND pr.test.criterion.theme = :theme"); } Query query = entityManager.createQuery(queryStr.toString()); query.setParameter("definiteValue", testSolution); query.setParameter("webresource", webresource); if (theme != null) { query.setParameter("theme", theme); } return ((Long) query.getSingleResult()).intValue(); } ProcessResultDAOImpl(); @Override int getResultByThemeCount(WebResource webresource, TestSolution testSolution, Theme theme); @Override Collection<ProcessResult> getResultByScopeList(WebResource webresource, Scope scope); @Override Long retrieveNumberOfGrossResultFromAudit(Audit audit); @Override Long retrieveNumberOfNetResultFromAudit(Audit audit); @Override Collection<ProcessResult> retrieveGrossResultFromAudit(Audit audit); @Override Collection<ProcessResult> retrieveNetResultFromAudit(Audit audit); @Override Collection<ProcessResult> retrieveNetResultFromAuditAndWebResource(Audit audit, WebResource webResource); @Override Collection<ProcessResult> retrieveGrossResultFromAuditAndTest(Audit audit, Test test); @Override void deleteIndefiniteResultFromAudit(Audit audit); @Override Collection<ProcessResult> retrieveIndefiniteResultFromAudit(Audit audit); @Override List<DefiniteResult> getHistoryChanges(ProcessResult processResultImpl); @Override Collection<ProcessResult> retrieveProcessResultListByWebResourceAndScope(
            WebResource webResource, 
            Scope scope); @Override Collection<ProcessResult> retrieveProcessResultListByWebResourceAndCriterion(
            WebResource webResource, 
            Criterion criterion); @Override Collection<ProcessResult> retrieveProcessResultListByWebResourceAndScope(
            WebResource webResource, 
            Scope scope, 
            String theme, 
            Collection<String> testSolutions); @Override Collection<ProcessResult> retrieveProcessResultListByWebResourceAndTest(WebResource webResource, Test test); @Override boolean hasAuditSiteScopeResult(WebResource webResource, Scope scope); }
ProcessResultDAOImpl extends AbstractJPADAO<ProcessResult, Long> implements ProcessResultDAO { @Override public int getResultByThemeCount(WebResource webresource, TestSolution testSolution, Theme theme) { StringBuilder queryStr = new StringBuilder(); queryStr.append("SELECT COUNT(pr) FROM "); queryStr.append(getDefitiniteResultClass().getName()); queryStr.append(" pr WHERE "); queryStr.append("pr.subject = :webresource AND "); queryStr.append("pr.definiteValue = :definiteValue"); if (theme != null) { queryStr.append(" AND pr.test.criterion.theme = :theme"); } Query query = entityManager.createQuery(queryStr.toString()); query.setParameter("definiteValue", testSolution); query.setParameter("webresource", webresource); if (theme != null) { query.setParameter("theme", theme); } return ((Long) query.getSingleResult()).intValue(); } ProcessResultDAOImpl(); @Override int getResultByThemeCount(WebResource webresource, TestSolution testSolution, Theme theme); @Override Collection<ProcessResult> getResultByScopeList(WebResource webresource, Scope scope); @Override Long retrieveNumberOfGrossResultFromAudit(Audit audit); @Override Long retrieveNumberOfNetResultFromAudit(Audit audit); @Override Collection<ProcessResult> retrieveGrossResultFromAudit(Audit audit); @Override Collection<ProcessResult> retrieveNetResultFromAudit(Audit audit); @Override Collection<ProcessResult> retrieveNetResultFromAuditAndWebResource(Audit audit, WebResource webResource); @Override Collection<ProcessResult> retrieveGrossResultFromAuditAndTest(Audit audit, Test test); @Override void deleteIndefiniteResultFromAudit(Audit audit); @Override Collection<ProcessResult> retrieveIndefiniteResultFromAudit(Audit audit); @Override List<DefiniteResult> getHistoryChanges(ProcessResult processResultImpl); @Override Collection<ProcessResult> retrieveProcessResultListByWebResourceAndScope(
            WebResource webResource, 
            Scope scope); @Override Collection<ProcessResult> retrieveProcessResultListByWebResourceAndCriterion(
            WebResource webResource, 
            Criterion criterion); @Override Collection<ProcessResult> retrieveProcessResultListByWebResourceAndScope(
            WebResource webResource, 
            Scope scope, 
            String theme, 
            Collection<String> testSolutions); @Override Collection<ProcessResult> retrieveProcessResultListByWebResourceAndTest(WebResource webResource, Test test); @Override boolean hasAuditSiteScopeResult(WebResource webResource, Scope scope);  }