itoolkit 1.0.0-rc.1 → 1.0.1
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.
- package/.eslintrc.js +37 -11
- package/CHANGELOG.md +76 -2
- package/README.md +8 -8
- package/lib/Connection.js +0 -1
- package/lib/Deprecated.js +3 -4
- package/lib/ProgramCall.js +2 -2
- package/lib/transports/httpTransport.js +2 -2
- package/lib/transports/idbTransport.js +23 -11
- package/lib/transports/odbcTransport.js +16 -2
- package/lib/transports/sshTransport.js +4 -5
- package/package.json +15 -14
- package/test/README.md +2 -4
- package/test/functional/CommandCallFunctional.js +20 -12
- package/test/functional/ProgramCallFunctional.js +6 -66
- package/test/functional/checkObjectExists.js +12 -1
- package/test/functional/checkVersion.js +17 -0
- package/test/functional/deprecated/commandsFunctional.js +20 -11
- package/test/functional/deprecated/iDataQueueFunctional.js +10 -11
- package/test/functional/deprecated/iNetworkFunctional.js +8 -9
- package/test/functional/deprecated/iObjFunctional.js +18 -19
- package/test/functional/deprecated/iPgmFunctional.js +6 -42
- package/test/functional/deprecated/iProdFunctional.js +10 -11
- package/test/functional/deprecated/iSqlFunctional.js +30 -32
- package/test/functional/deprecated/iUserSpaceFunctional.js +29 -18
- package/test/functional/deprecated/iWorkFunctional.js +61 -59
- package/test/functional/iDataQueueFunctional.js +8 -9
- package/test/functional/iNetworkFunctional.js +6 -8
- package/test/functional/iObjFunctional.js +16 -17
- package/test/functional/iProdFunctional.js +8 -9
- package/test/functional/iSqlFunctional.js +30 -31
- package/test/functional/iUserSpaceFunctional.js +27 -16
- package/test/functional/iWorkFunctional.js +29 -33
- package/test/unit/CommandCallUnit.js +10 -11
- package/test/unit/ConnectionUnit.js +12 -19
- package/test/unit/ProgamCallUnit.js +27 -25
- package/test/unit/deprecated/commandsUnit.js +10 -11
- package/test/unit/deprecated/iConnUnit.js +12 -16
- package/test/unit/deprecated/iPgmUnit.js +25 -21
- package/test/unit/deprecated/iSqlUnit.js +69 -70
- package/test/unit/deprecated/xmlToJsonUnit.js +6 -9
- package/docs/CommandCall.rst +0 -22
- package/docs/Connection.rst +0 -133
- package/docs/Makefile +0 -20
- package/docs/ProgramCall.rst +0 -30
- package/docs/conf.py +0 -63
- package/docs/deprecated/examples/addQuery.js +0 -27
- package/docs/deprecated/examples/addToLibraryList.js +0 -15
- package/docs/deprecated/examples/callProcedure.js +0 -28
- package/docs/deprecated/examples/clearDataQueue.js +0 -15
- package/docs/deprecated/examples/createUserSpace.js +0 -15
- package/docs/deprecated/examples/deleteUserSpace.js +0 -15
- package/docs/deprecated/examples/getDataArea.js +0 -15
- package/docs/deprecated/examples/getInstalledProducts.js +0 -15
- package/docs/deprecated/examples/getJobInfo.js +0 -15
- package/docs/deprecated/examples/getJobStatus.js +0 -15
- package/docs/deprecated/examples/getNetInterfaceData.js +0 -15
- package/docs/deprecated/examples/getPTFInfo.js +0 -15
- package/docs/deprecated/examples/getProductInfo.js +0 -15
- package/docs/deprecated/examples/getSysStatus.js +0 -15
- package/docs/deprecated/examples/getSysStatusExt.js +0 -15
- package/docs/deprecated/examples/getSysValue.js +0 -15
- package/docs/deprecated/examples/getTCPIPAttr.js +0 -15
- package/docs/deprecated/examples/getUserSpaceData.js +0 -15
- package/docs/deprecated/examples/receiveFromDataQueue.js +0 -15
- package/docs/deprecated/examples/retrCmdInfo.js +0 -15
- package/docs/deprecated/examples/retrPgmInfo.js +0 -15
- package/docs/deprecated/examples/retrSrvPgmInfo.js +0 -16
- package/docs/deprecated/examples/retrUserAuthToObj.js +0 -15
- package/docs/deprecated/examples/retrUserInfo.js +0 -15
- package/docs/deprecated/examples/retrUsrAuth.js +0 -15
- package/docs/deprecated/examples/sendToDataQueue.js +0 -15
- package/docs/deprecated/examples/setUserSpaceData.js +0 -15
- package/docs/deprecated/iCmd.rst +0 -7
- package/docs/deprecated/iConn.rst +0 -9
- package/docs/deprecated/iDataQueue.rst +0 -33
- package/docs/deprecated/iNetwork.rst +0 -27
- package/docs/deprecated/iObj.rst +0 -64
- package/docs/deprecated/iPgm.rst +0 -9
- package/docs/deprecated/iProd.rst +0 -36
- package/docs/deprecated/iQsh.rst +0 -7
- package/docs/deprecated/iSh.rst +0 -7
- package/docs/deprecated/iSql.rst +0 -30
- package/docs/deprecated/iUserSpace.rst +0 -38
- package/docs/deprecated/iWork.rst +0 -58
- package/docs/deprecated.rst +0 -21
- package/docs/examples/cosine.js +0 -27
- package/docs/examples/qusrobjd.js +0 -80
- package/docs/examples/rtvjoba.js +0 -24
- package/docs/features.rst +0 -12
- package/docs/index.rst +0 -71
- package/docs/migratation-guide-v1.0.rst +0 -325
- package/docs/requirements.txt +0 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if XMLSERVICE version supports QSH.
|
|
3
|
+
* XMLSERVICE >= 1.9.8 supports QSH
|
|
4
|
+
* @param {string} version - expects sematic version i.e. 1.2.3
|
|
5
|
+
*/
|
|
6
|
+
function isQSHSupported(version) {
|
|
7
|
+
// maps array of strings to numbers i.e. ['1', '2', '3'] -> [1, 2, 3]
|
|
8
|
+
const semver = version.split('.').map(Number);
|
|
9
|
+
if (semver[0] === 1 && semver[1] < 9) {
|
|
10
|
+
return false;
|
|
11
|
+
} if (semver[0] === 1 && semver[1] === 9 && semver[2] < 8) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
module.exports.isQSHSupported = isQSHSupported;
|
|
@@ -15,17 +15,16 @@
|
|
|
15
15
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
16
16
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
17
17
|
|
|
18
|
-
/* eslint-env mocha */
|
|
19
18
|
/* eslint-disable new-cap */
|
|
20
19
|
|
|
21
|
-
|
|
22
20
|
const { expect } = require('chai');
|
|
23
21
|
const { parseString } = require('xml2js');
|
|
24
22
|
const {
|
|
25
|
-
iCmd, iSh, iQsh, iConn,
|
|
23
|
+
iCmd, iSh, iQsh, iConn, iPgm,
|
|
26
24
|
} = require('../../../lib/itoolkit');
|
|
27
25
|
|
|
28
26
|
const { config, printConfig } = require('../config');
|
|
27
|
+
const { isQSHSupported } = require('../checkVersion');
|
|
29
28
|
|
|
30
29
|
// deprecated tests are in place to test compatability using deprecated classes and functions
|
|
31
30
|
// these tests use deprecated iConn Class to create a connnection
|
|
@@ -46,13 +45,13 @@ if (config.transport === 'rest') {
|
|
|
46
45
|
};
|
|
47
46
|
}
|
|
48
47
|
|
|
49
|
-
describe('iSh, iCmd, iQsh, Functional Tests', ()
|
|
50
|
-
before(()
|
|
48
|
+
describe('iSh, iCmd, iQsh, Functional Tests', function () {
|
|
49
|
+
before(function () {
|
|
51
50
|
printConfig();
|
|
52
51
|
});
|
|
53
52
|
|
|
54
|
-
describe('iCmd()', ()
|
|
55
|
-
it('calls CL command', (done)
|
|
53
|
+
describe('iCmd()', function () {
|
|
54
|
+
it('calls CL command', function (done) {
|
|
56
55
|
const connection = new iConn(database, username, password, restOptions);
|
|
57
56
|
connection.add(iCmd('RTVJOBA USRLIBL(?) SYSLIBL(?)'));
|
|
58
57
|
connection.run((xmlOut) => {
|
|
@@ -65,8 +64,8 @@ describe('iSh, iCmd, iQsh, Functional Tests', () => {
|
|
|
65
64
|
});
|
|
66
65
|
});
|
|
67
66
|
|
|
68
|
-
describe('iSh()', ()
|
|
69
|
-
it('calls PASE shell command', (done)
|
|
67
|
+
describe('iSh()', function () {
|
|
68
|
+
it('calls PASE shell command', function (done) {
|
|
70
69
|
const connection = new iConn(database, username, password, restOptions);
|
|
71
70
|
connection.add(iSh('system -i wrksyssts'));
|
|
72
71
|
connection.run((xmlOut) => {
|
|
@@ -81,15 +80,25 @@ describe('iSh, iCmd, iQsh, Functional Tests', () => {
|
|
|
81
80
|
});
|
|
82
81
|
});
|
|
83
82
|
|
|
84
|
-
describe('iQsh()', ()
|
|
85
|
-
it('calls QSH command', (done)
|
|
83
|
+
describe('iQsh()', function () {
|
|
84
|
+
it('calls QSH command', function (done) {
|
|
86
85
|
const connection = new iConn(database, username, password, restOptions);
|
|
86
|
+
connection.add(new iPgm('MYPGMTOOLONG'));
|
|
87
87
|
connection.add(iQsh('system wrksyssts'));
|
|
88
88
|
connection.run((xmlOut) => {
|
|
89
89
|
// xs does not return success property for sh or qsh command calls
|
|
90
90
|
// but on error sh or qsh node will not have any inner data
|
|
91
91
|
parseString(xmlOut, (parseError, result) => {
|
|
92
92
|
expect(parseError).to.equal(null);
|
|
93
|
+
const match = result.myscript.pgm[0].version[0].match(/\d\.\d\.\d/);
|
|
94
|
+
if (!match) {
|
|
95
|
+
throw Error('Unable to determine XMLSERVICE version');
|
|
96
|
+
}
|
|
97
|
+
if (!isQSHSupported(match[0])) {
|
|
98
|
+
// skip if QSH is unsupported
|
|
99
|
+
console.log(`XMLSERVICE version ${match[0]} does not support QSH`);
|
|
100
|
+
this.skip();
|
|
101
|
+
}
|
|
93
102
|
expect(result.myscript.qsh[0]._).to.match(/(System\sStatus\sInformation)/);
|
|
94
103
|
done();
|
|
95
104
|
});
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
16
16
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
17
17
|
|
|
18
|
-
/* eslint-env mocha */
|
|
19
18
|
/* eslint-disable new-cap */
|
|
20
19
|
|
|
21
20
|
const { expect } = require('chai');
|
|
@@ -45,8 +44,8 @@ if (config.transport === 'rest') {
|
|
|
45
44
|
|
|
46
45
|
const lib = 'NODETKTEST'; const dqName = 'TESTQ';
|
|
47
46
|
|
|
48
|
-
describe('iDataQueue Functional Tests', ()
|
|
49
|
-
before('check if data queue exists for tests', (done)
|
|
47
|
+
describe('iDataQueue Functional Tests', function () {
|
|
48
|
+
before('check if data queue exists for tests', function (done) {
|
|
50
49
|
printConfig();
|
|
51
50
|
checkObjectExists(config, dqName, '*DTAQ', (error) => {
|
|
52
51
|
if (error) { throw error; }
|
|
@@ -54,8 +53,8 @@ describe('iDataQueue Functional Tests', () => {
|
|
|
54
53
|
});
|
|
55
54
|
});
|
|
56
55
|
|
|
57
|
-
describe('constructor', ()
|
|
58
|
-
it('creates and returns an instance of iDataQueue', ()
|
|
56
|
+
describe('constructor', function () {
|
|
57
|
+
it('creates and returns an instance of iDataQueue', function () {
|
|
59
58
|
const connection = new iConn(database, config.user, password);
|
|
60
59
|
|
|
61
60
|
const dq = new iDataQueue(connection);
|
|
@@ -63,8 +62,8 @@ describe('iDataQueue Functional Tests', () => {
|
|
|
63
62
|
});
|
|
64
63
|
});
|
|
65
64
|
|
|
66
|
-
describe('sendToDataQueue', ()
|
|
67
|
-
it('sends data to specified DQ', (done)
|
|
65
|
+
describe('sendToDataQueue', function () {
|
|
66
|
+
it('sends data to specified DQ', function (done) {
|
|
68
67
|
const connection = new iConn(database, username, password, restOptions);
|
|
69
68
|
|
|
70
69
|
const dq = new iDataQueue(connection);
|
|
@@ -76,8 +75,8 @@ describe('iDataQueue Functional Tests', () => {
|
|
|
76
75
|
});
|
|
77
76
|
});
|
|
78
77
|
|
|
79
|
-
describe('receiveFromDataQueue', ()
|
|
80
|
-
it('receives data from specfied DQ', (done)
|
|
78
|
+
describe('receiveFromDataQueue', function () {
|
|
79
|
+
it('receives data from specfied DQ', function (done) {
|
|
81
80
|
const connection = new iConn(database, username, password, restOptions);
|
|
82
81
|
|
|
83
82
|
const dq = new iDataQueue(connection);
|
|
@@ -89,8 +88,8 @@ describe('iDataQueue Functional Tests', () => {
|
|
|
89
88
|
});
|
|
90
89
|
});
|
|
91
90
|
|
|
92
|
-
describe('clearDataQueue', ()
|
|
93
|
-
it('clears the specifed DQ', (done)
|
|
91
|
+
describe('clearDataQueue', function () {
|
|
92
|
+
it('clears the specifed DQ', function (done) {
|
|
94
93
|
const connection = new iConn(database, username, password, restOptions);
|
|
95
94
|
|
|
96
95
|
const dq = new iDataQueue(connection);
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
16
16
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
17
17
|
|
|
18
|
-
/* eslint-env mocha */
|
|
19
18
|
/* eslint-disable new-cap */
|
|
20
19
|
|
|
21
20
|
const { expect } = require('chai');
|
|
@@ -42,13 +41,13 @@ if (config.transport === 'rest') {
|
|
|
42
41
|
};
|
|
43
42
|
}
|
|
44
43
|
|
|
45
|
-
describe('iNetwork Functional Tests', ()
|
|
46
|
-
before(()
|
|
44
|
+
describe('iNetwork Functional Tests', function () {
|
|
45
|
+
before(function () {
|
|
47
46
|
printConfig();
|
|
48
47
|
});
|
|
49
48
|
|
|
50
|
-
describe('constructor', ()
|
|
51
|
-
it('creates and returns an instance of iNetwork', ()
|
|
49
|
+
describe('constructor', function () {
|
|
50
|
+
it('creates and returns an instance of iNetwork', function () {
|
|
52
51
|
const connection = new iConn(database, config.user, password);
|
|
53
52
|
|
|
54
53
|
const net = new iNetwork(connection);
|
|
@@ -57,8 +56,8 @@ describe('iNetwork Functional Tests', () => {
|
|
|
57
56
|
});
|
|
58
57
|
});
|
|
59
58
|
|
|
60
|
-
describe('getTCPIPAttr', ()
|
|
61
|
-
it('retrieves TCP/IP Attributes', (done)
|
|
59
|
+
describe('getTCPIPAttr', function () {
|
|
60
|
+
it('retrieves TCP/IP Attributes', function (done) {
|
|
62
61
|
const connection = new iConn(database, username, password, restOptions);
|
|
63
62
|
|
|
64
63
|
const net = new iNetwork(connection);
|
|
@@ -99,8 +98,8 @@ describe('iNetwork Functional Tests', () => {
|
|
|
99
98
|
});
|
|
100
99
|
});
|
|
101
100
|
|
|
102
|
-
describe('getNetInterfaceData', ()
|
|
103
|
-
it('retrieves IPv4 network interface info', (done)
|
|
101
|
+
describe('getNetInterfaceData', function () {
|
|
102
|
+
it('retrieves IPv4 network interface info', function (done) {
|
|
104
103
|
const connection = new iConn(database, username, password, restOptions);
|
|
105
104
|
|
|
106
105
|
const net = new iNetwork(connection);
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
16
16
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
17
17
|
|
|
18
|
-
/* eslint-env mocha */
|
|
19
18
|
/* eslint-disable new-cap */
|
|
20
19
|
|
|
21
20
|
const { expect } = require('chai');
|
|
@@ -42,13 +41,13 @@ if (config.transport === 'rest') {
|
|
|
42
41
|
};
|
|
43
42
|
}
|
|
44
43
|
|
|
45
|
-
describe('iObj Functional Tests', ()
|
|
46
|
-
before(()
|
|
44
|
+
describe('iObj Functional Tests', function () {
|
|
45
|
+
before(function () {
|
|
47
46
|
printConfig();
|
|
48
47
|
});
|
|
49
48
|
|
|
50
|
-
describe('constructor', ()
|
|
51
|
-
it('creates and returns an instance of iObj', ()
|
|
49
|
+
describe('constructor', function () {
|
|
50
|
+
it('creates and returns an instance of iObj', function () {
|
|
52
51
|
const connection = new iConn(database, config.user, password);
|
|
53
52
|
|
|
54
53
|
const obj = new iObj(connection);
|
|
@@ -57,8 +56,8 @@ describe('iObj Functional Tests', () => {
|
|
|
57
56
|
});
|
|
58
57
|
});
|
|
59
58
|
|
|
60
|
-
describe('retrUsrAuth', ()
|
|
61
|
-
it(`returns uses's authority for an object using ${config.transport} tranport`, (done)
|
|
59
|
+
describe('retrUsrAuth', function () {
|
|
60
|
+
it(`returns uses's authority for an object using ${config.transport} tranport`, function (done) {
|
|
62
61
|
const connection = new iConn(database, username, password, restOptions);
|
|
63
62
|
|
|
64
63
|
const obj = new iObj(connection);
|
|
@@ -101,8 +100,8 @@ describe('iObj Functional Tests', () => {
|
|
|
101
100
|
});
|
|
102
101
|
});
|
|
103
102
|
|
|
104
|
-
describe('rtrCmdInfo', ()
|
|
105
|
-
it('returns command info', (done)
|
|
103
|
+
describe('rtrCmdInfo', function () {
|
|
104
|
+
it('returns command info', function (done) {
|
|
106
105
|
const connection = new iConn(database, username, password, restOptions);
|
|
107
106
|
|
|
108
107
|
const obj = new iObj(connection);
|
|
@@ -153,8 +152,8 @@ describe('iObj Functional Tests', () => {
|
|
|
153
152
|
});
|
|
154
153
|
});
|
|
155
154
|
|
|
156
|
-
describe('retrPgmInfo', ()
|
|
157
|
-
it('returns program info', (done)
|
|
155
|
+
describe('retrPgmInfo', function () {
|
|
156
|
+
it('returns program info', function (done) {
|
|
158
157
|
const connection = new iConn(database, username, password, restOptions);
|
|
159
158
|
|
|
160
159
|
const obj = new iObj(connection);
|
|
@@ -227,8 +226,8 @@ describe('iObj Functional Tests', () => {
|
|
|
227
226
|
});
|
|
228
227
|
});
|
|
229
228
|
|
|
230
|
-
describe('retrSrvPgmInfo', ()
|
|
231
|
-
it('returns service program info', (done)
|
|
229
|
+
describe('retrSrvPgmInfo', function () {
|
|
230
|
+
it('returns service program info', function (done) {
|
|
232
231
|
const connection = new iConn(database, username, password, restOptions);
|
|
233
232
|
|
|
234
233
|
const obj = new iObj(connection);
|
|
@@ -282,8 +281,8 @@ describe('iObj Functional Tests', () => {
|
|
|
282
281
|
});
|
|
283
282
|
});
|
|
284
283
|
|
|
285
|
-
describe('retrUserInfo', ()
|
|
286
|
-
it('returns specified user profile info', (done)
|
|
284
|
+
describe('retrUserInfo', function () {
|
|
285
|
+
it('returns specified user profile info', function (done) {
|
|
287
286
|
const connection = new iConn(database, username, password, restOptions);
|
|
288
287
|
|
|
289
288
|
const obj = new iObj(connection);
|
|
@@ -308,8 +307,8 @@ describe('iObj Functional Tests', () => {
|
|
|
308
307
|
});
|
|
309
308
|
});
|
|
310
309
|
|
|
311
|
-
describe('retrUsrAuthToObj', ()
|
|
312
|
-
it(`retrieves info for users who are authorized to an object using ${config.transport} transpsort`, (done)
|
|
310
|
+
describe('retrUsrAuthToObj', function () {
|
|
311
|
+
it(`retrieves info for users who are authorized to an object using ${config.transport} transpsort`, function (done) {
|
|
313
312
|
const connection = new iConn(database, username, password, restOptions);
|
|
314
313
|
|
|
315
314
|
const obj = new iObj(connection);
|
|
@@ -335,8 +334,8 @@ describe('iObj Functional Tests', () => {
|
|
|
335
334
|
});
|
|
336
335
|
});
|
|
337
336
|
|
|
338
|
-
describe('addToLibraryList', ()
|
|
339
|
-
it('appends lib to user\'s lib list', (done)
|
|
337
|
+
describe('addToLibraryList', function () {
|
|
338
|
+
it('appends lib to user\'s lib list', function (done) {
|
|
340
339
|
const connection = new iConn(database, username, password, restOptions);
|
|
341
340
|
|
|
342
341
|
const obj = new iObj(connection);
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
16
16
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
17
17
|
|
|
18
|
-
/* eslint-env mocha */
|
|
19
18
|
/* eslint-disable new-cap */
|
|
20
19
|
|
|
21
20
|
const { expect } = require('chai');
|
|
@@ -43,13 +42,13 @@ if (config.transport === 'rest') {
|
|
|
43
42
|
};
|
|
44
43
|
}
|
|
45
44
|
|
|
46
|
-
describe('iPgm Functional Tests', ()
|
|
47
|
-
before(()
|
|
45
|
+
describe('iPgm Functional Tests', function () {
|
|
46
|
+
before(function () {
|
|
48
47
|
printConfig();
|
|
49
48
|
});
|
|
50
49
|
|
|
51
|
-
describe('
|
|
52
|
-
it('calls QWCRSVAL program checks if it ran successfully', (done)
|
|
50
|
+
describe('addParam', function () {
|
|
51
|
+
it('calls QWCRSVAL program checks if it ran successfully', function (done) {
|
|
53
52
|
const connection = new iConn(database, username, password, restOptions);
|
|
54
53
|
|
|
55
54
|
const program = new iPgm('QWCRSVAL', { lib: 'QSYS' });
|
|
@@ -80,45 +79,10 @@ describe('iPgm Functional Tests', () => {
|
|
|
80
79
|
});
|
|
81
80
|
});
|
|
82
81
|
|
|
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()', () => {
|
|
82
|
+
describe.skip('addReturn', function () {
|
|
119
83
|
// ZZSRV6 program requires XMLSERVICE built with tests
|
|
120
84
|
// Skip for now, we need to add before hook to check if ZZSRV6 is available
|
|
121
|
-
it.skip('
|
|
85
|
+
it.skip('calls ZZVARY4 and checks the return value', function (done) {
|
|
122
86
|
const connection = new iConn(database, username, password, restOptions);
|
|
123
87
|
|
|
124
88
|
const program = new iPgm('ZZSRV6', { lib: 'XMLSERVICE', func: 'ZZVARY4' });
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
16
16
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
17
17
|
|
|
18
|
-
/* eslint-env mocha */
|
|
19
18
|
/* eslint-disable new-cap */
|
|
20
19
|
|
|
21
20
|
const { expect } = require('chai');
|
|
@@ -42,13 +41,13 @@ if (config.transport === 'rest') {
|
|
|
42
41
|
};
|
|
43
42
|
}
|
|
44
43
|
|
|
45
|
-
describe('iProd Functional Tests', ()
|
|
46
|
-
before(()
|
|
44
|
+
describe('iProd Functional Tests', function () {
|
|
45
|
+
before(function () {
|
|
47
46
|
printConfig();
|
|
48
47
|
});
|
|
49
48
|
|
|
50
|
-
describe('constructor', ()
|
|
51
|
-
it('creates and returns an instance of iProd', ()
|
|
49
|
+
describe('constructor', function () {
|
|
50
|
+
it('creates and returns an instance of iProd', function () {
|
|
52
51
|
const connection = new iConn(database, config.user, password);
|
|
53
52
|
|
|
54
53
|
const prod = new iProd(connection);
|
|
@@ -57,8 +56,8 @@ describe('iProd Functional Tests', () => {
|
|
|
57
56
|
});
|
|
58
57
|
});
|
|
59
58
|
|
|
60
|
-
describe('getPTFInfo', ()
|
|
61
|
-
it('returns info for specified ptf', (done)
|
|
59
|
+
describe('getPTFInfo', function () {
|
|
60
|
+
it('returns info for specified ptf', function (done) {
|
|
62
61
|
const connection = new iConn(database, username, password, restOptions);
|
|
63
62
|
|
|
64
63
|
const prod = new iProd(connection);
|
|
@@ -99,8 +98,8 @@ describe('iProd Functional Tests', () => {
|
|
|
99
98
|
});
|
|
100
99
|
});
|
|
101
100
|
|
|
102
|
-
describe('getProductInfo', ()
|
|
103
|
-
it('returns info for specified product', (done)
|
|
101
|
+
describe('getProductInfo', function () {
|
|
102
|
+
it('returns info for specified product', function (done) {
|
|
104
103
|
const connection = new iConn(database, username, password, restOptions);
|
|
105
104
|
|
|
106
105
|
const prod = new iProd(connection);
|
|
@@ -130,8 +129,8 @@ describe('iProd Functional Tests', () => {
|
|
|
130
129
|
|
|
131
130
|
// REST transport currently failing with 414 URI Too Long response code
|
|
132
131
|
// The requested URL's length exceeds the capacity limit for this server
|
|
133
|
-
describe('getInstalledProducts', ()
|
|
134
|
-
it('returns info for installed products', (done)
|
|
132
|
+
describe('getInstalledProducts', function () {
|
|
133
|
+
it('returns info for installed products', function (done) {
|
|
135
134
|
const connection = new iConn(database, username, password, restOptions);
|
|
136
135
|
|
|
137
136
|
const prod = new iProd(connection);
|
|
@@ -15,10 +15,8 @@
|
|
|
15
15
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
16
16
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
17
17
|
|
|
18
|
-
/* eslint-env mocha */
|
|
19
18
|
/* eslint-disable new-cap */
|
|
20
19
|
|
|
21
|
-
|
|
22
20
|
const { expect } = require('chai');
|
|
23
21
|
const { parseString } = require('xml2js');
|
|
24
22
|
const { iSql, iConn } = require('../../../lib/itoolkit');
|
|
@@ -44,13 +42,13 @@ if (config.transport === 'rest') {
|
|
|
44
42
|
};
|
|
45
43
|
}
|
|
46
44
|
|
|
47
|
-
describe('iSql Functional Tests', ()
|
|
48
|
-
before(()
|
|
45
|
+
describe('iSql Functional Tests', function () {
|
|
46
|
+
before(function () {
|
|
49
47
|
printConfig();
|
|
50
48
|
});
|
|
51
49
|
|
|
52
|
-
describe('prepare & execute', ()
|
|
53
|
-
it('prepares & executes stored procedure then fetch results', (done)
|
|
50
|
+
describe('prepare & execute', function () {
|
|
51
|
+
it('prepares & executes stored procedure then fetch results', function (done) {
|
|
54
52
|
const connection = new iConn(database, username, password, restOptions);
|
|
55
53
|
|
|
56
54
|
const sql = new iSql();
|
|
@@ -81,8 +79,8 @@ describe('iSql Functional Tests', () => {
|
|
|
81
79
|
});
|
|
82
80
|
});
|
|
83
81
|
|
|
84
|
-
describe('addQuery & fetch', ()
|
|
85
|
-
it('runs a query and fetches results', (done)
|
|
82
|
+
describe('addQuery & fetch', function () {
|
|
83
|
+
it('runs a query and fetches results', function (done) {
|
|
86
84
|
const connection = new iConn(database, username, password, restOptions);
|
|
87
85
|
|
|
88
86
|
const sql = new iSql();
|
|
@@ -106,8 +104,8 @@ describe('iSql Functional Tests', () => {
|
|
|
106
104
|
});
|
|
107
105
|
});
|
|
108
106
|
|
|
109
|
-
describe('added test to ensure issue #11 was resolved', ()
|
|
110
|
-
it('should parse SQL result set empty data tags correctly', (done)
|
|
107
|
+
describe('added test to ensure issue #11 was resolved', function () {
|
|
108
|
+
it('should parse SQL result set empty data tags correctly', function (done) {
|
|
111
109
|
const connection = new iConn(database, username, password, restOptions);
|
|
112
110
|
|
|
113
111
|
const sql = new iSql();
|
|
@@ -132,8 +130,8 @@ describe('iSql Functional Tests', () => {
|
|
|
132
130
|
});
|
|
133
131
|
});
|
|
134
132
|
|
|
135
|
-
describe('tables', ()
|
|
136
|
-
it('returns meta data for specified table', (done)
|
|
133
|
+
describe('tables', function () {
|
|
134
|
+
it('returns meta data for specified table', function (done) {
|
|
137
135
|
const connection = new iConn(database, username, password, restOptions);
|
|
138
136
|
|
|
139
137
|
const sql = new iSql();
|
|
@@ -156,8 +154,8 @@ describe('iSql Functional Tests', () => {
|
|
|
156
154
|
});
|
|
157
155
|
});
|
|
158
156
|
|
|
159
|
-
describe('tablePriv', ()
|
|
160
|
-
it('returns privilege data for a table', (done)
|
|
157
|
+
describe('tablePriv', function () {
|
|
158
|
+
it('returns privilege data for a table', function (done) {
|
|
161
159
|
const connection = new iConn(database, username, password, restOptions);
|
|
162
160
|
|
|
163
161
|
const sql = new iSql();
|
|
@@ -182,8 +180,8 @@ describe('iSql Functional Tests', () => {
|
|
|
182
180
|
});
|
|
183
181
|
});
|
|
184
182
|
|
|
185
|
-
describe('columns', ()
|
|
186
|
-
it('returns meta data for a column', (done)
|
|
183
|
+
describe('columns', function () {
|
|
184
|
+
it('returns meta data for a column', function (done) {
|
|
187
185
|
const connection = new iConn(database, username, password, restOptions);
|
|
188
186
|
|
|
189
187
|
const sql = new iSql();
|
|
@@ -219,8 +217,8 @@ describe('iSql Functional Tests', () => {
|
|
|
219
217
|
});
|
|
220
218
|
});
|
|
221
219
|
|
|
222
|
-
describe('columnPriv', ()
|
|
223
|
-
it('returns privilege data for a column', (done)
|
|
220
|
+
describe('columnPriv', function () {
|
|
221
|
+
it('returns privilege data for a column', function (done) {
|
|
224
222
|
const connection = new iConn(database, username, password, restOptions);
|
|
225
223
|
|
|
226
224
|
const sql = new iSql();
|
|
@@ -247,8 +245,8 @@ describe('iSql Functional Tests', () => {
|
|
|
247
245
|
});
|
|
248
246
|
});
|
|
249
247
|
|
|
250
|
-
describe('procedures', ()
|
|
251
|
-
it('returns meta data on for a procedure', (done)
|
|
248
|
+
describe('procedures', function () {
|
|
249
|
+
it('returns meta data on for a procedure', function (done) {
|
|
252
250
|
const connection = new iConn(database, username, password, restOptions);
|
|
253
251
|
|
|
254
252
|
const sql = new iSql();
|
|
@@ -274,8 +272,8 @@ describe('iSql Functional Tests', () => {
|
|
|
274
272
|
});
|
|
275
273
|
});
|
|
276
274
|
|
|
277
|
-
describe('pColumns', ()
|
|
278
|
-
it('returns meta data for procedure column', (done)
|
|
275
|
+
describe('pColumns', function () {
|
|
276
|
+
it('returns meta data for procedure column', function (done) {
|
|
279
277
|
const connection = new iConn(database, username, password, restOptions);
|
|
280
278
|
|
|
281
279
|
const sql = new iSql();
|
|
@@ -312,8 +310,8 @@ describe('iSql Functional Tests', () => {
|
|
|
312
310
|
});
|
|
313
311
|
});
|
|
314
312
|
|
|
315
|
-
describe('primaryKeys', ()
|
|
316
|
-
it('returns meta data for a primary key', (done)
|
|
313
|
+
describe('primaryKeys', function () {
|
|
314
|
+
it('returns meta data for a primary key', function (done) {
|
|
317
315
|
const connection = new iConn(database, username, password, restOptions);
|
|
318
316
|
|
|
319
317
|
const sql = new iSql();
|
|
@@ -337,8 +335,8 @@ describe('iSql Functional Tests', () => {
|
|
|
337
335
|
});
|
|
338
336
|
});
|
|
339
337
|
|
|
340
|
-
describe('foreignKeys', ()
|
|
341
|
-
it('returns meta data for a foreign key', (done)
|
|
338
|
+
describe('foreignKeys', function () {
|
|
339
|
+
it('returns meta data for a foreign key', function (done) {
|
|
342
340
|
const connection = new iConn(database, username, password, restOptions);
|
|
343
341
|
|
|
344
342
|
const sql = new iSql();
|
|
@@ -371,8 +369,8 @@ describe('iSql Functional Tests', () => {
|
|
|
371
369
|
});
|
|
372
370
|
});
|
|
373
371
|
|
|
374
|
-
describe('statistics', ()
|
|
375
|
-
it('returns stats info for table', (done)
|
|
372
|
+
describe('statistics', function () {
|
|
373
|
+
it('returns stats info for table', function (done) {
|
|
376
374
|
const connection = new iConn(database, username, password, restOptions);
|
|
377
375
|
|
|
378
376
|
const sql = new iSql();
|
|
@@ -403,10 +401,10 @@ describe('iSql Functional Tests', () => {
|
|
|
403
401
|
});
|
|
404
402
|
});
|
|
405
403
|
|
|
406
|
-
describe.skip('special', ()
|
|
404
|
+
describe.skip('special', function () {
|
|
407
405
|
// TODO: find passing case
|
|
408
406
|
// Below test fails with error code 9- argument value not valid
|
|
409
|
-
it.skip('returns meta data for special columns', (done)
|
|
407
|
+
it.skip('returns meta data for special columns', function (done) {
|
|
410
408
|
// [catalog, schema, table, row | transaction |session, no | nullable]
|
|
411
409
|
const connection = new iConn(database, username, password, restOptions);
|
|
412
410
|
|
|
@@ -426,9 +424,9 @@ describe('iSql Functional Tests', () => {
|
|
|
426
424
|
});
|
|
427
425
|
});
|
|
428
426
|
|
|
429
|
-
describe.skip('rowCount', ()
|
|
427
|
+
describe.skip('rowCount', function () {
|
|
430
428
|
// Skip for now need to create a table for this test to insert to.
|
|
431
|
-
it.skip('returns the number of rows affected by statement', (done)
|
|
429
|
+
it.skip('returns the number of rows affected by statement', function (done) {
|
|
432
430
|
const connection = new iConn(database, username, password, restOptions);
|
|
433
431
|
|
|
434
432
|
const sql = new iSql();
|