Search in sources :

Example 1 with ManualResult

use of org.asqatasun.webapp.presentation.data.ManualResult in project Asqatasun by Asqatasun.

the class TestResultFactory method getProcessResultListFromTestsResult.

// TO DO : determine the difference between this method and the next one
// The code seems to be a duplication
public List<ProcessResult> getProcessResultListFromTestsResult(Map<String, ManualResult> overriddenResultMap, WebResource webResource) {
    List<ProcessResult> processResultList = new LinkedList();
    Audit audit = webResource.getAudit();
    for (Map.Entry<String, ManualResult> entry : overriddenResultMap.entrySet()) {
        if (StringUtils.isNotBlank(entry.getValue().getResult())) {
            Test test = testDataService.getTestFromAuditAndLabel(audit, entry.getKey());
            List<ProcessResult> prList = ((List<ProcessResult>) processResultDataService.getProcessResultListByWebResourceAndTest(webResource, test));
            /**
                 * If returned process result list doesn't contains elements
                 * that means the test is NOT_TESTED and has to be created to
                 * persist the manual audit value
                 */
            ProcessResult processResult;
            if (prList.isEmpty()) {
                processResult = createNotTestedProcessResult(test, webResource);
            } else {
                processResult = prList.get(0);
            }
            processResult.setManualValue(entry.getValue().getResult().equals(TestResult.FAILED_LOWER) ? TestSolution.FAILED : (entry.getValue().getResult().equals(TestResult.PASSED_LOWER) ? TestSolution.PASSED : TestSolution.NOT_APPLICABLE));
            if (StringUtils.isNotBlank(entry.getValue().getComment())) {
                ((DefiniteResult) processResult).setManualAuditComment(entry.getValue().getComment());
            }
            processResultList.add(processResult);
        }
    }
    return processResultList;
}
Also used : ManualResult(org.asqatasun.webapp.presentation.data.ManualResult) Test(org.asqatasun.entity.reference.Test)

Example 2 with ManualResult

use of org.asqatasun.webapp.presentation.data.ManualResult in project Asqatasun by Asqatasun.

the class TestResultFactory method getAllProcessResultListFromTestsResult.

/**
     * 
     * @param overriddenResultMap
     * @param webResource
     * @return 
     */
public List<ProcessResult> getAllProcessResultListFromTestsResult(Map<String, ManualResult> overriddenResultMap, WebResource webResource) {
    List<ProcessResult> processResultList = new LinkedList();
    Audit audit = webResource.getAudit();
    for (Map.Entry<String, ManualResult> entry : overriddenResultMap.entrySet()) {
        Test test = testDataService.getTestFromAuditAndLabel(audit, entry.getKey());
        List<ProcessResult> prList = ((List<ProcessResult>) processResultDataService.getProcessResultListByWebResourceAndTest(webResource, test));
        /**
             * If returned process result list doesn't contains elements that
             * means the test is NOT_TESTED and has to be created to persist the
             * manual audit value
             */
        ProcessResult processResult;
        if (prList.isEmpty()) {
            processResult = createNotTestedProcessResult(test, webResource);
        } else {
            processResult = prList.get(0);
        }
        if (StringUtils.isNotBlank(entry.getValue().getResult())) {
            processResult.setManualValue(entry.getValue().getResult().equals(TestResult.FAILED_LOWER) ? TestSolution.FAILED : (entry.getValue().getResult().equals(TestResult.PASSED_LOWER) ? TestSolution.PASSED : TestSolution.NOT_APPLICABLE));
            if (StringUtils.isNotBlank(entry.getValue().getComment())) {
                ((DefiniteResult) processResult).setManualAuditComment(entry.getValue().getComment());
            }
        }
        processResultList.add(processResult);
    }
    return processResultList;
}
Also used : ManualResult(org.asqatasun.webapp.presentation.data.ManualResult) Test(org.asqatasun.entity.reference.Test)

Aggregations

Test (org.asqatasun.entity.reference.Test)2 ManualResult (org.asqatasun.webapp.presentation.data.ManualResult)2