use of com.blackducksoftware.integration.hub.alert.scheduling.mock.MockGlobalSchedulingEntity in project hub-alert by blackducksoftware.
the class StartupManagerTest method testInitializeCronJobs.
@Test
public void testInitializeCronJobs() throws IOException {
final AccumulatorConfig accumulatorConfig = Mockito.mock(AccumulatorConfig.class);
Mockito.doNothing().when(accumulatorConfig).scheduleJobExecution(Mockito.anyString());
Mockito.doReturn(1L).when(accumulatorConfig).getMillisecondsToNextRun();
final DailyDigestBatchConfig dailyDigestBatchConfig = Mockito.mock(DailyDigestBatchConfig.class);
Mockito.doNothing().when(dailyDigestBatchConfig).scheduleJobExecution(Mockito.anyString());
Mockito.doReturn("time").when(dailyDigestBatchConfig).getFormatedNextRunTime();
final PurgeConfig purgeConfig = Mockito.mock(PurgeConfig.class);
Mockito.doNothing().when(purgeConfig).scheduleJobExecution(Mockito.anyString());
Mockito.doReturn("time").when(purgeConfig).getFormatedNextRunTime();
final GlobalSchedulingRepositoryWrapper globalSchedulingRepositoryWrapper = Mockito.mock(GlobalSchedulingRepositoryWrapper.class);
final MockGlobalSchedulingEntity mockGlobalSchedulingEntity = new MockGlobalSchedulingEntity();
final GlobalSchedulingConfigEntity entity = mockGlobalSchedulingEntity.createGlobalEntity();
Mockito.when(globalSchedulingRepositoryWrapper.save(Mockito.any(GlobalSchedulingConfigEntity.class))).thenReturn(entity);
final StartupManager startupManager = new StartupManager(globalSchedulingRepositoryWrapper, null, accumulatorConfig, dailyDigestBatchConfig, purgeConfig);
startupManager.initializeCronJobs();
final String expectedLog = entity.toString();
assertTrue(outputLogger.isLineContainingText(expectedLog));
}
Aggregations