Produced by Araxis Merge on 10/3/2017 11:16:02 AM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | ehmp.zip\ehmp\ehmp\product\production\vx-sync\tests\integrationtests\handlers\vista-record-processor | vista-record-processor-handler-itest-spec.js | Mon Jul 10 17:46:22 2017 UTC |
| 2 | ehmp.zip\ehmp\ehmp\product\production\vx-sync\tests\integrationtests\handlers\vista-record-processor | vista-record-processor-handler-itest-spec.js | Tue Oct 3 12:54:59 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 3 | 1296 |
| Changed | 2 | 6 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | 'use stric t'; | |
| 2 | ||
| 3 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- - | |
| 4 | // This is an integr ation test for the v ista-recor d-procesor -handler. | |
| 5 | // | |
| 6 | // Author: Les Westb erg | |
| 7 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- - | |
| 8 | ||
| 9 | require('. ./../../.. /env-setup '); | |
| 10 | var _ = re quire('und erscore'); | |
| 11 | ||
| 12 | var testHa ndler = re quire(glob al.VX_INTT ESTS + 'fr amework/ha ndler-test -framework ').testHan dler; | |
| 13 | var VistaC lient = re quire(glob al.VX_SUBS YSTEMS + ' vista/vist a-client') ; | |
| 14 | var Publis herRouter = require( global.VX_ JOBFRAMEWO RK).Publis herRouter; | |
| 15 | var grabJo bs = requi re(global. VX_INTTEST S + 'frame work/job-g rabber'); | |
| 16 | var jobUti l = requir e(global.V X_UTILS + 'job-utils '); | |
| 17 | var dummyL ogger = re quire(glob al.VX_DUMM IES + 'dum my-logger' ); | |
| 18 | // dummyLo gger = req uire('buny an').creat eLogger({ | |
| 19 | // nam e: 'dummy- log', | |
| 20 | // lev el: 'debug ' | |
| 21 | // }); | |
| 22 | ||
| 23 | ||
| 24 | var handle = require (global.VX _HANDLERS + 'vista-r ecord-proc essor/vist a-record-p rocessor-h andler'); | |
| 25 | var JobSta tusUpdater = require (global.VX _SUBSYSTEM S + 'jds/J obStatusUp dater'); | |
| 26 | var JdsCli ent = requ ire(global .VX_SUBSYS TEMS + 'jd s/jds-clie nt'); | |
| 27 | var wConfi g = requir e(global.V X_ROOT + ' worker-con fig'); | |
| 28 | var realCo nfig = JSO N.parse(JS ON.stringi fy(wConfig )); // Ma ke sure we are not u sing a sha red copy o f this so we can mak e changes later and not side e ffect some other tes t. | |
| 29 | ||
| 30 | var val = require(gl obal.VX_UT ILS + 'obj ect-utils' ).getPrope rty; | |
| 31 | ||
| 32 | var testCo nfig = req uire(globa l.VX_INTTE STS + 'tes t-config') ; | |
| 33 | var host = testConfi g.vxsyncIP ; | |
| 34 | var port = PORT ; | |
| 35 | var tubena me = 'vx-s ync-test'; | |
| 36 | ||
| 37 | var config = { | |
| 38 | vistaS ites: { | |
| 39 | '9 E7A': {}, | |
| 40 | 'C 877': {} | |
| 41 | }, | |
| 42 | // rem ove this i f it has n ot caused an integra tion test build to f ail | |
| 43 | // mvi : _.defaul ts(realCon fig.mvi, { | |
| 44 | // protocol: 'http', | |
| 45 | // host: '12 7.0.0.1', | |
| 46 | // port: 540 0, | |
| 47 | // path: '/m vi' | |
| 48 | // }), | |
| 49 | jds: _ .defaults( realConfig .jds, { | |
| 50 | pr otocol: 'h ttp', | |
| 51 | host: ' IP ', | |
| 52 | port: PORT | |
| 53 | }), | |
| 54 | syncNo tification s: { | |
| 55 | di scharge: { | |
| 56 | dataDoma in: 'disch arge' | |
| 57 | } | |
| 58 | } | |
| 59 | }; | |
| 60 | ||
| 61 | var enviro nment = { | |
| 62 | vistaC lient: new VistaClie nt(dummyLo gger, dumm yLogger, c onfig), | |
| 63 | jobSta tusUpdater : {}, | |
| 64 | publis herRouter: {}, | |
| 65 | metric s: dummyLo gger, | |
| 66 | jds: n ew JdsClie nt(dummyLo gger, dumm yLogger, c onfig) | |
| 67 | }; | |
| 68 | environmen t.jobStatu sUpdater = new JobSt atusUpdate r(dummyLog ger, confi g, environ ment.jds); | |
| 69 | environmen t.publishe rRouter = new Publis herRouter( dummyLogge r, config, dummyLogg er, enviro nment.jobS tatusUpdat er); | |
| 70 | ||
| 71 | var icnVal ue = '1000 0V400000'; | |
| 72 | ||
| 73 | var patien tIdentifie rValue = { | |
| 74 | type: 'pid', | |
| 75 | value: 'CCCC;3' | |
| 76 | }; | |
| 77 | ||
| 78 | var vistaF ullMessage = { | |
| 79 | apiVer sion: 1.02 , | |
| 80 | params : { | |
| 81 | do main: 'PAN ORAMA.VIST ACORE.US', | |
| 82 | sy stemId: 'C CCC' | |
| 83 | }, | |
| 84 | data: { | |
| 85 | up dated: '20 1501191356 18', | |
| 86 | to talItems: 6, | |
| 87 | la stUpdate: '3150119-1 5430', | |
| 88 | wa itingPids: [], | |
| 89 | pr ocessingPi ds: [], | |
| 90 | re mainingObj ects: 0, | |
| 91 | it ems: [{ | |
| 92 | collecti on: 'OPDsy ncStart', | |
| 93 | systemId : 'CCCC', | |
| 94 | rootJobI d: '1', | |
| 95 | jobId: ' 3', | |
| 96 | metaStam p: { | |
| 97 | stam pTime: 201 4103109492 0, | |
| 98 | sour ceMetaStam p: { | |
| 99 | 'CCCC': { | |
| 100 | stampT ime: 20141 031094920, | |
| 101 | domain MetaStamp: { | |
| 102 | 'a su-class': { | |
| 103 | domain: 'asu-class ', | |
| 104 | stampTim e: 2014103 1094920, | |
| 105 | itemMeta Stamp: { | |
| 106 | 'urn :va:asu-cl ass:CCCC:1 9': { | |
| 107 | 'stampTime ': 2014103 1094920 | |
| 108 | }, | |
| 109 | 'urn :va:asu-cl ass:CCCC:3 1': { | |
| 110 | 'stampTime ': 2014103 1094920 | |
| 111 | } | |
| 112 | } | |
| 113 | } | |
| 114 | } | |
| 115 | } | |
| 116 | } | |
| 117 | } | |
| 118 | }, { | |
| 119 | collecti on: 'asu-c lass', | |
| 120 | seq: 1, | |
| 121 | total: 2 , | |
| 122 | object: { | |
| 123 | abbr eviation: 'ANES', | |
| 124 | acti ve: true, | |
| 125 | disp layName: ' Anesthesio logist', | |
| 126 | loca lId: 19, | |
| 127 | name : 'ANESTHE SIOLOGIST' , | |
| 128 | uid: 'urn:va:a su-class:C CCC:19' | |
| 129 | } | |
| 130 | }, { | |
| 131 | collecti on: 'asu-c lass', | |
| 132 | seq: 2, | |
| 133 | total: 2 , | |
| 134 | object: { | |
| 135 | abbr eviation: 'ACOS', | |
| 136 | acti ve: true, | |
| 137 | disp layName: ' Associate Chief Of S taff', | |
| 138 | loca lId: 31, | |
| 139 | name : 'ASSOCIA TE CHIEF O F STAFF', | |
| 140 | uid: 'urn:va:a su-class:C CCC:31' | |
| 141 | } | |
| 142 | }, { | |
| 143 | collecti on: 'syncS tart', | |
| 144 | pid: 'CC CC;3', | |
| 145 | systemId : 'CCCC', | |
| 146 | localId: '3', | |
| 147 | icn: icn Value, | |
| 148 | rootJobI d: '1', | |
| 149 | jobId: ' 3', | |
| 150 | metaStam p: { | |
| 151 | icn: icnValue, | |
| 152 | stam pTime: '20 1501191356 18', | |
| 153 | sour ceMetaStam p: { | |
| 154 | 'CCCC': { | |
| 155 | pid: ' CCCC;3', | |
| 156 | localI d: '3', | |
| 157 | stampT ime: '2015 0119135618 ', | |
| 158 | domain MetaStamp: { | |
| 159 | al lergy: { | |
| 160 | domain: 'allergy', | |
| 161 | stampTim e: '201501 19135618', | |
| 162 | eventMet aStamp: { | |
| 163 | 'urn :va:allerg y:CCCC:3:7 51': { | |
| 164 | stampTime: '20150119 135618' | |
| 165 | }, | |
| 166 | 'urn :va:allerg y:CCCC:3:7 52': { | |
| 167 | stampTime: '20150119 135618' | |
| 168 | } | |
| 169 | } | |
| 170 | } | |
| 171 | } | |
| 172 | } | |
| 173 | } | |
| 174 | }, | |
| 175 | seq: 1, | |
| 176 | total: 1 | |
| 177 | }, { | |
| 178 | collecti on: 'aller gy', | |
| 179 | pid: 'CC CC;3', | |
| 180 | systemId : 'CCCC', | |
| 181 | localId: '3', | |
| 182 | icn: icn Value, | |
| 183 | seq: 1, | |
| 184 | total: 2 , | |
| 185 | object: { | |
| 186 | drug Classes: [ { | |
| 187 | code: 'AM1 14', | |
| 188 | name: 'PEN ICILLINSAN DBETA-LACT AMANTIMICR OBIALS' | |
| 189 | }], | |
| 190 | ente red: 20050 3172009, | |
| 191 | faci lityCode: 500, | |
| 192 | faci lityName: 'CAMPMASTE R', | |
| 193 | hist orical: tr ue, | |
| 194 | kind : 'Allergy \/AdverseR eaction', | |
| 195 | last UpdateTime : 20050317 200936, | |
| 196 | loca lId: 751, | |
| 197 | mech anism: 'PH ARMACOLOGI C', | |
| 198 | orig inatorName : 'VEHU, E IGHT', | |
| 199 | prod ucts: [{ | |
| 200 | name: 'PEN ICILLIN', | |
| 201 | vuid: 'urn :va:vuid' | |
| 202 | }], | |
| 203 | reac tions: [{ | |
| 204 | name: 'ITC HING, WATE RINGEYES', | |
| 205 | vuid: 'urn :va:vuid' | |
| 206 | }], | |
| 207 | refe rence: '12 5;GMRD(120 .82,', | |
| 208 | stam pTime: 200 5031720093 6, | |
| 209 | summ ary: 'PENI CILLIN', | |
| 210 | type Name: 'DRU G', | |
| 211 | uid: 'urn:va:a llergy:CCC C:3:751', | |
| 212 | veri fied: 2005 0317200936 , | |
| 213 | veri fierName: '<auto-ver ified>' | |
| 214 | } | |
| 215 | }, { | |
| 216 | collecti on: 'aller gy', | |
| 217 | pid: 'CC CC;3', | |
| 218 | systemId : 'CCCC', | |
| 219 | localId: '3', | |
| 220 | icn: icn Value, | |
| 221 | seq: 1, | |
| 222 | total: 2 , | |
| 223 | object: { | |
| 224 | drug Classes: [ { | |
| 225 | code: 'AM1 14', | |
| 226 | name: 'PEN ICILLINSAN DBETA-LACT AMANTIMICR OBIALS' | |
| 227 | }], | |
| 228 | ente red: 20050 3172009, | |
| 229 | faci lityCode: 500, | |
| 230 | faci lityName: 'CAMPMASTE R', | |
| 231 | hist orical: tr ue, | |
| 232 | kind : 'Allergy \/AdverseR eaction', | |
| 233 | last UpdateTime : 20050317 200936, | |
| 234 | loca lId: 751, | |
| 235 | mech anism: 'PH ARMACOLOGI C', | |
| 236 | orig inatorName : 'VEHU, E IGHT', | |
| 237 | prod ucts: [{ | |
| 238 | name: 'PEN ICILLIN', | |
| 239 | vuid: 'urn :va:vuid' | |
| 240 | }], | |
| 241 | reac tions: [{ | |
| 242 | name: 'ITC HING, WATE RINGEYES', | |
| 243 | vuid: 'urn :va:vuid' | |
| 244 | }], | |
| 245 | refe rence: '12 5;GMRD(120 .82,', | |
| 246 | stam pTime: 200 5031720093 6, | |
| 247 | summ ary: 'PENI CILLIN', | |
| 248 | type Name: 'DRU G', | |
| 249 | uid: 'urn:va:a llergy:CCC C:3:752', | |
| 250 | veri fied: 2005 0317200936 , | |
| 251 | veri fierName: '<auto-ver ified>' | |
| 252 | } | |
| 253 | }] | |
| 254 | } | |
| 255 | }; | |
| 256 | ||
| 257 | var discha rgeFullMes sage = { | |
| 258 | apiVer sion: 1.02 , | |
| 259 | params : { | |
| 260 | do main: 'PAN ORAMA.VIST ACORE.US', | |
| 261 | sy stemId: 'C CCC' | |
| 262 | }, | |
| 263 | data: { | |
| 264 | up dated: '20 1501191356 18', | |
| 265 | to talItems: 6, | |
| 266 | la stUpdate: '3150119-1 5430', | |
| 267 | wa itingPids: [], | |
| 268 | pr ocessingPi ds: [], | |
| 269 | re mainingObj ects: 0, | |
| 270 | it ems: [{ | |
| 271 | collecti on: 'syncS tart', | |
| 272 | pid: 'CC CC;3', | |
| 273 | systemId : 'CCCC', | |
| 274 | localId: '3', | |
| 275 | icn: icn Value, | |
| 276 | rootJobI d: '1', | |
| 277 | jobId: ' 3', | |
| 278 | metaStam p: { | |
| 279 | icn: icnValue, | |
| 280 | stam pTime: '20 1501191356 18', | |
| 281 | sour ceMetaStam p: { | |
| 282 | 'CCCC': { | |
| 283 | pid: ' CCCC;3', | |
| 284 | localI d: '3', | |
| 285 | stampT ime: '2015 0119135618 ', | |
| 286 | domain MetaStamp: { | |
| 287 | di scharge: { | |
| 288 | domain: 'discharge ', | |
| 289 | stampTim e: '201501 19135618', | |
| 290 | eventMet aStamp: { | |
| 291 | 'urn :va:allerg y:CCCC:3:7 51': { | |
| 292 | stampTime: '20150119 135618' | |
| 293 | } | |
| 294 | } | |
| 295 | } | |
| 296 | } | |
| 297 | } | |
| 298 | } | |
| 299 | }, | |
| 300 | seq: 1, | |
| 301 | total: 1 | |
| 302 | }, { | |
| 303 | collecti on: 'disch arge', | |
| 304 | pid: 'CC CC;3', | |
| 305 | systemId : 'CCCC', | |
| 306 | localId: '3', | |
| 307 | icn: icn Value, | |
| 308 | seq: 1, | |
| 309 | total: 1 , | |
| 310 | unsolici tedUpdate: true, | |
| 311 | object: { | |
| 312 | dece ased: true , | |
| 313 | last UpdateTime : '2017051 7094313', | |
| 314 | faci lityCode: '998', | |
| 315 | faci lityName: 'ABILENE ( CAA)', | |
| 316 | kind : 'dischar ge', | |
| 317 | reas onName: 'C HEST PAIN' , | |
| 318 | stam pTime: '20 1705170943 13', | |
| 319 | uid: 'urn:va:d ischarge:C CCC:3:H465 4' | |
| 320 | } | |
| 321 | ||
| 322 | }] | |
| 323 | } | |
| 324 | }; | |
| 325 | ||
| 326 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- ------ | |
| 327 | // Clear t he entries from the tube. | |
| 328 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- ------ | |
| 329 | function c learTube(l ogger, hos t, port, t ubename) { | |
| 330 | var ca lled = fal se; | |
| 331 | var ca lledError; | |
| 332 | ||
| 333 | grabJo bs(logger, host, por t, tubenam e, 0, func tion(error ) { | |
| 334 | ca lledError = error; | |
| 335 | ca lled = tru e; | |
| 336 | }); | |
| 337 | ||
| 338 | waitsF or(functio n() { | |
| 339 | re turn calle d; | |
| 340 | }, 'sh ould be ca lled', 200 00); | |
| 341 | ||
| 342 | runs(f unction() { | |
| 343 | // console.l og('clearT ube: error : %s;', ca lledError) ; | |
| 344 | ex pect(calle dError).to BeNull(); | |
| 345 | }); | |
| 346 | } | |
| 347 | ||
| 348 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- --- | |
| 349 | // Clear t he sync st atus | |
| 350 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- --- | |
| 351 | function c learTestPa tient(envi ronment) { | |
| 352 | var co mpleted = false; | |
| 353 | var ac tualError; | |
| 354 | var ac tualRespon se; | |
| 355 | ||
| 356 | runs(f unction() { | |
| 357 | en vironment. jds.delete PatientByP id(patient Identifier Value.valu e, functio n(error, r esponse) { | |
| 358 | actualEr ror = erro r; | |
| 359 | actualRe sponse = r esponse; | |
| 360 | complete d = true; | |
| 361 | }) ; | |
| 362 | }); | |
| 363 | ||
| 364 | waitsF or(functio n() { | |
| 365 | re turn compl eted; | |
| 366 | }, 'Ti med out wa iting for jds.delete PatientByP id.', 2000 0); | |
| 367 | ||
| 368 | runs(f unction() { | |
| 369 | // console.l og('delete PatientByP id: error: %s; respo nse: %j', actualErro r, actualR esponse); | |
| 370 | ex pect(actua lError).to BeFalsy(); | |
| 371 | ex pect(actua lResponse) .toBeTruth y(); | |
| 372 | // expect(val (actualRes ponse, 'st atusCode') ).toEqual( 200); //St atus code can be 200 or 404 | |
| 373 | }); | |
| 374 | } | |
| 375 | ||
| 376 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- --- | |
| 377 | // Clear t he operati onal sync status for CCCC | |
| 378 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- --- | |
| 379 | function c learOperat ionalSyncS tatus(envi ronment) { | |
| 380 | var co mpleted = false; | |
| 381 | var ac tualError; | |
| 382 | var ac tualRespon se; | |
| 383 | ||
| 384 | runs(f unction() { | |
| 385 | en vironment. jds.delete Operationa lSyncStatu s('CCCC', function(e rror, resp onse) { | |
| 386 | actualEr ror = erro r; | |
| 387 | actualRe sponse = r esponse; | |
| 388 | complete d = true; | |
| 389 | }) ; | |
| 390 | }); | |
| 391 | ||
| 392 | waitsF or(functio n() { | |
| 393 | re turn compl eted; | |
| 394 | }, 'Ti med out wa iting for jds.delete Operationa lSyncStatu s.', 20000 ); | |
| 395 | ||
| 396 | runs(f unction() { | |
| 397 | // console.l og('delete Operationa lSyncStatu s: error: %s; respon se: %j', a ctualError , actualRe sponse); | |
| 398 | ex pect(actua lError).to BeFalsy(); | |
| 399 | ex pect(actua lResponse) .toBeTruth y(); | |
| 400 | ex pect(val(a ctualRespo nse, 'stat usCode')). toEqual(20 0); | |
| 401 | }); | |
| 402 | } | |
| 403 | ||
| 404 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- - | |
| 405 | // Retriev e sync sta tus | |
| 406 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- - | |
| 407 | function r etrieveSyn cStatus(pa tientIdent ifier, env ironment, callback) { | |
| 408 | var co mpleted2 = false; | |
| 409 | var ac tualError; | |
| 410 | var ac tualRespon se; | |
| 411 | var ac tualResult ; | |
| 412 | ||
| 413 | // con sole.log(' retrieveSy ncStatus: Entering m ethod'); | |
| 414 | runs(f unction() { | |
| 415 | en vironment. jds.getSyn cStatus(pa tientIdent ifier, fun ction(erro r, respons e, result) { | |
| 416 | actualEr ror = erro r; | |
| 417 | actualRe sponse = r esponse; | |
| 418 | actualRe sult = res ult; | |
| 419 | // conso le.log('re trieveSync Status: fi nished ret rieving sy nc status. error: % s; respons e: %s; res ult: %j', actualErro r, actualR esponse, a ctualResul t); | |
| 420 | complete d2 = true; | |
| 421 | }) ; | |
| 422 | }); | |
| 423 | ||
| 424 | waitsF or(functio n() { | |
| 425 | re turn compl eted2; | |
| 426 | }, 'Ti med out wa iting for jds.clearT estPatient .', 20000) ; | |
| 427 | ||
| 428 | runs(f unction() { | |
| 429 | // console.l og('retrie veSyncStat us: error: %s; respo nse: %j', actualErro r, actualR esponse); | |
| 430 | ex pect(actua lError).to BeNull(); | |
| 431 | ex pect(actua lResponse) .toBeTruth y(); | |
| 432 | ex pect(val(a ctualRespo nse, 'stat usCode')). toEqual(20 0); | |
| 433 | ex pect(actua lResult).t oBeTruthy( ); | |
| 434 | ca llback(nul l, actualR esult); | |
| 435 | }); | |
| 436 | } | |
| 437 | ||
| 438 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- - | |
| 439 | // Retriev e operatio nal sync s tatus | |
| 440 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- - | |
| 441 | function r etrieveOpe rationalSy ncStatus(s iteId, env ironment, callback) { | |
| 442 | var co mpleted2 = false; | |
| 443 | var ac tualError; | |
| 444 | var ac tualRespon se; | |
| 445 | var ac tualResult ; | |
| 446 | ||
| 447 | // con sole.log(' retrieveSy ncStatus: Entering m ethod'); | |
| 448 | runs(f unction() { | |
| 449 | en vironment. jds.getOpe rationalSy ncStatus(s iteId, fun ction(erro r, respons e, result) { | |
| 450 | actualEr ror = erro r; | |
| 451 | actualRe sponse = r esponse; | |
| 452 | actualRe sult = res ult; | |
| 453 | // conso le.log('re trieveSync Status: fi nished ret rieving sy nc status. error: % s; respons e: %s; res ult: %j', actualErro r, actualR esponse, a ctualResul t); | |
| 454 | complete d2 = true; | |
| 455 | }) ; | |
| 456 | }); | |
| 457 | ||
| 458 | waitsF or(functio n() { | |
| 459 | re turn compl eted2; | |
| 460 | }, 'Ti med out wa iting for jds.clearT estPatient .', 20000) ; | |
| 461 | ||
| 462 | runs(f unction() { | |
| 463 | // console.l og('retrie veSyncStat us: error: %s; respo nse: %j', actualErro r, actualR esponse); | |
| 464 | ex pect(actua lError).to BeNull(); | |
| 465 | ex pect(actua lResponse) .toBeTruth y(); | |
| 466 | ex pect(val(a ctualRespo nse, 'stat usCode')). toEqual(20 0); | |
| 467 | ex pect(actua lResult).t oBeTruthy( ); | |
| 468 | ca llback(nul l, actualR esult); | |
| 469 | }); | |
| 470 | } | |
| 471 | ||
| 472 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- | |
| 473 | // Create patientIde ntifiers f or the pat ient we wa nt to use. | |
| 474 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- | |
| 475 | function c reatePatie ntIdentifi ers(icn, p atientIden tifier, en vironment, callback) { | |
| 476 | var jd sPatientId entificati onRequest = { | |
| 477 | pa tientIdent ifiers: [i cn, patien tIdentifie r.value] | |
| 478 | }; | |
| 479 | var co mpleted3 = false; | |
| 480 | var ac tualError; | |
| 481 | var ac tualRespon se; | |
| 482 | ||
| 483 | runs(f unction() { | |
| 484 | en vironment. jds.storeP atientIden tifier(jds PatientIde ntificatio nRequest, function(e rror, resp onse, resu lt) { | |
| 485 | actualEr ror = erro r; | |
| 486 | actualRe sponse = r esponse; | |
| 487 | dummyLog ger.debug( 'createPat ientIdenti fiers: fin ished stor ing patien t identifi ers. erro r: %s; res ponse: %j; result: % j', error, response, result); | |
| 488 | complete d3 = true; | |
| 489 | }) ; | |
| 490 | }); | |
| 491 | ||
| 492 | waitsF or(functio n() { | |
| 493 | re turn compl eted3; | |
| 494 | }, 'Ti med out wa iting for jds.storeP atientIden tifier.', 20000); | |
| 495 | ||
| 496 | runs(f unction() { | |
| 497 | ex pect(actua lError).to BeNull(); | |
| 498 | ex pect(actua lResponse) .toBeTruth y(); | |
| 499 | // expect(val (actualRes ponse, 'st atusCode') ).toEqual( 200); | |
| 500 | ca llback(nul l, 'succes s'); | |
| 501 | }); | |
| 502 | ||
| 503 | } | |
| 504 | ||
| 505 | describe(' vista-reco rd-process or.js', fu nction() { | |
| 506 | descri be('Verify handler p rocessed t he message s, creates expected jobs, and stores met aStamps / sync statu s into JDS ', functio n() { | |
| 507 | be foreEach(f unction() { | |
| 508 | // Clear SyncStatu s | |
| 509 | //------ ---------- - | |
| 510 | clearTes tPatient(e nvironment ); | |
| 511 | clearOpe rationalSy ncStatus(e nvironment ); | |
| 512 | ||
| 513 | // Clear Jobs | |
| 514 | //------ ----- | |
| 515 | clearTub e(dummyLog ger, host, port, tub ename); | |
| 516 | ||
| 517 | // Creat e the pati ent Identi fiers | |
| 518 | //------ ---------- ---------- ------ | |
| 519 | createPa tientIdent ifiers(icn Value, pat ientIdenti fierValue, environme nt, functi on(error, response) { | |
| 520 | expe ct(error). toBeNull() ; | |
| 521 | expe ct(respons e).toBe('s uccess'); | |
| 522 | }); | |
| 523 | }) ; | |
| 524 | ||
| 525 | af terEach(fu nction() { | |
| 526 | environm ent.publis herRouter. close(); | |
| 527 | }) ; | |
| 528 | ||
| 529 | va r job = jo bUtil.crea teVistaRec ordProcess orRequest( vistaFullM essage.dat a, null); | |
| 530 | ||
| 531 | va r actualRe sponse, ac tualError, actualOpe rationalSy ncStatus, actualSync Status; | |
| 532 | ||
| 533 | va r matching JobTypes = [jobUtil. operationa lDataStore Type(), jo bUtil.oper ationalDat aStoreType (), jobUti l.eventPri oritizatio nRequestTy pe(), jobU til.eventP rioritizat ionRequest Type()]; | |
| 534 | te stHandler( handle, du mmyLogger, config, e nvironment , host, po rt, tubena me, job, m atchingJob Types, nul l, functio n(error, r esponse) { | |
| 535 | actualEr ror = erro r; | |
| 536 | actualRe sponse = r esponse; | |
| 537 | // Now t hat we hav e publishe d and retr ieved the jobs. Let s retrieve the SyncS tatus (met a stamp) | |
| 538 | //------ ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- --------- | |
| 539 | var comp leted2 = f alse; | |
| 540 | var comp leted3 = f alse; | |
| 541 | runs(fun ction() { | |
| 542 | dumm yLogger.de bug('it(po ller proce ssed corre ctly): bef ore retrie ving syncS tatus. er ror: %s; j obs: %j;', actualErr or, actual Response); | |
| 543 | retr ieveSyncSt atus({ | |
| 544 | type: 'pid ', | |
| 545 | value: 'CC CC;3' | |
| 546 | }, e nvironment , function (error, sy ncStatus) { | |
| 547 | actualErro r = error; | |
| 548 | actualSync Status = s yncStatus; | |
| 549 | dummyLogge r.debug('i t(poller p rocessed c orrectly): after ret rieving sy ncStatus. error: %s ; jobs: %j ; actualSy ncStatus: ', actualE rror, actu alResponse , actualSy ncStatus); | |
| 550 | completed2 = true; | |
| 551 | }); | |
| 552 | dumm yLogger.de bug('it(po ller proce ssed corre ctly): now retrievin g operatio nal syncSt atus.'); | |
| 553 | retr ieveOperat ionalSyncS tatus('CCC C', enviro nment, fun ction(erro r, syncSta tus) { | |
| 554 | actualErro r = error; | |
| 555 | actualOper ationalSyn cStatus = syncStatus ; | |
| 556 | dummyLogge r.debug('i t(poller p rocessed c orrectly): after ret rieving op erational syncStatus . actualOp erationalS yncStatus: ', actual Operationa lSyncStatu s); | |
| 557 | completed3 = true; | |
| 558 | }); | |
| 559 | }); | |
| 560 | ||
| 561 | waitsFor (function( ) { | |
| 562 | retu rn complet ed2 && com pleted3; | |
| 563 | }, 'resp onse from poller._pr ocessBatch timed out .', 10000) ; | |
| 564 | ||
| 565 | runs(fun ction() { | |
| 566 | expe ct(actualE rror).toBe Falsy(); | |
| 567 | ||
| 568 | // V erify that the syncS tatus was created | |
| 569 | //-- ---------- ---------- ---------- ------- | |
| 570 | expe ct(actualS yncStatus) .toBeTruth y(); | |
| 571 | dumm yLogger.wa rn(actualS yncStatus) ; | |
| 572 | expe ct(val(act ualSyncSta tus, 'inPr ogress')). toBeTruthy (); | |
| 573 | expe ct(val(act ualSyncSta tus, 'inPr ogress', ' icn')).toE qual('1000 0V400000') ; | |
| 574 | expe ct(val(act ualSyncSta tus, 'inPr ogress', ' sourceMeta Stamp')).t oBeTruthy( ); | |
| 575 | expe ct(val(act ualSyncSta tus, 'inPr ogress', ' sourceMeta Stamp', 'C CCC')).toB eTruthy(); | |
| 576 | expe ct(val(act ualSyncSta tus, 'inPr ogress', ' sourceMeta Stamp', 'C CCC', 'dom ainMetaSta mp')).toBe Truthy(); | |
| 577 | ||
| 578 | var domainMeta Stamp = va l(actualSy ncStatus, 'inProgres s', 'sourc eMetaStamp ', 'CCCC', 'domainMe taStamp'); | |
| 579 | expe ct(val(dom ainMetaSta mp, 'aller gy')).toBe Truthy(); | |
| 580 | expe ct(val(dom ainMetaSta mp, 'aller gy', 'doma in')).toEq ual('aller gy'); | |
| 581 | dumm yLogger.de bug('vista -record-po ller-itest -spec - in test... actualSyn cStatus: % j', actual SyncStatus ); | |
| 582 | ||
| 583 | // V erify that the opera tional syn cStatus wa s created | |
| 584 | //-- ---------- ---------- ---------- ---------- --------- | |
| 585 | //co nsole.log( actualOper ationalSyn cStatus); | |
| 586 | expe ct(actualO perational SyncStatus ).toBeTrut hy(); | |
| 587 | expe ct(val(act ualOperati onalSyncSt atus, 'inP rogress')) .toBeTruth y(); | |
| 588 | expe ct(val(act ualOperati onalSyncSt atus, 'inP rogress', 'sourceMet aStamp')). toBeTruthy (); | |
| 589 | expe ct(val(act ualOperati onalSyncSt atus, 'inP rogress', 'sourceMet aStamp', ' CCCC')).to BeTruthy() ; | |
| 590 | expe ct(val(act ualOperati onalSyncSt atus, 'inP rogress', 'sourceMet aStamp', ' CCCC', 'do mainMetaSt amp')).toB eTruthy(); | |
| 591 | ||
| 592 | var operationa lDomainMet astamp = v al(actualO perational SyncStatus , 'inProgr ess', 'sou rceMetaSta mp', 'CCCC ', 'domain MetaStamp' ); | |
| 593 | //co nsole.log( operationa lDomainMet astamp); | |
| 594 | expe ct(val(ope rationalDo mainMetast amp, 'asu- class')).t oBeTruthy( ); | |
| 595 | expe ct(val(ope rationalDo mainMetast amp, 'asu- class', 'd omain')).t oEqual('as u-class'); | |
| 596 | }); | |
| 597 | }) ; | |
| 598 | }); | |
| 599 | ||
| 600 | descri be('Verify handler p rocessed t he dischar ge message s, creates expected jobs, and does NOT s tores meta Stamps / s ync status into JDS' , function () { | |
| 601 | be foreEach(f unction() { | |
| 602 | // Clear SyncStatu s | |
| 603 | //------ ---------- - | |
| 604 | clearTes tPatient(e nvironment ); | |
| 605 | clearOpe rationalSy ncStatus(e nvironment ); | |
| 606 | ||
| 607 | // Clear Jobs | |
| 608 | //------ ----- | |
| 609 | clearTub e(dummyLog ger, host, port, tub ename); | |
| 610 | ||
| 611 | // Creat e the pati ent Identi fiers | |
| 612 | //------ ---------- ---------- ------ | |
| 613 | createPa tientIdent ifiers(icn Value, pat ientIdenti fierValue, environme nt, functi on(error, response) { | |
| 614 | expe ct(error). toBeNull() ; | |
| 615 | expe ct(respons e).toBe('s uccess'); | |
| 616 | }); | |
| 617 | }) ; | |
| 618 | ||
| 619 | af terEach(fu nction() { | |
| 620 | environm ent.publis herRouter. close(); | |
| 621 | }) ; | |
| 622 | ||
| 623 | va r job = jo bUtil.crea teVistaRec ordProcess orRequest( dischargeF ullMessage .data, nul l); | |
| 624 | ||
| 625 | va r actualRe sponse, ac tualError; | |
| 626 | ||
| 627 | va r matching JobTypes = [jobUtil. syncNotifi cationType ()]; | |
| 628 | te stHandler( handle, du mmyLogger, config, e nvironment , host, po rt, tubena me, job, m atchingJob Types, nul l, functio n(error, r esponse) { | |
| 629 | actualEr ror = erro r; | |
| 630 | actualRe sponse = r esponse; | |
| 631 | // Now t hat we hav e publishe d and retr ieved the jobs. Let s retrieve the SyncS tatus (met a stamp) | |
| 632 | //------ ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- --------- | |
| 633 | var comp leted2 = f alse; | |
| 634 | runs(fun ction() { | |
| 635 | dumm yLogger.de bug('it(po ller proce ssed corre ctly): bef ore retrie ving syncS tatus. er ror: %s; j obs: %j;', actualErr or, actual Response); | |
| 636 | envi ronment.jd s.getSyncS tatus({ | |
| 637 | type: 'pid ', | |
| 638 | value: 'CC CC;3' | |
| 639 | }, f unction(er ror, respo nse, resul t) { | |
| 640 | //Patient not found | |
| 641 | expect(err or).toBeFa lsy(); | |
| 642 | expect(res ponse.stat usCode).to Be(200); | |
| 643 | expect(res ult.syncSt atus).toBe Falsy(); | |
| 644 | completed2 = true; | |
| 645 | }); | |
| 646 | }); | |
| 647 | ||
| 648 | waitsFor (function( ) {return completed2 ;}, 'respo nse from p oller._pro cessBatch timed out. ', 10000); | |
| 649 | }) ; | |
| 650 | }); | |
| 651 | }); |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.