mirror of
https://github.com/abapGit/abapGit.git
synced 2025-05-02 04:36:49 +08:00
Merge pull request #508 from EduardoCopat/class-intf-refactor
Class intf refactor - Issue #21
This commit is contained in:
commit
d6d44c464e
|
@ -18,8 +18,8 @@ TYPES: ty_file_signatures_tt TYPE STANDARD TABLE OF ty_file_signature WITH DEFAU
|
||||||
TYPES: ty_file_signatures_ts TYPE SORTED TABLE OF ty_file_signature WITH UNIQUE KEY path filename.
|
TYPES: ty_file_signatures_ts TYPE SORTED TABLE OF ty_file_signature WITH UNIQUE KEY path filename.
|
||||||
|
|
||||||
TYPES: BEGIN OF ty_file.
|
TYPES: BEGIN OF ty_file.
|
||||||
INCLUDE TYPE ty_file_signature.
|
INCLUDE TYPE ty_file_signature.
|
||||||
TYPES: data TYPE xstring,
|
TYPES: data TYPE xstring,
|
||||||
END OF ty_file.
|
END OF ty_file.
|
||||||
TYPES: ty_files_tt TYPE STANDARD TABLE OF ty_file WITH DEFAULT KEY.
|
TYPES: ty_files_tt TYPE STANDARD TABLE OF ty_file WITH DEFAULT KEY.
|
||||||
|
|
||||||
|
@ -61,11 +61,11 @@ TYPES: BEGIN OF ty_web_asset,
|
||||||
TYPES tt_web_assets TYPE STANDARD TABLE OF ty_web_asset WITH DEFAULT KEY.
|
TYPES tt_web_assets TYPE STANDARD TABLE OF ty_web_asset WITH DEFAULT KEY.
|
||||||
|
|
||||||
TYPES: BEGIN OF ty_repo_file,
|
TYPES: BEGIN OF ty_repo_file,
|
||||||
path TYPE string,
|
path TYPE string,
|
||||||
filename TYPE string,
|
filename TYPE string,
|
||||||
is_changed TYPE abap_bool,
|
is_changed TYPE abap_bool,
|
||||||
rstate TYPE char1,
|
rstate TYPE char1,
|
||||||
lstate TYPE char1,
|
lstate TYPE char1,
|
||||||
END OF ty_repo_file.
|
END OF ty_repo_file.
|
||||||
TYPES tt_repo_files TYPE STANDARD TABLE OF ty_repo_file WITH DEFAULT KEY.
|
TYPES tt_repo_files TYPE STANDARD TABLE OF ty_repo_file WITH DEFAULT KEY.
|
||||||
|
|
||||||
|
@ -101,19 +101,35 @@ TYPES: BEGIN OF ty_tadir,
|
||||||
TYPES: ty_tadir_tt TYPE STANDARD TABLE OF ty_tadir WITH DEFAULT KEY.
|
TYPES: ty_tadir_tt TYPE STANDARD TABLE OF ty_tadir WITH DEFAULT KEY.
|
||||||
|
|
||||||
TYPES: BEGIN OF ty_result,
|
TYPES: BEGIN OF ty_result,
|
||||||
obj_type TYPE tadir-object,
|
obj_type TYPE tadir-object,
|
||||||
obj_name TYPE tadir-obj_name,
|
obj_name TYPE tadir-obj_name,
|
||||||
path TYPE string,
|
path TYPE string,
|
||||||
filename TYPE string,
|
filename TYPE string,
|
||||||
package TYPE devclass,
|
package TYPE devclass,
|
||||||
match TYPE sap_bool,
|
match TYPE sap_bool,
|
||||||
lstate TYPE char1,
|
lstate TYPE char1,
|
||||||
rstate TYPE char1,
|
rstate TYPE char1,
|
||||||
END OF ty_result.
|
END OF ty_result.
|
||||||
TYPES: ty_results_tt TYPE STANDARD TABLE OF ty_result WITH DEFAULT KEY.
|
TYPES: ty_results_tt TYPE STANDARD TABLE OF ty_result WITH DEFAULT KEY.
|
||||||
|
|
||||||
TYPES: ty_sval_tt TYPE STANDARD TABLE OF sval WITH DEFAULT KEY.
|
TYPES: ty_sval_tt TYPE STANDARD TABLE OF sval WITH DEFAULT KEY.
|
||||||
|
|
||||||
|
TYPES: ty_seocompotx_tt TYPE STANDARD TABLE OF seocompotx WITH DEFAULT KEY.
|
||||||
|
|
||||||
|
TYPES: BEGIN OF ty_tpool.
|
||||||
|
INCLUDE TYPE textpool.
|
||||||
|
TYPES: split TYPE c LENGTH 8.
|
||||||
|
TYPES: END OF ty_tpool.
|
||||||
|
|
||||||
|
TYPES: ty_tpool_tt TYPE STANDARD TABLE OF ty_tpool WITH DEFAULT KEY.
|
||||||
|
|
||||||
|
TYPES: BEGIN OF ty_sotr,
|
||||||
|
header TYPE sotr_head,
|
||||||
|
entries TYPE sotr_text_tt,
|
||||||
|
END OF ty_sotr.
|
||||||
|
|
||||||
|
TYPES: ty_sotr_tt TYPE STANDARD TABLE OF ty_sotr WITH DEFAULT KEY.
|
||||||
|
|
||||||
CONSTANTS: BEGIN OF gc_state, " https://git-scm.com/docs/git-status
|
CONSTANTS: BEGIN OF gc_state, " https://git-scm.com/docs/git-status
|
||||||
unchanged TYPE char1 VALUE '',
|
unchanged TYPE char1 VALUE '',
|
||||||
added TYPE char1 VALUE 'A',
|
added TYPE char1 VALUE 'A',
|
||||||
|
@ -171,43 +187,43 @@ CONSTANTS: BEGIN OF gc_action,
|
||||||
repo_refresh_checksums TYPE string VALUE 'repo_refresh_checksums',
|
repo_refresh_checksums TYPE string VALUE 'repo_refresh_checksums',
|
||||||
repo_toggle_fav TYPE string VALUE 'repo_toggle_fav',
|
repo_toggle_fav TYPE string VALUE 'repo_toggle_fav',
|
||||||
|
|
||||||
abapgit_home TYPE string VALUE 'abapgit_home',
|
abapgit_home TYPE string VALUE 'abapgit_home',
|
||||||
abapgit_wiki TYPE string VALUE 'abapgit_wiki',
|
abapgit_wiki TYPE string VALUE 'abapgit_wiki',
|
||||||
abapgit_install TYPE string VALUE 'abapgit_install',
|
abapgit_install TYPE string VALUE 'abapgit_install',
|
||||||
abapgit_install_pi TYPE string VALUE 'abapgit_install_pi',
|
abapgit_install_pi TYPE string VALUE 'abapgit_install_pi',
|
||||||
|
|
||||||
zip_import TYPE string VALUE 'zip_import',
|
zip_import TYPE string VALUE 'zip_import',
|
||||||
zip_export TYPE string VALUE 'zip_export',
|
zip_export TYPE string VALUE 'zip_export',
|
||||||
zip_package TYPE string VALUE 'zip_package',
|
zip_package TYPE string VALUE 'zip_package',
|
||||||
zip_transport TYPE string VALUE 'zip_transport',
|
zip_transport TYPE string VALUE 'zip_transport',
|
||||||
zip_object TYPE string VALUE 'zip_object',
|
zip_object TYPE string VALUE 'zip_object',
|
||||||
|
|
||||||
git_pull TYPE string VALUE 'git_pull',
|
git_pull TYPE string VALUE 'git_pull',
|
||||||
git_reset TYPE string VALUE 'git_reset',
|
git_reset TYPE string VALUE 'git_reset',
|
||||||
git_branch_create TYPE string VALUE 'git_branch_create',
|
git_branch_create TYPE string VALUE 'git_branch_create',
|
||||||
git_branch_switch TYPE string VALUE 'git_branch_switch',
|
git_branch_switch TYPE string VALUE 'git_branch_switch',
|
||||||
git_branch_delete TYPE string VALUE 'git_branch_delete',
|
git_branch_delete TYPE string VALUE 'git_branch_delete',
|
||||||
git_commit TYPE string VALUE 'git_commit',
|
git_commit TYPE string VALUE 'git_commit',
|
||||||
|
|
||||||
db_delete TYPE string VALUE 'db_delete',
|
db_delete TYPE string VALUE 'db_delete',
|
||||||
db_update TYPE string VALUE 'db_update',
|
db_update TYPE string VALUE 'db_update',
|
||||||
db_display TYPE string VALUE 'db_display',
|
db_display TYPE string VALUE 'db_display',
|
||||||
db_edit TYPE string VALUE 'db_edit',
|
db_edit TYPE string VALUE 'db_edit',
|
||||||
bg_update TYPE string VALUE 'bg_update',
|
bg_update TYPE string VALUE 'bg_update',
|
||||||
|
|
||||||
go_main TYPE string VALUE 'go_main',
|
go_main TYPE string VALUE 'go_main',
|
||||||
go_explore TYPE string VALUE 'go_explore',
|
go_explore TYPE string VALUE 'go_explore',
|
||||||
go_db TYPE string VALUE 'go_db',
|
go_db TYPE string VALUE 'go_db',
|
||||||
go_background TYPE string VALUE 'go_background',
|
go_background TYPE string VALUE 'go_background',
|
||||||
go_background_run TYPE string VALUE 'go_background_run',
|
go_background_run TYPE string VALUE 'go_background_run',
|
||||||
go_diff TYPE string VALUE 'go_diff',
|
go_diff TYPE string VALUE 'go_diff',
|
||||||
go_stage TYPE string VALUE 'go_stage',
|
go_stage TYPE string VALUE 'go_stage',
|
||||||
go_commit TYPE string VALUE 'go_commit',
|
go_commit TYPE string VALUE 'go_commit',
|
||||||
go_branch_overview TYPE string VALUE 'go_branch_overview',
|
go_branch_overview TYPE string VALUE 'go_branch_overview',
|
||||||
go_playground TYPE string VALUE 'go_playground',
|
go_playground TYPE string VALUE 'go_playground',
|
||||||
go_debuginfo TYPE string VALUE 'go_debuginfo',
|
go_debuginfo TYPE string VALUE 'go_debuginfo',
|
||||||
go_settings TYPE STRING VALUE 'go_settings',
|
go_settings TYPE string VALUE 'go_settings',
|
||||||
go_tutorial TYPE STRING VALUE 'go_tutorial',
|
go_tutorial TYPE string VALUE 'go_tutorial',
|
||||||
jump TYPE string VALUE 'jump',
|
jump TYPE string VALUE 'jump',
|
||||||
jump_pkg TYPE string VALUE 'jump_pkg',
|
jump_pkg TYPE string VALUE 'jump_pkg',
|
||||||
END OF gc_action.
|
END OF gc_action.
|
|
@ -7,34 +7,416 @@
|
||||||
*----------------------------------------------------------------------*
|
*----------------------------------------------------------------------*
|
||||||
*
|
*
|
||||||
*----------------------------------------------------------------------*
|
*----------------------------------------------------------------------*
|
||||||
|
INTERFACE lif_object_oriented_object.
|
||||||
|
METHODS:
|
||||||
|
create
|
||||||
|
IMPORTING
|
||||||
|
iv_package TYPE devclass
|
||||||
|
iv_overwrite TYPE seox_boolean DEFAULT seox_true
|
||||||
|
CHANGING
|
||||||
|
is_properties TYPE any
|
||||||
|
RAISING
|
||||||
|
lcx_exception,
|
||||||
|
generate_locals
|
||||||
|
IMPORTING
|
||||||
|
is_key TYPE seoclskey
|
||||||
|
iv_force TYPE seox_boolean DEFAULT seox_true
|
||||||
|
it_local_definitions TYPE seop_source_string OPTIONAL
|
||||||
|
it_local_implementations TYPE seop_source_string OPTIONAL
|
||||||
|
it_local_macros TYPE seop_source_string OPTIONAL
|
||||||
|
it_local_test_classes TYPE seop_source_string OPTIONAL
|
||||||
|
RAISING
|
||||||
|
lcx_exception,
|
||||||
|
deserialize_source
|
||||||
|
IMPORTING
|
||||||
|
is_key TYPE seoclskey
|
||||||
|
it_source TYPE ty_string_tt
|
||||||
|
RAISING
|
||||||
|
lcx_exception
|
||||||
|
cx_sy_dyn_call_error,
|
||||||
|
insert_text_pool
|
||||||
|
IMPORTING
|
||||||
|
iv_class_name TYPE seoclsname
|
||||||
|
it_text_pool TYPE textpool_table
|
||||||
|
iv_language TYPE spras
|
||||||
|
RAISING
|
||||||
|
lcx_exception,
|
||||||
|
update_descriptions
|
||||||
|
IMPORTING
|
||||||
|
is_key TYPE seoclskey
|
||||||
|
it_descriptions TYPE ty_seocompotx_tt,
|
||||||
|
add_to_activation_list
|
||||||
|
IMPORTING
|
||||||
|
is_item TYPE ty_item
|
||||||
|
RAISING
|
||||||
|
lcx_exception,
|
||||||
|
create_sotr
|
||||||
|
IMPORTING
|
||||||
|
iv_package TYPE devclass
|
||||||
|
it_sotr TYPE ty_sotr_tt
|
||||||
|
RAISING
|
||||||
|
lcx_exception,
|
||||||
|
create_documentation
|
||||||
|
IMPORTING
|
||||||
|
it_lines TYPE tlinetab
|
||||||
|
iv_object_name TYPE dokhl-object
|
||||||
|
iv_language TYPE spras
|
||||||
|
RAISING
|
||||||
|
lcx_exception.
|
||||||
|
ENDINTERFACE.
|
||||||
|
|
||||||
|
CLASS lcl_object_oriented_base DEFINITION ABSTRACT.
|
||||||
|
PUBLIC SECTION.
|
||||||
|
INTERFACES: lif_object_oriented_object.
|
||||||
|
PRIVATE SECTION.
|
||||||
|
METHODS deserialize_abap_source_old
|
||||||
|
IMPORTING is_clskey TYPE seoclskey
|
||||||
|
it_source TYPE ty_string_tt
|
||||||
|
RAISING lcx_exception.
|
||||||
|
|
||||||
|
METHODS deserialize_abap_source_new
|
||||||
|
IMPORTING is_clskey TYPE seoclskey
|
||||||
|
it_source TYPE ty_string_tt
|
||||||
|
RAISING lcx_exception
|
||||||
|
cx_sy_dyn_call_error.
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
CLASS lcl_object_oriented_base IMPLEMENTATION.
|
||||||
|
|
||||||
|
METHOD lif_object_oriented_object~create.
|
||||||
|
"Subclass responsibility
|
||||||
|
RETURN.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD lif_object_oriented_object~deserialize_source.
|
||||||
|
TRY.
|
||||||
|
deserialize_abap_source_new(
|
||||||
|
is_clskey = is_key
|
||||||
|
it_source = it_source ).
|
||||||
|
CATCH cx_sy_dyn_call_error.
|
||||||
|
deserialize_abap_source_old(
|
||||||
|
is_clskey = is_key
|
||||||
|
it_source = it_source ).
|
||||||
|
ENDTRY.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD lif_object_oriented_object~generate_locals.
|
||||||
|
"Subclass responsibility
|
||||||
|
RETURN.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD deserialize_abap_source_old.
|
||||||
|
"for backwards compatability down to 702
|
||||||
|
|
||||||
|
DATA: lo_source TYPE REF TO cl_oo_source.
|
||||||
|
|
||||||
|
CREATE OBJECT lo_source
|
||||||
|
EXPORTING
|
||||||
|
clskey = is_clskey
|
||||||
|
EXCEPTIONS
|
||||||
|
class_not_existing = 1
|
||||||
|
OTHERS = 2.
|
||||||
|
IF sy-subrc <> 0.
|
||||||
|
lcx_exception=>raise( 'error from CL_OO_SOURCE' ).
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
TRY.
|
||||||
|
lo_source->access_permission( seok_access_modify ).
|
||||||
|
lo_source->set_source( it_source ).
|
||||||
|
lo_source->save( ).
|
||||||
|
lo_source->access_permission( seok_access_free ).
|
||||||
|
CATCH cx_oo_access_permission.
|
||||||
|
lcx_exception=>raise( 'permission error' ).
|
||||||
|
CATCH cx_oo_source_save_failure.
|
||||||
|
lcx_exception=>raise( 'save failure' ).
|
||||||
|
ENDTRY.
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD deserialize_abap_source_new.
|
||||||
|
DATA: lo_factory TYPE REF TO object,
|
||||||
|
lo_source TYPE REF TO object.
|
||||||
|
|
||||||
|
CALL METHOD ('CL_OO_FACTORY')=>('CREATE_INSTANCE')
|
||||||
|
RECEIVING
|
||||||
|
result = lo_factory.
|
||||||
|
|
||||||
|
CALL METHOD lo_factory->('CREATE_CLIF_SOURCE')
|
||||||
|
EXPORTING
|
||||||
|
clif_name = is_clskey-clsname
|
||||||
|
RECEIVING
|
||||||
|
result = lo_source.
|
||||||
|
|
||||||
|
TRY.
|
||||||
|
CALL METHOD lo_source->('IF_OO_CLIF_SOURCE~LOCK').
|
||||||
|
CATCH cx_oo_access_permission.
|
||||||
|
lcx_exception=>raise( 'source_new, access permission exception' ).
|
||||||
|
ENDTRY.
|
||||||
|
|
||||||
|
CALL METHOD lo_source->('IF_OO_CLIF_SOURCE~SET_SOURCE')
|
||||||
|
EXPORTING
|
||||||
|
source = it_source.
|
||||||
|
|
||||||
|
CALL METHOD lo_source->('IF_OO_CLIF_SOURCE~SAVE').
|
||||||
|
|
||||||
|
CALL METHOD lo_source->('IF_OO_CLIF_SOURCE~UNLOCK').
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
METHOD lif_object_oriented_object~add_to_activation_list.
|
||||||
|
lcl_objects_activation=>add_item( is_item ).
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD lif_object_oriented_object~update_descriptions.
|
||||||
|
DELETE FROM seocompotx WHERE clsname = is_key-clsname.
|
||||||
|
INSERT seocompotx FROM TABLE it_descriptions.
|
||||||
|
ENDMETHOD.
|
||||||
|
METHOD lif_object_oriented_object~insert_text_pool.
|
||||||
|
"Subclass responsibility
|
||||||
|
RETURN.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD lif_object_oriented_object~create_sotr.
|
||||||
|
"Subclass responsibility
|
||||||
|
RETURN.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD lif_object_oriented_object~create_documentation.
|
||||||
|
CALL FUNCTION 'DOCU_UPD'
|
||||||
|
EXPORTING
|
||||||
|
id = 'CL'
|
||||||
|
langu = iv_language
|
||||||
|
object = iv_object_name
|
||||||
|
TABLES
|
||||||
|
line = it_lines
|
||||||
|
EXCEPTIONS
|
||||||
|
ret_code = 1
|
||||||
|
OTHERS = 2.
|
||||||
|
IF sy-subrc <> 0.
|
||||||
|
lcx_exception=>raise( 'error from DOCU_UPD' ).
|
||||||
|
ENDIF.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
|
||||||
|
CLASS lcl_object_oriented_class DEFINITION
|
||||||
|
INHERITING FROM lcl_object_oriented_base.
|
||||||
|
PUBLIC SECTION.
|
||||||
|
METHODS:
|
||||||
|
lif_object_oriented_object~create REDEFINITION,
|
||||||
|
lif_object_oriented_object~generate_locals REDEFINITION,
|
||||||
|
lif_object_oriented_object~insert_text_pool REDEFINITION,
|
||||||
|
lif_object_oriented_object~create_sotr REDEFINITION.
|
||||||
|
|
||||||
|
ENDCLASS.
|
||||||
|
CLASS lcl_object_oriented_class IMPLEMENTATION.
|
||||||
|
METHOD lif_object_oriented_object~create.
|
||||||
|
CALL FUNCTION 'SEO_CLASS_CREATE_COMPLETE'
|
||||||
|
EXPORTING
|
||||||
|
devclass = iv_package
|
||||||
|
overwrite = iv_overwrite
|
||||||
|
CHANGING
|
||||||
|
class = is_properties
|
||||||
|
EXCEPTIONS
|
||||||
|
existing = 1
|
||||||
|
is_interface = 2
|
||||||
|
db_error = 3
|
||||||
|
component_error = 4
|
||||||
|
no_access = 5
|
||||||
|
other = 6
|
||||||
|
OTHERS = 7.
|
||||||
|
IF sy-subrc <> 0.
|
||||||
|
lcx_exception=>raise( 'error from SEO_CLASS_CREATE_COMPLETE' ).
|
||||||
|
ENDIF.
|
||||||
|
ENDMETHOD.
|
||||||
|
METHOD lif_object_oriented_object~generate_locals.
|
||||||
|
CALL FUNCTION 'SEO_CLASS_GENERATE_LOCALS'
|
||||||
|
EXPORTING
|
||||||
|
clskey = is_key
|
||||||
|
force = iv_force
|
||||||
|
locals_def = it_local_definitions
|
||||||
|
locals_imp = it_local_implementations
|
||||||
|
locals_mac = it_local_macros
|
||||||
|
locals_testclasses = it_local_test_classes
|
||||||
|
EXCEPTIONS
|
||||||
|
not_existing = 1
|
||||||
|
model_only = 2
|
||||||
|
locals_not_generated = 3
|
||||||
|
locals_not_initialised = 4
|
||||||
|
OTHERS = 5.
|
||||||
|
IF sy-subrc <> 0.
|
||||||
|
lcx_exception=>raise( 'error from generate_locals' ).
|
||||||
|
ENDIF.
|
||||||
|
ENDMETHOD.
|
||||||
|
METHOD lif_object_oriented_object~insert_text_pool.
|
||||||
|
DATA: lv_cp TYPE program.
|
||||||
|
|
||||||
|
lv_cp = cl_oo_classname_service=>get_classpool_name( iv_class_name ).
|
||||||
|
|
||||||
|
INSERT TEXTPOOL lv_cp
|
||||||
|
FROM it_text_pool
|
||||||
|
LANGUAGE iv_language
|
||||||
|
STATE 'I'.
|
||||||
|
IF sy-subrc <> 0.
|
||||||
|
lcx_exception=>raise( 'error from INSERT TEXTPOOL' ).
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
lcl_objects_activation=>add( iv_type = 'REPT'
|
||||||
|
iv_name = lv_cp ).
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD lif_object_oriented_object~create_sotr.
|
||||||
|
DATA: lt_sotr TYPE ty_sotr_tt,
|
||||||
|
lt_objects TYPE sotr_objects,
|
||||||
|
ls_paket TYPE sotr_pack,
|
||||||
|
lv_object LIKE LINE OF lt_objects.
|
||||||
|
|
||||||
|
FIELD-SYMBOLS: <ls_sotr> LIKE LINE OF lt_sotr.
|
||||||
|
|
||||||
|
LOOP AT it_sotr ASSIGNING <ls_sotr>.
|
||||||
|
CALL FUNCTION 'SOTR_OBJECT_GET_OBJECTS'
|
||||||
|
EXPORTING
|
||||||
|
object_vector = <ls_sotr>-header-objid_vec
|
||||||
|
IMPORTING
|
||||||
|
objects = lt_objects
|
||||||
|
EXCEPTIONS
|
||||||
|
object_not_found = 1
|
||||||
|
OTHERS = 2.
|
||||||
|
IF sy-subrc <> 0.
|
||||||
|
lcx_exception=>raise( 'error from SOTR_OBJECT_GET_OBJECTS' ).
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
READ TABLE lt_objects INDEX 1 INTO lv_object.
|
||||||
|
ASSERT sy-subrc = 0.
|
||||||
|
|
||||||
|
ls_paket-paket = iv_package.
|
||||||
|
|
||||||
|
CALL FUNCTION 'SOTR_CREATE_CONCEPT'
|
||||||
|
EXPORTING
|
||||||
|
paket = ls_paket
|
||||||
|
crea_lan = <ls_sotr>-header-crea_lan
|
||||||
|
alias_name = <ls_sotr>-header-alias_name
|
||||||
|
object = lv_object
|
||||||
|
entries = <ls_sotr>-entries
|
||||||
|
concept_default = <ls_sotr>-header-concept
|
||||||
|
EXCEPTIONS
|
||||||
|
package_missing = 1
|
||||||
|
crea_lan_missing = 2
|
||||||
|
object_missing = 3
|
||||||
|
paket_does_not_exist = 4
|
||||||
|
alias_already_exist = 5
|
||||||
|
object_type_not_found = 6
|
||||||
|
langu_missing = 7
|
||||||
|
identical_context_not_allowed = 8
|
||||||
|
text_too_long = 9
|
||||||
|
error_in_update = 10
|
||||||
|
no_master_langu = 11
|
||||||
|
error_in_concept_id = 12
|
||||||
|
alias_not_allowed = 13
|
||||||
|
tadir_entry_creation_failed = 14
|
||||||
|
internal_error = 15
|
||||||
|
error_in_correction = 16
|
||||||
|
user_cancelled = 17
|
||||||
|
no_entry_found = 18
|
||||||
|
OTHERS = 19.
|
||||||
|
IF sy-subrc <> 0.
|
||||||
|
lcx_exception=>raise( 'error from SOTR_CREATE_CONCEPT' ).
|
||||||
|
ENDIF.
|
||||||
|
ENDLOOP.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
CLASS lcl_object_oriented_interface DEFINITION
|
||||||
|
INHERITING FROM lcl_object_oriented_base.
|
||||||
|
PUBLIC SECTION.
|
||||||
|
METHODS:
|
||||||
|
lif_object_oriented_object~create REDEFINITION.
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
CLASS lcl_object_oriented_interface IMPLEMENTATION.
|
||||||
|
METHOD lif_object_oriented_object~create.
|
||||||
|
CALL FUNCTION 'SEO_INTERFACE_CREATE_COMPLETE'
|
||||||
|
EXPORTING
|
||||||
|
devclass = iv_package
|
||||||
|
overwrite = iv_overwrite
|
||||||
|
CHANGING
|
||||||
|
interface = is_properties
|
||||||
|
EXCEPTIONS
|
||||||
|
existing = 1
|
||||||
|
is_class = 2
|
||||||
|
db_error = 3
|
||||||
|
component_error = 4
|
||||||
|
no_access = 5
|
||||||
|
other = 6
|
||||||
|
OTHERS = 7.
|
||||||
|
IF sy-subrc <> 0.
|
||||||
|
lcx_exception=>raise( 'Error from SEO_INTERFACE_CREATE_COMPLETE' ).
|
||||||
|
ENDIF.
|
||||||
|
ENDMETHOD.
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
CLASS lth_oo_factory_injector DEFINITION DEFERRED.
|
||||||
|
|
||||||
|
CLASS lcl_object_oriented_factory DEFINITION
|
||||||
|
FRIENDS lth_oo_factory_injector.
|
||||||
|
PUBLIC SECTION.
|
||||||
|
CLASS-METHODS:
|
||||||
|
make
|
||||||
|
IMPORTING
|
||||||
|
iv_object_type TYPE tadir-object
|
||||||
|
RETURNING
|
||||||
|
VALUE(ro_object_oriented_object) TYPE REF TO lif_object_oriented_object.
|
||||||
|
PRIVATE SECTION.
|
||||||
|
CLASS-DATA:
|
||||||
|
go_object_oriented_object TYPE REF TO lif_object_oriented_object.
|
||||||
|
ENDCLASS.
|
||||||
|
CLASS lcl_object_oriented_factory IMPLEMENTATION.
|
||||||
|
METHOD make.
|
||||||
|
IF go_object_oriented_object IS BOUND.
|
||||||
|
ro_object_oriented_object = go_object_oriented_object.
|
||||||
|
RETURN.
|
||||||
|
ENDIF.
|
||||||
|
IF iv_object_type = 'CLAS'.
|
||||||
|
CREATE OBJECT ro_object_oriented_object TYPE lcl_object_oriented_class.
|
||||||
|
ELSEIF iv_object_type = 'INTF'.
|
||||||
|
CREATE OBJECT ro_object_oriented_object TYPE lcl_object_oriented_interface.
|
||||||
|
ENDIF.
|
||||||
|
ENDMETHOD.
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
CLASS lth_oo_factory_injector DEFINITION FOR TESTING.
|
||||||
|
PUBLIC SECTION.
|
||||||
|
CLASS-METHODS:
|
||||||
|
inject
|
||||||
|
IMPORTING
|
||||||
|
io_object_oriented_object TYPE REF TO lif_object_oriented_object.
|
||||||
|
ENDCLASS.
|
||||||
|
CLASS lth_oo_factory_injector IMPLEMENTATION.
|
||||||
|
METHOD inject.
|
||||||
|
lcl_object_oriented_factory=>go_object_oriented_object = io_object_oriented_object.
|
||||||
|
ENDMETHOD.
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
CLASS lcl_object_clas DEFINITION INHERITING FROM lcl_objects_program.
|
CLASS lcl_object_clas DEFINITION INHERITING FROM lcl_objects_program.
|
||||||
|
|
||||||
PUBLIC SECTION.
|
PUBLIC SECTION.
|
||||||
INTERFACES lif_object.
|
INTERFACES lif_object.
|
||||||
ALIASES mo_files FOR lif_object~mo_files.
|
ALIASES mo_files FOR lif_object~mo_files.
|
||||||
|
PROTECTED SECTION.
|
||||||
PRIVATE SECTION.
|
|
||||||
TYPES: BEGIN OF ty_sotr,
|
|
||||||
header TYPE sotr_head,
|
|
||||||
entries TYPE sotr_text_tt,
|
|
||||||
END OF ty_sotr.
|
|
||||||
|
|
||||||
TYPES: ty_sotr_tt TYPE STANDARD TABLE OF ty_sotr WITH DEFAULT KEY.
|
|
||||||
|
|
||||||
TYPES: ty_seocompotx_tt TYPE STANDARD TABLE OF seocompotx WITH DEFAULT KEY.
|
|
||||||
|
|
||||||
DATA mv_skip_testclass TYPE abap_bool.
|
|
||||||
|
|
||||||
METHODS deserialize_abap
|
METHODS deserialize_abap
|
||||||
IMPORTING io_xml TYPE REF TO lcl_xml_input
|
IMPORTING io_xml TYPE REF TO lcl_xml_input
|
||||||
iv_package TYPE devclass
|
iv_package TYPE devclass
|
||||||
RAISING lcx_exception.
|
RAISING lcx_exception.
|
||||||
|
|
||||||
METHODS deserialize_textpool
|
METHODS deserialize_docu
|
||||||
IMPORTING io_xml TYPE REF TO lcl_xml_input
|
IMPORTING io_xml TYPE REF TO lcl_xml_input
|
||||||
RAISING lcx_exception.
|
RAISING lcx_exception.
|
||||||
|
DATA mo_object_oriented_object TYPE REF TO lif_object_oriented_object.
|
||||||
|
PRIVATE SECTION.
|
||||||
|
DATA mv_skip_testclass TYPE abap_bool.
|
||||||
|
|
||||||
METHODS deserialize_docu
|
METHODS deserialize_textpool
|
||||||
IMPORTING io_xml TYPE REF TO lcl_xml_input
|
IMPORTING io_xml TYPE REF TO lcl_xml_input
|
||||||
RAISING lcx_exception.
|
RAISING lcx_exception.
|
||||||
|
|
||||||
|
@ -48,17 +430,6 @@ CLASS lcl_object_clas DEFINITION INHERITING FROM lcl_objects_program.
|
||||||
RETURNING VALUE(rt_source) TYPE ty_string_tt
|
RETURNING VALUE(rt_source) TYPE ty_string_tt
|
||||||
RAISING lcx_exception.
|
RAISING lcx_exception.
|
||||||
|
|
||||||
METHODS deserialize_abap_source_old
|
|
||||||
IMPORTING is_clskey TYPE seoclskey
|
|
||||||
it_source TYPE ty_string_tt
|
|
||||||
RAISING lcx_exception.
|
|
||||||
|
|
||||||
METHODS deserialize_abap_source_new
|
|
||||||
IMPORTING is_clskey TYPE seoclskey
|
|
||||||
it_source TYPE ty_string_tt
|
|
||||||
RAISING lcx_exception
|
|
||||||
cx_sy_dyn_call_error.
|
|
||||||
|
|
||||||
METHODS serialize_abap_new
|
METHODS serialize_abap_new
|
||||||
IMPORTING is_clskey TYPE seoclskey
|
IMPORTING is_clskey TYPE seoclskey
|
||||||
RETURNING VALUE(rt_source) TYPE ty_string_tt
|
RETURNING VALUE(rt_source) TYPE ty_string_tt
|
||||||
|
@ -109,16 +480,6 @@ CLASS lcl_object_clas DEFINITION INHERITING FROM lcl_objects_program.
|
||||||
|
|
||||||
ENDCLASS. "lcl_object_dtel DEFINITION
|
ENDCLASS. "lcl_object_dtel DEFINITION
|
||||||
|
|
||||||
*----------------------------------------------------------------------*
|
|
||||||
* CLASS lcl_object_intf DEFINITION
|
|
||||||
*----------------------------------------------------------------------*
|
|
||||||
*
|
|
||||||
*----------------------------------------------------------------------*
|
|
||||||
CLASS lcl_object_intf DEFINITION INHERITING FROM lcl_object_clas FINAL.
|
|
||||||
* todo, CLAS + INTF to be refactored, see:
|
|
||||||
* https://github.com/larshp/abapGit/issues/21
|
|
||||||
ENDCLASS. "lcl_object_intf DEFINITION
|
|
||||||
|
|
||||||
*----------------------------------------------------------------------*
|
*----------------------------------------------------------------------*
|
||||||
* CLASS lcl_object_clas IMPLEMENTATION
|
* CLASS lcl_object_clas IMPLEMENTATION
|
||||||
*----------------------------------------------------------------------*
|
*----------------------------------------------------------------------*
|
||||||
|
@ -737,28 +1098,21 @@ CLASS lcl_object_clas IMPLEMENTATION.
|
||||||
|
|
||||||
METHOD lif_object~deserialize.
|
METHOD lif_object~deserialize.
|
||||||
|
|
||||||
* function group SEOK
|
mo_object_oriented_object = lcl_object_oriented_factory=>make( iv_object_type = ms_item-obj_type ).
|
||||||
* function group SEOQ
|
|
||||||
* function group SEOP
|
|
||||||
* class CL_OO_CLASSNAME_SERVICE
|
|
||||||
* class CL_OO_SOURCE
|
|
||||||
|
|
||||||
deserialize_abap( io_xml = io_xml
|
deserialize_abap( io_xml = io_xml
|
||||||
iv_package = iv_package ).
|
iv_package = iv_package ).
|
||||||
|
|
||||||
IF ms_item-obj_type = 'CLAS'.
|
deserialize_textpool( io_xml ).
|
||||||
deserialize_textpool( io_xml ).
|
|
||||||
|
|
||||||
deserialize_sotr( io_xml = io_xml
|
deserialize_sotr( io_xml = io_xml
|
||||||
iv_package = iv_package ).
|
iv_package = iv_package ).
|
||||||
ENDIF.
|
|
||||||
|
|
||||||
deserialize_docu( io_xml ).
|
deserialize_docu( io_xml ).
|
||||||
|
|
||||||
ENDMETHOD. "deserialize
|
ENDMETHOD. "deserialize
|
||||||
|
|
||||||
METHOD deserialize_sotr.
|
METHOD deserialize_sotr.
|
||||||
|
"OTR stands for Online Text Repository
|
||||||
DATA: lt_sotr TYPE ty_sotr_tt,
|
DATA: lt_sotr TYPE ty_sotr_tt,
|
||||||
lt_objects TYPE sotr_objects,
|
lt_objects TYPE sotr_objects,
|
||||||
ls_paket TYPE sotr_pack,
|
ls_paket TYPE sotr_pack,
|
||||||
|
@ -774,58 +1128,9 @@ CLASS lcl_object_clas IMPLEMENTATION.
|
||||||
RETURN.
|
RETURN.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
LOOP AT lt_sotr ASSIGNING <ls_sotr>.
|
mo_object_oriented_object->create_sotr(
|
||||||
CALL FUNCTION 'SOTR_OBJECT_GET_OBJECTS'
|
iv_package = iv_package
|
||||||
EXPORTING
|
it_sotr = lt_sotr ).
|
||||||
object_vector = <ls_sotr>-header-objid_vec
|
|
||||||
IMPORTING
|
|
||||||
objects = lt_objects
|
|
||||||
EXCEPTIONS
|
|
||||||
object_not_found = 1
|
|
||||||
OTHERS = 2.
|
|
||||||
IF sy-subrc <> 0.
|
|
||||||
lcx_exception=>raise( 'error from SOTR_OBJECT_GET_OBJECTS' ).
|
|
||||||
ENDIF.
|
|
||||||
|
|
||||||
READ TABLE lt_objects INDEX 1 INTO lv_object.
|
|
||||||
ASSERT sy-subrc = 0.
|
|
||||||
|
|
||||||
ls_paket-paket = iv_package.
|
|
||||||
|
|
||||||
CALL FUNCTION 'SOTR_CREATE_CONCEPT'
|
|
||||||
EXPORTING
|
|
||||||
paket = ls_paket
|
|
||||||
crea_lan = <ls_sotr>-header-crea_lan
|
|
||||||
alias_name = <ls_sotr>-header-alias_name
|
|
||||||
object = lv_object
|
|
||||||
entries = <ls_sotr>-entries
|
|
||||||
concept_default = <ls_sotr>-header-concept
|
|
||||||
EXCEPTIONS
|
|
||||||
package_missing = 1
|
|
||||||
crea_lan_missing = 2
|
|
||||||
object_missing = 3
|
|
||||||
paket_does_not_exist = 4
|
|
||||||
alias_already_exist = 5
|
|
||||||
object_type_not_found = 6
|
|
||||||
langu_missing = 7
|
|
||||||
identical_context_not_allowed = 8
|
|
||||||
text_too_long = 9
|
|
||||||
error_in_update = 10
|
|
||||||
no_master_langu = 11
|
|
||||||
error_in_concept_id = 12
|
|
||||||
alias_not_allowed = 13
|
|
||||||
tadir_entry_creation_failed = 14
|
|
||||||
internal_error = 15
|
|
||||||
error_in_correction = 16
|
|
||||||
user_cancelled = 17
|
|
||||||
no_entry_found = 18
|
|
||||||
OTHERS = 19.
|
|
||||||
IF sy-subrc <> 0.
|
|
||||||
lcx_exception=>raise( 'error from SOTR_CREATE_CONCEPT' ).
|
|
||||||
ENDIF.
|
|
||||||
|
|
||||||
ENDLOOP.
|
|
||||||
|
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
METHOD deserialize_docu.
|
METHOD deserialize_docu.
|
||||||
|
@ -833,7 +1138,6 @@ CLASS lcl_object_clas IMPLEMENTATION.
|
||||||
DATA: lt_lines TYPE tlinetab,
|
DATA: lt_lines TYPE tlinetab,
|
||||||
lv_object TYPE dokhl-object.
|
lv_object TYPE dokhl-object.
|
||||||
|
|
||||||
|
|
||||||
io_xml->read( EXPORTING iv_name = 'LINES'
|
io_xml->read( EXPORTING iv_name = 'LINES'
|
||||||
CHANGING cg_data = lt_lines ).
|
CHANGING cg_data = lt_lines ).
|
||||||
|
|
||||||
|
@ -842,20 +1146,11 @@ CLASS lcl_object_clas IMPLEMENTATION.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
lv_object = ms_item-obj_name.
|
lv_object = ms_item-obj_name.
|
||||||
CALL FUNCTION 'DOCU_UPD'
|
|
||||||
EXPORTING
|
|
||||||
id = 'CL'
|
|
||||||
langu = mv_language
|
|
||||||
object = lv_object
|
|
||||||
TABLES
|
|
||||||
line = lt_lines
|
|
||||||
EXCEPTIONS
|
|
||||||
ret_code = 1
|
|
||||||
OTHERS = 2.
|
|
||||||
IF sy-subrc <> 0.
|
|
||||||
lcx_exception=>raise( 'error from DOCU_UPD' ).
|
|
||||||
ENDIF.
|
|
||||||
|
|
||||||
|
mo_object_oriented_object->create_documentation(
|
||||||
|
it_lines = lt_lines
|
||||||
|
iv_object_name = lv_object
|
||||||
|
iv_language = mv_language ).
|
||||||
ENDMETHOD. "deserialize_doku
|
ENDMETHOD. "deserialize_doku
|
||||||
|
|
||||||
METHOD deserialize_textpool.
|
METHOD deserialize_textpool.
|
||||||
|
@ -875,202 +1170,130 @@ CLASS lcl_object_clas IMPLEMENTATION.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
lv_clsname = ms_item-obj_name.
|
lv_clsname = ms_item-obj_name.
|
||||||
lv_cp = cl_oo_classname_service=>get_classpool_name( lv_clsname ).
|
|
||||||
|
|
||||||
INSERT TEXTPOOL lv_cp
|
|
||||||
FROM lt_tpool
|
|
||||||
LANGUAGE mv_language
|
|
||||||
STATE 'I'.
|
|
||||||
IF sy-subrc <> 0.
|
|
||||||
lcx_exception=>raise( 'error from INSERT TEXTPOOL' ).
|
|
||||||
ENDIF.
|
|
||||||
|
|
||||||
lcl_objects_activation=>add( iv_type = 'REPT'
|
|
||||||
iv_name = lv_cp ).
|
|
||||||
|
|
||||||
|
mo_object_oriented_object->insert_text_pool(
|
||||||
|
iv_class_name = lv_clsname
|
||||||
|
it_text_pool = lt_tpool
|
||||||
|
iv_language = mv_language ).
|
||||||
ENDMETHOD. "deserialize_textpool
|
ENDMETHOD. "deserialize_textpool
|
||||||
|
|
||||||
METHOD deserialize_abap.
|
METHOD deserialize_abap.
|
||||||
|
|
||||||
DATA: ls_vseoclass TYPE vseoclass,
|
DATA: ls_vseoclass TYPE vseoclass,
|
||||||
ls_vseointerf TYPE vseointerf,
|
lt_source TYPE seop_source_string,
|
||||||
lt_source TYPE seop_source_string,
|
lt_local_definitions TYPE seop_source_string,
|
||||||
lt_locals_def TYPE seop_source_string,
|
lt_local_implementations TYPE seop_source_string,
|
||||||
lt_locals_imp TYPE seop_source_string,
|
lt_local_macros TYPE seop_source_string,
|
||||||
lt_locals_mac TYPE seop_source_string,
|
lt_test_classes TYPE seop_source_string,
|
||||||
lt_testclasses TYPE seop_source_string,
|
lt_descriptions TYPE ty_seocompotx_tt,
|
||||||
lt_descriptions TYPE ty_seocompotx_tt,
|
ls_class_key TYPE seoclskey.
|
||||||
ls_clskey TYPE seoclskey.
|
|
||||||
|
|
||||||
|
|
||||||
lt_source = mo_files->read_abap( ).
|
lt_source = mo_files->read_abap( ).
|
||||||
|
|
||||||
lt_locals_def = mo_files->read_abap( iv_extra = 'locals_def'
|
lt_local_definitions = mo_files->read_abap( iv_extra = 'locals_def'
|
||||||
iv_error = abap_false ). "#EC NOTEXT
|
iv_error = abap_false ). "#EC NOTEXT
|
||||||
|
|
||||||
lt_locals_imp = mo_files->read_abap( iv_extra = 'locals_imp'
|
lt_local_implementations = mo_files->read_abap( iv_extra = 'locals_imp'
|
||||||
iv_error = abap_false ). "#EC NOTEXT
|
iv_error = abap_false ). "#EC NOTEXT
|
||||||
|
|
||||||
lt_locals_mac = mo_files->read_abap( iv_extra = 'macros'
|
lt_local_macros = mo_files->read_abap( iv_extra = 'macros'
|
||||||
iv_error = abap_false ). "#EC NOTEXT
|
iv_error = abap_false ). "#EC NOTEXT
|
||||||
|
|
||||||
lt_testclasses = mo_files->read_abap( iv_extra = 'testclasses'
|
lt_test_classes = mo_files->read_abap( iv_extra = 'testclasses'
|
||||||
iv_error = abap_false ). "#EC NOTEXT
|
iv_error = abap_false ). "#EC NOTEXT
|
||||||
|
|
||||||
ls_clskey-clsname = ms_item-obj_name.
|
ls_class_key-clsname = ms_item-obj_name.
|
||||||
|
|
||||||
|
io_xml->read( EXPORTING iv_name = 'VSEOCLASS'
|
||||||
|
CHANGING cg_data = ls_vseoclass ).
|
||||||
|
|
||||||
CASE ms_item-obj_type.
|
mo_object_oriented_object->create(
|
||||||
WHEN 'CLAS'.
|
EXPORTING
|
||||||
io_xml->read( EXPORTING iv_name = 'VSEOCLASS'
|
iv_package = iv_package
|
||||||
CHANGING cg_data = ls_vseoclass ).
|
CHANGING
|
||||||
|
is_properties = ls_vseoclass ).
|
||||||
|
mo_object_oriented_object->generate_locals(
|
||||||
|
is_key = ls_class_key
|
||||||
|
iv_force = seox_true
|
||||||
|
it_local_definitions = lt_local_definitions
|
||||||
|
it_local_implementations = lt_local_implementations
|
||||||
|
it_local_macros = lt_local_macros
|
||||||
|
it_local_test_classes = lt_test_classes ).
|
||||||
|
|
||||||
CALL FUNCTION 'SEO_CLASS_CREATE_COMPLETE'
|
mo_object_oriented_object->deserialize_source(
|
||||||
EXPORTING
|
is_key = ls_class_key
|
||||||
devclass = iv_package
|
it_source = lt_source ).
|
||||||
overwrite = seox_true
|
|
||||||
CHANGING
|
|
||||||
class = ls_vseoclass
|
|
||||||
EXCEPTIONS
|
|
||||||
existing = 1
|
|
||||||
is_interface = 2
|
|
||||||
db_error = 3
|
|
||||||
component_error = 4
|
|
||||||
no_access = 5
|
|
||||||
other = 6
|
|
||||||
OTHERS = 7.
|
|
||||||
IF sy-subrc <> 0.
|
|
||||||
lcx_exception=>raise( 'error from SEO_CLASS_CREATE_COMPLETE' ).
|
|
||||||
ENDIF.
|
|
||||||
|
|
||||||
WHEN 'INTF'.
|
|
||||||
io_xml->read( EXPORTING iv_name = 'VSEOINTERF'
|
|
||||||
CHANGING cg_data = ls_vseointerf ).
|
|
||||||
|
|
||||||
CALL FUNCTION 'SEO_INTERFACE_CREATE_COMPLETE'
|
|
||||||
EXPORTING
|
|
||||||
devclass = iv_package
|
|
||||||
overwrite = seox_true
|
|
||||||
CHANGING
|
|
||||||
interface = ls_vseointerf
|
|
||||||
EXCEPTIONS
|
|
||||||
existing = 1
|
|
||||||
is_class = 2
|
|
||||||
db_error = 3
|
|
||||||
component_error = 4
|
|
||||||
no_access = 5
|
|
||||||
other = 6
|
|
||||||
OTHERS = 7.
|
|
||||||
IF sy-subrc <> 0.
|
|
||||||
lcx_exception=>raise( 'Error from SEO_INTERFACE_CREATE_COMPLETE' ).
|
|
||||||
ENDIF.
|
|
||||||
|
|
||||||
WHEN OTHERS.
|
|
||||||
ASSERT 0 = 1.
|
|
||||||
ENDCASE.
|
|
||||||
|
|
||||||
IF ms_item-obj_type = 'CLAS'.
|
|
||||||
CALL FUNCTION 'SEO_CLASS_GENERATE_LOCALS'
|
|
||||||
EXPORTING
|
|
||||||
clskey = ls_clskey
|
|
||||||
force = seox_true
|
|
||||||
locals_def = lt_locals_def
|
|
||||||
locals_imp = lt_locals_imp
|
|
||||||
locals_mac = lt_locals_mac
|
|
||||||
locals_testclasses = lt_testclasses
|
|
||||||
EXCEPTIONS
|
|
||||||
not_existing = 1
|
|
||||||
model_only = 2
|
|
||||||
locals_not_generated = 3
|
|
||||||
locals_not_initialised = 4
|
|
||||||
OTHERS = 5.
|
|
||||||
IF sy-subrc <> 0.
|
|
||||||
lcx_exception=>raise( 'error from generate_locals' ).
|
|
||||||
ENDIF.
|
|
||||||
ENDIF.
|
|
||||||
|
|
||||||
TRY.
|
|
||||||
deserialize_abap_source_new(
|
|
||||||
is_clskey = ls_clskey
|
|
||||||
it_source = lt_source ).
|
|
||||||
CATCH cx_sy_dyn_call_error.
|
|
||||||
deserialize_abap_source_old(
|
|
||||||
is_clskey = ls_clskey
|
|
||||||
it_source = lt_source ).
|
|
||||||
ENDTRY.
|
|
||||||
|
|
||||||
io_xml->read( EXPORTING iv_name = 'DESCRIPTIONS'
|
io_xml->read( EXPORTING iv_name = 'DESCRIPTIONS'
|
||||||
CHANGING cg_data = lt_descriptions ).
|
CHANGING cg_data = lt_descriptions ).
|
||||||
DELETE FROM seocompotx WHERE clsname = ls_clskey-clsname.
|
|
||||||
INSERT seocompotx FROM TABLE lt_descriptions.
|
|
||||||
|
|
||||||
lcl_objects_activation=>add_item( ms_item ).
|
mo_object_oriented_object->update_descriptions(
|
||||||
|
is_key = ls_class_key
|
||||||
|
it_descriptions = lt_descriptions ).
|
||||||
|
|
||||||
|
mo_object_oriented_object->add_to_activation_list( is_item = ms_item ).
|
||||||
ENDMETHOD. "deserialize
|
ENDMETHOD. "deserialize
|
||||||
|
|
||||||
METHOD deserialize_abap_source_old.
|
|
||||||
* for backwards compatability down to 702
|
|
||||||
|
|
||||||
DATA: lo_source TYPE REF TO cl_oo_source.
|
|
||||||
|
|
||||||
|
|
||||||
CREATE OBJECT lo_source
|
|
||||||
EXPORTING
|
|
||||||
clskey = is_clskey
|
|
||||||
EXCEPTIONS
|
|
||||||
class_not_existing = 1
|
|
||||||
OTHERS = 2.
|
|
||||||
IF sy-subrc <> 0.
|
|
||||||
lcx_exception=>raise( 'error from CL_OO_SOURCE' ).
|
|
||||||
ENDIF.
|
|
||||||
|
|
||||||
TRY.
|
|
||||||
lo_source->access_permission( seok_access_modify ).
|
|
||||||
lo_source->set_source( it_source ).
|
|
||||||
lo_source->save( ).
|
|
||||||
lo_source->access_permission( seok_access_free ).
|
|
||||||
CATCH cx_oo_access_permission.
|
|
||||||
lcx_exception=>raise( 'permission error' ).
|
|
||||||
CATCH cx_oo_source_save_failure.
|
|
||||||
lcx_exception=>raise( 'save failure' ).
|
|
||||||
ENDTRY.
|
|
||||||
|
|
||||||
ENDMETHOD.
|
|
||||||
|
|
||||||
METHOD deserialize_abap_source_new.
|
|
||||||
|
|
||||||
DATA: lo_factory TYPE REF TO object,
|
|
||||||
lo_source TYPE REF TO object.
|
|
||||||
|
|
||||||
|
|
||||||
CALL METHOD ('CL_OO_FACTORY')=>('CREATE_INSTANCE')
|
|
||||||
RECEIVING
|
|
||||||
result = lo_factory.
|
|
||||||
|
|
||||||
CALL METHOD lo_factory->('CREATE_CLIF_SOURCE')
|
|
||||||
EXPORTING
|
|
||||||
clif_name = is_clskey-clsname
|
|
||||||
RECEIVING
|
|
||||||
result = lo_source.
|
|
||||||
|
|
||||||
TRY.
|
|
||||||
CALL METHOD lo_source->('IF_OO_CLIF_SOURCE~LOCK').
|
|
||||||
CATCH cx_oo_access_permission.
|
|
||||||
lcx_exception=>raise( 'source_new, access permission exception' ).
|
|
||||||
ENDTRY.
|
|
||||||
|
|
||||||
CALL METHOD lo_source->('IF_OO_CLIF_SOURCE~SET_SOURCE')
|
|
||||||
EXPORTING
|
|
||||||
source = it_source.
|
|
||||||
|
|
||||||
CALL METHOD lo_source->('IF_OO_CLIF_SOURCE~SAVE').
|
|
||||||
|
|
||||||
CALL METHOD lo_source->('IF_OO_CLIF_SOURCE~UNLOCK').
|
|
||||||
|
|
||||||
ENDMETHOD.
|
|
||||||
|
|
||||||
METHOD lif_object~compare_to_remote_version.
|
METHOD lif_object~compare_to_remote_version.
|
||||||
CREATE OBJECT ro_comparison_result TYPE lcl_null_comparison_result.
|
CREATE OBJECT ro_comparison_result TYPE lcl_null_comparison_result.
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
ENDCLASS. "lcl_object_CLAS IMPLEMENTATION
|
ENDCLASS. "lcl_object_CLAS IMPLEMENTATION
|
||||||
|
|
||||||
|
*----------------------------------------------------------------------*
|
||||||
|
* CLASS lcl_object_intf DEFINITION
|
||||||
|
*----------------------------------------------------------------------*
|
||||||
|
*
|
||||||
|
*----------------------------------------------------------------------*
|
||||||
|
CLASS lcl_object_intf DEFINITION INHERITING FROM lcl_object_clas FINAL.
|
||||||
|
* todo, CLAS + INTF to be refactored, see:
|
||||||
|
* https://github.com/larshp/abapGit/issues/21
|
||||||
|
PUBLIC SECTION.
|
||||||
|
METHODS:
|
||||||
|
lif_object~deserialize REDEFINITION.
|
||||||
|
PROTECTED SECTION.
|
||||||
|
METHODS:
|
||||||
|
deserialize_abap REDEFINITION.
|
||||||
|
ENDCLASS. "lcl_object_intf DEFINITION
|
||||||
|
CLASS lcl_object_intf IMPLEMENTATION.
|
||||||
|
METHOD lif_object~deserialize.
|
||||||
|
mo_object_oriented_object = lcl_object_oriented_factory=>make( iv_object_type = ms_item-obj_type ).
|
||||||
|
|
||||||
|
deserialize_abap( io_xml = io_xml
|
||||||
|
iv_package = iv_package ).
|
||||||
|
|
||||||
|
deserialize_docu( io_xml ).
|
||||||
|
ENDMETHOD.
|
||||||
|
METHOD deserialize_abap.
|
||||||
|
DATA: ls_vseointerf TYPE vseointerf,
|
||||||
|
lt_source TYPE seop_source_string,
|
||||||
|
lt_descriptions TYPE ty_seocompotx_tt,
|
||||||
|
ls_clskey TYPE seoclskey.
|
||||||
|
ls_clskey-clsname = ms_item-obj_name.
|
||||||
|
|
||||||
|
lt_source = mo_files->read_abap( ).
|
||||||
|
|
||||||
|
io_xml->read( EXPORTING iv_name = 'VSEOINTERF'
|
||||||
|
CHANGING cg_data = ls_vseointerf ).
|
||||||
|
|
||||||
|
mo_object_oriented_object->create(
|
||||||
|
EXPORTING
|
||||||
|
iv_package = iv_package
|
||||||
|
CHANGING
|
||||||
|
is_properties = ls_vseointerf ).
|
||||||
|
|
||||||
|
mo_object_oriented_object->deserialize_source(
|
||||||
|
is_key = ls_clskey
|
||||||
|
it_source = lt_source ).
|
||||||
|
|
||||||
|
io_xml->read( EXPORTING iv_name = 'DESCRIPTIONS'
|
||||||
|
CHANGING cg_data = lt_descriptions ).
|
||||||
|
|
||||||
|
mo_object_oriented_object->update_descriptions(
|
||||||
|
is_key = ls_clskey
|
||||||
|
it_descriptions = lt_descriptions ).
|
||||||
|
|
||||||
|
mo_object_oriented_object->add_to_activation_list( is_item = ms_item ).
|
||||||
|
ENDMETHOD.
|
||||||
|
ENDCLASS.
|
|
@ -187,7 +187,7 @@ ENDCLASS. "lcl_objects_activation IMPLEMENTATION
|
||||||
*----------------------------------------------------------------------*
|
*----------------------------------------------------------------------*
|
||||||
*
|
*
|
||||||
*----------------------------------------------------------------------*
|
*----------------------------------------------------------------------*
|
||||||
CLASS lcl_objects_files DEFINITION FINAL.
|
CLASS lcl_objects_files DEFINITION .
|
||||||
|
|
||||||
PUBLIC SECTION.
|
PUBLIC SECTION.
|
||||||
METHODS:
|
METHODS:
|
||||||
|
@ -859,13 +859,6 @@ CLASS lcl_objects_program DEFINITION INHERITING FROM lcl_objects_super.
|
||||||
|
|
||||||
TYPES: ty_spaces_tt TYPE STANDARD TABLE OF i WITH DEFAULT KEY.
|
TYPES: ty_spaces_tt TYPE STANDARD TABLE OF i WITH DEFAULT KEY.
|
||||||
|
|
||||||
TYPES: BEGIN OF ty_tpool.
|
|
||||||
INCLUDE TYPE textpool.
|
|
||||||
TYPES: split TYPE c LENGTH 8.
|
|
||||||
TYPES: END OF ty_tpool.
|
|
||||||
|
|
||||||
TYPES: ty_tpool_tt TYPE STANDARD TABLE OF ty_tpool WITH DEFAULT KEY.
|
|
||||||
|
|
||||||
TYPES: BEGIN OF ty_dynpro,
|
TYPES: BEGIN OF ty_dynpro,
|
||||||
header TYPE rpy_dyhead,
|
header TYPE rpy_dyhead,
|
||||||
containers TYPE dycatt_tab,
|
containers TYPE dycatt_tab,
|
||||||
|
|
|
@ -2205,4 +2205,544 @@ CLASS ltcl_persistence_settings IMPLEMENTATION.
|
||||||
|
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
|
||||||
|
CLASS ltd_spy_oo_object DEFINITION FOR TESTING.
|
||||||
|
PUBLIC SECTION.
|
||||||
|
INTERFACES: lif_object_oriented_object.
|
||||||
|
DATA:
|
||||||
|
mv_package TYPE devclass,
|
||||||
|
mv_overwrite TYPE seox_boolean,
|
||||||
|
ms_interface_properties TYPE vseointerf,
|
||||||
|
ms_class_properties TYPE vseoclass,
|
||||||
|
ms_locals_key TYPE seoclskey,
|
||||||
|
mt_local_definitions TYPE rswsourcet,
|
||||||
|
mt_local_implementations TYPE rswsourcet,
|
||||||
|
mt_local_macros TYPE rswsourcet,
|
||||||
|
mt_local_test_classes TYPE rswsourcet,
|
||||||
|
mv_force TYPE seoflag,
|
||||||
|
ms_deserialize_key TYPE seoclskey,
|
||||||
|
mt_source TYPE ty_string_tt,
|
||||||
|
ms_item_to_activate TYPE ty_item,
|
||||||
|
mt_descriptions TYPE ty_seocompotx_tt,
|
||||||
|
ms_description_key TYPE seoclskey,
|
||||||
|
mv_text_pool_class_name TYPE seoclsname,
|
||||||
|
mt_text_pool TYPE textpool_table,
|
||||||
|
mv_text_pool_inserted TYPE abap_bool,
|
||||||
|
mt_sotr TYPE ty_sotr_tt,
|
||||||
|
mt_sotr_package TYPE devclass,
|
||||||
|
mv_docu_object_name TYPE dokhl-object,
|
||||||
|
mv_docu_language TYPE spras,
|
||||||
|
mt_docu_lines TYPE tlinetab.
|
||||||
|
|
||||||
|
ENDCLASS.
|
||||||
|
CLASS ltd_spy_oo_object IMPLEMENTATION.
|
||||||
|
METHOD lif_object_oriented_object~create.
|
||||||
|
DATA lv_properties_structure_name TYPE string.
|
||||||
|
lv_properties_structure_name = cl_abap_typedescr=>describe_by_data( is_properties )->absolute_name.
|
||||||
|
IF lv_properties_structure_name = cl_abap_typedescr=>describe_by_data( ms_interface_properties )->absolute_name.
|
||||||
|
ms_interface_properties = is_properties.
|
||||||
|
ELSE.
|
||||||
|
ms_class_properties = is_properties.
|
||||||
|
ENDIF.
|
||||||
|
mv_package = iv_package.
|
||||||
|
mv_overwrite = iv_overwrite.
|
||||||
|
ENDMETHOD.
|
||||||
|
METHOD lif_object_oriented_object~generate_locals.
|
||||||
|
ms_locals_key = is_key.
|
||||||
|
mt_local_definitions = it_local_definitions.
|
||||||
|
mt_local_implementations = it_local_implementations.
|
||||||
|
mt_local_macros = it_local_macros.
|
||||||
|
mt_local_test_classes = it_local_test_classes.
|
||||||
|
mv_force = iv_force.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD lif_object_oriented_object~deserialize_source.
|
||||||
|
ms_deserialize_key = is_key.
|
||||||
|
mt_source = it_source.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD lif_object_oriented_object~add_to_activation_list.
|
||||||
|
ms_item_to_activate = is_item.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD lif_object_oriented_object~update_descriptions.
|
||||||
|
ms_description_key = is_key.
|
||||||
|
mt_descriptions = it_descriptions.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD lif_object_oriented_object~insert_text_pool.
|
||||||
|
mv_text_pool_inserted = abap_true.
|
||||||
|
mv_text_pool_class_name = iv_class_name.
|
||||||
|
mt_text_pool = it_text_pool.
|
||||||
|
cl_abap_unit_assert=>assert_equals(
|
||||||
|
act = iv_language
|
||||||
|
exp = sy-langu ).
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD lif_object_oriented_object~create_sotr.
|
||||||
|
mt_sotr = it_sotr.
|
||||||
|
mt_sotr_package = iv_package.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD lif_object_oriented_object~create_documentation.
|
||||||
|
mv_docu_object_name = iv_object_name.
|
||||||
|
mv_docu_language = iv_language.
|
||||||
|
mt_docu_lines = it_lines.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
CLASS ltd_fake_object_files DEFINITION FOR TESTING
|
||||||
|
INHERITING FROM lcl_objects_files.
|
||||||
|
PUBLIC SECTION.
|
||||||
|
METHODS constructor.
|
||||||
|
METHODS read_abap REDEFINITION.
|
||||||
|
DATA:
|
||||||
|
mt_sources TYPE seop_source_string,
|
||||||
|
mt_local_definitions TYPE seop_source_string,
|
||||||
|
mt_local_implementations TYPE seop_source_string,
|
||||||
|
mt_local_macros TYPE seop_source_string,
|
||||||
|
mt_local_test_classes TYPE seop_source_string.
|
||||||
|
ENDCLASS.
|
||||||
|
CLASS ltd_fake_object_files IMPLEMENTATION.
|
||||||
|
METHOD read_abap.
|
||||||
|
CASE iv_extra.
|
||||||
|
WHEN 'locals_def'.
|
||||||
|
rt_abap = mt_local_definitions.
|
||||||
|
WHEN 'locals_imp'.
|
||||||
|
rt_abap = mt_local_implementations.
|
||||||
|
WHEN 'macros'.
|
||||||
|
rt_abap = mt_local_macros.
|
||||||
|
WHEN 'testclasses'.
|
||||||
|
rt_abap = mt_local_test_classes.
|
||||||
|
WHEN OTHERS.
|
||||||
|
rt_abap = mt_sources.
|
||||||
|
RETURN.
|
||||||
|
ENDCASE.
|
||||||
|
|
||||||
|
cl_abap_unit_assert=>assert_false( iv_error ).
|
||||||
|
ENDMETHOD.
|
||||||
|
METHOD constructor.
|
||||||
|
DATA ls_empty_item TYPE ty_item.
|
||||||
|
super->constructor( ls_empty_item ).
|
||||||
|
APPEND 'source' TO me->mt_sources.
|
||||||
|
APPEND 'definition' TO me->mt_local_definitions.
|
||||||
|
APPEND 'implementation' TO me->mt_local_implementations.
|
||||||
|
APPEND 'macro' TO me->mt_local_macros.
|
||||||
|
APPEND 'test' TO me->mt_local_test_classes.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
CLASS ltc_oo_test DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT .
|
||||||
|
PROTECTED SECTION.
|
||||||
|
DATA:
|
||||||
|
mo_spy_oo_object TYPE REF TO ltd_spy_oo_object,
|
||||||
|
mo_fake_object_files TYPE REF TO ltd_fake_object_files,
|
||||||
|
mo_xml_input TYPE REF TO lcl_xml_input,
|
||||||
|
mo_xml_out TYPE REF TO lcl_xml_output,
|
||||||
|
mo_oo_object TYPE REF TO lif_object,
|
||||||
|
ms_item TYPE ty_item.
|
||||||
|
METHODS: when_deserializing
|
||||||
|
RAISING
|
||||||
|
lcx_exception,
|
||||||
|
then_should_deserialize_source,
|
||||||
|
given_the_descriptions
|
||||||
|
IMPORTING
|
||||||
|
it_descriptions TYPE ty_seocompotx_tt
|
||||||
|
RAISING
|
||||||
|
lcx_exception,
|
||||||
|
then_shuld_update_descriptions
|
||||||
|
IMPORTING
|
||||||
|
it_descriptions TYPE ty_seocompotx_tt,
|
||||||
|
then_it_should_add_activation,
|
||||||
|
given_documentation_in_xml_as
|
||||||
|
IMPORTING
|
||||||
|
it_lines TYPE tlinetab
|
||||||
|
RAISING
|
||||||
|
lcx_exception,
|
||||||
|
then_docu_should_be_created
|
||||||
|
IMPORTING
|
||||||
|
it_lines TYPE tlinetab.
|
||||||
|
|
||||||
|
ENDCLASS.
|
||||||
|
CLASS ltc_oo_test IMPLEMENTATION.
|
||||||
|
|
||||||
|
METHOD then_docu_should_be_created.
|
||||||
|
cl_abap_unit_assert=>assert_equals(
|
||||||
|
act = mo_spy_oo_object->mt_docu_lines
|
||||||
|
exp = it_lines ).
|
||||||
|
|
||||||
|
cl_abap_unit_assert=>assert_equals(
|
||||||
|
act = mo_spy_oo_object->mv_docu_object_name
|
||||||
|
exp = ms_item-obj_name ).
|
||||||
|
|
||||||
|
cl_abap_unit_assert=>assert_equals(
|
||||||
|
act = mo_spy_oo_object->mv_docu_language
|
||||||
|
exp = sy-langu ).
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD given_documentation_in_xml_as.
|
||||||
|
mo_xml_out->add(
|
||||||
|
iv_name = 'LINES'
|
||||||
|
ig_data = it_lines ).
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD then_it_should_add_activation.
|
||||||
|
cl_abap_unit_assert=>assert_equals(
|
||||||
|
act = mo_spy_oo_object->ms_item_to_activate
|
||||||
|
exp = ms_item ).
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD then_shuld_update_descriptions.
|
||||||
|
cl_abap_unit_assert=>assert_equals(
|
||||||
|
act = mo_spy_oo_object->mt_descriptions
|
||||||
|
exp = it_descriptions ).
|
||||||
|
|
||||||
|
cl_abap_unit_assert=>assert_equals(
|
||||||
|
act = mo_spy_oo_object->ms_description_key
|
||||||
|
exp = ms_item-obj_name ).
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD given_the_descriptions.
|
||||||
|
mo_xml_out->add(
|
||||||
|
iv_name = 'DESCRIPTIONS'
|
||||||
|
ig_data = it_descriptions ).
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD then_should_deserialize_source.
|
||||||
|
cl_abap_unit_assert=>assert_equals(
|
||||||
|
act = mo_spy_oo_object->mt_source
|
||||||
|
exp = mo_fake_object_files->mt_sources ).
|
||||||
|
|
||||||
|
cl_abap_unit_assert=>assert_equals(
|
||||||
|
act = mo_spy_oo_object->ms_deserialize_key
|
||||||
|
exp = ms_item-obj_name ).
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD when_deserializing.
|
||||||
|
CREATE OBJECT mo_xml_input
|
||||||
|
EXPORTING
|
||||||
|
iv_xml = mo_xml_out->render( ).
|
||||||
|
mo_oo_object->deserialize(
|
||||||
|
iv_package = 'package_name'
|
||||||
|
io_xml = mo_xml_input ).
|
||||||
|
ENDMETHOD.
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
CLASS ltcl_class_deserialization DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT
|
||||||
|
INHERITING FROM ltc_oo_test.
|
||||||
|
PRIVATE SECTION.
|
||||||
|
METHODS:
|
||||||
|
setup,
|
||||||
|
given_a_class_properties
|
||||||
|
RAISING
|
||||||
|
lcx_exception,
|
||||||
|
then_should_create_class,
|
||||||
|
then_it_should_generate_locals,
|
||||||
|
should_create_class FOR TESTING RAISING cx_static_check,
|
||||||
|
should_generate_locals FOR TESTING RAISING cx_static_check,
|
||||||
|
should_deserialize_source FOR TESTING RAISING cx_static_check,
|
||||||
|
should_update_descriptions FOR TESTING RAISING cx_static_check,
|
||||||
|
should_add_to_activation FOR TESTING RAISING cx_static_check,
|
||||||
|
no_text_pool_no_insert FOR TESTING RAISING cx_static_check,
|
||||||
|
insert_text_pool FOR TESTING RAISING cx_static_check,
|
||||||
|
create_stor_from_xml FOR TESTING RAISING cx_static_check,
|
||||||
|
create_documentation FOR TESTING RAISING cx_static_check.
|
||||||
|
DATA:
|
||||||
|
ms_class_properties TYPE vseoclass.
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
CLASS ltcl_class_deserialization IMPLEMENTATION.
|
||||||
|
METHOD setup.
|
||||||
|
CREATE OBJECT mo_fake_object_files.
|
||||||
|
CREATE OBJECT mo_spy_oo_object.
|
||||||
|
CREATE OBJECT mo_xml_out.
|
||||||
|
lth_oo_factory_injector=>inject( mo_spy_oo_object ).
|
||||||
|
|
||||||
|
ms_item-devclass = 'package_name'.
|
||||||
|
ms_item-obj_name = 'zcl_class'.
|
||||||
|
ms_item-obj_type = 'CLAS'.
|
||||||
|
|
||||||
|
CREATE OBJECT mo_oo_object TYPE lcl_object_clas
|
||||||
|
EXPORTING
|
||||||
|
is_item = ms_item
|
||||||
|
iv_language = sy-langu.
|
||||||
|
mo_oo_object->mo_files = mo_fake_object_files.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD should_create_class.
|
||||||
|
ms_class_properties-clsname = ms_item-obj_name.
|
||||||
|
|
||||||
|
given_a_class_properties( ).
|
||||||
|
|
||||||
|
when_deserializing( ).
|
||||||
|
|
||||||
|
then_should_create_class( ).
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD should_generate_locals.
|
||||||
|
given_a_class_properties( ).
|
||||||
|
|
||||||
|
when_deserializing( ).
|
||||||
|
|
||||||
|
then_it_should_generate_locals( ).
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD should_deserialize_source.
|
||||||
|
given_a_class_properties( ).
|
||||||
|
|
||||||
|
when_deserializing( ).
|
||||||
|
|
||||||
|
then_should_deserialize_source( ).
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD should_update_descriptions.
|
||||||
|
DATA:
|
||||||
|
ls_description TYPE seocompotx,
|
||||||
|
lt_descriptions TYPE ty_seocompotx_tt.
|
||||||
|
|
||||||
|
given_a_class_properties( ).
|
||||||
|
|
||||||
|
ls_description-clsname = ms_item-obj_name.
|
||||||
|
ls_description-cmpname = 'a_method'.
|
||||||
|
APPEND ls_description TO lt_descriptions.
|
||||||
|
given_the_descriptions( lt_descriptions ).
|
||||||
|
|
||||||
|
when_deserializing( ).
|
||||||
|
|
||||||
|
then_shuld_update_descriptions( lt_descriptions ).
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD should_add_to_activation.
|
||||||
|
given_a_class_properties( ).
|
||||||
|
|
||||||
|
when_deserializing( ).
|
||||||
|
|
||||||
|
then_it_should_add_activation( ).
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD given_a_class_properties.
|
||||||
|
mo_xml_out->add(
|
||||||
|
iv_name = 'VSEOCLASS'
|
||||||
|
ig_data = ms_class_properties ).
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD then_should_create_class.
|
||||||
|
cl_abap_unit_assert=>assert_equals(
|
||||||
|
act = mo_spy_oo_object->ms_class_properties
|
||||||
|
exp = ms_class_properties ).
|
||||||
|
|
||||||
|
cl_abap_unit_assert=>assert_true( mo_spy_oo_object->mv_overwrite ).
|
||||||
|
|
||||||
|
cl_abap_unit_assert=>assert_equals(
|
||||||
|
act = mo_spy_oo_object->mv_package
|
||||||
|
exp = 'package_name' ).
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD then_it_should_generate_locals.
|
||||||
|
cl_abap_unit_assert=>assert_equals(
|
||||||
|
act = mo_spy_oo_object->ms_locals_key
|
||||||
|
exp = ms_item-obj_name ).
|
||||||
|
cl_abap_unit_assert=>assert_true( mo_spy_oo_object->mv_force ).
|
||||||
|
|
||||||
|
cl_abap_unit_assert=>assert_equals(
|
||||||
|
act = mo_spy_oo_object->mt_local_definitions
|
||||||
|
exp = mo_fake_object_files->mt_local_definitions ).
|
||||||
|
|
||||||
|
cl_abap_unit_assert=>assert_equals(
|
||||||
|
act = mo_spy_oo_object->mt_local_implementations
|
||||||
|
exp = mo_fake_object_files->mt_local_implementations ).
|
||||||
|
|
||||||
|
cl_abap_unit_assert=>assert_equals(
|
||||||
|
act = mo_spy_oo_object->mt_local_macros
|
||||||
|
exp = mo_fake_object_files->mt_local_macros ).
|
||||||
|
|
||||||
|
cl_abap_unit_assert=>assert_equals(
|
||||||
|
act = mo_spy_oo_object->mt_local_test_classes
|
||||||
|
exp = mo_fake_object_files->mt_local_test_classes ).
|
||||||
|
ENDMETHOD.
|
||||||
|
METHOD no_text_pool_no_insert.
|
||||||
|
given_a_class_properties( ).
|
||||||
|
|
||||||
|
when_deserializing( ).
|
||||||
|
|
||||||
|
cl_abap_unit_assert=>assert_false( mo_spy_oo_object->mv_text_pool_inserted ).
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD insert_text_pool.
|
||||||
|
DATA: lt_pool_external TYPE textpool_table,
|
||||||
|
ls_pool_external TYPE ty_tpool.
|
||||||
|
ls_pool_external-id = 'ID'.
|
||||||
|
ls_pool_external-key = 'KEY'.
|
||||||
|
APPEND ls_pool_external TO lt_pool_external.
|
||||||
|
|
||||||
|
given_a_class_properties( ).
|
||||||
|
|
||||||
|
mo_xml_out->add(
|
||||||
|
iv_name = 'TPOOL'
|
||||||
|
ig_data = lt_pool_external ).
|
||||||
|
|
||||||
|
when_deserializing( ).
|
||||||
|
|
||||||
|
cl_abap_unit_assert=>assert_equals(
|
||||||
|
act = mo_spy_oo_object->mt_text_pool
|
||||||
|
exp = lt_pool_external ).
|
||||||
|
|
||||||
|
cl_abap_unit_assert=>assert_equals(
|
||||||
|
act = mo_spy_oo_object->mv_text_pool_class_name
|
||||||
|
exp = 'zcl_class' ).
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD create_stor_from_xml.
|
||||||
|
DATA:
|
||||||
|
lt_sotr TYPE ty_sotr_tt,
|
||||||
|
ls_sotr LIKE LINE OF lt_sotr.
|
||||||
|
|
||||||
|
given_a_class_properties( ).
|
||||||
|
|
||||||
|
ls_sotr-header-concept = 'HEADER'.
|
||||||
|
APPEND ls_sotr TO lt_sotr.
|
||||||
|
mo_xml_out->add(
|
||||||
|
iv_name = 'SOTR'
|
||||||
|
ig_data = lt_sotr ).
|
||||||
|
|
||||||
|
when_deserializing( ).
|
||||||
|
|
||||||
|
cl_abap_unit_assert=>assert_equals(
|
||||||
|
act = mo_spy_oo_object->mt_sotr
|
||||||
|
exp = lt_sotr ).
|
||||||
|
cl_abap_unit_assert=>assert_equals(
|
||||||
|
act = mo_spy_oo_object->mt_sotr_package
|
||||||
|
exp = 'package_name' ).
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD create_documentation.
|
||||||
|
DATA: lt_lines TYPE tlinetab,
|
||||||
|
ls_line TYPE LINE OF tlinetab.
|
||||||
|
ls_line-tdline = 'Class Line Doc'.
|
||||||
|
APPEND ls_line TO lt_lines.
|
||||||
|
|
||||||
|
given_a_class_properties( ).
|
||||||
|
|
||||||
|
given_documentation_in_xml_as( lt_lines ).
|
||||||
|
|
||||||
|
when_deserializing( ).
|
||||||
|
|
||||||
|
then_docu_should_be_created( lt_lines ).
|
||||||
|
ENDMETHOD.
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
CLASS ltcl_interface_deserialization DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT
|
||||||
|
INHERITING FROM ltc_oo_test.
|
||||||
|
PRIVATE SECTION.
|
||||||
|
METHODS:
|
||||||
|
setup,
|
||||||
|
given_an_interface_properties
|
||||||
|
RAISING
|
||||||
|
lcx_exception,
|
||||||
|
then_should_create_interface,
|
||||||
|
create_interface FOR TESTING RAISING cx_static_check,
|
||||||
|
update_descriptions FOR TESTING RAISING cx_static_check,
|
||||||
|
add_to_activation FOR TESTING RAISING cx_static_check,
|
||||||
|
deserialize_source FOR TESTING RAISING cx_static_check,
|
||||||
|
create_documentation FOR TESTING RAISING cx_static_check.
|
||||||
|
DATA:
|
||||||
|
ms_interface_properties TYPE vseointerf.
|
||||||
|
ENDCLASS.
|
||||||
|
CLASS ltcl_interface_deserialization IMPLEMENTATION.
|
||||||
|
METHOD setup.
|
||||||
|
CREATE OBJECT mo_fake_object_files.
|
||||||
|
CREATE OBJECT mo_spy_oo_object.
|
||||||
|
CREATE OBJECT mo_xml_out.
|
||||||
|
lth_oo_factory_injector=>inject( mo_spy_oo_object ).
|
||||||
|
|
||||||
|
ms_item-devclass = 'package_name'.
|
||||||
|
ms_item-obj_name = 'zif_interface'.
|
||||||
|
ms_item-obj_type = 'INTF'.
|
||||||
|
|
||||||
|
CREATE OBJECT mo_oo_object TYPE lcl_object_intf
|
||||||
|
EXPORTING
|
||||||
|
is_item = ms_item
|
||||||
|
iv_language = sy-langu.
|
||||||
|
mo_oo_object->mo_files = mo_fake_object_files.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD create_interface.
|
||||||
|
ms_interface_properties-clsname = ms_item-obj_name.
|
||||||
|
given_an_interface_properties( ).
|
||||||
|
|
||||||
|
when_deserializing( ).
|
||||||
|
|
||||||
|
then_should_create_interface( ).
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD update_descriptions.
|
||||||
|
DATA:
|
||||||
|
ls_description TYPE seocompotx,
|
||||||
|
lt_descriptions TYPE ty_seocompotx_tt.
|
||||||
|
|
||||||
|
given_an_interface_properties( ).
|
||||||
|
|
||||||
|
ls_description-clsname = ms_item-obj_name.
|
||||||
|
ls_description-cmpname = 'a_method'.
|
||||||
|
APPEND ls_description TO lt_descriptions.
|
||||||
|
given_the_descriptions( lt_descriptions ).
|
||||||
|
|
||||||
|
when_deserializing( ).
|
||||||
|
|
||||||
|
then_shuld_update_descriptions( lt_descriptions ).
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD add_to_activation.
|
||||||
|
given_an_interface_properties( ).
|
||||||
|
|
||||||
|
when_deserializing( ).
|
||||||
|
|
||||||
|
then_it_should_add_activation( ).
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD deserialize_source.
|
||||||
|
given_an_interface_properties( ).
|
||||||
|
|
||||||
|
when_deserializing( ).
|
||||||
|
|
||||||
|
then_should_deserialize_source( ).
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD given_an_interface_properties.
|
||||||
|
mo_xml_out->add(
|
||||||
|
iv_name = 'VSEOINTERF'
|
||||||
|
ig_data = ms_interface_properties ).
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD then_should_create_interface.
|
||||||
|
cl_abap_unit_assert=>assert_equals(
|
||||||
|
act = mo_spy_oo_object->ms_interface_properties
|
||||||
|
exp = ms_interface_properties ).
|
||||||
|
|
||||||
|
cl_abap_unit_assert=>assert_true( mo_spy_oo_object->mv_overwrite ).
|
||||||
|
|
||||||
|
cl_abap_unit_assert=>assert_equals(
|
||||||
|
act = mo_spy_oo_object->mv_package
|
||||||
|
exp = 'package_name' ).
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD create_documentation.
|
||||||
|
DATA: lt_lines TYPE tlinetab,
|
||||||
|
ls_line TYPE LINE OF tlinetab.
|
||||||
|
ls_line-tdline = 'Interface Line Doc'.
|
||||||
|
APPEND ls_line TO lt_lines.
|
||||||
|
|
||||||
|
given_an_interface_properties( ).
|
||||||
|
|
||||||
|
given_documentation_in_xml_as( lt_lines ).
|
||||||
|
|
||||||
|
when_deserializing( ).
|
||||||
|
|
||||||
|
then_docu_should_be_created( lt_lines ).
|
||||||
|
ENDMETHOD.
|
||||||
ENDCLASS.
|
ENDCLASS.
|
Loading…
Reference in New Issue
Block a user