1
+ /* Copyright (c) 2018, 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
+ * The node-oracledb test suite uses 'mocha', 'should' and 'async'.
19
+ * See LICENSE.md for relevant licenses.
20
+ *
21
+ * NAME
22
+ * 159. end2endTracing.js
23
+ *
24
+ * DESCRIPTION
25
+ * Test settings of end-to-end tracing attributes.
26
+ *
27
+ *****************************************************************************/
28
+ 'use strict' ;
29
+
30
+ var oracledb = require ( 'oracledb' ) ;
31
+ var should = require ( 'should' ) ;
32
+ var dbConfig = require ( './dbconfig.js' ) ;
33
+
34
+ describe ( '159. end2endTracing.js' , function ( ) {
35
+
36
+ var conn ;
37
+ before ( function ( done ) {
38
+ oracledb . getConnection (
39
+ dbConfig ,
40
+ function ( err , connection ) {
41
+ should . not . exist ( err ) ;
42
+ conn = connection ;
43
+ done ( ) ;
44
+ }
45
+ ) ;
46
+ } ) ;
47
+
48
+ after ( function ( done ) {
49
+ conn . close ( function ( err ) {
50
+ should . not . exist ( err ) ;
51
+ done ( ) ;
52
+ } ) ;
53
+ } ) ;
54
+
55
+ var verify = function ( sql , expect , callback ) {
56
+ conn . execute (
57
+ sql ,
58
+ function ( err , result ) {
59
+ should . not . exist ( err ) ;
60
+ should . strictEqual (
61
+ result . rows [ 0 ] [ 0 ] ,
62
+ expect
63
+ ) ;
64
+ callback ( ) ;
65
+ }
66
+ ) ;
67
+ } ;
68
+
69
+ it ( '159.1 set the end-to-end tracing attribute - module' , function ( done ) {
70
+
71
+ var sql = "select sys_context('userenv', 'module') from dual" ;
72
+ var testValue = "MODULE" ;
73
+ conn . module = testValue ;
74
+ verify ( sql , testValue , done ) ;
75
+
76
+ } ) ;
77
+
78
+ it ( '159.2 set the tracing attribute - action' , function ( done ) {
79
+
80
+ var sql = "select sys_context('userenv', 'action') from dual" ;
81
+ var testValue = "ACTION" ;
82
+ conn . action = testValue ;
83
+ verify ( sql , testValue , done ) ;
84
+
85
+ } ) ;
86
+
87
+ it ( '159.3 set the tracing attribure - clientId' , function ( done ) {
88
+
89
+ var sql = "select sys_context('userenv', 'client_identifier') from dual" ;
90
+ var testValue = "CLIENTID" ;
91
+ conn . clientId = testValue ;
92
+ verify ( sql , testValue , done ) ;
93
+
94
+ } ) ;
95
+ } ) ;
0 commit comments