Search in sources :

Example 1 with Theme

use of org.asqatasun.entity.reference.Theme in project Asqatasun by Asqatasun.

the class TestResultFactory method getTestResultListFromTest.

/**
     *
     * @param webresource
     * @param test
     * @return the test result list without user filter (used for the export
     * function)
     */
public Map<Theme, List<TestResult>> getTestResultListFromTest(WebResource webresource, Test test) {
    // Map that associates a list of results with a theme
    List<TestResult> testResultList = new LinkedList();
    List<ProcessResult> netResultList = (List<ProcessResult>) processResultDataService.getProcessResultListByWebResourceAndTest(webresource, test);
    Collection testList = new ArrayList();
    testList.add(test);
    netResultList.addAll(addNotTestedProcessResult(testList, test.getCriterion().getTheme().getCode(), netResultList));
    sortCollection(netResultList);
    for (ProcessResult processResult : netResultList) {
        if (processResult instanceof DefiniteResult) {
            TestResult testResult = getTestResult(processResult, true, false);
            testResultList.add(testResult);
        }
    }
    Map<Theme, List<TestResult>> testResultMap = new HashMap();
    testResultMap.put(test.getCriterion().getTheme(), testResultList);
    return testResultMap;
}
Also used : Theme(org.asqatasun.entity.reference.Theme) TestResult(org.asqatasun.webapp.presentation.data.TestResult)

Example 2 with Theme

use of org.asqatasun.entity.reference.Theme in project Asqatasun by Asqatasun.

the class TestResultFactory method prepareThemeResultMap.

/**
     *
     * @param netResultList
     * @return
     */
private Map<Theme, List<TestResult>> prepareThemeResultMap(List<ProcessResult> netResultList) {
    // Map that associates a list of results with a theme
    Map<Theme, List<TestResult>> testResultMap = new LinkedHashMap();
    sortCollection(netResultList);
    for (ProcessResult processResult : netResultList) {
        if (processResult instanceof DefiniteResult) {
            TestResult testResult = getTestResult(processResult, true, true);
            Theme theme = processResult.getTest().getCriterion().getTheme();
            if (testResultMap.containsKey(theme)) {
                testResultMap.get(theme).add(testResult);
            } else {
                List<TestResult> testResultList = new ArrayList();
                testResultList.add(testResult);
                testResultMap.put(theme, testResultList);
            }
        }
    }
    return testResultMap;
}
Also used : Theme(org.asqatasun.entity.reference.Theme) TestResult(org.asqatasun.webapp.presentation.data.TestResult)

Example 3 with Theme

use of org.asqatasun.entity.reference.Theme in project Asqatasun by Asqatasun.

the class AuditSynthesisController method prepareSynthesisSiteData.

/**
     * This method prepares data for the synthesis page. Only multi pages audit
     * are considered here
     *
     * @param audit
     * @param model
     * @return
     * @throws IOException
     */
private String prepareSynthesisSiteData(Audit audit, Model model) {
    // Add this step, we are sure that the audit subject 
    // is a site, we can trustly cast it
    Site site = (Site) audit.getSubject();
    //TODO cas manual
    addAuditStatisticsToModel(site, model, TgolKeyStore.TEST_DISPLAY_SCOPE_VALUE);
    Map<Theme, ResultCounter> top5SortedThemeMap = new LinkedHashMap<>();
    @SuppressWarnings("unchecked") Collection<FailedThemeInfo> tfiCollection = (Collection<FailedThemeInfo>) getStatisticsDataService().getResultCountByResultTypeAndTheme(site, audit, TestSolution.FAILED, nbOfDisplayedFailedTest);
    for (FailedThemeInfo tfi : tfiCollection) {
        ResultCounter failedCounter = ResultCounterFactory.getInstance().getResultCounter();
        failedCounter.setFailedCount(tfi.getResultCounter().intValue());
        top5SortedThemeMap.put(AuditStatisticsFactory.getInstance().getTheme(tfi.getThemeId()), failedCounter);
    }
    model.addAttribute(TgolKeyStore.AUDITED_PAGES_COUNT_KEY, getStatisticsDataService().getWebResourceCountByAuditAndHttpStatusCode(audit.getId(), HttpStatusCodeFamily.f2xx, null, null).intValue());
    model.addAttribute(TgolKeyStore.TOP5_SORTED_THEME_MAP, top5SortedThemeMap);
    model.addAttribute(TgolKeyStore.FAILED_PAGE_INFO_BY_TEST_SET_KEY, getStatisticsDataService().getFailedWebResourceSortedByTest(site, audit, nbOfDisplayedFailedPages));
    model.addAttribute(TgolKeyStore.FAILED_PAGE_INFO_BY_OCCURRENCE_SET_KEY, getStatisticsDataService().getFailedWebResourceSortedByOccurrence(site, audit, nbOfDisplayedFailedPages));
    model.addAttribute(TgolKeyStore.FAILED_TEST_INFO_BY_OCCURRENCE_SET_KEY, getStatisticsDataService().getFailedTestByOccurrence(site, audit, nbOfDisplayedFailedTest));
    model.addAttribute(TgolKeyStore.HAS_SITE_SCOPE_TEST_KEY, processResultDataService.hasAuditSiteScopeResult(site, getSiteScope()));
    model.addAttribute(TgolKeyStore.STATUS_KEY, computeAuditStatus(site.getAudit()));
    return TgolKeyStore.SYNTHESIS_SITE_VIEW_NAME;
}
Also used : Site(org.asqatasun.entity.subject.Site) FailedThemeInfo(org.asqatasun.webapp.presentation.data.FailedThemeInfo) Theme(org.asqatasun.entity.reference.Theme) ResultCounter(org.asqatasun.webapp.presentation.data.ResultCounter)

