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;
}
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;
}
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;
}
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);
}
}
}
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;
}
Aggregations