use of org.sakuli.services.forwarder.gearman.GearmanResultServiceImpl 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.gearman.GearmanResultServiceImpl in project sakuli by ConSol.
the class TeardownServiceHelperTest method mockGearmanResultService.
private GearmanResultServiceImpl mockGearmanResultService() {
GearmanResultServiceImpl gearmanResultService = BeanLoader.loadBean(GearmanResultServiceImpl.class);
doNothing().when(gearmanResultService).refreshStates();
doNothing().when(gearmanResultService).saveAllResults();
return gearmanResultService;
}
Aggregations