Search in sources :

Example 31 with Parameter

use of org.asqatasun.entity.parameterization.Parameter in project Asqatasun by Asqatasun.

the class AnalyserImplTest method testComputeMark.

public void testComputeMark() {
    WebResourceStatisticsFactory webResourceStatisticsFactory = new WebResourceStatisticsFactoryImpl();
    WebResourceStatisticsDataService webResourceStatisticsDataService = new WebResourceStatisticsDataServiceImpl();
    webResourceStatisticsDataService.setEntityFactory(webResourceStatisticsFactory);
    AnalyserImpl analyser = new AnalyserImpl(null, null, null, webResourceStatisticsDataService, null, null, null, new ArrayList<Parameter>(), 1);
    WebResourceStatistics wrStats = analyser.getWebResourceStatisticsDataService().create();
    wrStats.setNbOfPassed(89330);
    wrStats.setNbOfFailed(84541);
    wrStats.setNbOfNmi(97541);
    assertEquals(Double.valueOf(45.828712).floatValue(), analyser.computeMark(wrStats).getMark());
    wrStats.setNbOfPassed(0);
    wrStats.setNbOfFailed(0);
    wrStats.setNbOfNmi(0);
    assertEquals(Double.valueOf(0).floatValue(), analyser.computeMark(wrStats).getMark());
}
Also used : WebResourceStatisticsFactory(org.asqatasun.entity.statistics.factory.WebResourceStatisticsFactory) WebResourceStatisticsDataServiceImpl(org.asqatasun.entity.service.statistics.WebResourceStatisticsDataServiceImpl) Parameter(org.asqatasun.entity.parameterization.Parameter) WebResourceStatisticsDataService(org.asqatasun.entity.service.statistics.WebResourceStatisticsDataService) WebResourceStatistics(org.asqatasun.entity.statistics.WebResourceStatistics) WebResourceStatisticsFactoryImpl(org.asqatasun.entity.statistics.factory.WebResourceStatisticsFactoryImpl)

Example 32 with Parameter

use of org.asqatasun.entity.parameterization.Parameter in project Asqatasun by Asqatasun.

the class AuditStatisticsFactory method getAuditParameters.

/**
     * Retrieves all the parameters of the audit and prepares the data depending
     * on the wished displayed parameters of the view.
     *
     *
     * @param audit
     * @param parametersToDisplay
     * @return
     */
private Map<String, String> getAuditParameters(Audit audit, Map<String, String> parametersToDisplay) {
    Map<String, String> auditParameters = new LinkedHashMap();
    Set<Parameter> auditParamSet = parameterDataService.getParameterSetFromAudit(audit);
    // the parameter management has been integrated
    if (auditParamSet.isEmpty()) {
        return auditParameters;
    }
    for (Map.Entry<String, String> entry : parametersToDisplay.entrySet()) {
        for (Parameter param : auditParamSet) {
            if (entry.getKey().equals(param.getParameterElement().getParameterElementCode())) {
                auditParameters.put(entry.getValue(), param.getValue());
            }
        }
    }
    if (!parametersToDisplay.isEmpty()) {
        auditParameters.put(TgolKeyStore.REFERENTIAL_PARAM_KEY, parameterDataService.getReferentialKeyFromAudit(audit));
    }
    return auditParameters;
}
Also used : Parameter(org.asqatasun.entity.parameterization.Parameter)

Example 33 with Parameter

use of org.asqatasun.entity.parameterization.Parameter in project Asqatasun by Asqatasun.

the class AsqatasunOrchestratorImpl method auditPageUpload.

