@@ -29,6 +29,7 @@ const oracledb = require('oracledb');
29
29
const should = require ( 'should' ) ;
30
30
const dbconfig = require ( './dbconfig.js' ) ;
31
31
const testsUtil = require ( './testsUtil.js' ) ;
32
+ const assert = require ( 'assert' ) ;
32
33
33
34
describe ( '218. aq2.js' , function ( ) {
34
35
@@ -179,34 +180,23 @@ describe('218. aq2.js', function() {
179
180
}
180
181
} ) ; // 218.3
181
182
182
- it . skip ( '218.4 getQueue() without options on DB Object data' , async ( ) => {
183
+ it ( '218.4 Negative - getQueue() without options on DB Object data' , async ( ) => {
183
184
try {
184
185
const addrData = {
185
186
NAME : "Changjie" ,
186
187
ADDRESS : "200 Oracle Parkway Redwood City, CA US 94065"
187
188
} ;
188
-
189
- // Enqueue
190
- const queue1 = await conn . getQueue (
191
- objQueueName ,
192
- //{ payloadType: objType }
193
- ) ;
194
- const objClass = await conn . getDbObjectClass ( objType ) ;
195
- const message = new objClass ( addrData ) ;
196
- // const message = new queue1.payloadTypeClass(addrData);
197
- await queue1 . enqOne ( message ) ;
198
- await conn . commit ( ) ;
199
-
200
- // Dequeue
201
- const queue2 = await conn . getQueue (
202
- objQueueName ,
203
- //{ payloadType: objType }
189
+ await assert . rejects (
190
+ async ( ) => {
191
+ const queue1 = await conn . getQueue ( objQueueName ) ;
192
+ const objClass = await conn . getDbObjectClass ( objType ) ;
193
+ const message = new objClass ( addrData ) ;
194
+ await queue1 . enqOne ( message ) ;
195
+ } ,
196
+ / D P I - 1 0 7 1 /
204
197
) ;
205
- const msg = await queue2 . deqOne ( ) ;
206
- await conn . commit ( ) ;
207
- should . exist ( msg ) ;
208
- should . strictEqual ( msg . payload . NAME , addrData . NAME ) ;
209
- should . strictEqual ( msg . payload . ADDRESS , addrData . ADDRESS ) ;
198
+ // DPI-1071: payload type in message properties must match
199
+ // the payload type of the queue
210
200
} catch ( err ) {
211
201
should . not . exist ( err ) ;
212
202
}
@@ -274,34 +264,26 @@ describe('218. aq2.js', function() {
274
264
} ) ; // 218.6
275
265
276
266
// A variation of 218.4
277
- it . skip ( '218.7 Set payloadType as oracledb.DB_TYPE_OBJECT' , async ( ) => {
267
+ it ( '218.7 Negative - Set payloadType as oracledb.DB_TYPE_OBJECT' , async ( ) => {
278
268
try {
279
269
const addrData = {
280
270
NAME : "Changjie" ,
281
271
ADDRESS : "200 Oracle Parkway Redwood City, CA US 94065"
282
272
} ;
283
-
284
- // Enqueue
285
- const queue1 = await conn . getQueue (
286
- objQueueName ,
287
- { payloadType : oracledb . DB_TYPE_OBJECT }
288
- ) ;
289
- const objClass = await conn . getDbObjectClass ( objType ) ;
290
- const message = new objClass ( addrData ) ;
291
- // const message = new queue1.payloadTypeClass(addrData);
292
- await queue1 . enqOne ( message ) ;
293
- await conn . commit ( ) ;
294
-
295
- // Dequeue
296
- const queue2 = await conn . getQueue (
297
- objQueueName ,
298
- { payloadType : oracledb . DB_TYPE_OBJECT }
273
+ await assert . rejects (
274
+ async ( ) => {
275
+ const queue1 = await conn . getQueue (
276
+ objQueueName ,
277
+ { payloadType : oracledb . DB_TYPE_OBJECT }
278
+ ) ;
279
+ const objClass = await conn . getDbObjectClass ( objType ) ;
280
+ const message = new objClass ( addrData ) ;
281
+ await queue1 . enqOne ( message ) ;
282
+ } ,
283
+ {
284
+ message : 'NJS-007: invalid value for "payloadType" in parameter 2'
285
+ }
299
286
) ;
300
- const msg = await queue2 . deqOne ( ) ;
301
- await conn . commit ( ) ;
302
- should . exist ( msg ) ;
303
- should . strictEqual ( msg . payload . NAME , addrData . NAME ) ;
304
- should . strictEqual ( msg . payload . ADDRESS , addrData . ADDRESS ) ;
305
287
} catch ( err ) {
306
288
should . not . exist ( err ) ;
307
289
}
0 commit comments