Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Frédéric THOMAS
    @doublefx
    Still the step seems to be recorded
    protected Condition is_personal_pension_transfer = this::isPersonalPensionTransfer;
    Maybe I should pass a Supplier<Boolean<> ?
    Bertil Muth
    @bertilmuth
    Yes, indeed, this works as (I) intended it.
    Even the steps that have a false condition are recorded, since it may be interesting that their condition has been evaluated.
    Frédéric THOMAS
    @doublefx
    Do you mean the step is recorded eventhough the condition is false?
    ok
    Bertil Muth
    @bertilmuth
    Yes. Is that a problem?
    Frédéric THOMAS
    @doublefx
    how can I test that then?
    because my point here doing UT is to test the flow logic but if the step is recorded, I cannot rely on assertRecordedStepNames as I did up to now
    Bertil Muth
    @bertilmuth
    OK. I'm willing to do a hot fix for that if it is a problem.
    Frédéric THOMAS
    @doublefx
    thanks!
    Bertil Muth
    @bertilmuth
    It's not a big deal.
    Frédéric THOMAS
    @doublefx
    good then
    Frédéric THOMAS
    @doublefx
    Also, Can you please add the sources to the build, since 1.8, it has been removed
    Bertil Muth
    @bertilmuth
    What? I didn't change anything in the build file, maybe something was wrong with the upload.
    I'll check the build file just to be absolutely sure.
    Frédéric THOMAS
    @doublefx
    ok, I'll see the fixed version whether I get the source.jar
    Bertil Muth
    @bertilmuth
    Yep. I see the sources.jar for v1.8 in Nexus Repository Manager. Odd.
    Frédéric THOMAS
    @doublefx
    yes, odd, my remote machine has crashed today, maybe some files have been corrupted,
    anyway good to know that's not on your side
    I was thinking that if you feel you need the step to be recorded even when the condition is false, maybe you can change the type from String to RecordedStep with String stepName, boolean condition, so the step will be recored but I can filter the false out
    Bertil Muth
    @bertilmuth
    I'm not clinging to my need, and already implemented the hotfix :-)
    Frédéric THOMAS
    @doublefx
    ok, great, sorry :-)
    Bertil Muth
    @bertilmuth
    Ok, you can use v1.8.1. Sources are available in my download.
    I meant: I can see the sources locally.
    Frédéric THOMAS
    @doublefx
    I use them as part of the maven artifact
    from my IDE
    is the maven artifact built and pushed?
    and I don't know what you mean "Sources are available in my download"
    Bertil Muth
    @bertilmuth
    I just downloaded v1.8.1 with Maven, and I can navigate to the sources with my IDE. Gradle as well. That's what I meant.
    Frédéric THOMAS
    @doublefx
    ah ok, thanks
    trying now
    weird
    image.png
    Frédéric THOMAS
    @doublefx
    Bertil Muth
    @bertilmuth
    And it worked before v1.8?
    Frédéric THOMAS
    @doublefx
    yes
    The test above now passes but, when condition is true, after systemPublish(), the returned event is not considered, it goes to the next step instead
    //@formatter:off
    return builder
    .useCase(PROCESS_ORDER)
        .basicFlow()
          .step(HANDLES_PROCESS_ORDER_START_EVENT).on(process_order_start_event).systemPublish(start_process_order)
          .step(HANDLES_ORDER_STATUS).system(handles_order_status)
          .step(HANDLES_EMPLOYMENT_STATUS).system(handles_employment_status)
          .step(HANDLES_PERSONAL_PENSION_ORDER_TYPE).system(handles_personal_pension_order_type)
          .step(HANDLES_VALIDATE_CEDING_PROVIDERS).inCase(is_personal_pension_transfer).systemPublish(validates_ceding_providers)
          .step(HANDLES_GCD_VALIDATION).systemPublish(validates_gcd)
          .step("HANDLES_VALIDATE_AML").system(stop)
    
        .flow(RUFUS_CHECK).after(HANDLES_PERSONAL_PENSION_ORDER_TYPE).condition(is_isa_product)
          .step(HANDLES_CHECK_RUFUS_STATUS).systemPublish(rufus_check_start).to(rufus_flow)
          .step(HANDLES_RUFUS_CHECK_SUCCESS).on(rufus_check_success).continuesAt(HANDLES_GCD_VALIDATION)
    
        .flow(CEDING_PROVIDERS_VALIDATION_FAILED)
          .step(HANDLES_CEDING_PROVIDERS_VALIDATION_FAILED).on(ceding_providers_validation_failed).systemPublish(respond_ceding_providers_failure_E104)
    
        .flow(PUBLISH_RESPONSE).anytime()
          .step(HANDLES_PUBLISH_RESPONSE).on(publish_response).systemPublish(response)
    
        .flow(PROCESS_ORDER_EXCEPTION).anytime()
          .step(HANDLES_PROCESS_ORDER_EXCEPTION).on(process_order_exception).system(stop_on_exception)
    
      .build();
    //@formatter:on

    @Test
    public void HANDLES_CEDING_PROVIDERS_VALIDATION_FAILED_respond_ceding_providers_failure_E104() {
    // GIVEN
    final PublishResponseEvent publishResponseEvent = of(new ResponseEntity<>(response, OK));

    given(cedingProvidersValidationStep.isPersonalPensionTransfer()).willReturn(true);
    given(cedingProvidersValidationStep.validateCedingProviders()).willReturn(cedingProvidersValidationFailed);
    given(cedingProvidersValidationStep.respondCedingProvidersFailureE104())
        .willReturn(publishResponseEvent);
    
    givenFlowWillStopAt(PUBLISH_RESPONSE);
    
    // WHEN
    modelRunner.reactTo(processOrderRequest);
    
    // THEN
    assertRecordedStepNames(HANDLES_PROCESS_ORDER_START_EVENT,
                            HANDLES_ORDER_STATUS,
                            HANDLES_EMPLOYMENT_STATUS,
                            HANDLES_PERSONAL_PENSION_ORDER_TYPE,
                            HANDLES_VALIDATE_CEDING_PROVIDERS,
                            HANDLES_CEDING_PROVIDERS_VALIDATION_FAILED,
                            HANDLES_PUBLISH_RESPONSE);

    }

    [Handles Process Order Start Event, Handles Order Status, Handles Employment Status, Handles Personal Pension Order Type, Handles Validate Ceding Providers, Handles GCD Validation, HANDLES_VALIDATE_AML]
    Frédéric THOMAS
    @doublefx
    works if I add .insteadOf(HANDLES_GCD_VALIDATION)
    Bertil Muth
    @bertilmuth
    to which flow? Sorry, I'm a bit lost.
    Frédéric THOMAS
    @doublefx
    I remember now what you told me yerterday, flows need conditions, the on() is not enough
    .flow(CEDING_PROVIDERS_VALIDATION_FAILED).insteadOf(HANDLES_GCD_VALIDATION)
    .step(HANDLES_CEDING_PROVIDERS_VALIDATION_FAILED).on(ceding_providers_validation_failed).systemPublish(respond_ceding_providers_failure_E104)
    Bertil Muth
    @bertilmuth
    Yes. You could use anytime() as well.
    The rule of thumb is: if it's not the basic flow, it needs a condition (or flow position).
    Frédéric THOMAS
    @doublefx
    Have a great weekend Bertil, I hope I won't disturb you for a while now, many thanks again
    Bertil Muth
    @bertilmuth
    You as well. I‘ll be on vacation now, but will check what‘s going on from time to time.