@Override
public Audit auditPageUpload(Contract contract, Map<String, String> fileMap, String clientIp, Set<Parameter> parameterSet, Locale locale) {
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("auditPage Upload on " + fileMap.size() + " files");
        for (Parameter param : parameterSet) {
            LOGGER.debug("param " + param.getValue() + " " + param.getParameterElement().getParameterElementCode());
        }
    }
    Act act;
    if (fileMap.size() > 1) {
        act = createAct(contract, ScopeEnum.GROUPOFFILES, clientIp);
    } else {
        act = createAct(contract, ScopeEnum.FILE, clientIp);
    }
    AuditTimeoutThread auditPageUploadThread = new AuditPageUploadThread(fileMap, auditService, act, parameterSet, locale, delay);
    Audit audit = submitAuditAndLaunch(auditPageUploadThread, act);
    return audit;
}
Also used : Audit(org.asqatasun.entity.audit.Audit) Parameter(org.asqatasun.entity.parameterization.Parameter)

Example 34 with Parameter

use of org.asqatasun.entity.parameterization.Parameter in project Asqatasun by Asqatasun.

the class AsqatasunOrchestratorImpl method auditSite.

@Override
public void auditSite(Contract contract, String siteUrl, String clientIp, Set<Parameter> parameterSet, Locale locale) {
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("Site audit on " + siteUrl);
        for (Parameter param : parameterSet) {
            LOGGER.debug("param " + param.getValue() + " " + param.getParameterElement().getParameterElementCode());
        }
    }
    Act act = createAct(contract, ScopeEnum.DOMAIN, clientIp);
    AuditThread auditSiteThread = new AuditSiteThread(siteUrl, auditService, act, parameterSet, locale);
    threadPoolTaskExecutor.submit(auditSiteThread);
}
Also used : Parameter(org.asqatasun.entity.parameterization.Parameter)

Example 35 with Parameter

use of org.asqatasun.entity.parameterization.Parameter in project Asqatasun by Asqatasun.

the class AsqatasunOrchestratorImpl method auditScenario.

@Override
public void auditScenario(Contract contract, Long idScenario, String clientIp, Set<Parameter> parameterSet, Locale locale) {
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("Scenarion audit on scenario with id" + idScenario);
        for (Parameter param : parameterSet) {
            LOGGER.debug("param " + param.getValue() + " " + param.getParameterElement().getParameterElementCode());
        }
    }
    Act act = createAct(contract, ScopeEnum.SCENARIO, clientIp);
    Scenario scenario = scenarioDataService.read(idScenario);
    AuditThread auditScenarioThread = new AuditScenarioThread(scenario.getLabel(), scenario.getContent(), auditService, act, parameterSet, locale);
    threadPoolTaskExecutor.submit(auditScenarioThread);
}
Also used : Parameter(org.asqatasun.entity.parameterization.Parameter) Scenario(org.asqatasun.webapp.entity.scenario.Scenario)

Aggregations

Parameter (org.asqatasun.entity.parameterization.Parameter)59 ParameterElement (org.asqatasun.entity.parameterization.ParameterElement)13 Audit (org.asqatasun.entity.audit.Audit)8 ParameterImpl (org.asqatasun.entity.parameterization.ParameterImpl)6 NoResultException (javax.persistence.NoResultException)5 Query (javax.persistence.Query)5 HashSet (java.util.HashSet)4 AuditCommand (org.asqatasun.service.command.AuditCommand)4 AuditCommandFactory (org.asqatasun.service.command.factory.AuditCommandFactory)4 Test (org.junit.Test)4 File (java.io.File)3 IOException (java.io.IOException)3 Crawler (org.asqatasun.crawler.Crawler)3 ParameterElementImpl (org.asqatasun.entity.parameterization.ParameterElementImpl)3 LinkedHashSet (java.util.LinkedHashSet)2 ParameterFamily (org.asqatasun.entity.parameterization.ParameterFamily)2 WebResourceStatisticsDataService (org.asqatasun.entity.service.statistics.WebResourceStatisticsDataService)2 WebResourceStatisticsDataServiceImpl (org.asqatasun.entity.service.statistics.WebResourceStatisticsDataServiceImpl)2 WebResourceStatistics (org.asqatasun.entity.statistics.WebResourceStatistics)2 WebResourceStatisticsFactory (org.asqatasun.entity.statistics.factory.WebResourceStatisticsFactory)2