Pipeline controller: plan 2 (hard +, error +50 %), backlog throttle, 2 trajectory workers, stop rules, summaries every 50; budget reserve

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Kral
2026-10-05 13:35:54 +02:00
parent 1c4667a0fc
commit 13360292dd
781 changed files with 50211 additions and 22 deletions

View File

@@ -0,0 +1,184 @@
CLASS {{p}}holiday_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
CONSTANTS c_today TYPE d VALUE '20260101'.
DATA mo_cut TYPE REF TO {{p}}holiday_checker.
METHODS setup.
METHODS valid_booking FOR TESTING.
METHODS minimum_values FOR TESTING.
METHODS lower_case_code FOR TESTING.
METHODS unknown_destination FOR TESTING.
METHODS too_many_travellers FOR TESTING.
METHODS zero_travellers FOR TESTING.
METHODS bad_nights FOR TESTING.
METHODS too_early_departure FOR TESTING.
METHODS dest_rule_comes_first FOR TESTING.
METHODS nights_rule_comes_first FOR TESTING.
ENDCLASS.
CLASS {{p}}holiday_hidden IMPLEMENTATION.
METHOD setup.
mo_cut = NEW {{p}}holiday_checker( ).
ENDMETHOD.
METHOD valid_booking.
DATA(lv_done) = abap_false.
TRY.
mo_cut->check( is_booking = VALUE #( dest_code = 'ALPS'
travellers = 6
nights = 7
departure = '20260201' )
iv_today = c_today ).
lv_done = abap_true.
CATCH {{p}}cx_holiday_error INTO DATA(lx).
cl_abap_unit_assert=>fail( |Unexpected exception: { lx->mv_message }| ).
ENDTRY.
cl_abap_unit_assert=>assert_equals( exp = abap_true act = lv_done ).
ENDMETHOD.
METHOD minimum_values.
DATA(lv_done) = abap_false.
TRY.
mo_cut->check( is_booking = VALUE #( dest_code = 'LAPLAND'
travellers = 1
nights = 2
departure = '20260115' )
iv_today = c_today ).
lv_done = abap_true.
CATCH {{p}}cx_holiday_error INTO DATA(lx).
cl_abap_unit_assert=>fail( |Unexpected exception: { lx->mv_message }| ).
ENDTRY.
cl_abap_unit_assert=>assert_equals( exp = abap_true act = lv_done ).
ENDMETHOD.
METHOD lower_case_code.
DATA(lv_done) = abap_false.
TRY.
mo_cut->check( is_booking = VALUE #( dest_code = ' kyoto '
travellers = 8
nights = 14
departure = '20260301' )
iv_today = c_today ).
lv_done = abap_true.
CATCH {{p}}cx_holiday_error INTO DATA(lx).
cl_abap_unit_assert=>fail( |Unexpected exception: { lx->mv_message }| ).
ENDTRY.
cl_abap_unit_assert=>assert_equals( exp = abap_true act = lv_done ).
ENDMETHOD.
METHOD unknown_destination.
TRY.
mo_cut->check( is_booking = VALUE #( dest_code = 'MARS'
travellers = 2
nights = 7
departure = '20260201' )
iv_today = c_today ).
cl_abap_unit_assert=>fail( 'CX_UNKNOWN_DEST expected' ).
CATCH {{p}}cx_unknown_dest INTO DATA(lx).
cl_abap_unit_assert=>assert_equals( exp = `MARS` act = lx->mv_dest ).
cl_abap_unit_assert=>assert_equals( exp = `Destination is not offered`
act = lx->mv_message ).
CATCH {{p}}cx_holiday_error.
cl_abap_unit_assert=>fail( 'Wrong exception type' ).
ENDTRY.
ENDMETHOD.
METHOD too_many_travellers.
TRY.
mo_cut->check( is_booking = VALUE #( dest_code = 'CRETE'
travellers = 5
nights = 7
departure = '20260201' )
iv_today = c_today ).
cl_abap_unit_assert=>fail( 'CX_BAD_TRAVELLERS expected' ).
CATCH {{p}}cx_bad_travellers INTO DATA(lx).
cl_abap_unit_assert=>assert_equals( exp = 5 act = lx->mv_travellers ).
cl_abap_unit_assert=>assert_equals( exp = 4 act = lx->mv_max ).
CATCH {{p}}cx_holiday_error.
cl_abap_unit_assert=>fail( 'Wrong exception type' ).
ENDTRY.
ENDMETHOD.
METHOD zero_travellers.
TRY.
mo_cut->check( is_booking = VALUE #( dest_code = 'ALPS'
travellers = 0
nights = 7
departure = '20260201' )
iv_today = c_today ).
cl_abap_unit_assert=>fail( 'CX_BAD_TRAVELLERS expected' ).
CATCH {{p}}cx_bad_travellers INTO DATA(lx).
cl_abap_unit_assert=>assert_equals( exp = 0 act = lx->mv_travellers ).
cl_abap_unit_assert=>assert_equals( exp = 6 act = lx->mv_max ).
CATCH {{p}}cx_holiday_error.
cl_abap_unit_assert=>fail( 'Wrong exception type' ).
ENDTRY.
ENDMETHOD.
METHOD bad_nights.
TRY.
mo_cut->check( is_booking = VALUE #( dest_code = 'ALPS'
travellers = 2
nights = 29
departure = '20260201' )
iv_today = c_today ).
cl_abap_unit_assert=>fail( 'CX_BAD_NIGHTS expected' ).
CATCH {{p}}cx_bad_nights INTO DATA(lx).
cl_abap_unit_assert=>assert_equals( exp = 29 act = lx->mv_nights ).
CATCH {{p}}cx_holiday_error.
cl_abap_unit_assert=>fail( 'Wrong exception type' ).
ENDTRY.
ENDMETHOD.
METHOD too_early_departure.
TRY.
mo_cut->check( is_booking = VALUE #( dest_code = 'SAFARI'
travellers = 3
nights = 7
departure = '20260114' )
iv_today = c_today ).
cl_abap_unit_assert=>fail( 'CX_BAD_DEPARTURE expected' ).
CATCH {{p}}cx_bad_departure INTO DATA(lx).
cl_abap_unit_assert=>assert_equals( exp = CONV d( '20260114' )
act = lx->mv_departure ).
cl_abap_unit_assert=>assert_equals( exp = CONV d( '20260115' )
act = lx->mv_earliest ).
cl_abap_unit_assert=>assert_equals( exp = `Departure date is too early`
act = lx->mv_message ).
CATCH {{p}}cx_holiday_error.
cl_abap_unit_assert=>fail( 'Wrong exception type' ).
ENDTRY.
ENDMETHOD.
METHOD dest_rule_comes_first.
TRY.
mo_cut->check( is_booking = VALUE #( dest_code = 'MARS'
travellers = 99
nights = 99
departure = '20200101' )
iv_today = c_today ).
cl_abap_unit_assert=>fail( 'CX_UNKNOWN_DEST expected' ).
CATCH {{p}}cx_unknown_dest.
CATCH {{p}}cx_holiday_error.
cl_abap_unit_assert=>fail( 'Wrong exception type' ).
ENDTRY.
ENDMETHOD.
METHOD nights_rule_comes_first.
TRY.
mo_cut->check( is_booking = VALUE #( dest_code = 'ALPS'
travellers = 2
nights = 99
departure = '20200101' )
iv_today = c_today ).
cl_abap_unit_assert=>fail( 'CX_BAD_NIGHTS expected' ).
CATCH {{p}}cx_bad_nights.
CATCH {{p}}cx_holiday_error.
cl_abap_unit_assert=>fail( 'Wrong exception type' ).
ENDTRY.
ENDMETHOD.
ENDCLASS.