use of org.asqatasun.service.command.AuditCommand in project Asqatasun by Asqatasun.
the class AuditServiceImpl method consolidate.
@Override
public Audit consolidate(Audit audit) {
AuditCommand auditCommand = auditCommandFactory.create(null, null, true);
auditCommand.setAudit(audit);
auditCommand.consolidate();
return audit;
}
use of org.asqatasun.service.command.AuditCommand in project Asqatasun by Asqatasun.
the class AuditServiceImplTest method testAuditGroupOfPages.
/**
* Test of auditPage method, of class AuditServiceImpl.
*/
public void testAuditGroupOfPages() {
System.out.println("auditGroupOfPages");
String siteUrl = "http://My.testUrl.org";
String pageUrl = "http://My.testUrlPage1.org";
Set<Parameter> paramSet = null;
List<String> urlList = new ArrayList<>();
urlList.add(pageUrl);
AuditServiceImpl instance = initialiseAuditService();
Audit auditCreateByAuditCommand = EasyMock.createMock(Audit.class);
AuditCommand mockAuditCommand = EasyMock.createMock(AuditCommand.class);
EasyMock.expect(mockAuditCommand.getAudit()).andReturn(auditCreateByAuditCommand).anyTimes();
EasyMock.replay(mockAuditCommand);
AuditCommandFactory mockAuditCommandFactory = EasyMock.createMock(AuditCommandFactory.class);
EasyMock.expect(mockAuditCommandFactory.create(siteUrl, urlList, paramSet)).andReturn(mockAuditCommand).anyTimes();
EasyMock.replay(mockAuditCommandFactory);
instance.setAuditCommandFactory(mockAuditCommandFactory);
// anyTimes the audit is created and set-up, the auditServiceThreadQueue is
// called to effectively launch the site audit
AuditServiceThreadQueue mockAuditServiceThreadQueue = EasyMock.createMock(AuditServiceThreadQueue.class);
mockAuditServiceThreadQueue.add(instance);
EasyMock.expectLastCall().anyTimes();
mockAuditServiceThreadQueue.addPageAudit(mockAuditCommand);
EasyMock.expectLastCall().anyTimes();
EasyMock.replay(mockAuditServiceThreadQueue);
instance.setAuditServiceThreadQueue(mockAuditServiceThreadQueue);
Audit result = instance.auditSite(siteUrl, urlList, paramSet);
assertEquals(auditCreateByAuditCommand, result);
EasyMock.verify(mockAuditServiceThreadQueue);
EasyMock.verify(mockAuditCommand);
EasyMock.verify(mockAuditCommandFactory);
}
use of org.asqatasun.service.command.AuditCommand in project Asqatasun by Asqatasun.
the class AuditServiceImplTest method testAuditScenario.
/**
* Test of auditPage method, of class AuditServiceImpl.
*/
public void testAuditScenario() {
System.out.println("auditScenario");
String scenarioName = "MyScenario";
String scenario = "";
AuditServiceImpl instance = initialiseAuditService();
Audit auditCreateByAuditCommand = EasyMock.createMock(Audit.class);
AuditCommand mockAuditCommand = EasyMock.createMock(AuditCommand.class);
EasyMock.expect(mockAuditCommand.getAudit()).andReturn(auditCreateByAuditCommand).anyTimes();
EasyMock.replay(mockAuditCommand);
AuditCommandFactory mockAuditCommandFactory = EasyMock.createMock(AuditCommandFactory.class);
EasyMock.expect(mockAuditCommandFactory.create(scenarioName, scenario, null)).andReturn(mockAuditCommand).anyTimes();
EasyMock.replay(mockAuditCommandFactory);
instance.setAuditCommandFactory(mockAuditCommandFactory);
// anyTimes the audit is created and set-up, the auditServiceThreadQueue is
// called to effectively launch the pageUpload audit
AuditServiceThreadQueue mockAuditServiceThreadQueue = EasyMock.createMock(AuditServiceThreadQueue.class);
mockAuditServiceThreadQueue.add(instance);
EasyMock.expectLastCall().anyTimes();
mockAuditServiceThreadQueue.addScenarioAudit(mockAuditCommand);
EasyMock.expectLastCall().anyTimes();
EasyMock.replay(mockAuditServiceThreadQueue);
instance.setAuditServiceThreadQueue(mockAuditServiceThreadQueue);
Audit result = instance.auditScenario(scenarioName, scenario, null);
assertEquals(auditCreateByAuditCommand, result);
EasyMock.verify(mockAuditServiceThreadQueue);
EasyMock.verify(mockAuditCommand);
EasyMock.verify(mockAuditCommandFactory);
}
use of org.asqatasun.service.command.AuditCommand in project Asqatasun by Asqatasun.
the class AuditServiceImpl method auditScenario.
@Override
public Audit auditScenario(String scenarioName, String scenario, Set<Parameter> paramSet, List<Tag> tagList) {
LOGGER.debug("auditScenario");
AuditCommand auditCommand = auditCommandFactory.create(scenarioName, scenario, paramSet, tagList);
auditServiceThreadQueue.addScenarioAudit(auditCommand);
auditServiceThreadQueue.add(this);
return auditCommand.getAudit();
}
use of org.asqatasun.service.command.AuditCommand in project Asqatasun by Asqatasun.
the class AuditServiceImpl method auditPage.
@Override
public Audit auditPage(String pageUrl, Set<Parameter> paramSet, List<Tag> tagList) {
LOGGER.debug("auditpage");
AuditCommand auditCommand = auditCommandFactory.create(pageUrl, paramSet, tagList, false);
auditServiceThreadQueue.addPageAudit(auditCommand);
auditServiceThreadQueue.add(this);
return auditCommand.getAudit();
}
Aggregations