Search in sources :

Example 1 with TestResult

use of org.asqatasun.webapp.dto.TestResult 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.dto.TestResult)

Example 2 with TestResult

use of org.asqatasun.webapp.dto.TestResult in project Asqatasun by Asqatasun.

the class TestResultFactory method getTestResult.

/**
 * @param processResult
 * @param hasResultDetails
 * @param truncatable
 * @return an instance of ProcessResult
 */
public TestResult getTestResult(ProcessResult processResult, boolean hasResultDetails, boolean truncatable) {
    TestResult testResult = new TestResult();
    testResult.setTestUrl(processResult.getTest().getDescription());
    testResult.setTestShortLabel(processResult.getTest().getLabel());
    testResult.setTestCode(processResult.getTest().getCode());
    testResult.setLevelCode(processResult.getTest().getLevel().getCode());
    testResult.setResult(processResult.getValue().toString());
    testResult.setResultCode(setResultToLowerCase(processResult, testResult));
    testResult.setRuleDesignUrl(processResult.getTest().getRuleDesignUrl());
    testResult.setResultCounter(resultCounterFactory.getResultCounter());
    testResult.setTest(processResult.getTest());
    testResult.setHistory(constructHistoryChanges(processResult));
    if (processResult instanceof DefiniteResult && processResult.getManualValue() != null) {
        testResult.setComment(((DefiniteResult) processResult).getManualAuditComment());
        switch((TestSolution) processResult.getManualValue()) {
            case FAILED:
                testResult.setManualResult(TestResult.FAILED_LOWER);
                break;
            case PASSED:
                testResult.setManualResult(TestResult.PASSED_LOWER);
                break;
            case NOT_APPLICABLE:
                testResult.setManualResult(TestResult.NOT_APPLICABLE_LOWER);
                break;
        }
    }
    try {
        testResult.setTestRepresentation(Integer.parseInt(representationBundle.getString(testResult.getTestCode() + TestResult.REPRESENTATION_SUFFIX_KEY)));
    } catch (MissingResourceException mre) {
        LOGGER.warn(mre.getMessage());
    }
    try {
        testResult.setTestEvidenceRepresentationOrder(representationBundle.getString(testResult.getTestCode() + TestResult.REPRESENTATION_ORDER_SUFFIX_KEY));
    } catch (MissingResourceException mre) {
        LOGGER.warn(mre.getMessage());
    }
    try {
        testResult.setColorTestContrastRatio(representationBundle.getString(testResult.getTestCode() + TestResult.CONTRAST_RATIO_SUFFIX_KEY));
    } catch (MissingResourceException mre) {
        LOGGER.warn(mre.getMessage());
    }
    if (hasResultDetails && (testResult.getResult().equalsIgnoreCase(TestSolution.FAILED.toString()) || testResult.getResult().equalsIgnoreCase(TestSolution.NEED_MORE_INFO.toString()))) {
        addRemarkInfosMapToTestResult(testResult, processResult, truncatable);
    }
    return testResult;
}
Also used : TestResult(org.asqatasun.webapp.dto.TestResult)

Example 3 with TestResult

use of org.asqatasun.webapp.dto.TestResult in project Asqatasun by Asqatasun.

the class TestResultFactory method getTestResultList.

/**
 * @param webresource
 * @param scope
 * @param locale
 * @return the test result list without user filter (used for the export
 * function)
 */
public List<TestResult> getTestResultList(WebResource webresource, Scope scope, Locale locale) {
    // Map that associates a list of results with a theme
    List<TestResult> testResultList = new LinkedList();
    List<ProcessResult> netResultList = (List<ProcessResult>) processResultDataService.getProcessResultListByWebResourceAndScope(webresource, scope);
    netResultList.addAll(addNotTestedProcessResult(getTestListFromWebResource(webresource), SELECT_ALL_THEME_KEY, netResultList));
    sortCollection(netResultList);
    for (ProcessResult processResult : netResultList) {
        if (processResult instanceof DefiniteResult) {
            TestResult testResult = getTestResult(processResult, true, false);
            testResultList.add(testResult);
        }
    }
    return testResultList;
}
Also used : TestResult(org.asqatasun.webapp.dto.TestResult)

Example 4 with TestResult

use of org.asqatasun.webapp.dto.TestResult in project Asqatasun by Asqatasun.

the class TestResultFactory method getTestResultListFromCriterion.

/**
 * @param webresource
 * @param crit
 * @return the test result list without user filter (used for the export
 * function)
 */
public Map<Theme, List<TestResult>> getTestResultListFromCriterion(WebResource webresource, Criterion crit) {
    // Map that associates a list of results with a theme
    List<TestResult> testResultList = new LinkedList();
    List<ProcessResult> netResultList = (List<ProcessResult>) processResultDataService.getProcessResultListByWebResourceAndCriterion(webresource, crit);
    netResultList.addAll(addNotTestedProcessResult(testDataService.findAllByCriterion(crit), crit.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(crit.getTheme(), testResultList);
    return testResultMap;
}
Also used : Theme(org.asqatasun.entity.reference.Theme) TestResult(org.asqatasun.webapp.dto.TestResult)

Example 5 with TestResult

use of org.asqatasun.webapp.dto.TestResult 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.dto.TestResult)

Aggregations

TestResult (org.asqatasun.webapp.dto.TestResult)6 Theme (org.asqatasun.entity.reference.Theme)3 ColumnBuilderException (ar.com.fdvs.dj.domain.builders.ColumnBuilderException)1 JRException (net.sf.jasperreports.engine.JRException)1 Scope (org.asqatasun.entity.reference.Scope)1 Page (org.asqatasun.entity.subject.Page)1 AuditStatistics (org.asqatasun.webapp.dto.AuditStatistics)1