diff --git a/src/z_generate_json_schema.prog.abap b/src/z_generate_json_schema.prog.abap index 8dceec2f..85eb4e50 100644 --- a/src/z_generate_json_schema.prog.abap +++ b/src/z_generate_json_schema.prog.abap @@ -59,7 +59,7 @@ CLASS lcl_generator_helper IMPLEMENTATION. ENDIF. DATA(generator) = NEW zcl_aff_generator( writer ). - DATA(result_table) = generator->generate_type( ). + DATA(result_table) = generator->zif_aff_generator~generate_type( ). CONCATENATE LINES OF result_table INTO result SEPARATED BY cl_abap_char_utilities=>newline. ENDMETHOD. diff --git a/src/z_generate_repo.prog.abap b/src/z_generate_repo.prog.abap index 389d3263..fe95340d 100644 --- a/src/z_generate_repo.prog.abap +++ b/src/z_generate_repo.prog.abap @@ -31,11 +31,11 @@ CLASS lcl_generator_helper IMPLEMENTATION. ENDMETHOD. METHOD lif_generator~generate_type. - result = me->generator->generate_type( data ). + result = me->generator->zif_aff_generator~generate_type( data ). ENDMETHOD. METHOD lif_generator~get_log. - log = me->generator->get_log( ). + log = me->generator->zif_aff_generator~get_log( ). ENDMETHOD. ENDCLASS. @@ -266,8 +266,8 @@ CLASS lcl_generator IMPLEMENTATION. IF NOT intf_name CP `z*`. INSERT VALUE #( to_be_replaced = intf_name replace_with = get_objname_wo_namspace_with_z( to_lower( ) ) ) INTO TABLE replacing_table_string. IF intf_name CP `*/*`. - REPLACE FIRST OCCURRENCE OF '/' IN intf_name WITH'('. - REPLACE FIRST OCCURRENCE OF '/' IN intf_name WITH')'. + REPLACE FIRST OCCURRENCE OF '/' IN intf_name WITH '('. + REPLACE FIRST OCCURRENCE OF '/' IN intf_name WITH ')'. INSERT VALUE #( to_be_replaced = intf_name replace_with = get_objname_wo_namspace_with_z( to_lower( ) ) ) INTO TABLE replacing_table_string. ENDIF. ENDIF. diff --git a/src/zcl_aff_abap_doc_parser.clas.testclasses.abap b/src/zcl_aff_abap_doc_parser.clas.testclasses.abap index 4a4d9951..a1585a6f 100644 --- a/src/zcl_aff_abap_doc_parser.clas.testclasses.abap +++ b/src/zcl_aff_abap_doc_parser.clas.testclasses.abap @@ -58,7 +58,7 @@ CLASS ltcl_aff_abap_doc_parser IMPLEMENTATION. to_parse = abap_doc_to_parse CHANGING log = log ). - exp_abap_doc = VALUE #( description = `This is the description.` title = `Title`). + exp_abap_doc = VALUE #( description = `This is the description.` title = `Title` ). cl_abap_unit_assert=>assert_equals( exp = exp_abap_doc act = act_abap_doc ). zcl_aff_tools_unit_test_helper=>assert_log_has_no_message( log = log message_severity_threshold = zif_aff_log=>c_message_type-info ). ENDMETHOD. @@ -72,7 +72,7 @@ CLASS ltcl_aff_abap_doc_parser IMPLEMENTATION. to_parse = abap_doc_to_parse CHANGING log = log ). - exp_abap_doc = VALUE #( description = `This is the description.` title = `Title` minimum = `12` default = `"20"`). + exp_abap_doc = VALUE #( description = `This is the description.` title = `Title` minimum = `12` default = `"20"` ). cl_abap_unit_assert=>assert_equals( exp = exp_abap_doc act = act_abap_doc ). zcl_aff_tools_unit_test_helper=>assert_log_has_no_message( log = log message_severity_threshold = zif_aff_log=>c_message_type-info ). ENDMETHOD. @@ -509,7 +509,7 @@ CLASS ltcl_aff_abap_doc_parser IMPLEMENTATION. to_parse = abap_doc_to_parse CHANGING log = log ). - exp_abap_doc = VALUE #( title = `Title` minimum = `12` default = `"20"`). + exp_abap_doc = VALUE #( title = `Title` minimum = `12` default = `"20"` ). cl_abap_unit_assert=>assert_equals( exp = exp_abap_doc act = act_abap_doc ). zcl_aff_tools_unit_test_helper=>assert_log_contains_text( log = log exp_text = zif_aff_log=>co_msg115 @@ -525,7 +525,7 @@ CLASS ltcl_aff_abap_doc_parser IMPLEMENTATION. to_parse = abap_doc_to_parse CHANGING log = log ). - exp_abap_doc = VALUE #( description = `Here is text between annotation` title = `Title` required = abap_true default = `@link cl_aff_test_types_for_writer.data:enum_values.classic_badi`). + exp_abap_doc = VALUE #( description = `Here is text between annotation` title = `Title` required = abap_true default = `@link cl_aff_test_types_for_writer.data:enum_values.classic_badi` ). cl_abap_unit_assert=>assert_equals( exp = exp_abap_doc act = act_abap_doc ). zcl_aff_tools_unit_test_helper=>assert_log_contains_text( log = log exp_text = zif_aff_log=>co_msg116 diff --git a/src/zcl_aff_generator.clas.abap b/src/zcl_aff_generator.clas.abap index c5dd36d3..b46d2691 100644 --- a/src/zcl_aff_generator.clas.abap +++ b/src/zcl_aff_generator.clas.abap @@ -4,22 +4,11 @@ CLASS zcl_aff_generator DEFINITION CREATE PUBLIC. PUBLIC SECTION. + INTERFACES zif_aff_generator. METHODS constructor IMPORTING writer TYPE REF TO zif_aff_writer. - METHODS generate_type - IMPORTING - data TYPE data - RETURNING - VALUE(result) TYPE string_table - RAISING - zcx_aff_tools. - - METHODS get_log - RETURNING - VALUE(log) TYPE REF TO zif_aff_log. - PRIVATE SECTION. DATA: writer TYPE REF TO zif_aff_writer, @@ -80,7 +69,7 @@ CLASS zcl_aff_generator IMPLEMENTATION. log = NEW zcl_aff_log( ). ENDMETHOD. - METHOD generate_type. + METHOD zif_aff_generator~generate_type. DATA(type_description) = cl_abap_typedescr=>describe_by_data( data ). check_input( type_description ). process_type_description( type_description ). @@ -187,8 +176,7 @@ CLASS zcl_aff_generator IMPLEMENTATION. node_description = table_description ). ENDMETHOD. - - METHOD get_log. + METHOD zif_aff_generator~get_log. log = me->log. ENDMETHOD. diff --git a/src/zcl_aff_generator.clas.testclasses.abap b/src/zcl_aff_generator.clas.testclasses.abap index dc8cae65..9522bdf4 100644 --- a/src/zcl_aff_generator.clas.testclasses.abap +++ b/src/zcl_aff_generator.clas.testclasses.abap @@ -201,7 +201,7 @@ CLASS ltcl_type_generator DEFINITION FINAL FOR TESTING PRIVATE SECTION. DATA: - cut TYPE REF TO zcl_aff_generator, + cut TYPE REF TO zif_aff_generator, exp_result TYPE string_table. METHODS: @@ -222,8 +222,8 @@ CLASS ltcl_type_generator DEFINITION FINAL FOR TESTING no_header FOR TESTING RAISING cx_static_check, no_format_version FOR TESTING RAISING cx_static_check, no_structure FOR TESTING RAISING cx_static_check, - structure_on_top_level FOR TESTING RAISING cx_static_check, - table_on_top_level FOR TESTING RAISING cx_static_check, + structure_on_top_level FOR TESTING RAISING cx_static_check, + table_on_top_level FOR TESTING RAISING cx_static_check, setup, assert_output_equals IMPORTING diff --git a/src/zcl_aff_writer_json_schema.clas.testclasses.abap b/src/zcl_aff_writer_json_schema.clas.testclasses.abap index 67e3703d..9ccd9e4d 100644 --- a/src/zcl_aff_writer_json_schema.clas.testclasses.abap +++ b/src/zcl_aff_writer_json_schema.clas.testclasses.abap @@ -8,7 +8,7 @@ CLASS ltcl_json_writer DEFINITION FINAL FOR TESTING DATA: cut TYPE REF TO zcl_aff_writer_json_schema, - test_generator TYPE REF TO zcl_aff_generator. + test_generator TYPE REF TO zif_aff_generator. METHODS: use_ddic_info_for_element FOR TESTING RAISING cx_static_check, date_time_element FOR TESTING RAISING cx_static_check, @@ -496,7 +496,7 @@ CLASS ltcl_json_writer_abap_doc DEFINITION FINAL FOR TESTING CONSTANTS: schema_id TYPE string VALUE 'schema/id.json'. DATA cut TYPE REF TO zcl_aff_writer_json_schema. - DATA test_generator TYPE REF TO zcl_aff_generator. + DATA test_generator TYPE REF TO zif_aff_generator. DATA log TYPE REF TO zif_aff_log. METHODS setup. diff --git a/src/zcl_aff_writer_xslt.clas.testclasses.abap b/src/zcl_aff_writer_xslt.clas.testclasses.abap index 17d06f9b..053ae6ff 100644 --- a/src/zcl_aff_writer_xslt.clas.testclasses.abap +++ b/src/zcl_aff_writer_xslt.clas.testclasses.abap @@ -79,7 +79,7 @@ CLASS ltcl_type_writer_xslt DEFINITION FINAL FOR TESTING DATA: exp_transformation TYPE string_table, cut TYPE REF TO zcl_aff_writer_xslt, - test_generator TYPE REF TO zcl_aff_generator, + test_generator TYPE REF TO zif_aff_generator, st_root_name TYPE string VALUE 'root' ##NO_TEXT. METHODS: structure_with_incl FOR TESTING RAISING cx_static_check, @@ -515,30 +515,30 @@ CLASS ltcl_type_writer_xslt IMPLEMENTATION. DATA transformation TYPE string_table. DATA(log) = NEW zcl_aff_log( ). transformation = VALUE #( - ( `` ) - ( `` ) - ( `` ) - ( `` ) - ( `` ) - ( `` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( `` ) - ( `` ) - ( `` ) - ( `` ) ). + ( `` ) + ( `` ) + ( `` ) + ( `` ) + ( `` ) + ( `` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( `` ) + ( `` ) + ( `` ) + ( `` ) ). DATA(is_valid) = cut->zif_aff_writer~validate( source = transformation log = log ). @@ -550,30 +550,30 @@ CLASS ltcl_type_writer_xslt IMPLEMENTATION. DATA transformation TYPE string_table. DATA(log) = NEW zcl_aff_log( ). transformation = VALUE #( - ( `` ) - ( `` ) - ( `` ) - ( `` ) - ( `` ) - ( `` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( `` ) - ( `` ) - ( `` ) - ( `` ) ). + ( `` ) + ( `` ) + ( `` ) + ( `` ) + ( `` ) + ( `` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( `` ) + ( `` ) + ( `` ) + ( `` ) ). DATA(is_valid) = cut->zif_aff_writer~validate( source = transformation log = log ). @@ -683,7 +683,7 @@ CLASS ltcl_integration_test IMPLEMENTATION. DATA(cut) = NEW zcl_aff_writer_xslt( 'root' ). DATA(test_generator) = NEW zcl_aff_generator( cut ). - DATA(st_content) = test_generator->generate_type( test_type ). + DATA(st_content) = test_generator->zif_aff_generator~generate_type( test_type ). DATA(st_name) = CONV progname( c_xslt_prefix && st_execution_counter ). st_name = |{ st_name WIDTH = 30 PAD = '=' }{ c_ext_xslt_source }|. @@ -776,10 +776,10 @@ CLASS ltcl_integration_test IMPLEMENTATION. METHOD include_table. DATA test_type TYPE lif_test_types=>include_table. test_type = VALUE #( - table = VALUE #( - ( element_1 = 1 element_2 = 'obj1_element_2_value' ) - ( element_1 = 2 element_2 = 'obj2_element_2_value' ) - ) + table = VALUE #( + ( element_1 = 1 element_2 = 'obj1_element_2_value' ) + ( element_1 = 2 element_2 = 'obj2_element_2_value' ) + ) include_element_1 = 1 ). from_abap_to_json( @@ -1135,7 +1135,7 @@ CLASS ltcl_type_writer_xslt_ad DEFINITION FINAL FOR TESTING DATA: exp_transformation TYPE string_table, cut TYPE REF TO zcl_aff_writer_xslt, - test_generator TYPE REF TO zcl_aff_generator, + test_generator TYPE REF TO zif_aff_generator, st_root_name TYPE string VALUE 'root' ##NO_TEXT, log TYPE REF TO zif_aff_log. @@ -1225,7 +1225,7 @@ CLASS ltcl_type_writer_xslt_ad IMPLEMENTATION. DATA(act_output) = test_generator->generate_type( test_type ). me->exp_transformation = VALUE #( - ( `` ) + ( `` ) ( ` ` ) ( ` ` ) ( ` ` ) @@ -1376,14 +1376,14 @@ CLASS ltcl_type_writer_xslt_ad IMPLEMENTATION. DATA(act_output) = test_generator->generate_type( test_type ). me->exp_transformation = VALUE #( -( `` ) -( ` ` ) -( ` ` ) -( ` ` ) -( `` ) ). + ( `` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( `` ) ). validate_output( act = act_output no_log_check = abap_true ). log = cut->zif_aff_writer~get_log( ). zcl_aff_tools_unit_test_helper=>assert_log_contains_text( @@ -1448,92 +1448,92 @@ CLASS ltcl_type_writer_xslt_ad IMPLEMENTATION. DATA test_type TYPE zcl_aff_test_types=>ty_class_properties. DATA(act_output) = test_generator->generate_type( test_type ). me->exp_transformation = VALUE #( -( `` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` <_ tt:lax="on">` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` <__/>` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` <_ tt:lax="on">` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` <__/>` ) -( ` ` ) -( ` ` ) -( ` ` ) -( `` ) ). + ( `` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` <_ tt:lax="on">` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` <__/>` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` <_ tt:lax="on">` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` <__/>` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( `` ) ). validate_output( act = act_output ). ENDMETHOD. @@ -1766,139 +1766,140 @@ CLASS ltcl_type_writer_xslt_ad IMPLEMENTATION. DATA test_type TYPE zcl_aff_test_types=>structure_different_default. DATA(act_output) = test_generator->generate_type( test_type ). me->exp_transformation = VALUE #( -( `` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` <_ tt:lax="on">` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` <__/>` ) -( ` ` ) -( ` ` ) -( ` ` ) -( `` ) ). + ( `` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` <_ tt:lax="on">` ) + ( ` ` ) + ( +` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` <__/>` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( `` ) ). validate_output( act = act_output no_log_check = abap_true ). log = cut->zif_aff_writer~get_log( ). @@ -1913,145 +1914,64 @@ CLASS ltcl_type_writer_xslt_ad IMPLEMENTATION. DATA test_type TYPE zcl_aff_test_types=>structure_with_default_problem. DATA(act_output) = test_generator->generate_type( test_type ). me->exp_transformation = VALUE #( -( `` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` <_ tt:lax="on">` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` <__/>` ) -( ` ` ) -( ` ` ) -( ` ` ) -( `` ) ). - validate_output( act = act_output no_log_check = abap_true ). - log = cut->zif_aff_writer~get_log( ). - zcl_aff_tools_unit_test_helper=>assert_log_contains_text( log = log - exp_text = zif_aff_log=>co_msg126 - exp_component_name = `STRUCTURE_WITH_DEFAULT_PROBLEM-INTEGER` - exp_type = zif_aff_log=>c_message_type-warning ). - ENDMETHOD. - - METHOD nested_struc_with_default. - DATA test_type TYPE zcl_aff_test_types=>nested_struc_with_default. - DATA(act_output) = test_generator->generate_type( test_type ). - me->exp_transformation = VALUE #( - ( `` ) + ( `` ) ( ` ` ) - ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) ( ` ` ) ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` <_ tt:lax="on">` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` <__/>` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` <_ tt:lax="on">` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` <__/>` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) ( ` ` ) ( ` ` ) ( ` <_ tt:lax="on">` ) ( ` ` ) - ( ` ` ) + ( ` ` ) ( ` ` ) ( ` ` ) ( ` ` ) @@ -2062,6 +1982,87 @@ CLASS ltcl_type_writer_xslt_ad IMPLEMENTATION. ( ` ` ) ( ` ` ) ( `` ) ). + validate_output( act = act_output no_log_check = abap_true ). + log = cut->zif_aff_writer~get_log( ). + zcl_aff_tools_unit_test_helper=>assert_log_contains_text( log = log + exp_text = zif_aff_log=>co_msg126 + exp_component_name = `STRUCTURE_WITH_DEFAULT_PROBLEM-INTEGER` + exp_type = zif_aff_log=>c_message_type-warning ). + ENDMETHOD. + + METHOD nested_struc_with_default. + DATA test_type TYPE zcl_aff_test_types=>nested_struc_with_default. + DATA(act_output) = test_generator->generate_type( test_type ). + me->exp_transformation = VALUE #( + ( `` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` <_ tt:lax="on">` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` <__/>` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` <_ tt:lax="on">` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` <__/>` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` <_ tt:lax="on">` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` <__/>` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( `` ) ). validate_output( act_output ). ENDMETHOD. @@ -2115,51 +2116,50 @@ CLASS ltcl_type_writer_xslt_ad IMPLEMENTATION. DATA test_type TYPE zcl_aff_test_types=>structure_with_wrong_default. DATA(act_output) = test_generator->generate_type( test_type ). me->exp_transformation = VALUE #( - -( `` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` <_ tt:lax="on">` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` <__/>` ) -( ` ` ) -( ` ` ) -( ` ` ) -( `` ) ). + ( `` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` <_ tt:lax="on">` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` <__/>` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( `` ) ). validate_output( act = act_output no_log_check = abap_true ). log = cut->zif_aff_writer~get_log( ). zcl_aff_tools_unit_test_helper=>assert_log_contains_text( log = log @@ -2176,11 +2176,11 @@ CLASS ltcl_type_writer_xslt_ad IMPLEMENTATION. DATA test_type TYPE zcl_aff_test_types=>simple_callback. DATA(act_output) = test_generator->generate_type( test_type ). DATA(exp_schema) = VALUE string_table( -( ` ` ) -( ` ` ) -( | | ) -( ` ` ) -( ` ` ) ). + ( ` ` ) + ( ` ` ) + ( | | ) + ( ` ` ) + ( ` ` ) ). INSERT LINES OF exp_schema INTO TABLE me->exp_transformation. validate_output( act_output ). ENDMETHOD. @@ -2189,11 +2189,11 @@ CLASS ltcl_type_writer_xslt_ad IMPLEMENTATION. DATA test_type TYPE zcl_aff_test_types=>table_callback. DATA(act_output) = test_generator->generate_type( test_type ). DATA(exp_schema) = VALUE string_table( -( ` ` ) -( ` ` ) -( | | ) -( ` ` ) -( ` ` ) ). + ( ` ` ) + ( ` ` ) + ( | | ) + ( ` ` ) + ( ` ` ) ). INSERT LINES OF exp_schema INTO TABLE me->exp_transformation. validate_output( act_output ). ENDMETHOD. @@ -2202,11 +2202,11 @@ CLASS ltcl_type_writer_xslt_ad IMPLEMENTATION. DATA test_type TYPE zcl_aff_test_types=>table_call_of_table. DATA(act_output) = test_generator->generate_type( test_type ). DATA(exp_schema) = VALUE string_table( -( ` ` ) -( ` ` ) -( | | ) -( ` ` ) -( ` ` ) ). + ( ` ` ) + ( ` ` ) + ( | | ) + ( ` ` ) + ( ` ` ) ). INSERT LINES OF exp_schema INTO TABLE me->exp_transformation. validate_output( act_output ). ENDMETHOD. @@ -2215,11 +2215,11 @@ CLASS ltcl_type_writer_xslt_ad IMPLEMENTATION. DATA test_type TYPE zcl_aff_test_types=>structure_callback. DATA(act_output) = test_generator->generate_type( test_type ). DATA(exp_schema) = VALUE string_table( -( ` ` ) -( ` ` ) -( | | ) -( ` ` ) -( ` ` ) ). + ( ` ` ) + ( ` ` ) + ( | | ) + ( ` ` ) + ( ` ` ) ). INSERT LINES OF exp_schema INTO TABLE me->exp_transformation. validate_output( act_output ). ENDMETHOD. @@ -2286,40 +2286,40 @@ CLASS ltcl_type_writer_xslt_ad IMPLEMENTATION. DATA test_type TYPE zcl_aff_test_types=>struc_in_struc_with_callback. DATA(act_output) = test_generator->generate_type( test_type ). me->exp_transformation = VALUE #( - ( `` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` <_ tt:lax="on">` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( ` <__/>` ) - ( ` ` ) - ( ` ` ) - ( ` ` ) - ( `` ) ). + ( `` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` <_ tt:lax="on">` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` <__/>` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( `` ) ). validate_output( act_output ). ENDMETHOD. @@ -2372,43 +2372,43 @@ CLASS ltcl_type_writer_xslt_ad IMPLEMENTATION. DATA test_type TYPE zcl_aff_test_types=>struc_with_own_enum_values. DATA(act_output) = test_generator->generate_type( test_type ). me->exp_transformation = VALUE #( -( `` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` <_ tt:lax="on">` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` ` ) -( ` <__/>` ) -( ` ` ) -( ` ` ) -( ` ` ) -( `` ) ). + ( `` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` <_ tt:lax="on">` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( ` <__/>` ) + ( ` ` ) + ( ` ` ) + ( ` ` ) + ( `` ) ). validate_output( act_output ). ENDMETHOD. @@ -2544,7 +2544,7 @@ CLASS ltcl_integration_test_ad IMPLEMENTATION. DATA act_data LIKE test_type. exp_json = VALUE #( - ( `{` ) + ( `{` ) ( ` "mySecondElement":5` ) ( `}` ) ). @@ -2586,7 +2586,7 @@ CLASS ltcl_integration_test_ad IMPLEMENTATION. DATA test_type TYPE zcl_aff_test_types=>my_structure3. test_type = VALUE #( nested_struc = VALUE #( my_element = 'Nested Element' ) - my_element = 'Not nested Element' ). + my_element = 'Not nested Element' ). DATA act_data LIKE test_type. exp_json = VALUE #( ( `{` ) @@ -2638,7 +2638,7 @@ CLASS ltcl_integration_test_ad IMPLEMENTATION. DATA test_type TYPE zcl_aff_test_types=>ty_class_properties. test_type = VALUE #( - header = VALUE #( description = 'description of the class' abap_language_version = 5 original_language = 'E' ) + header = VALUE #( description = 'description of the class' abap_language_version = 5 original_language = 'E' ) class_category = '01' ). DATA act_data LIKE test_type. @@ -2665,13 +2665,13 @@ CLASS ltcl_integration_test_ad IMPLEMENTATION. test_type = VALUE #( field2 = 'AA' - list1 = + list1 = VALUE #( element_of_list1 = 50 - list2 = + list2 = VALUE #( - element_of_list2 = 'Deep Nested' + element_of_list2 = 'Deep Nested' + ) ) - ) field3 = 'ZZ' ). DATA act_data LIKE test_type. @@ -2699,9 +2699,9 @@ CLASS ltcl_integration_test_ad IMPLEMENTATION. test_type = VALUE #( inner_struc = VALUE #( - element_of_inner_struc = 50 - inner_table_var = VALUE #( ( `line_1` ) ( `line_2` ) ) ) - field2 = 'ZZ' ). + element_of_inner_struc = 50 + inner_table_var = VALUE #( ( `line_1` ) ( `line_2` ) ) ) + field2 = 'ZZ' ). DATA act_data LIKE test_type. exp_json = VALUE #( @@ -2727,10 +2727,10 @@ CLASS ltcl_integration_test_ad IMPLEMENTATION. DATA test_type TYPE zcl_aff_test_types=>aff_test_type. test_type = VALUE #( - field1 = 25 + field1 = 25 inner_struc = VALUE #( - inner_element = 50 ) - field2 = 'ZZ' ). + inner_element = 50 ) + field2 = 'ZZ' ). DATA act_data LIKE test_type. exp_json = VALUE #( @@ -2783,8 +2783,8 @@ CLASS ltcl_integration_test_ad IMPLEMENTATION. DATA test_type TYPE zcl_aff_test_types=>nested_struc_with_default. DATA act_data LIKE test_type. test_type = VALUE #( outer_component = 12 - middle_struc = VALUE #( middle_component = 'wxyz' - inner_struc = VALUE #( inner_component = 'Inner Component' ) ) ). + middle_struc = VALUE #( middle_component = 'wxyz' + inner_struc = VALUE #( inner_component = 'Inner Component' ) ) ). exp_json = VALUE #( ( `{` ) ( ` "outerComponent":12,` ) @@ -2806,8 +2806,8 @@ CLASS ltcl_integration_test_ad IMPLEMENTATION. DATA test_type TYPE zcl_aff_test_types=>nested_struc_with_default. DATA act_data LIKE test_type. test_type = VALUE #( outer_component = 10 - middle_struc = VALUE #( middle_component = 'abcd' - inner_struc = VALUE #( inner_component = 'Default Value' ) ) ). + middle_struc = VALUE #( middle_component = 'abcd' + inner_struc = VALUE #( inner_component = 'Default Value' ) ) ). exp_json = VALUE #( ( `{` ) ( ` "middleStruc": {` ) @@ -2824,23 +2824,23 @@ CLASS ltcl_integration_test_ad IMPLEMENTATION. METHOD structure_different_default. DATA test_type TYPE zcl_aff_test_types=>structure_different_default. DATA act_data LIKE test_type. - test_type = VALUE #( four_byte_int = 5 - eight_byte_int = 55 - bin_float = '4.3' - byte_like = 'FFFF' - byte_like2 = 'FF00FF' - decimal_float_16 = '25.26' - decimal_float_34 = '123.05' - packed_number = '123.45' - numeric_text = '1067' - character_text = 'abcde' - string_text = 'Default text' - date_field = '19720401' - time_field = '201500' - date_time_field = '9999-12-31T23:59:59.9999999' - bool_true = abap_true - bool_false = abap_false - enum_type = '01' ) ##LITERAL. + test_type = VALUE #( four_byte_int = 5 + eight_byte_int = 55 + bin_float = '4.3' + byte_like = 'FFFF' + byte_like2 = 'FF00FF' + decimal_float_16 = '25.26' + decimal_float_34 = '123.05' + packed_number = '123.45' + numeric_text = '1067' + character_text = 'abcde' + string_text = 'Default text' + date_field = '19720401' + time_field = '201500' + date_time_field = '9999-12-31T23:59:59.9999999' + bool_true = abap_true + bool_false = abap_false + enum_type = '01' ) ##LITERAL. exp_json = VALUE #( ( `{` ) ( `"dateTimeField": "9999-12-31T23:59:59.9999999+00:00"` ) @@ -2855,10 +2855,10 @@ CLASS ltcl_integration_test_ad IMPLEMENTATION. METHOD structure_with_default_problem. DATA test_type TYPE zcl_aff_test_types=>structure_with_default_problem. DATA act_data LIKE test_type. - test_type = VALUE #( integer = 5 - string_element = 'DefaultString' - enum_required = '01' - enum_show_always = '01' ) ##LITERAL. + test_type = VALUE #( integer = 5 + string_element = 'DefaultString' + enum_required = '01' + enum_show_always = '01' ) ##LITERAL. exp_json = VALUE #( ( `{` ) ( `"integer" : 5,` ) @@ -2951,9 +2951,9 @@ CLASS ltcl_integration_test_ad IMPLEMENTATION. DATA element_structure_callback LIKE test_type-element_structure_callback. element_structure_callback = VALUE #( element_name = 5 ). zcl_aff_test_types=>set_expected( element_structure_callback ). - test_type = VALUE #( my_first_element = 'firstElement' + test_type = VALUE #( my_first_element = 'firstElement' element_structure_callback = element_structure_callback - my_third_element = 6 ). + my_third_element = 6 ). exp_json = VALUE #( ( `{` ) ( ` "myFirstElement": "firstElement",` ) @@ -2971,7 +2971,7 @@ CLASS ltcl_integration_test_ad IMPLEMENTATION. METHOD structure_with_elem_callback. DATA test_type TYPE zcl_aff_test_types=>structure_with_elem_callback. - test_type = VALUE #( element_callback = 'My First Element' + test_type = VALUE #( element_callback = 'My First Element' my_second_element = 4 ). zcl_aff_test_types=>set_expected( 'callbackClass was called' ). exp_json = VALUE #( @@ -3097,7 +3097,7 @@ CLASS ltcl_integration_test_ad IMPLEMENTATION. METHOD from_abap_to_json. DATA(cut) = NEW zcl_aff_writer_xslt( 'root' ). DATA(test_generator) = NEW zcl_aff_generator( cut ). - DATA(st_content) = test_generator->generate_type( test_type ). + DATA(st_content) = test_generator->zif_aff_generator~generate_type( test_type ). DATA(st_name) = CONV progname( c_xslt_prefix && st_execution_counter ). st_name = |{ st_name WIDTH = 30 PAD = '=' }XT|. diff --git a/src/zif_aff_generator.intf.abap b/src/zif_aff_generator.intf.abap new file mode 100644 index 00000000..f5c23419 --- /dev/null +++ b/src/zif_aff_generator.intf.abap @@ -0,0 +1,15 @@ +INTERFACE zif_aff_generator + PUBLIC. + METHODS: generate_type + IMPORTING + data TYPE data + RETURNING + VALUE(result) TYPE string_table + RAISING + zcx_aff_tools, + + get_log + RETURNING + VALUE(log) TYPE REF TO zif_aff_log. + +ENDINTERFACE. diff --git a/src/zif_aff_generator.intf.xml b/src/zif_aff_generator.intf.xml new file mode 100644 index 00000000..78459baa --- /dev/null +++ b/src/zif_aff_generator.intf.xml @@ -0,0 +1,15 @@ + + + + + + ZIF_AFF_GENERATOR + E + AFF generator + 2 + 1 + X + + + + diff --git a/test/cl_run.clas.abap b/test/cl_run.clas.abap index 7d8b3eff..07d73a9d 100644 --- a/test/cl_run.clas.abap +++ b/test/cl_run.clas.abap @@ -31,7 +31,7 @@ CLASS cl_run IMPLEMENTATION. EXPORTING writer = writer. - string_tab = generator->generate_type( ref->* ). + string_tab = generator->zif_aff_generator~generate_type( ref->* ). * workaround for transpiler/JS keywords LOOP AT string_tab ASSIGNING .