mirror of
https://github.com/abapGit/abapGit.git
synced 2025-05-02 04:36:49 +08:00
Merge remote-tracking branch 'refs/remotes/larshp/master'
This commit is contained in:
commit
4e5b762803
|
@ -3,7 +3,7 @@ REPORT zabapgit LINE-SIZE 100.
|
|||
* See http://www.abapgit.org
|
||||
|
||||
CONSTANTS: gc_xml_version TYPE string VALUE 'v1.0.0', "#EC NOTEXT
|
||||
gc_abap_version TYPE string VALUE 'v1.24.13'. "#EC NOTEXT
|
||||
gc_abap_version TYPE string VALUE 'v1.25.0'. "#EC NOTEXT
|
||||
|
||||
********************************************************************************
|
||||
* The MIT License (MIT)
|
||||
|
|
|
@ -37,7 +37,7 @@ form input:focus, textarea:focus {
|
|||
.grey { color: lightgrey !important; }
|
||||
.darkgrey { color: #808080 !important; }
|
||||
.attention { color: red !important; }
|
||||
.blue { color: #5e8dc9; !important; }
|
||||
.blue { color: #5e8dc9 !important; }
|
||||
.red { color: red !important; }
|
||||
|
||||
/* MODIFIERS */
|
||||
|
@ -111,9 +111,22 @@ div.menu .menu_end { border-right: 0px !important; }
|
|||
div.menu a {
|
||||
padding-left: 0.5em;
|
||||
padding-right: 0.5em;
|
||||
border-right: 1px solid lightgrey;
|
||||
font-size: 12pt;
|
||||
}
|
||||
|
||||
div.menu > a {
|
||||
border-right: 1px solid lightgrey;
|
||||
}
|
||||
div.menu > div.dropdown > a {
|
||||
border-right: 1px solid lightgrey;
|
||||
}
|
||||
div.menu > a:last-child {
|
||||
border-right: 0px !important;
|
||||
}
|
||||
div.menu > div.dropdown:last-child > a {
|
||||
border-right: 0px !important;
|
||||
}
|
||||
|
||||
div.menu_vertical { display: inline; }
|
||||
div.menu_vertical a {
|
||||
display: block;
|
||||
|
@ -415,8 +428,8 @@ span.diff_banner {
|
|||
padding-right: 0.3em;
|
||||
}
|
||||
.diff_ins {
|
||||
border-color: #7bea7b;
|
||||
background-color: #d3f8d3;
|
||||
border-color: #abf2ab;
|
||||
background-color: #e0ffe0;
|
||||
}
|
||||
.diff_del {
|
||||
border-color: #ff667d;
|
||||
|
@ -500,22 +513,36 @@ table.diff_tab thead.nav_line th {
|
|||
color: #bbb;
|
||||
}
|
||||
table.diff_tab td.num, th.num {
|
||||
text-align: right;
|
||||
width: 1%;
|
||||
min-width: 2em;
|
||||
padding-right: 8px;
|
||||
padding-left: 8px;
|
||||
text-align: right !important;
|
||||
color: #ccc;
|
||||
border-left: 1px solid #eee;
|
||||
border-right: 1px solid #eee;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
table.diff_tab td.num::before {
|
||||
content: attr(line-num);
|
||||
}
|
||||
table.diff_tab code {
|
||||
font-family: inherit;
|
||||
white-space: pre;
|
||||
}
|
||||
table.diff_tab td.code {
|
||||
word-wrap: break-word;
|
||||
white-space: pre-wrap;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
table.diff_tab code span.keyword { color: #0a69ce; }
|
||||
table.diff_tab code span.text { color: #48ce4f; }
|
||||
table.diff_tab code span.comment { color: #808080; font-style: italic; }
|
||||
table.diff_tab code span.xml_tag { color: #3370e0; }
|
||||
table.diff_tab code span.attr { color: #f20707; }
|
||||
table.diff_tab code span.attr_val { color: #7a02f9; }
|
||||
table.diff_tab .code span.keyword { color: #0a69ce; }
|
||||
table.diff_tab .code span.text { color: #48ce4f; }
|
||||
table.diff_tab .code span.comment { color: #808080; font-style: italic; }
|
||||
table.diff_tab .code span.xml_tag { color: #457ce3; }
|
||||
table.diff_tab .code span.attr { color: #b777fb; }
|
||||
table.diff_tab .code span.attr_val { color: #7a02f9; }
|
||||
|
||||
table.diff_tab tbody tr:first-child td { padding-top: 0.5em; }
|
||||
table.diff_tab tbody tr:last-child td { padding-bottom: 0.5em; }
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<NAME>ZABAPGIT_CSS_COMMON</NAME>
|
||||
<TEXT>AbapGit common styles</TEXT>
|
||||
<TEXT/>
|
||||
<PARAMS>
|
||||
<WWWPARAMS>
|
||||
<RELID>MI</RELID>
|
||||
|
|
|
@ -111,7 +111,7 @@ CLASS lcl_git_branch_list DEFINITION FINAL.
|
|||
tag TYPE ty_git_branch_type VALUE 'TG',
|
||||
other TYPE ty_git_branch_type VALUE 'ZZ',
|
||||
END OF c_type.
|
||||
CONSTANTS head_name TYPE string VALUE 'HEAD'.
|
||||
CONSTANTS c_head_name TYPE string VALUE 'HEAD'.
|
||||
|
||||
METHODS constructor
|
||||
IMPORTING iv_data TYPE string
|
||||
|
@ -126,6 +126,9 @@ CLASS lcl_git_branch_list DEFINITION FINAL.
|
|||
RETURNING VALUE(rs_branch) TYPE ty_git_branch
|
||||
RAISING lcx_exception.
|
||||
|
||||
METHODS get_head_symref
|
||||
RETURNING VALUE(rv_head_symref) TYPE string.
|
||||
|
||||
METHODS get_branches_only
|
||||
RETURNING VALUE(rt_branches) TYPE ty_git_branch_list_tt
|
||||
RAISING lcx_exception.
|
||||
|
@ -150,6 +153,10 @@ CLASS lcl_git_branch_list DEFINITION FINAL.
|
|||
IMPORTING iv_branch_name TYPE clike
|
||||
RETURNING VALUE(rv_name) TYPE string.
|
||||
|
||||
CLASS-METHODS normalize_branch_name
|
||||
IMPORTING iv_branch_name TYPE clike
|
||||
RETURNING VALUE(rv_name) TYPE string.
|
||||
|
||||
PRIVATE SECTION.
|
||||
DATA mt_branches TYPE ty_git_branch_list_tt.
|
||||
DATA mv_head_symref TYPE string.
|
||||
|
@ -178,6 +185,10 @@ CLASS lcl_git_branch_list IMPLEMENTATION.
|
|||
ev_head_symref = me->mv_head_symref ).
|
||||
ENDMETHOD. "create
|
||||
|
||||
METHOD get_head_symref.
|
||||
rv_head_symref = mv_head_symref.
|
||||
ENDMETHOD. " get_head_symref.
|
||||
|
||||
METHOD find_by_name.
|
||||
|
||||
IF iv_branch_name IS INITIAL.
|
||||
|
@ -197,7 +208,7 @@ CLASS lcl_git_branch_list IMPLEMENTATION.
|
|||
IF mv_head_symref IS NOT INITIAL.
|
||||
rs_branch = find_by_name( mv_head_symref ).
|
||||
ELSE.
|
||||
rs_branch = find_by_name( head_name ).
|
||||
rs_branch = find_by_name( c_head_name ).
|
||||
ENDIF.
|
||||
|
||||
ENDMETHOD. "get_head
|
||||
|
@ -246,7 +257,7 @@ CLASS lcl_git_branch_list IMPLEMENTATION.
|
|||
<ls_branch>-name = lv_name.
|
||||
<ls_branch>-display_name = get_display_name( lv_name ).
|
||||
<ls_branch>-type = get_type( lv_name ).
|
||||
IF <ls_branch>-name = head_name OR <ls_branch>-name = ev_head_symref.
|
||||
IF <ls_branch>-name = c_head_name OR <ls_branch>-name = ev_head_symref.
|
||||
<ls_branch>-is_head = abap_true.
|
||||
ENDIF.
|
||||
ENDLOOP.
|
||||
|
@ -295,7 +306,7 @@ CLASS lcl_git_branch_list IMPLEMENTATION.
|
|||
METHOD get_type.
|
||||
rv_type = c_type-other.
|
||||
|
||||
IF iv_branch_name CP 'refs/heads/*' OR iv_branch_name = head_name.
|
||||
IF iv_branch_name CP 'refs/heads/*' OR iv_branch_name = c_head_name.
|
||||
rv_type = c_type-branch.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
@ -334,4 +345,11 @@ CLASS lcl_git_branch_list IMPLEMENTATION.
|
|||
ENDLOOP.
|
||||
ENDMETHOD. "get_tags_only
|
||||
|
||||
METHOD normalize_branch_name.
|
||||
|
||||
rv_name = iv_branch_name. " Force convert to string
|
||||
REPLACE ALL OCCURRENCES OF ` ` IN rv_name WITH '-'. " Disallow space in branch name
|
||||
|
||||
ENDMETHOD. " normalize_branch_name.
|
||||
|
||||
ENDCLASS. "lcl_git_branch_list
|
|
@ -332,8 +332,7 @@ CLASS lcl_html_toolbar IMPLEMENTATION.
|
|||
METHOD render. "TODO refactor
|
||||
|
||||
DATA: lv_class TYPE string,
|
||||
lv_is_drop TYPE abap_bool,
|
||||
lv_last TYPE abap_bool.
|
||||
lv_is_drop TYPE abap_bool.
|
||||
|
||||
FIELD-SYMBOLS <ls_item> LIKE LINE OF mt_items.
|
||||
|
||||
|
@ -359,13 +358,8 @@ CLASS lcl_html_toolbar IMPLEMENTATION.
|
|||
IF iv_as_angle = abap_true.
|
||||
ro_html->add( '<div class="dropbtn_angle"></div>' ).
|
||||
ELSE.
|
||||
lv_class = 'dropbtn'.
|
||||
IF iv_no_separator = abap_true.
|
||||
lv_class = lv_class && ' menu_end' ##NO_TEXT.
|
||||
ENDIF.
|
||||
|
||||
ro_html->add_a( iv_txt = iv_as_droplist_with_label
|
||||
iv_class = lv_class
|
||||
iv_class = 'dropbtn'
|
||||
iv_act = '' ).
|
||||
ENDIF.
|
||||
|
||||
|
@ -386,15 +380,8 @@ CLASS lcl_html_toolbar IMPLEMENTATION.
|
|||
ENDIF.
|
||||
|
||||
LOOP AT mt_items ASSIGNING <ls_item>.
|
||||
lv_last = boolc( sy-tabix = lines( mt_items ) ).
|
||||
|
||||
IF <ls_item>-sub IS INITIAL.
|
||||
CLEAR lv_class.
|
||||
IF iv_no_separator = abap_true
|
||||
OR lv_last = abap_true
|
||||
AND iv_as_droplist_with_label IS INITIAL.
|
||||
lv_class = 'menu_end'.
|
||||
ENDIF.
|
||||
|
||||
IF iv_with_icons = abap_true.
|
||||
ro_html->add( '<tr>' ).
|
||||
|
@ -405,8 +392,7 @@ CLASS lcl_html_toolbar IMPLEMENTATION.
|
|||
ro_html->add_a( iv_txt = <ls_item>-txt
|
||||
iv_act = <ls_item>-act
|
||||
iv_opt = <ls_item>-opt
|
||||
iv_typ = <ls_item>-typ
|
||||
iv_class = lv_class ).
|
||||
iv_typ = <ls_item>-typ ).
|
||||
|
||||
IF iv_with_icons = abap_true.
|
||||
ro_html->add( '</td>' ).
|
||||
|
@ -414,9 +400,7 @@ CLASS lcl_html_toolbar IMPLEMENTATION.
|
|||
ENDIF.
|
||||
|
||||
ELSE.
|
||||
ro_html->add( <ls_item>-sub->render(
|
||||
iv_as_droplist_with_label = <ls_item>-txt
|
||||
iv_no_separator = lv_last ) ).
|
||||
ro_html->add( <ls_item>-sub->render( iv_as_droplist_with_label = <ls_item>-txt ) ).
|
||||
ENDIF.
|
||||
|
||||
ENDLOOP.
|
||||
|
@ -426,7 +410,8 @@ CLASS lcl_html_toolbar IMPLEMENTATION.
|
|||
ENDIF.
|
||||
|
||||
IF lv_is_drop = abap_true. " Dropdown
|
||||
ro_html->add( '</div></div>' ).
|
||||
ro_html->add( '</div>' ).
|
||||
ro_html->add( '</div>' ).
|
||||
ENDIF.
|
||||
|
||||
ro_html->add( '</div>' ).
|
||||
|
|
|
@ -162,7 +162,8 @@ CLASS lcl_gui_chunk_lib IMPLEMENTATION.
|
|||
|
||||
lv_text = lcl_git_branch_list=>get_display_name( iv_branch ).
|
||||
|
||||
IF iv_branch = io_repo->get_head_branch_name( ) OR iv_branch = lcl_git_branch_list=>head_name.
|
||||
IF iv_branch = io_repo->get_head_branch_name( )
|
||||
OR iv_branch = lcl_git_branch_list=>c_head_name.
|
||||
lv_class = 'branch branch_head'.
|
||||
ELSEIF lcl_git_branch_list=>get_type( iv_branch ) = lcl_git_branch_list=>c_type-branch.
|
||||
lv_class = 'branch branch_branch'.
|
||||
|
|
|
@ -8,6 +8,11 @@
|
|||
*
|
||||
*----------------------------------------------------------------------*
|
||||
INTERFACE lif_object_oriented_object.
|
||||
TYPES: BEGIN OF ty_includes,
|
||||
programm TYPE programm,
|
||||
END OF ty_includes,
|
||||
ty_includes_tt TYPE STANDARD TABLE OF ty_includes WITH DEFAULT KEY.
|
||||
|
||||
METHODS:
|
||||
create
|
||||
IMPORTING
|
||||
|
@ -62,7 +67,12 @@ INTERFACE lif_object_oriented_object.
|
|||
iv_object_name TYPE dokhl-object
|
||||
iv_language TYPE spras
|
||||
RAISING
|
||||
lcx_exception.
|
||||
lcx_exception,
|
||||
get_includes
|
||||
IMPORTING
|
||||
iv_object_name TYPE sobj_name
|
||||
RETURNING
|
||||
VALUE(rt_includes) TYPE ty_includes_tt.
|
||||
ENDINTERFACE.
|
||||
|
||||
CLASS lcl_object_oriented_base DEFINITION ABSTRACT.
|
||||
|
@ -85,7 +95,7 @@ CLASS lcl_object_oriented_base IMPLEMENTATION.
|
|||
|
||||
METHOD lif_object_oriented_object~create.
|
||||
"Subclass responsibility
|
||||
RETURN.
|
||||
ASSERT 0 = 1.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD lif_object_oriented_object~deserialize_source.
|
||||
|
@ -102,7 +112,7 @@ CLASS lcl_object_oriented_base IMPLEMENTATION.
|
|||
|
||||
METHOD lif_object_oriented_object~generate_locals.
|
||||
"Subclass responsibility
|
||||
RETURN.
|
||||
ASSERT 0 = 1.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD deserialize_abap_source_old.
|
||||
|
@ -172,12 +182,12 @@ CLASS lcl_object_oriented_base IMPLEMENTATION.
|
|||
ENDMETHOD.
|
||||
METHOD lif_object_oriented_object~insert_text_pool.
|
||||
"Subclass responsibility
|
||||
RETURN.
|
||||
ASSERT 0 = 1.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD lif_object_oriented_object~create_sotr.
|
||||
"Subclass responsibility
|
||||
RETURN.
|
||||
ASSERT 0 = 1.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD lif_object_oriented_object~create_documentation.
|
||||
|
@ -196,6 +206,11 @@ CLASS lcl_object_oriented_base IMPLEMENTATION.
|
|||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD lif_object_oriented_object~get_includes.
|
||||
"Subclass responsibility
|
||||
ASSERT 0 = 1.
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
|
@ -206,7 +221,8 @@ CLASS lcl_object_oriented_class DEFINITION
|
|||
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.
|
||||
lif_object_oriented_object~create_sotr REDEFINITION,
|
||||
lif_object_oriented_object~get_includes REDEFINITION.
|
||||
|
||||
ENDCLASS.
|
||||
CLASS lcl_object_oriented_class IMPLEMENTATION.
|
||||
|
@ -325,13 +341,44 @@ CLASS lcl_object_oriented_class IMPLEMENTATION.
|
|||
ENDLOOP.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD lif_object_oriented_object~get_includes.
|
||||
* note: includes returned might not exist
|
||||
* method cl_oo_classname_service=>GET_ALL_CLASS_INCLUDES does not exist in 702
|
||||
|
||||
DATA: lv_class_name TYPE seoclsname,
|
||||
lt_methods TYPE seop_methods_w_include.
|
||||
|
||||
FIELD-SYMBOLS: <ls_method> LIKE LINE OF lt_methods.
|
||||
|
||||
lv_class_name = iv_object_name.
|
||||
|
||||
APPEND cl_oo_classname_service=>get_ccdef_name( lv_class_name ) TO rt_includes.
|
||||
APPEND cl_oo_classname_service=>get_ccmac_name( lv_class_name ) TO rt_includes.
|
||||
APPEND cl_oo_classname_service=>get_ccimp_name( lv_class_name ) TO rt_includes.
|
||||
APPEND cl_oo_classname_service=>get_cl_name( lv_class_name ) TO rt_includes.
|
||||
APPEND cl_oo_classname_service=>get_ccau_name( lv_class_name ) TO rt_includes.
|
||||
APPEND cl_oo_classname_service=>get_pubsec_name( lv_class_name ) TO rt_includes.
|
||||
APPEND cl_oo_classname_service=>get_prosec_name( lv_class_name ) TO rt_includes.
|
||||
APPEND cl_oo_classname_service=>get_prisec_name( lv_class_name ) TO rt_includes.
|
||||
APPEND cl_oo_classname_service=>get_classpool_name( lv_class_name ) TO rt_includes.
|
||||
APPEND cl_oo_classname_service=>get_ct_name( lv_class_name ) TO rt_includes.
|
||||
APPEND cl_oo_classname_service=>get_cs_name( lv_class_name ) TO rt_includes.
|
||||
|
||||
lt_methods = cl_oo_classname_service=>get_all_method_includes( lv_class_name ).
|
||||
LOOP AT lt_methods ASSIGNING <ls_method>.
|
||||
APPEND <ls_method>-incname TO rt_includes.
|
||||
ENDLOOP.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lcl_object_oriented_interface DEFINITION
|
||||
INHERITING FROM lcl_object_oriented_base.
|
||||
PUBLIC SECTION.
|
||||
METHODS:
|
||||
lif_object_oriented_object~create REDEFINITION.
|
||||
lif_object_oriented_object~create REDEFINITION,
|
||||
lif_object_oriented_object~get_includes REDEFINITION.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lcl_object_oriented_interface IMPLEMENTATION.
|
||||
|
@ -354,6 +401,12 @@ CLASS lcl_object_oriented_interface IMPLEMENTATION.
|
|||
lcx_exception=>raise( 'Error from SEO_INTERFACE_CREATE_COMPLETE' ).
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
METHOD lif_object_oriented_object~get_includes.
|
||||
DATA lv_interface_name TYPE seoclsname.
|
||||
lv_interface_name = iv_object_name.
|
||||
APPEND cl_oo_classname_service=>get_interfacepool_name( lv_interface_name ) TO rt_includes.
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lth_oo_factory_injector DEFINITION DEFERRED.
|
||||
|
@ -403,6 +456,11 @@ CLASS lcl_object_clas DEFINITION INHERITING FROM lcl_objects_program.
|
|||
PUBLIC SECTION.
|
||||
INTERFACES lif_object.
|
||||
ALIASES mo_files FOR lif_object~mo_files.
|
||||
METHODS constructor
|
||||
IMPORTING
|
||||
is_item TYPE ty_item
|
||||
iv_language TYPE spras.
|
||||
|
||||
PROTECTED SECTION.
|
||||
METHODS deserialize_abap
|
||||
IMPORTING io_xml TYPE REF TO lcl_xml_input
|
||||
|
@ -474,10 +532,6 @@ CLASS lcl_object_clas DEFINITION INHERITING FROM lcl_objects_program.
|
|||
|
||||
METHODS reduce
|
||||
CHANGING ct_source TYPE ty_string_tt.
|
||||
|
||||
METHODS get_all_class_includes
|
||||
RETURNING VALUE(rt_includes) TYPE seoincl_t.
|
||||
|
||||
ENDCLASS. "lcl_object_dtel DEFINITION
|
||||
|
||||
*----------------------------------------------------------------------*
|
||||
|
@ -487,78 +541,22 @@ ENDCLASS. "lcl_object_dtel DEFINITION
|
|||
*----------------------------------------------------------------------*
|
||||
CLASS lcl_object_clas IMPLEMENTATION.
|
||||
|
||||
METHOD get_all_class_includes.
|
||||
* note: includes returned might not exist
|
||||
* method cl_oo_classname_service=>GET_ALL_CLASS_INCLUDES does not exist in 702
|
||||
|
||||
DATA: lv_clsname TYPE seoclsname,
|
||||
lt_methods TYPE seop_methods_w_include.
|
||||
|
||||
FIELD-SYMBOLS: <ls_method> LIKE LINE OF lt_methods.
|
||||
|
||||
|
||||
lv_clsname = ms_item-obj_name.
|
||||
|
||||
APPEND cl_oo_classname_service=>get_ccdef_name( lv_clsname ) TO rt_includes.
|
||||
APPEND cl_oo_classname_service=>get_ccmac_name( lv_clsname ) TO rt_includes.
|
||||
APPEND cl_oo_classname_service=>get_ccimp_name( lv_clsname ) TO rt_includes.
|
||||
APPEND cl_oo_classname_service=>get_cl_name( lv_clsname ) TO rt_includes.
|
||||
APPEND cl_oo_classname_service=>get_ccau_name( lv_clsname ) TO rt_includes.
|
||||
APPEND cl_oo_classname_service=>get_pubsec_name( lv_clsname ) TO rt_includes.
|
||||
APPEND cl_oo_classname_service=>get_prosec_name( lv_clsname ) TO rt_includes.
|
||||
APPEND cl_oo_classname_service=>get_prisec_name( lv_clsname ) TO rt_includes.
|
||||
APPEND cl_oo_classname_service=>get_classpool_name( lv_clsname ) TO rt_includes.
|
||||
APPEND cl_oo_classname_service=>get_ct_name( lv_clsname ) TO rt_includes.
|
||||
APPEND cl_oo_classname_service=>get_cs_name( lv_clsname ) TO rt_includes.
|
||||
|
||||
lt_methods = cl_oo_classname_service=>get_all_method_includes( lv_clsname ).
|
||||
LOOP AT lt_methods ASSIGNING <ls_method>.
|
||||
APPEND <ls_method>-incname TO rt_includes.
|
||||
ENDLOOP.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD lif_object~has_changed_since.
|
||||
DATA:
|
||||
lt_includes TYPE seoincl_t.
|
||||
|
||||
DATA: lv_clsname TYPE seoclsname,
|
||||
lv_program TYPE program,
|
||||
lt_incl TYPE seoincl_t.
|
||||
|
||||
FIELD-SYMBOLS <incl> LIKE LINE OF lt_incl.
|
||||
|
||||
lv_clsname = ms_item-obj_name.
|
||||
|
||||
CASE ms_item-obj_type.
|
||||
WHEN 'CLAS'.
|
||||
TRY.
|
||||
CALL METHOD cl_oo_classname_service=>('GET_ALL_CLASS_INCLUDES')
|
||||
EXPORTING
|
||||
class_name = lv_clsname
|
||||
RECEIVING
|
||||
result = lt_incl.
|
||||
CATCH cx_sy_dyn_call_illegal_method.
|
||||
* method does not exist in 702, just report everything as changed
|
||||
rv_changed = abap_true.
|
||||
ENDTRY.
|
||||
LOOP AT lt_incl ASSIGNING <incl>.
|
||||
rv_changed = check_prog_changed_since(
|
||||
iv_program = <incl>
|
||||
iv_timestamp = iv_timestamp
|
||||
iv_skip_gui = abap_true ).
|
||||
IF rv_changed = abap_true.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
ENDLOOP.
|
||||
WHEN 'INTF'.
|
||||
lv_program = cl_oo_classname_service=>get_interfacepool_name( lv_clsname ).
|
||||
rv_changed = check_prog_changed_since(
|
||||
iv_program = lv_program
|
||||
iv_timestamp = iv_timestamp
|
||||
iv_skip_gui = abap_true ).
|
||||
WHEN OTHERS.
|
||||
lcx_exception=>raise( 'class delete, unknown type' ).
|
||||
ENDCASE.
|
||||
FIELD-SYMBOLS <incl> LIKE LINE OF lt_includes.
|
||||
|
||||
lt_includes = mo_object_oriented_object->get_includes( ms_item-obj_name ).
|
||||
LOOP AT lt_includes ASSIGNING <incl>.
|
||||
rv_changed = check_prog_changed_since(
|
||||
iv_program = <incl>
|
||||
iv_timestamp = iv_timestamp
|
||||
iv_skip_gui = abap_true ).
|
||||
IF rv_changed = abap_true.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
ENDLOOP.
|
||||
ENDMETHOD. "lif_object~has_changed_since
|
||||
|
||||
METHOD lif_object~get_metadata.
|
||||
|
@ -579,21 +577,10 @@ CLASS lcl_object_clas IMPLEMENTATION.
|
|||
|
||||
DATA: lt_reposrc TYPE STANDARD TABLE OF ty_reposrc,
|
||||
ls_reposrc LIKE LINE OF lt_reposrc,
|
||||
lt_includes TYPE STANDARD TABLE OF ty_includes,
|
||||
lv_clsname TYPE seoclsname.
|
||||
lt_includes TYPE STANDARD TABLE OF ty_includes.
|
||||
|
||||
|
||||
lv_clsname = ms_item-obj_name.
|
||||
|
||||
CASE ms_item-obj_type.
|
||||
WHEN 'CLAS'.
|
||||
lt_includes = get_all_class_includes( ).
|
||||
ASSERT lines( lt_includes ) > 0.
|
||||
WHEN 'INTF'.
|
||||
APPEND cl_oo_classname_service=>get_interfacepool_name( lv_clsname ) TO lt_includes.
|
||||
WHEN OTHERS.
|
||||
ASSERT 0 = 1.
|
||||
ENDCASE.
|
||||
lt_includes = mo_object_oriented_object->get_includes( ms_item-obj_name ).
|
||||
ASSERT lines( lt_includes ) > 0.
|
||||
|
||||
SELECT unam udat utime FROM reposrc
|
||||
INTO TABLE lt_reposrc
|
||||
|
@ -1099,9 +1086,6 @@ CLASS lcl_object_clas IMPLEMENTATION.
|
|||
ENDMETHOD. "serialize_xml
|
||||
|
||||
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 ).
|
||||
|
||||
|
@ -1237,6 +1221,13 @@ CLASS lcl_object_clas IMPLEMENTATION.
|
|||
CREATE OBJECT ro_comparison_result TYPE lcl_null_comparison_result.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD constructor.
|
||||
super->constructor(
|
||||
is_item = is_item
|
||||
iv_language = iv_language ).
|
||||
mo_object_oriented_object = lcl_object_oriented_factory=>make( iv_object_type = ms_item-obj_type ).
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS. "lcl_object_CLAS IMPLEMENTATION
|
||||
|
||||
*----------------------------------------------------------------------*
|
||||
|
@ -1249,15 +1240,14 @@ CLASS lcl_object_intf DEFINITION INHERITING FROM lcl_object_clas FINAL.
|
|||
* https://github.com/larshp/abapGit/issues/21
|
||||
PUBLIC SECTION.
|
||||
METHODS:
|
||||
lif_object~deserialize REDEFINITION.
|
||||
lif_object~deserialize REDEFINITION,
|
||||
lif_object~has_changed_since 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 ).
|
||||
|
||||
|
@ -1294,4 +1284,18 @@ CLASS lcl_object_intf IMPLEMENTATION.
|
|||
|
||||
mo_object_oriented_object->add_to_activation_list( is_item = ms_item ).
|
||||
ENDMETHOD.
|
||||
METHOD lif_object~has_changed_since.
|
||||
DATA:
|
||||
lv_program TYPE program,
|
||||
lt_includes TYPE seoincl_t.
|
||||
|
||||
lt_includes = mo_object_oriented_object->get_includes( ms_item-obj_name ).
|
||||
READ TABLE lt_includes INDEX 1 INTO lv_program.
|
||||
"lv_program = cl_oo_classname_service=>get_interfacepool_name( lv_clsname ).
|
||||
rv_changed = check_prog_changed_since(
|
||||
iv_program = lv_program
|
||||
iv_timestamp = iv_timestamp
|
||||
iv_skip_gui = abap_true ).
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
File diff suppressed because it is too large
Load Diff
|
@ -7,32 +7,40 @@ CLASS lcl_gui_page_diff DEFINITION FINAL INHERITING FROM lcl_gui_page.
|
|||
PUBLIC SECTION.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_mod,
|
||||
BEGIN OF c_fstate,
|
||||
local TYPE char1 VALUE 'L',
|
||||
remote TYPE char1 VALUE 'R',
|
||||
both TYPE char1 VALUE 'B',
|
||||
END OF c_mod.
|
||||
END OF c_fstate.
|
||||
|
||||
TYPES: BEGIN OF ty_file_diff,
|
||||
filename TYPE string,
|
||||
lstate TYPE char1,
|
||||
rstate TYPE char1,
|
||||
mod TYPE char1, " Abstraction for shorter ifs
|
||||
fstate TYPE char1, " FILE state - Abstraction for shorter ifs
|
||||
o_diff TYPE REF TO lcl_diff,
|
||||
END OF ty_file_diff,
|
||||
tt_file_diff TYPE STANDARD TABLE OF ty_file_diff.
|
||||
|
||||
METHODS: constructor
|
||||
IMPORTING iv_key TYPE lcl_persistence_repo=>ty_repo-key
|
||||
is_file TYPE ty_file OPTIONAL
|
||||
is_object TYPE ty_item OPTIONAL
|
||||
RAISING lcx_exception.
|
||||
METHODS:
|
||||
constructor
|
||||
IMPORTING iv_key TYPE lcl_persistence_repo=>ty_repo-key
|
||||
is_file TYPE ty_file OPTIONAL
|
||||
is_object TYPE ty_item OPTIONAL
|
||||
RAISING lcx_exception,
|
||||
lif_gui_page~on_event REDEFINITION.
|
||||
|
||||
PROTECTED SECTION.
|
||||
METHODS render_content REDEFINITION.
|
||||
|
||||
PRIVATE SECTION.
|
||||
DATA: mt_diff_files TYPE tt_file_diff.
|
||||
CONSTANTS: BEGIN OF c_actions,
|
||||
toggle_unified TYPE string VALUE 'toggle_unified',
|
||||
END OF c_actions.
|
||||
|
||||
DATA: mt_diff_files TYPE tt_file_diff,
|
||||
mt_delayed_lines TYPE lcl_diff=>ty_diffs_tt,
|
||||
mv_unified TYPE abap_bool VALUE abap_true.
|
||||
|
||||
METHODS render_diff
|
||||
IMPORTING is_diff TYPE ty_file_diff
|
||||
|
@ -49,16 +57,20 @@ CLASS lcl_gui_page_diff DEFINITION FINAL INHERITING FROM lcl_gui_page.
|
|||
IMPORTING is_diff_line TYPE lcl_diff=>ty_diff
|
||||
is_diff TYPE ty_file_diff
|
||||
RETURNING VALUE(ro_html) TYPE REF TO lcl_html.
|
||||
METHODS get_line_hl
|
||||
IMPORTING iv_mod TYPE char1
|
||||
iv_result TYPE lcl_diff=>ty_diff-result
|
||||
EXPORTING ev_lattr TYPE string
|
||||
ev_rattr TYPE string.
|
||||
METHODS render_line_split
|
||||
IMPORTING is_diff_line TYPE lcl_diff=>ty_diff
|
||||
iv_fstate TYPE char1
|
||||
RETURNING VALUE(ro_html) TYPE REF TO lcl_html.
|
||||
METHODS render_line_unified
|
||||
IMPORTING is_diff_line TYPE lcl_diff=>ty_diff OPTIONAL
|
||||
RETURNING VALUE(ro_html) TYPE REF TO lcl_html.
|
||||
METHODS append_diff
|
||||
IMPORTING it_remote TYPE ty_files_tt
|
||||
it_local TYPE ty_files_item_tt
|
||||
is_status TYPE ty_result
|
||||
RAISING lcx_exception.
|
||||
METHODS build_menu
|
||||
RETURNING VALUE(ro_menu) TYPE REF TO lcl_html_toolbar.
|
||||
|
||||
ENDCLASS. "lcl_gui_page_diff
|
||||
|
||||
|
@ -75,6 +87,8 @@ CLASS lcl_gui_page_diff IMPLEMENTATION.
|
|||
|
||||
super->constructor( ).
|
||||
ms_control-page_title = 'DIFF'.
|
||||
ms_control-page_menu = build_menu( ).
|
||||
mv_unified = lcl_app=>user( )->get_diff_unified( ).
|
||||
|
||||
ASSERT is_file IS INITIAL OR is_object IS INITIAL. " just one passed
|
||||
|
||||
|
@ -154,14 +168,14 @@ CLASS lcl_gui_page_diff IMPLEMENTATION.
|
|||
<ls_diff>-rstate = is_status-rstate.
|
||||
|
||||
IF <ls_diff>-lstate IS NOT INITIAL AND <ls_diff>-rstate IS NOT INITIAL.
|
||||
<ls_diff>-mod = c_mod-both.
|
||||
<ls_diff>-fstate = c_fstate-both.
|
||||
ELSEIF <ls_diff>-lstate IS NOT INITIAL.
|
||||
<ls_diff>-mod = c_mod-local.
|
||||
<ls_diff>-fstate = c_fstate-local.
|
||||
ELSE. "rstate IS NOT INITIAL, lstate = empty.
|
||||
<ls_diff>-mod = c_mod-remote.
|
||||
<ls_diff>-fstate = c_fstate-remote.
|
||||
ENDIF.
|
||||
|
||||
IF <ls_diff>-mod = c_mod-remote. " Remote file leading changes
|
||||
IF <ls_diff>-fstate = c_fstate-remote. " Remote file leading changes
|
||||
CREATE OBJECT <ls_diff>-o_diff
|
||||
EXPORTING
|
||||
iv_new = <ls_remote>-data
|
||||
|
@ -175,45 +189,46 @@ CLASS lcl_gui_page_diff IMPLEMENTATION.
|
|||
|
||||
ENDMETHOD. "append_diff
|
||||
|
||||
METHOD render_diff_head.
|
||||
DATA: lo_html TYPE REF TO lcl_html,
|
||||
ls_stats TYPE lcl_diff=>ty_count.
|
||||
METHOD build_menu.
|
||||
CREATE OBJECT ro_menu.
|
||||
ro_menu->add( iv_txt = 'Split/Unified view'
|
||||
iv_act = c_actions-toggle_unified ) ##NO_TEXT.
|
||||
ENDMETHOD. " build_menu.
|
||||
|
||||
CREATE OBJECT lo_html.
|
||||
**********************************************************************
|
||||
* EVENT HANDLING
|
||||
**********************************************************************
|
||||
|
||||
ls_stats = is_diff-o_diff->stats( ).
|
||||
METHOD lif_gui_page~on_event.
|
||||
|
||||
IF is_diff-mod = c_mod-both. " Merge stats into 'update' if both were changed
|
||||
ls_stats-update = ls_stats-update + ls_stats-insert + ls_stats-delete.
|
||||
CLEAR: ls_stats-insert, ls_stats-delete.
|
||||
ENDIF.
|
||||
CASE iv_action.
|
||||
WHEN c_actions-toggle_unified. " Toggle file diplay
|
||||
mv_unified = lcl_app=>user( )->toggle_diff_unified( ).
|
||||
ev_state = gc_event_state-re_render.
|
||||
ENDCASE.
|
||||
|
||||
lo_html->add( '<div class="diff_head">' ). "#EC NOTEXT
|
||||
lo_html->add( |<span class="diff_banner diff_ins">+ { ls_stats-insert }</span>| ).
|
||||
lo_html->add( |<span class="diff_banner diff_del">- { ls_stats-delete }</span>| ).
|
||||
lo_html->add( |<span class="diff_banner diff_upd">~ { ls_stats-update }</span>| ).
|
||||
lo_html->add( |<span class="diff_name">{ is_diff-filename }</span>| ). "#EC NOTEXT
|
||||
lo_html->add( lcl_gui_chunk_lib=>render_item_state( iv1 = is_diff-lstate
|
||||
iv2 = is_diff-rstate ) ).
|
||||
lo_html->add( '</div>' ). "#EC NOTEXT
|
||||
ENDMETHOD. "lif_gui_page~on_event
|
||||
|
||||
ro_html = lo_html.
|
||||
ENDMETHOD.
|
||||
**********************************************************************
|
||||
* RENDER LOGIC
|
||||
**********************************************************************
|
||||
|
||||
METHOD render_table_head.
|
||||
METHOD render_content.
|
||||
|
||||
DATA ls_diff_file LIKE LINE OF mt_diff_files.
|
||||
|
||||
CREATE OBJECT ro_html.
|
||||
|
||||
ro_html->add( '<thead class="header">' ). "#EC NOTEXT
|
||||
ro_html->add( '<tr>' ). "#EC NOTEXT
|
||||
ro_html->add( '<th class="num"></th>' ). "#EC NOTEXT
|
||||
ro_html->add( '<th>LOCAL</th>' ). "#EC NOTEXT
|
||||
ro_html->add( '<th class="num"></th>' ). "#EC NOTEXT
|
||||
ro_html->add( '<th>REMOTE</th>' ). "#EC NOTEXT
|
||||
ro_html->add( '</tr>' ). "#EC NOTEXT
|
||||
ro_html->add( '</thead>' ). "#EC NOTEXT
|
||||
LOOP AT mt_diff_files INTO ls_diff_file.
|
||||
lcl_progress=>show( iv_key = 'Diff'
|
||||
iv_current = sy-tabix
|
||||
iv_total = lines( mt_diff_files )
|
||||
iv_text = |Render Diff - { ls_diff_file-filename }| ).
|
||||
|
||||
ENDMETHOD. " render_table_head.
|
||||
ro_html->add( render_diff( ls_diff_file ) ).
|
||||
ENDLOOP.
|
||||
|
||||
ENDMETHOD. "render_content
|
||||
|
||||
METHOD render_diff.
|
||||
|
||||
|
@ -232,11 +247,70 @@ CLASS lcl_gui_page_diff IMPLEMENTATION.
|
|||
|
||||
ro_html->add( '</div>' ). "#EC NOTEXT
|
||||
|
||||
ENDMETHOD. " render_diff
|
||||
|
||||
**********************************************************************
|
||||
* CHUNKS
|
||||
**********************************************************************
|
||||
|
||||
METHOD render_diff_head.
|
||||
|
||||
DATA: ls_stats TYPE lcl_diff=>ty_count.
|
||||
|
||||
CREATE OBJECT ro_html.
|
||||
ls_stats = is_diff-o_diff->stats( ).
|
||||
|
||||
IF is_diff-fstate = c_fstate-both. " Merge stats into 'update' if both were changed
|
||||
ls_stats-update = ls_stats-update + ls_stats-insert + ls_stats-delete.
|
||||
CLEAR: ls_stats-insert, ls_stats-delete.
|
||||
ENDIF.
|
||||
|
||||
ro_html->add( '<div class="diff_head">' ). "#EC NOTEXT
|
||||
|
||||
ro_html->add( |<span class="diff_banner diff_ins">+ { ls_stats-insert }</span>| ).
|
||||
ro_html->add( |<span class="diff_banner diff_del">- { ls_stats-delete }</span>| ).
|
||||
ro_html->add( |<span class="diff_banner diff_upd">~ { ls_stats-update }</span>| ).
|
||||
ro_html->add( |<span class="diff_name">{ is_diff-filename }</span>| ). "#EC NOTEXT
|
||||
ro_html->add( lcl_gui_chunk_lib=>render_item_state( iv1 = is_diff-lstate
|
||||
iv2 = is_diff-rstate ) ).
|
||||
|
||||
IF is_diff-fstate = c_fstate-both AND mv_unified = abap_true.
|
||||
ro_html->add( '<span class="attention pad-sides">Attention: Unified mode'
|
||||
&& ' highlighting for MM assumes local file is newer ! </span>' ). "#EC NOTEXT
|
||||
ENDIF.
|
||||
|
||||
ro_html->add( '</div>' ). "#EC NOTEXT
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD render_table_head.
|
||||
|
||||
CREATE OBJECT ro_html.
|
||||
|
||||
IF mv_unified = abap_true.
|
||||
ro_html->add( '<thead class="header">' ). "#EC NOTEXT
|
||||
ro_html->add( '<tr>' ). "#EC NOTEXT
|
||||
ro_html->add( '<th class="num">old</th>' ). "#EC NOTEXT
|
||||
ro_html->add( '<th class="num">new</th>' ). "#EC NOTEXT
|
||||
ro_html->add( '<th>code</th>' ). "#EC NOTEXT
|
||||
ro_html->add( '</tr>' ). "#EC NOTEXT
|
||||
ro_html->add( '</thead>' ). "#EC NOTEXT
|
||||
ELSE.
|
||||
ro_html->add( '<thead class="header">' ). "#EC NOTEXT
|
||||
ro_html->add( '<tr>' ). "#EC NOTEXT
|
||||
ro_html->add( '<th class="num"></th>' ). "#EC NOTEXT
|
||||
ro_html->add( '<th>LOCAL</th>' ). "#EC NOTEXT
|
||||
ro_html->add( '<th class="num"></th>' ). "#EC NOTEXT
|
||||
ro_html->add( '<th>REMOTE</th>' ). "#EC NOTEXT
|
||||
ro_html->add( '</tr>' ). "#EC NOTEXT
|
||||
ro_html->add( '</thead>' ). "#EC NOTEXT
|
||||
ENDIF.
|
||||
|
||||
ENDMETHOD. " render_table_head.
|
||||
|
||||
METHOD render_beacon.
|
||||
|
||||
DATA: lv_beacon TYPE string.
|
||||
DATA: lv_beacon TYPE string.
|
||||
|
||||
CREATE OBJECT ro_html.
|
||||
|
||||
|
@ -246,10 +320,19 @@ CLASS lcl_gui_page_diff IMPLEMENTATION.
|
|||
lv_beacon = '---'.
|
||||
ENDIF.
|
||||
|
||||
|
||||
ro_html->add( '<thead class="nav_line">' ).
|
||||
ro_html->add( '<tr>' ).
|
||||
ro_html->add( '<th class="num"></th>' ).
|
||||
ro_html->add( |<th colspan="3">@@ { is_diff_line-new_line } @@ { lv_beacon }</th>| ).
|
||||
|
||||
IF mv_unified = abap_true.
|
||||
ro_html->add( '<th class="num"></th>' ).
|
||||
ro_html->add( '<th class="num"></th>' ).
|
||||
ro_html->add( |<th>@@ { is_diff_line-new_num } @@ { lv_beacon }</th>| ).
|
||||
ELSE.
|
||||
ro_html->add( '<th class="num"></th>' ).
|
||||
ro_html->add( |<th colspan="3">@@ { is_diff_line-new_num } @@ { lv_beacon }</th>| ).
|
||||
ENDIF.
|
||||
|
||||
ro_html->add( '</tr>' ).
|
||||
ro_html->add( '</thead>' ).
|
||||
|
||||
|
@ -259,10 +342,6 @@ CLASS lcl_gui_page_diff IMPLEMENTATION.
|
|||
|
||||
DATA: lo_highlighter TYPE REF TO lcl_syntax_highlighter,
|
||||
lt_diffs TYPE lcl_diff=>ty_diffs_tt,
|
||||
lv_local TYPE string,
|
||||
lv_remote TYPE string,
|
||||
lv_lattr TYPE string,
|
||||
lv_rattr TYPE string,
|
||||
lv_insert_nav TYPE abap_bool.
|
||||
|
||||
FIELD-SYMBOLS <ls_diff> LIKE LINE OF lt_diffs.
|
||||
|
@ -283,83 +362,125 @@ CLASS lcl_gui_page_diff IMPLEMENTATION.
|
|||
lv_insert_nav = abap_false.
|
||||
ENDIF.
|
||||
|
||||
IF is_diff-mod = c_mod-remote. " Remote file leading changes
|
||||
lv_local = <ls_diff>-old.
|
||||
lv_remote = <ls_diff>-new.
|
||||
ELSE. " Local leading changes or both were modified
|
||||
lv_local = <ls_diff>-new.
|
||||
lv_remote = <ls_diff>-old.
|
||||
ENDIF.
|
||||
|
||||
IF lo_highlighter IS BOUND.
|
||||
lv_local = lo_highlighter->process_line( lv_local ).
|
||||
lv_remote = lo_highlighter->process_line( lv_remote ).
|
||||
<ls_diff>-new = lo_highlighter->process_line( <ls_diff>-new ).
|
||||
<ls_diff>-old = lo_highlighter->process_line( <ls_diff>-old ).
|
||||
ELSE.
|
||||
lv_local = escape( val = lv_local format = cl_abap_format=>e_html_attr ).
|
||||
lv_remote = escape( val = lv_remote format = cl_abap_format=>e_html_attr ).
|
||||
<ls_diff>-new = escape( val = <ls_diff>-new format = cl_abap_format=>e_html_attr ).
|
||||
<ls_diff>-old = escape( val = <ls_diff>-old format = cl_abap_format=>e_html_attr ).
|
||||
ENDIF.
|
||||
|
||||
get_line_hl( EXPORTING iv_mod = is_diff-mod
|
||||
iv_result = <ls_diff>-result
|
||||
IMPORTING ev_lattr = lv_lattr
|
||||
ev_rattr = lv_rattr ).
|
||||
CONDENSE <ls_diff>-new_num. "get rid of leading spaces
|
||||
CONDENSE <ls_diff>-old_num.
|
||||
|
||||
ro_html->add( '<tr>' ). "#EC NOTEXT
|
||||
ro_html->add( |<td class="num">{ <ls_diff>-new_line }</td>| ). "#EC NOTEXT
|
||||
ro_html->add( |<td{ lv_lattr }><code>{ lv_local }</code></td>| ). "#EC NOTEXT
|
||||
ro_html->add( |<td class="num">{ <ls_diff>-old_line }</td>| ). "#EC NOTEXT
|
||||
ro_html->add( |<td{ lv_rattr }><code>{ lv_remote }</code></td>| ). "#EC NOTEXT
|
||||
ro_html->add( '</tr>' ). "#EC NOTEXT
|
||||
IF mv_unified = abap_true.
|
||||
ro_html->add( render_line_unified( is_diff_line = <ls_diff> ) ).
|
||||
ELSE.
|
||||
ro_html->add( render_line_split( is_diff_line = <ls_diff>
|
||||
iv_fstate = is_diff-fstate ) ).
|
||||
ENDIF.
|
||||
|
||||
ENDLOOP.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD get_line_hl.
|
||||
|
||||
CLEAR: ev_lattr, ev_rattr. " Class for changed lines
|
||||
|
||||
IF iv_result IS INITIAL.
|
||||
RETURN.
|
||||
IF mv_unified = abap_true.
|
||||
ro_html->add( render_line_unified( ) ). " Release delayed lines
|
||||
ENDIF.
|
||||
|
||||
" Both file changed ? Or line updated ? - All yellow
|
||||
IF iv_mod = c_mod-both OR iv_result = lcl_diff=>c_diff-update.
|
||||
ev_lattr = ' class="diff_upd"'. "#EC NOTEXT
|
||||
ev_rattr = ' class="diff_upd"'. "#EC NOTEXT
|
||||
ELSEIF iv_mod = c_mod-local. " Changed locally
|
||||
CASE iv_result.
|
||||
WHEN lcl_diff=>c_diff-insert.
|
||||
ev_lattr = ' class="diff_ins"'. "#EC NOTEXT
|
||||
WHEN lcl_diff=>c_diff-delete.
|
||||
ev_rattr = ' class="diff_del"'. "#EC NOTEXT
|
||||
ENDCASE.
|
||||
ELSEIF iv_mod = c_mod-remote. " Changed remotely - invert sides
|
||||
CASE iv_result.
|
||||
WHEN lcl_diff=>c_diff-insert.
|
||||
ev_rattr = ' class="diff_ins"'. "#EC NOTEXT
|
||||
WHEN lcl_diff=>c_diff-delete.
|
||||
ev_lattr = ' class="diff_del"'. "#EC NOTEXT
|
||||
ENDCASE.
|
||||
ENDIF.
|
||||
ENDMETHOD. "render_lines
|
||||
|
||||
ENDMETHOD. " get_line_hl.
|
||||
METHOD render_line_split.
|
||||
|
||||
METHOD render_content.
|
||||
|
||||
DATA ls_diff_file LIKE LINE OF mt_diff_files.
|
||||
DATA: lv_new TYPE string,
|
||||
lv_old TYPE string,
|
||||
lv_mark TYPE string,
|
||||
lv_bg TYPE string.
|
||||
|
||||
CREATE OBJECT ro_html.
|
||||
|
||||
LOOP AT mt_diff_files INTO ls_diff_file.
|
||||
lcl_progress=>show( iv_key = 'Diff'
|
||||
iv_current = sy-tabix
|
||||
iv_total = lines( mt_diff_files )
|
||||
iv_text = |Render Diff - { ls_diff_file-filename }| ).
|
||||
" New line
|
||||
lv_mark = ` `.
|
||||
IF iv_fstate = c_fstate-both OR is_diff_line-result = lcl_diff=>c_diff-update.
|
||||
lv_bg = ' diff_upd'.
|
||||
lv_mark = `~`.
|
||||
ELSEIF is_diff_line-result = lcl_diff=>c_diff-insert.
|
||||
lv_bg = ' diff_ins'.
|
||||
lv_mark = `+`.
|
||||
ENDIF.
|
||||
lv_new = |<td class="num" line-num="{ is_diff_line-new_num }"></td>|
|
||||
&& |<td class="code{ lv_bg }">{ lv_mark }{ is_diff_line-new }</td>|.
|
||||
|
||||
ro_html->add( render_diff( ls_diff_file ) ).
|
||||
ENDLOOP.
|
||||
" Old line
|
||||
CLEAR lv_bg.
|
||||
lv_mark = ` `.
|
||||
IF iv_fstate = c_fstate-both OR is_diff_line-result = lcl_diff=>c_diff-update.
|
||||
lv_bg = ' diff_upd'.
|
||||
lv_mark = `~`.
|
||||
ELSEIF is_diff_line-result = lcl_diff=>c_diff-delete.
|
||||
lv_bg = ' diff_del'.
|
||||
lv_mark = `-`.
|
||||
ENDIF.
|
||||
lv_old = |<td class="num" line-num="{ is_diff_line-old_num }"></td>|
|
||||
&& |<td class="code{ lv_bg }">{ lv_mark }{ is_diff_line-old }</td>|.
|
||||
|
||||
ENDMETHOD. "render_content
|
||||
" render line, inverse sides if remote is newer
|
||||
ro_html->add( '<tr>' ). "#EC NOTEXT
|
||||
IF iv_fstate = c_fstate-remote. " Remote file leading changes
|
||||
ro_html->add( lv_old ). " local
|
||||
ro_html->add( lv_new ). " remote
|
||||
ELSE. " Local leading changes or both were modified
|
||||
ro_html->add( lv_new ). " local
|
||||
ro_html->add( lv_old ). " remote
|
||||
ENDIF.
|
||||
ro_html->add( '</tr>' ). "#EC NOTEXT
|
||||
|
||||
ENDMETHOD. "render_line_split
|
||||
|
||||
METHOD render_line_unified.
|
||||
|
||||
DATA lv_line TYPE string.
|
||||
|
||||
FIELD-SYMBOLS <diff_line> LIKE LINE OF mt_delayed_lines.
|
||||
|
||||
CREATE OBJECT ro_html.
|
||||
|
||||
" Release delayed subsequent update lines
|
||||
IF is_diff_line-result <> lcl_diff=>c_diff-update.
|
||||
LOOP AT mt_delayed_lines ASSIGNING <diff_line>.
|
||||
ro_html->add( '<tr>' ). "#EC NOTEXT
|
||||
ro_html->add( |<td class="num" line-num="{ <diff_line>-old_num }"></td>|
|
||||
&& |<td class="num" line-num=""></td>|
|
||||
&& |<td class="code diff_del">-{ <diff_line>-old }</td>| ).
|
||||
ro_html->add( '</tr>' ). "#EC NOTEXT
|
||||
ENDLOOP.
|
||||
LOOP AT mt_delayed_lines ASSIGNING <diff_line>.
|
||||
ro_html->add( '<tr>' ). "#EC NOTEXT
|
||||
ro_html->add( |<td class="num" line-num=""></td>|
|
||||
&& |<td class="num" line-num="{ <diff_line>-new_num }"></td>|
|
||||
&& |<td class="code diff_ins">+{ <diff_line>-new }</td>| ).
|
||||
ro_html->add( '</tr>' ). "#EC NOTEXT
|
||||
ENDLOOP.
|
||||
CLEAR mt_delayed_lines.
|
||||
ENDIF.
|
||||
|
||||
ro_html->add( '<tr>' ). "#EC NOTEXT
|
||||
CASE is_diff_line-result.
|
||||
WHEN lcl_diff=>c_diff-update.
|
||||
APPEND is_diff_line TO mt_delayed_lines. " Delay output of subsequent updates
|
||||
WHEN lcl_diff=>c_diff-insert.
|
||||
ro_html->add( |<td class="num" line-num=""></td>|
|
||||
&& |<td class="num" line-num="{ is_diff_line-new_num }"></td>|
|
||||
&& |<td class="code diff_ins">+{ is_diff_line-new }</td>| ).
|
||||
WHEN lcl_diff=>c_diff-delete.
|
||||
ro_html->add( |<td class="num" line-num="{ is_diff_line-old_num }"></td>|
|
||||
&& |<td class="num" line-num=""></td>|
|
||||
&& |<td class="code diff_del">-{ is_diff_line-old }</td>| ).
|
||||
WHEN OTHERS. "none
|
||||
ro_html->add( |<td class="num" line-num="{ is_diff_line-old_num }"></td>|
|
||||
&& |<td class="num" line-num="{ is_diff_line-new_num }"></td>|
|
||||
&& |<td class="code"> { is_diff_line-old }</td>| ).
|
||||
ENDCASE.
|
||||
ro_html->add( '</tr>' ). "#EC NOTEXT
|
||||
|
||||
ENDMETHOD. "render_line_unified
|
||||
|
||||
ENDCLASS. "lcl_gui_page_diff
|
|
@ -422,6 +422,14 @@ CLASS lcl_persistence_user DEFINITION FINAL CREATE PRIVATE FRIENDS lcl_app.
|
|||
RETURNING VALUE(rv_changes_only) TYPE abap_bool
|
||||
RAISING lcx_exception.
|
||||
|
||||
METHODS toggle_diff_unified
|
||||
RETURNING VALUE(rv_diff_unified) TYPE abap_bool
|
||||
RAISING lcx_exception.
|
||||
|
||||
METHODS get_diff_unified
|
||||
RETURNING VALUE(rv_diff_unified) TYPE abap_bool
|
||||
RAISING lcx_exception.
|
||||
|
||||
METHODS get_favorites
|
||||
RETURNING VALUE(rt_favorites) TYPE tt_favorites
|
||||
RAISING lcx_exception.
|
||||
|
@ -454,6 +462,7 @@ CLASS lcl_persistence_user DEFINITION FINAL CREATE PRIVATE FRIENDS lcl_app.
|
|||
repo_config TYPE ty_repo_config_tt,
|
||||
hide_files TYPE abap_bool,
|
||||
changes_only TYPE abap_bool,
|
||||
diff_unified TYPE abap_bool,
|
||||
favorites TYPE tt_favorites,
|
||||
END OF ty_user.
|
||||
|
||||
|
@ -698,6 +707,24 @@ CLASS lcl_persistence_user IMPLEMENTATION.
|
|||
|
||||
ENDMETHOD. "get_changes_only
|
||||
|
||||
METHOD toggle_diff_unified.
|
||||
|
||||
DATA ls_user TYPE ty_user.
|
||||
|
||||
ls_user = read( ).
|
||||
ls_user-diff_unified = boolc( ls_user-diff_unified = abap_false ).
|
||||
update( ls_user ).
|
||||
|
||||
rv_diff_unified = ls_user-diff_unified.
|
||||
|
||||
ENDMETHOD. "toggle_diff_unified
|
||||
|
||||
METHOD get_diff_unified.
|
||||
|
||||
rv_diff_unified = read( )-diff_unified.
|
||||
|
||||
ENDMETHOD. "get_diff_unified
|
||||
|
||||
METHOD get_favorites.
|
||||
|
||||
rt_favorites = read( )-favorites.
|
||||
|
|
|
@ -174,7 +174,7 @@ CLASS lcl_popups IMPLEMENTATION.
|
|||
CLEAR: ev_name, ev_cancel.
|
||||
|
||||
* TAB FLD LABEL DEF ATTR
|
||||
_add_dialog_fld 'TEXTL' 'LINE' 'Name' 'new_branch_name' ''.
|
||||
_add_dialog_fld 'TEXTL' 'LINE' 'Name' 'new-branch-name' ''.
|
||||
|
||||
CALL FUNCTION 'POPUP_GET_VALUES'
|
||||
EXPORTING
|
||||
|
@ -195,7 +195,8 @@ CLASS lcl_popups IMPLEMENTATION.
|
|||
ELSE.
|
||||
READ TABLE lt_fields INDEX 1 ASSIGNING <ls_field>.
|
||||
ASSERT sy-subrc = 0.
|
||||
ev_name = lcl_git_branch_list=>complete_heads_branch_name( <ls_field>-value ).
|
||||
ev_name = lcl_git_branch_list=>complete_heads_branch_name(
|
||||
lcl_git_branch_list=>normalize_branch_name( <ls_field>-value ) ).
|
||||
ENDIF.
|
||||
|
||||
ENDMETHOD.
|
||||
|
@ -282,26 +283,42 @@ CLASS lcl_popups IMPLEMENTATION.
|
|||
|
||||
METHOD branch_list_popup.
|
||||
|
||||
DATA: lo_branches TYPE REF TO lcl_git_branch_list,
|
||||
lt_branches TYPE lcl_git_branch_list=>ty_git_branch_list_tt,
|
||||
lv_answer TYPE c LENGTH 1,
|
||||
lv_default TYPE i VALUE 1, "Default cursor position
|
||||
lt_selection TYPE TABLE OF spopli.
|
||||
DATA: lo_branches TYPE REF TO lcl_git_branch_list,
|
||||
lt_branches TYPE lcl_git_branch_list=>ty_git_branch_list_tt,
|
||||
lv_head_suffix TYPE string,
|
||||
lv_answer TYPE c LENGTH 1,
|
||||
lv_default TYPE i VALUE 1, "Default cursor position
|
||||
lt_selection TYPE TABLE OF spopli.
|
||||
|
||||
FIELD-SYMBOLS: <ls_sel> LIKE LINE OF lt_selection,
|
||||
<ls_branch> LIKE LINE OF lt_branches.
|
||||
|
||||
|
||||
lo_branches = lcl_git_transport=>branches( iv_url ).
|
||||
lo_branches = lcl_git_transport=>branches( iv_url ).
|
||||
lt_branches = lo_branches->get_branches_only( ).
|
||||
lv_head_suffix = | ({ lcl_git_branch_list=>c_head_name })|.
|
||||
|
||||
lt_branches = lo_branches->get_branches_only( ).
|
||||
LOOP AT lt_branches ASSIGNING <ls_branch>.
|
||||
APPEND INITIAL LINE TO lt_selection ASSIGNING <ls_sel>.
|
||||
<ls_sel>-varoption = <ls_branch>-name.
|
||||
|
||||
IF <ls_branch>-name = lcl_git_branch_list=>c_head_name
|
||||
AND <ls_branch>-name <> lo_branches->get_head_symref( ).
|
||||
" HEAD but other HEAD symref exist
|
||||
CONTINUE.
|
||||
ENDIF.
|
||||
|
||||
APPEND INITIAL LINE TO lt_selection ASSIGNING <ls_sel>.
|
||||
IF iv_default_branch IS NOT INITIAL AND iv_default_branch = <ls_branch>-name.
|
||||
lv_default = sy-tabix.
|
||||
ENDIF.
|
||||
|
||||
IF <ls_branch>-name = lo_branches->get_head_symref( )
|
||||
AND <ls_branch>-name <> lcl_git_branch_list=>c_head_name.
|
||||
" HEAD symref but not HEAD itself
|
||||
<ls_sel>-varoption = <ls_branch>-display_name && lv_head_suffix.
|
||||
ELSE.
|
||||
<ls_sel>-varoption = <ls_branch>-display_name.
|
||||
ENDIF.
|
||||
|
||||
ENDLOOP.
|
||||
|
||||
IF iv_show_new_option = abap_true.
|
||||
|
@ -339,7 +356,10 @@ CLASS lcl_popups IMPLEMENTATION.
|
|||
IF iv_show_new_option = abap_true AND <ls_sel>-varoption = c_new_branch_label.
|
||||
rs_branch-name = c_new_branch_label.
|
||||
ELSE.
|
||||
rs_branch = lo_branches->find_by_name( <ls_sel>-varoption ).
|
||||
REPLACE FIRST OCCURRENCE OF lv_head_suffix IN <ls_sel>-varoption WITH ''.
|
||||
READ TABLE lt_branches WITH KEY display_name = <ls_sel>-varoption ASSIGNING <ls_branch>.
|
||||
ASSERT sy-subrc = 0.
|
||||
rs_branch = lo_branches->find_by_name( <ls_branch>-name ).
|
||||
ENDIF.
|
||||
|
||||
|
||||
|
|
|
@ -242,11 +242,11 @@ CLASS ltcl_diff IMPLEMENTATION.
|
|||
|
||||
DEFINE _expected.
|
||||
CLEAR ms_expected.
|
||||
ms_expected-new_line = &1.
|
||||
ms_expected-new = &2.
|
||||
ms_expected-result = &3.
|
||||
ms_expected-old_line = &4.
|
||||
ms_expected-old = &5.
|
||||
ms_expected-new_num = &1.
|
||||
ms_expected-new = &2.
|
||||
ms_expected-result = &3.
|
||||
ms_expected-old_num = &4.
|
||||
ms_expected-old = &5.
|
||||
APPEND ms_expected TO mt_expected.
|
||||
END-OF-DEFINITION.
|
||||
|
||||
|
@ -2210,548 +2210,4 @@ CLASS ltcl_persistence_settings IMPLEMENTATION.
|
|||
|
||||
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_equals( act = iv_error
|
||||
exp = abap_false ).
|
||||
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_equals( act = mo_spy_oo_object->mv_overwrite
|
||||
exp = abap_true ).
|
||||
|
||||
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_equals( act = mo_spy_oo_object->mv_force
|
||||
exp = abap_true ).
|
||||
|
||||
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_equals( act = mo_spy_oo_object->mv_text_pool_inserted
|
||||
exp = abap_false ).
|
||||
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_equals( act = mo_spy_oo_object->mv_overwrite
|
||||
exp = abap_true ).
|
||||
|
||||
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.
|
||||
INCLUDE ZABAPGIT_UNIT_TEST_CLAS_INTF.
|
646
src/zabapgit_unit_test_clas_intf.prog.abap
Normal file
646
src/zabapgit_unit_test_clas_intf.prog.abap
Normal file
|
@ -0,0 +1,646 @@
|
|||
|
||||
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,
|
||||
mv_get_includes_called TYPE abap_bool.
|
||||
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.
|
||||
|
||||
METHOD lif_object_oriented_object~get_includes.
|
||||
APPEND 'dummy' TO rt_includes.
|
||||
mv_get_includes_called = abap_true.
|
||||
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_equals( act = iv_error
|
||||
exp = abap_false ).
|
||||
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_equals( act = mo_spy_oo_object->mv_overwrite
|
||||
exp = abap_true ).
|
||||
|
||||
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_equals( act = mo_spy_oo_object->mv_force
|
||||
exp = abap_true ).
|
||||
|
||||
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_equals( act = mo_spy_oo_object->mv_text_pool_inserted
|
||||
exp = abap_false ).
|
||||
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_equals( act = mo_spy_oo_object->mv_overwrite
|
||||
exp = abap_true ).
|
||||
|
||||
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.
|
||||
|
||||
CLASS ltcl_class_changed DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT
|
||||
INHERITING FROM ltc_oo_test.
|
||||
PRIVATE SECTION.
|
||||
METHODS:
|
||||
setup,
|
||||
changed_by_call_get_includes FOR TESTING RAISING cx_static_check,
|
||||
changed_since_call_get_include FOR TESTING RAISING cx_static_check.
|
||||
|
||||
ENDCLASS.
|
||||
CLASS ltcl_class_changed 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 changed_by_call_get_includes.
|
||||
DATA lv_username TYPE xubname.
|
||||
lv_username = mo_oo_object->changed_by( ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
act = mo_spy_oo_object->mv_get_includes_called
|
||||
exp = abap_true ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
act = lv_username
|
||||
exp = lcl_objects_super=>c_user_unknown ).
|
||||
ENDMETHOD.
|
||||
METHOD changed_since_call_get_include.
|
||||
DATA lv_timestamp TYPE timestamp.
|
||||
GET TIME STAMP FIELD lv_timestamp.
|
||||
mo_oo_object->has_changed_since( lv_timestamp ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
act = mo_spy_oo_object->mv_get_includes_called
|
||||
exp = abap_true ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
CLASS ltcl_interface_changed DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT
|
||||
INHERITING FROM ltc_oo_test.
|
||||
PRIVATE SECTION.
|
||||
METHODS:
|
||||
setup,
|
||||
changed_by_call_get_includes FOR TESTING RAISING cx_static_check,
|
||||
changed_since_call_get_include FOR TESTING RAISING cx_static_check.
|
||||
ENDCLASS.
|
||||
CLASS ltcl_interface_changed 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 changed_by_call_get_includes.
|
||||
DATA lv_username TYPE xubname.
|
||||
lv_username = mo_oo_object->changed_by( ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
act = mo_spy_oo_object->mv_get_includes_called
|
||||
exp = abap_true ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
act = lv_username
|
||||
exp = lcl_objects_super=>c_user_unknown ).
|
||||
ENDMETHOD.
|
||||
METHOD changed_since_call_get_include.
|
||||
DATA lv_timestamp TYPE timestamp.
|
||||
GET TIME STAMP FIELD lv_timestamp.
|
||||
mo_oo_object->has_changed_since( lv_timestamp ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
act = mo_spy_oo_object->mv_get_includes_called
|
||||
exp = abap_true ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
48
src/zabapgit_unit_test_clas_intf.prog.xml
Normal file
48
src/zabapgit_unit_test_clas_intf.prog.xml
Normal file
|
@ -0,0 +1,48 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_PROG" serializer_version="v1.0.0">
|
||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<PROGDIR>
|
||||
<NAME>ZABAPGIT_UNIT_TEST_CLAS_INTF</NAME>
|
||||
<STATE>A</STATE>
|
||||
<SQLX/>
|
||||
<EDTX/>
|
||||
<VARCL>X</VARCL>
|
||||
<DBAPL>S</DBAPL>
|
||||
<DBNA>D$</DBNA>
|
||||
<CLAS/>
|
||||
<TYPE/>
|
||||
<OCCURS/>
|
||||
<SUBC>I</SUBC>
|
||||
<APPL/>
|
||||
<SECU/>
|
||||
<CNAM/>
|
||||
<CDAT>0000-00-00</CDAT>
|
||||
<UNAM/>
|
||||
<UDAT>0000-00-00</UDAT>
|
||||
<VERN/>
|
||||
<LEVL/>
|
||||
<RSTAT/>
|
||||
<RMAND/>
|
||||
<RLOAD/>
|
||||
<FIXPT>X</FIXPT>
|
||||
<SSET/>
|
||||
<SDATE>0000-00-00</SDATE>
|
||||
<STIME/>
|
||||
<IDATE>0000-00-00</IDATE>
|
||||
<ITIME/>
|
||||
<LDBNAME>D$S</LDBNAME>
|
||||
<UCCHECK>X</UCCHECK>
|
||||
</PROGDIR>
|
||||
<TPOOL>
|
||||
<item>
|
||||
<ID>R</ID>
|
||||
<KEY/>
|
||||
<ENTRY>Unit tests for classes and interfaces objecst</ENTRY>
|
||||
<LENGTH>45</LENGTH>
|
||||
<SPLIT/>
|
||||
</item>
|
||||
</TPOOL>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
|
@ -547,13 +547,13 @@ CLASS lcl_diff DEFINITION FINAL.
|
|||
END OF c_diff.
|
||||
|
||||
TYPES: BEGIN OF ty_diff,
|
||||
new_line TYPE c LENGTH 6,
|
||||
new TYPE string,
|
||||
result TYPE c LENGTH 1,
|
||||
old_line TYPE c LENGTH 6,
|
||||
old TYPE string,
|
||||
short TYPE abap_bool,
|
||||
beacon TYPE i,
|
||||
new_num TYPE c LENGTH 6,
|
||||
new TYPE string,
|
||||
result TYPE c LENGTH 1,
|
||||
old_num TYPE c LENGTH 6,
|
||||
old TYPE string,
|
||||
short TYPE abap_bool,
|
||||
beacon TYPE i,
|
||||
END OF ty_diff.
|
||||
TYPES: ty_diffs_tt TYPE STANDARD TABLE OF ty_diff WITH DEFAULT KEY.
|
||||
|
||||
|
@ -697,16 +697,16 @@ CLASS lcl_diff IMPLEMENTATION.
|
|||
|
||||
|
||||
LOOP AT mt_diff ASSIGNING <ls_diff>.
|
||||
<ls_diff>-new_line = lv_new.
|
||||
<ls_diff>-old_line = lv_old.
|
||||
<ls_diff>-new_num = lv_new.
|
||||
<ls_diff>-old_num = lv_old.
|
||||
|
||||
CASE <ls_diff>-result. " Line nums
|
||||
WHEN c_diff-delete.
|
||||
lv_old = lv_old + 1.
|
||||
CLEAR <ls_diff>-new_line.
|
||||
CLEAR <ls_diff>-new_num.
|
||||
WHEN c_diff-insert.
|
||||
lv_new = lv_new + 1.
|
||||
CLEAR <ls_diff>-old_line.
|
||||
CLEAR <ls_diff>-old_num.
|
||||
WHEN OTHERS.
|
||||
lv_new = lv_new + 1.
|
||||
lv_old = lv_old + 1.
|
||||
|
|
|
@ -27,12 +27,12 @@ CLASS lcl_zip DEFINITION FINAL.
|
|||
|
||||
PRIVATE SECTION.
|
||||
CLASS-METHODS file_upload
|
||||
RETURNING value(rv_xstr) TYPE xstring
|
||||
RETURNING VALUE(rv_xstr) TYPE xstring
|
||||
RAISING lcx_exception.
|
||||
|
||||
CLASS-METHODS unzip_file
|
||||
IMPORTING iv_xstr TYPE xstring
|
||||
RETURNING value(rt_files) TYPE ty_files_tt
|
||||
RETURNING VALUE(rt_files) TYPE ty_files_tt
|
||||
RAISING lcx_exception.
|
||||
|
||||
CLASS-METHODS normalize_path
|
||||
|
@ -52,11 +52,11 @@ CLASS lcl_zip DEFINITION FINAL.
|
|||
|
||||
CLASS-METHODS encode_files
|
||||
IMPORTING it_files TYPE ty_files_item_tt
|
||||
RETURNING value(rv_xstr) TYPE xstring
|
||||
RETURNING VALUE(rv_xstr) TYPE xstring
|
||||
RAISING lcx_exception.
|
||||
|
||||
CLASS-METHODS get_message
|
||||
RETURNING value(rv_message) TYPE string
|
||||
RETURNING VALUE(rv_message) TYPE string
|
||||
RAISING lcx_exception.
|
||||
|
||||
ENDCLASS. "lcl_zip DEFINITION
|
||||
|
@ -341,12 +341,11 @@ CLASS lcl_zip IMPLEMENTATION.
|
|||
|
||||
METHOD unzip_file.
|
||||
|
||||
DATA: lo_zip TYPE REF TO cl_abap_zip,
|
||||
lv_xstr TYPE xstring,
|
||||
lt_splice TYPE cl_abap_zip=>t_splice_entries.
|
||||
DATA: lo_zip TYPE REF TO cl_abap_zip,
|
||||
lv_data TYPE xstring.
|
||||
|
||||
FIELD-SYMBOLS: <ls_splice> LIKE LINE OF lt_splice,
|
||||
<ls_file> LIKE LINE OF rt_files.
|
||||
FIELD-SYMBOLS: <ls_zipfile> TYPE cl_abap_zip=>t_file,
|
||||
<ls_file> LIKE LINE OF rt_files.
|
||||
|
||||
|
||||
CREATE OBJECT lo_zip.
|
||||
|
@ -359,14 +358,13 @@ CLASS lcl_zip IMPLEMENTATION.
|
|||
lcx_exception=>raise( 'error from zip' ).
|
||||
ENDIF.
|
||||
|
||||
lt_splice = cl_abap_zip=>splice( iv_xstr ).
|
||||
LOOP AT lo_zip->files ASSIGNING <ls_zipfile>.
|
||||
|
||||
LOOP AT lt_splice ASSIGNING <ls_splice>.
|
||||
lo_zip->get(
|
||||
EXPORTING
|
||||
name = <ls_splice>-name
|
||||
name = <ls_zipfile>-name
|
||||
IMPORTING
|
||||
content = lv_xstr
|
||||
content = lv_data
|
||||
EXCEPTIONS
|
||||
zip_index_error = 1
|
||||
zip_decompression_error = 2
|
||||
|
@ -379,12 +377,12 @@ CLASS lcl_zip IMPLEMENTATION.
|
|||
|
||||
filename(
|
||||
EXPORTING
|
||||
iv_str = <ls_splice>-name
|
||||
iv_str = <ls_zipfile>-name
|
||||
IMPORTING
|
||||
ev_path = <ls_file>-path
|
||||
ev_filename = <ls_file>-filename ).
|
||||
|
||||
<ls_file>-data = lv_xstr.
|
||||
<ls_file>-data = lv_data.
|
||||
|
||||
<ls_file>-sha1 = lcl_hash=>sha1( iv_type = gc_type-blob
|
||||
iv_data = <ls_file>-data ).
|
||||
|
|
Loading…
Reference in New Issue
Block a user