test_class.file: dataprep-maintenance/src/test/java/org/talend/dataprep/maintenance/preparation/PreparationStepMarkerTest.java
test_class.identifier: PreparationStepMarkerTest
test_case.body: @Test
      public void shouldDisableCleanUpDuringProcess() {
          // Given
          final UUID stepMarker = UUID.randomUUID();
          final StepMarker marker = new PreparationStepMarker();
          final PreparationRepository repository = mock(PreparationRepository.class);
          when(repository.exist(eq(Preparation.class), any())).thenReturn(false, true);
          final Preparation preparation = new Preparation();
          when(repository.list(eq(Preparation.class))).thenReturn(Stream.of(preparation));
  
          // When
          final StepMarker.Result result = marker.mark(repository, stepMarker);
  
          // Then
          assertEquals(StepMarker.Result.INTERRUPTED, result);
          verify(repository, never()).add(Matchers.<Collection<Step>> any());
      }
test_case.class_method_signature: PreparationStepMarkerTest.shouldDisableCleanUpDuringProcess()
test_case.full_signature: @Test public void shouldDisableCleanUpDuringProcess()
test_case.identifier: shouldDisableCleanUpDuringProcess
test_case.invocations: randomUUID mock thenReturn when exist eq any thenReturn when list eq of mark assertEquals add verify never any
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void shouldDisableCleanUpDuringProcess()
focal_class.declarator: LOGGER = LoggerFactory.getLogger(PreparationStepMarker.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOGGER = LoggerFactory.getLogger(PreparationStepMarker.class);
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.declarator: recentlyModified
focal_class.modifier: @Value("${cleaner.recently.modified:3600}")
      private
focal_class.original_string: @Value("${cleaner.recently.modified:3600}")
      private int recentlyModified;
focal_class.type: int
focal_class.var_name: recentlyModified
focal_class.file: dataprep-maintenance/src/main/java/org/talend/dataprep/maintenance/preparation/PreparationStepMarker.java
focal_class.identifier: PreparationStepMarker
focal_class.interfaces: implements StepMarker
focal_class.class_method_signature: PreparationStepMarker.logRecentlyModified(PreparationRepository repository)
focal_class.full_signature: private void logRecentlyModified(PreparationRepository repository)
focal_class.identifier: logRecentlyModified
focal_class.modifiers: private
focal_class.parameters: (PreparationRepository repository)
focal_class.return: void
focal_class.signature: void logRecentlyModified(PreparationRepository repository)
focal_class.class_method_signature: PreparationStepMarker.recentlyModified()
focal_class.full_signature: private Expression recentlyModified()
focal_class.identifier: recentlyModified
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: Expression
focal_class.signature: Expression recentlyModified()
focal_class.class_method_signature: PreparationStepMarker.mark(PreparationRepository repository, UUID marker)
focal_class.full_signature: @Override public Result mark(PreparationRepository repository, UUID marker)
focal_class.identifier: mark
focal_class.modifiers: @Override public
focal_class.parameters: (PreparationRepository repository, UUID marker)
focal_class.return: Result
focal_class.signature: Result mark(PreparationRepository repository, UUID marker)
focal_method.body: @Override
      public Result mark(PreparationRepository repository, UUID marker) {
          if (repository.exist(Preparation.class, recentlyModified())) {
              LOGGER.info("Not running clean up (at least a preparation modified within last hour).");
              logRecentlyModified(repository);
              return Result.INTERRUPTED;
          }
  
          final AtomicBoolean interrupted = new AtomicBoolean(false);
          repository
                  .list(Preparation.class) //
                  .filter(p -> !interrupted.get()) //
                  .forEach(p -> {
                      if (repository.exist(Preparation.class, recentlyModified())) {
                          LOGGER.info("Interrupting clean up (preparation modified within last hour).");
                          logRecentlyModified(repository);
                          interrupted.set(true);
                          return;
                      }
                      final Collection<Identifiable> markedSteps = p
                              .getSteps() //
                              .stream() //
                              .filter(s -> !Objects.equals(s, Step.ROOT_STEP))
                              .peek(s -> s.setMarker(marker.toString())) //
                              .collect(Collectors.toList());
                      repository.add(markedSteps);
                  });
          return interrupted.get() ? Result.INTERRUPTED : Result.COMPLETED;
      }
focal_method.class_method_signature: PreparationStepMarker.mark(PreparationRepository repository, UUID marker)
focal_method.full_signature: @Override public Result mark(PreparationRepository repository, UUID marker)
focal_method.identifier: mark
focal_method.invocations: exist recentlyModified info logRecentlyModified forEach filter list get exist recentlyModified info logRecentlyModified set collect peek filter stream getSteps equals setMarker toString toList add get
focal_method.modifiers: @Override public
focal_method.parameters: (PreparationRepository repository, UUID marker)
focal_method.return: Result
focal_method.signature: Result mark(PreparationRepository repository, UUID marker)