itoolkit 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +13 -8
  2. package/lib/CommandCall.js +2 -16
  3. package/lib/Connection.js +2 -17
  4. package/lib/Deprecated.js +5 -26
  5. package/lib/ProgramCall.js +4 -18
  6. package/lib/itoolkit.js +2 -16
  7. package/lib/transports/httpTransport.js +4 -18
  8. package/lib/transports/idbTransport.js +24 -26
  9. package/lib/transports/odbcTransport.js +16 -16
  10. package/lib/transports/sshTransport.js +5 -20
  11. package/package.json +23 -16
  12. package/.eslintrc.js +0 -13
  13. package/.gitattributes +0 -2
  14. package/.readthedocs.yml +0 -16
  15. package/CHANGELOG.md +0 -195
  16. package/contributors.txt +0 -2
  17. package/test/README.md +0 -46
  18. package/test/functional/CommandCallFunctional.js +0 -79
  19. package/test/functional/ProgramCallFunctional.js +0 -166
  20. package/test/functional/checkObjectExists.js +0 -182
  21. package/test/functional/config.js +0 -35
  22. package/test/functional/deprecated/commandsFunctional.js +0 -99
  23. package/test/functional/deprecated/iDataQueueFunctional.js +0 -104
  24. package/test/functional/deprecated/iNetworkFunctional.js +0 -160
  25. package/test/functional/deprecated/iObjFunctional.js +0 -350
  26. package/test/functional/deprecated/iPgmFunctional.js +0 -140
  27. package/test/functional/deprecated/iProdFunctional.js +0 -161
  28. package/test/functional/deprecated/iSqlFunctional.js +0 -455
  29. package/test/functional/deprecated/iUserSpaceFunctional.js +0 -127
  30. package/test/functional/deprecated/iWorkFunctional.js +0 -236
  31. package/test/functional/iDataQueueFunctional.js +0 -84
  32. package/test/functional/iNetworkFunctional.js +0 -133
  33. package/test/functional/iObjFunctional.js +0 -327
  34. package/test/functional/iProdFunctional.js +0 -135
  35. package/test/functional/iSqlFunctional.js +0 -449
  36. package/test/functional/iUserSpaceFunctional.js +0 -123
  37. package/test/functional/iWorkFunctional.js +0 -219
  38. package/test/unit/CommandCallUnit.js +0 -88
  39. package/test/unit/ConnectionUnit.js +0 -195
  40. package/test/unit/ProgamCallUnit.js +0 -279
  41. package/test/unit/deprecated/commandsUnit.js +0 -88
  42. package/test/unit/deprecated/iConnUnit.js +0 -162
  43. package/test/unit/deprecated/iPgmUnit.js +0 -207
  44. package/test/unit/deprecated/iSqlUnit.js +0 -442
  45. package/test/unit/deprecated/xmlToJsonUnit.js +0 -203
