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\syncruleengine | operational-data-sync-rule-itest-spec.js | Mon Jul 10 17:46:22 2017 UTC |
| 2 | ehmp.zip\ehmp\ehmp\product\production\vx-sync\tests\integrationtests\syncruleengine | operational-data-sync-rule-itest-spec.js | Tue Oct 3 12:56:13 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 1054 |
| Changed | 1 | 4 |
| 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 | var _ = re quire('und erscore'); | |
| 4 | ||
| 5 | require('. ./../../en v-setup'); | |
| 6 | var SyncRu lesEngine = require( global.VX_ SYNCRULES + '/rules- engine'); | |
| 7 | var JdsCli ent = requ ire(global .VX_SUBSYS TEMS + 'jd s/jds-clie nt'); | |
| 8 | var val = require(gl obal.VX_UT ILS + 'obj ect-utils' ).getPrope rty; | |
| 9 | ||
| 10 | var realCo nfig = req uire(globa l.VX_ROOT + 'worker- config'); | |
| 11 | var wConfi g = JSON.p arse(JSON. stringify( realConfig )); // Mak e sure we have a cle an copy of wConfig | |
| 12 | var log = require(gl obal.VX_DU MMIES + 'd ummy-logge r'); | |
| 13 | var async = require( 'async'); | |
| 14 | var pidUti ls = requi re(global. VX_UTILS + 'patient- identifier -utils'); | |
| 15 | // log = r equire('bu nyan').cre ateLogger( { | |
| 16 | // nam e: 'operat ional-sync -endpoint- handler-sp ec', | |
| 17 | // lev el: 'debug ' | |
| 18 | // }); | |
| 19 | ||
| 20 | function c reateTestO pdStamp(si teHash, pi d, stampTi me) { | |
| 21 | var op dStamp = { | |
| 22 | 's tampTime': stampTime , | |
| 23 | 's ourceMetaS tamp': {} | |
| 24 | }; | |
| 25 | ||
| 26 | var si te = siteH ash || pid Utils.extr actSiteFro mPid(pid); | |
| 27 | ||
| 28 | opdSta mp.sourceM etaStamp[s ite] = { | |
| 29 | 's tampTime': stampTime , | |
| 30 | 'd omainMetaS tamp': {} | |
| 31 | }; | |
| 32 | ||
| 33 | if (si teHash) { | |
| 34 | op dStamp.sou rceMetaSta mp[site].d omainMetaS tamp['doc- def'] = { | |
| 35 | 'domain' : 'doc-def ', | |
| 36 | 'stampTi me': stamp Time, | |
| 37 | 'itemMet aStamp': { } | |
| 38 | }; | |
| 39 | ||
| 40 | op dStamp.sou rceMetaSta mp[site].d omainMetaS tamp['doc- def'].item MetaStamp[ 'urn:va:do c-def:' + site + ':1 001'] = { | |
| 41 | 'stampTi me': stamp Time | |
| 42 | }; | |
| 43 | } | |
| 44 | ||
| 45 | if (pi d) { | |
| 46 | va r dfn = pi dUtils.ext ractDfnFro mPid(pid); | |
| 47 | op dStamp.sou rceMetaSta mp[site].d omainMetaS tamp['pt-s elect'] = { | |
| 48 | 'domain' : 'pt-sele ct', | |
| 49 | 'stampTi me': stamp Time, | |
| 50 | 'itemMet aStamp': { } | |
| 51 | }; | |
| 52 | op dStamp.sou rceMetaSta mp[site].d omainMetaS tamp['pt-s elect'].it emMetaStam p['urn:va: pt-select: ' + site + ':' + dfn + ':' + d fn] = { | |
| 53 | 'stampTi me': stamp Time | |
| 54 | }; | |
| 55 | } | |
| 56 | ||
| 57 | return opdStamp; | |
| 58 | } | |
| 59 | ||
| 60 | function c reateStora geMetaData (site, dom ain, uid, stampTime) { | |
| 61 | return { | |
| 62 | 's ource': si te, | |
| 63 | 'u id': uid, | |
| 64 | 'd omain': do main, | |
| 65 | 'i temStamp': stampTime | |
| 66 | }; | |
| 67 | } | |
| 68 | ||
| 69 | function c reateMockP atientIds( testSitePi d1, testSi tePid2) { | |
| 70 | return [{ | |
| 71 | ty pe: 'icn', | |
| 72 | va lue: '1111 11V22222' | |
| 73 | }, { | |
| 74 | ty pe: 'pid', | |
| 75 | va lue: testS itePid1 | |
| 76 | }, { | |
| 77 | ty pe: 'pid', | |
| 78 | va lue: testS itePid2 | |
| 79 | }, { | |
| 80 | ty pe: 'pid', | |
| 81 | va lue: 'DOD; 000000180' | |
| 82 | }, { | |
| 83 | ty pe: 'pid', | |
| 84 | va lue: 'HDR; 111111V222 22' | |
| 85 | }, { | |
| 86 | ty pe: 'pid', | |
| 87 | va lue: 'VLER ;111111V22 222' | |
| 88 | }]; | |
| 89 | } | |
| 90 | ||
| 91 | var config = { | |
| 92 | vistaS ites: { | |
| 93 | 'A AAA': {}, | |
| 94 | 'B BBB': {}, | |
| 95 | 'C CCC': {}, | |
| 96 | 'D DDD': {}, | |
| 97 | 'E EEE': {}, | |
| 98 | 'F FFF': {}, | |
| 99 | 'A BBB': {}, | |
| 100 | 'B CCC': {}, | |
| 101 | 'C DDD': {}, | |
| 102 | 'D EEE': {} | |
| 103 | }, | |
| 104 | jds: _ .defaults( wConfig.jd s, { | |
| 105 | pr otocol: 'h ttp', | |
| 106 | host: ' IP ', | |
| 107 | port: PORT | |
| 108 | }), | |
| 109 | rules: { | |
| 110 | 'o perational -data-sync ': {} | |
| 111 | }, | |
| 112 | 'hdr': { | |
| 113 | 'o perationMo de': 'REQ/ RES' | |
| 114 | } | |
| 115 | }; | |
| 116 | ||
| 117 | function c learOperat ionalDataS yncStatusF orSites(si tes, callb ack) { | |
| 118 | var jd sClient = new JdsCli ent(log, l og, config ); | |
| 119 | ||
| 120 | async. eachSeries (sites, fu nction(sit e, asyncCa llback) { | |
| 121 | jd sClient.de leteOperat ionalSyncS tatus(site , function () { | |
| 122 | asyncCal lback(); | |
| 123 | }) ; | |
| 124 | }, fun ction() { | |
| 125 | ca llback(); | |
| 126 | }); | |
| 127 | } | |
| 128 | ||
| 129 | describe(' operationa l-data-syn c-rule int egration t est', func tion() { | |
| 130 | var mo ckPatientI ds = [{ | |
| 131 | ty pe: 'icn', | |
| 132 | va lue: '1111 11V22222' | |
| 133 | }, { | |
| 134 | ty pe: 'pid', | |
| 135 | va lue: 'AAAA ;3' | |
| 136 | }, { | |
| 137 | ty pe: 'pid', | |
| 138 | va lue: 'BBBB ;3' | |
| 139 | }, { | |
| 140 | ty pe: 'pid', | |
| 141 | va lue: 'DOD; 000000180' | |
| 142 | }, { | |
| 143 | ty pe: 'pid', | |
| 144 | va lue: 'HDR; 111111V222 22' | |
| 145 | }, { | |
| 146 | ty pe: 'pid', | |
| 147 | va lue: 'VLER ;111111V22 222' | |
| 148 | }]; | |
| 149 | ||
| 150 | it('No rmal path: no primar y sites as sociated w ith patien t have com pleted OPD sync', fu nction() { | |
| 151 | va r done = f alse; | |
| 152 | va r jdsClien t = new Jd sClient(lo g, log, co nfig); | |
| 153 | va r environm ent = { | |
| 154 | jds: jds Client, | |
| 155 | metrics: log | |
| 156 | }; | |
| 157 | va r mockPati entIds = [ { | |
| 158 | type: 'i cn', | |
| 159 | value: ' 111111V222 22' | |
| 160 | }, { | |
| 161 | type: 'p id', | |
| 162 | value: ' CDDD;3' | |
| 163 | }, { | |
| 164 | type: 'p id', | |
| 165 | value: ' DEEE;3' | |
| 166 | }, { | |
| 167 | type: 'p id', | |
| 168 | value: ' DOD;000000 180' | |
| 169 | }, { | |
| 170 | type: 'p id', | |
| 171 | value: ' HDR;111111 V22222' | |
| 172 | }, { | |
| 173 | type: 'p id', | |
| 174 | value: ' VLER;11111 1V22222' | |
| 175 | }] ; | |
| 176 | // No metasta mp in JDS | |
| 177 | va r engine = new SyncR ulesEngine (log, conf ig, enviro nment); | |
| 178 | // engine.ru les = [rul e]; | |
| 179 | ru ns(functio n() { | |
| 180 | engine.g etSyncPati entIdentif iers(mockP atientIds, [], funct ion(err, r esult) { | |
| 181 | //co nsole.log( result); | |
| 182 | expe ct(err).to Equal('NO_ OPDATA'); | |
| 183 | done = true; | |
| 184 | }); | |
| 185 | }) ; | |
| 186 | wa itsFor(fun ction() { | |
| 187 | return d one; | |
| 188 | }) ; | |
| 189 | }); | |
| 190 | ||
| 191 | //AAAA , BBBB | |
| 192 | it('No rmal path: some prim ary sites associated with pati ent have c ompleted O PD sync', function() { | |
| 193 | va r opdStamp AAAA = cre ateTestOpd Stamp('AAA A', 'AAAA; 3', 201410 31094920); | |
| 194 | va r opdStamp BBBB = cre ateTestOpd Stamp(null , 'BBBB;3' , 20141031 094920); | |
| 195 | va r storePtS electMetad ataBBBB = createStor ageMetaDat a('BBBB', 'pt-select ', 'urn:va :pt-select :BBBB:3:3' , 20141031 094920); | |
| 196 | ||
| 197 | va r setUpDon e, cleanUp Done; | |
| 198 | ru ns(functio n() { | |
| 199 | clearOpe rationalDa taSyncStat usForSites (['AAAA', 'BBBB'], f unction() { | |
| 200 | setU pDone = tr ue; | |
| 201 | }); | |
| 202 | }) ; | |
| 203 | wa itsFor(fun ction() { | |
| 204 | return s etUpDone; | |
| 205 | }) ; | |
| 206 | ||
| 207 | va r done1, d one2, done 3, done4 = false; | |
| 208 | va r jdsClien t = new Jd sClient(lo g, log, co nfig); | |
| 209 | va r environm ent = { | |
| 210 | jds: jds Client, | |
| 211 | metrics: log | |
| 212 | }; | |
| 213 | ||
| 214 | // Send opera tional met astamps to JDS | |
| 215 | ru ns(functio n() { | |
| 216 | environm ent.jds.sa veOperatio nalSyncSta tus(opdSta mpAAAA, 'A AAA', func tion() { | |
| 217 | done 1 = true; | |
| 218 | }); | |
| 219 | environm ent.jds.sa veOperatio nalSyncSta tus(opdSta mpBBBB, 'B BBB', func tion() { | |
| 220 | done 2 = true; | |
| 221 | }); | |
| 222 | }) ; | |
| 223 | wa itsFor(fun ction() { | |
| 224 | return d one1 && do ne2; | |
| 225 | }) ; | |
| 226 | // Mark all i tems for B BBB as sto red | |
| 227 | ru ns(functio n() { | |
| 228 | environm ent.jds._m arkOperati onalItemAs Stored(sto rePtSelect MetadataBB BB, functi on() { | |
| 229 | done 3 = true; | |
| 230 | }); | |
| 231 | }) ; | |
| 232 | wa itsFor(fun ction() { | |
| 233 | return d one3; | |
| 234 | }) ; | |
| 235 | ||
| 236 | va r engine = new SyncR ulesEngine (log, conf ig, enviro nment); | |
| 237 | // engine.ru les = [rul e]; | |
| 238 | ru ns(functio n() { | |
| 239 | engine.g etSyncPati entIdentif iers(mockP atientIds, [], funct ion(err, r esult) { | |
| 240 | //co nsole.log( result); | |
| 241 | expe ct(val(res ult, 'leng th')).toEq ual(5); | |
| 242 | done 4 = true; | |
| 243 | }); | |
| 244 | }) ; | |
| 245 | wa itsFor(fun ction() { | |
| 246 | return d one4; | |
| 247 | }) ; | |
| 248 | ||
| 249 | ru ns(functio n() { | |
| 250 | clearOpe rationalDa taSyncStat usForSites (['AAAA', 'BBBB'], f unction() { | |
| 251 | clea nUpDone = true; | |
| 252 | }); | |
| 253 | }) ; | |
| 254 | wa itsFor(fun ction() { | |
| 255 | return c leanUpDone ; | |
| 256 | }) ; | |
| 257 | }); | |
| 258 | ||
| 259 | //CCCC , DDDD | |
| 260 | it('No rmal path: all prima ry sites a ssociated with patie nt have co mpleted OP D sync', f unction() { | |
| 261 | va r setUpDon e, cleanUp Done; | |
| 262 | ru ns(functio n() { | |
| 263 | clearOpe rationalDa taSyncStat usForSites (['CCCC', 'DDDD'], f unction() { | |
| 264 | setU pDone = tr ue; | |
| 265 | }); | |
| 266 | }) ; | |
| 267 | wa itsFor(fun ction() { | |
| 268 | return s etUpDone; | |
| 269 | }) ; | |
| 270 | ||
| 271 | va r mockPati entIds = c reateMockP atientIds( 'CCCC;3', 'DDDD;3'); | |
| 272 | va r opdStamp CCCC = cre ateTestOpd Stamp('CCC C', 'CCCC; 3', 201410 31094920); | |
| 273 | va r opdStamp DDDD = cre ateTestOpd Stamp(null , 'DDDD;3' , 20141031 094920); | |
| 274 | ||
| 275 | va r storeDoc DefMetadat aCCCC = cr eateStorag eMetaData( 'CCCC', 'd oc-def', ' urn:va:doc -def:CCCC: 1001', 201 4103109492 0); | |
| 276 | va r storePtS electMetad ataCCCC = createStor ageMetaDat a('CCCC', 'pt-select ', 'urn:va :pt-select :CCCC:3:3' , 20141031 094920); | |
| 277 | va r storePtS electMetad ataDDDD = createStor ageMetaDat a('DDDD', 'pt-select ', 'urn:va :pt-select :DDDD:3:3' , 20141031 094920); | |
| 278 | ||
| 279 | va r done1, d one2, done 3, done4, done5, don e6 = false ; | |
| 280 | va r jdsClien t = new Jd sClient(lo g, log, co nfig); | |
| 281 | va r environm ent = { | |
| 282 | jds: jds Client, | |
| 283 | metrics: log | |
| 284 | }; | |
| 285 | // Send opera tional met astamps to JDS | |
| 286 | ru ns(functio n() { | |
| 287 | environm ent.jds.sa veOperatio nalSyncSta tus(opdSta mpCCCC, 'C CCC', func tion() { | |
| 288 | done 1 = true; | |
| 289 | }); | |
| 290 | environm ent.jds.sa veOperatio nalSyncSta tus(opdSta mpDDDD, 'D DDD', func tion() { | |
| 291 | done 2 = true; | |
| 292 | }); | |
| 293 | }) ; | |
| 294 | wa itsFor(fun ction() { | |
| 295 | return d one1 && do ne2; | |
| 296 | }) ; | |
| 297 | // Mark all i tems for A AAA and BB BB as stor ed | |
| 298 | ru ns(functio n() { | |
| 299 | environm ent.jds._m arkOperati onalItemAs Stored(sto reDocDefMe tadataCCCC , function (error, re sponse) { | |
| 300 | done 3 = true; | |
| 301 | }); | |
| 302 | environm ent.jds._m arkOperati onalItemAs Stored(sto rePtSelect MetadataCC CC, functi on(error, response) { | |
| 303 | done 4 = true; | |
| 304 | }); | |
| 305 | environm ent.jds._m arkOperati onalItemAs Stored(sto rePtSelect MetadataDD DD, functi on(error, response) { | |
| 306 | done 5 = true; | |
| 307 | }); | |
| 308 | }) ; | |
| 309 | wa itsFor(fun ction() { | |
| 310 | return d one3 && do ne4 && don e5; | |
| 311 | }) ; | |
| 312 | ||
| 313 | va r engine = new SyncR ulesEngine (log, conf ig, enviro nment); | |
| 314 | // engine.ru les = [rul e]; | |
| 315 | ru ns(functio n() { | |
| 316 | engine.g etSyncPati entIdentif iers(mockP atientIds, [], funct ion(err, r esult) { | |
| 317 | // c onsole.log ('mockPati entIds: %j ', mockPat ientIds); | |
| 318 | // c onsole.log ('result : %j ', result) ; | |
| 319 | expe ct(val(res ult, 'leng th')).toEq ual(6); | |
| 320 | done 6 = true; | |
| 321 | }); | |
| 322 | }) ; | |
| 323 | wa itsFor(fun ction() { | |
| 324 | return d one6; | |
| 325 | }) ; | |
| 326 | ||
| 327 | ru ns(functio n() { | |
| 328 | clearOpe rationalDa taSyncStat usForSites (['CCCC', 'DDDD'], f unction() { | |
| 329 | clea nUpDone = true; | |
| 330 | }); | |
| 331 | }) ; | |
| 332 | wa itsFor(fun ction() { | |
| 333 | return c leanUpDone ; | |
| 334 | }) ; | |
| 335 | }); | |
| 336 | ||
| 337 | //EEEE , FFFF | |
| 338 | it('No rmal path: primary s ite comple te once, b ut pt-sele ct for pat ient is no t', functi on() { | |
| 339 | va r setUpDon e, cleanUp Done; | |
| 340 | ru ns(functio n() { | |
| 341 | clearOpe rationalDa taSyncStat usForSites (['EEEE', 'FFFF'], f unction() { | |
| 342 | setU pDone = tr ue; | |
| 343 | }); | |
| 344 | }) ; | |
| 345 | wa itsFor(fun ction() { | |
| 346 | return s etUpDone; | |
| 347 | }) ; | |
| 348 | ||
| 349 | va r mockPati entIds = c reateMockP atientIds( 'EEEE;3', 'FFFF;3'); | |
| 350 | va r opdStamp EEEE = cre ateTestOpd Stamp('EEE E', 'EEEE; 3', 201410 31094920); | |
| 351 | va r opdStamp FFFF = cre ateTestOpd Stamp(null , 'FFFF;3' , 20141031 094920); | |
| 352 | ||
| 353 | va r storeDoc DefMetadat aEEEE = cr eateStorag eMetaData( 'EEEE', 'd oc-def', ' urn:va:doc -def:EEEE: 1001', 201 4103109492 0); | |
| 354 | va r storePtS electMetad ataEEEE = createStor ageMetaDat a('EEEE', 'pt-select ', 'urn:va :pt-select :EEEE:3:3' , 20141031 094920); | |
| 355 | va r storePtS electMetad ataFFFF = createStor ageMetaDat a('FFFF', 'pt-select ', 'urn:va :pt-select :FFFF:3:3' , 20141031 094920); | |
| 356 | ||
| 357 | va r opdStamp EEEEnewSta mpTime = c reateTestO pdStamp(nu ll, 'EEEE; 3', 201510 31094920); | |
| 358 | ||
| 359 | va r done1, d one2, done 3, done4, done5, don e6, done7 = false; | |
| 360 | va r jdsClien t = new Jd sClient(lo g, log, co nfig); | |
| 361 | va r environm ent = { | |
| 362 | jds: jds Client, | |
| 363 | metrics: log | |
| 364 | }; | |
| 365 | ||
| 366 | // Send opera tional met astamps to JDS | |
| 367 | ru ns(functio n() { | |
| 368 | environm ent.jds.sa veOperatio nalSyncSta tus(opdSta mpEEEE, 'E EEE', func tion() { | |
| 369 | done 1 = true; | |
| 370 | }); | |
| 371 | environm ent.jds.sa veOperatio nalSyncSta tus(opdSta mpFFFF, 'F FFF', func tion() { | |
| 372 | done 2 = true; | |
| 373 | }); | |
| 374 | }) ; | |
| 375 | wa itsFor(fun ction() { | |
| 376 | return d one1 && do ne2; | |
| 377 | }) ; | |
| 378 | ||
| 379 | // Mark all i tems for A AAA and BB BB as stor ed | |
| 380 | ru ns(functio n() { | |
| 381 | environm ent.jds._m arkOperati onalItemAs Stored(sto reDocDefMe tadataEEEE , function (error, re sponse) { | |
| 382 | done 3 = true; | |
| 383 | }); | |
| 384 | environm ent.jds._m arkOperati onalItemAs Stored(sto rePtSelect MetadataEE EE, functi on(error, response) { | |
| 385 | done 4 = true; | |
| 386 | }); | |
| 387 | environm ent.jds._m arkOperati onalItemAs Stored(sto rePtSelect MetadataFF FF, functi on(error, response) { | |
| 388 | done 5 = true; | |
| 389 | }); | |
| 390 | }) ; | |
| 391 | wa itsFor(fun ction() { | |
| 392 | return d one3 && do ne4 && don e5; | |
| 393 | }) ; | |
| 394 | ||
| 395 | // Store new operationa l data met astamp to JDS to sim ulate pt-s elect upda te | |
| 396 | ru ns(functio n() { | |
| 397 | environm ent.jds.sa veOperatio nalSyncSta tus(opdSta mpEEEEnewS tampTime, 'EEEE', fu nction() { | |
| 398 | done 6 = true; | |
| 399 | }); | |
| 400 | }) ; | |
| 401 | wa itsFor(fun ction() { | |
| 402 | return d one6; | |
| 403 | }) ; | |
| 404 | va r engine = new SyncR ulesEngine (log, conf ig, enviro nment); | |
| 405 | // engine.ru les = [rul e]; | |
| 406 | ru ns(functio n() { | |
| 407 | engine.g etSyncPati entIdentif iers(mockP atientIds, [], funct ion(err, r esult) { | |
| 408 | // c onsole.log ('mockPati entIds: %j ', mockPat ientIds); | |
| 409 | // c onsole.log ('result : %j ', result) ; | |
| 410 | expe ct(val(res ult, 'leng th')).toEq ual(5); | |
| 411 | done 7 = true; | |
| 412 | }); | |
| 413 | }) ; | |
| 414 | wa itsFor(fun ction() { | |
| 415 | return d one7; | |
| 416 | }) ; | |
| 417 | ||
| 418 | ru ns(functio n() { | |
| 419 | clearOpe rationalDa taSyncStat usForSites (['EEEE', 'FFFF'], f unction() { | |
| 420 | clea nUpDone = true; | |
| 421 | }); | |
| 422 | }) ; | |
| 423 | wa itsFor(fun ction() { | |
| 424 | return c leanUpDone ; | |
| 425 | }) ; | |
| 426 | }); | |
| 427 | ||
| 428 | //ABBB , BCCC | |
| 429 | it('No rmal path: primary s ite comple te once, b ut pt-sele ct for dif ferent pat ient is no t', functi on() { | |
| 430 | va r setUpDon e, cleanUp Done; | |
| 431 | ru ns(functio n() { | |
| 432 | clearOpe rationalDa taSyncStat usForSites (['ABBB', 'BCCC'], f unction() { | |
| 433 | setU pDone = tr ue; | |
| 434 | }); | |
| 435 | }) ; | |
| 436 | wa itsFor(fun ction() { | |
| 437 | return s etUpDone; | |
| 438 | }) ; | |
| 439 | ||
| 440 | va r mockPati entIds = c reateMockP atientIds( 'ABBB;3', 'BCCC;3'); | |
| 441 | ||
| 442 | va r opdStamp ABBB = cre ateTestOpd Stamp('ABB B', 'ABBB; 3', 201410 31094920); | |
| 443 | va r opdStamp ABBBnewPat ient = cre ateTestOpd Stamp(null , 'ABBB;4' , 20151031 094920); | |
| 444 | va r opdStamp BCCC = cre ateTestOpd Stamp(null , 'BCCC;3' , 20141031 094920); | |
| 445 | ||
| 446 | va r storeDoc DefMetadat aABBB = cr eateStorag eMetaData( 'ABBB', 'd oc-def', ' urn:va:doc -def:ABBB: 1001', 201 4103109492 0); | |
| 447 | va r storePtS electMetad ataABBB = createStor ageMetaDat a('ABBB', 'pt-select ', 'urn:va :pt-select :ABBB:3:3' , 20141031 094920); | |
| 448 | va r storePtS electMetad ataBCCC = createStor ageMetaDat a('BCCC', 'pt-select ', 'urn:va :pt-select :BCCC:3:3' , 20141031 094920); | |
| 449 | ||
| 450 | va r done1, d one2, done 3, done4, done5, don e6 = false ; | |
| 451 | va r jdsClien t = new Jd sClient(lo g, log, co nfig); | |
| 452 | va r environm ent = { | |
| 453 | jds: jds Client, | |
| 454 | metrics: log | |
| 455 | }; | |
| 456 | ||
| 457 | // Send opera tional met astamps to JDS | |
| 458 | ru ns(functio n() { | |
| 459 | environm ent.jds.sa veOperatio nalSyncSta tus(opdSta mpABBB, 'A BBB', func tion() { | |
| 460 | done 1 = true; | |
| 461 | }); | |
| 462 | environm ent.jds.sa veOperatio nalSyncSta tus(opdSta mpBCCC, 'B CCC', func tion() { | |
| 463 | done 2 = true; | |
| 464 | }); | |
| 465 | }) ; | |
| 466 | wa itsFor(fun ction() { | |
| 467 | return d one1 && do ne2; | |
| 468 | }) ; | |
| 469 | ||
| 470 | // Mark all i tems for A AAA and BB BB as stor ed | |
| 471 | ru ns(functio n() { | |
| 472 | environm ent.jds._m arkOperati onalItemAs Stored(sto reDocDefMe tadataABBB , function (error, re sponse) { | |
| 473 | expe ct(error). toBeFalsy( ); | |
| 474 | done 3 = true; | |
| 475 | }); | |
| 476 | environm ent.jds._m arkOperati onalItemAs Stored(sto rePtSelect MetadataAB BB, functi on(error, response) { | |
| 477 | expe ct(error). toBeFalsy( ); | |
| 478 | done 4 = true; | |
| 479 | }); | |
| 480 | environm ent.jds._m arkOperati onalItemAs Stored(sto rePtSelect MetadataBC CC, functi on(error, response) { | |
| 481 | expe ct(error). toBeFalsy( ); | |
| 482 | done 5 = true; | |
| 483 | }); | |
| 484 | }) ; | |
| 485 | wa itsFor(fun ction() { | |
| 486 | return d one3 && do ne4 && don e5; | |
| 487 | }) ; | |
| 488 | ||
| 489 | va r storeNew ABBBoperat ionalMetas tampDone = false; | |
| 490 | ||
| 491 | ru ns(functio n() { | |
| 492 | //Store new operat ional data metastamp to JDS to simulate pt-select update | |
| 493 | //Must r etrieve sy nc status now to sig nal syncCo mpleteAsOf Flag | |
| 494 | environm ent.jds.ge tOperation alSyncStat us('ABBB', function( error, res ponse) { | |
| 495 | expe ct(error). toBeFalsy( ); | |
| 496 | envi ronment.jd s.saveOper ationalSyn cStatus(op dStampABBB newPatient , 'ABBB', function(e rror, resp onse) { | |
| 497 | expect(err or).toBeFa lsy(); | |
| 498 | storeNewAB BBoperatio nalMetasta mpDone = t rue; | |
| 499 | }); | |
| 500 | }); | |
| 501 | }) ; | |
| 502 | wa itsFor(fun ction() { | |
| 503 | return s toreNewABB Boperation alMetastam pDone; | |
| 504 | }) ; | |
| 505 | ||
| 506 | ||
| 507 | va r engine = new SyncR ulesEngine (log, conf ig, enviro nment); | |
| 508 | // engine.ru les = [rul e]; | |
| 509 | ru ns(functio n() { | |
| 510 | engine.g etSyncPati entIdentif iers(mockP atientIds, [], funct ion(err, r esult) { | |
| 511 | expe ct(err).to BeFalsy(); | |
| 512 | expe ct(val(res ult, 'leng th')).toEq ual(6); | |
| 513 | done 6 = true; | |
| 514 | }); | |
| 515 | }) ; | |
| 516 | wa itsFor(fun ction() { | |
| 517 | return d one6; | |
| 518 | }) ; | |
| 519 | ||
| 520 | ru ns(functio n() { | |
| 521 | clearOpe rationalDa taSyncStat usForSites (['ABBB', 'BCCC'], f unction() { | |
| 522 | clea nUpDone = true; | |
| 523 | }); | |
| 524 | }) ; | |
| 525 | wa itsFor(fun ction() { | |
| 526 | return c leanUpDone ; | |
| 527 | }) ; | |
| 528 | }); | |
| 529 | }); |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.