1+ /* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. */
2+
3+ /******************************************************************************
4+ *
5+ * You may not use the identified files except in compliance with the Apache
6+ * License, Version 2.0 (the "License.")
7+ *
8+ * You may obtain a copy of the License at
9+ * http://www.apache.org/licenses/LICENSE-2.0.
10+ *
11+ * Unless required by applicable law or agreed to in writing, software
12+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+ *
15+ * See the License for the specific language governing permissions and
16+ * limitations under the License.
17+ *
18+ * NAME
19+ * 221. connectionClass.js
20+ *
21+ * DESCRIPTION
22+ * Test "oracledb.connectionClass".
23+ *
24+ *****************************************************************************/
25+ 'use strict' ;
26+
27+ const oracledb = require ( 'oracledb' ) ;
28+ const should = require ( 'should' ) ;
29+ const dbconfig = require ( './dbconfig.js' ) ;
30+
31+ describe ( '221. connectionClass.js' , ( ) => {
32+
33+ after ( ( ) => {
34+ oracledb . connectionClass = '' ;
35+ } ) ;
36+
37+ it ( '221.1 set the property when using a connection pool' , async ( ) => {
38+ try {
39+ oracledb . connectionClass = 'NODB_TEST' ;
40+ const pool = await oracledb . createPool ( dbconfig ) ;
41+ const conn = await pool . getConnection ( ) ;
42+
43+ const result = await conn . execute ( 'SELECT (1+4) FROM DUAL' ) ;
44+ should . strictEqual ( result . rows [ 0 ] [ 0 ] , 5 ) ;
45+
46+ await conn . close ( ) ;
47+ await pool . close ( ) ;
48+
49+ } catch ( err ) {
50+ should . not . exist ( err ) ;
51+ }
52+ } ) ; // 221.1
53+
54+ it . skip ( '221.2 set the property when using a standalone connection' , async ( ) => {
55+ try {
56+ oracledb . connectionClass = 'NODB_TEST' ;
57+ const conn = await oracledb . getConnection ( dbconfig ) ;
58+
59+ await conn . close ( ) ;
60+ } catch ( err ) {
61+ should . not . exist ( err ) ;
62+ }
63+ } ) ; // 221.2
64+ } ) ;
0 commit comments