diff --git a/src/01/01/z2ui5_cl_util_tree_json.clas.testclasses.abap b/src/01/01/z2ui5_cl_util_tree_json.clas.testclasses.abap index 62421a0c..868b5474 100644 --- a/src/01/01/z2ui5_cl_util_tree_json.clas.testclasses.abap +++ b/src/01/01/z2ui5_cl_util_tree_json.clas.testclasses.abap @@ -1,85 +1,85 @@ -CLASS ltcl_unit_01_json DEFINITION FINAL FOR TESTING - DURATION LONG - RISK LEVEL HARMLESS. - - PRIVATE SECTION. - METHODS test_json_attri FOR TESTING RAISING cx_static_check. - METHODS test_json_object FOR TESTING RAISING cx_static_check. - METHODS test_json_struc FOR TESTING RAISING cx_static_check. - METHODS test_create_json FOR TESTING RAISING cx_static_check. - -ENDCLASS. - -CLASS ltcl_unit_01_json IMPLEMENTATION. - - METHOD test_json_attri. - - DATA(lo_tree) = NEW z2ui5_cl_util_tree_json( ). - lo_tree->add_attribute( n = `AAA` - v = `BBB` ). - - DATA(lv_result) = lo_tree->stringify( ). - IF `{"AAA":"BBB"}` <> lv_result. - cl_abap_unit_assert=>fail( 'json tree - wrong stringify attributes' ). - ENDIF. - - ENDMETHOD. - - METHOD test_json_object. - - DATA(lo_tree) = NEW z2ui5_cl_util_tree_json( ). - lo_tree->add_attribute_object( `CCC` )->add_attribute( n = `AAA` - v = `BBB` ). - - DATA(lv_result) = lo_tree->stringify( ). - IF `{"CCC":{"AAA":"BBB"}}` <> lv_result. - cl_abap_unit_assert=>fail( 'json tree - wrong stringify object attributes' ). - ENDIF. - - ENDMETHOD. - - METHOD test_json_struc. - - DATA(lo_tree) = NEW z2ui5_cl_util_tree_json( ). - - TYPES: - BEGIN OF ty_s_test, - comp1 TYPE string, - comp2 TYPE string, - END OF ty_s_test. - - DATA(ls_test) = VALUE ty_s_test( comp1 = `AAA` comp2 = `BBB` ). - lo_tree->add_attribute_object( `CCC` )->add_attribute_struc( ls_test ). - - DATA(lv_result) = lo_tree->stringify( ). - IF `{"CCC":{"COMP1":"AAA","COMP2":"BBB"}}` <> lv_result. - cl_abap_unit_assert=>fail( 'json tree - wrong stringify structure' ). - ENDIF. - - ENDMETHOD. - - METHOD test_create_json. - - - - DATA(lo_json) = z2ui5_cl_util_tree_json=>factory( `{"CCC":{"COMP1":"AAA","COMP2":"BBB"}}` ). - - DATA(lo_attri) = lo_json->get_attribute( `CCC` )->get_attribute( `COMP2` ). - - - FIELD-SYMBOLS TYPE any. - DATA(lr_ref) = lo_attri->get_val_ref( ). - - ASSIGN lr_ref->* TO . - IF <> `BBB`. - cl_abap_unit_assert=>fail( quit = 5 ). - ENDIF. - - DATA(lv_val) = lo_attri->get_val( ). - IF lv_val <> `BBB`. - cl_abap_unit_assert=>fail( quit = 5 ). - ENDIF. - - ENDMETHOD. - -ENDCLASS. +*CLASS ltcl_unit_01_json DEFINITION FINAL FOR TESTING +* DURATION LONG +* RISK LEVEL HARMLESS. +* +* PRIVATE SECTION. +* METHODS test_json_attri FOR TESTING RAISING cx_static_check. +* METHODS test_json_object FOR TESTING RAISING cx_static_check. +* METHODS test_json_struc FOR TESTING RAISING cx_static_check. +* METHODS test_create_json FOR TESTING RAISING cx_static_check. +* +*ENDCLASS. +* +*CLASS ltcl_unit_01_json IMPLEMENTATION. +* +* METHOD test_json_attri. +* +* DATA(lo_tree) = NEW z2ui5_cl_util_tree_json( ). +* lo_tree->add_attribute( n = `AAA` +* v = `BBB` ). +* +* DATA(lv_result) = lo_tree->stringify( ). +* IF `{"AAA":"BBB"}` <> lv_result. +* cl_abap_unit_assert=>fail( 'json tree - wrong stringify attributes' ). +* ENDIF. +* +* ENDMETHOD. +* +* METHOD test_json_object. +* +* DATA(lo_tree) = NEW z2ui5_cl_util_tree_json( ). +* lo_tree->add_attribute_object( `CCC` )->add_attribute( n = `AAA` +* v = `BBB` ). +* +* DATA(lv_result) = lo_tree->stringify( ). +* IF `{"CCC":{"AAA":"BBB"}}` <> lv_result. +* cl_abap_unit_assert=>fail( 'json tree - wrong stringify object attributes' ). +* ENDIF. +* +* ENDMETHOD. +* +* METHOD test_json_struc. +* +* DATA(lo_tree) = NEW z2ui5_cl_util_tree_json( ). +* +* TYPES: +* BEGIN OF ty_s_test, +* comp1 TYPE string, +* comp2 TYPE string, +* END OF ty_s_test. +* +* DATA(ls_test) = VALUE ty_s_test( comp1 = `AAA` comp2 = `BBB` ). +* lo_tree->add_attribute_object( `CCC` )->add_attribute_struc( ls_test ). +* +* DATA(lv_result) = lo_tree->stringify( ). +* IF `{"CCC":{"COMP1":"AAA","COMP2":"BBB"}}` <> lv_result. +* cl_abap_unit_assert=>fail( 'json tree - wrong stringify structure' ). +* ENDIF. +* +* ENDMETHOD. +* +* METHOD test_create_json. +* +* +* +* DATA(lo_json) = z2ui5_cl_util_tree_json=>factory( `{"CCC":{"COMP1":"AAA","COMP2":"BBB"}}` ). +* +* DATA(lo_attri) = lo_json->get_attribute( `CCC` )->get_attribute( `COMP2` ). +* +* +* FIELD-SYMBOLS TYPE any. +* DATA(lr_ref) = lo_attri->get_val_ref( ). +* +* ASSIGN lr_ref->* TO . +* IF <> `BBB`. +* cl_abap_unit_assert=>fail( quit = 5 ). +* ENDIF. +* +* DATA(lv_val) = lo_attri->get_val( ). +* IF lv_val <> `BBB`. +* cl_abap_unit_assert=>fail( quit = 5 ). +* ENDIF. +* +* ENDMETHOD. +* +*ENDCLASS. diff --git a/src/01/02/z2ui5_cl_fw_binding.clas.testclasses.abap b/src/01/02/z2ui5_cl_fw_binding.clas.testclasses.abap index b5d776df..b1ec8eb8 100644 --- a/src/01/02/z2ui5_cl_fw_binding.clas.testclasses.abap +++ b/src/01/02/z2ui5_cl_fw_binding.clas.testclasses.abap @@ -1,764 +1,764 @@ - -CLASS ltcl_test_dissolve DEFINITION DEFERRED. -CLASS z2ui5_cl_fw_binding DEFINITION LOCAL FRIENDS ltcl_test_dissolve. - -CLASS ltcl_test_dissolve DEFINITION FINAL FOR TESTING - DURATION SHORT - RISK LEVEL DANGEROUS. - - PUBLIC SECTION. - - TYPES: - BEGIN OF s_01, - input TYPE string, - BEGIN OF s_02, - input TYPE string, - BEGIN OF s_03, - input TYPE string, - BEGIN OF s_04, - input TYPE string, - END OF s_04, - END OF s_03, - END OF s_02, - END OF s_01. - - DATA ms_struc TYPE s_01 ##NEEDED. - DATA mv_value TYPE string ##NEEDED. - DATA mr_value TYPE REF TO data. - DATA mr_struc TYPE REF TO s_01. - DATA mo_app TYPE REF TO ltcl_test_dissolve. - - PRIVATE SECTION. - METHODS test_dissolve_init FOR TESTING RAISING cx_static_check. - METHODS test_dissolve_struc FOR TESTING RAISING cx_static_check. - METHODS test_dissolve_dref FOR TESTING RAISING cx_static_check. - METHODS test_dissolve_oref FOR TESTING RAISING cx_static_check. - -ENDCLASS. - -CLASS ltcl_test_dissolve IMPLEMENTATION. - - METHOD test_dissolve_init. - - DATA(lo_app) = NEW ltcl_test_dissolve( ). - DATA(lo_bind) = NEW z2ui5_cl_fw_binding( ). - lo_bind->mo_app = lo_app. - - lo_bind->dissolve_init( ). - DATA(lt_dissolve) = lo_bind->mt_attri. - - cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MO_APP` ] OPTIONAL ) ). - cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MR_STRUC` ] OPTIONAL ) ). - cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MR_VALUE` ] OPTIONAL ) ). - cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MS_STRUC` ] OPTIONAL ) ). - cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MV_VALUE` ] OPTIONAL ) ). - - ENDMETHOD. - - METHOD test_dissolve_dref. - - DATA(lo_app) = NEW ltcl_test_dissolve( ). - DATA(lo_bind) = NEW z2ui5_cl_fw_binding( ). - lo_bind->mo_app = lo_app. - - CREATE DATA lo_app->mr_struc. - CREATE DATA lo_app->mr_value TYPE string. - - lo_bind->dissolve_init( ). - lo_bind->dissolve_dref( ). - DATA(lt_dissolve) = lo_bind->mt_attri. - - cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MO_APP` ] OPTIONAL ) ). - cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MR_STRUC->*` ] OPTIONAL ) ). - cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MR_VALUE->*` ] OPTIONAL ) ). - cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MS_STRUC` ] OPTIONAL ) ). - cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MV_VALUE` ] OPTIONAL ) ). - - ENDMETHOD. - - METHOD test_dissolve_oref. - - DATA(lo_app) = NEW ltcl_test_dissolve( ). - lo_app->mo_app = NEW #( ). - DATA(lo_bind) = NEW z2ui5_cl_fw_binding( ). - lo_bind->mo_app = lo_app. - - CREATE DATA lo_app->mo_app->mr_struc. - CREATE DATA lo_app->mo_app->mr_value TYPE string. - - lo_bind->dissolve_init( ). - lo_bind->dissolve_oref( ). - DATA(lt_dissolve) = lo_bind->mt_attri. - - cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MO_APP->MV_VALUE` ] OPTIONAL ) ). - cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MO_APP->MR_STRUC` ] OPTIONAL ) ). - cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MO_APP->MR_VALUE` ] OPTIONAL ) ). - cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MO_APP->MS_STRUC` ] OPTIONAL ) ). - cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MR_STRUC` ] OPTIONAL ) ). - cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MR_VALUE` ] OPTIONAL ) ). - cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MS_STRUC` ] OPTIONAL ) ). - cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MV_VALUE` ] OPTIONAL ) ). - - ENDMETHOD. - - METHOD test_dissolve_struc. - - DATA(lo_app) = NEW ltcl_test_dissolve( ). - DATA(lo_bind) = NEW z2ui5_cl_fw_binding( ). - lo_bind->mo_app = lo_app. - - lo_bind->dissolve_init( ). - lo_bind->dissolve_struc( ). - DATA(lt_dissolve) = lo_bind->mt_attri. - - cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MO_APP` ] OPTIONAL ) ). - cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MR_STRUC` ] OPTIONAL ) ). - cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MS_STRUC-INPUT` ] OPTIONAL ) ). - cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MS_STRUC-S_02-INPUT` ] OPTIONAL ) ). - cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MS_STRUC-S_02-S_03-S_04-INPUT` ] OPTIONAL ) ). - cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MR_VALUE` ] OPTIONAL ) ). - cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MS_STRUC` ] OPTIONAL ) ). - cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MV_VALUE` ] OPTIONAL ) ). - - ENDMETHOD. - -ENDCLASS. - -CLASS ltcl_test_bind DEFINITION DEFERRED. -CLASS z2ui5_cl_fw_binding DEFINITION LOCAL FRIENDS ltcl_test_bind. - -CLASS ltcl_test_bind DEFINITION FINAL FOR TESTING - DURATION MEDIUM - RISK LEVEL DANGEROUS. - - PUBLIC SECTION. - - TYPES: - BEGIN OF s_01, - input TYPE string, - BEGIN OF s_02, - input TYPE string, - BEGIN OF s_03, - input TYPE string, - BEGIN OF s_04, - input TYPE string, - END OF s_04, - END OF s_03, - END OF s_02, - END OF s_01. - - DATA ms_struc TYPE s_01. - DATA mv_value TYPE string. - DATA mr_value TYPE REF TO data. - DATA mr_struc TYPE REF TO s_01. - DATA mo_app TYPE REF TO ltcl_test_bind. - - PRIVATE SECTION. - METHODS test_value FOR TESTING RAISING cx_static_check. - METHODS test_struc FOR TESTING RAISING cx_static_check. - METHODS test_dref_val FOR TESTING RAISING cx_static_check. - METHODS test_dref_struc FOR TESTING RAISING cx_static_check. - METHODS test_oref_val FOR TESTING RAISING cx_static_check. - METHODS test_oref_struc FOR TESTING RAISING cx_static_check. - METHODS test_oref_dref_val FOR TESTING RAISING cx_static_check. - METHODS test_local FOR TESTING RAISING cx_static_check. - -ENDCLASS. - -CLASS ltcl_test_bind IMPLEMENTATION. - - METHOD test_value. - - DATA(lo_app) = NEW ltcl_test_bind( ). - DATA(lo_bind) = NEW z2ui5_cl_fw_binding( ). - - lo_bind->mo_app = lo_app. - lo_bind->mr_data = REF #( lo_app->mv_value ). - lo_bind->mv_type = z2ui5_cl_fw_binding=>cs_bind_type-one_way. - - DATA(ls_attri) = VALUE z2ui5_cl_fw_binding=>ty_s_attri( name = `MV_VALUE` ). - DATA(lv_result) = lo_bind->bind( REF #( ls_attri ) ). - - cl_abap_unit_assert=>assert_equals( - act = lv_result - exp = `/MV_VALUE` ). - - ENDMETHOD. - - - METHOD test_struc. - - DATA(lo_app) = NEW ltcl_test_bind( ). - DATA(lo_bind) = NEW z2ui5_cl_fw_binding( ). - - lo_bind->mo_app = lo_app. - lo_bind->mr_data = REF #( lo_app->ms_struc-s_02-s_03-s_04-input ). - lo_bind->mv_type = z2ui5_cl_fw_binding=>cs_bind_type-one_way. - - DATA(ls_attri) = VALUE z2ui5_cl_fw_binding=>ty_s_attri( name = `MS_STRUC-S_02-S_03-S_04-INPUT` ). - DATA(lv_result) = lo_bind->bind( REF #( ls_attri ) ). - - cl_abap_unit_assert=>assert_equals( - act = lv_result - exp = `/MS_STRUC_S_02_S_03_S_04_INPUT` ). - - ENDMETHOD. - - - METHOD test_dref_val. - - DATA(lo_app) = NEW ltcl_test_bind( ). - DATA(lo_bind) = NEW z2ui5_cl_fw_binding( ). - - FIELD-SYMBOLS TYPE any. - CREATE DATA lo_app->mr_value TYPE string. - ASSIGN lo_app->mr_value->* TO . - - lo_bind->mo_app = lo_app. - lo_bind->mr_data = REF #( ). - lo_bind->mv_type = z2ui5_cl_fw_binding=>cs_bind_type-one_way. - - DATA(ls_attri) = VALUE z2ui5_cl_fw_binding=>ty_s_attri( name = `MR_VALUE->*` ). - DATA(lv_result) = lo_bind->bind( REF #( ls_attri ) ). - - cl_abap_unit_assert=>assert_equals( - act = lv_result - exp = `/MR_VALUE___` ). - - ENDMETHOD. - - METHOD test_dref_struc. - - DATA(lo_app) = NEW ltcl_test_bind( ). - DATA(lo_bind) = NEW z2ui5_cl_fw_binding( ). - - FIELD-SYMBOLS TYPE any. - CREATE DATA lo_app->mr_struc. - ASSIGN lo_app->mr_struc->input TO . - - lo_bind->mo_app = lo_app. - lo_bind->mr_data = REF #( ). - lo_bind->mv_type = z2ui5_cl_fw_binding=>cs_bind_type-one_way. - - DATA(ls_attri) = VALUE z2ui5_cl_fw_binding=>ty_s_attri( name = `MR_STRUC->INPUT` ). - DATA(lv_result) = lo_bind->bind( REF #( ls_attri ) ). - - cl_abap_unit_assert=>assert_equals( - act = lv_result - exp = `/MR_STRUC__INPUT` ). - - ENDMETHOD. - - METHOD test_oref_val. - - DATA(lo_app) = NEW ltcl_test_bind( ). - lo_app->mo_app = NEW #( ). - DATA(lo_bind) = NEW z2ui5_cl_fw_binding( ). - - lo_bind->mo_app = lo_app. - lo_bind->mr_data = REF #( lo_app->mo_app->mv_value ). - lo_bind->mv_type = z2ui5_cl_fw_binding=>cs_bind_type-one_way. - - DATA(ls_attri) = VALUE z2ui5_cl_fw_binding=>ty_s_attri( name = `MO_APP->MV_VALUE` ). - DATA(lv_result) = lo_bind->bind( REF #( ls_attri ) ). - - cl_abap_unit_assert=>assert_equals( - act = lv_result - exp = `/MO_APP__MV_VALUE` ). - - ENDMETHOD. - - METHOD test_oref_struc. - - DATA(lo_app) = NEW ltcl_test_bind( ). - lo_app->mo_app = NEW #( ). - DATA(lo_bind) = NEW z2ui5_cl_fw_binding( ). - - lo_bind->mo_app = lo_app. - lo_bind->mr_data = REF #( lo_app->mo_app->ms_struc-input ). - lo_bind->mv_type = z2ui5_cl_fw_binding=>cs_bind_type-one_way. - - DATA(ls_attri) = VALUE z2ui5_cl_fw_binding=>ty_s_attri( name = `MO_APP->MS_STRUC-INPUT` ). - DATA(lv_result) = lo_bind->bind( REF #( ls_attri ) ). - - cl_abap_unit_assert=>assert_equals( - act = lv_result - exp = `/MO_APP__MS_STRUC_INPUT` ). - - ENDMETHOD. - - METHOD test_oref_dref_val. - - DATA(lo_app) = NEW ltcl_test_bind( ). - FIELD-SYMBOLS TYPE any. - lo_app->mo_app = NEW #( ). - DATA(lo_bind) = NEW z2ui5_cl_fw_binding( ). - - - CREATE DATA lo_app->mo_app->mr_value TYPE string. - ASSIGN lo_app->mo_app->mr_value->* TO . - - lo_bind->mo_app = lo_app. - lo_bind->mr_data = REF #( ). - lo_bind->mv_type = z2ui5_cl_fw_binding=>cs_bind_type-one_way. - - DATA(ls_attri) = VALUE z2ui5_cl_fw_binding=>ty_s_attri( name = `MO_APP->MR_VALUE->*` ). - DATA(lv_result) = lo_bind->bind( REF #( ls_attri ) ). - - cl_abap_unit_assert=>assert_equals( - act = lv_result - exp = `/MO_APP__MR_VALUE___` ). - - ENDMETHOD. - - METHOD test_local. - - DATA(lo_bind) = NEW z2ui5_cl_fw_binding( ). - DATA(lv_value) = `test`. - lo_bind->mr_data = REF #( lv_value ). - lo_bind->mv_type = z2ui5_cl_fw_binding=>cs_bind_type-one_time. - - DATA(lv_result) = lo_bind->bind_local( ). - - IF lv_result IS INITIAL. - cl_abap_unit_assert=>fail( ). - ENDIF. - - ENDMETHOD. - -ENDCLASS. - -CLASS ltcl_test_main_value DEFINITION FINAL FOR TESTING - DURATION MEDIUM - RISK LEVEL DANGEROUS. - - PUBLIC SECTION. - - DATA mv_value TYPE string. - - PROTECTED SECTION. - PRIVATE SECTION. - - METHODS test_one_way FOR TESTING RAISING cx_static_check. - METHODS test_one_way_t_attri FOR TESTING RAISING cx_static_check. - METHODS test_one_way_multiple FOR TESTING RAISING cx_static_check. - METHODS test_two_way FOR TESTING RAISING cx_static_check. - METHODS test_one_way_two_way_error FOR TESTING RAISING cx_static_check. - -ENDCLASS. - -CLASS ltcl_test_main_value IMPLEMENTATION. - - METHOD test_one_way. - - DATA(lo_app) = NEW ltcl_test_main_value( ). - lo_app->mv_value = `my value`. - - DATA(lt_attri) = VALUE z2ui5_cl_fw_binding=>ty_t_attri( ). - - DATA(lo_bind) = z2ui5_cl_fw_binding=>factory( - app = lo_app - attri = lt_attri - type = z2ui5_cl_fw_binding=>cs_bind_type-one_way - data = lo_app->mv_value ). - - DATA(lv_result) = lo_bind->main( ). - - cl_abap_unit_assert=>assert_equals( - act = lv_result - exp = `/MV_VALUE` ). - - ENDMETHOD. - - METHOD test_two_way. - - DATA(lo_app) = NEW ltcl_test_main_value( ). - lo_app->mv_value = `my value`. - - DATA(lt_attri) = VALUE z2ui5_cl_fw_binding=>ty_t_attri( ). - - DATA(lo_bind) = z2ui5_cl_fw_binding=>factory( - app = lo_app - attri = lt_attri - type = z2ui5_cl_fw_binding=>cs_bind_type-two_way - data = lo_app->mv_value ). - - DATA(lv_result) = lo_bind->main( ). - - cl_abap_unit_assert=>assert_equals( - act = lv_result - exp = `/` && z2ui5_cl_fw_binding=>cv_model_edit_name && `/MV_VALUE` ). - - ENDMETHOD. - - METHOD test_one_way_t_attri. - - DATA(lo_app) = NEW ltcl_test_main_value( ). - lo_app->mv_value = `my value`. - - DATA(lt_attri) = VALUE z2ui5_cl_fw_binding=>ty_t_attri( ). - - DATA(lo_bind) = z2ui5_cl_fw_binding=>factory( - app = lo_app - attri = lt_attri - type = z2ui5_cl_fw_binding=>cs_bind_type-one_way - data = lo_app->mv_value ). - - lo_bind->main( ). - - DATA(ls_attri) = lo_bind->mt_attri[ name = `MV_VALUE` bind_type = z2ui5_cl_fw_binding=>cs_bind_type-one_way ] ##NEEDED. - - ENDMETHOD. - - METHOD test_one_way_multiple. - - DATA(lo_app) = NEW ltcl_test_main_value( ). - lo_app->mv_value = `my value`. - - DATA(lt_attri) = VALUE z2ui5_cl_fw_binding=>ty_t_attri( ). - - DATA(lo_bind) = z2ui5_cl_fw_binding=>factory( - app = lo_app - attri = lt_attri - type = z2ui5_cl_fw_binding=>cs_bind_type-two_way - data = lo_app->mv_value ). - - DATA(lv_result) = lo_bind->main( ). - - DATA(lo_bind2) = z2ui5_cl_fw_binding=>factory( - app = lo_app - attri = lt_attri - type = z2ui5_cl_fw_binding=>cs_bind_type-two_way - data = lo_app->mv_value ). - - DATA(lv_result2) = lo_bind2->main( ). - - cl_abap_unit_assert=>assert_equals( - act = lv_result - exp = lv_result2 ). - - ENDMETHOD. - - METHOD test_one_way_two_way_error. - - DATA(lo_app) = NEW ltcl_test_main_value( ). - lo_app->mv_value = `my value`. - - DATA(lt_attri) = VALUE z2ui5_cl_fw_binding=>ty_t_attri( ). - - DATA(lo_bind) = z2ui5_cl_fw_binding=>factory( - app = lo_app - attri = lt_attri - type = z2ui5_cl_fw_binding=>cs_bind_type-one_way - data = lo_app->mv_value ). - - lo_bind->main( ). - - DATA(lo_bind2) = z2ui5_cl_fw_binding=>factory( - app = lo_app - attri = lo_bind->mt_attri - type = z2ui5_cl_fw_binding=>cs_bind_type-two_way - data = lo_app->mv_value ). - - TRY. - - lo_bind2->main( ). - cl_abap_unit_assert=>fail( ). - - CATCH cx_root. - ENDTRY. - - ENDMETHOD. - -ENDCLASS. - -CLASS ltcl_test_main_structure DEFINITION FINAL FOR TESTING - DURATION MEDIUM - RISK LEVEL DANGEROUS. - - PUBLIC SECTION. - - TYPES: - BEGIN OF s_01, - input TYPE string, - BEGIN OF s_02, - input TYPE string, - BEGIN OF s_03, - input TYPE string, - BEGIN OF s_04, - input TYPE string, - END OF s_04, - END OF s_03, - END OF s_02, - END OF s_01. - - DATA ms_struc TYPE s_01. - - PRIVATE SECTION. - - METHODS test_one_way_lev1 FOR TESTING RAISING cx_static_check. - METHODS test_one_way_lev2 FOR TESTING RAISING cx_static_check. - METHODS test_one_way_lev3 FOR TESTING RAISING cx_static_check. - - METHODS test_one_way_lev4_long_name FOR TESTING RAISING cx_static_check. - - -ENDCLASS. - -CLASS ltcl_test_main_structure IMPLEMENTATION. - - METHOD test_one_way_lev1. - - DATA(lo_app) = NEW ltcl_test_main_structure( ). - lo_app->ms_struc-input = `my value`. - - DATA(lt_attri) = VALUE z2ui5_cl_fw_binding=>ty_t_attri( ). - - DATA(lo_bind) = z2ui5_cl_fw_binding=>factory( - app = lo_app - attri = lt_attri - type = z2ui5_cl_fw_binding=>cs_bind_type-one_way - data = lo_app->ms_struc-input ). - - DATA(lv_result) = lo_bind->main( ). - - cl_abap_unit_assert=>assert_equals( - act = lv_result - exp = `/MS_STRUC_INPUT` ). - - ENDMETHOD. - - METHOD test_one_way_lev2. - - DATA(lo_app) = NEW ltcl_test_main_structure( ). - lo_app->ms_struc-s_02-input = `my value`. - - DATA(lt_attri) = VALUE z2ui5_cl_fw_binding=>ty_t_attri( ). - - DATA(lo_bind) = z2ui5_cl_fw_binding=>factory( - app = lo_app - attri = lt_attri - type = z2ui5_cl_fw_binding=>cs_bind_type-one_way - data = lo_app->ms_struc-s_02-input ). - - DATA(lv_result) = lo_bind->main( ). - - cl_abap_unit_assert=>assert_equals( - act = lv_result - exp = `/MS_STRUC_S_02_INPUT` ). - - ENDMETHOD. - - METHOD test_one_way_lev3. - - DATA(lo_app) = NEW ltcl_test_main_structure( ). - lo_app->ms_struc-s_02-s_03-input = `my value`. - - DATA(lt_attri) = VALUE z2ui5_cl_fw_binding=>ty_t_attri( ). - - DATA(lo_bind) = z2ui5_cl_fw_binding=>factory( - app = lo_app - attri = lt_attri - type = z2ui5_cl_fw_binding=>cs_bind_type-one_way - data = lo_app->ms_struc-s_02-s_03-input ). - - DATA(lv_result) = lo_bind->main( ). - - cl_abap_unit_assert=>assert_equals( - act = lv_result - exp = `/MS_STRUC_S_02_S_03_INPUT` ). - - ENDMETHOD. - - METHOD test_one_way_lev4_long_name. - - DATA(lo_app) = NEW ltcl_test_main_structure( ). - lo_app->ms_struc-s_02-s_03-s_04-input = `my value`. - - DATA(lt_attri) = VALUE z2ui5_cl_fw_binding=>ty_t_attri( ). - - DATA(lo_bind) = z2ui5_cl_fw_binding=>factory( - app = lo_app - attri = lt_attri - type = z2ui5_cl_fw_binding=>cs_bind_type-one_way - data = lo_app->ms_struc-s_02-s_03-s_04-input ). - - DATA(lv_result) = lo_bind->main( ). - - DATA(ls_attri) = lo_bind->mt_attri[ name = `MS_STRUC-S_02-S_03-S_04-INPUT` bind_type = z2ui5_cl_fw_binding=>cs_bind_type-one_way ]. - - cl_abap_unit_assert=>assert_equals( - act = lv_result - exp = `/` && ls_attri-name_front ). - - ENDMETHOD. - -ENDCLASS. - -CLASS ltcl_test_main_data_ref DEFINITION FINAL FOR TESTING - DURATION MEDIUM - RISK LEVEL DANGEROUS. - - PUBLIC SECTION. - - - - DATA mr_value TYPE REF TO data ##NEEDED. - DATA mr_struc TYPE REF TO data ##NEEDED. - - PRIVATE SECTION. - - METHODS test_one_way_value FOR TESTING RAISING cx_static_check. - METHODS test_one_way_struc FOR TESTING RAISING cx_static_check. - - -ENDCLASS. - -CLASS ltcl_test_main_data_ref IMPLEMENTATION. - - METHOD test_one_way_value. - - - - ENDMETHOD. - - METHOD test_one_way_struc. - - - - ENDMETHOD. - -ENDCLASS. - -CLASS ltcl_test_main_object DEFINITION FINAL FOR TESTING - DURATION MEDIUM - RISK LEVEL DANGEROUS. - - PUBLIC SECTION. - - TYPES: - BEGIN OF ty_s_01, - input TYPE string, - input_02 TYPE string, - input_03 TYPE string, - END OF ty_s_01. - - DATA mv_value TYPE string. - DATA ms_struc TYPE ty_s_01. - - DATA mo_obj TYPE REF TO ltcl_test_main_object. - - PRIVATE SECTION. - - METHODS test_one_way_value FOR TESTING RAISING cx_static_check. - METHODS test_one_way_struc FOR TESTING RAISING cx_static_check. - - -ENDCLASS. - -CLASS ltcl_test_main_object IMPLEMENTATION. - - METHOD test_one_way_value. - - DATA(lo_app) = NEW ltcl_test_main_object( ). - lo_app->mo_obj = NEW #( ). - lo_app->mo_obj->mv_value = `my value`. - - - DATA(lt_attri) = VALUE z2ui5_cl_fw_binding=>ty_t_attri( ). - - DATA(lo_bind) = z2ui5_cl_fw_binding=>factory( - app = lo_app - attri = lt_attri - type = z2ui5_cl_fw_binding=>cs_bind_type-one_way - data = lo_app->mo_obj->mv_value ). - - DATA(lv_result) = lo_bind->main( ). - - cl_abap_unit_assert=>assert_equals( - act = lv_result - exp = `/MO_OBJ__MV_VALUE` ). - - ENDMETHOD. - - METHOD test_one_way_struc. - - DATA(lo_app) = NEW ltcl_test_main_object( ). - lo_app->mo_obj = NEW #( ). - lo_app->mo_obj->ms_struc-input = `my value`. - - DATA(lt_attri) = VALUE z2ui5_cl_fw_binding=>ty_t_attri( ). - - DATA(lo_bind) = z2ui5_cl_fw_binding=>factory( - app = lo_app - attri = lt_attri - type = z2ui5_cl_fw_binding=>cs_bind_type-one_way - data = lo_app->mo_obj->ms_struc-input ). - - DATA(lv_result) = lo_bind->main( ). - - cl_abap_unit_assert=>assert_equals( - act = lv_result - exp = `/MO_OBJ__MS_STRUC_INPUT` ). - - ENDMETHOD. - -ENDCLASS. - -CLASS ltcl_test_main_object_ref_app DEFINITION. - - PUBLIC SECTION. - - TYPES: - BEGIN OF ty_s_01, - input TYPE string, - input_02 TYPE string, - input_03 TYPE string, - END OF ty_s_01. - TYPES ty_t_01 TYPE STANDARD TABLE OF ty_s_01 WITH EMPTY KEY ##NEEDED. - - DATA mr_value TYPE REF TO data ##NEEDED. - DATA mr_struc TYPE REF TO data ##NEEDED. - DATA mr_tab TYPE REF TO data ##NEEDED. - - PRIVATE SECTION. - -ENDCLASS. - -CLASS ltcl_test_main_object_ref DEFINITION FINAL FOR TESTING - DURATION MEDIUM - RISK LEVEL DANGEROUS. - - PUBLIC SECTION. - - DATA mo_obj TYPE REF TO ltcl_test_main_object_ref_app ##NEEDED. - - PRIVATE SECTION. - - METHODS test_one_way_value FOR TESTING RAISING cx_static_check. - METHODS test_one_way_struc FOR TESTING RAISING cx_static_check. - METHODS test_one_way_tab FOR TESTING RAISING cx_static_check. - -ENDCLASS. - -CLASS ltcl_test_main_object_ref IMPLEMENTATION. - - METHOD test_one_way_value. - - - - ENDMETHOD. - - METHOD test_one_way_struc. - - - - ENDMETHOD. - - METHOD test_one_way_tab. - - - - ENDMETHOD. - -ENDCLASS. +* +*CLASS ltcl_test_dissolve DEFINITION DEFERRED. +*CLASS z2ui5_cl_fw_binding DEFINITION LOCAL FRIENDS ltcl_test_dissolve. +* +*CLASS ltcl_test_dissolve DEFINITION FINAL FOR TESTING +* DURATION SHORT +* RISK LEVEL DANGEROUS. +* +* PUBLIC SECTION. +* +* TYPES: +* BEGIN OF s_01, +* input TYPE string, +* BEGIN OF s_02, +* input TYPE string, +* BEGIN OF s_03, +* input TYPE string, +* BEGIN OF s_04, +* input TYPE string, +* END OF s_04, +* END OF s_03, +* END OF s_02, +* END OF s_01. +* +* DATA ms_struc TYPE s_01 ##NEEDED. +* DATA mv_value TYPE string ##NEEDED. +* DATA mr_value TYPE REF TO data. +* DATA mr_struc TYPE REF TO s_01. +* DATA mo_app TYPE REF TO ltcl_test_dissolve. +* +* PRIVATE SECTION. +* METHODS test_dissolve_init FOR TESTING RAISING cx_static_check. +* METHODS test_dissolve_struc FOR TESTING RAISING cx_static_check. +* METHODS test_dissolve_dref FOR TESTING RAISING cx_static_check. +* METHODS test_dissolve_oref FOR TESTING RAISING cx_static_check. +* +*ENDCLASS. +* +*CLASS ltcl_test_dissolve IMPLEMENTATION. +* +* METHOD test_dissolve_init. +* +* DATA(lo_app) = NEW ltcl_test_dissolve( ). +* DATA(lo_bind) = NEW z2ui5_cl_fw_binding( ). +* lo_bind->mo_app = lo_app. +* +* lo_bind->dissolve_init( ). +* DATA(lt_dissolve) = lo_bind->mt_attri. +* +* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MO_APP` ] OPTIONAL ) ). +* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MR_STRUC` ] OPTIONAL ) ). +* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MR_VALUE` ] OPTIONAL ) ). +* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MS_STRUC` ] OPTIONAL ) ). +* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MV_VALUE` ] OPTIONAL ) ). +* +* ENDMETHOD. +* +* METHOD test_dissolve_dref. +* +* DATA(lo_app) = NEW ltcl_test_dissolve( ). +* DATA(lo_bind) = NEW z2ui5_cl_fw_binding( ). +* lo_bind->mo_app = lo_app. +* +* CREATE DATA lo_app->mr_struc. +* CREATE DATA lo_app->mr_value TYPE string. +* +* lo_bind->dissolve_init( ). +* lo_bind->dissolve_dref( ). +* DATA(lt_dissolve) = lo_bind->mt_attri. +* +* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MO_APP` ] OPTIONAL ) ). +* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MR_STRUC->*` ] OPTIONAL ) ). +* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MR_VALUE->*` ] OPTIONAL ) ). +* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MS_STRUC` ] OPTIONAL ) ). +* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MV_VALUE` ] OPTIONAL ) ). +* +* ENDMETHOD. +* +* METHOD test_dissolve_oref. +* +* DATA(lo_app) = NEW ltcl_test_dissolve( ). +* lo_app->mo_app = NEW #( ). +* DATA(lo_bind) = NEW z2ui5_cl_fw_binding( ). +* lo_bind->mo_app = lo_app. +* +* CREATE DATA lo_app->mo_app->mr_struc. +* CREATE DATA lo_app->mo_app->mr_value TYPE string. +* +* lo_bind->dissolve_init( ). +* lo_bind->dissolve_oref( ). +* DATA(lt_dissolve) = lo_bind->mt_attri. +* +* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MO_APP->MV_VALUE` ] OPTIONAL ) ). +* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MO_APP->MR_STRUC` ] OPTIONAL ) ). +* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MO_APP->MR_VALUE` ] OPTIONAL ) ). +* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MO_APP->MS_STRUC` ] OPTIONAL ) ). +* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MR_STRUC` ] OPTIONAL ) ). +* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MR_VALUE` ] OPTIONAL ) ). +* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MS_STRUC` ] OPTIONAL ) ). +* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MV_VALUE` ] OPTIONAL ) ). +* +* ENDMETHOD. +* +* METHOD test_dissolve_struc. +* +* DATA(lo_app) = NEW ltcl_test_dissolve( ). +* DATA(lo_bind) = NEW z2ui5_cl_fw_binding( ). +* lo_bind->mo_app = lo_app. +* +* lo_bind->dissolve_init( ). +* lo_bind->dissolve_struc( ). +* DATA(lt_dissolve) = lo_bind->mt_attri. +* +* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MO_APP` ] OPTIONAL ) ). +* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MR_STRUC` ] OPTIONAL ) ). +* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MS_STRUC-INPUT` ] OPTIONAL ) ). +* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MS_STRUC-S_02-INPUT` ] OPTIONAL ) ). +* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MS_STRUC-S_02-S_03-S_04-INPUT` ] OPTIONAL ) ). +* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MR_VALUE` ] OPTIONAL ) ). +* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MS_STRUC` ] OPTIONAL ) ). +* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MV_VALUE` ] OPTIONAL ) ). +* +* ENDMETHOD. +* +*ENDCLASS. +* +*CLASS ltcl_test_bind DEFINITION DEFERRED. +*CLASS z2ui5_cl_fw_binding DEFINITION LOCAL FRIENDS ltcl_test_bind. +* +*CLASS ltcl_test_bind DEFINITION FINAL FOR TESTING +* DURATION MEDIUM +* RISK LEVEL DANGEROUS. +* +* PUBLIC SECTION. +* +* TYPES: +* BEGIN OF s_01, +* input TYPE string, +* BEGIN OF s_02, +* input TYPE string, +* BEGIN OF s_03, +* input TYPE string, +* BEGIN OF s_04, +* input TYPE string, +* END OF s_04, +* END OF s_03, +* END OF s_02, +* END OF s_01. +* +* DATA ms_struc TYPE s_01. +* DATA mv_value TYPE string. +* DATA mr_value TYPE REF TO data. +* DATA mr_struc TYPE REF TO s_01. +* DATA mo_app TYPE REF TO ltcl_test_bind. +* +* PRIVATE SECTION. +* METHODS test_value FOR TESTING RAISING cx_static_check. +* METHODS test_struc FOR TESTING RAISING cx_static_check. +* METHODS test_dref_val FOR TESTING RAISING cx_static_check. +* METHODS test_dref_struc FOR TESTING RAISING cx_static_check. +* METHODS test_oref_val FOR TESTING RAISING cx_static_check. +* METHODS test_oref_struc FOR TESTING RAISING cx_static_check. +* METHODS test_oref_dref_val FOR TESTING RAISING cx_static_check. +* METHODS test_local FOR TESTING RAISING cx_static_check. +* +*ENDCLASS. +* +*CLASS ltcl_test_bind IMPLEMENTATION. +* +* METHOD test_value. +* +* DATA(lo_app) = NEW ltcl_test_bind( ). +* DATA(lo_bind) = NEW z2ui5_cl_fw_binding( ). +* +* lo_bind->mo_app = lo_app. +* lo_bind->mr_data = REF #( lo_app->mv_value ). +* lo_bind->mv_type = z2ui5_cl_fw_binding=>cs_bind_type-one_way. +* +* DATA(ls_attri) = VALUE z2ui5_cl_fw_binding=>ty_s_attri( name = `MV_VALUE` ). +* DATA(lv_result) = lo_bind->bind( REF #( ls_attri ) ). +* +* cl_abap_unit_assert=>assert_equals( +* act = lv_result +* exp = `/MV_VALUE` ). +* +* ENDMETHOD. +* +* +* METHOD test_struc. +* +* DATA(lo_app) = NEW ltcl_test_bind( ). +* DATA(lo_bind) = NEW z2ui5_cl_fw_binding( ). +* +* lo_bind->mo_app = lo_app. +* lo_bind->mr_data = REF #( lo_app->ms_struc-s_02-s_03-s_04-input ). +* lo_bind->mv_type = z2ui5_cl_fw_binding=>cs_bind_type-one_way. +* +* DATA(ls_attri) = VALUE z2ui5_cl_fw_binding=>ty_s_attri( name = `MS_STRUC-S_02-S_03-S_04-INPUT` ). +* DATA(lv_result) = lo_bind->bind( REF #( ls_attri ) ). +* +* cl_abap_unit_assert=>assert_equals( +* act = lv_result +* exp = `/MS_STRUC_S_02_S_03_S_04_INPUT` ). +* +* ENDMETHOD. +* +* +* METHOD test_dref_val. +* +* DATA(lo_app) = NEW ltcl_test_bind( ). +* DATA(lo_bind) = NEW z2ui5_cl_fw_binding( ). +* +* FIELD-SYMBOLS TYPE any. +* CREATE DATA lo_app->mr_value TYPE string. +* ASSIGN lo_app->mr_value->* TO . +* +* lo_bind->mo_app = lo_app. +* lo_bind->mr_data = REF #( ). +* lo_bind->mv_type = z2ui5_cl_fw_binding=>cs_bind_type-one_way. +* +* DATA(ls_attri) = VALUE z2ui5_cl_fw_binding=>ty_s_attri( name = `MR_VALUE->*` ). +* DATA(lv_result) = lo_bind->bind( REF #( ls_attri ) ). +* +* cl_abap_unit_assert=>assert_equals( +* act = lv_result +* exp = `/MR_VALUE___` ). +* +* ENDMETHOD. +* +* METHOD test_dref_struc. +* +* DATA(lo_app) = NEW ltcl_test_bind( ). +* DATA(lo_bind) = NEW z2ui5_cl_fw_binding( ). +* +* FIELD-SYMBOLS TYPE any. +* CREATE DATA lo_app->mr_struc. +* ASSIGN lo_app->mr_struc->input TO . +* +* lo_bind->mo_app = lo_app. +* lo_bind->mr_data = REF #( ). +* lo_bind->mv_type = z2ui5_cl_fw_binding=>cs_bind_type-one_way. +* +* DATA(ls_attri) = VALUE z2ui5_cl_fw_binding=>ty_s_attri( name = `MR_STRUC->INPUT` ). +* DATA(lv_result) = lo_bind->bind( REF #( ls_attri ) ). +* +* cl_abap_unit_assert=>assert_equals( +* act = lv_result +* exp = `/MR_STRUC__INPUT` ). +* +* ENDMETHOD. +* +* METHOD test_oref_val. +* +* DATA(lo_app) = NEW ltcl_test_bind( ). +* lo_app->mo_app = NEW #( ). +* DATA(lo_bind) = NEW z2ui5_cl_fw_binding( ). +* +* lo_bind->mo_app = lo_app. +* lo_bind->mr_data = REF #( lo_app->mo_app->mv_value ). +* lo_bind->mv_type = z2ui5_cl_fw_binding=>cs_bind_type-one_way. +* +* DATA(ls_attri) = VALUE z2ui5_cl_fw_binding=>ty_s_attri( name = `MO_APP->MV_VALUE` ). +* DATA(lv_result) = lo_bind->bind( REF #( ls_attri ) ). +* +* cl_abap_unit_assert=>assert_equals( +* act = lv_result +* exp = `/MO_APP__MV_VALUE` ). +* +* ENDMETHOD. +* +* METHOD test_oref_struc. +* +* DATA(lo_app) = NEW ltcl_test_bind( ). +* lo_app->mo_app = NEW #( ). +* DATA(lo_bind) = NEW z2ui5_cl_fw_binding( ). +* +* lo_bind->mo_app = lo_app. +* lo_bind->mr_data = REF #( lo_app->mo_app->ms_struc-input ). +* lo_bind->mv_type = z2ui5_cl_fw_binding=>cs_bind_type-one_way. +* +* DATA(ls_attri) = VALUE z2ui5_cl_fw_binding=>ty_s_attri( name = `MO_APP->MS_STRUC-INPUT` ). +* DATA(lv_result) = lo_bind->bind( REF #( ls_attri ) ). +* +* cl_abap_unit_assert=>assert_equals( +* act = lv_result +* exp = `/MO_APP__MS_STRUC_INPUT` ). +* +* ENDMETHOD. +* +* METHOD test_oref_dref_val. +* +* DATA(lo_app) = NEW ltcl_test_bind( ). +* FIELD-SYMBOLS TYPE any. +* lo_app->mo_app = NEW #( ). +* DATA(lo_bind) = NEW z2ui5_cl_fw_binding( ). +* +* +* CREATE DATA lo_app->mo_app->mr_value TYPE string. +* ASSIGN lo_app->mo_app->mr_value->* TO . +* +* lo_bind->mo_app = lo_app. +* lo_bind->mr_data = REF #( ). +* lo_bind->mv_type = z2ui5_cl_fw_binding=>cs_bind_type-one_way. +* +* DATA(ls_attri) = VALUE z2ui5_cl_fw_binding=>ty_s_attri( name = `MO_APP->MR_VALUE->*` ). +* DATA(lv_result) = lo_bind->bind( REF #( ls_attri ) ). +* +* cl_abap_unit_assert=>assert_equals( +* act = lv_result +* exp = `/MO_APP__MR_VALUE___` ). +* +* ENDMETHOD. +* +* METHOD test_local. +* +* DATA(lo_bind) = NEW z2ui5_cl_fw_binding( ). +* DATA(lv_value) = `test`. +* lo_bind->mr_data = REF #( lv_value ). +* lo_bind->mv_type = z2ui5_cl_fw_binding=>cs_bind_type-one_time. +* +* DATA(lv_result) = lo_bind->bind_local( ). +* +* IF lv_result IS INITIAL. +* cl_abap_unit_assert=>fail( ). +* ENDIF. +* +* ENDMETHOD. +* +*ENDCLASS. +* +*CLASS ltcl_test_main_value DEFINITION FINAL FOR TESTING +* DURATION MEDIUM +* RISK LEVEL DANGEROUS. +* +* PUBLIC SECTION. +* +* DATA mv_value TYPE string. +* +* PROTECTED SECTION. +* PRIVATE SECTION. +* +* METHODS test_one_way FOR TESTING RAISING cx_static_check. +* METHODS test_one_way_t_attri FOR TESTING RAISING cx_static_check. +* METHODS test_one_way_multiple FOR TESTING RAISING cx_static_check. +* METHODS test_two_way FOR TESTING RAISING cx_static_check. +* METHODS test_one_way_two_way_error FOR TESTING RAISING cx_static_check. +* +*ENDCLASS. +* +*CLASS ltcl_test_main_value IMPLEMENTATION. +* +* METHOD test_one_way. +* +* DATA(lo_app) = NEW ltcl_test_main_value( ). +* lo_app->mv_value = `my value`. +* +* DATA(lt_attri) = VALUE z2ui5_cl_fw_binding=>ty_t_attri( ). +* +* DATA(lo_bind) = z2ui5_cl_fw_binding=>factory( +* app = lo_app +* attri = lt_attri +* type = z2ui5_cl_fw_binding=>cs_bind_type-one_way +* data = lo_app->mv_value ). +* +* DATA(lv_result) = lo_bind->main( ). +* +* cl_abap_unit_assert=>assert_equals( +* act = lv_result +* exp = `/MV_VALUE` ). +* +* ENDMETHOD. +* +* METHOD test_two_way. +* +* DATA(lo_app) = NEW ltcl_test_main_value( ). +* lo_app->mv_value = `my value`. +* +* DATA(lt_attri) = VALUE z2ui5_cl_fw_binding=>ty_t_attri( ). +* +* DATA(lo_bind) = z2ui5_cl_fw_binding=>factory( +* app = lo_app +* attri = lt_attri +* type = z2ui5_cl_fw_binding=>cs_bind_type-two_way +* data = lo_app->mv_value ). +* +* DATA(lv_result) = lo_bind->main( ). +* +* cl_abap_unit_assert=>assert_equals( +* act = lv_result +* exp = `/` && z2ui5_cl_fw_binding=>cv_model_edit_name && `/MV_VALUE` ). +* +* ENDMETHOD. +* +* METHOD test_one_way_t_attri. +* +* DATA(lo_app) = NEW ltcl_test_main_value( ). +* lo_app->mv_value = `my value`. +* +* DATA(lt_attri) = VALUE z2ui5_cl_fw_binding=>ty_t_attri( ). +* +* DATA(lo_bind) = z2ui5_cl_fw_binding=>factory( +* app = lo_app +* attri = lt_attri +* type = z2ui5_cl_fw_binding=>cs_bind_type-one_way +* data = lo_app->mv_value ). +* +* lo_bind->main( ). +* +* DATA(ls_attri) = lo_bind->mt_attri[ name = `MV_VALUE` bind_type = z2ui5_cl_fw_binding=>cs_bind_type-one_way ] ##NEEDED. +* +* ENDMETHOD. +* +* METHOD test_one_way_multiple. +* +* DATA(lo_app) = NEW ltcl_test_main_value( ). +* lo_app->mv_value = `my value`. +* +* DATA(lt_attri) = VALUE z2ui5_cl_fw_binding=>ty_t_attri( ). +* +* DATA(lo_bind) = z2ui5_cl_fw_binding=>factory( +* app = lo_app +* attri = lt_attri +* type = z2ui5_cl_fw_binding=>cs_bind_type-two_way +* data = lo_app->mv_value ). +* +* DATA(lv_result) = lo_bind->main( ). +* +* DATA(lo_bind2) = z2ui5_cl_fw_binding=>factory( +* app = lo_app +* attri = lt_attri +* type = z2ui5_cl_fw_binding=>cs_bind_type-two_way +* data = lo_app->mv_value ). +* +* DATA(lv_result2) = lo_bind2->main( ). +* +* cl_abap_unit_assert=>assert_equals( +* act = lv_result +* exp = lv_result2 ). +* +* ENDMETHOD. +* +* METHOD test_one_way_two_way_error. +* +* DATA(lo_app) = NEW ltcl_test_main_value( ). +* lo_app->mv_value = `my value`. +* +* DATA(lt_attri) = VALUE z2ui5_cl_fw_binding=>ty_t_attri( ). +* +* DATA(lo_bind) = z2ui5_cl_fw_binding=>factory( +* app = lo_app +* attri = lt_attri +* type = z2ui5_cl_fw_binding=>cs_bind_type-one_way +* data = lo_app->mv_value ). +* +* lo_bind->main( ). +* +* DATA(lo_bind2) = z2ui5_cl_fw_binding=>factory( +* app = lo_app +* attri = lo_bind->mt_attri +* type = z2ui5_cl_fw_binding=>cs_bind_type-two_way +* data = lo_app->mv_value ). +* +* TRY. +* +* lo_bind2->main( ). +* cl_abap_unit_assert=>fail( ). +* +* CATCH cx_root. +* ENDTRY. +* +* ENDMETHOD. +* +*ENDCLASS. +* +*CLASS ltcl_test_main_structure DEFINITION FINAL FOR TESTING +* DURATION MEDIUM +* RISK LEVEL DANGEROUS. +* +* PUBLIC SECTION. +* +* TYPES: +* BEGIN OF s_01, +* input TYPE string, +* BEGIN OF s_02, +* input TYPE string, +* BEGIN OF s_03, +* input TYPE string, +* BEGIN OF s_04, +* input TYPE string, +* END OF s_04, +* END OF s_03, +* END OF s_02, +* END OF s_01. +* +* DATA ms_struc TYPE s_01. +* +* PRIVATE SECTION. +* +* METHODS test_one_way_lev1 FOR TESTING RAISING cx_static_check. +* METHODS test_one_way_lev2 FOR TESTING RAISING cx_static_check. +* METHODS test_one_way_lev3 FOR TESTING RAISING cx_static_check. +* +* METHODS test_one_way_lev4_long_name FOR TESTING RAISING cx_static_check. +* +* +*ENDCLASS. +* +*CLASS ltcl_test_main_structure IMPLEMENTATION. +* +* METHOD test_one_way_lev1. +* +* DATA(lo_app) = NEW ltcl_test_main_structure( ). +* lo_app->ms_struc-input = `my value`. +* +* DATA(lt_attri) = VALUE z2ui5_cl_fw_binding=>ty_t_attri( ). +* +* DATA(lo_bind) = z2ui5_cl_fw_binding=>factory( +* app = lo_app +* attri = lt_attri +* type = z2ui5_cl_fw_binding=>cs_bind_type-one_way +* data = lo_app->ms_struc-input ). +* +* DATA(lv_result) = lo_bind->main( ). +* +* cl_abap_unit_assert=>assert_equals( +* act = lv_result +* exp = `/MS_STRUC_INPUT` ). +* +* ENDMETHOD. +* +* METHOD test_one_way_lev2. +* +* DATA(lo_app) = NEW ltcl_test_main_structure( ). +* lo_app->ms_struc-s_02-input = `my value`. +* +* DATA(lt_attri) = VALUE z2ui5_cl_fw_binding=>ty_t_attri( ). +* +* DATA(lo_bind) = z2ui5_cl_fw_binding=>factory( +* app = lo_app +* attri = lt_attri +* type = z2ui5_cl_fw_binding=>cs_bind_type-one_way +* data = lo_app->ms_struc-s_02-input ). +* +* DATA(lv_result) = lo_bind->main( ). +* +* cl_abap_unit_assert=>assert_equals( +* act = lv_result +* exp = `/MS_STRUC_S_02_INPUT` ). +* +* ENDMETHOD. +* +* METHOD test_one_way_lev3. +* +* DATA(lo_app) = NEW ltcl_test_main_structure( ). +* lo_app->ms_struc-s_02-s_03-input = `my value`. +* +* DATA(lt_attri) = VALUE z2ui5_cl_fw_binding=>ty_t_attri( ). +* +* DATA(lo_bind) = z2ui5_cl_fw_binding=>factory( +* app = lo_app +* attri = lt_attri +* type = z2ui5_cl_fw_binding=>cs_bind_type-one_way +* data = lo_app->ms_struc-s_02-s_03-input ). +* +* DATA(lv_result) = lo_bind->main( ). +* +* cl_abap_unit_assert=>assert_equals( +* act = lv_result +* exp = `/MS_STRUC_S_02_S_03_INPUT` ). +* +* ENDMETHOD. +* +* METHOD test_one_way_lev4_long_name. +* +* DATA(lo_app) = NEW ltcl_test_main_structure( ). +* lo_app->ms_struc-s_02-s_03-s_04-input = `my value`. +* +* DATA(lt_attri) = VALUE z2ui5_cl_fw_binding=>ty_t_attri( ). +* +* DATA(lo_bind) = z2ui5_cl_fw_binding=>factory( +* app = lo_app +* attri = lt_attri +* type = z2ui5_cl_fw_binding=>cs_bind_type-one_way +* data = lo_app->ms_struc-s_02-s_03-s_04-input ). +* +* DATA(lv_result) = lo_bind->main( ). +* +* DATA(ls_attri) = lo_bind->mt_attri[ name = `MS_STRUC-S_02-S_03-S_04-INPUT` bind_type = z2ui5_cl_fw_binding=>cs_bind_type-one_way ]. +* +* cl_abap_unit_assert=>assert_equals( +* act = lv_result +* exp = `/` && ls_attri-name_front ). +* +* ENDMETHOD. +* +*ENDCLASS. +* +*CLASS ltcl_test_main_data_ref DEFINITION FINAL FOR TESTING +* DURATION MEDIUM +* RISK LEVEL DANGEROUS. +* +* PUBLIC SECTION. +* +* +* +* DATA mr_value TYPE REF TO data ##NEEDED. +* DATA mr_struc TYPE REF TO data ##NEEDED. +* +* PRIVATE SECTION. +* +* METHODS test_one_way_value FOR TESTING RAISING cx_static_check. +* METHODS test_one_way_struc FOR TESTING RAISING cx_static_check. +* +* +*ENDCLASS. +* +*CLASS ltcl_test_main_data_ref IMPLEMENTATION. +* +* METHOD test_one_way_value. +* +* +* +* ENDMETHOD. +* +* METHOD test_one_way_struc. +* +* +* +* ENDMETHOD. +* +*ENDCLASS. +* +*CLASS ltcl_test_main_object DEFINITION FINAL FOR TESTING +* DURATION MEDIUM +* RISK LEVEL DANGEROUS. +* +* PUBLIC SECTION. +* +* TYPES: +* BEGIN OF ty_s_01, +* input TYPE string, +* input_02 TYPE string, +* input_03 TYPE string, +* END OF ty_s_01. +* +* DATA mv_value TYPE string. +* DATA ms_struc TYPE ty_s_01. +* +* DATA mo_obj TYPE REF TO ltcl_test_main_object. +* +* PRIVATE SECTION. +* +* METHODS test_one_way_value FOR TESTING RAISING cx_static_check. +* METHODS test_one_way_struc FOR TESTING RAISING cx_static_check. +* +* +*ENDCLASS. +* +*CLASS ltcl_test_main_object IMPLEMENTATION. +* +* METHOD test_one_way_value. +* +* DATA(lo_app) = NEW ltcl_test_main_object( ). +* lo_app->mo_obj = NEW #( ). +* lo_app->mo_obj->mv_value = `my value`. +* +* +* DATA(lt_attri) = VALUE z2ui5_cl_fw_binding=>ty_t_attri( ). +* +* DATA(lo_bind) = z2ui5_cl_fw_binding=>factory( +* app = lo_app +* attri = lt_attri +* type = z2ui5_cl_fw_binding=>cs_bind_type-one_way +* data = lo_app->mo_obj->mv_value ). +* +* DATA(lv_result) = lo_bind->main( ). +* +* cl_abap_unit_assert=>assert_equals( +* act = lv_result +* exp = `/MO_OBJ__MV_VALUE` ). +* +* ENDMETHOD. +* +* METHOD test_one_way_struc. +* +* DATA(lo_app) = NEW ltcl_test_main_object( ). +* lo_app->mo_obj = NEW #( ). +* lo_app->mo_obj->ms_struc-input = `my value`. +* +* DATA(lt_attri) = VALUE z2ui5_cl_fw_binding=>ty_t_attri( ). +* +* DATA(lo_bind) = z2ui5_cl_fw_binding=>factory( +* app = lo_app +* attri = lt_attri +* type = z2ui5_cl_fw_binding=>cs_bind_type-one_way +* data = lo_app->mo_obj->ms_struc-input ). +* +* DATA(lv_result) = lo_bind->main( ). +* +* cl_abap_unit_assert=>assert_equals( +* act = lv_result +* exp = `/MO_OBJ__MS_STRUC_INPUT` ). +* +* ENDMETHOD. +* +*ENDCLASS. +* +*CLASS ltcl_test_main_object_ref_app DEFINITION. +* +* PUBLIC SECTION. +* +* TYPES: +* BEGIN OF ty_s_01, +* input TYPE string, +* input_02 TYPE string, +* input_03 TYPE string, +* END OF ty_s_01. +* TYPES ty_t_01 TYPE STANDARD TABLE OF ty_s_01 WITH EMPTY KEY ##NEEDED. +* +* DATA mr_value TYPE REF TO data ##NEEDED. +* DATA mr_struc TYPE REF TO data ##NEEDED. +* DATA mr_tab TYPE REF TO data ##NEEDED. +* +* PRIVATE SECTION. +* +*ENDCLASS. +* +*CLASS ltcl_test_main_object_ref DEFINITION FINAL FOR TESTING +* DURATION MEDIUM +* RISK LEVEL DANGEROUS. +* +* PUBLIC SECTION. +* +* DATA mo_obj TYPE REF TO ltcl_test_main_object_ref_app ##NEEDED. +* +* PRIVATE SECTION. +* +* METHODS test_one_way_value FOR TESTING RAISING cx_static_check. +* METHODS test_one_way_struc FOR TESTING RAISING cx_static_check. +* METHODS test_one_way_tab FOR TESTING RAISING cx_static_check. +* +*ENDCLASS. +* +*CLASS ltcl_test_main_object_ref IMPLEMENTATION. +* +* METHOD test_one_way_value. +* +* +* +* ENDMETHOD. +* +* METHOD test_one_way_struc. +* +* +* +* ENDMETHOD. +* +* METHOD test_one_way_tab. +* +* +* +* ENDMETHOD. +* +*ENDCLASS. diff --git a/src/01/02/z2ui5_cl_fw_model.clas.testclasses.abap b/src/01/02/z2ui5_cl_fw_model.clas.testclasses.abap index b706b39a..3d371a80 100644 --- a/src/01/02/z2ui5_cl_fw_model.clas.testclasses.abap +++ b/src/01/02/z2ui5_cl_fw_model.clas.testclasses.abap @@ -1,69 +1,69 @@ -CLASS ltcl_unit_test DEFINITION FINAL FOR TESTING - DURATION LONG - RISK LEVEL DANGEROUS. - - PUBLIC SECTION. - DATA quantity TYPE string. - - PRIVATE SECTION. - METHODS test_model_set_frontend FOR TESTING RAISING cx_static_check. - METHODS test_model_set_backend FOR TESTING RAISING cx_static_check. - -ENDCLASS. - - -CLASS ltcl_unit_test IMPLEMENTATION. - - METHOD test_model_set_frontend. - - DATA(lt_attri) = VALUE z2ui5_cl_fw_binding=>ty_t_attri( ( name = `QUANTITY` bind_type = z2ui5_cl_fw_binding=>cs_bind_type-two_way name_front = `QUANTITY` ) ). - DATA(lo_app) = NEW ltcl_unit_test( ). - - lo_app->quantity = `600`. - - DATA(lo_model) = z2ui5_cl_fw_model=>factory( - viewname = `` - app = lo_app - attri = lt_attri ). - - DATA(lv_frontend) = lo_model->main_set_frontend( ). - - cl_abap_unit_assert=>assert_equals( - act = lv_frontend - exp = `{"EDIT":{"QUANTITY":"600"}}` ). - - ENDMETHOD. - - METHOD test_model_set_backend. - - DATA(lt_attri) = VALUE z2ui5_cl_fw_binding=>ty_t_attri( ( name = `QUANTITY` bind_type = z2ui5_cl_fw_binding=>cs_bind_type-two_way name_front = `QUANTITY` ) ). - DATA(lo_app) = NEW ltcl_unit_test( ). - - DATA(lv_model) = `{"EDIT":{"QUANTITY":"600"},"oScroll":[],"OMESSAGEMANAGER":[],"ID":"0242B09497911EDE90A60CD0D8519DD5","ARGUMENTS":[{"EVENT":"BUTTON_POST","METHOD":"UPDATE","CHECK_VIEW_DESTROY":false}],"OCURSOR":{"id":"__button1"},"OLOCATION":{` - && `"SEARCH":"?sap-client=001&app_start=z2ui5_cl_app_hello_world","VERSION":"com.sap.ui5.dist:sapui5-sdk-dist:1.116.0:war"}}`. - - DATA lr_model TYPE REF TO data. - FIELD-SYMBOLS TYPE any. - /ui2/cl_json=>deserialize( - EXPORTING - json = lv_model - CHANGING - data = lr_model ). - - DATA(lo_model) = z2ui5_cl_fw_model=>factory( - viewname = `` - app = lo_app - attri = lt_attri ). - - DATA(lv_assign) = `LR_MODEL->` && z2ui5_cl_fw_binding=>cv_model_edit_name. - - ASSIGN (lv_assign) TO . - lo_model->main_set_backend( ). - - cl_abap_unit_assert=>assert_equals( - act = lo_app->quantity - exp = `600` ). - - ENDMETHOD. - -ENDCLASS. +*CLASS ltcl_unit_test DEFINITION FINAL FOR TESTING +* DURATION LONG +* RISK LEVEL DANGEROUS. +* +* PUBLIC SECTION. +* DATA quantity TYPE string. +* +* PRIVATE SECTION. +* METHODS test_model_set_frontend FOR TESTING RAISING cx_static_check. +* METHODS test_model_set_backend FOR TESTING RAISING cx_static_check. +* +*ENDCLASS. +* +* +*CLASS ltcl_unit_test IMPLEMENTATION. +* +* METHOD test_model_set_frontend. +* +* DATA(lt_attri) = VALUE z2ui5_cl_fw_binding=>ty_t_attri( ( name = `QUANTITY` bind_type = z2ui5_cl_fw_binding=>cs_bind_type-two_way name_front = `QUANTITY` ) ). +* DATA(lo_app) = NEW ltcl_unit_test( ). +* +* lo_app->quantity = `600`. +* +* DATA(lo_model) = z2ui5_cl_fw_model=>factory( +* viewname = `` +* app = lo_app +* attri = lt_attri ). +* +* DATA(lv_frontend) = lo_model->main_set_frontend( ). +* +* cl_abap_unit_assert=>assert_equals( +* act = lv_frontend +* exp = `{"EDIT":{"QUANTITY":"600"}}` ). +* +* ENDMETHOD. +* +* METHOD test_model_set_backend. +* +* DATA(lt_attri) = VALUE z2ui5_cl_fw_binding=>ty_t_attri( ( name = `QUANTITY` bind_type = z2ui5_cl_fw_binding=>cs_bind_type-two_way name_front = `QUANTITY` ) ). +* DATA(lo_app) = NEW ltcl_unit_test( ). +* +* DATA(lv_model) = `{"EDIT":{"QUANTITY":"600"},"oScroll":[],"OMESSAGEMANAGER":[],"ID":"0242B09497911EDE90A60CD0D8519DD5","ARGUMENTS":[{"EVENT":"BUTTON_POST","METHOD":"UPDATE","CHECK_VIEW_DESTROY":false}],"OCURSOR":{"id":"__button1"},"OLOCATION":{` +* && `"SEARCH":"?sap-client=001&app_start=z2ui5_cl_app_hello_world","VERSION":"com.sap.ui5.dist:sapui5-sdk-dist:1.116.0:war"}}`. +* +* DATA lr_model TYPE REF TO data. +* FIELD-SYMBOLS TYPE any. +* /ui2/cl_json=>deserialize( +* EXPORTING +* json = lv_model +* CHANGING +* data = lr_model ). +* +* DATA(lo_model) = z2ui5_cl_fw_model=>factory( +* viewname = `` +* app = lo_app +* attri = lt_attri ). +* +* DATA(lv_assign) = `LR_MODEL->` && z2ui5_cl_fw_binding=>cv_model_edit_name. +* +* ASSIGN (lv_assign) TO . +* lo_model->main_set_backend( ). +* +* cl_abap_unit_assert=>assert_equals( +* act = lo_app->quantity +* exp = `600` ). +* +* ENDMETHOD. +* +*ENDCLASS. diff --git a/src/02/z2ui5_cl_fw_http_handler.clas.abap b/src/02/z2ui5_cl_fw_http_handler.clas.abap index 0c30f359..95105abd 100644 --- a/src/02/z2ui5_cl_fw_http_handler.clas.abap +++ b/src/02/z2ui5_cl_fw_http_handler.clas.abap @@ -7,7 +7,7 @@ CLASS z2ui5_cl_fw_http_handler DEFINITION CLASS-METHODS http_post IMPORTING body TYPE string - check_old_json TYPE abap_bool DEFAULT abap_true + check_old_json TYPE abap_bool DEFAULT abap_false RETURNING VALUE(result) TYPE string. diff --git a/src/02/z2ui5_if_app.intf.abap b/src/02/z2ui5_if_app.intf.abap index a3de9459..571e0e78 100644 --- a/src/02/z2ui5_if_app.intf.abap +++ b/src/02/z2ui5_if_app.intf.abap @@ -1,7 +1,7 @@ INTERFACE z2ui5_if_app PUBLIC. INTERFACES if_serializable_object. - CONSTANTS version TYPE string VALUE '1.117.0'. + CONSTANTS version TYPE string VALUE '1.118.0'. CONSTANTS origin TYPE string VALUE 'https://github.com/abap2UI5/abap2UI5'. CONSTANTS license TYPE string VALUE 'MIT'.