-
Notifications
You must be signed in to change notification settings - Fork 6
/
zake_mocka.prog.abap
174 lines (149 loc) · 5.58 KB
/
zake_mocka.prog.abap
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
*&---------------------------------------------------------------------*
*& Report ZAKE_MOCKA
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zake_mocka.
CONSTANTS cl_svn TYPE seoclsname VALUE 'ZCL_ZAKE_SVN'.
CONSTANTS cl_tortoise_svn TYPE seoclsname VALUE 'ZCL_ZAKE_TORTOISE_SVN'.
DATA package TYPE devclass.
DATA zake TYPE REF TO zake.
DATA objects TYPE scts_tadir.
DATA object LIKE LINE OF objects.
DATA files TYPE string_table.
DATA file LIKE LINE OF files.
DATA zake_build TYPE string.
DATA zake_nuggetname TYPE string.
DATA comment_str TYPE string.
DATA loclpath_str TYPE string.
DATA svnpath_str TYPE string.
DATA username_str TYPE string.
DATA password_str TYPE string.
DATA class TYPE seoclsname.
DATA lv_package_nr TYPE i.
DATA: ex TYPE REF TO zcx_saplink,
message TYPE string.
SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE a.
PARAMETERS:
* checkout TYPE flag RADIOBUTTON GROUP act,
* update TYPE flag RADIOBUTTON GROUP act,
install TYPE flag RADIOBUTTON GROUP act,
export TYPE flag RADIOBUTTON GROUP act,
build TYPE flag RADIOBUTTON GROUP act DEFAULT 'X'.
* checkin TYPE flag RADIOBUTTON GROUP act.
SELECTION-SCREEN END OF BLOCK a.
SELECTION-SCREEN BEGIN OF BLOCK b WITH FRAME TITLE b.
PARAMETERS:
svn TYPE flag RADIOBUTTON GROUP cl,
tortoise TYPE flag RADIOBUTTON GROUP cl.
SELECTION-SCREEN END OF BLOCK b.
SELECTION-SCREEN BEGIN OF BLOCK c WITH FRAME TITLE c.
PARAMETERS:
loclpath TYPE char512 LOWER CASE OBLIGATORY,
zakenugg TYPE char512 LOWER CASE OBLIGATORY,
svnpath TYPE char512 DEFAULT '-' LOWER CASE OBLIGATORY,
comment TYPE char512 DEFAULT '' LOWER CASE,
testrun TYPE flag DEFAULT 'X'.
SELECTION-SCREEN END OF BLOCK c.
INITIALIZATION.
a = 'Action'.
b = 'Version Controll Program'.
c = 'Parameters'.
START-OF-SELECTION.
svnpath_str = svnpath.
loclpath_str = loclpath.
zake_nuggetname = zakenugg.
comment_str = comment.
" SELECT * INTO TABLE objects FROM tadir WHERE devclass = 'ZABAP2XLSX'.
" DELETE zake_objects WHERE object = 'DEVC'.
TRY.
IF svn = 'X'.
class = cl_svn.
ELSE.
class = cl_tortoise_svn.
ENDIF.
DO 3 TIMES.
CLEAR: objects.
ADD 1 TO lv_package_nr.
CREATE OBJECT zake
TYPE
(class)
EXPORTING
i_svnpath = svnpath_str
i_localpath = loclpath_str.
zake->set_testrun( testrun ).
zake->set_package( 'Z_MOCKA' ).
" Build Object list for Export
object-object = 'CLAS'.
object-obj_name = 'ZCL_MOCKA_HELPER_MOCKER'.
APPEND object TO objects.
object-obj_name = 'ZCL_MOCKA_MOCKER'.
APPEND object TO objects.
object-obj_name = 'ZCL_MOCKA_MOCKER_METHOD'.
APPEND object TO objects.
object-obj_name = 'ZCL_MOCKA_VALUE_COMPARISON'.
APPEND object TO objects.
object-obj_name = 'ZCX_MOCKA'.
APPEND object TO objects.
object-obj_name = 'ZCL_MOCKA_FLIGHT_OBSERVER'.
APPEND object TO objects.
object-obj_name = 'ZCL_MOCKA_MOCKER_ATTRIBUTE'.
APPEND object TO objects.
object-obj_name = 'ZCX_MOCKA_IN_TIME_EXCEPTION'.
APPEND object TO objects.
object-object = 'INTF'.
object-obj_name = 'ZIF_MOCKA_MOCKER'.
APPEND object TO objects.
object-obj_name = 'ZIF_MOCKA_MOCKER_METHOD'.
APPEND object TO objects.
object-obj_name = 'ZIF_MOCKA_FLIGHT_ALERT_PROCESS'.
APPEND object TO objects.
object-obj_name = 'ZIF_MOCKA_IS_IN_TIME_INFO'.
APPEND object TO objects.
object-obj_name = 'ZIF_MOCKA_MOCKER_METHOD_RUNTIM'.
APPEND object TO objects.
object-obj_name = 'ZIF_MOCKA_MOCKER_ATTRIBUTE'.
APPEND object TO objects.
object-object = 'PROG'.
object-obj_name = 'ZTEST_CL_MOCKA_FLIGHT_OBSERVER'.
APPEND object TO objects.
object-obj_name = 'ZTEST_CL_MOCKA_MOCKER'.
APPEND object TO objects.
object-obj_name = 'ZMOCKA_DEMO'.
APPEND object TO objects.
object-obj_name = 'ZTEST_CL_MOCKA_CLASS_GEN'.
APPEND object TO objects.
* object-obj_name = 'ZAKE_MOCKA'.
* APPEND object TO objects.
object-object = 'MSAG'.
object-obj_name = 'ZMOCKA_EXC_MOCK'.
APPEND object TO objects.
IF install = 'X'.
zake->install_slinkees_from_lm( testrun ).
IF testrun IS INITIAL.
zake->activate_package_objects( ).
zake->set_package_of_package_objects( ).
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
ENDIF.
ELSEIF export = 'X'.
zake->set_checkin_objects( objects ).
zake->download_slinkees_to_lm = abap_true.
zake->download_nugget_to_lm = space.
zake->download_zip_to_lm_flag = space.
zake->create_slinkees( ).
ELSEIF build = 'X'.
" Build a complete package for download
zake->set_checkin_objects( objects ).
" We don't want that for the complete Package Slinkees are created
" in the ZAKE folder
zake->download_slinkees_to_lm = space.
zake->download_nugget_to_lm = abap_true.
zake->create_slinkees( zake_nuggetname ).
ENDIF.
ENDDO.
CATCH zcx_saplink INTO ex.
message = ex->msg.
WRITE: / 'An Error occured: ', message.
ENDTRY.