Search in sources :

Example 11 with ScheduledTask

use of com.synopsys.integration.alert.api.task.ScheduledTask in project hub-alert by blackducksoftware.

the class TaskManagerTest method testScheduleFixedRateForUnknownTask.

@Test
public void testScheduleFixedRateForUnknownTask() {
    ScheduledTask task = Mockito.mock(ScheduledTask.class);
    final String taskName = "a_task";
    final long period = 999;
    Mockito.when(task.getTaskName()).thenReturn(taskName);
    TaskManager taskManager = new TaskManager();
    taskManager.registerTask(task);
    taskManager.scheduleExecutionAtFixedRate(period, "unknown_task");
    Mockito.verify(task, Mockito.times(0)).scheduleExecutionAtFixedRate(Mockito.anyLong());
    taskManager.scheduleExecutionAtFixedRate(period, null);
    Mockito.verify(task, Mockito.times(0)).scheduleExecutionAtFixedRate(Mockito.anyLong());
}
Also used : TaskManager(com.synopsys.integration.alert.api.task.TaskManager) ScheduledTask(com.synopsys.integration.alert.api.task.ScheduledTask) Test(org.junit.jupiter.api.Test)

Aggregations

ScheduledTask (com.synopsys.integration.alert.api.task.ScheduledTask)11 TaskManager (com.synopsys.integration.alert.api.task.TaskManager)11 Test (org.junit.jupiter.api.Test)11 TaskMetaData (com.synopsys.integration.alert.api.task.TaskMetaData)1 AuthorizationManager (com.synopsys.integration.alert.common.security.authorization.AuthorizationManager)1 TaskManagementDescriptorKey (com.synopsys.integration.alert.component.tasks.TaskManagementDescriptorKey)1 ScheduledFuture (java.util.concurrent.ScheduledFuture)1 TaskScheduler (org.springframework.scheduling.TaskScheduler)1