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