Produced by Araxis Merge on 10/3/2017 11:16:03 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\unittests\handlers\solr-record-storage | solr-record-storage-handler-spec.js | Mon Jul 10 17:46:22 2017 UTC |
| 2 | ehmp.zip\ehmp\ehmp\product\production\vx-sync\tests\unittests\handlers\solr-record-storage | solr-record-storage-handler-spec.js | Tue Oct 3 13:21:12 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 4 | 1662 |
| Changed | 3 | 10 |
| 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 | require('. ./../../.. /env-setup '); | |
| 4 | ||
| 5 | var handle = require (global.VX _HANDLERS + 'solr-re cord-stora ge/solr-re cord-stora ge-handler '); | |
| 6 | var trackS olrStorage = require (global.VX _HANDLERS + 'solr-re cord-stora ge/solr-re cord-stora ge-handler ').trackSo lrStorage; | |
| 7 | var writeb ackWrapper = require (global.VX _HANDLERS + 'solr-re cord-stora ge/solr-re cord-stora ge-handler ').writeba ckWrapper; | |
| 8 | var JdsCli entDummy = require(g lobal.VX_D UMMIES + ' jds-client -dummy'); | |
| 9 | var val = require(gl obal.VX_UT ILS + 'obj ect-utils' ).getPrope rty; | |
| 10 | ||
| 11 | ||
| 12 | var log = require(gl obal.VX_DU MMIES + 'd ummy-logge r'); | |
| 13 | //-------- ---------- ---------- ---------- ---------- ---------- ---- | |
| 14 | // Uncomme nt the fol lowing to see the lo gging out on the scr een. | |
| 15 | //-------- ---------- ---------- ---------- ---------- ---------- ---- | |
| 16 | // var log Util = req uire(globa l.VX_UTILS + 'log'); | |
| 17 | // log = l ogUtil._cr eateLogger ({ | |
| 18 | // name: 'test', | |
| 19 | // level: 'debug', | |
| 20 | // child: logUtil._ createLogg er | |
| 21 | // }); | |
| 22 | //-------- ---------- ---------- ---------- ---- | |
| 23 | // End of logging st uff to com ment out.. .. | |
| 24 | //-------- ---------- ---------- ---------- ---- | |
| 25 | // log = r equire('bu nyan').cre ateLogger( { | |
| 26 | // nam e: 'solr-r ecord-stor age-handle r-spec', | |
| 27 | // lev el: 'debug ' | |
| 28 | // }); | |
| 29 | ||
| 30 | // var env ironment = {}; | |
| 31 | // environ ment.publi sherRouter = { | |
| 32 | // 'pu blish': ja smine.crea teSpy().an dCallFake( function(j ob, callba ck) { | |
| 33 | // callback( null, [1]) ; | |
| 34 | // }) | |
| 35 | // }; | |
| 36 | // environ ment.metri cs = log; | |
| 37 | // environ ment.solr = { | |
| 38 | // 'ad d': jasmin e.createSp y().andCal lFake(func tion(doc, callback) { | |
| 39 | // callback( null); | |
| 40 | // }) | |
| 41 | // }; | |
| 42 | ||
| 43 | ||
| 44 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- | |
| 45 | // Create the config object th at is need ed for tes ting. | |
| 46 | // | |
| 47 | // returns config: T he config object. | |
| 48 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- | |
| 49 | function c reateConfi g() { | |
| 50 | var co nfig = { | |
| 51 | 't rackSolrSt orage': tr ue, | |
| 52 | 'v ista': { | |
| 53 | 'domains NoSolrTrac king': [ ' patient', 'treatment ' ] | |
| 54 | }, | |
| 55 | 's olrStorage Rules': { | |
| 56 | 'jds-dom ains': {}, | |
| 57 | 'store-t o-solr-att ribute': { }, | |
| 58 | 'ehmp-ac tivity-dat a': {} | |
| 59 | } | |
| 60 | }; | |
| 61 | return config; | |
| 62 | } | |
| 63 | ||
| 64 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- | |
| 65 | // Create the enviro nment vari able neede d for the tests. | |
| 66 | // | |
| 67 | // config: The confi guration s ettings to be used. | |
| 68 | // solrErr orResponse : The valu e to retur n as the S OLR error response i f the meth od solr.ad d | |
| 69 | // method c alled. | |
| 70 | // returns : The fill ed out env ironment v ariable. | |
| 71 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- | |
| 72 | function c reateEnvir onment(con fig, solrE rrorRespon se) { | |
| 73 | var en vironment = { | |
| 74 | jd s: new Jds ClientDumm y(log, con fig), | |
| 75 | me trics: log , | |
| 76 | // publisher Router: { | |
| 77 | // 'publ ish': jasm ine.create Spy().andC allFake(fu nction(job , callback ) { | |
| 78 | // c allback(nu ll, [1]); | |
| 79 | // }) | |
| 80 | // }, | |
| 81 | // solr: { | |
| 82 | // 'add' : jasmine. createSpy( ).andCallF ake(functi on(doc, ca llback) { | |
| 83 | // c allback(nu ll); | |
| 84 | // }) | |
| 85 | // } | |
| 86 | so lr: { | |
| 87 | 'add': f unction(so lrDoc, cal lback) { | |
| 88 | call back(solrE rrorRespon se); | |
| 89 | } | |
| 90 | } | |
| 91 | }; | |
| 92 | ||
| 93 | spyOn( environmen t.jds, 'ge tSimpleSyn cStatus'). andCallThr ough(); | |
| 94 | spyOn( environmen t.jds, 'se tEventStor eStatus'). andCallThr ough(); | |
| 95 | spyOn( environmen t.solr, 'a dd').andCa llThrough( ); | |
| 96 | ||
| 97 | return environme nt; | |
| 98 | } | |
| 99 | ||
| 100 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ------- | |
| 101 | // This fu nction ret urns a suc cesful res ponse from JDS if it has store d Solr sta tus for an event | |
| 102 | // to JDS. | |
| 103 | // | |
| 104 | // returns : A "succe ss" respon se that wo uld occur if JDS had successfu lly stored status to SOLR. | |
| 105 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ------- | |
| 106 | function c reateJdsSu ccessSetEv entStoreSt atusRespon se() { | |
| 107 | var re sponse = { | |
| 108 | 's tatusCode' : 201, | |
| 109 | 'h eaders': { | |
| 110 | 'date': 'Tue, 11 O ct 2016 16 :36:18 GMT ', | |
| 111 | 'location' : 'http:// IP /vpr/9E7A; 33333/urn: va:allergy :9E7A:3:10 01', | |
| 112 | 'content -type': 'a pplication /json', | |
| 113 | 'access- control-al low-origin ': '*', | |
| 114 | 'content -length': '0' | |
| 115 | }, | |
| 116 | 'r equest': { | |
| 117 | 'uri': { | |
| 118 | 'pro tocol': 'h ttp:', | |
| 119 | 'sla shes': tru e, | |
| 120 | 'aut h': null, | |
| 121 | 'host': ' IP ', | |
| 122 | 'port': ' PORT ', | |
| 123 | 'hostname' : ' IP ', | |
| 124 | 'has h': null, | |
| 125 | 'sea rch': null , | |
| 126 | 'que ry': null, | |
| 127 | 'pat hname': '/ status/9E7 A;33333/st ore', | |
| 128 | 'pat h': '/stat us/9E7A;33 333/store' , | |
| 129 | 'href': 'h ttp:// IP /status/9E 7A;33333/s tore' | |
| 130 | }, | |
| 131 | 'method' : 'POST', | |
| 132 | 'headers ': { | |
| 133 | 'acc ept': 'app lication/j son', | |
| 134 | 'con tent-type' : 'applica tion/json' , | |
| 135 | 'con tent-lengt h': 78 | |
| 136 | } | |
| 137 | } | |
| 138 | }; | |
| 139 | ||
| 140 | return response; | |
| 141 | } | |
| 142 | ||
| 143 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ------- | |
| 144 | // This fu nction ret urns a val id allergy event. | |
| 145 | // | |
| 146 | // returns : A valid allergy ev ent. | |
| 147 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ------- | |
| 148 | function c reateAller gyEvent() { | |
| 149 | var al lergyEvent = { | |
| 150 | 'd rugClasses ': [{ | |
| 151 | 'code': 'AM114', | |
| 152 | 'name': 'PENICILLI NS AND BET A-LACTAM A NTIMICROBI ALS', | |
| 153 | 'summary ': 'Allerg yDrugClass {uid=\'\'} ' | |
| 154 | }] , | |
| 155 | 'e ntered': ' 2005031720 0900', | |
| 156 | 'f acilityCod e': '500', | |
| 157 | 'f acilityNam e': 'CAMP MASTER', | |
| 158 | 'h istorical' : true, | |
| 159 | 'k ind': 'All ergy/Adver se Reactio n', | |
| 160 | 'l astUpdateT ime': '200 5031720093 6', | |
| 161 | 'l ocalId': ' 751', | |
| 162 | 'm echanism': 'PHARMACO LOGIC', | |
| 163 | 'o riginatorN ame': 'VEH U,EIGHT', | |
| 164 | 'p id': '9E7A ;3', | |
| 165 | 'p roducts': [{ | |
| 166 | 'name': 'PENICILLI N', | |
| 167 | 'summary ': 'Allerg yProduct{u id=\'\'}', | |
| 168 | 'vuid': 'urn:va:vu id:' | |
| 169 | }] , | |
| 170 | 'r eactions': [{ | |
| 171 | 'name': 'ITCHING,W ATERING EY ES', | |
| 172 | 'summary ': 'Allerg yReaction{ uid=\'\'}' , | |
| 173 | 'vuid': 'urn:va:vu id:' | |
| 174 | }] , | |
| 175 | 'r eference': '125;GMRD (120.82,', | |
| 176 | 's tampTime': '20050317 200936', | |
| 177 | 's ummary': ' PENICILLIN ', | |
| 178 | 't ypeName': 'DRUG', | |
| 179 | 'u id': 'urn: va:allergy :9E7A:3:75 1', | |
| 180 | 'v erified': '200503172 00936', | |
| 181 | 'v erifierNam e': '<auto -verified> ' | |
| 182 | }; | |
| 183 | ||
| 184 | return allergyEv ent; | |
| 185 | } | |
| 186 | ||
| 187 | ||
| 188 | describe(' solr-recor d-storage- handler.js ', functio n() { | |
| 189 | descri be('store Method', f unction() { | |
| 190 | it ('Test pat ient domai n - make s ure it tra cks storag e - but do es not act ually stor e to SOLR. ', functio n() { | |
| 191 | var conf ig = creat eConfig(); | |
| 192 | var data Domain = ' patient'; | |
| 193 | var envi ronment = createEnvi ronment(co nfig, null ); | |
| 194 | var reco rd = { | |
| 195 | 'fam ilyName': 'EIGHT', | |
| 196 | 'giv enNames': 'PATIENT', | |
| 197 | 'uid ': 'urn:va :patient:9 E7A:3:3', | |
| 198 | 'sta mpTime': ' 2007121715 1354', | |
| 199 | 'pid ': '9E7A;3 ' | |
| 200 | }; | |
| 201 | var jdsR esponse = createJdsS uccessSetE ventStoreS tatusRespo nse(); | |
| 202 | environm ent.jds._s etResponse Data([null ], [jdsRes ponse], [u ndefined]) ; | |
| 203 | ||
| 204 | var fini shed; | |
| 205 | runs(fun ction() { | |
| 206 | writ ebackWrapp er(log, co nfig, envi ronment, d ataDomain, record, f unction(er ror, respo nse) { | |
| 207 | expect(err or).toBeFa lsy(); | |
| 208 | expect(res ponse).toB e('success '); | |
| 209 | expect(env ironment.j ds.setEven tStoreStat us).not.to HaveBeenCa lled(); | |
| 210 | expect(env ironment.s olr.add).n ot.toHaveB eenCalled( ); | |
| 211 | finished = true; | |
| 212 | }); | |
| 213 | ||
| 214 | }); | |
| 215 | ||
| 216 | waitsFor (function( ) { | |
| 217 | retu rn finishe d; | |
| 218 | }); | |
| 219 | }) ; | |
| 220 | ||
| 221 | it ('Test tre atment dom ain - make sure it t racks stor age - but does not a ctually st ore to SOL R.', funct ion() { | |
| 222 | var conf ig = creat eConfig(); | |
| 223 | var data Domain = ' treatment' ; | |
| 224 | var envi ronment = createEnvi ronment(co nfig, null ); | |
| 225 | var reco rd = { | |
| 226 | 'uid ': 'urn:va :treatment :9E7A:3:12 275', | |
| 227 | 'sta mpTime': ' 2007121715 1354', | |
| 228 | 'pid ': '9E7A;3 ' | |
| 229 | }; | |
| 230 | var jdsR esponse = createJdsS uccessSetE ventStoreS tatusRespo nse(); | |
| 231 | environm ent.jds._s etResponse Data([null ], [jdsRes ponse], [u ndefined]) ; | |
| 232 | ||
| 233 | var fini shed; | |
| 234 | runs(fun ction() { | |
| 235 | writ ebackWrapp er(log, co nfig, envi ronment, d ataDomain, record, f unction(er ror, respo nse) { | |
| 236 | expect(err or).toBeFa lsy(); | |
| 237 | expect(res ponse).toB e('success '); | |
| 238 | expect(env ironment.j ds.setEven tStoreStat us).not.to HaveBeenCa lled(); | |
| 239 | expect(env ironment.s olr.add).n ot.toHaveB eenCalled( ); | |
| 240 | finished = true; | |
| 241 | }); | |
| 242 | ||
| 243 | }); | |
| 244 | ||
| 245 | waitsFor (function( ) { | |
| 246 | retu rn finishe d; | |
| 247 | }); | |
| 248 | }) ; | |
| 249 | ||
| 250 | it ('Test all ergy domai n - make s ure it sto res to sol r and also tracks st orage.', f unction() { | |
| 251 | var conf ig = creat eConfig(); | |
| 252 | var data Domain = ' allergy'; | |
| 253 | var solr Response = null; // Success response | |
| 254 | var envi ronment = createEnvi ronment(co nfig, solr Response); | |
| 255 | var reco rd = creat eAllergyEv ent(); | |
| 256 | var jdsR esponse = createJdsS uccessSetE ventStoreS tatusRespo nse(); | |
| 257 | environm ent.jds._s etResponse Data([null ], [jdsRes ponse], [u ndefined]) ; | |
| 258 | ||
| 259 | var fini shed; | |
| 260 | runs(fun ction() { | |
| 261 | writ ebackWrapp er(log, co nfig, envi ronment, d ataDomain, record, f unction(er ror, respo nse) { | |
| 262 | expect(err or).toBeFa lsy(); | |
| 263 | expect(res ponse).toB e('success '); | |
| 264 | expect(env ironment.j ds.setEven tStoreStat us).toHave BeenCalled (); | |
| 265 | expect(env ironment.s olr.add).t oHaveBeenC alled(); | |
| 266 | finished = true; | |
| 267 | }); | |
| 268 | ||
| 269 | }); | |
| 270 | ||
| 271 | waitsFor (function( ) { | |
| 272 | retu rn finishe d; | |
| 273 | }); | |
| 274 | }) ; | |
| 275 | ||
| 276 | it ('Test all ergy domai n - Simula te Solr er ror - make sure it b ehaves cor rectly.', function() { | |
| 277 | var conf ig = creat eConfig(); | |
| 278 | var data Domain = ' allergy'; | |
| 279 | var solr Response = 'An error occurred. '; // S uccess res ponse | |
| 280 | var envi ronment = createEnvi ronment(co nfig, solr Response); | |
| 281 | var reco rd = creat eAllergyEv ent(); | |
| 282 | var jdsR esponse = createJdsS uccessSetE ventStoreS tatusRespo nse(); | |
| 283 | environm ent.jds._s etResponse Data([null ], [jdsRes ponse], [u ndefined]) ; | |
| 284 | ||
| 285 | var fini shed; | |
| 286 | runs(fun ction() { | |
| 287 | writ ebackWrapp er(log, co nfig, envi ronment, d ataDomain, record, f unction(er ror, respo nse) { | |
| 288 | expect(err or).toBeTr uthy(); | |
| 289 | expect(val (error, 't ype')).toB e('transie nt-excepti on'); | |
| 290 | expect(res ponse).toB eUndefined (); | |
| 291 | expect(env ironment.j ds.setEven tStoreStat us).not.to HaveBeenCa lled(); | |
| 292 | expect(env ironment.s olr.add).t oHaveBeenC alled(); | |
| 293 | finished = true; | |
| 294 | }); | |
| 295 | ||
| 296 | }); | |
| 297 | ||
| 298 | waitsFor (function( ) { | |
| 299 | retu rn finishe d; | |
| 300 | }); | |
| 301 | }) ; | |
| 302 | ||
| 303 | it ('Test all ergy domai n - Simula te situati on where S olr Xform fails to t ransform t he record. ', functio n() { | |
| 304 | var conf ig = creat eConfig(); | |
| 305 | var data Domain = ' allergy'; | |
| 306 | var solr Response = 'An error occurred. '; // S uccess res ponse | |
| 307 | var envi ronment = createEnvi ronment(co nfig, solr Response); | |
| 308 | environm ent.solrXf orm = func tion (reco rd, log, c onfig, cal lback) { | |
| 309 | retu rn callbac k(null); | |
| 310 | }; | |
| 311 | var reco rd = creat eAllergyEv ent(); | |
| 312 | var jdsR esponse = createJdsS uccessSetE ventStoreS tatusRespo nse(); | |
| 313 | environm ent.jds._s etResponse Data([null ], [jdsRes ponse], [u ndefined]) ; | |
| 314 | ||
| 315 | var fini shed; | |
| 316 | runs(fun ction() { | |
| 317 | writ ebackWrapp er(log, co nfig, envi ronment, d ataDomain, record, f unction(er ror, respo nse) { | |
| 318 | expect(err or).toBeTr uthy(); | |
| 319 | expect(val (error, 't ype')).toB e('transie nt-excepti on'); | |
| 320 | expect(res ponse).toB eUndefined (); | |
| 321 | expect(env ironment.j ds.setEven tStoreStat us).not.to HaveBeenCa lled(); | |
| 322 | expect(env ironment.s olr.add).n ot.toHaveB eenCalled( ); | |
| 323 | finished = true; | |
| 324 | }); | |
| 325 | ||
| 326 | }); | |
| 327 | ||
| 328 | waitsFor (function( ) { | |
| 329 | retu rn finishe d; | |
| 330 | }); | |
| 331 | }) ; | |
| 332 | ||
| 333 | it ('Test all ergy domai n - Simula te situati on where S olr Xform returns an error', f unction() { | |
| 334 | var conf ig = creat eConfig(); | |
| 335 | var data Domain = ' allergy'; | |
| 336 | var solr Response = 'An error occurred. '; // S uccess res ponse | |
| 337 | var envi ronment = createEnvi ronment(co nfig, solr Response); | |
| 338 | environm ent.solrXf orm = func tion (reco rd, log, c onfig, cal lback) { | |
| 339 | retu rn callbac k('error!' ); | |
| 340 | }; | |
| 341 | var reco rd = creat eAllergyEv ent(); | |
| 342 | var jdsR esponse = createJdsS uccessSetE ventStoreS tatusRespo nse(); | |
| 343 | environm ent.jds._s etResponse Data([null ], [jdsRes ponse], [u ndefined]) ; | |
| 344 | ||
| 345 | var fini shed; | |
| 346 | runs(fun ction() { | |
| 347 | writ ebackWrapp er(log, co nfig, envi ronment, d ataDomain, record, f unction(er ror, respo nse) { | |
| 348 | expect(err or).toBeTr uthy(); | |
| 349 | expect(val (error, 't ype')).toB e('transie nt-excepti on'); | |
| 350 | expect(res ponse).toB eUndefined (); | |
| 351 | expect(env ironment.j ds.setEven tStoreStat us).not.to HaveBeenCa lled(); | |
| 352 | expect(env ironment.s olr.add).n ot.toHaveB eenCalled( ); | |
| 353 | finished = true; | |
| 354 | }); | |
| 355 | ||
| 356 | }); | |
| 357 | ||
| 358 | waitsFor (function( ) { | |
| 359 | retu rn finishe d; | |
| 360 | }); | |
| 361 | }) ; | |
| 362 | ||
| 363 | it ('Test ehm p activity that shou ld not be transforme d', functi on() { | |
| 364 | var conf ig = creat eConfig(); | |
| 365 | var data Domain = ' ehmp-activ ity'; | |
| 366 | var solr Response = null; | |
| 367 | var envi ronment = createEnvi ronment(co nfig, solr Response); | |
| 368 | var reco rd = {doma in: 'ehmp- activity', subDomain : 'medicat ion'}; | |
| 369 | var jdsR esponse = createJdsS uccessSetE ventStoreS tatusRespo nse(); | |
| 370 | environm ent.jds._s etResponse Data([null ], [jdsRes ponse], [u ndefined]) ; | |
| 371 | ||
| 372 | var fini shed; | |
| 373 | runs(fun ction() { | |
| 374 | writ ebackWrapp er(log, co nfig, envi ronment, d ataDomain, record, f unction(er ror, respo nse) { | |
| 375 | expect(err or).toBeNu ll(); | |
| 376 | expect(res ponse).toB e('success '); | |
| 377 | expect(env ironment.j ds.setEven tStoreStat us).not.to HaveBeenCa lled(); | |
| 378 | expect(env ironment.s olr.add).n ot.toHaveB eenCalled( ); | |
| 379 | finished = true; | |
| 380 | }); | |
| 381 | ||
| 382 | }); | |
| 383 | ||
| 384 | waitsFor (function( ) { | |
| 385 | retu rn finishe d; | |
| 386 | }); | |
| 387 | }) ; | |
| 388 | }); | |
| 389 | ||
| 390 | descri be('trackS olrStorage Method', function() { | |
| 391 | it ('Test whe re trackSo lrStorage is turned off.', fun ction() { | |
| 392 | var conf ig = creat eConfig(); | |
| 393 | config.t rackSolrSt orage = fa lse; | |
| 394 | var envi ronment = createEnvi ronment(co nfig, null ); | |
| 395 | var reco rd = {}; | |
| 396 | ||
| 397 | var fini shed; | |
| 398 | runs(fun ction() { | |
| 399 | trac kSolrStora ge(log, co nfig, envi ronment, r ecord, fun ction(erro r, respons e) { | |
| 400 | expect(err or).toBeFa lsy(); | |
| 401 | expect(res ponse).toB e('success '); | |
| 402 | expect(env ironment.j ds.setEven tStoreStat us).not.to HaveBeenCa lled(); | |
| 403 | finished = true; | |
| 404 | }); | |
| 405 | ||
| 406 | }); | |
| 407 | ||
| 408 | waitsFor (function( ) { | |
| 409 | retu rn finishe d; | |
| 410 | }); | |
| 411 | }) ; | |
| 412 | ||
| 413 | it ('Test tra ckSolrStor age failur e: Invalid parameter - record is null.', function( ) { | |
| 414 | var conf ig = creat eConfig(); | |
| 415 | var envi ronment = createEnvi ronment(co nfig, null ); | |
| 416 | var reco rd = null; | |
| 417 | ||
| 418 | var fini shed; | |
| 419 | runs(fun ction() { | |
| 420 | trac kSolrStora ge(log, co nfig, envi ronment, r ecord, fun ction(erro r, respons e) { | |
| 421 | expect(err or).toBeTr uthy(); | |
| 422 | expect(val (error, 't ype')).toB e('fatal-e xception') ; | |
| 423 | expect(env ironment.j ds.setEven tStoreStat us).not.to HaveBeenCa lled(); | |
| 424 | expect(res ponse).toB eUndefined (); | |
| 425 | finished = true; | |
| 426 | }); | |
| 427 | ||
| 428 | }); | |
| 429 | ||
| 430 | waitsFor (function( ) { | |
| 431 | retu rn finishe d; | |
| 432 | }); | |
| 433 | }) ; | |
| 434 | ||
| 435 | it ('Test tra ckSolrStor age failur e: Invalid parameter - record is undefin ed.', func tion() { | |
| 436 | var conf ig = creat eConfig(); | |
| 437 | var envi ronment = createEnvi ronment(co nfig, null ); | |
| 438 | var reco rd; | |
| 439 | ||
| 440 | var fini shed; | |
| 441 | runs(fun ction() { | |
| 442 | trac kSolrStora ge(log, co nfig, envi ronment, r ecord, fun ction(erro r, respons e) { | |
| 443 | expect(err or).toBeTr uthy(); | |
| 444 | expect(val (error, 't ype')).toB e('fatal-e xception') ; | |
| 445 | expect(env ironment.j ds.setEven tStoreStat us).not.to HaveBeenCa lled(); | |
| 446 | expect(res ponse).toB eUndefined (); | |
| 447 | finished = true; | |
| 448 | }); | |
| 449 | ||
| 450 | }); | |
| 451 | ||
| 452 | waitsFor (function( ) { | |
| 453 | retu rn finishe d; | |
| 454 | }); | |
| 455 | }) ; | |
| 456 | ||
| 457 | it ('Test tra ckSolrStor age failur e: Invalid parameter - record is empty o bject.', f unction() { | |
| 458 | var conf ig = creat eConfig(); | |
| 459 | var envi ronment = createEnvi ronment(co nfig, null ); | |
| 460 | var reco rd = {}; | |
| 461 | ||
| 462 | var fini shed; | |
| 463 | runs(fun ction() { | |
| 464 | trac kSolrStora ge(log, co nfig, envi ronment, r ecord, fun ction(erro r, respons e) { | |
| 465 | expect(err or).toBeTr uthy(); | |
| 466 | expect(val (error, 't ype')).toB e('fatal-e xception') ; | |
| 467 | expect(env ironment.j ds.setEven tStoreStat us).not.to HaveBeenCa lled(); | |
| 468 | expect(res ponse).toB eUndefined (); | |
| 469 | finished = true; | |
| 470 | }); | |
| 471 | ||
| 472 | }); | |
| 473 | ||
| 474 | waitsFor (function( ) { | |
| 475 | retu rn finishe d; | |
| 476 | }); | |
| 477 | }) ; | |
| 478 | ||
| 479 | it ('Test tra ckSolrStor age failur e: Invalid parameter - record. uid is und efined.', function() { | |
| 480 | var conf ig = creat eConfig(); | |
| 481 | var envi ronment = createEnvi ronment(co nfig, null ); | |
| 482 | var reco rd = { | |
| 483 | 'kin d': 'Aller gy/Adverse Reaction' | |
| 484 | }; | |
| 485 | ||
| 486 | var fini shed; | |
| 487 | runs(fun ction() { | |
| 488 | trac kSolrStora ge(log, co nfig, envi ronment, r ecord, fun ction(erro r, respons e) { | |
| 489 | expect(err or).toBeTr uthy(); | |
| 490 | expect(val (error, 't ype')).toB e('fatal-e xception') ; | |
| 491 | expect(env ironment.j ds.setEven tStoreStat us).not.to HaveBeenCa lled(); | |
| 492 | expect(res ponse).toB eUndefined (); | |
| 493 | finished = true; | |
| 494 | }); | |
| 495 | ||
| 496 | }); | |
| 497 | ||
| 498 | waitsFor (function( ) { | |
| 499 | retu rn finishe d; | |
| 500 | }); | |
| 501 | }) ; | |
| 502 | ||
| 503 | it ('Test tra ckSolrStor age failur e: Invalid parameter - record. uid is nul l.', funct ion() { | |
| 504 | var conf ig = creat eConfig(); | |
| 505 | var envi ronment = createEnvi ronment(co nfig, null ); | |
| 506 | var reco rd = { | |
| 507 | 'kin d': 'Aller gy/Adverse Reaction' , | |
| 508 | 'uid ': null | |
| 509 | }; | |
| 510 | ||
| 511 | var fini shed; | |
| 512 | runs(fun ction() { | |
| 513 | trac kSolrStora ge(log, co nfig, envi ronment, r ecord, fun ction(erro r, respons e) { | |
| 514 | expect(err or).toBeTr uthy(); | |
| 515 | expect(val (error, 't ype')).toB e('fatal-e xception') ; | |
| 516 | expect(env ironment.j ds.setEven tStoreStat us).not.to HaveBeenCa lled(); | |
| 517 | expect(res ponse).toB eUndefined (); | |
| 518 | finished = true; | |
| 519 | }); | |
| 520 | ||
| 521 | }); | |
| 522 | ||
| 523 | waitsFor (function( ) { | |
| 524 | retu rn finishe d; | |
| 525 | }); | |
| 526 | }) ; | |
| 527 | ||
| 528 | it ('Test tra ckSolrStor age failur e: Invalid parameter - record. uid is an empty stri ng.', func tion() { | |
| 529 | var conf ig = creat eConfig(); | |
| 530 | var envi ronment = createEnvi ronment(co nfig, null ); | |
| 531 | var reco rd = { | |
| 532 | 'kin d': 'Aller gy/Adverse Reaction' , | |
| 533 | 'uid ': '' | |
| 534 | }; | |
| 535 | ||
| 536 | var fini shed; | |
| 537 | runs(fun ction() { | |
| 538 | trac kSolrStora ge(log, co nfig, envi ronment, r ecord, fun ction(erro r, respons e) { | |
| 539 | expect(err or).toBeTr uthy(); | |
| 540 | expect(val (error, 't ype')).toB e('fatal-e xception') ; | |
| 541 | expect(env ironment.j ds.setEven tStoreStat us).not.to HaveBeenCa lled(); | |
| 542 | expect(res ponse).toB eUndefined (); | |
| 543 | finished = true; | |
| 544 | }); | |
| 545 | ||
| 546 | }); | |
| 547 | ||
| 548 | waitsFor (function( ) { | |
| 549 | retu rn finishe d; | |
| 550 | }); | |
| 551 | }) ; | |
| 552 | ||
| 553 | it ('Test tra ckSolrStor age failur e: Invalid parameter - record. stampTime is undefin ed.', func tion() { | |
| 554 | var conf ig = creat eConfig(); | |
| 555 | var envi ronment = createEnvi ronment(co nfig, null ); | |
| 556 | var reco rd = { | |
| 557 | 'kin d': 'Aller gy/Adverse Reaction' , | |
| 558 | 'uid ': 'urn:va :allergy:9 E7A:3:751' | |
| 559 | }; | |
| 560 | ||
| 561 | var fini shed; | |
| 562 | runs(fun ction() { | |
| 563 | trac kSolrStora ge(log, co nfig, envi ronment, r ecord, fun ction(erro r, respons e) { | |
| 564 | expect(err or).toBeTr uthy(); | |
| 565 | expect(val (error, 't ype')).toB e('fatal-e xception') ; | |
| 566 | expect(env ironment.j ds.setEven tStoreStat us).not.to HaveBeenCa lled(); | |
| 567 | expect(res ponse).toB eUndefined (); | |
| 568 | finished = true; | |
| 569 | }); | |
| 570 | ||
| 571 | }); | |
| 572 | ||
| 573 | waitsFor (function( ) { | |
| 574 | retu rn finishe d; | |
| 575 | }); | |
| 576 | }) ; | |
| 577 | ||
| 578 | it ('Test tra ckSolrStor age failur e: Invalid parameter - record. stampTime is null.', function( ) { | |
| 579 | var conf ig = creat eConfig(); | |
| 580 | var envi ronment = createEnvi ronment(co nfig, null ); | |
| 581 | var reco rd = { | |
| 582 | 'kin d': 'Aller gy/Adverse Reaction' , | |
| 583 | 'uid ': 'urn:va :allergy:9 E7A:3:751' , | |
| 584 | 'sta mpTime': n ull | |
| 585 | }; | |
| 586 | ||
| 587 | var fini shed; | |
| 588 | runs(fun ction() { | |
| 589 | trac kSolrStora ge(log, co nfig, envi ronment, r ecord, fun ction(erro r, respons e) { | |
| 590 | expect(err or).toBeTr uthy(); | |
| 591 | expect(val (error, 't ype')).toB e('fatal-e xception') ; | |
| 592 | expect(env ironment.j ds.setEven tStoreStat us).not.to HaveBeenCa lled(); | |
| 593 | expect(res ponse).toB eUndefined (); | |
| 594 | finished = true; | |
| 595 | }); | |
| 596 | ||
| 597 | }); | |
| 598 | ||
| 599 | waitsFor (function( ) { | |
| 600 | retu rn finishe d; | |
| 601 | }); | |
| 602 | }) ; | |
| 603 | ||
| 604 | it ('Test tra ckSolrStor age failur e: Invalid parameter - record. stampTime is an empt y string.' , function () { | |
| 605 | var conf ig = creat eConfig(); | |
| 606 | var envi ronment = createEnvi ronment(co nfig, null ); | |
| 607 | var reco rd = { | |
| 608 | 'kin d': 'Aller gy/Adverse Reaction' , | |
| 609 | 'uid ': 'urn:va :allergy:9 E7A:3:751' , | |
| 610 | 'sta mpTime': ' ' | |
| 611 | }; | |
| 612 | ||
| 613 | var fini shed; | |
| 614 | runs(fun ction() { | |
| 615 | trac kSolrStora ge(log, co nfig, envi ronment, r ecord, fun ction(erro r, respons e) { | |
| 616 | expect(err or).toBeTr uthy(); | |
| 617 | expect(val (error, 't ype')).toB e('fatal-e xception') ; | |
| 618 | expect(env ironment.j ds.setEven tStoreStat us).not.to HaveBeenCa lled(); | |
| 619 | expect(res ponse).toB eUndefined (); | |
| 620 | finished = true; | |
| 621 | }); | |
| 622 | ||
| 623 | }); | |
| 624 | ||
| 625 | waitsFor (function( ) { | |
| 626 | retu rn finishe d; | |
| 627 | }); | |
| 628 | }) ; | |
| 629 | ||
| 630 | it ('Test tra ckSolrStor age failur e: Invalid parameter - record. pid is und efined.', function() { | |
| 631 | var conf ig = creat eConfig(); | |
| 632 | var envi ronment = createEnvi ronment(co nfig, null ); | |
| 633 | var reco rd = { | |
| 634 | 'kin d': 'Aller gy/Adverse Reaction' , | |
| 635 | 'uid ': 'urn:va :allergy:9 E7A:3:751' , | |
| 636 | 'sta mpTime': ' 2007121715 1354' | |
| 637 | }; | |
| 638 | ||
| 639 | var fini shed; | |
| 640 | runs(fun ction() { | |
| 641 | trac kSolrStora ge(log, co nfig, envi ronment, r ecord, fun ction(erro r, respons e) { | |
| 642 | expect(err or).toBeTr uthy(); | |
| 643 | expect(val (error, 't ype')).toB e('fatal-e xception') ; | |
| 644 | expect(env ironment.j ds.setEven tStoreStat us).not.to HaveBeenCa lled(); | |
| 645 | expect(res ponse).toB eUndefined (); | |
| 646 | finished = true; | |
| 647 | }); | |
| 648 | ||
| 649 | }); | |
| 650 | ||
| 651 | waitsFor (function( ) { | |
| 652 | retu rn finishe d; | |
| 653 | }); | |
| 654 | }) ; | |
| 655 | ||
| 656 | it ('Test tra ckSolrStor age failur e: Invalid parameter - record. pid is nul l.', funct ion() { | |
| 657 | var conf ig = creat eConfig(); | |
| 658 | var envi ronment = createEnvi ronment(co nfig, null ); | |
| 659 | var reco rd = { | |
| 660 | 'kin d': 'Aller gy/Adverse Reaction' , | |
| 661 | 'uid ': 'urn:va :allergy:9 E7A:3:751' , | |
| 662 | 'sta mpTime': ' 2007121715 1354', | |
| 663 | 'pid ': null | |
| 664 | }; | |
| 665 | ||
| 666 | var fini shed; | |
| 667 | runs(fun ction() { | |
| 668 | trac kSolrStora ge(log, co nfig, envi ronment, r ecord, fun ction(erro r, respons e) { | |
| 669 | expect(err or).toBeTr uthy(); | |
| 670 | expect(val (error, 't ype')).toB e('fatal-e xception') ; | |
| 671 | expect(env ironment.j ds.setEven tStoreStat us).not.to HaveBeenCa lled(); | |
| 672 | expect(res ponse).toB eUndefined (); | |
| 673 | finished = true; | |
| 674 | }); | |
| 675 | ||
| 676 | }); | |
| 677 | ||
| 678 | waitsFor (function( ) { | |
| 679 | retu rn finishe d; | |
| 680 | }); | |
| 681 | }) ; | |
| 682 | ||
| 683 | it ('Test tra ckSolrStor age failur e: Invalid parameter - record. pid is an empty stri ng.', func tion() { | |
| 684 | var conf ig = creat eConfig(); | |
| 685 | var envi ronment = createEnvi ronment(co nfig, null ); | |
| 686 | var reco rd = { | |
| 687 | 'kin d': 'Aller gy/Adverse Reaction' , | |
| 688 | 'uid ': 'urn:va :allergy:9 E7A:3:751' , | |
| 689 | 'sta mpTime': ' 2007121715 1354', | |
| 690 | 'pid ': '' | |
| 691 | }; | |
| 692 | ||
| 693 | var fini shed; | |
| 694 | runs(fun ction() { | |
| 695 | trac kSolrStora ge(log, co nfig, envi ronment, r ecord, fun ction(erro r, respons e) { | |
| 696 | expect(err or).toBeTr uthy(); | |
| 697 | expect(val (error, 't ype')).toB e('fatal-e xception') ; | |
| 698 | expect(env ironment.j ds.setEven tStoreStat us).not.to HaveBeenCa lled(); | |
| 699 | expect(res ponse).toB eUndefined (); | |
| 700 | finished = true; | |
| 701 | }); | |
| 702 | ||
| 703 | }); | |
| 704 | ||
| 705 | waitsFor (function( ) { | |
| 706 | retu rn finishe d; | |
| 707 | }); | |
| 708 | }) ; | |
| 709 | ||
| 710 | it ('Test tra ckSolrStor age failur e: Error r esponse fr om JDS whe n attempti ng to call setEventS toreStatus ', functio n() { | |
| 711 | var conf ig = creat eConfig(); | |
| 712 | var envi ronment = createEnvi ronment(co nfig, null ); | |
| 713 | var reco rd = { | |
| 714 | 'kin d': 'Aller gy/Adverse Reaction' , | |
| 715 | 'uid ': 'urn:va :allergy:9 E7A:3:751' , | |
| 716 | 'sta mpTime': ' 2007121715 1354', | |
| 717 | 'pid ': '9E7A;3 3333' | |
| 718 | }; | |
| 719 | environm ent.jds._s etResponse Data(['Fai led to sto re record. '], [undef ined], [un defined]); | |
| 720 | ||
| 721 | var fini shed; | |
| 722 | runs(fun ction() { | |
| 723 | trac kSolrStora ge(log, co nfig, envi ronment, r ecord, fun ction(erro r, respons e) { | |
| 724 | expect(err or).toBeTr uthy(); | |
| 725 | expect(val (error, 't ype')).toB e('transie nt-excepti on'); | |
| 726 | expect(env ironment.j ds.setEven tStoreStat us).toHave BeenCalled (); | |
| 727 | expect(res ponse).toB eUndefined (); | |
| 728 | finished = true; | |
| 729 | }); | |
| 730 | ||
| 731 | }); | |
| 732 | ||
| 733 | waitsFor (function( ) { | |
| 734 | retu rn finishe d; | |
| 735 | }); | |
| 736 | }) ; | |
| 737 | ||
| 738 | it ('Test tra ckSolrStor age failur e: Error r esponse fr om JDS whe n attempti ng to call setEventS toreStatus ', functio n() { | |
| 739 | var conf ig = creat eConfig(); | |
| 740 | var envi ronment = createEnvi ronment(co nfig, null ); | |
| 741 | var reco rd = { | |
| 742 | 'kin d': 'Aller gy/Adverse Reaction' , | |
| 743 | 'uid ': 'urn:va :allergy:9 E7A:3:751' , | |
| 744 | 'sta mpTime': ' 2007121715 1354', | |
| 745 | 'pid ': '9E7A;3 3333' | |
| 746 | }; | |
| 747 | var jdsR esponse = createJdsS uccessSetE ventStoreS tatusRespo nse(); | |
| 748 | jdsRespo nse.status Code = 400 ; | |
| 749 | environm ent.jds._s etResponse Data([null ], [jdsRes ponse], [u ndefined]) ; | |
| 750 | ||
| 751 | var fini shed; | |
| 752 | runs(fun ction() { | |
| 753 | trac kSolrStora ge(log, co nfig, envi ronment, r ecord, fun ction(erro r, respons e) { | |
| 754 | expect(err or).toBeTr uthy(); | |
| 755 | expect(val (error, 't ype')).toB e('transie nt-excepti on'); | |
| 756 | expect(env ironment.j ds.setEven tStoreStat us).toHave BeenCalled (); | |
| 757 | expect(res ponse).toB eUndefined (); | |
| 758 | finished = true; | |
| 759 | }); | |
| 760 | ||
| 761 | }); | |
| 762 | ||
| 763 | waitsFor (function( ) { | |
| 764 | retu rn finishe d; | |
| 765 | }); | |
| 766 | }) ; | |
| 767 | ||
| 768 | it ('Test tra ckSolrStor age failur e: Success ful respon se from JD S when att empting to call setE ventStoreS tatus', fu nction() { | |
| 769 | var conf ig = creat eConfig(); | |
| 770 | var envi ronment = createEnvi ronment(co nfig, null ); | |
| 771 | var reco rd = { | |
| 772 | 'kin d': 'Aller gy/Adverse Reaction' , | |
| 773 | 'uid ': 'urn:va :allergy:9 E7A:3:751' , | |
| 774 | 'sta mpTime': ' 2007121715 1354', | |
| 775 | 'pid ': '9E7A;3 3333' | |
| 776 | }; | |
| 777 | ||
| 778 | var jdsR esponse = createJdsS uccessSetE ventStoreS tatusRespo nse(); | |
| 779 | environm ent.jds._s etResponse Data([null ], [jdsRes ponse], [u ndefined]) ; | |
| 780 | ||
| 781 | var fini shed; | |
| 782 | runs(fun ction() { | |
| 783 | trac kSolrStora ge(log, co nfig, envi ronment, r ecord, fun ction(erro r, respons e) { | |
| 784 | expect(err or).toBeNu ll(); | |
| 785 | expect(res ponse).toB eTruthy(); | |
| 786 | expect(res ponse).toB e('success '); | |
| 787 | expect(env ironment.j ds.setEven tStoreStat us).toHave BeenCalled (); | |
| 788 | finished = true; | |
| 789 | }); | |
| 790 | ||
| 791 | }); | |
| 792 | ||
| 793 | waitsFor (function( ) { | |
| 794 | retu rn finishe d; | |
| 795 | }); | |
| 796 | }) ; | |
| 797 | }); | |
| 798 | ||
| 799 | descri be('handle ()', funct ion() { | |
| 800 | it ('handles a solr-rec ord-storag e job', fu nction() { | |
| 801 | var conf ig = creat eConfig(); | |
| 802 | var envi ronment = createEnvi ronment(co nfig, null ); | |
| 803 | ||
| 804 | var pati entIdentif ier = { | |
| 805 | 'typ e': 'pid', | |
| 806 | 'val ue': '9E7A ;3' | |
| 807 | }; | |
| 808 | var alle rgyRecord = createAl lergyEvent (); | |
| 809 | var stor ageJob = { | |
| 810 | 'pat ientIdenti fier': pat ientIdenti fier, | |
| 811 | 'rec ord': alle rgyRecord, | |
| 812 | 'jpi d': '21EC2 020-3AEA-4 069-A2DD-0 8002B30309 D', | |
| 813 | 'dat aDomain': 'allergy', | |
| 814 | 'typ e': 'solr- record-sto rage' | |
| 815 | }; | |
| 816 | ||
| 817 | var jdsR esponse = createJdsS uccessSetE ventStoreS tatusRespo nse(); | |
| 818 | environm ent.jds._s etResponse Data([null ], [jdsRes ponse], [u ndefined]) ; | |
| 819 | ||
| 820 | var fini shed = fal se; | |
| 821 | runs(fun ction() { | |
| 822 | hand le(log, co nfig, envi ronment, s torageJob, function( error, res ponse) { | |
| 823 | expect(err or).toBeFa lsy(); | |
| 824 | expect(res ponse).toB e('success '); | |
| 825 | expect(env ironment.j ds.setEven tStoreStat us).toHave BeenCalled (); | |
| 826 | expect(env ironment.s olr.add).t oHaveBeenC alled(); | |
| 827 | finished = true; | |
| 828 | }, f unction() {}); | |
| 829 | }); | |
| 830 | ||
| 831 | waitsFor (function( ) { | |
| 832 | retu rn finishe d; | |
| 833 | }); | |
| 834 | }) ; | |
| 835 | }); | |
| 836 | }); |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.