Example 4 with Theme

use of org.asqatasun.entity.reference.Theme in project Asqatasun by Asqatasun.

the class AnalyserImpl method extractThemeAndCriterionSet.

/**
     * This method extracts a collection of themes for a given audit
     *
     * @return
     */
private void extractThemeAndCriterionSet() {
    themeMap = new HashMap();
    criterionMap = new HashMap();
    for (Test test : testSet) {
        //Collect criterions given the set of tests for the audit, and keep
        // the number of tests for each criterion (needed to calculate the
        // not tested
        Criterion criterion = test.getCriterion();
        if (criterionMap.containsKey(criterion)) {
            Integer testCounter = criterionMap.get(criterion) + 1;
            criterionMap.put(criterion, testCounter);
        } else {
            criterionMap.put(criterion, 1);
        }
        //Collect themes given the set of tests for the audit, and keep
        // the number of tests for each criterion (needed to calculate the
        // not tested
        Theme theme = criterion.getTheme();
        if (themeMap.containsKey(theme)) {
            Integer testCounter = themeMap.get(theme) + 1;
            themeMap.put(theme, testCounter);
        } else {
            themeMap.put(theme, 1);
        }
    }
}
Also used : Test(org.asqatasun.entity.reference.Test) Criterion(org.asqatasun.entity.reference.Criterion) Theme(org.asqatasun.entity.reference.Theme)

Example 5 with Theme

use of org.asqatasun.entity.reference.Theme in project Asqatasun by Asqatasun.

the class AnalyserImpl method computeThemeStatisticsFromDb.

/**
     *
     * @param wrStatistics
     * @return
     */
private WebResourceStatistics computeThemeStatisticsFromDb(WebResourceStatistics wrStatistics) {
    for (Theme theme : themeMap.keySet()) {
        ThemeStatistics themeStatistics = themeStatisticsDataService.create();
        themeStatistics.setTheme(theme);
        int nbOfFailed = themeStatisticsDataService.getResultCountByResultTypeAndTheme(webResource, TestSolution.FAILED, theme).intValue();
        themeStatistics.setNbOfFailed(nbOfFailed);
        int nbOfPassed = themeStatisticsDataService.getResultCountByResultTypeAndTheme(webResource, TestSolution.PASSED, theme).intValue();
        themeStatistics.setNbOfPassed(nbOfPassed);
        int nbOfNa = themeStatisticsDataService.getResultCountByResultTypeAndTheme(webResource, TestSolution.NOT_APPLICABLE, theme).intValue();
        themeStatistics.setNbOfNa(nbOfNa);
        int nbOfNmi = themeStatisticsDataService.getResultCountByResultTypeAndTheme(webResource, TestSolution.NEED_MORE_INFO, theme).intValue();
        nbOfNmi += themeStatisticsDataService.getResultCountByResultTypeAndTheme(webResource, TestSolution.SUSPECTED_FAILED, theme).intValue();
        nbOfNmi += themeStatisticsDataService.getResultCountByResultTypeAndTheme(webResource, TestSolution.SUSPECTED_PASSED, theme).intValue();
        themeStatistics.setNbOfNmi(nbOfNmi);
        int themeTestListSize = themeMap.get(theme);
        themeStatistics.setNbOfNotTested(themeTestListSize * nbOfWr - nbOfFailed - nbOfNa - nbOfNmi - nbOfPassed);
        wrStatistics.addThemeStatistics(themeStatistics);
    }
    return wrStatistics;
}
Also used : Theme(org.asqatasun.entity.reference.Theme) ThemeStatistics(org.asqatasun.entity.statistics.ThemeStatistics)

Aggregations

Theme (org.asqatasun.entity.reference.Theme)12 Criterion (org.asqatasun.entity.reference.Criterion)3 TestResult (org.asqatasun.webapp.presentation.data.TestResult)3 Test (org.asqatasun.entity.reference.Test)2 CriterionStatistics (org.asqatasun.entity.statistics.CriterionStatistics)2 ThemeStatistics (org.asqatasun.entity.statistics.ThemeStatistics)2 ResultCounter (org.asqatasun.webapp.presentation.data.ResultCounter)2 HashMap (java.util.HashMap)1 ProcessResult (org.asqatasun.entity.audit.ProcessResult)1 TestSolution (org.asqatasun.entity.audit.TestSolution)1 WebResourceStatisticsDAO (org.asqatasun.entity.dao.statistics.WebResourceStatisticsDAO)1 Reference (org.asqatasun.entity.reference.Reference)1 ThemeDataService (org.asqatasun.entity.service.reference.ThemeDataService)1 WebResourceStatistics (org.asqatasun.entity.statistics.WebResourceStatistics)1 Site (org.asqatasun.entity.subject.Site)1 WebResource (org.asqatasun.entity.subject.WebResource)1 CriterionResult (org.asqatasun.webapp.presentation.data.CriterionResult)1 FailedThemeInfo (org.asqatasun.webapp.presentation.data.FailedThemeInfo)1 Autowired (org.springframework.beans.factory.annotation.Autowired)1