use of org.asqatasun.entity.audit.Audit in project Asqatasun by Asqatasun.
the class AuditServiceImplTest method testAuditCompleted.
// /**
// * Test of init method, of class AuditServiceImpl.
// */
// public void testInit() {
// AuditServiceImpl instance = initialiseAuditService();
//
// Audit audit = EasyMock.createMock(Audit.class);
// Audit auditReturnedByInitMethodOfAuditServiceThread =
// EasyMock.createMock(Audit.class);
//
// AuditServiceThread mockAuditServiceThread = EasyMock.createMock(AuditServiceThread.class);
//
// mockAuditServiceThread.init();
// EasyMock.expectLastCall();
// EasyMock.expect(mockAuditServiceThread.getAudit()).
// andReturn(auditReturnedByInitMethodOfAuditServiceThread).anyTimes();
// EasyMock.replay(mockAuditServiceThread);
//
// EasyMock.expect(mockAuditServiceThreadFactory.create(audit)).
// andReturn(mockAuditServiceThread).anyTimes();
// EasyMock.replay(mockAuditServiceThreadFactory);
//
// assertEquals(auditReturnedByInitMethodOfAuditServiceThread,
// instance.init(audit));
//
// EasyMock.verify(mockAuditServiceThread);
// EasyMock.verify(mockAuditServiceThreadFactory);
// }
// /**
// * Test of crawl method, of class AuditServiceImpl.
// */
// public void testCrawl() {
// AuditServiceImpl instance = initialiseAuditService();
//
// Audit audit = EasyMock.createMock(Audit.class);
// Audit auditReturnedByCrawlMethodOfAuditServiceThread =
// EasyMock.createMock(Audit.class);
//
// AuditServiceThread mockAuditServiceThread = EasyMock.createMock(AuditServiceThread.class);
//
// mockAuditServiceThread.loadContent();
// EasyMock.expectLastCall();
// EasyMock.expect(mockAuditServiceThread.getAudit()).
// andReturn(auditReturnedByCrawlMethodOfAuditServiceThread).anyTimes();
// EasyMock.replay(mockAuditServiceThread);
//
// EasyMock.expect(mockAuditServiceThreadFactory.create(audit)).
// andReturn(mockAuditServiceThread).anyTimes();
// EasyMock.replay(mockAuditServiceThreadFactory);
//
// assertEquals(auditReturnedByCrawlMethodOfAuditServiceThread,
// instance.crawl(audit));
//
// EasyMock.verify(mockAuditServiceThread);
// EasyMock.verify(mockAuditServiceThreadFactory);
// }
// /**
// * Test of loadContent method, of class AuditServiceImpl.
// */
// public void testLoadContent() {
// AuditServiceImpl instance = initialiseAuditService();
//
// Audit audit = EasyMock.createMock(Audit.class);
// Audit auditReturnedByLoadContentMethodOfAuditServiceThread =
// EasyMock.createMock(Audit.class);
//
// AuditServiceThread mockAuditServiceThread = EasyMock.createMock(AuditServiceThread.class);
//
// mockAuditServiceThread.loadContent();
// EasyMock.expectLastCall();
// EasyMock.expect(mockAuditServiceThread.getAudit()).
// andReturn(auditReturnedByLoadContentMethodOfAuditServiceThread).anyTimes();
// EasyMock.replay(mockAuditServiceThread);
//
// EasyMock.expect(mockAuditServiceThreadFactory.create(audit)).
// andReturn(mockAuditServiceThread).anyTimes();
// EasyMock.replay(mockAuditServiceThreadFactory);
//
// assertEquals(auditReturnedByLoadContentMethodOfAuditServiceThread,
// instance.loadContent(audit));
//
// EasyMock.verify(mockAuditServiceThread);
// EasyMock.verify(mockAuditServiceThreadFactory);
// }
// /**
// * Test of loadScenario method, of class AuditServiceImpl.
// */
// public void testLoadScenario() {
// AuditServiceImpl instance = initialiseAuditService();
//
// Audit audit = EasyMock.createMock(Audit.class);
// Audit auditReturnedByLoadScenarioMethodOfAuditServiceThread =
// EasyMock.createMock(Audit.class);
//
// AuditServiceThread mockAuditServiceThread = EasyMock.createMock(AuditServiceThread.class);
//
// mockAuditServiceThread.loadContent();
// EasyMock.expectLastCall();
// EasyMock.expect(mockAuditServiceThread.getAudit()).
// andReturn(auditReturnedByLoadScenarioMethodOfAuditServiceThread).anyTimes();
// EasyMock.replay(mockAuditServiceThread);
//
// EasyMock.expect(mockAuditServiceThreadFactory.create(audit)).
// andReturn(mockAuditServiceThread).anyTimes();
// EasyMock.replay(mockAuditServiceThreadFactory);
//
// assertEquals(auditReturnedByLoadScenarioMethodOfAuditServiceThread,
// instance.loadScenario(audit));
//
// EasyMock.verify(mockAuditServiceThread);
// EasyMock.verify(mockAuditServiceThreadFactory);
// }
// /**
// * Test of adaptContent method, of class AuditServiceImpl.
// */
// public void testAdaptContent() {
// AuditServiceImpl instance = initialiseAuditService();
//
// Audit audit = EasyMock.createMock(Audit.class);
// Audit auditReturnedByAdaptContentMethodOfAuditServiceThread =
// EasyMock.createMock(Audit.class);
//
// AuditServiceThread mockAuditServiceThread = EasyMock.createMock(AuditServiceThread.class);
//
// mockAuditServiceThread.adaptContent();
// EasyMock.expectLastCall();
// EasyMock.expect(mockAuditServiceThread.getAudit()).
// andReturn(auditReturnedByAdaptContentMethodOfAuditServiceThread).anyTimes();
// EasyMock.replay(mockAuditServiceThread);
//
// EasyMock.expect(mockAuditServiceThreadFactory.create(audit)).
// andReturn(mockAuditServiceThread).anyTimes();
// EasyMock.replay(mockAuditServiceThreadFactory);
//
// assertEquals(auditReturnedByAdaptContentMethodOfAuditServiceThread,
// instance.adaptContent(audit));
//
// EasyMock.verify(mockAuditServiceThread);
// EasyMock.verify(mockAuditServiceThreadFactory);
// }
// /**
// * Test of process method, of class AuditServiceImpl.
// */
// public void testProcess() {
// AuditServiceImpl instance = initialiseAuditService();
//
// Audit audit = EasyMock.createMock(Audit.class);
// Audit auditReturnedByProcessMethodOfAuditServiceThread =
// EasyMock.createMock(Audit.class);
//
// AuditServiceThread mockAuditServiceThread = EasyMock.createMock(AuditServiceThread.class);
//
// mockAuditServiceThread.process();
// EasyMock.expectLastCall();
// EasyMock.expect(mockAuditServiceThread.getAudit()).
// andReturn(auditReturnedByProcessMethodOfAuditServiceThread).anyTimes();
// EasyMock.replay(mockAuditServiceThread);
//
// EasyMock.expect(mockAuditServiceThreadFactory.create(audit)).
// andReturn(mockAuditServiceThread).anyTimes();
// EasyMock.replay(mockAuditServiceThreadFactory);
//
// assertEquals(auditReturnedByProcessMethodOfAuditServiceThread,
// instance.process(audit));
//
// EasyMock.verify(mockAuditServiceThread);
// EasyMock.verify(mockAuditServiceThreadFactory);
// }
// /**
// * Test of consolidate method, of class AuditServiceImpl.
// */
// public void testConsolidate() {
// AuditServiceImpl instance = initialiseAuditService();
//
// Audit audit = EasyMock.createMock(Audit.class);
// Audit auditReturnedByConsolidateMethodOfAuditServiceThread =
// EasyMock.createMock(Audit.class);
//
// AuditServiceThread mockAuditServiceThread = EasyMock.createMock(AuditServiceThread.class);
//
// mockAuditServiceThread.consolidate();
// EasyMock.expectLastCall();
// EasyMock.expect(mockAuditServiceThread.getAudit()).
// andReturn(auditReturnedByConsolidateMethodOfAuditServiceThread).anyTimes();
// EasyMock.replay(mockAuditServiceThread);
//
// EasyMock.expect(mockAuditServiceThreadFactory.create(audit)).
// andReturn(mockAuditServiceThread).anyTimes();
// EasyMock.replay(mockAuditServiceThreadFactory);
//
// assertEquals(auditReturnedByConsolidateMethodOfAuditServiceThread,
// instance.consolidate(audit));
//
// EasyMock.verify(mockAuditServiceThread);
// EasyMock.verify(mockAuditServiceThreadFactory);
// }
// /**
// * Test of analyse method, of class AuditServiceImpl.
// */
// public void testAnalyse() {
// AuditServiceImpl instance = initialiseAuditService();
//
// Audit audit = EasyMock.createMock(Audit.class);
// Audit auditReturnedByAnalyseMethodOfAuditServiceThread =
// EasyMock.createMock(Audit.class);
//
// AuditServiceThread mockAuditServiceThread = EasyMock.createMock(AuditServiceThread.class);
//
// mockAuditServiceThread.analyse();
// EasyMock.expectLastCall();
// EasyMock.expect(mockAuditServiceThread.getAudit()).
// andReturn(auditReturnedByAnalyseMethodOfAuditServiceThread).anyTimes();
// EasyMock.replay(mockAuditServiceThread);
//
// EasyMock.expect(mockAuditServiceThreadFactory.create(audit)).
// andReturn(mockAuditServiceThread).anyTimes();
// EasyMock.replay(mockAuditServiceThreadFactory);
//
// assertEquals(auditReturnedByAnalyseMethodOfAuditServiceThread,
// instance.analyse(audit));
//
// EasyMock.verify(mockAuditServiceThread);
// EasyMock.verify(mockAuditServiceThreadFactory);
// }
/**
* Test of auditCompleted method, of class AuditServiceImpl.
*/
public void testAuditCompleted() {
AuditServiceImpl instance = initialiseAuditService();
Audit mockAudit = EasyMock.createMock(Audit.class);
AuditServiceListener mockAuditServiceListener = EasyMock.createMock(AuditServiceListener.class);
mockAuditServiceListener.auditCompleted(mockAudit);
EasyMock.expectLastCall().anyTimes();
EasyMock.replay(mockAuditServiceListener);
EasyMock.replay(mockAudit);
instance.add(mockAuditServiceListener);
instance.auditCompleted(mockAudit);
EasyMock.verify(mockAudit);
EasyMock.verify(mockAuditServiceListener);
}
use of org.asqatasun.entity.audit.Audit in project Asqatasun by Asqatasun.
the class AuditServiceImplTest method testAuditSite.
/**
* Test of auditPage method, of class AuditServiceImpl.
*/
public void testAuditSite() {
System.out.println("auditSite");
String siteUrl = "http://My.testUrl.org";
Set<Parameter> paramSet = null;
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, paramSet, true)).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.addSiteAudit(mockAuditCommand);
EasyMock.expectLastCall().anyTimes();
EasyMock.replay(mockAuditServiceThreadQueue);
instance.setAuditServiceThreadQueue(mockAuditServiceThreadQueue);
Audit result = instance.auditSite(siteUrl, paramSet);
assertEquals(auditCreateByAuditCommand, result);
EasyMock.verify(mockAuditServiceThreadQueue);
EasyMock.verify(mockAuditCommand);
EasyMock.verify(mockAuditCommandFactory);
}
use of org.asqatasun.entity.audit.Audit in project Asqatasun by Asqatasun.
the class AuditServiceImplTest method testAuditPage.
/**
* Test of auditPage method, of class AuditServiceImpl.
*/
public void testAuditPage() {
System.out.println("auditPage");
String pageUrl = "http://My.testUrl.org";
Set<Parameter> paramSet = null;
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(pageUrl, paramSet, false)).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 page 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.auditPage(pageUrl, paramSet);
assertEquals(auditCreateByAuditCommand, result);
EasyMock.verify(mockAuditServiceThreadQueue);
EasyMock.verify(mockAuditCommand);
EasyMock.verify(mockAuditCommandFactory);
}
use of org.asqatasun.entity.audit.Audit in project Asqatasun by Asqatasun.
the class AuditServiceImplTest method testAuditPageUploadWithOneFile.
/**
* Test of auditPageUpload method, of class AuditServiceImpl.
*/
public void testAuditPageUploadWithOneFile() {
System.out.println("auditPageUploadWithOneFile");
Set<Parameter> paramSet = null;
// test we only one file is passed as argument to be tested
String file1Name = "file://test1";
Map<String, String> fileMap = new HashMap<>();
fileMap.put(file1Name, "");
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(fileMap, 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 pageUpload audit
AuditServiceThreadQueue mockAuditServiceThreadQueue = EasyMock.createMock(AuditServiceThreadQueue.class);
mockAuditServiceThreadQueue.add(instance);
EasyMock.expectLastCall().anyTimes();
mockAuditServiceThreadQueue.addPageUploadAudit(mockAuditCommand);
EasyMock.replay(mockAuditServiceThreadQueue);
instance.setAuditServiceThreadQueue(mockAuditServiceThreadQueue);
Audit result = instance.auditPageUpload(fileMap, paramSet);
assertEquals(auditCreateByAuditCommand, result);
EasyMock.verify(mockAuditServiceThreadQueue);
EasyMock.verify(mockAuditCommand);
EasyMock.verify(mockAuditCommandFactory);
}
use of org.asqatasun.entity.audit.Audit in project Asqatasun by Asqatasun.
the class AuditServiceImplTest method testAuditCrashed.
/**
* Test of auditCompleted method, of class AuditServiceImpl.
*/
public void testAuditCrashed() {
AuditServiceImpl instance = initialiseAuditService();
Audit mockAudit = EasyMock.createMock(Audit.class);
Exception mockException = EasyMock.createMock(Exception.class);
AuditServiceListener mockAuditServiceListener = EasyMock.createMock(AuditServiceListener.class);
mockAuditServiceListener.auditCrashed(mockAudit, mockException);
EasyMock.expectLastCall().anyTimes();
EasyMock.replay(mockAuditServiceListener);
EasyMock.replay(mockAudit);
EasyMock.replay(mockException);
instance.add(mockAuditServiceListener);
instance.auditCrashed(mockAudit, mockException);
EasyMock.verify(mockAudit);
EasyMock.verify(mockAuditServiceListener);
EasyMock.verify(mockException);
}
Aggregations