Search in sources :

Example 1 with DatabaseInitializingServiceImpl

use of org.sakuli.services.forwarder.database.DatabaseInitializingServiceImpl in project sakuli by ConSol.

the class InitializingServiceHelperTest method testInvokeAllResultServices.

@Test
public void testInvokeAllResultServices() throws Exception {
    assertEquals(BeanLoader.loadMultipleBeans(InitializingService.class).size(), 3);
    DatabaseInitializingServiceImpl databaseService = BeanLoader.loadBean(DatabaseInitializingServiceImpl.class);
    doNothing().when(databaseService).initTestSuite();
    GearmanInitializingServiceImpl gearmanService = BeanLoader.loadBean(GearmanInitializingServiceImpl.class);
    doNothing().when(gearmanService).initTestSuite();
    TestSuite testSuite = BeanLoader.loadBean(TestSuite.class);
    testSuite.setState(null);
    testSuite.setStartDate(null);
    InitializingServiceHelper.invokeInitializingServcies();
    assertEquals(testSuite.getState(), TestSuiteState.RUNNING);
    assertTrue(testSuite.getStartDate().before(new DateTime().plusMillis(100).toDate()));
    verify(databaseService).initTestSuite();
    verify(gearmanService).initTestSuite();
}
Also used : GearmanInitializingServiceImpl(org.sakuli.services.forwarder.gearman.GearmanInitializingServiceImpl) TestSuite(org.sakuli.datamodel.TestSuite) DatabaseInitializingServiceImpl(org.sakuli.services.forwarder.database.DatabaseInitializingServiceImpl) DateTime(org.joda.time.DateTime) Test(org.testng.annotations.Test)

Aggregations

DateTime (org.joda.time.DateTime)1 TestSuite (org.sakuli.datamodel.TestSuite)1 DatabaseInitializingServiceImpl (org.sakuli.services.forwarder.database.DatabaseInitializingServiceImpl)1 GearmanInitializingServiceImpl (org.sakuli.services.forwarder.gearman.GearmanInitializingServiceImpl)1 Test (org.testng.annotations.Test)1