mirror of
https://github.com/abapGit/abapGit.git
synced 2025-05-01 04:08:27 +08:00
Fix unit tests for ZCL_ABAPGIT_REPO_REQUIREMENTS
(#6801)
Co-authored-by: Lars Hvam <larshp@hotmail.com>
This commit is contained in:
parent
fa66b626de
commit
999da0ef9e
|
@ -5,6 +5,8 @@ CLASS zcl_abapgit_repo_requirements DEFINITION
|
||||||
|
|
||||||
PUBLIC SECTION.
|
PUBLIC SECTION.
|
||||||
|
|
||||||
|
TYPES ty_cvers TYPE STANDARD TABLE OF cvers WITH DEFAULT KEY.
|
||||||
|
|
||||||
CLASS-METHODS requirements_popup
|
CLASS-METHODS requirements_popup
|
||||||
IMPORTING
|
IMPORTING
|
||||||
!it_requirements TYPE zif_abapgit_dot_abapgit=>ty_requirement_tt
|
!it_requirements TYPE zif_abapgit_dot_abapgit=>ty_requirement_tt
|
||||||
|
@ -17,6 +19,11 @@ CLASS zcl_abapgit_repo_requirements DEFINITION
|
||||||
VALUE(rv_status) TYPE zif_abapgit_definitions=>ty_yes_no
|
VALUE(rv_status) TYPE zif_abapgit_definitions=>ty_yes_no
|
||||||
RAISING
|
RAISING
|
||||||
zcx_abapgit_exception.
|
zcx_abapgit_exception.
|
||||||
|
|
||||||
|
CLASS-METHODS inject_cvers
|
||||||
|
IMPORTING
|
||||||
|
!it_cvers TYPE ty_cvers.
|
||||||
|
|
||||||
PROTECTED SECTION.
|
PROTECTED SECTION.
|
||||||
PRIVATE SECTION.
|
PRIVATE SECTION.
|
||||||
|
|
||||||
|
@ -33,6 +40,14 @@ CLASS zcl_abapgit_repo_requirements DEFINITION
|
||||||
TYPES:
|
TYPES:
|
||||||
ty_requirement_status_tt TYPE STANDARD TABLE OF ty_requirement_status WITH DEFAULT KEY .
|
ty_requirement_status_tt TYPE STANDARD TABLE OF ty_requirement_status WITH DEFAULT KEY .
|
||||||
|
|
||||||
|
CLASS-DATA gt_cvers TYPE ty_cvers.
|
||||||
|
|
||||||
|
CLASS-METHODS get_cvers
|
||||||
|
RETURNING
|
||||||
|
VALUE(rt_cvers) TYPE ty_cvers
|
||||||
|
RAISING
|
||||||
|
zcx_abapgit_exception.
|
||||||
|
|
||||||
CLASS-METHODS show_requirement_popup
|
CLASS-METHODS show_requirement_popup
|
||||||
IMPORTING
|
IMPORTING
|
||||||
!it_requirements TYPE ty_requirement_status_tt
|
!it_requirements TYPE ty_requirement_status_tt
|
||||||
|
@ -57,19 +72,29 @@ ENDCLASS.
|
||||||
CLASS zcl_abapgit_repo_requirements IMPLEMENTATION.
|
CLASS zcl_abapgit_repo_requirements IMPLEMENTATION.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD get_cvers.
|
||||||
|
IF gt_cvers IS NOT INITIAL.
|
||||||
|
rt_cvers = gt_cvers.
|
||||||
|
RETURN.
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
SELECT * FROM cvers INTO TABLE rt_cvers ORDER BY PRIMARY KEY.
|
||||||
|
IF sy-subrc <> 0.
|
||||||
|
zcx_abapgit_exception=>raise( |Error reading installed components| ).
|
||||||
|
ENDIF.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
METHOD get_requirement_met_status.
|
METHOD get_requirement_met_status.
|
||||||
|
|
||||||
DATA: lt_installed TYPE STANDARD TABLE OF cvers.
|
DATA: lt_installed TYPE ty_cvers.
|
||||||
|
|
||||||
FIELD-SYMBOLS: <ls_requirement> TYPE zif_abapgit_dot_abapgit=>ty_requirement,
|
FIELD-SYMBOLS: <ls_requirement> TYPE zif_abapgit_dot_abapgit=>ty_requirement,
|
||||||
<ls_status> TYPE ty_requirement_status,
|
<ls_status> TYPE ty_requirement_status,
|
||||||
<ls_installed_comp> TYPE cvers.
|
<ls_installed_comp> TYPE cvers.
|
||||||
|
|
||||||
|
|
||||||
SELECT * FROM cvers INTO TABLE lt_installed ORDER BY PRIMARY KEY.
|
lt_installed = get_cvers( ).
|
||||||
IF sy-subrc <> 0.
|
|
||||||
zcx_abapgit_exception=>raise( |Error reading installed components| ).
|
|
||||||
ENDIF.
|
|
||||||
|
|
||||||
LOOP AT it_requirements ASSIGNING <ls_requirement>.
|
LOOP AT it_requirements ASSIGNING <ls_requirement>.
|
||||||
APPEND INITIAL LINE TO rt_status ASSIGNING <ls_status>.
|
APPEND INITIAL LINE TO rt_status ASSIGNING <ls_status>.
|
||||||
|
@ -100,6 +125,12 @@ CLASS zcl_abapgit_repo_requirements IMPLEMENTATION.
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD inject_cvers.
|
||||||
|
" For testing only
|
||||||
|
gt_cvers = it_cvers.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
METHOD is_requirements_met.
|
METHOD is_requirements_met.
|
||||||
|
|
||||||
DATA: lt_met_status TYPE ty_requirement_status_tt.
|
DATA: lt_met_status TYPE ty_requirement_status_tt.
|
||||||
|
|
|
@ -15,14 +15,19 @@ CLASS lcl_helper IMPLEMENTATION.
|
||||||
|
|
||||||
METHOD get_sap_basis_component.
|
METHOD get_sap_basis_component.
|
||||||
|
|
||||||
|
DATA lt_cvers TYPE zcl_abapgit_repo_requirements=>ty_cvers.
|
||||||
|
|
||||||
" mock SAP_BASIS
|
" mock SAP_BASIS
|
||||||
rs_result-component = 'SAP_BASIS'.
|
rs_result-component = 'SAP_BASIS'.
|
||||||
rs_result-release = '754'.
|
rs_result-release = '754'.
|
||||||
rs_result-extrelease = '0007'.
|
rs_result-extrelease = '0007'.
|
||||||
rs_result-comp_type = 'S'.
|
rs_result-comp_type = 'S'.
|
||||||
|
|
||||||
ENDMETHOD.
|
INSERT rs_result INTO TABLE lt_cvers.
|
||||||
|
|
||||||
|
zcl_abapgit_repo_requirements=>inject_cvers( lt_cvers ).
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
ENDCLASS.
|
ENDCLASS.
|
||||||
|
|
||||||
|
|
|
@ -101,21 +101,6 @@
|
||||||
|
|
||||||
{"object": "ZCL_ABAPGIT_PERSIST_PACKAGES", "class": "ltcl_packages", "method": "test_package", "note": "ZABAPGIT table not existing, error cx_sy_dynamic_osql_semantics"},
|
{"object": "ZCL_ABAPGIT_PERSIST_PACKAGES", "class": "ltcl_packages", "method": "test_package", "note": "ZABAPGIT table not existing, error cx_sy_dynamic_osql_semantics"},
|
||||||
|
|
||||||
{"object": "ZCL_ABAPGIT_REPO_REQUIREMENTS", "class": "ltcl_lower_release", "method": "empty_patch", "note": "Mock CVERS and CVERS_REF tables"},
|
|
||||||
{"object": "ZCL_ABAPGIT_REPO_REQUIREMENTS", "class": "ltcl_lower_release", "method": "lower_patch", "note": "Mock CVERS and CVERS_REF tables"},
|
|
||||||
{"object": "ZCL_ABAPGIT_REPO_REQUIREMENTS", "class": "ltcl_lower_release", "method": "same_patch", "note": "Mock CVERS and CVERS_REF tables"},
|
|
||||||
{"object": "ZCL_ABAPGIT_REPO_REQUIREMENTS", "class": "ltcl_lower_release", "method": "higher_patch", "note": "Mock CVERS and CVERS_REF tables"},
|
|
||||||
{"object": "ZCL_ABAPGIT_REPO_REQUIREMENTS", "class": "ltcl_same_release", "method": "empty_patch", "note": "Mock CVERS and CVERS_REF tables"},
|
|
||||||
{"object": "ZCL_ABAPGIT_REPO_REQUIREMENTS", "class": "ltcl_same_release", "method": "lower_patch", "note": "Mock CVERS and CVERS_REF tables"},
|
|
||||||
{"object": "ZCL_ABAPGIT_REPO_REQUIREMENTS", "class": "ltcl_same_release", "method": "same_patch", "note": "Mock CVERS and CVERS_REF tables"},
|
|
||||||
{"object": "ZCL_ABAPGIT_REPO_REQUIREMENTS", "class": "ltcl_same_release", "method": "higher_patch", "note": "Mock CVERS and CVERS_REF tables"},
|
|
||||||
{"object": "ZCL_ABAPGIT_REPO_REQUIREMENTS", "class": "ltcl_higher_release", "method": "empty_patch", "note": "Mock CVERS and CVERS_REF tables"},
|
|
||||||
{"object": "ZCL_ABAPGIT_REPO_REQUIREMENTS", "class": "ltcl_higher_release", "method": "lower_patch", "note": "Mock CVERS and CVERS_REF tables"},
|
|
||||||
{"object": "ZCL_ABAPGIT_REPO_REQUIREMENTS", "class": "ltcl_higher_release", "method": "same_patch", "note": "Mock CVERS and CVERS_REF tables"},
|
|
||||||
{"object": "ZCL_ABAPGIT_REPO_REQUIREMENTS", "class": "ltcl_higher_release", "method": "higher_patch", "note": "Mock CVERS and CVERS_REF tables"},
|
|
||||||
{"object": "ZCL_ABAPGIT_REPO_REQUIREMENTS", "class": "ltcl_formats", "method": "shorter_patch", "note": "Mock CVERS and CVERS_REF tables"},
|
|
||||||
{"object": "ZCL_ABAPGIT_REPO_REQUIREMENTS", "class": "ltcl_formats", "method": "longer_patch", "note": "Mock CVERS and CVERS_REF tables"},
|
|
||||||
|
|
||||||
{"object": "ZCL_ABAPGIT_XML", "class": "ltcl_xml", "method": "space_leading_trailing", "note": "??"},
|
{"object": "ZCL_ABAPGIT_XML", "class": "ltcl_xml", "method": "space_leading_trailing", "note": "??"},
|
||||||
{"object": "ZCL_ABAPGIT_XML", "class": "ltcl_xml", "method": "bad_xml_raises_exc", "note": "handling of xml parser errors, cl_ixml, test method parse_negative"},
|
{"object": "ZCL_ABAPGIT_XML", "class": "ltcl_xml", "method": "bad_xml_raises_exc", "note": "handling of xml parser errors, cl_ixml, test method parse_negative"},
|
||||||
{"object": "ZCL_ABAPGIT_XML_OUTPUT", "class": "ltcl_xml_output", "method": "render_xml_string", "note": "kernel_call_transformation.mi_writer.get(...).if_sxml_writer$open_element is not a function"},
|
{"object": "ZCL_ABAPGIT_XML_OUTPUT", "class": "ltcl_xml_output", "method": "render_xml_string", "note": "kernel_call_transformation.mi_writer.get(...).if_sxml_writer$open_element is not a function"},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user