use of org.sakuli.services.forwarder.database.DatabaseResultServiceImpl in project sakuli by ConSol.
the class TeardownServiceHelperTest method testInvokeAllTeardwonServices.
@Test
public void testInvokeAllTeardwonServices() throws Exception {
assertEquals(BeanLoader.loadMultipleBeans(TeardownService.class).size(), 5);
DatabaseResultServiceImpl databaseResultService = mockDatabaseResultService();
GearmanResultServiceImpl gearmanResultService = mockGearmanResultService();
CacheHandlingResultServiceImpl cacheHandlingResultService = mockCacheHandlingResultService();
LogCleanUpResultServiceImpl logCleanUpResultService = mockLogCleanUpResultService();
TestSuite testSuite = BeanLoader.loadBean(TestSuite.class);
testSuite.setState(TestSuiteState.RUNNING);
TeardownServiceHelper.invokeTeardownServices();
assertEquals(testSuite.getState(), TestSuiteState.OK);
assertTrue(testSuite.getStopDate().after(testSuite.getStartDate()));
verify(databaseResultService).saveAllResults();
verify(databaseResultService).refreshStates();
verify(gearmanResultService).saveAllResults();
verify(gearmanResultService).refreshStates();
verify(cacheHandlingResultService).saveAllResults();
verify(cacheHandlingResultService).refreshStates();
verify(logCleanUpResultService).triggerAction();
}
use of org.sakuli.services.forwarder.database.DatabaseResultServiceImpl in project sakuli by ConSol.
the class TeardownServiceHelperTest method mockDatabaseResultService.
private DatabaseResultServiceImpl mockDatabaseResultService() {
DatabaseResultServiceImpl databaseResultService = BeanLoader.loadBean(DatabaseResultServiceImpl.class);
doNothing().when(databaseResultService).refreshStates();
doNothing().when(databaseResultService).saveAllResults();
return databaseResultService;
}
Aggregations