use of com.synopsys.integration.alert.component.scheduling.workflow.DailyTask in project hub-alert by blackducksoftware.
the class DailyTaskTest method testGetTaskName.
@Test
void testGetTaskName() {
DailyTask task = new DailyTask(SCHEDULING_DESCRIPTOR_KEY, null, null, null, null, null, null);
assertEquals(ScheduledTask.computeTaskName(task.getClass()), task.getTaskName());
}
use of com.synopsys.integration.alert.component.scheduling.workflow.DailyTask in project hub-alert by blackducksoftware.
the class DailyTaskTest method cronExpressionNotDefault.
@Test
void cronExpressionNotDefault() {
final String notDefaultValue = "44";
ConfigurationModelConfigurationAccessor configurationModelConfigurationAccessor = Mockito.mock(ConfigurationModelConfigurationAccessor.class);
ConfigurationModelMutable configurationModel = new ConfigurationModelMutable(1L, 1L, null, null, ConfigContextEnum.GLOBAL);
ConfigurationFieldModel configurationFieldModel = ConfigurationFieldModel.create(SchedulingDescriptor.KEY_DAILY_PROCESSOR_HOUR_OF_DAY);
configurationFieldModel.setFieldValue(notDefaultValue);
configurationModel.put(configurationFieldModel);
Mockito.when(configurationModelConfigurationAccessor.getConfigurationsByDescriptorKey(Mockito.any(DescriptorKey.class))).thenReturn(List.of(configurationModel));
StaticJobAccessor jobAccessor = Mockito.mock(StaticJobAccessor.class);
Mockito.when(jobAccessor.hasJobsByFrequency(Mockito.any())).thenReturn(true);
DailyTask task = new DailyTask(SCHEDULING_DESCRIPTOR_KEY, null, null, null, null, configurationModelConfigurationAccessor, jobAccessor);
String cronWithNotDefault = task.scheduleCronExpression();
String expectedCron = String.format(DailyTask.CRON_FORMAT, notDefaultValue);
assertEquals(expectedCron, cronWithNotDefault);
}
Aggregations