@@ -1,350 +0,0 @@
1
- // Copyright (c) International Business Machines Corp. 2019
2
-
3
- // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
4
- // associated documentation files (the "Software"), to deal in the Software without restriction,
5
- // including without limitation the rights to use, copy, modify, merge, publish, distribute,
6
- // sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
7
- // furnished to do so, subject to the following conditions:
8
-
9
- // The above copyright notice and this permission notice shall be included in all copies or
10
- // substantial portions of the Software.
11
-
12
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
13
- // NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
14
- // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
15
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
17
-
18
- /* eslint-env mocha */
19
- /* eslint-disable new-cap */
20
-
21
- const { expect } = require('chai');
22
- const { iConn, iObj } = require('../../../lib/itoolkit');
23
- const { config, printConfig } = require('../config');
24
-
25
- // deprecated tests are in place to test compatability using deprecated classes and functions
26
- // these tests use deprecated iConn Class to create a connnection
27
- // iConn only supported idb and rest transports
28
- if (config.transport !== 'idb' && config.transport !== 'rest') {
29
- throw new Error('Only idb and rest transports are available for deprecated tests');
30
- }
31
-
32
- const {
33
- database, username, password, host, port = 80, path,
34
- } = config.transportOptions;
35
-
36
- let restOptions = null;
37
- if (config.transport === 'rest') {
38
- restOptions = {
39
- host,
40
- port,
41
- path,
42
- };
43
- }
44
-
45
- describe('iObj Functional Tests', () => {
46
- before(() => {
47
- printConfig();
48
- });
49
-
50
- describe('constructor', () => {
51
- it('creates and returns an instance of iObj', () => {
52
- const connection = new iConn(database, config.user, password);
53
-
54
- const obj = new iObj(connection);
55
-
56
- expect(obj).to.be.instanceOf(iObj);
57
- });
58
- });
59
-
60
- describe('retrUsrAuth', () => {
61
- it(`returns uses's authority for an object using ${config.transport} tranport`, (done) => {
62
- const connection = new iConn(database, username, password, restOptions);
63
-
64
- const obj = new iObj(connection);
65
-
66
- obj.retrUsrAuth('*PUBLIC', '*PGM', 'XMLCGI', 'QXMLSERV', (output) => {
67
- expect(output).to.be.an('Object');
68
- expect(output).to.have.a.property('Object_authority_/_Data_authority');
69
- expect(output).to.have.a.property('Authorization_list_management');
70
- expect(output).to.have.a.property('Object_operational');
71
- expect(output).to.have.a.property('Object_management');
72
- expect(output).to.have.a.property('Object_existence');
73
- expect(output).to.have.a.property('Data_read');
74
- expect(output).to.have.a.property('Data_add');
75
- expect(output).to.have.a.property('Data_update');
76
- expect(output).to.have.a.property('Data_delete');
77
- expect(output).to.have.a.property('Authorization_list');
78
- expect(output).to.have.a.property('Authority_source');
79
- expect(output).to.have.a.property('Some_adopted_authority');
80
- expect(output).to.have.a.property('Adopted_object_authority');
81
- expect(output).to.have.a.property('Adopted_authorization_list_management');
82
- expect(output).to.have.a.property('Adopted_object_operational');
83
- expect(output).to.have.a.property('Adopted_object_management');
84
- expect(output).to.have.a.property('Adopted_object_existence');
85
- expect(output).to.have.a.property('Adopted_data_read');
86
- expect(output).to.have.a.property('Adopted_data_add');
87
- expect(output).to.have.a.property('Adopted_data_update');
88
- expect(output).to.have.a.property('Adopted_data_delete');
89
- expect(output).to.have.a.property('Adopted_data_execute');
90
- expect(output).to.have.a.property('Adopted_object_alter');
91
- expect(output).to.have.a.property('Adopted_object_reference');
92
- expect(output).to.have.a.property('Data_execute');
93
- expect(output).to.have.a.property('Object_alter');
94
- expect(output).to.have.a.property('Object_reference');
95
- expect(output).to.have.a.property('ASP_device_name_of_library');
96
- expect(output).to.have.a.property('ASP_device_name_of_object');
97
- expect(output).to.have.a.property('Offset_to_group_information_table');
98
- expect(output).to.have.a.property('Number_of_group_table_entries_returned');
99
- done();
100
- });
101
- });
102
- });
103
-
104
- describe('rtrCmdInfo', () => {
105
- it('returns command info', (done) => {
106
- const connection = new iConn(database, username, password, restOptions);
107
-
108
- const obj = new iObj(connection);
109
-
110
- obj.retrCmdInfo('CRTLIB', '*LIBL', (output) => {
111
- expect(output).to.be.an('Object');
112
- expect(output).to.have.a.property('Command_name');
113
- expect(output).to.have.a.property('Command_library_name');
114
- expect(output).to.have.a.property('Command_processing_program_or_proxy_target_command');
115
- expect(output).to.have.a.property('Command_processing_program\'s_or_proxy_target_command\'s_library_name');
116
- expect(output).to.have.a.property('Source_file_name');
117
- expect(output).to.have.a.property('Source_file_library_name');
118
- expect(output).to.have.a.property('Source_file_member_name');
119
- expect(output).to.have.a.property('Validity_check_program_name');
120
- expect(output).to.have.a.property('Validity_check_program_library_name');
121
- expect(output).to.have.a.property('Mode_information');
122
- expect(output).to.have.a.property('Where_allowed_to_run');
123
- expect(output).to.have.a.property('Allow_limited_user');
124
- expect(output).to.have.a.property('Maximum_positional_parameters');
125
- expect(output).to.have.a.property('Prompt_message_file_name');
126
- expect(output).to.have.a.property('Prompt_message_file_library_name');
127
- expect(output).to.have.a.property('Message_file_name');
128
- expect(output).to.have.a.property('Message_file_library_name');
129
- expect(output).to.have.a.property('Help_panel_group_name');
130
- expect(output).to.have.a.property('Help_panel_group_library_name');
131
- expect(output).to.have.a.property('Help_identifier');
132
- expect(output).to.have.a.property('Search_index_name');
133
- expect(output).to.have.a.property('Search_index_library_name');
134
- expect(output).to.have.a.property('Current_library');
135
- expect(output).to.have.a.property('Product_library');
136
- expect(output).to.have.a.property('Prompt_override_program_name');
137
- expect(output).to.have.a.property('Prompt_override_program_library_name');
138
- expect(output).to.have.a.property('Restricted_to_target_release');
139
- expect(output).to.have.a.property('Text_description');
140
- expect(output).to.have.a.property('Command_processing_program_call_state');
141
- expect(output).to.have.a.property('Validity_check_program_call_state');
142
- expect(output).to.have.a.property('Prompt_override_program_call_state');
143
- expect(output).to.have.a.property('Offset_to_help_bookshelf_information');
144
- expect(output).to.have.a.property('Length_of_help_bookshelf_information');
145
- expect(output).to.have.a.property('Coded_character_set_ID_(CCSID)');
146
- expect(output).to.have.a.property('Enabled_for_GUI_indicator');
147
- expect(output).to.have.a.property('Threadsafe_indicator');
148
- expect(output).to.have.a.property('Multithreaded_job_action');
149
- expect(output).to.have.a.property('Proxy_command_indicator');
150
- expect(output).to.have.a.property('Prompt_message_file_text_indicator');
151
- done();
152
- });
153
- });
154
- });
155
-
156
- describe('retrPgmInfo', () => {
157
- it('returns program info', (done) => {
158
- const connection = new iConn(database, username, password, restOptions);
159
-
160
- const obj = new iObj(connection);
161
-
162
- obj.retrPgmInfo('XMLCGI', 'QXMLSERV', (output) => {
163
- expect(output).to.be.an('Object');
164
- expect(output).to.have.a.property('Program_name');
165
- expect(output).to.have.a.property('Program_library_name');
166
- expect(output).to.have.a.property('Program_owner');
167
- expect(output).to.have.a.property('Program_attribute');
168
- expect(output).to.have.a.property('Creation_date_and_time');
169
- expect(output).to.have.a.property('Source_file_name');
170
- expect(output).to.have.a.property('Source_file_library_name');
171
- expect(output).to.have.a.property('Source_file_member_name');
172
- expect(output).to.have.a.property('Source_file_updated_date_and_time');
173
- expect(output).to.have.a.property('Observable_information');
174
- expect(output).to.have.a.property('User_profile_option');
175
- expect(output).to.have.a.property('Use_adopted_authority');
176
- expect(output).to.have.a.property('Log_commands');
177
- expect(output).to.have.a.property('Allow_RTVCLSRC');
178
- expect(output).to.have.a.property('Fix_decimal_data');
179
- expect(output).to.have.a.property('Text_description');
180
- expect(output).to.have.a.property('Type_of_program');
181
- expect(output).to.have.a.property('Teraspace_storage-enabled_program');
182
- expect(output).to.have.a.property('Minimum_number_of_parameters');
183
- expect(output).to.have.a.property('Maximum_number_of_parameters');
184
- expect(output).to.have.a.property('Program_size');
185
- expect(output).to.have.a.property('Associated_space_size');
186
- expect(output).to.have.a.property('Static_storage_size');
187
- expect(output).to.have.a.property('Automatic_storage_size');
188
- expect(output).to.have.a.property('Number_of_MI_instructions');
189
- expect(output).to.have.a.property('Number_of_MI_ODT_entries');
190
- expect(output).to.have.a.property('Program_state');
191
- expect(output).to.have.a.property('Compiler_identification');
192
- expect(output).to.have.a.property('Earliest_release_program_can_run');
193
- expect(output).to.have.a.property('Sort_sequence_table_name');
194
- expect(output).to.have.a.property('Sort_sequence_table_library_name');
195
- expect(output).to.have.a.property('Language_identifier');
196
- expect(output).to.have.a.property('Program_domain');
197
- expect(output).to.have.a.property('Conversion_required');
198
- expect(output).to.have.a.property('Conversion_details');
199
- expect(output).to.have.a.property('Optimization');
200
- expect(output).to.have.a.property('Paging_pool');
201
- expect(output).to.have.a.property('Update_program_automatic_storage_area_(PASA)');
202
- expect(output).to.have.a.property('Clear_program_automatic_storage_area_(PASA)');
203
- expect(output).to.have.a.property('Paging_amount');
204
- expect(output).to.have.a.property('Program_entry_procedure_module');
205
- expect(output).to.have.a.property('Program_entry_procedure_module_library');
206
- expect(output).to.have.a.property('Activation_group_attribute');
207
- expect(output).to.have.a.property('Observable_information_compressed');
208
- expect(output).to.have.a.property('Run-time_information_compressed');
209
- expect(output).to.have.a.property('Release_program_created_on');
210
- expect(output).to.have.a.property('Shared_activation_group');
211
- expect(output).to.have.a.property('Allow_update');
212
- expect(output).to.have.a.property('Program_CCSID');
213
- expect(output).to.have.a.property('Number_of_modules');
214
- expect(output).to.have.a.property('Number_of_service_programs');
215
- expect(output).to.have.a.property('Number_of_copyrights');
216
- expect(output).to.have.a.property('Number_of_unresolved_references');
217
- expect(output).to.have.a.property('Release_program_created_for');
218
- expect(output).to.have.a.property('Allow_static_storage_reinitialization');
219
- expect(output).to.have.a.property('All_creation_data');
220
- expect(output).to.have.a.property('Allow_bound_*SRVPGM_library_name_update');
221
- expect(output).to.have.a.property('Profiling_data');
222
- expect(output).to.have.a.property('Teraspace_storage_enabled_modules');
223
- expect(output).to.have.a.property('Storage_model');
224
- expect(output).to.have.a.property('Uses_argument_optimization_(ARGOPT)');
225
- done();
226
- });
227
- });
228
- });
229
-
230
- describe('retrSrvPgmInfo', () => {
231
- it('returns service program info', (done) => {
232
- const connection = new iConn(database, username, password, restOptions);
233
-
234
- const obj = new iObj(connection);
235
-
236
- obj.retrSrvPgmInfo('QZSRVSSL', 'QHTTPSVR', (output) => {
237
- expect(output).to.be.an('Object');
238
- expect(output).to.have.a.property('Service_program_name');
239
- expect(output).to.have.a.property('Service_program_name');
240
- expect(output).to.have.a.property('Service_program_owner');
241
- expect(output).to.have.a.property('Service_program_attribute');
242
- expect(output).to.have.a.property('Creation_date_and_time');
243
- expect(output).to.have.a.property('Export_source_file_name');
244
- expect(output).to.have.a.property('Export_source_file_library_name');
245
- expect(output).to.have.a.property('Export_source_file_member_name');
246
- expect(output).to.have.a.property('Activation_group_attribute');
247
- expect(output).to.have.a.property('Current_export_signature');
248
- expect(output).to.have.a.property('User_profile');
249
- expect(output).to.have.a.property('Observable_information_compressed');
250
- expect(output).to.have.a.property('Run-time_information_compressed');
251
- expect(output).to.have.a.property('Run-time_information_compressed');
252
- expect(output).to.have.a.property('Service_program_CCSID');
253
- expect(output).to.have.a.property('Number_of_modules');
254
- expect(output).to.have.a.property('Number_of_service_programs');
255
- expect(output).to.have.a.property('Number_of_copyrights');
256
- expect(output).to.have.a.property('Text_description');
257
- expect(output).to.have.a.property('Shared_activation_group');
258
- expect(output).to.have.a.property('Allow_update');
259
- expect(output).to.have.a.property('Number_of_unresolved_references');
260
- expect(output).to.have.a.property('Use_adopted_authority');
261
- expect(output).to.have.a.property('Allow_bound_*SRVPGM_library_name_update');
262
- expect(output).to.have.a.property('Profiling_data');
263
- expect(output).to.have.a.property('Teraspace_storage_enabled_modules');
264
- expect(output).to.have.a.property('Storage_model');
265
- expect(output).to.have.a.property('Uses_argument_optimization_(ARGOPT)');
266
- expect(output).to.have.a.property('Service_program_state');
267
- expect(output).to.have.a.property('Service_program_domain');
268
- expect(output).to.have.a.property('Associated_space_size');
269
- expect(output).to.have.a.property('Static_storage_size');
270
- expect(output).to.have.a.property('Service_program_size');
271
- expect(output).to.have.a.property('Release_service_program_created_on');
272
- expect(output).to.have.a.property('Earliest_release_service_program_can_run');
273
- expect(output).to.have.a.property('Release_service_program_created_for');
274
- expect(output).to.have.a.property('Allow_static_storage_reinitialization');
275
- expect(output).to.have.a.property('Conversion_required');
276
- expect(output).to.have.a.property('All_creation_data');
277
- expect(output).to.have.a.property('Conversion_details');
278
- expect(output).to.have.a.property('Paging_pool');
279
- expect(output).to.have.a.property('Paging_amount');
280
- done();
281
- });
282
- });
283
- });
284
-
285
- describe('retrUserInfo', () => {
286
- it('returns specified user profile info', (done) => {
287
- const connection = new iConn(database, username, password, restOptions);
288
-
289
- const obj = new iObj(connection);
290
-
291
- obj.retrUserInfo('QSYS', (output) => {
292
- expect(output).to.be.an('Object');
293
- expect(output).to.have.a.property('User_profile_name');
294
- expect(output).to.have.a.property('Previous_sign-on_date_and_time');
295
- expect(output).to.have.a.property('Sign-on_attempts_not_valid');
296
- expect(output).to.have.a.property('Status');
297
- expect(output).to.have.a.property('Password_change_date');
298
- expect(output).to.have.a.property('No_password_indicator');
299
- expect(output).to.have.a.property('Password_expiration_interval');
300
- expect(output).to.have.a.property('Date_password_expires');
301
- expect(output).to.have.a.property('Days_until_password_expires');
302
- expect(output).to.have.a.property('Set_password_to_expire');
303
- expect(output).to.have.a.property('Display_sign-on_information');
304
- expect(output).to.have.a.property('Local_password_management');
305
- expect(output).to.have.a.property('Block_password_change');
306
- done();
307
- });
308
- });
309
- });
310
-
311
- describe('retrUsrAuthToObj', () => {
312
- it(`retrieves info for users who are authorized to an object using ${config.transport} transpsort`, (done) => {
313
- const connection = new iConn(database, username, password, restOptions);
314
-
315
- const obj = new iObj(connection);
316
-
317
- obj.retrUserAuthToObj('/home', (output) => {
318
- expect(output).to.be.an('Object');
319
- expect(output).to.have.a.property('Profile_name');
320
- expect(output).to.have.a.property('User_or_group_indicator');
321
- expect(output).to.have.a.property('Data_authority');
322
- expect(output).to.have.a.property('Authorization_list_management');
323
- expect(output).to.have.a.property('Object_management');
324
- expect(output).to.have.a.property('Object_existence');
325
- expect(output).to.have.a.property('Object_alter');
326
- expect(output).to.have.a.property('Object_reference');
327
- expect(output).to.have.a.property('Object_operational');
328
- expect(output).to.have.a.property('Data_read');
329
- expect(output).to.have.a.property('Data_add');
330
- expect(output).to.have.a.property('Data_update');
331
- expect(output).to.have.a.property('Data_delete');
332
- expect(output).to.have.a.property('Data_execute');
333
- done();
334
- });
335
- });
336
- });
337
-
338
- describe('addToLibraryList', () => {
339
- it('appends lib to user\'s lib list', (done) => {
340
- const connection = new iConn(database, username, password, restOptions);
341
-
342
- const obj = new iObj(connection);
343
-
344
- obj.addToLibraryList('QHTTPSVR', (output) => {
345
- expect(output).to.be.a('boolean').and.to.equal(true);
346
- done();
347
- });
348
- });
349
- });
350
- });
@@ -1,140 +0,0 @@
1
- // Copyright (c) International Business Machines Corp. 2019
2
-
3
- // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
4
- // associated documentation files (the "Software"), to deal in the Software without restriction,
5
- // including without limitation the rights to use, copy, modify, merge, publish, distribute,
6
- // sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
7
- // furnished to do so, subject to the following conditions:
8
-
9
- // The above copyright notice and this permission notice shall be included in all copies or
10
- // substantial portions of the Software.
11
-
12
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
13
- // NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
14
- // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
15
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
17
-
18
- /* eslint-env mocha */
19
- /* eslint-disable new-cap */
20
-
21
- const { expect } = require('chai');
22
- const { parseString } = require('xml2js');
23
- const { iPgm, iConn } = require('../../../lib/itoolkit');
24
- const { config, printConfig } = require('../config');
25
-
26
- // deprecated tests are in place to test compatability using deprecated classes and functions
27
- // these tests use deprecated iConn Class to create a connnection
28
- // iConn only supported idb and rest transports
29
- if (config.transport !== 'idb' && config.transport !== 'rest') {
30
- throw new Error('Only idb and rest transports are available for deprecated tests');
31
- }
32
-
33
- const {
34
- database, username, password, host, port = 80, path,
35
- } = config.transportOptions;
36
-
37
- let restOptions = null;
38
- if (config.transport === 'rest') {
39
- restOptions = {
40
- host,
41
- port,
42
- path,
43
- };
44
- }
45
-
46
- describe('iPgm Functional Tests', () => {
47
- before(() => {
48
- printConfig();
49
- });
50
-
51
- describe('Test iPgm()', () => {
52
- it('calls QWCRSVAL program checks if it ran successfully', (done) => {
53
- const connection = new iConn(database, username, password, restOptions);
54
-
55
- const program = new iPgm('QWCRSVAL', { lib: 'QSYS' });
56
-
57
- const outBuf = [
58
- [0, '10i0'],
59
- [0, '10i0'],
60
- ['', '36h'],
61
- ['', '10A'],
62
- ['', '1A'],
63
- ['', '1A'],
64
- [0, '10i0'],
65
- [0, '10i0'],
66
- ];
67
- program.addParam(outBuf, { io: 'out' });
68
- program.addParam(66, '10i0');
69
- program.addParam(1, '10i0');
70
- program.addParam('QCCSID', '10A');
71
- program.addParam(this.errno, { io: 'both', len: 'rec2' });
72
- connection.add(program);
73
- connection.run((xmlOut) => {
74
- parseString(xmlOut, (parseError, result) => {
75
- expect(parseError).to.equal(null);
76
- expect(result.myscript.pgm[0].success[0]).to.include('+++ success QSYS QWCRSVAL');
77
- done();
78
- });
79
- });
80
- });
81
- });
82
-
83
-
84
- describe('Test iPgm()', () => {
85
- it('calls QWCRSVAL program and returns arbitrarily named parameter', (done) => {
86
- const connection = new iConn(database, username, password, restOptions);
87
-
88
- const program = new iPgm('QWCRSVAL', { lib: 'QSYS' });
89
-
90
- const outBuf = [
91
- [0, '10i0'],
92
- [0, '10i0'],
93
- ['', '36h'],
94
- ['', '10A'],
95
- ['', '1A'],
96
- ['', '1A'],
97
- [0, '10i0'],
98
- [0, '10i0'],
99
- ];
100
- program.addParam(outBuf, { io: 'out' });
101
- program.addParam(66, '10i0');
102
- program.addParam(1, '10i0');
103
- program.addParam('QCCSID', '10A');
104
- const paramValue = 'errno';
105
-
106
- program.addParam(this.errno, { io: 'both', len: 'rec2', name: paramValue });
107
- connection.add(program);
108
- connection.run((xmlOut) => {
109
- parseString(xmlOut, (parseError, result) => {
110
- expect(parseError).to.equal(null);
111
- expect(result.myscript.pgm[0].success[0]).to.include('+++ success QSYS QWCRSVAL');
112
- done();
113
- });
114
- });
115
- });
116
- });
117
-
118
- describe.skip('Test iPgm()', () => {
119
- // ZZSRV6 program requires XMLSERVICE built with tests
120
- // Skip for now, we need to add before hook to check if ZZSRV6 is available
121
- it.skip('Should be successful with addReturn arbitrary attribute specified using', (done) => {
122
- const connection = new iConn(database, username, password, restOptions);
123
-
124
- const program = new iPgm('ZZSRV6', { lib: 'XMLSERVICE', func: 'ZZVARY4' });
125
-
126
- program.addParam('Gill', '10A', { varying: '4' });
127
- const testValue = 'NEW_NAME';
128
- program.addReturn('0', '20A', { varying: '4', name: testValue });
129
- connection.add(program);
130
- connection.run((xmlOut) => {
131
- parseString(xmlOut, (parseError, result) => {
132
- expect(parseError).to.equal(null);
133
- expect(result.myscript.pgm[0].success[0]).to.include('+++ success');
134
- expect(result.myscript.pgm[0].return[0].data[0]._).to.equal('my name is Gill');
135
- done();
136
- });
137
- });
138
- });
139
- });
140
- });
@@ -1,161 +0,0 @@
1
- // Copyright (c) International Business Machines Corp. 2019
2
-
3
- // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
4
- // associated documentation files (the "Software"), to deal in the Software without restriction,
5
- // including without limitation the rights to use, copy, modify, merge, publish, distribute,
6
- // sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
7
- // furnished to do so, subject to the following conditions:
8
-
9
- // The above copyright notice and this permission notice shall be included in all copies or
10
- // substantial portions of the Software.
11
-
12
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
13
- // NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
14
- // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
15
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
17
-
18
- /* eslint-env mocha */
19
- /* eslint-disable new-cap */
20
-
21
- const { expect } = require('chai');
22
- const { iConn, iProd } = require('../../../lib/itoolkit');
23
- const { config, printConfig } = require('../config');
24
-
25
- // deprecated tests are in place to test compatability using deprecated classes and functions
26
- // these tests use deprecated iConn Class to create a connnection
27
- // iConn only supported idb and rest transports
28
- if (config.transport !== 'idb' && config.transport !== 'rest') {
29
- throw new Error('Only idb and rest transports are available for deprecated tests');
30
- }
31
-
32
- const {
33
- database, username, password, host, port = 80, path,
34
- } = config.transportOptions;
35
-
36
- let restOptions = null;
37
- if (config.transport === 'rest') {
38
- restOptions = {
39
- host,
40
- port,
41
- path,
42
- };
43
- }
44
-
45
- describe('iProd Functional Tests', () => {
46
- before(() => {
47
- printConfig();
48
- });
49
-
50
- describe('constructor', () => {
51
- it('creates and returns an instance of iProd', () => {
52
- const connection = new iConn(database, config.user, password);
53
-
54
- const prod = new iProd(connection);
55
-
56
- expect(prod).to.be.instanceOf(iProd);
57
- });
58
- });
59
-
60
- describe('getPTFInfo', () => {
61
- it('returns info for specified ptf', (done) => {
62
- const connection = new iConn(database, username, password, restOptions);
63
-
64
- const prod = new iProd(connection);
65
-
66
- prod.getPTFInfo('SI67726', (ptf) => {
67
- expect(ptf).to.be.an('Object');
68
- expect(ptf).to.have.a.property('Product_ID');
69
- expect(ptf).to.have.a.property('PTF_ID');
70
- expect(ptf).to.have.a.property('Release_level');
71
- expect(ptf).to.have.a.property('Product_option');
72
- expect(ptf).to.have.a.property('Load_ID');
73
- expect(ptf).to.have.a.property('Loaded_status');
74
- expect(ptf).to.have.a.property('Cover_letter_status');
75
- expect(ptf).to.have.a.property('On-order_status');
76
- expect(ptf).to.have.a.property('Save_file_status');
77
- expect(ptf).to.have.a.property('File_name');
78
- expect(ptf).to.have.a.property('File_library_name');
79
- expect(ptf).to.have.a.property('PTF_type');
80
- expect(ptf).to.have.a.property('IPL_action');
81
- expect(ptf).to.have.a.property('Action_pending');
82
- expect(ptf).to.have.a.property('Action_required');
83
- expect(ptf).to.have.a.property('PTF_is_released');
84
- expect(ptf).to.have.a.property('Target_release');
85
- expect(ptf).to.have.a.property('Superseding_PTF');
86
- expect(ptf).to.have.a.property('Current_IPL_source');
87
- expect(ptf).to.have.a.property('Minimum_level');
88
- expect(ptf).to.have.a.property('Maximum_level');
89
- expect(ptf).to.have.a.property('Format_information_available');
90
- expect(ptf).to.have.a.property('Status_date_and_time');
91
- expect(ptf).to.have.a.property('Licensed_Internal_Code_group');
92
- expect(ptf).to.have.a.property('Superseded_by_PTF_ID');
93
- expect(ptf).to.have.a.property('Current_server_IPL_source');
94
- expect(ptf).to.have.a.property('Server_IPL_required');
95
- expect(ptf).to.have.a.property('Creation_date_and_time');
96
- expect(ptf).to.have.a.property('Technology_refresh_PTF');
97
- done();
98
- });
99
- });
100
- });
101
-
102
- describe('getProductInfo', () => {
103
- it('returns info for specified product', (done) => {
104
- const connection = new iConn(database, username, password, restOptions);
105
-
106
- const prod = new iProd(connection);
107
-
108
- prod.getProductInfo('5770DG1', (product) => {
109
- expect(product).to.be.an('Object');
110
- expect(product).to.have.a.property('Product_ID');
111
- expect(product).to.have.a.property('Release_level');
112
- expect(product).to.have.a.property('Product_option');
113
- expect(product).to.have.a.property('Load_ID');
114
- expect(product).to.have.a.property('Symbolic_load_state');
115
- expect(product).to.have.a.property('Load_error_indicator');
116
- expect(product).to.have.a.property('Load_state');
117
- expect(product).to.have.a.property('Supported_flag');
118
- expect(product).to.have.a.property('Registration_type');
119
- expect(product).to.have.a.property('Registration_value');
120
- expect(product).to.have.a.property('Offset_to_additional_information');
121
- expect(product).to.have.a.property('Primary_language_load_identifier');
122
- expect(product).to.have.a.property('Minimum_target_release');
123
- expect(product).to.have.a.property('Minimum_VRM_of_*BASE_required_by_option');
124
- expect(product).to.have.a.property('Requirements_met_between_base_and_option_value');
125
- expect(product).to.have.a.property('Level');
126
- done();
127
- });
128
- });
129
- });
130
-
131
- // REST transport currently failing with 414 URI Too Long response code
132
- // The requested URL's length exceeds the capacity limit for this server
133
- describe('getInstalledProducts', () => {
134
- it('returns info for installed products', (done) => {
135
- const connection = new iConn(database, username, password, restOptions);
136
-
137
- const prod = new iProd(connection);
138
-
139
- prod.getInstalledProducts((products) => {
140
- expect(products).to.be.an('Array');
141
- expect(products.length).to.be.greaterThan(0);
142
-
143
- products.forEach((product) => {
144
- expect(product).to.be.an('Object');
145
- expect(product).to.have.a.property('Product_ID');
146
- expect(product).to.have.a.property('Product_option');
147
- expect(product).to.have.a.property('Release_level');
148
- expect(product).to.have.a.property('Description_text_message_ID');
149
- expect(product).to.have.a.property('Description_text_object_name');
150
- expect(product).to.have.a.property('Description_text_library_name');
151
- expect(product).to.have.a.property('Installed_flag');
152
- expect(product).to.have.a.property('Supported_flag');
153
- expect(product).to.have.a.property('Registration_type');
154
- expect(product).to.have.a.property('Registration_value');
155
- expect(product).to.have.a.property('Description_text');
156
- });
157
- done();
158
- });
159
- });
160
- });
161
- });