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
package/CHANGELOG.md DELETED
@@ -1,195 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
-
5
- ## [1.0.0](https://github.com/IBM/nodejs-itoolkit/compare/1.0.0-alpha.1...1.0.0) (2020-05-08)
6
-
7
-
8
- ### ⚠ BREAKING CHANGES
9
-
10
- * Remove iSql.connect() and iSql.setOptions()
11
- * Remove iConn.setTimeout()
12
-
13
- ### Features
14
-
15
- * Allow DS for service program return value ([#217](https://github.com/IBM/nodejs-itoolkit/issues/217)) ([30e9f8a](https://github.com/IBM/nodejs-itoolkit/commit/30e9f8a69da829935dcee72dbd394032feef0e27))
16
- * Specify supported Node versions ([#264](https://github.com/IBM/nodejs-itoolkit/issues/264)) ([63ec53c](https://github.com/IBM/nodejs-itoolkit/commit/63ec53c0ac17e9d4130b79074a61075ce0ac897e))
17
- * use standard-version [#85](https://github.com/IBM/nodejs-itoolkit/issues/85) ([45f66a7](https://github.com/IBM/nodejs-itoolkit/commit/45f66a7f9ac5b5d37c907f5d088cb517cd4d3d66))
18
-
19
-
20
- ### Bug Fixes
21
-
22
- * Add missing '?' in xml prolog ([bff8649](https://github.com/IBM/nodejs-itoolkit/commit/bff864991f73f5789c5dec563821c86eb1aab3fa))
23
- * data type issue in Toolkit.getSysStatus and Toolkit.getSysStatusExt ([#190](https://github.com/IBM/nodejs-itoolkit/issues/190)) ([15397c2](https://github.com/IBM/nodejs-itoolkit/commit/15397c279d51b9282ef948b7d61d7d403690ce6f))
24
- * Define errno structure correctly ([#192](https://github.com/IBM/nodejs-itoolkit/issues/192)) ([b1561f7](https://github.com/IBM/nodejs-itoolkit/commit/b1561f76e5803409c485f8b965745a060462852b)), closes [#191](https://github.com/IBM/nodejs-itoolkit/issues/191)
25
- * Deprecated functional tests rest transport options ([#255](https://github.com/IBM/nodejs-itoolkit/issues/255)) ([903dd3f](https://github.com/IBM/nodejs-itoolkit/commit/903dd3f70f635f37bb2abba4a61b5a99a4f16ba3))
26
- * eslint errors ([#243](https://github.com/IBM/nodejs-itoolkit/issues/243)) ([df40eb0](https://github.com/IBM/nodejs-itoolkit/commit/df40eb0c4898214493b22b9054d9eea57e6bccd9))
27
- * Faulty error thrown by ProgramCall.addParam ([#124](https://github.com/IBM/nodejs-itoolkit/issues/124)) ([75d081c](https://github.com/IBM/nodejs-itoolkit/commit/75d081c86ae35f0557ea7b5a1f8886018de6ff36))
28
- * Formatting errors in bug report template ([24a9262](https://github.com/IBM/nodejs-itoolkit/commit/24a92626e97f407dc7de998e2c65d6500d289eaf))
29
- * Homepage link in package.json ([#267](https://github.com/IBM/nodejs-itoolkit/issues/267)) ([d5787ce](https://github.com/IBM/nodejs-itoolkit/commit/d5787cef2ade2d8fa298986a73040158dd2b6f84))
30
- * HTTP transport should take a URL ([#252](https://github.com/IBM/nodejs-itoolkit/issues/252)) ([34e4e37](https://github.com/IBM/nodejs-itoolkit/commit/34e4e3765667a6060d82bd6dabf2bcd4569aa765))
31
- * iConn unit test failure ([52f0330](https://github.com/IBM/nodejs-itoolkit/commit/52f0330801a8b5bbdbac19af4ff60ee80927a9e3))
32
- * iConn unit test failure ([#274](https://github.com/IBM/nodejs-itoolkit/issues/274)) ([9e72857](https://github.com/IBM/nodejs-itoolkit/commit/9e728572fcfd734059d3a09e6934760518183250))
33
- * Improper TOC nesting in main README ([#175](https://github.com/IBM/nodejs-itoolkit/issues/175)) ([db5d44c](https://github.com/IBM/nodejs-itoolkit/commit/db5d44cdcc79dbded8d3fa6f0717ed268d5d7606))
34
- * minimist CVE ([#231](https://github.com/IBM/nodejs-itoolkit/issues/231)) ([6d02c43](https://github.com/IBM/nodejs-itoolkit/commit/6d02c43c38cf3c5fcc2e5ee559ea123ba97b12f2))
35
- * Move iConn compatibility code to iConn itself ([#218](https://github.com/IBM/nodejs-itoolkit/issues/218)) ([73d798d](https://github.com/IBM/nodejs-itoolkit/commit/73d798deaf1ca840d2c0d5742ded40712fe33955))
36
- * ssh transport econnreset ([#272](https://github.com/IBM/nodejs-itoolkit/issues/272)) ([d5e71c1](https://github.com/IBM/nodejs-itoolkit/commit/d5e71c159319574a937ee415df4c636d7f347ba7))
37
- * ssh transport silent failure ([#225](https://github.com/IBM/nodejs-itoolkit/issues/225)) ([6e3b8a0](https://github.com/IBM/nodejs-itoolkit/commit/6e3b8a0f11539ee04540cf12d97cd6b67b3ed967))
38
- * Test hooks timeout when using rest transport ([#253](https://github.com/IBM/nodejs-itoolkit/issues/253)) ([60fdd5b](https://github.com/IBM/nodejs-itoolkit/commit/60fdd5b75ba165646d8f888344aa1924c39272b1))
39
- * TODOs in Deprecated.js ([#240](https://github.com/IBM/nodejs-itoolkit/issues/240)) ([cd47476](https://github.com/IBM/nodejs-itoolkit/commit/cd474766d769d7832cf38fca40a5ed14b19f4bfa))
40
- * **idb:** Improve cleanup handling ([#233](https://github.com/IBM/nodejs-itoolkit/issues/233)) ([c2bb115](https://github.com/IBM/nodejs-itoolkit/commit/c2bb1152e13785a975597da41d6ca7df94bf4c09))
41
- * Use encodeURIComponent for URL params ([2c98b22](https://github.com/IBM/nodejs-itoolkit/commit/2c98b229148adbc3475d2eba1c1f397cd7367447)), closes [#72](https://github.com/IBM/nodejs-itoolkit/issues/72) [#71](https://github.com/IBM/nodejs-itoolkit/issues/71)
42
-
43
-
44
- * Remove iConn.setTimeout() ([c978c41](https://github.com/IBM/nodejs-itoolkit/commit/c978c41ad28f5e4db152bd4bd5e56ba3824ea650))
45
- * Remove iSql.connect() and iSql.setOptions() ([066e8ba](https://github.com/IBM/nodejs-itoolkit/commit/066e8ba43e0c68ff6165b4be8f1d00eac1242f38))
46
-
47
- ## [1.0.0-alpha.1](https://github.com/IBM/nodejs-itoolkit/compare/1.0.0-alpha.0...1.0.0-alpha.1) (2019-07-10)
48
-
49
- ### Bug Fixes
50
-
51
- * Bump version to 1.0.0-alpha.1 ([a7b4770](https://github.com/IBM/nodejs-itoolkit/commit/a7b47704b4e564329288efad51d06fcd7d166609))
52
-
53
- * Add check for connectError ([0ec197e](https://github.com/IBM/nodejs-itoolkit/commit/0ec197e37114c34857eb75edf4b86889c0fdfdd7))
54
-
55
- * Use POST method for REST transport ([#65](https://github.com/IBM/nodejs-itoolkit/issues/65)) ([6a9f91f](https://github.com/IBM/nodejs-itoolkit/commit/6a9f91fc5b556a2991668a2fa64a4b321cb25bb2))
56
-
57
- ## [1.0.0-alpha.0](https://github.com/IBM/nodejs-itoolkit/compare/v0.1.6...1.0.0-alpha.0) (2019-06-27)
58
-
59
- ### ⚠ BREAKING CHANGES
60
-
61
- * Removed 'sync' logic from all the functions. Have all internal functions using ProgramCaller instead of xt.iPgm. Fixed eslint-disable sections, but there are a few that are still needed (bitwise operations) ([#32](https://github.com/IBM/nodejs-itoolkit/issues/32)) ([7fdf0fd](https://github.com/IBM/nodejs-itoolkit/commit/7fdf0fd5b530297699ac8ffc80f5cfaa18e1fc72))
62
-
63
-
64
- * Remove setTimeout() method see issue ([#32](https://github.com/IBM/nodejs-itoolkit/issues/32)) We no longer support sync mode which had an option to set timeout ([ee3d048](https://github.com/IBM/nodejs-itoolkit/commit/ee3d048cd61842a29b9ad8a848c8439c9658c337))
65
-
66
-
67
- ### Features
68
-
69
- * Rework Connection.js see issues ([#25](https://github.com/IBM/nodejs-itoolkit/issues/25)) ([#2](https://github.com/IBM/nodejs-itoolkit/issues/2)) ([4dcb183](https://github.com/IBM/nodejs-itoolkit/commit/4dcb183bda082e55a820528a2e741d6e622a94cd))
70
-
71
- Allow Connection.js Constructor to accept a single object see #25
72
- Allow Connection.run() function to return error as first param of callback see #2
73
-
74
- * Add ssh transport ([5f1c803](https://github.com/IBM/nodejs-itoolkit/commit/5f1c803855a35de12c23c7b91778fc1716dc3a0a))
75
-
76
- * Add odbc transport ([7956a15](https://github.com/IBM/nodejs-itoolkit/commit/7956a153dc5d0665a1fecc3d0fe77075719da9dc))
77
-
78
- ### Bug Fixes
79
-
80
- * Patch SqlCall.js ([aa9591c](https://github.com/IBM/nodejs-itoolkit/commit/aa9591c24402dcca0fbcf750e6a77ded4f4dbd9d))
81
-
82
- * **deps:** update with ssh2 and missing depd dependency ([45c1c57](https://github.com/IBM/nodejs-itoolkit/commit/45c1c5768750b05fd1f6c1ae2858070e4ba1ff77))
83
-
84
- * **deps:** Update odbc dependency ([04bac84](https://github.com/IBM/nodejs-itoolkit/commit/04bac848bd902e70e07861905ff81aa2c6a453d6))
85
-
86
- * Rework idb and rest transports ([#17](https://github.com/IBM/nodejs-itoolkit/issues/17)) ([6f2ddcd](https://github.com/IBM/nodejs-itoolkit/commit/6f2ddcda9be8ed0f9ad4e46af4bc7d6722fce707))
87
-
88
- Update transports interface to accept config, xmlInput, done
89
-
90
- idb transport
91
-
92
- Use iPLUGR512k variant instead of iPLUG512k to iterate over a result set
93
-
94
- Ensure conn and stmt are always cleaned up properly
95
- - even during error states the stmt and conn objects are now cleaned
96
- - add function clean() to avoid duplication
97
- - this commit should help resolve issue #17
98
-
99
- rest transport
100
-
101
- Validate required: database, username, password
102
-
103
- Enforce output buffer to be set to the max
104
- - before default was only set now output buffer is always set to the max
105
-
106
- Small fixes add mising semicolons, remove some comments, etc
107
-
108
- ### Tests
109
-
110
- * Added unit and functional tests ([163939c](https://github.com/IBM/nodejs-itoolkit/pull/38/commits/163939c6520d8a9b35e433699bdb8f9bdf0598a4))
111
-
112
- * Fixed some issues found during unit testing ([1f5421f](https://github.com/IBM/nodejs-itoolkit/pull/38/commits/1f5421fc3a080f337668d2ce01fbb912eb6ca9c6))
113
-
114
- * Move existing unit/functional tests to deprecated folder ([c7a875e](https://github.com/IBM/nodejs-itoolkit/commit/c7a875e1f090330d330a1928390043cc0a481140))
115
-
116
- * Update unit/functional tests ([c6c470d](https://github.com/IBM/nodejs-itoolkit/commit/c6c470d9d8c5ee185ac0db191d54f0f94b056e51))
117
-
118
- * Added ToolkitFunctional.js ([8aa1f56](https://github.com/IBM/nodejs-itoolkit/commit/8aa1f56c8a1ccffdb158ae280c9643bfed5e4104))
119
-
120
- * Rename unit/functional tests ([b8733bc](https://github.com/IBM/nodejs-itoolkit/commit/b8733bc5306747033d48430a41070c4efb9bcc9c))
121
-
122
- * Bump default timeout for tests from 2s -> 3s ([6ef2cb3](https://github.com/IBM/nodejs-itoolkit/commit/6ef2cb3754ba217280cd09daf7f99a1433421897))
123
-
124
- * Update configuration options in functional tests ([4ba0b8f](https://github.com/IBM/nodejs-itoolkit/commit/4ba0b8f1c8a278b8d948bd841bf6fe3ddb9c1172))
125
-
126
- * Add ssh to available transports also add verbose configuration ([15ec42d](https://github.com/IBM/nodejs-itoolkit/commit/15ec42dd1acbf0f613d6f56220c4277d1b0cbe82))
127
-
128
- * Add config for DSN ([8957bb4](https://github.com/IBM/nodejs-itoolkit/commit/8957bb4f469675427920622787786296be670ae9))
129
-
130
- ### Refactor
131
-
132
- * Rename command.js -> CommandCall.js ([7c12d91](https://github.com/IBM/nodejs-itoolkit/commit/7c12d91ff009157caea954863d7c52a2d114a35f))
133
-
134
- * Add CommandCall Class ([8884e7a](https://github.com/IBM/nodejs-itoolkit/commit/8884e7a15d4989e477b5386e097f98c00885bdc0))
135
-
136
- - class to maintain command types (sh, cl, qsh) see issue #24
137
- - merge (sh, cl, qsh) code into toXml
138
- - add in some JSDoc annotations
139
-
140
- * Update Toolkit.js ([36492d2](https://github.com/IBM/nodejs-itoolkit/commit/36492d25a8e3d33b9275214b12767c07a3a13dc1))
141
-
142
- Add in checks for when returnError is false in Toolkit.js.
143
- This is case occurs when a call from deprecated class goes through
144
- Toolkit.js. Instead of worrying about setting the flag on and off
145
- create a new Connection object when same config when returnError is
146
- false within the constructor. Then have proper checks for when to report
147
- the error.
148
-
149
- * Update Toolkit methods - Now all toolkit methods will have error first callbacks ([a632dbf](https://github.com/IBM/nodejs-itoolkit/commit/a632dbf1c99371771e47bd8922df9c75ce49f4b0))
150
-
151
- * Move transports to lib/transports/ directory([8077fb7](https://github.com/IBM/nodejs-itoolkit/commit/8077fb70aec343c5cd5ed2e8c774d729bc43e1e7))
152
-
153
- * Moving ALL deprecated functions into Deprecated.js They import the new classes and use them. Can be easily removed later. Also removed CommandGenerator class and just have 3 const functions exported ([d218b1d](https://github.com/IBM/nodejs-itoolkit/commit/d218b1d1e84844e841f2543d9f8687b6b96b76fd))
154
-
155
- * Linted the tests, and made them use assert (before they only failed if the last object tested were not successful, and tracked success with a variable). Renamed the sql class to SqlCall. General cleanup ([a73d031](https://github.com/IBM/nodejs-itoolkit/commit/a73d03151ba2ce8272a00ba0b65b1e24b28529ff))
156
-
157
- * Cut down and consolidated files. I think initial modularization was good, now building back up a little. icmd, iqsh, and ish are all mostly the same thing, and I made them live in the CommandGenerator class. Others, like iconn and isql, are definitely their own classes and rightly split off. I also put the deprecated classes into the file of the class that is replacing them to simplify the file structure. ([#24](https://github.com/IBM/nodejs-itoolkit/issues/24)) ([5e7b983](https://github.com/IBM/nodejs-itoolkit/issues/24))
158
-
159
- * Creating 'Toolkit' class to hold all of the functions and stores the conn like the old classes. Keeping old classes but redirecting to toolkit and adding deprecation messages (todo) ([f8fc468](https://github.com/IBM/nodejs-itoolkit/commit/f8fc468d8d8bf2003ed105bd604a0c041d87b015))
160
-
161
- * Consolidating 'classes' that serve no purpose into one file, now all functions that do the same type of work are together ([69d2825](https://github.com/IBM/nodejs-itoolkit/commit/69d282507797621565bc30a1bbcb1e4927f3697e))
162
-
163
- * Modularize itoolkit.js ([#20](https://github.com/IBM/nodejs-itoolkit/issues/20)) ([35a2ffb](https://github.com/IBM/nodejs-itoolkit/commit/35a2ffb586300721127d93d8b64885d7aad6e84b))
164
-
165
- * Getting rid of __getClass in itoolkit.js and places where it was imported ([f9812b7](https://github.com/IBM/nodejs-itoolkit/commit/5388b55dc0f0510b8f2570b6ea327d6853206fb1))
166
-
167
- ### Docs
168
-
169
- * Add contribution guidelines ([89be160](https://github.com/IBM/nodejs-itoolkit/pull/38/commits/89be160344863dfd0509ea188cb1dc6d743625ad))
170
-
171
- * Update Readme for v1.0.0 ([f51438e](https://github.com/IBM/nodejs-itoolkit/commit/f51438e21c1d1756f6105ec70b99f3aa22903c08))
172
-
173
- * Update and Add SSH doc ([f7b8fd8](https://github.com/IBM/nodejs-itoolkit/commit/f7b8fd8d3c876765b9d8e027bb0816745dd9b18c))
174
-
175
- * Add doc for odbc transport ([c0e80ff](https://github.com/IBM/nodejs-itoolkit/commit/c0e80ff110e48c8d51e1b95c65b82682150e0a99))
176
-
177
- * Update install docs for alpha version ([8e81232](https://github.com/IBM/nodejs-itoolkit/commit/8e812324de0630f1de04e87eb0ae339a77ec22a5))
178
-
179
- ### Style
180
-
181
- * Fix lingering files with CRLF line endings CRLF -> LF ([b21636c](https://github.com/IBM/nodejs-itoolkit/commit/b21636c4398c8c242bad278a3901d23991dd4f97))
182
-
183
- * Fix line endings CRLF -> LF ([0541748](https://github.com/IBM/nodejs-itoolkit/commit/0541748c7c04c3e44ae1b2138bc0a74236c03986))
184
-
185
- * Removing some eslint-disable comments now that ProgramCall fits with required naming convention ([be5247c](https://github.com/IBM/nodejs-itoolkit/commit/be5247c8e2fcd66d6b4026930c3bd3a7c778453e))
186
-
187
- * Lint xmlToJson function ([17ef86f](https://github.com/IBM/nodejs-itoolkit/commit/17ef86f987b1056c8e325d73edfd5c5bada88dcc))
188
-
189
- * Linted the /lib directory using airbnb-base linting configuration ([#21](https://github.com/IBM/nodejs-itoolkit/issues/21)) ([5388b55](https://github.com/IBM/nodejs-itoolkit/commit/5388b55dc0f0510b8f2570b6ea327d6853206fb1))
190
-
191
- ### [0.1.6](https://github.com/IBM/nodejs-itoolkit/compare/0.1.5...0.1.6) (2019-01-25)
192
-
193
- ### [0.1.5](https://github.com/IBM/nodejs-itoolkit/compare/0.1.4...0.1.5) (2019-01-08)
194
-
195
- ### 0.1.4 (2018-09-17)
package/contributors.txt DELETED
@@ -1,2 +0,0 @@
1
- Tony Cairns
2
- Xu Meng
package/test/README.md DELETED
@@ -1,46 +0,0 @@
1
- # Node.js Toolkit Tests
2
-
3
- Ensure dependencies are installed by running `npm install` from the project root.
4
-
5
- ## Running Tests
6
-
7
- - Run unit tests with `npm test`.
8
-
9
- - Run functional tests with `npm run test-integration`.
10
-
11
- ***NOTE***
12
-
13
- Integration tests require additional setup and configuration. Some tests require objects to preexist on the IBM i. The test case will check if the object exists and log instructions if the object is not found.
14
-
15
- ## Setup Rest interface
16
- - view the [README](../README.md#rest)
17
-
18
- ## Setup SSH interface
19
- - view the [README](../README.md#ssh)
20
-
21
- ## Configuring Tests
22
-
23
- Functional tests can be configured using the following enviornment variables.
24
-
25
- - `TKTRANSPORT` - The transport to use. Defaults to use `ssh`.
26
-
27
- - `TKVERBOSE`- Enables verbose output.
28
-
29
- - `TKHOST` - The hostname. Defaults to `localhost`.
30
-
31
- - `TKUSER` - The user to connect as.
32
-
33
- - `TKPASS` - The user's password.
34
-
35
- - `TKDB` - The database to connect to. Defaults to `*LOCAL`.
36
-
37
- - `TKPORT` - The port to use to connect.
38
-
39
- - `TKPATH` - The path to xmlcgi. Defaults to `/cgi-bin/xmlcgi.pgm`
40
-
41
- - `TKURL` - The url to the xmlcgi endpoint.
42
-
43
- - `TKPK` - The path to a private key file when using `ssh` transport.
44
-
45
- - `TKPHRASE` - The passphrase to decrypt the private key.
46
-
@@ -1,79 +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
-
20
- const { expect } = require('chai');
21
- const { parseString } = require('xml2js');
22
- const { CommandCall, Connection } = require('../../lib/itoolkit');
23
- const { config, printConfig } = require('./config');
24
-
25
-
26
- describe('CommandCall Functional Tests', () => {
27
- before(() => {
28
- printConfig();
29
- });
30
-
31
- describe('CL command tests', () => {
32
- it('calls CL command', (done) => {
33
- const connection = new Connection(config);
34
- connection.add(new CommandCall({ command: 'RTVJOBA USRLIBL(?) SYSLIBL(?)', type: 'cl' }));
35
- connection.run((error, xmlOut) => {
36
- expect(error).to.equal(null);
37
- parseString(xmlOut, (parseError, result) => {
38
- expect(parseError).to.equal(null);
39
- expect(result.myscript.cmd[0].success[0]).to.include('+++ success RTVJOBA USRLIBL(?) SYSLIBL(?)');
40
- done();
41
- });
42
- });
43
- });
44
- });
45
-
46
- describe('SH command tests', () => {
47
- it('calls PASE shell command', (done) => {
48
- const connection = new Connection(config);
49
- connection.add(new CommandCall({ command: 'system -i wrksyssts', type: 'sh' }));
50
- connection.run((error, xmlOut) => {
51
- expect(error).to.equal(null);
52
- // xs does not return success property for sh or qsh command calls
53
- // but on error sh or qsh node will not have any inner data
54
- parseString(xmlOut, (parseError, result) => {
55
- expect(parseError).to.equal(null);
56
- expect(result.myscript.sh[0]._).to.match(/(System\sStatus\sInformation)/);
57
- done();
58
- });
59
- });
60
- });
61
- });
62
-
63
- describe('QSH command tests', () => {
64
- it('calls QSH command', (done) => {
65
- const connection = new Connection(config);
66
- connection.add(new CommandCall({ command: 'system wrksyssts', type: 'qsh' }));
67
- connection.run((error, xmlOut) => {
68
- expect(error).to.equal(null);
69
- // xs does not return success property for sh or qsh command calls
70
- // but on error sh or qsh node will not have any inner data
71
- parseString(xmlOut, (parseError, result) => {
72
- expect(parseError).to.equal(null);
73
- expect(result.myscript.qsh[0]._).to.match(/(System\sStatus\sInformation)/);
74
- done();
75
- });
76
- });
77
- });
78
- });
79
- });
@@ -1,166 +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
-
20
- const { expect } = require('chai');
21
- const { parseString } = require('xml2js');
22
- const { ProgramCall, Connection } = require('../../lib/itoolkit');
23
- const { config, printConfig } = require('./config');
24
-
25
-
26
- describe('ProgramCall Functional Tests', () => {
27
- before(() => {
28
- printConfig();
29
- });
30
-
31
- describe('Test ProgramCall()', () => {
32
- it('calls QWCRSVAL program checks if it ran successfully', (done) => {
33
- const connection = new Connection(config);
34
-
35
- const program = new ProgramCall('QWCRSVAL', { lib: 'QSYS' });
36
-
37
- const outBuf = {
38
- type: 'ds',
39
- io: 'out',
40
- fields: [
41
- { type: '10i0', value: 0 },
42
- { type: '10i0', value: 0 },
43
- { type: '36h', value: '' },
44
- { type: '10A', value: '' },
45
- { type: '1A', value: '' },
46
- { type: '1A', value: '' },
47
- { type: '10i0', value: 0 },
48
- { type: '10i0', value: 0 },
49
- ],
50
- };
51
-
52
- const errno = {
53
- type: 'ds',
54
- io: 'both',
55
- len: 'rec2',
56
- fields: [
57
- {
58
- name: 'bytes_provided',
59
- type: '10i0',
60
- value: 0,
61
- setlen: 'rec2',
62
- },
63
- { name: 'bytes_available', type: '10i0', value: 0 },
64
- { name: 'msgid', type: '7A', value: '' },
65
- { type: '1A', value: '' },
66
- ],
67
- };
68
-
69
- program.addParam(outBuf);
70
- program.addParam({ type: '10i0', value: 66 });
71
- program.addParam({ type: '10i0', value: 1 });
72
- program.addParam({ type: '10A', value: 'QCCSID' });
73
- program.addParam(errno);
74
- connection.add(program);
75
- connection.run((error, xmlOut) => {
76
- expect(error).to.equal(null);
77
- parseString(xmlOut, (parseError, result) => {
78
- expect(parseError).to.equal(null);
79
- expect(result.myscript.pgm[0].success[0]).to.include('+++ success QSYS QWCRSVAL');
80
- done();
81
- });
82
- });
83
- });
84
- });
85
-
86
-
87
- describe('Test ProgramCall()', () => {
88
- it('calls QWCRSVAL program and returns arbitrarily named parameter', (done) => {
89
- const connection = new Connection(config);
90
-
91
- const program = new ProgramCall('QWCRSVAL', { lib: 'QSYS' });
92
-
93
- const outBuf = {
94
- type: 'ds',
95
- io: 'out',
96
- fields: [
97
- { type: '10i0', value: 0 },
98
- { type: '10i0', value: 0 },
99
- { type: '36h', value: '' },
100
- { type: '10A', value: '' },
101
- { type: '1A', value: '' },
102
- { type: '1A', value: '' },
103
- { type: '10i0', value: 0 },
104
- { type: '10i0', value: 0 },
105
- ],
106
- };
107
-
108
- const errno = {
109
- name: 'errno',
110
- type: 'ds',
111
- io: 'both',
112
- len: 'rec2',
113
- fields: [
114
- {
115
- name: 'bytes_provided',
116
- type: '10i0',
117
- value: 0,
118
- setlen: 'rec2',
119
- },
120
- { name: 'bytes_available', type: '10i0', value: 0 },
121
- { name: 'msgid', type: '7A', value: '' },
122
- { type: '1A', value: '' },
123
- ],
124
- };
125
-
126
- program.addParam(outBuf);
127
- program.addParam({ type: '10i0', value: 66 });
128
- program.addParam({ type: '10i0', value: 1 });
129
- program.addParam({ type: '10A', value: 'QCCSID' });
130
- program.addParam(errno);
131
- connection.add(program);
132
- connection.run((error, xmlOut) => {
133
- expect(error).to.equal(null);
134
- parseString(xmlOut, (parseError, result) => {
135
- expect(parseError).to.equal(null);
136
- expect(result.myscript.pgm[0].success[0]).to.include('+++ success QSYS QWCRSVAL');
137
- done();
138
- });
139
- });
140
- });
141
- });
142
-
143
- describe.skip('Test ProgramCall()', () => {
144
- // ZZSRV6 program requires XMLSERVICE built with tests
145
- // Skip for now, we need to add before hook to check ZZSRV6 is available
146
- it.skip('Should be successful with addReturn arbitrary attribute specified', (done) => {
147
- const connection = new Connection(config);
148
-
149
- const program = new ProgramCall('ZZSRV6', { lib: 'XMLSERVICE', func: 'ZZVARY4' });
150
-
151
- program.addParam({ type: '10A', varying: '4', value: 'Gill' });
152
- const testValue = 'NEW_NAME';
153
- program.addReturn('0', '20A', { varying: '4', name: testValue });
154
- connection.add(program);
155
- connection.run((error, xmlOut) => {
156
- expect(error).to.equal(null);
157
- parseString(xmlOut, (parseError, result) => {
158
- expect(parseError).to.equal(null);
159
- expect(result.myscript.pgm[0].success[0]).to.include('+++ success');
160
- expect(result.myscript.pgm[0].return[0].data[0]._).to.equal('my name is Gill');
161
- done();
162
- });
163
- });
164
- });
165
- });
166
- });