@@ -40,10 +40,10 @@ var should = require('should');
4040var dbConfig = require ( './dbconfig.js' ) ;
4141var assist = require ( './dataTypeAssist.js' ) ;
4242
43- var inFileName = './ test/clobexample.txt' ; // the file with text to be inserted into the database
44- var outFileName = './ test/clobstreamout.txt' ;
43+ var inFileName = 'test/clobexample.txt' ; // the file with text to be inserted into the database
44+ var outFileName = 'test/clobstreamout.txt' ;
4545
46- describe . skip ( '40. dataTypeClob.js' , function ( ) {
46+ describe ( '40. dataTypeClob.js' , function ( ) {
4747
4848 var connection = null ;
4949 var tableName = "nodb_myclobs" ;
@@ -90,12 +90,6 @@ describe.skip('40. dataTypeClob.js', function() {
9090 async . series ( [
9191 function clobinsert1 ( callback ) {
9292
93- var lobFinishEventFired = false ;
94- setTimeout ( function ( ) {
95- lobFinishEventFired . should . equal ( true , "lob does not fire 'finish' event!" ) ;
96- callback ( ) ;
97- } , 2000 ) ;
98-
9993 connection . execute (
10094 "INSERT INTO nodb_myclobs (num, content) VALUES (:n, EMPTY_CLOB()) RETURNING content INTO :lobbv" ,
10195 { n : 1 , lobbv : { type : oracledb . CLOB , dir : oracledb . BIND_OUT } } ,
@@ -116,11 +110,11 @@ describe.skip('40. dataTypeClob.js', function() {
116110 should . not . exist ( err , "inStream.on 'error' event" ) ;
117111 } ) ;
118112
119- lob . on ( 'finish' , function ( ) {
120- lobFinishEventFired = true ;
113+ lob . on ( 'close' , function ( ) {
121114 // now commit updates
122115 connection . commit ( function ( err ) {
123116 should . not . exist ( err ) ;
117+ callback ( ) ;
124118 } ) ;
125119 } ) ;
126120
@@ -129,12 +123,6 @@ describe.skip('40. dataTypeClob.js', function() {
129123 ) ;
130124 } ,
131125 function clobstream1 ( callback ) {
132- var streamFinishEventFired = false ;
133- setTimeout ( function ( ) {
134- streamFinishEventFired . should . equal ( true , "stream does not call 'Finish' Event!" ) ;
135- callback ( ) ;
136- } , 2000 ) ;
137-
138126 connection . execute (
139127 "SELECT content FROM nodb_myclobs WHERE num = :n" ,
140128 { n : 1 } ,
@@ -156,7 +144,7 @@ describe.skip('40. dataTypeClob.js', function() {
156144
157145 lob . pipe ( outStream ) ;
158146
159- outStream . on ( 'finish ' , function ( ) {
147+ outStream . on ( 'close ' , function ( ) {
160148
161149 fs . readFile ( inFileName , { encoding : 'utf8' } , function ( err , originalData ) {
162150 should . not . exist ( err ) ;
@@ -165,22 +153,15 @@ describe.skip('40. dataTypeClob.js', function() {
165153 should . not . exist ( err ) ;
166154 originalData . should . equal ( generatedData ) ;
167155
168- streamFinishEventFired = true ;
156+ callback ( ) ;
169157 } ) ;
170158 } ) ;
171159 } ) ;
160+
172161 }
173162 ) ;
174163 } ,
175164 function clobstream2 ( callback ) {
176- var lobEndEventFired = false ;
177- var lobDataEventFired = false ;
178- setTimeout ( function ( ) {
179- lobDataEventFired . should . equal ( true , "lob does not call 'data' event!" ) ;
180- lobEndEventFired . should . equal ( true , "lob does not call 'end' event!" ) ;
181- callback ( ) ;
182- } , 2000 ) ;
183-
184165 connection . execute (
185166 "SELECT content FROM nodb_myclobs WHERE num = :n" ,
186167 { n : 1 } ,
@@ -193,19 +174,15 @@ describe.skip('40. dataTypeClob.js', function() {
193174 lob . setEncoding ( 'utf8' ) ; // set the encoding so we get a 'string' not a 'buffer'
194175
195176 lob . on ( 'data' , function ( chunk ) {
196- // console.log("lob.on 'data' event");
197- // console.log(' - got %d bytes of data', chunk.length);
198- lobDataEventFired = true ;
199177 clob += chunk ;
200178 } ) ;
201179
202- lob . on ( 'end ' , function ( ) {
180+ lob . on ( 'close ' , function ( ) {
203181 fs . readFile ( inFileName , { encoding : 'utf8' } , function ( err , data ) {
204182 should . not . exist ( err ) ;
205- lobEndEventFired = true ;
206-
207183 data . length . should . be . exactly ( clob . length ) ;
208184 data . should . equal ( clob ) ;
185+ callback ( ) ;
209186 } ) ;
210187 } ) ;
211188
@@ -216,14 +193,6 @@ describe.skip('40. dataTypeClob.js', function() {
216193 ) ;
217194 } ,
218195 function objectOutFormat ( callback ) {
219- var lobEndEventFired = false ;
220- var lobDataEventFired = false ;
221- setTimeout ( function ( ) {
222- lobDataEventFired . should . equal ( true , "lob does not call 'data' event!" ) ;
223- lobEndEventFired . should . equal ( true , "lob does not call 'end' event!" ) ;
224- callback ( ) ;
225- } , 2000 ) ;
226-
227196 connection . execute (
228197 "SELECT content FROM nodb_myclobs WHERE num = :n" ,
229198 { n : 1 } ,
@@ -238,12 +207,11 @@ describe.skip('40. dataTypeClob.js', function() {
238207 lob . setEncoding ( 'utf8' ) ;
239208
240209 lob . on ( 'data' , function ( chunk ) {
241- lobDataEventFired = true ;
242210 clob = clob + chunk ;
243211 } ) ;
244212
245- lob . on ( 'end ' , function ( ) {
246- lobEndEventFired = true ;
213+ lob . on ( 'close ' , function ( ) {
214+ callback ( ) ;
247215 } ) ;
248216
249217 lob . on ( 'error' , function ( err ) {
0 commit comments