Search in sources :

Example 1 with AuditCommand

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;
}
Also used : AuditCommand(org.asqatasun.service.command.AuditCommand)

Example 2 with AuditCommand

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);
}
Also used : Audit(org.asqatasun.entity.audit.Audit) AuditCommandFactory(org.asqatasun.service.command.factory.AuditCommandFactory) Parameter(org.asqatasun.entity.parameterization.Parameter) AuditCommand(org.asqatasun.service.command.AuditCommand)

Example 3 with AuditCommand

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);
}
Also used : Audit(org.asqatasun.entity.audit.Audit) AuditCommandFactory(org.asqatasun.service.command.factory.AuditCommandFactory) AuditCommand(org.asqatasun.service.command.AuditCommand)

Example 4 with AuditCommand

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();
}
Also used : AuditCommand(org.asqatasun.service.command.AuditCommand)

Example 5 with AuditCommand

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();
}
Also used : AuditCommand(org.asqatasun.service.command.AuditCommand)

Aggregations

AuditCommand (org.asqatasun.service.command.AuditCommand)36 Audit (org.asqatasun.entity.audit.Audit)7 AuditCommandFactory (org.asqatasun.service.command.factory.AuditCommandFactory)5 Parameter (org.asqatasun.entity.parameterization.Parameter)4 ArrayList (java.util.ArrayList)1