mirror of
https://github.com/abapGit/abapGit.git
synced 2025-05-01 12:20:51 +08:00
Isolate delete from CLAS and INTF
This commit is contained in:
parent
db4cadf88d
commit
389b6aeced
|
@ -129,7 +129,12 @@ INTERFACE lif_object_oriented_object_fnc.
|
||||||
IMPORTING
|
IMPORTING
|
||||||
iv_obejct_name TYPE seoclsname
|
iv_obejct_name TYPE seoclsname
|
||||||
RETURNING
|
RETURNING
|
||||||
VALUE(rt_descriptions) TYPE ty_seocompotx_tt.
|
VALUE(rt_descriptions) TYPE ty_seocompotx_tt,
|
||||||
|
delete
|
||||||
|
IMPORTING
|
||||||
|
is_deletion_key TYPE seoclskey
|
||||||
|
RAISING
|
||||||
|
lcx_exception.
|
||||||
ENDINTERFACE.
|
ENDINTERFACE.
|
||||||
|
|
||||||
CLASS lcl_oo_object_serializer DEFINITION.
|
CLASS lcl_oo_object_serializer DEFINITION.
|
||||||
|
@ -408,8 +413,7 @@ ENDCLASS.
|
||||||
CLASS lcl_object_oriented_base IMPLEMENTATION.
|
CLASS lcl_object_oriented_base IMPLEMENTATION.
|
||||||
|
|
||||||
METHOD lif_object_oriented_object_fnc~create.
|
METHOD lif_object_oriented_object_fnc~create.
|
||||||
"Subclass responsibility
|
ASSERT 0 = 1. "Subclass responsibility
|
||||||
ASSERT 0 = 1.
|
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
METHOD lif_object_oriented_object_fnc~deserialize_source.
|
METHOD lif_object_oriented_object_fnc~deserialize_source.
|
||||||
|
@ -425,8 +429,7 @@ CLASS lcl_object_oriented_base IMPLEMENTATION.
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
METHOD lif_object_oriented_object_fnc~generate_locals.
|
METHOD lif_object_oriented_object_fnc~generate_locals.
|
||||||
"Subclass responsibility
|
ASSERT 0 = 1. "Subclass responsibility
|
||||||
ASSERT 0 = 1.
|
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
METHOD deserialize_abap_source_old.
|
METHOD deserialize_abap_source_old.
|
||||||
|
@ -494,14 +497,13 @@ CLASS lcl_object_oriented_base IMPLEMENTATION.
|
||||||
DELETE FROM seocompotx WHERE clsname = is_key-clsname.
|
DELETE FROM seocompotx WHERE clsname = is_key-clsname.
|
||||||
INSERT seocompotx FROM TABLE it_descriptions.
|
INSERT seocompotx FROM TABLE it_descriptions.
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
METHOD lif_object_oriented_object_fnc~insert_text_pool.
|
METHOD lif_object_oriented_object_fnc~insert_text_pool.
|
||||||
"Subclass responsibility
|
ASSERT 0 = 1. "Subclass responsibility
|
||||||
ASSERT 0 = 1.
|
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
METHOD lif_object_oriented_object_fnc~create_sotr.
|
METHOD lif_object_oriented_object_fnc~create_sotr.
|
||||||
"Subclass responsibility
|
ASSERT 0 = 1. "Subclass responsibility
|
||||||
ASSERT 0 = 1.
|
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
METHOD lif_object_oriented_object_fnc~create_documentation.
|
METHOD lif_object_oriented_object_fnc~create_documentation.
|
||||||
|
@ -521,8 +523,7 @@ CLASS lcl_object_oriented_base IMPLEMENTATION.
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
METHOD lif_object_oriented_object_fnc~get_includes.
|
METHOD lif_object_oriented_object_fnc~get_includes.
|
||||||
"Subclass responsibility
|
ASSERT 0 = 1. "Subclass responsibility
|
||||||
ASSERT 0 = 1.
|
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
METHOD lif_object_oriented_object_fnc~exists.
|
METHOD lif_object_oriented_object_fnc~exists.
|
||||||
|
@ -560,19 +561,19 @@ CLASS lcl_object_oriented_base IMPLEMENTATION.
|
||||||
rv_skip = mv_skip_test_classes.
|
rv_skip = mv_skip_test_classes.
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
METHOD lif_object_oriented_object_fnc~get_class_properties.
|
METHOD lif_object_oriented_object_fnc~get_class_properties.
|
||||||
ASSERT 0 = 1.
|
ASSERT 0 = 1. "Subclass responsibility
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
METHOD lif_object_oriented_object_fnc~get_interface_properties.
|
METHOD lif_object_oriented_object_fnc~get_interface_properties.
|
||||||
ASSERT 0 = 1.
|
ASSERT 0 = 1. "Subclass responsibility
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
METHOD lif_object_oriented_object_fnc~read_text_pool.
|
METHOD lif_object_oriented_object_fnc~read_text_pool.
|
||||||
ASSERT 0 = 1.
|
ASSERT 0 = 1. "Subclass responsibility
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
METHOD lif_object_oriented_object_fnc~read_sotr.
|
METHOD lif_object_oriented_object_fnc~read_sotr.
|
||||||
ASSERT 0 = 1.
|
ASSERT 0 = 1. "Subclass responsibility
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
METHOD lif_object_oriented_object_fnc~read_documentation.
|
METHOD lif_object_oriented_object_fnc~read_documentation.
|
||||||
|
@ -611,6 +612,10 @@ CLASS lcl_object_oriented_base IMPLEMENTATION.
|
||||||
DELETE rt_descriptions WHERE descript IS INITIAL.
|
DELETE rt_descriptions WHERE descript IS INITIAL.
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD lif_object_oriented_object_fnc~delete.
|
||||||
|
ASSERT 0 = 1. "Subclass responsibility
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
ENDCLASS.
|
ENDCLASS.
|
||||||
|
|
||||||
|
|
||||||
|
@ -626,7 +631,9 @@ CLASS lcl_object_oriented_class DEFINITION
|
||||||
lif_object_oriented_object_fnc~get_includes REDEFINITION,
|
lif_object_oriented_object_fnc~get_includes REDEFINITION,
|
||||||
lif_object_oriented_object_fnc~get_class_properties REDEFINITION,
|
lif_object_oriented_object_fnc~get_class_properties REDEFINITION,
|
||||||
lif_object_oriented_object_fnc~read_text_pool REDEFINITION,
|
lif_object_oriented_object_fnc~read_text_pool REDEFINITION,
|
||||||
lif_object_oriented_object_fnc~read_sotr REDEFINITION.
|
lif_object_oriented_object_fnc~read_sotr REDEFINITION,
|
||||||
|
lif_object_oriented_object_fnc~delete REDEFINITION.
|
||||||
|
|
||||||
ENDCLASS.
|
ENDCLASS.
|
||||||
CLASS lcl_object_oriented_class IMPLEMENTATION.
|
CLASS lcl_object_oriented_class IMPLEMENTATION.
|
||||||
METHOD lif_object_oriented_object_fnc~create.
|
METHOD lif_object_oriented_object_fnc~create.
|
||||||
|
@ -860,6 +867,22 @@ CLASS lcl_object_oriented_class IMPLEMENTATION.
|
||||||
ENDLOOP.
|
ENDLOOP.
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD lif_object_oriented_object_fnc~delete.
|
||||||
|
CALL FUNCTION 'SEO_CLASS_DELETE_COMPLETE'
|
||||||
|
EXPORTING
|
||||||
|
clskey = is_deletion_key
|
||||||
|
EXCEPTIONS
|
||||||
|
not_existing = 1
|
||||||
|
is_interface = 2
|
||||||
|
db_error = 3
|
||||||
|
no_access = 4
|
||||||
|
other = 5
|
||||||
|
OTHERS = 6.
|
||||||
|
IF sy-subrc <> 0.
|
||||||
|
lcx_exception=>raise( 'Error from SEO_CLASS_DELETE_COMPLETE' ).
|
||||||
|
ENDIF.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
ENDCLASS.
|
ENDCLASS.
|
||||||
|
|
||||||
CLASS lcl_object_oriented_interface DEFINITION
|
CLASS lcl_object_oriented_interface DEFINITION
|
||||||
|
@ -868,7 +891,8 @@ CLASS lcl_object_oriented_interface DEFINITION
|
||||||
METHODS:
|
METHODS:
|
||||||
lif_object_oriented_object_fnc~create REDEFINITION,
|
lif_object_oriented_object_fnc~create REDEFINITION,
|
||||||
lif_object_oriented_object_fnc~get_includes REDEFINITION,
|
lif_object_oriented_object_fnc~get_includes REDEFINITION,
|
||||||
lif_object_oriented_object_fnc~get_interface_properties REDEFINITION.
|
lif_object_oriented_object_fnc~get_interface_properties REDEFINITION,
|
||||||
|
lif_object_oriented_object_fnc~delete REDEFINITION.
|
||||||
ENDCLASS.
|
ENDCLASS.
|
||||||
|
|
||||||
CLASS lcl_object_oriented_interface IMPLEMENTATION.
|
CLASS lcl_object_oriented_interface IMPLEMENTATION.
|
||||||
|
@ -916,6 +940,21 @@ CLASS lcl_object_oriented_interface IMPLEMENTATION.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD lif_object_oriented_object_fnc~delete.
|
||||||
|
CALL FUNCTION 'SEO_INTERFACE_DELETE_COMPLETE'
|
||||||
|
EXPORTING
|
||||||
|
intkey = is_deletion_key
|
||||||
|
EXCEPTIONS
|
||||||
|
not_existing = 1
|
||||||
|
is_class = 2
|
||||||
|
db_error = 3
|
||||||
|
no_access = 4
|
||||||
|
other = 5
|
||||||
|
OTHERS = 6.
|
||||||
|
IF sy-subrc <> 0.
|
||||||
|
lcx_exception=>raise( 'Error from SEO_INTERFACE_DELETE_COMPLETE' ).
|
||||||
|
ENDIF.
|
||||||
|
ENDMETHOD.
|
||||||
ENDCLASS.
|
ENDCLASS.
|
||||||
|
|
||||||
CLASS lth_oo_factory_injector DEFINITION DEFERRED.
|
CLASS lth_oo_factory_injector DEFINITION DEFERRED.
|
||||||
|
@ -1083,44 +1122,10 @@ CLASS lcl_object_clas IMPLEMENTATION.
|
||||||
ENDMETHOD. "jump
|
ENDMETHOD. "jump
|
||||||
|
|
||||||
METHOD lif_object~delete.
|
METHOD lif_object~delete.
|
||||||
|
|
||||||
DATA: ls_clskey TYPE seoclskey.
|
DATA: ls_clskey TYPE seoclskey.
|
||||||
|
|
||||||
|
|
||||||
ls_clskey-clsname = ms_item-obj_name.
|
ls_clskey-clsname = ms_item-obj_name.
|
||||||
|
|
||||||
CASE ms_item-obj_type.
|
mo_object_oriented_object_fct->delete( ls_clskey ).
|
||||||
WHEN 'CLAS'.
|
|
||||||
CALL FUNCTION 'SEO_CLASS_DELETE_COMPLETE'
|
|
||||||
EXPORTING
|
|
||||||
clskey = ls_clskey
|
|
||||||
EXCEPTIONS
|
|
||||||
not_existing = 1
|
|
||||||
is_interface = 2
|
|
||||||
db_error = 3
|
|
||||||
no_access = 4
|
|
||||||
other = 5
|
|
||||||
OTHERS = 6.
|
|
||||||
IF sy-subrc <> 0.
|
|
||||||
lcx_exception=>raise( 'Error from SEO_CLASS_DELETE_COMPLETE' ).
|
|
||||||
ENDIF.
|
|
||||||
WHEN 'INTF'.
|
|
||||||
CALL FUNCTION 'SEO_INTERFACE_DELETE_COMPLETE'
|
|
||||||
EXPORTING
|
|
||||||
intkey = ls_clskey
|
|
||||||
EXCEPTIONS
|
|
||||||
not_existing = 1
|
|
||||||
is_class = 2
|
|
||||||
db_error = 3
|
|
||||||
no_access = 4
|
|
||||||
other = 5
|
|
||||||
OTHERS = 6.
|
|
||||||
IF sy-subrc <> 0.
|
|
||||||
lcx_exception=>raise( 'Error from SEO_INTERFACE_DELETE_COMPLETE' ).
|
|
||||||
ENDIF.
|
|
||||||
WHEN OTHERS.
|
|
||||||
lcx_exception=>raise( 'class delete, unknown type' ).
|
|
||||||
ENDCASE.
|
|
||||||
ENDMETHOD. "delete
|
ENDMETHOD. "delete
|
||||||
|
|
||||||
METHOD lif_object~serialize.
|
METHOD lif_object~serialize.
|
||||||
|
|
|
@ -30,6 +30,7 @@ CLASS ltd_spy_oo_object DEFINITION FOR TESTING.
|
||||||
mv_exists TYPE abap_bool,
|
mv_exists TYPE abap_bool,
|
||||||
mv_exists_called TYPE abap_bool,
|
mv_exists_called TYPE abap_bool,
|
||||||
ms_serialize_key TYPE seoclskey,
|
ms_serialize_key TYPE seoclskey,
|
||||||
|
ms_delete_key TYPE seoclskey,
|
||||||
mv_skip_test_classes TYPE abap_bool.
|
mv_skip_test_classes TYPE abap_bool.
|
||||||
PRIVATE SECTION.
|
PRIVATE SECTION.
|
||||||
|
|
||||||
|
@ -144,6 +145,10 @@ CLASS ltd_spy_oo_object IMPLEMENTATION.
|
||||||
rv_skip = mv_skip_test_classes.
|
rv_skip = mv_skip_test_classes.
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD lif_object_oriented_object_fnc~delete.
|
||||||
|
ms_delete_key = is_deletion_key.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
ENDCLASS.
|
ENDCLASS.
|
||||||
|
|
||||||
CLASS ltd_fake_object_files DEFINITION FOR TESTING
|
CLASS ltd_fake_object_files DEFINITION FOR TESTING
|
||||||
|
@ -1253,3 +1258,59 @@ CLASS ltcl_serialize_interface IMPLEMENTATION.
|
||||||
exp = abap_true ).
|
exp = abap_true ).
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
ENDCLASS.
|
ENDCLASS.
|
||||||
|
|
||||||
|
CLASS ltcl_delete_oo_test DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT
|
||||||
|
INHERITING FROM ltc_oo_test.
|
||||||
|
PRIVATE SECTION.
|
||||||
|
METHODS:
|
||||||
|
setup,
|
||||||
|
class_delete FOR TESTING RAISING cx_static_check,
|
||||||
|
interface_delete FOR TESTING RAISING cx_static_check.
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
CLASS ltcl_delete_oo_test IMPLEMENTATION.
|
||||||
|
METHOD setup.
|
||||||
|
CREATE OBJECT mo_spy_oo_object_functions.
|
||||||
|
me->mo_spy_oo_object_functions->mv_exists = abap_true.
|
||||||
|
lth_oo_factory_injector=>inject( mo_spy_oo_object_functions ).
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD class_delete.
|
||||||
|
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->delete( ).
|
||||||
|
|
||||||
|
DATA ls_expected_delete_key TYPE seoclskey.
|
||||||
|
ls_expected_delete_key-clsname = ms_item-obj_name.
|
||||||
|
|
||||||
|
cl_abap_unit_assert=>assert_equals(
|
||||||
|
act = me->mo_spy_oo_object_functions->ms_delete_key
|
||||||
|
exp = ls_expected_delete_key ).
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD interface_delete.
|
||||||
|
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->delete( ).
|
||||||
|
|
||||||
|
DATA ls_expected_delete_key TYPE seoclskey.
|
||||||
|
ls_expected_delete_key-clsname = ms_item-obj_name.
|
||||||
|
|
||||||
|
cl_abap_unit_assert=>assert_equals(
|
||||||
|
act = me->mo_spy_oo_object_functions->ms_delete_key
|
||||||
|
exp = ls_expected_delete_key ).
|
||||||
|
ENDMETHOD.
|
||||||
|
ENDCLASS.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user