Search in sources :

Example 1 with CacheHandlingResultServiceImpl

use of org.sakuli.services.common.CacheHandlingResultServiceImpl 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();
}
Also used : GearmanResultServiceImpl(org.sakuli.services.forwarder.gearman.GearmanResultServiceImpl) CacheHandlingResultServiceImpl(org.sakuli.services.common.CacheHandlingResultServiceImpl) TestSuite(org.sakuli.datamodel.TestSuite) DatabaseResultServiceImpl(org.sakuli.services.forwarder.database.DatabaseResultServiceImpl) LogCleanUpResultServiceImpl(org.sakuli.services.common.LogCleanUpResultServiceImpl) Test(org.testng.annotations.Test)

Example 2 with CacheHandlingResultServiceImpl

use of org.sakuli.services.common.CacheHandlingResultServiceImpl in project sakuli by ConSol.

the class TeardownServiceHelperTest method mockCacheHandlingResultService.

private CacheHandlingResultServiceImpl mockCacheHandlingResultService() {
    CacheHandlingResultServiceImpl cacheHandlingResultService = BeanLoader.loadBean(CacheHandlingResultServiceImpl.class);
    doNothing().when(cacheHandlingResultService).refreshStates();
    doNothing().when(cacheHandlingResultService).saveAllResults();
    return cacheHandlingResultService;
}
Also used : CacheHandlingResultServiceImpl(org.sakuli.services.common.CacheHandlingResultServiceImpl)

Aggregations

CacheHandlingResultServiceImpl (org.sakuli.services.common.CacheHandlingResultServiceImpl)2 TestSuite (org.sakuli.datamodel.TestSuite)1 LogCleanUpResultServiceImpl (org.sakuli.services.common.LogCleanUpResultServiceImpl)1 DatabaseResultServiceImpl (org.sakuli.services.forwarder.database.DatabaseResultServiceImpl)1 GearmanResultServiceImpl (org.sakuli.services.forwarder.gearman.GearmanResultServiceImpl)1 Test (org.testng.annotations.Test)1