예제 #1
0
 // TODO add test for processing finish
 @Test
 @Ignore
 public void shouldFinishProcessing() throws InterruptedException {
   // Given
   ImageProcessingFlowFactory flowFactory = new ImageProcessingFlowFactory();
   Step step =
       new Step(
           INITIAL_STEP_NUMBER, PLUGIN_NAME, Arrays.asList(new StepDependency(0, Image.class)));
   List<Step> processingSchedule = Arrays.asList(step);
   int flowSize = processingSchedule.size();
   String taskId = "1";
   ImageProcessingFlow imageProcessingFlow =
       flowFactory.create(manifestRepository, eventBus, flowSize, processingSchedule, taskId);
   // When
   imageProcessingFlow.start(image, (e) -> {});
   // Then
   assertThat((TestEvent) eventBus.getPublishedEvents().get(1))
       .is(
           new Condition<>(
               e -> e.getStepNumber() == 1 && e.getResult() == TestFlowStep.RESULT,
               "Step id correct and has expected result"));
 }
예제 #2
0
 @Test
 public void shouldStartProcessingFlow() {
   // Given
   ImageProcessingFlowFactory flowFactory = new ImageProcessingFlowFactory();
   Step step =
       new Step(
           INITIAL_STEP_NUMBER,
           PLUGIN_NAME,
           Arrays.asList(new StepDependency(ImageProcessingFlow.START_STEP_ID, Image.class)));
   List<Step> processingSchedule = Arrays.asList(step);
   int flowSize = processingSchedule.size();
   String taskId = "1";
   ImageProcessingFlow imageProcessingFlow =
       flowFactory.create(manifestRepository, eventBus, flowSize, processingSchedule, taskId);
   // When
   imageProcessingFlow.start(image, (e) -> {});
   // Then
   assertThat((ImageCalculated) eventBus.getPublishedEvents().get(FIRST_EVENT))
       .is(
           new Condition<>(
               e -> e.getStepNumber() == INITIAL_STEP_NUMBER && e.getLoadedImage() == image,
               "Is message loaded"));
 }