Search in sources :

Example 26 with Parameter

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

the class AuditSetUpControllerTest method setUpMockParameterDataService.

private void setUpMockParameterDataService() {
    ParameterElement mockParameterElementTextualFormField = new ParameterElementImpl() {

        {
            setParameterElementCode("TEXTUAL_FORMFIELD");
        }
    };
    ParameterElement mockParameterElementLevel = new ParameterElementImpl() {

        {
            setParameterElementCode("LEVEL");
        }
    };
    when(mockParameterElementDataService.getParameterElement("TEXTUAL_FORMFIELD")).thenReturn(mockParameterElementTextualFormField);
    when(mockParameterElementDataService.getParameterElement("LEVEL")).thenReturn(mockParameterElementLevel);
    Parameter param1 = new ParameterImpl() {

        {
            setValue("PARAMETER1");
        }
    };
    Parameter param2 = new ParameterImpl() {

        {
            setValue("PARAMETER2");
        }
    };
    Set<Parameter> paramSet = new HashSet<Parameter>() {

        {
            add(param1);
            add(param2);
        }
    };
    when(mockParameterDataService.getDefaultParameterSet()).thenReturn(paramSet);
    when(mockParameterDataService.getDefaultParameter(mockParameterElementLevel)).thenReturn(param1);
    when(mockParameterDataService.getDefaultParameter(mockParameterElementTextualFormField)).thenReturn(param2);
    when(mockParameterDataService.getDefaultLevelParameter()).thenReturn(param1);
    when(mockParameterDataService.getLastParameterValueFromUser(1L, mockParameterElementLevel, ScopeEnum.DOMAIN)).thenReturn("PARAMETER1");
    when(mockParameterDataService.getLastParameterValueFromUser(2L, mockParameterElementLevel, ScopeEnum.DOMAIN)).thenReturn("PARAMETER1");
    when(mockParameterDataService.getLastParameterValueFromUser(1L, mockParameterElementTextualFormField, ScopeEnum.DOMAIN)).thenReturn("PARAMETER2");
    when(mockParameterDataService.getLastParameterValueFromUser(2L, mockParameterElementTextualFormField, ScopeEnum.DOMAIN)).thenReturn("PARAMETER2");
}
Also used : ParameterImpl(org.asqatasun.entity.parameterization.ParameterImpl) Parameter(org.asqatasun.entity.parameterization.Parameter) ParameterElement(org.asqatasun.entity.parameterization.ParameterElement) ParameterElementImpl(org.asqatasun.entity.parameterization.ParameterElementImpl)

Example 27 with Parameter

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

the class PageListControllerTest method setUpMockWebResourceDataService.

/**
 */
private void setUpMockWebResourceDataService(Long idAudit) {
    when(mockSite.getAudit()).thenReturn(mockAudit);
    when(mockSite.getURL()).thenReturn("http://www.test.org");
    when(mockAudit.getDateOfCreation()).thenReturn(Calendar.getInstance().getTime());
    when(mockStatisticsDataService.getWebResourceCountByAuditAndHttpStatusCode(idAudit, HttpStatusCodeFamily.f2xx, null, null)).thenReturn(1L);
    when(mockStatisticsDataService.getWebResourceCountByAuditAndHttpStatusCode(idAudit, HttpStatusCodeFamily.f3xx, null, null)).thenReturn(2L);
    when(mockStatisticsDataService.getWebResourceCountByAuditAndHttpStatusCode(idAudit, HttpStatusCodeFamily.f4xx, null, null)).thenReturn(3L);
    when(mockStatisticsDataService.getWebResourceCountByAuditAndHttpStatusCode(idAudit, HttpStatusCodeFamily.f9xx, null, null)).thenReturn(4L);
    when(mockStatisticsDataService.getMarkByWebResourceAndAudit(mockSite, false, false)).thenReturn(55.0f);
    when(mockStatisticsDataService.getMarkByWebResourceAndAudit(mockSite, true, false)).thenReturn(75.0f);
    when(mockWebResourceDataService.getChildWebResourceCount(mockSite)).thenReturn(10L);
    when(mockStatisticsDataService.getResultCountByResultType(mockSite, mockAudit, TestSolution.PASSED)).thenReturn(3L);
    when(mockStatisticsDataService.getResultCountByResultType(mockSite, mockAudit, TestSolution.FAILED)).thenReturn(3L);
    when(mockStatisticsDataService.getResultCountByResultType(mockSite, mockAudit, TestSolution.NEED_MORE_INFO)).thenReturn(3L);
    when(mockStatisticsDataService.getResultCountByResultType(mockSite, mockAudit, TestSolution.NOT_APPLICABLE)).thenReturn(1L);
    setUpThemeDataService();
    Set<Parameter> paramSet = new HashSet();
    Parameter mockParameter = new ParameterImpl();
    ParameterElement mockParameterElement = new ParameterElementImpl();
    mockParameterElement.setParameterElementCode("LEVEL");
    mockParameter.setParameterElement(mockParameterElement);
    mockParameter.setValue("AW21");
    paramSet.add(mockParameter);
    when(mockParameterDataService.getParameterSetFromAudit(mockAudit)).thenReturn(paramSet);
    when(mockParameterDataService.getReferentialKeyFromAudit(mockAudit)).thenReturn("AW21");
}
Also used : ParameterImpl(org.asqatasun.entity.parameterization.ParameterImpl) Parameter(org.asqatasun.entity.parameterization.Parameter) ParameterElement(org.asqatasun.entity.parameterization.ParameterElement) ParameterElementImpl(org.asqatasun.entity.parameterization.ParameterElementImpl)

Example 28 with Parameter

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

the class AsqatasunOrchestrator method auditPage.

public Audit auditPage(Contract contract, String pageUrl, String clientIp, Set<Parameter> parameterSet, Locale locale) {
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("Page audit on " + pageUrl);
        for (Parameter param : parameterSet) {
            LOGGER.debug("param " + param.getValue() + " " + param.getParameterElement().getParameterElementCode());
        }
    }
    Act act = createAct(contract, ScopeEnum.PAGE, clientIp);
    AuditTimeoutThread auditPageThread = new AuditPageThread(pageUrl, auditService, act, parameterSet, locale, delay);
    return submitAuditAndLaunch(auditPageThread);
}
Also used : Parameter(org.asqatasun.entity.parameterization.Parameter)

Example 29 with Parameter

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

the class AsqatasunOrchestrator method auditSite.

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 30 with Parameter

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

the class AsqatasunOrchestrator method auditSite.

public Audit auditSite(Contract contract, String siteUrl, final List<String> pageUrlList, String clientIp, Set<Parameter> parameterSet, Locale locale) {
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("Group of pages audit");
        for (String str : pageUrlList) {
            LOGGER.debug("pageUrl " + str);
        }
        for (Parameter param : parameterSet) {
            LOGGER.debug("param " + param.getValue() + " " + param.getParameterElement().getParameterElementCode());
        }
    }
    Act act = createAct(contract, ScopeEnum.GROUPOFPAGES, clientIp);
    AuditTimeoutThread auditPageThread = new AuditGroupOfPagesThread(siteUrl, pageUrlList, auditService, act, parameterSet, locale, delay);
    return submitAuditAndLaunch(auditPageThread);
}
Also used : Parameter(org.asqatasun.entity.parameterization.Parameter)

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