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-poller | vista-record-poller-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-poller | vista-record-poller-itest-spec.js | Tue Oct 3 12:54:34 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 3 | 1898 |
| 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-poller. Note that since the vista-rec ord-poller | |
| 5 | // is real ly a syste m that con tinues to run and po ll VistA a nd process what it g ets, it is not | |
| 6 | // feasibl e to test this at th e highest layer. It will be t ested from the point in time w here it | |
| 7 | // believe s a messag e has been received and then p rocess the message. So our in tegration test will | |
| 8 | // be writ ten to use a known m essage - a nd verify that all o f the down stream art ifacts are created | |
| 9 | // from th e know mes sage. | |
| 10 | // | |
| 11 | // Author: Les Westb erg | |
| 12 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- - | |
| 13 | ||
| 14 | require('. ./../../.. /env-setup '); | |
| 15 | var _ = re quire('und erscore'); | |
| 16 | ||
| 17 | var queueC onfig = re quire(glob al.VX_JOBF RAMEWORK). QueueConfi g; | |
| 18 | var VistaC lient = re quire(glob al.VX_SUBS YSTEMS + ' vista/vist a-client') ; | |
| 19 | var Publis herRouter = require( global.VX_ JOBFRAMEWO RK).Publis herRouter; | |
| 20 | var grabJo bs = requi re(global. VX_INTTEST S + 'frame work/job-g rabber'); | |
| 21 | var dummyL ogger = re quire(glob al.VX_DUMM IES + 'dum my-logger' ); | |
| 22 | // var log = require (global.VX _UTILS + ' log'); | |
| 23 | // dummyLo gger = log ._createLo gger({ | |
| 24 | // nam e: 'test', | |
| 25 | // lev el: 'debug ', | |
| 26 | // chi ld: log._c reateLogge r | |
| 27 | // }); | |
| 28 | ||
| 29 | var Poller = require (global.VX _HANDLERS + 'vista-r ecord-poll er/vista-r ecord-poll er'); | |
| 30 | var JobSta tusUpdater = require (global.VX _SUBSYSTEM S + 'jds/J obStatusUp dater'); | |
| 31 | var JdsCli ent = requ ire(global .VX_SUBSYS TEMS + 'jd s/jds-clie nt'); | |
| 32 | var wConfi g = requir e(global.V X_ROOT + ' worker-con fig'); | |
| 33 | 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. | |
| 34 | ||
| 35 | var val = require(gl obal.VX_UT ILS + 'obj ect-utils' ).getPrope rty; | |
| 36 | ||
| 37 | var testCo nfig = req uire(globa l.VX_INTTE STS + 'tes t-config') ; | |
| 38 | var host = testConfi g.vxsyncIP ; | |
| 39 | var port = PORT ; | |
| 40 | var tubena me = 'vx-s ync-test'; | |
| 41 | ||
| 42 | var beanst alkConfig = queueCon fig.create FullBeanst alkConfig( { | |
| 43 | repoUn iversal: { | |
| 44 | pr iority: 10 , | |
| 45 | de lay: 0, | |
| 46 | tt r: 60, | |
| 47 | ti meout: 10, | |
| 48 | in itMillis: 1000, | |
| 49 | ma xMillis: 1 5000, | |
| 50 | in cMillis: 1 000 | |
| 51 | }, | |
| 52 | repoDe faults: { | |
| 53 | ho st: host, | |
| 54 | po rt: port, | |
| 55 | tu bename: tu bename, | |
| 56 | tu bePrefix: 'vxs-', | |
| 57 | jo bTypeForTu be: false | |
| 58 | }, | |
| 59 | jobTyp es: { | |
| 60 | 'e nterprise- sync-reque st': {}, | |
| 61 | 'v ista-opera tional-sub scribe-req uest': {}, | |
| 62 | ||
| 63 | 'v ista-9E7A- subscribe- request': {}, | |
| 64 | 'v ista-C877- subscribe- request': {}, | |
| 65 | ||
| 66 | 'h dr-sync-re quest': {} , | |
| 67 | 'v ler-sync-r equest': { }, | |
| 68 | 'p gd-sync-re quest': {} , | |
| 69 | 'j meadows-sy nc-request ': {}, | |
| 70 | ||
| 71 | 'h dr-xform-v pr': {}, | |
| 72 | 'v ler-xform- vpr': {}, | |
| 73 | 'p gd-xform-v pr': {}, | |
| 74 | ||
| 75 | 'j meadows-sy nc-allergy -request': {}, | |
| 76 | 'j meadows-sy nc-appoint ment-reque st': {}, | |
| 77 | 'j meadows-sy nc-consult -request': {}, | |
| 78 | 'j meadows-sy nc-demogra phics-requ est': {}, | |
| 79 | 'j meadows-sy nc-dischar geSummary- request': {}, | |
| 80 | 'j meadows-sy nc-encount er-request ': {}, | |
| 81 | 'j meadows-sy nc-immuniz ation-requ est': {}, | |
| 82 | 'j meadows-sy nc-lab-req uest': {}, | |
| 83 | 'j meadows-sy nc-medicat ion-reques t': {}, | |
| 84 | 'j meadows-sy nc-note-re quest': {} , | |
| 85 | 'j meadows-sy nc-order-r equest': { }, | |
| 86 | 'j meadows-sy nc-problem -request': {}, | |
| 87 | 'j meadows-sy nc-progres sNote-requ est': {}, | |
| 88 | 'j meadows-sy nc-radiolo gy-request ': {}, | |
| 89 | 'j meadows-sy nc-vital-r equest': { }, | |
| 90 | ||
| 91 | 'j meadows-xf orm-allerg y-vpr': {} , | |
| 92 | 'j meadows-xf orm-appoin tment-vpr' : {}, | |
| 93 | 'j meadows-xf orm-consul t-vpr': {} , | |
| 94 | 'j meadows-xf orm-demogr aphics-vpr ': {}, | |
| 95 | 'j meadows-xf orm-discha rgeSummary -vpr': {}, | |
| 96 | 'j meadows-xf orm-encoun ter-vpr': {}, | |
| 97 | 'j meadows-xf orm-immuni zation-vpr ': {}, | |
| 98 | 'j meadows-xf orm-lab-vp r': {}, | |
| 99 | 'j meadows-xf orm-medica tion-vpr': {}, | |
| 100 | 'j meadows-xf orm-note-v pr': {}, | |
| 101 | 'j meadows-xf orm-order- vpr': {}, | |
| 102 | 'j meadows-xf orm-proble m-vpr': {} , | |
| 103 | 'j meadows-xf orm-progre ssNote-vpr ': {}, | |
| 104 | 'j meadows-xf orm-radiol ogy-vpr': {}, | |
| 105 | 'j meadows-xf orm-vital- vpr': {}, | |
| 106 | ||
| 107 | 'j meadows-pd f-document -transform ': {}, | |
| 108 | 'j meadows-do cument-ret rieval': { }, | |
| 109 | ||
| 110 | 'r ecord-enri chment': { }, | |
| 111 | 's tore-recor d': {}, | |
| 112 | 'e vent-prior itization- request': {}, | |
| 113 | 'e vent-recor d-processo r-request' : {}, | |
| 114 | 'o perational -store-rec ord': {}, | |
| 115 | 'p ublish-dat a-change-e vent': {}, | |
| 116 | 'p atient-dat a-state-ch ecker': {} | |
| 117 | } | |
| 118 | }); | |
| 119 | ||
| 120 | var config = { | |
| 121 | vistaS ites: { | |
| 122 | '9 E7A': {}, | |
| 123 | 'C 877': {} | |
| 124 | }, | |
| 125 | // remove this if it has not c aused an i ntegration test buil d to fail | |
| 126 | // mvi : _.defaul ts(realCon fig.mvi, { | |
| 127 | // protocol: 'http', | |
| 128 | // host: '12 7.0.0.1', | |
| 129 | // port: 540 00, | |
| 130 | // path: '/m vi' | |
| 131 | // }), | |
| 132 | jds: _ .defaults( wConfig.jd s, { | |
| 133 | pr otocol: 'h ttp', | |
| 134 | host: ' IP ', | |
| 135 | port: PORT | |
| 136 | }), | |
| 137 | beanst alk: beans talkConfig | |
| 138 | }; | |
| 139 | ||
| 140 | var enviro nment = { | |
| 141 | vistaC lient: new VistaClie nt(dummyLo gger, dumm yLogger, c onfig), | |
| 142 | jobSta tusUpdater : {}, | |
| 143 | publis herRouter: {}, | |
| 144 | errorP ublisher: { | |
| 145 | pu blishPolle rError: fu nction() { } | |
| 146 | }, | |
| 147 | metric s: dummyLo gger, | |
| 148 | jds: n ew JdsClie nt(dummyLo gger, dumm yLogger, c onfig) | |
| 149 | }; | |
| 150 | environmen t.jobStatu sUpdater = new JobSt atusUpdate r(dummyLog ger, confi g, environ ment.jds); | |
| 151 | environmen t.publishe rRouter = new Publis herRouter( dummyLogge r, config, dummyLogg er, enviro nment.jobS tatusUpdat er); | |
| 152 | ||
| 153 | config.bea nstalk.job Repo = { | |
| 154 | ho st: host, | |
| 155 | po rt: port, | |
| 156 | tu bename: tu bename | |
| 157 | // }, | |
| 158 | // opt ions: { | |
| 159 | // priority: 5, | |
| 160 | // delay: 0, | |
| 161 | // ttr: 0 | |
| 162 | // }, | |
| 163 | // wor ker: { | |
| 164 | // ignoreDef aultTube: true, | |
| 165 | // timeout: 10 | |
| 166 | // }, | |
| 167 | // del ay: { | |
| 168 | // initMilli s: 1000, | |
| 169 | // maxMillis : 5000, | |
| 170 | // incMillis : 1000 | |
| 171 | // } | |
| 172 | }; | |
| 173 | ||
| 174 | var vistaI dValue = ' CCCC'; | |
| 175 | var icnVal ue = '1000 0V400000'; | |
| 176 | var patrie ntIdentifi erValue = { | |
| 177 | type: 'pid', | |
| 178 | value: 'CCCC;3' | |
| 179 | }; | |
| 180 | ||
| 181 | var vistaF ullMessage = { | |
| 182 | apiVer sion: 1.02 , | |
| 183 | params : { | |
| 184 | do main: 'PAN ORAMA.VIST ACORE.US', | |
| 185 | sy stemId: 'C CCC' | |
| 186 | }, | |
| 187 | data: { | |
| 188 | up dated: '20 1501191356 18', | |
| 189 | to talItems: 6, | |
| 190 | la stUpdate: '3150119-1 5430', | |
| 191 | wa itingPids: [], | |
| 192 | pr ocessingPi ds: [], | |
| 193 | re mainingObj ects: 0, | |
| 194 | it ems: [{ | |
| 195 | collecti on: 'OPDsy ncStart', | |
| 196 | systemId : 'CCCC', | |
| 197 | rootJobI d: '1', | |
| 198 | jobId: ' 3', | |
| 199 | metaStam p: { | |
| 200 | stam pTime: 201 4103109492 0, | |
| 201 | sour ceMetaStam p: { | |
| 202 | 'CCCC': { | |
| 203 | stampT ime: 20141 031094920, | |
| 204 | domain MetaStamp: { | |
| 205 | 'a su-class': { | |
| 206 | domain: 'asu-class ', | |
| 207 | stampTim e: 2014103 1094920, | |
| 208 | itemMeta Stamp: { | |
| 209 | 'urn :va:asu-cl ass:CCCC:1 9': { | |
| 210 | 'stampTime ': 2014103 1094920 | |
| 211 | }, | |
| 212 | 'urn :va:asu-cl ass:CCCC:3 1': { | |
| 213 | 'stampTime ': 2014103 1094920 | |
| 214 | } | |
| 215 | } | |
| 216 | } | |
| 217 | } | |
| 218 | } | |
| 219 | } | |
| 220 | } | |
| 221 | }, { | |
| 222 | collecti on: 'asu-c lass', | |
| 223 | seq: 1, | |
| 224 | total: 2 , | |
| 225 | object: { | |
| 226 | abbr eviation: 'ANES', | |
| 227 | acti ve: true, | |
| 228 | disp layName: ' Anesthesio logist', | |
| 229 | loca lId: 19, | |
| 230 | name : 'ANESTHE SIOLOGIST' , | |
| 231 | uid: 'urn:va:a su-class:C CCC:19' | |
| 232 | } | |
| 233 | }, { | |
| 234 | collecti on: 'asu-c lass', | |
| 235 | seq: 2, | |
| 236 | total: 2 , | |
| 237 | object: { | |
| 238 | abbr eviation: 'ACOS', | |
| 239 | acti ve: true, | |
| 240 | disp layName: ' Associate Chief Of S taff', | |
| 241 | loca lId: 31, | |
| 242 | name : 'ASSOCIA TE CHIEF O F STAFF', | |
| 243 | uid: 'urn:va:a su-class:C CCC:31' | |
| 244 | } | |
| 245 | }, { | |
| 246 | collecti on: 'syncS tart', | |
| 247 | pid: 'CC CC;3', | |
| 248 | systemId : 'CCCC', | |
| 249 | localId: '3', | |
| 250 | icn: icn Value, | |
| 251 | rootJobI d: '1', | |
| 252 | jobId: ' 3', | |
| 253 | metaStam p: { | |
| 254 | icn: icnValue, | |
| 255 | stam pTime: '20 1501191356 18', | |
| 256 | sour ceMetaStam p: { | |
| 257 | 'CCCC': { | |
| 258 | pid: ' CCCC;3', | |
| 259 | localI d: '3', | |
| 260 | stampT ime: '2015 0119135618 ', | |
| 261 | domain MetaStamp: { | |
| 262 | al lergy: { | |
| 263 | domain: 'allergy', | |
| 264 | stampTim e: '201501 19135618', | |
| 265 | eventMet aStamp: { | |
| 266 | 'urn :va:allerg y:CCCC:3:7 51': { | |
| 267 | stampTime: '20150119 135618' | |
| 268 | }, | |
| 269 | 'urn :va:allerg y:CCCC:3:7 52': { | |
| 270 | stampTime: '20150119 135618' | |
| 271 | } | |
| 272 | } | |
| 273 | } | |
| 274 | } | |
| 275 | } | |
| 276 | } | |
| 277 | }, | |
| 278 | seq: 1, | |
| 279 | total: 1 | |
| 280 | }, { | |
| 281 | collecti on: 'aller gy', | |
| 282 | pid: 'CC CC;3', | |
| 283 | systemId : 'CCCC', | |
| 284 | localId: '3', | |
| 285 | icn: icn Value, | |
| 286 | seq: 1, | |
| 287 | total: 2 , | |
| 288 | object: { | |
| 289 | drug Classes: [ { | |
| 290 | code: 'AM1 14', | |
| 291 | name: 'PEN ICILLINSAN DBETA-LACT AMANTIMICR OBIALS' | |
| 292 | }], | |
| 293 | ente red: 20050 3172009, | |
| 294 | faci lityCode: 500, | |
| 295 | faci lityName: 'CAMPMASTE R', | |
| 296 | hist orical: tr ue, | |
| 297 | kind : 'Allergy \/AdverseR eaction', | |
| 298 | last UpdateTime : 20050317 200936, | |
| 299 | loca lId: 751, | |
| 300 | mech anism: 'PH ARMACOLOGI C', | |
| 301 | orig inatorName : 'VEHU, E IGHT', | |
| 302 | prod ucts: [{ | |
| 303 | name: 'PEN ICILLIN', | |
| 304 | vuid: 'urn :va:vuid' | |
| 305 | }], | |
| 306 | reac tions: [{ | |
| 307 | name: 'ITC HING, WATE RINGEYES', | |
| 308 | vuid: 'urn :va:vuid' | |
| 309 | }], | |
| 310 | refe rence: '12 5;GMRD(120 .82,', | |
| 311 | stam pTime: 200 5031720093 6, | |
| 312 | summ ary: 'PENI CILLIN', | |
| 313 | type Name: 'DRU G', | |
| 314 | uid: 'urn:va:a llergy:CCC C:3:751', | |
| 315 | veri fied: 2005 0317200936 , | |
| 316 | veri fierName: '<auto-ver ified>' | |
| 317 | } | |
| 318 | }, { | |
| 319 | collecti on: 'aller gy', | |
| 320 | pid: 'CC CC;3', | |
| 321 | systemId : 'CCCC', | |
| 322 | localId: '3', | |
| 323 | icn: icn Value, | |
| 324 | seq: 1, | |
| 325 | total: 2 , | |
| 326 | object: { | |
| 327 | drug Classes: [ { | |
| 328 | code: 'AM1 14', | |
| 329 | name: 'PEN ICILLINSAN DBETA-LACT AMANTIMICR OBIALS' | |
| 330 | }], | |
| 331 | ente red: 20050 3172009, | |
| 332 | faci lityCode: 500, | |
| 333 | faci lityName: 'CAMPMASTE R', | |
| 334 | hist orical: tr ue, | |
| 335 | kind : 'Allergy \/AdverseR eaction', | |
| 336 | last UpdateTime : 20050317 200936, | |
| 337 | loca lId: 751, | |
| 338 | mech anism: 'PH ARMACOLOGI C', | |
| 339 | orig inatorName : 'VEHU, E IGHT', | |
| 340 | prod ucts: [{ | |
| 341 | name: 'PEN ICILLIN', | |
| 342 | vuid: 'urn :va:vuid' | |
| 343 | }], | |
| 344 | reac tions: [{ | |
| 345 | name: 'ITC HING, WATE RINGEYES', | |
| 346 | vuid: 'urn :va:vuid' | |
| 347 | }], | |
| 348 | refe rence: '12 5;GMRD(120 .82,', | |
| 349 | stam pTime: 200 5031720093 6, | |
| 350 | summ ary: 'PENI CILLIN', | |
| 351 | type Name: 'DRU G', | |
| 352 | uid: 'urn:va:a llergy:CCC C:3:752', | |
| 353 | veri fied: 2005 0317200936 , | |
| 354 | veri fierName: '<auto-ver ified>' | |
| 355 | } | |
| 356 | }, { | |
| 357 | collecti on: 'syncS tart', | |
| 358 | pid: 'CC CC;3', | |
| 359 | systemId : 'CCCC', | |
| 360 | localId: '3', | |
| 361 | icn: icn Value, | |
| 362 | metaStam p: { | |
| 363 | icn: icnValue, | |
| 364 | stam pTime: '20 1501191356 18', | |
| 365 | sour ceMetaStam p: { | |
| 366 | 'CCCC': { | |
| 367 | pid: ' CCCC;3', | |
| 368 | localI d: '3', | |
| 369 | stampT ime: '2015 0119135618 ', | |
| 370 | domain MetaStamp: { | |
| 371 | al lergy: { | |
| 372 | domain: 'allergy', | |
| 373 | stampTim e: '201501 19135618', | |
| 374 | eventMet aStamp: { | |
| 375 | 'urn :va:allerg y:CCCC:3:7 53': { | |
| 376 | stampTime: '20150119 135618' | |
| 377 | } | |
| 378 | } | |
| 379 | } | |
| 380 | } | |
| 381 | } | |
| 382 | } | |
| 383 | } | |
| 384 | }, { | |
| 385 | collecti on: 'aller gy', | |
| 386 | pid: 'CC CC;3', | |
| 387 | systemId : 'CCCC', | |
| 388 | localId: '3', | |
| 389 | icn: icn Value, | |
| 390 | seq: 1, | |
| 391 | total: 1 , | |
| 392 | object: { | |
| 393 | drug Classes: [ { | |
| 394 | code: 'AM1 14', | |
| 395 | name: 'PEN ICILLINSAN DBETA-LACT AMANTIMICR OBIALS' | |
| 396 | }], | |
| 397 | ente red: 20050 3172009, | |
| 398 | faci lityCode: 500, | |
| 399 | faci lityName: 'CAMPMASTE R', | |
| 400 | hist orical: tr ue, | |
| 401 | kind : 'Allergy \/AdverseR eaction', | |
| 402 | last UpdateTime : 20050317 200936, | |
| 403 | loca lId: 751, | |
| 404 | mech anism: 'PH ARMACOLOGI C', | |
| 405 | orig inatorName : 'VEHU, E IGHT', | |
| 406 | prod ucts: [{ | |
| 407 | name: 'PEN ICILLIN', | |
| 408 | vuid: 'urn :va:vuid' | |
| 409 | }], | |
| 410 | reac tions: [{ | |
| 411 | name: 'ITC HING, WATE RINGEYES', | |
| 412 | vuid: 'urn :va:vuid' | |
| 413 | }], | |
| 414 | refe rence: '12 5;GMRD(120 .82,', | |
| 415 | stam pTime: 200 5031720093 6, | |
| 416 | summ ary: 'PENI CILLIN', | |
| 417 | type Name: 'DRU G', | |
| 418 | uid: 'urn:va:a llergy:CCC C:3:753', | |
| 419 | veri fied: 2005 0317200936 , | |
| 420 | veri fierName: '<auto-ver ified>' | |
| 421 | } | |
| 422 | } ] | |
| 423 | } | |
| 424 | }; | |
| 425 | ||
| 426 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- ------ | |
| 427 | // Clear t he entries from the tube. | |
| 428 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- ------ | |
| 429 | function c learTube(l ogger, hos t, port, t ubename) { | |
| 430 | var ca lled = fal se; | |
| 431 | var ca lledError; | |
| 432 | ||
| 433 | grabJo bs(logger, host, por t, tubenam e, 0, func tion(error ) { | |
| 434 | ca lledError = error; | |
| 435 | ca lled = tru e; | |
| 436 | }); | |
| 437 | ||
| 438 | waitsF or(functio n() { | |
| 439 | re turn calle d; | |
| 440 | }, 'sh ould be ca lled', 200 00); | |
| 441 | ||
| 442 | runs(f unction() { | |
| 443 | // console.l og('clearT ube: error : %s;', ca lledError) ; | |
| 444 | ex pect(calle dError).to BeNull(); | |
| 445 | }); | |
| 446 | } | |
| 447 | ||
| 448 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- --- | |
| 449 | // Clear t he sync st atus | |
| 450 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- --- | |
| 451 | function c learTestPa tient(envi ronment) { | |
| 452 | var co mpleted = false; | |
| 453 | var ac tualError; | |
| 454 | var ac tualRespon se; | |
| 455 | ||
| 456 | runs(f unction() { | |
| 457 | en vironment. jds.delete PatientByP id(patrien tIdentifie rValue.val ue, functi on(error, response) { | |
| 458 | actualEr ror = erro r; | |
| 459 | actualRe sponse = r esponse; | |
| 460 | complete d = true; | |
| 461 | }) ; | |
| 462 | }); | |
| 463 | ||
| 464 | waitsF or(functio n() { | |
| 465 | re turn compl eted; | |
| 466 | }, 'Ti med out wa iting for jds.delete PatientByP id.', 2000 0); | |
| 467 | ||
| 468 | runs(f unction() { | |
| 469 | // console.l og('delete PatientByP id: error: %s; respo nse: %j', actualErro r, actualR esponse); | |
| 470 | ex pect(actua lError).to BeFalsy(); | |
| 471 | ex pect(actua lResponse) .toBeTruth y(); | |
| 472 | // expect(val (actualRes ponse, 'st atusCode') ).toEqual( 200); //St atus code can be 200 or 404 | |
| 473 | }); | |
| 474 | } | |
| 475 | ||
| 476 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- --- | |
| 477 | // Clear t he operati onal sync status for CCCC | |
| 478 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- --- | |
| 479 | function c learOperat ionalSyncS tatus(envi ronment) { | |
| 480 | var co mpleted = false; | |
| 481 | var ac tualError; | |
| 482 | var ac tualRespon se; | |
| 483 | ||
| 484 | runs(f unction() { | |
| 485 | en vironment. jds.delete Operationa lSyncStatu s('CCCC', function(e rror, resp onse) { | |
| 486 | actualEr ror = erro r; | |
| 487 | actualRe sponse = r esponse; | |
| 488 | complete d = true; | |
| 489 | }) ; | |
| 490 | }); | |
| 491 | ||
| 492 | waitsF or(functio n() { | |
| 493 | re turn compl eted; | |
| 494 | }, 'Ti med out wa iting for jds.delete Operationa lSyncStatu s.', 20000 ); | |
| 495 | ||
| 496 | runs(f unction() { | |
| 497 | // console.l og('delete Operationa lSyncStatu s: error: %s; respon se: %j', a ctualError , actualRe sponse); | |
| 498 | ex pect(actua lError).to BeFalsy(); | |
| 499 | ex pect(actua lResponse) .toBeTruth y(); | |
| 500 | ex pect(val(a ctualRespo nse, 'stat usCode')). toEqual(20 0); | |
| 501 | }); | |
| 502 | } | |
| 503 | ||
| 504 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- --- | |
| 505 | // Get the last upda te time fo r CCCC | |
| 506 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- --- | |
| 507 | function g etSiteLast UpdateTime (environme nt, callba ck){ | |
| 508 | var co mpleted = false; | |
| 509 | var ac tualError; | |
| 510 | var ac tualRespon se; | |
| 511 | var ac tualResult ; | |
| 512 | ||
| 513 | runs(f unction() { | |
| 514 | en vironment. jds.getOpe rationalDa taMutable( 'CCCC', fu nction(err or, respon se, result ) { | |
| 515 | actualEr ror = erro r; | |
| 516 | actualRe sponse = r esponse; | |
| 517 | actualRe sult = res ult; | |
| 518 | complete d = true; | |
| 519 | }) ; | |
| 520 | }); | |
| 521 | ||
| 522 | waitsF or(functio n() { | |
| 523 | re turn compl eted; | |
| 524 | }, 'Ti med out wa iting for jds.delete Operationa lDataMutab le.', 2000 0); | |
| 525 | ||
| 526 | runs(f unction() { | |
| 527 | ex pect(actua lError).to BeFalsy(); | |
| 528 | ex pect(actua lResponse) .toBeTruth y(); | |
| 529 | ex pect(actua lResult).t oBeTruthy( ); | |
| 530 | ex pect(val(a ctualRespo nse, 'stat usCode')). toEqual(20 0); | |
| 531 | ca llback(nul l, actualR esult); | |
| 532 | }); | |
| 533 | } | |
| 534 | ||
| 535 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- --- | |
| 536 | // Clear t he last up date time for CCCC | |
| 537 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- --- | |
| 538 | function c learTestSi teLastUpda teTime(env ironment){ | |
| 539 | var co mpleted = false; | |
| 540 | var ac tualError; | |
| 541 | var ac tualRespon se; | |
| 542 | ||
| 543 | runs(f unction() { | |
| 544 | en vironment. jds.delete Operationa lDataMutab le('CCCC', function( error, res ponse) { | |
| 545 | actualEr ror = erro r; | |
| 546 | actualRe sponse = r esponse; | |
| 547 | complete d = true; | |
| 548 | }) ; | |
| 549 | }); | |
| 550 | ||
| 551 | waitsF or(functio n() { | |
| 552 | re turn compl eted; | |
| 553 | }, 'Ti med out wa iting for jds.delete Operationa lDataMutab le.', 2000 0); | |
| 554 | ||
| 555 | runs(f unction() { | |
| 556 | ex pect(actua lError).to BeFalsy(); | |
| 557 | ex pect(actua lResponse) .toBeTruth y(); | |
| 558 | ex pect(val(a ctualRespo nse, 'stat usCode')). toEqual(20 0); | |
| 559 | }); | |
| 560 | } | |
| 561 | ||
| 562 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- - | |
| 563 | // Retriev e sync sta tus | |
| 564 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- - | |
| 565 | function r etrieveSyn cStatus(pa tientIdent ifier, env ironment, callback) { | |
| 566 | var co mpleted2 = false; | |
| 567 | var ac tualError; | |
| 568 | var ac tualRespon se; | |
| 569 | var ac tualResult ; | |
| 570 | ||
| 571 | // con sole.log(' retrieveSy ncStatus: Entering m ethod'); | |
| 572 | runs(f unction() { | |
| 573 | en vironment. jds.getSyn cStatus(pa tientIdent ifier, fun ction(erro r, respons e, result) { | |
| 574 | actualEr ror = erro r; | |
| 575 | actualRe sponse = r esponse; | |
| 576 | actualRe sult = res ult; | |
| 577 | // 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); | |
| 578 | complete d2 = true; | |
| 579 | }) ; | |
| 580 | }); | |
| 581 | ||
| 582 | waitsF or(functio n() { | |
| 583 | re turn compl eted2; | |
| 584 | }, 'Ti med out wa iting for jds.clearT estPatient .', 20000) ; | |
| 585 | ||
| 586 | runs(f unction() { | |
| 587 | // console.l og('retrie veSyncStat us: error: %s; respo nse: %j', actualErro r, actualR esponse); | |
| 588 | ex pect(actua lError).to BeNull(); | |
| 589 | ex pect(actua lResponse) .toBeTruth y(); | |
| 590 | ex pect(val(a ctualRespo nse, 'stat usCode')). toEqual(20 0); | |
| 591 | ex pect(actua lResult).t oBeTruthy( ); | |
| 592 | ca llback(nul l, actualR esult); | |
| 593 | }); | |
| 594 | } | |
| 595 | ||
| 596 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- - | |
| 597 | // Retriev e operatio nal sync s tatus | |
| 598 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- - | |
| 599 | function r etrieveOpe rationalSy ncStatus(s iteId, env ironment, callback) { | |
| 600 | var co mpleted2 = false; | |
| 601 | var ac tualError; | |
| 602 | var ac tualRespon se; | |
| 603 | var ac tualResult ; | |
| 604 | ||
| 605 | // con sole.log(' retrieveSy ncStatus: Entering m ethod'); | |
| 606 | runs(f unction() { | |
| 607 | en vironment. jds.getOpe rationalSy ncStatus(s iteId, fun ction(erro r, respons e, result) { | |
| 608 | actualEr ror = erro r; | |
| 609 | actualRe sponse = r esponse; | |
| 610 | actualRe sult = res ult; | |
| 611 | // 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); | |
| 612 | complete d2 = true; | |
| 613 | }) ; | |
| 614 | }); | |
| 615 | ||
| 616 | waitsF or(functio n() { | |
| 617 | re turn compl eted2; | |
| 618 | }, 'Ti med out wa iting for jds.clearT estPatient .', 20000) ; | |
| 619 | ||
| 620 | runs(f unction() { | |
| 621 | // console.l og('retrie veSyncStat us: error: %s; respo nse: %j', actualErro r, actualR esponse); | |
| 622 | ex pect(actua lError).to BeNull(); | |
| 623 | ex pect(actua lResponse) .toBeTruth y(); | |
| 624 | ex pect(val(a ctualRespo nse, 'stat usCode')). toEqual(20 0); | |
| 625 | ex pect(actua lResult).t oBeTruthy( ); | |
| 626 | ca llback(nul l, actualR esult); | |
| 627 | }); | |
| 628 | } | |
| 629 | ||
| 630 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- | |
| 631 | // Create patientIde ntifiers f or the pat ient we wa nt to use. | |
| 632 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- | |
| 633 | function c reatePatie ntIdentifi ers(icn, p atientIden tifier, en vironment, callback) { | |
| 634 | var jd sPatientId entificati onRequest = { | |
| 635 | pa tientIdent ifiers: [i cn, patien tIdentifie r.value] | |
| 636 | }; | |
| 637 | var co mpleted3 = false; | |
| 638 | var ac tualError; | |
| 639 | var ac tualRespon se; | |
| 640 | ||
| 641 | runs(f unction() { | |
| 642 | en vironment. jds.storeP atientIden tifier(jds PatientIde ntificatio nRequest, function(e rror, resp onse, resu lt) { | |
| 643 | actualEr ror = erro r; | |
| 644 | actualRe sponse = r esponse; | |
| 645 | 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); | |
| 646 | complete d3 = true; | |
| 647 | }) ; | |
| 648 | }); | |
| 649 | ||
| 650 | waitsF or(functio n() { | |
| 651 | re turn compl eted3; | |
| 652 | }, 'Ti med out wa iting for jds.storeP atientIden tifier.', 20000); | |
| 653 | ||
| 654 | runs(f unction() { | |
| 655 | ex pect(actua lError).to BeNull(); | |
| 656 | ex pect(actua lResponse) .toBeTruth y(); | |
| 657 | // expect(val (actualRes ponse, 'st atusCode') ).toEqual( 200); | |
| 658 | ca llback(nul l, 'succes s'); | |
| 659 | }); | |
| 660 | ||
| 661 | } | |
| 662 | ||
| 663 | function r etrieveUns olicitedUp datePoller Job(pid, d omain, sit eHash, jds Client, ca llback){ | |
| 664 | jdsCli ent.getJob Status({jp id: pid}, /*{filter: '?filter=i like(\"typ e\",\"vist a-' + site Hash + '-d ata-' + do main + '-p oller\")'} ,*/ functi on(error, response, result){ | |
| 665 | ex pect(error ).toBeFals y(); | |
| 666 | ex pect(respo nse).toBeT ruthy(); | |
| 667 | ex pect(resul t).toBeTru thy(); | |
| 668 | ||
| 669 | ca llback(err or, result ); | |
| 670 | }); | |
| 671 | } | |
| 672 | ||
| 673 | describe(' vista-reco rd-poller. js', funct ion() { | |
| 674 | ||
| 675 | before Each(funct ion() { | |
| 676 | // Clear Syn cStatus | |
| 677 | // ---------- ------- | |
| 678 | cl earTestPat ient(envir onment); | |
| 679 | cl earOperati onalSyncSt atus(envir onment); | |
| 680 | cl earTestSit eLastUpdat eTime(envi ronment); | |
| 681 | // Clear Job s | |
| 682 | // ---------- - | |
| 683 | cl earTube(du mmyLogger, host, por t, tubenam e); | |
| 684 | ||
| 685 | // Create th e patient Identifier s | |
| 686 | // ---------- ---------- ---------- -- | |
| 687 | cr eatePatien tIdentifie rs(icnValu e, patrien tIdentifie rValue, en vironment, function( error, res ponse) { | |
| 688 | expect(e rror).toBe Null(); | |
| 689 | expect(r esponse).t oBe('succe ss'); | |
| 690 | }) ; | |
| 691 | }); | |
| 692 | ||
| 693 | afterE ach(functi on() { | |
| 694 | en vironment. publisherR outer.clos e(); | |
| 695 | }); | |
| 696 | ||
| 697 | it('po ller proce ssed the m essage cor rectly - s ingle poll er mode', function() { | |
| 698 | ||
| 699 | va r complete d = false; | |
| 700 | va r actualEr ror; | |
| 701 | va r actualRe sponse; | |
| 702 | va r actualSy ncStatus; | |
| 703 | ||
| 704 | // var actual Operationa lError; | |
| 705 | // var actual Operationa lSyncStatu s; | |
| 706 | ||
| 707 | va r actualSi teLastUpda teTime; | |
| 708 | ||
| 709 | va r poller = new Polle r(dummyLog ger, vista IdValue, c onfig, env ironment); | |
| 710 | ru ns(functio n() { | |
| 711 | dummyLog ger.debug( 'it(poller processed correctly ): started the test' ); | |
| 712 | var loca lData = JS ON.parse(J SON.string ify(vistaF ullMessage .data)); | |
| 713 | poller._ processBat ch(localDa ta, functi on(error, response) { | |
| 714 | if ( error) { | |
| 715 | actualErro r = error; | |
| 716 | actualResp onse = res ponse; | |
| 717 | dummyLogge r.debug('i t(poller p rocessed c orrectly): error fro m _process Batch. er ror: %s; r esponse: % s;', actua lError, ac tualRespon se); | |
| 718 | completed = true; | |
| 719 | return; | |
| 720 | } | |
| 721 | // c onsole.log ('it(polle r processe d correctl y): Grabbi ng jobs fr om tube.') ; | |
| 722 | grab Jobs(dummy Logger, ho st, port, tubename, 0, functio n(error, j obs) { | |
| 723 | actualResp onse = job s; | |
| 724 | if (error) { | |
| 725 | actual Error = er ror; | |
| 726 | dummyL ogger.debu g('it(poll er process ed correct ly): error from grab Jobs. err or: %s; re sponse: %j ;', actual Error, act ualRespons e); | |
| 727 | comple ted=true; | |
| 728 | return ; | |
| 729 | } | |
| 730 | dummyLogge r.debug('i t(poller p rocessed c orrectly): Success G rabbing jo bs from tu be.'); | |
| 731 | completed = true; | |
| 732 | }); | |
| 733 | }); | |
| 734 | }) ; | |
| 735 | ||
| 736 | wa itsFor(fun ction() { | |
| 737 | return c ompleted; | |
| 738 | }, 'response from poll er._proces sBatch tim ed out.', 10000); | |
| 739 | ||
| 740 | // Now that we have pu blished an d retrieve d the jobs . Lets re trieve the SyncStatu s (meta st amp) | |
| 741 | // ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----- | |
| 742 | va r complete d2 = false ; | |
| 743 | ru ns(functio n() { | |
| 744 | dummyLog ger.debug( 'it(poller processed correctly ): before retrieving syncStatu s. error: %s; jobs: %j;', act ualError, actualResp onse); | |
| 745 | retrieve SyncStatus ({ | |
| 746 | type : 'pid', | |
| 747 | valu e: 'CCCC;3 ' | |
| 748 | }, envir onment, fu nction(err or, syncSt atus) { | |
| 749 | actu alError = error; | |
| 750 | actu alSyncStat us = syncS tatus; | |
| 751 | dumm yLogger.de bug('it(po ller proce ssed corre ctly): aft er retriev ing syncSt atus. err or: %s; jo bs: %j; ac tualSyncSt atus: ', a ctualError , actualRe sponse, ac tualSyncSt atus); | |
| 752 | comp leted2 = t rue; | |
| 753 | }); | |
| 754 | }) ; | |
| 755 | ||
| 756 | wa itsFor(fun ction() { | |
| 757 | return c ompleted2 /*&& compl eted3*/; | |
| 758 | }, 'response from poll er._proces sBatch tim ed out.', 10000); | |
| 759 | ||
| 760 | // Get the l ast update time for site CCCC from JDS | |
| 761 | // ---------- ---------- ---------- ---------- -------- | |
| 762 | va r complete d4 = false ; | |
| 763 | ru ns(functio n(){ | |
| 764 | getSiteL astUpdateT ime(enviro nment, fun ction(erro r, result) { | |
| 765 | actu alSiteLast UpdateTime = result; | |
| 766 | comp leted4 = t rue; | |
| 767 | }); | |
| 768 | }) ; | |
| 769 | wa itsFor(fun ction(){ | |
| 770 | return c ompleted4; | |
| 771 | }) ; | |
| 772 | ||
| 773 | // Retrieve the unsoli cited upda te poller job from J DS | |
| 774 | // ---------- ---------- ---------- ---------- ---------- -- | |
| 775 | va r complete d5 = false ; | |
| 776 | va r actualUn solicitedU pdatePolle rJobResult ; | |
| 777 | ru ns(functio n(){ | |
| 778 | retrieve Unsolicite dUpdatePol lerJob(pat rientIdent ifierValue .value, 'a llergy', v istaIdValu e, environ ment.jds, function(e rror, resu lt){ | |
| 779 | actu alUnsolici tedUpdateP ollerJobRe sult = res ult; | |
| 780 | comp leted5 = t rue; | |
| 781 | }); | |
| 782 | }) ; | |
| 783 | ||
| 784 | wa itsFor(fun ction(){ | |
| 785 | return c ompleted5; | |
| 786 | }, 'checking for unsol icited upd ate job st atus in JD S', 10000) ; | |
| 787 | ||
| 788 | ||
| 789 | ru ns(functio n() { | |
| 790 | expect(a ctualError ).toBeFals y(); | |
| 791 | // Verif y the site 's last up date time was stored | |
| 792 | //------ ---------- ---------- ---------- ---------- | |
| 793 | expect(a ctualSiteL astUpdateT ime).toBeT ruthy(); | |
| 794 | expect(v al(actualS iteLastUpd ateTime, ' _id')).toB eTruthy(); | |
| 795 | expect(v al(actualS iteLastUpd ateTime, ' lastUpdate ')).toBeTr uthy(); | |
| 796 | expect(v al(actualS iteLastUpd ateTime, ' uid')).toB eTruthy(); | |
| 797 | ||
| 798 | // Verif y that the jobs were published | |
| 799 | //------ ---------- ---------- ---------- - | |
| 800 | var jobs = _.chain (actualRes ponse).map (function( response) {return re sponse.job s}).flatte n().value( ); | |
| 801 | expect(j obs).toBeT ruthy(); | |
| 802 | expect(v al(jobs, ' length')). toEqual(1) ; | |
| 803 | ||
| 804 | var resu ltJobTypes = _.pluck (jobs, 'ty pe'); | |
| 805 | var oper ationalSto reJobs = _ .filter(re sultJobTyp es, functi on(job) { | |
| 806 | retu rn (job == = 'operati onal-store -record'); | |
| 807 | }); | |
| 808 | var prio ritization Jobs = _.f ilter(resu ltJobTypes , function (job) { | |
| 809 | retu rn (job == = 'event-p rioritizat ion-reques t'); | |
| 810 | }); | |
| 811 | var vist aRecordPro cessorJobs = _.filte r(resultJo bTypes, fu nction(job ) { | |
| 812 | retu rn (job == = 'vista-r ecord-proc essor-requ est'); | |
| 813 | }); | |
| 814 | ||
| 815 | expect(v al(resultJ obTypes, ' length')). toEqual(1) ; | |
| 816 | expect(v al(vistaRe cordProces sorJobs, ' length')). toEqual(1) ; | |
| 817 | expect(v al(operati onalStoreJ obs, 'leng th')).toEq ual(0); // R egression test - mak e sure tha t we get n o operatio nal jobs | |
| 818 | expect(v al(priorit izationJob s, 'length ')).toEqua l(0); // R egression test - mak e sure tha t we get n o prioriti zation job s | |
| 819 | ||
| 820 | ||
| 821 | // Verif y unsolici ted update job sent to JDS | |
| 822 | //------ ---------- ---------- ---------- ------ | |
| 823 | expect(_ .isEmpty(a ctualUnsol icitedUpda tePollerJo bResult)). toBe(false ); | |
| 824 | expect(a ctualUnsol icitedUpda tePollerJo bResult.it ems).toCon tain(jasmi ne.objectC ontaining( {type: 'vi sta-CCCC-d ata-allerg y-poller'} )); | |
| 825 | ||
| 826 | // Clear the syncS tatus we j ust create d. | |
| 827 | //------ ---------- ---------- ---------- --- | |
| 828 | clearTes tPatient(e nvironment ); | |
| 829 | clearOpe rationalSy ncStatus(e nvironment ); | |
| 830 | clearTes tSiteLastU pdateTime( environmen t); | |
| 831 | }) ; | |
| 832 | }); | |
| 833 | ||
| 834 | it('po ller proce ssed the m essage cor rectly - m ultiple po ller mode' , function () { | |
| 835 | ||
| 836 | va r complete d = false; | |
| 837 | va r actualEr ror; | |
| 838 | va r actualRe sponse; | |
| 839 | va r actualSy ncStatus; | |
| 840 | ||
| 841 | va r poller = new Polle r(dummyLog ger, vista IdValue, c onfig, env ironment, false, tru e); | |
| 842 | ru ns(functio n() { | |
| 843 | dummyLog ger.debug( 'it(poller processed correctly ): started the test' ); | |
| 844 | var loca lData = JS ON.parse(J SON.string ify(vistaF ullMessage .data)); | |
| 845 | localDat a.allocati onToken = '123456789 '; | |
| 846 | poller._ processBat ch(localDa ta, functi on(error, response) { | |
| 847 | if ( error) { | |
| 848 | actualErro r = error; | |
| 849 | actualResp onse = res ponse; | |
| 850 | dummyLogge r.debug('i t(poller p rocessed c orrectly): error fro m _process Batch. er ror: %s; r esponse: % s;', actua lError, ac tualRespon se); | |
| 851 | completed = true; | |
| 852 | return; | |
| 853 | } | |
| 854 | // c onsole.log ('it(polle r processe d correctl y): Grabbi ng jobs fr om tube.') ; | |
| 855 | grab Jobs(dummy Logger, ho st, port, tubename, 0, functio n(error, j obs) { | |
| 856 | actualResp onse = job s; | |
| 857 | if (error) { | |
| 858 | actual Error = er ror; | |
| 859 | dummyL ogger.debu g('it(poll er process ed correct ly): error from grab Jobs. err or: %s; re sponse: %j ;', actual Error, act ualRespons e); | |
| 860 | comple ted=true; | |
| 861 | return ; | |
| 862 | } | |
| 863 | dummyLogge r.debug('i t(poller p rocessed c orrectly): Success G rabbing jo bs from tu be.'); | |
| 864 | completed = true; | |
| 865 | }); | |
| 866 | }); | |
| 867 | }) ; | |
| 868 | ||
| 869 | wa itsFor(fun ction() { | |
| 870 | return c ompleted; | |
| 871 | }, 'response from poll er._proces sBatch tim ed out.', 10000); | |
| 872 | ||
| 873 | // Now that we have pu blished an d retrieve d the jobs . Lets re trieve the SyncStatu s (meta st amp) | |
| 874 | // ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----- | |
| 875 | va r complete d2 = false ; | |
| 876 | ru ns(functio n() { | |
| 877 | dummyLog ger.debug( 'it(poller processed correctly ): before retrieving syncStatu s. error: %s; jobs: %j;', act ualError, actualResp onse); | |
| 878 | retrieve SyncStatus ({ | |
| 879 | type : 'pid', | |
| 880 | valu e: 'CCCC;3 ' | |
| 881 | }, envir onment, fu nction(err or, syncSt atus) { | |
| 882 | actu alError = error; | |
| 883 | actu alSyncStat us = syncS tatus; | |
| 884 | dumm yLogger.de bug('it(po ller proce ssed corre ctly): aft er retriev ing syncSt atus. err or: %s; jo bs: %j; ac tualSyncSt atus: ', a ctualError , actualRe sponse, ac tualSyncSt atus); | |
| 885 | comp leted2 = t rue; | |
| 886 | }); | |
| 887 | }) ; | |
| 888 | ||
| 889 | wa itsFor(fun ction() { | |
| 890 | return c ompleted2 /*&& compl eted3*/; | |
| 891 | }, 'response from poll er._proces sBatch tim ed out.', 10000); | |
| 892 | ||
| 893 | // Retrieve the unsoli cited upda te poller job from J DS | |
| 894 | // ---------- ---------- ---------- ---------- ---------- -- | |
| 895 | va r complete d5 = false ; | |
| 896 | va r actualUn solicitedU pdatePolle rJobResult ; | |
| 897 | ru ns(functio n(){ | |
| 898 | retrieve Unsolicite dUpdatePol lerJob(pat rientIdent ifierValue .value, 'a llergy', v istaIdValu e, environ ment.jds, function(e rror, resu lt){ | |
| 899 | actu alUnsolici tedUpdateP ollerJobRe sult = res ult; | |
| 900 | comp leted5 = t rue; | |
| 901 | }); | |
| 902 | }) ; | |
| 903 | ||
| 904 | wa itsFor(fun ction(){ | |
| 905 | return c ompleted5; | |
| 906 | }, 'checking for unsol icited upd ate job st atus in JD S', 10000) ; | |
| 907 | ||
| 908 | ||
| 909 | ru ns(functio n() { | |
| 910 | expect(a ctualError ).toBeFals y(); | |
| 911 | ||
| 912 | // Verif y that the allocatio nToken was updated i n the poll er. | |
| 913 | //------ ---------- ---------- ---------- ---------- ---------- --- | |
| 914 | expect(p oller.allo cationToke n).toBe('1 23456789') ; | |
| 915 | expect(p oller.allo cationStat us).toBe(' complete') ; | |
| 916 | ||
| 917 | // Verif y that the jobs were published | |
| 918 | //------ ---------- ---------- ---------- - | |
| 919 | var jobs = _.chain (actualRes ponse).map (function( response) {return re sponse.job s;}).flatt en().value (); | |
| 920 | expect(j obs).toBeT ruthy(); | |
| 921 | expect(v al(jobs, ' length')). toEqual(1) ; | |
| 922 | ||
| 923 | var resu ltJobTypes = _.pluck (jobs, 'ty pe'); | |
| 924 | var oper ationalSto reJobs = _ .filter(re sultJobTyp es, functi on(job) { | |
| 925 | retu rn (job == = 'operati onal-store -record'); | |
| 926 | }); | |
| 927 | var prio ritization Jobs = _.f ilter(resu ltJobTypes , function (job) { | |
| 928 | retu rn (job == = 'event-p rioritizat ion-reques t'); | |
| 929 | }); | |
| 930 | var vist aRecordPro cessorJobs = _.filte r(resultJo bTypes, fu nction(job ) { | |
| 931 | retu rn (job == = 'vista-r ecord-proc essor-requ est'); | |
| 932 | }); | |
| 933 | ||
| 934 | expect(v al(resultJ obTypes, ' length')). toEqual(1) ; | |
| 935 | expect(v al(vistaRe cordProces sorJobs, ' length')). toEqual(1) ; | |
| 936 | expect(v al(operati onalStoreJ obs, 'leng th')).toEq ual(0); // R egression test - mak e sure tha t we get n o operatio nal jobs | |
| 937 | expect(v al(priorit izationJob s, 'length ')).toEqua l(0); // R egression test - mak e sure tha t we get n o prioriti zation job s | |
| 938 | ||
| 939 | ||
| 940 | // Verif y unsolici ted update job sent to JDS | |
| 941 | //------ ---------- ---------- ---------- ------ | |
| 942 | expect(_ .isEmpty(a ctualUnsol icitedUpda tePollerJo bResult)). toBe(false ); | |
| 943 | expect(a ctualUnsol icitedUpda tePollerJo bResult.it ems).toCon tain(jasmi ne.objectC ontaining( {type: 'vi sta-CCCC-d ata-allerg y-poller'} )); | |
| 944 | ||
| 945 | // Clear the syncS tatus we j ust create d. | |
| 946 | //------ ---------- ---------- ---------- --- | |
| 947 | clearTes tPatient(e nvironment ); | |
| 948 | clearOpe rationalSy ncStatus(e nvironment ); | |
| 949 | }) ; | |
| 950 | }); | |
| 951 | ||
| 952 | }); |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.