File tree Expand file tree Collapse file tree 2 files changed +83
-1
lines changed Expand file tree Collapse file tree 2 files changed +83
-1
lines changed Original file line number Diff line number Diff line change @@ -179,7 +179,7 @@ describe('218. aq2.js', function() {
179
179
}
180
180
} ) ; // 218.3
181
181
182
- it . skip ( '218.4 getQueue() without options' , async ( ) => {
182
+ it . skip ( '218.4 getQueue() without options on DB Object data ' , async ( ) => {
183
183
try {
184
184
const addrData = {
185
185
NAME : "Changjie" ,
@@ -272,4 +272,38 @@ describe('218. aq2.js', function() {
272
272
should . not . exist ( err ) ;
273
273
}
274
274
} ) ; // 218.6
275
+
276
+ // A variation of 218.4
277
+ it . skip ( '218.7 Set payloadType as oracledb.DB_TYPE_OBJECT' , async ( ) => {
278
+ try {
279
+ const addrData = {
280
+ NAME : "Changjie" ,
281
+ ADDRESS : "200 Oracle Parkway Redwood City, CA US 94065"
282
+ } ;
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 }
299
+ ) ;
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
+ } catch ( err ) {
306
+ should . not . exist ( err ) ;
307
+ }
308
+ } ) ; // 218.7
275
309
} ) ;
Original file line number Diff line number Diff line change @@ -223,4 +223,52 @@ describe('219. aq3.js', function() {
223
223
should . not . exist ( err ) ;
224
224
}
225
225
} ) ; // 219.7
226
+
227
+ it . skip ( '219.8 getQueue() with options on RAW data' , async ( ) => {
228
+ try {
229
+ // Enqueue
230
+ const queue1 = await conn . getQueue (
231
+ rawQueueName ,
232
+ { payloadType : oracledb . DB_TYPE_RAW }
233
+ ) ;
234
+ const messageString = 'The default value of payloadType is "oracledb.DB_TYPE_RAW"' ;
235
+ await queue1 . enqOne ( messageString ) ;
236
+ await conn . commit ( ) ;
237
+
238
+ // Dequeue
239
+ const queue2 = await conn . getQueue ( rawQueueName ) ;
240
+ const msg = await queue2 . deqOne ( ) ;
241
+ await conn . commit ( ) ;
242
+
243
+ should . exist ( msg ) ;
244
+ should . strictEqual ( msg . payload . toString ( ) , messageString ) ;
245
+
246
+ } catch ( err ) {
247
+ should . not . exist ( err ) ;
248
+ }
249
+ } ) ; // 219.8
250
+
251
+ it . skip ( '219.9 Negative - getQueue() with invalid payloadType option' , async ( ) => {
252
+ try {
253
+ // Enqueue
254
+ const queue1 = await conn . getQueue (
255
+ rawQueueName ,
256
+ { payloadType : oracledb . DB_TYPE_OBJECT }
257
+ ) ;
258
+ const messageString = 'The default value of payloadType is "oracledb.DB_TYPE_RAW"' ;
259
+ await queue1 . enqOne ( messageString ) ;
260
+ await conn . commit ( ) ;
261
+
262
+ // Dequeue
263
+ const queue2 = await conn . getQueue ( rawQueueName ) ;
264
+ const msg = await queue2 . deqOne ( ) ;
265
+ await conn . commit ( ) ;
266
+
267
+ should . exist ( msg ) ;
268
+ should . strictEqual ( msg . payload . toString ( ) , messageString ) ;
269
+
270
+ } catch ( err ) {
271
+ should . not . exist ( err ) ;
272
+ }
273
+ } ) ; // 219.9
226
274
} ) ;
You can’t perform that action at this time.
0 commit comments