test_class.declarator: outputCapture = new OutputCaptureRule()
test_class.modifier: @Rule
      public final
test_class.original_string: @Rule
      public final OutputCaptureRule outputCapture = new OutputCaptureRule();
test_class.type: OutputCaptureRule
test_class.var_name: outputCapture
test_class.declarator: eventService
test_class.modifier: @MockBean
      private
test_class.original_string: @MockBean
      private EventService eventService;
test_class.type: EventService
test_class.var_name: eventService
test_class.declarator: buildService
test_class.modifier: @MockBean
      private
test_class.original_string: @MockBean
      private BuildService buildService;
test_class.type: BuildService
test_class.var_name: buildService
test_class.declarator: eventsHandler
test_class.modifier: @MockBean
      private
test_class.original_string: @MockBean
      private ServerSentEventsHandler eventsHandler;
test_class.type: ServerSentEventsHandler
test_class.var_name: eventsHandler
test_class.declarator: dashboardService
test_class.modifier: @MockBean
      private
test_class.original_string: @MockBean
      private DashboardService dashboardService;
test_class.type: DashboardService
test_class.var_name: dashboardService
test_class.declarator: eventScheduler
test_class.modifier: @Autowired
      private
test_class.original_string: @Autowired
      private EventScheduler eventScheduler;
test_class.type: EventScheduler
test_class.var_name: eventScheduler
test_class.file: mirrorgate-api/src/test/java/com/bbva/arq/devops/ae/mirrorgate/cron/EventSchedulerTest.java
test_class.identifier: EventSchedulerTest
test_case.body: @Test
      public void testSchedulerTimestampIsModified() {
          when(eventService.getEventsSinceTimestamp(anyLong()))
              .thenReturn(Arrays.asList(createBuildEvent(), createIssueEvent()));
          when(eventService.getLastEvent()).thenReturn(null);
          when(eventsHandler.getDashboardsWithSession()).thenReturn(new HashSet<>(Collections.singletonList("123")));
  
          eventScheduler.checkEventUpdates();
  
          assertTrue(outputCapture.toString().contains("1234567"));
  
      }
test_case.class_method_signature: EventSchedulerTest.testSchedulerTimestampIsModified()
test_case.full_signature: @Test public void testSchedulerTimestampIsModified()
test_case.identifier: testSchedulerTimestampIsModified
test_case.invocations: thenReturn when getEventsSinceTimestamp anyLong asList createBuildEvent createIssueEvent thenReturn when getLastEvent thenReturn when getDashboardsWithSession singletonList checkEventUpdates assertTrue contains toString
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testSchedulerTimestampIsModified()
focal_class.declarator: LOG = LoggerFactory.getLogger(EventScheduler.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOG = LoggerFactory.getLogger(EventScheduler.class);
focal_class.type: Logger
focal_class.var_name: LOG
focal_class.declarator: eventService
focal_class.modifier: private final
focal_class.original_string: private final EventService eventService;
focal_class.type: EventService
focal_class.var_name: eventService
focal_class.declarator: schedulerTimestamp = 0L
focal_class.modifier: private
focal_class.original_string: private Long schedulerTimestamp = 0L;
focal_class.type: Long
focal_class.var_name: schedulerTimestamp
focal_class.declarator: handler
focal_class.modifier: private final
focal_class.original_string: private final ConnectionHandler handler;
focal_class.type: ConnectionHandler
focal_class.var_name: handler
focal_class.declarator: beanFactory
focal_class.modifier: private final
focal_class.original_string: private final BeanFactory beanFactory;
focal_class.type: BeanFactory
focal_class.var_name: beanFactory
focal_class.file: mirrorgate-api/src/main/java/com/bbva/arq/devops/ae/mirrorgate/cron/EventScheduler.java
focal_class.identifier: EventScheduler
focal_class.class_method_signature: EventScheduler.EventScheduler(
          final EventService eventService,
          final ConnectionHandler handler,
          final BeanFactory beanFactory
      )
focal_class.full_signature: @Autowired public  EventScheduler(
          final EventService eventService,
          final ConnectionHandler handler,
          final BeanFactory beanFactory
      )
focal_class.identifier: EventScheduler
focal_class.modifiers: @Autowired public
focal_class.parameters: (
          final EventService eventService,
          final ConnectionHandler handler,
          final BeanFactory beanFactory
      )
focal_class.signature:  EventScheduler(
          final EventService eventService,
          final ConnectionHandler handler,
          final BeanFactory beanFactory
      )
focal_class.class_method_signature: EventScheduler.checkEventUpdates()
focal_class.full_signature: @Scheduled(fixedDelayString = "${events.scheduler.delay.millis}") void checkEventUpdates()
focal_class.identifier: checkEventUpdates
focal_class.modifiers: @Scheduled(fixedDelayString = "${events.scheduler.delay.millis}")
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void checkEventUpdates()
focal_class.class_method_signature: EventScheduler.initSchedulerTimestamp()
focal_class.full_signature: @PostConstruct public void initSchedulerTimestamp()
focal_class.identifier: initSchedulerTimestamp
focal_class.modifiers: @PostConstruct public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void initSchedulerTimestamp()
focal_method.body: @Scheduled(fixedDelayString = "${events.scheduler.delay.millis}")
      void checkEventUpdates() {
  
          LOG.debug("Processing events for timestamp {}", schedulerTimestamp);
  
          final Set<String> dashboardIds = handler.getDashboardsWithSession();
  
          if (dashboardIds != null) {
              LOG.debug("Active dashboards {}", dashboardIds.size());
          }
  
          //process events
          if (! Objects.requireNonNull(dashboardIds).isEmpty()) {
              //query DB for last events
              final List<Event> unprocessedEvents = eventService.getEventsSinceTimestamp(schedulerTimestamp);
              if (! unprocessedEvents.isEmpty()) {
  
                  //Filter events
                  unprocessedEvents.stream()
                      .collect(Collectors.groupingBy(Event::getEventType))
                      .forEach((key, value) -> beanFactory.getBean(key.getValue(), EventHandler.class)
                          .processEvents(value, dashboardIds));
                  //save last event timestamp to local variable
                  schedulerTimestamp = unprocessedEvents.get(unprocessedEvents.size() - 1).getTimestamp();
                  LOG.debug("Modified timestamp: {}", schedulerTimestamp);
              }
  
          }
      }
focal_method.class_method_signature: EventScheduler.checkEventUpdates()
focal_method.full_signature: @Scheduled(fixedDelayString = "${events.scheduler.delay.millis}") void checkEventUpdates()
focal_method.identifier: checkEventUpdates
focal_method.invocations: debug getDashboardsWithSession debug size isEmpty requireNonNull getEventsSinceTimestamp isEmpty forEach collect stream groupingBy processEvents getBean getValue getTimestamp get size debug
focal_method.modifiers: @Scheduled(fixedDelayString = "${events.scheduler.delay.millis}")
focal_method.parameters: ()
focal_method.return: void
focal_method.signature: void checkEventUpdates()