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\resync-request | resync-request-handler-itest-spec.js | Mon Jul 10 17:46:22 2017 UTC |
| 2 | ehmp.zip\ehmp\ehmp\product\production\vx-sync\tests\integrationtests\handlers\resync-request | resync-request-handler-itest-spec.js | Tue Oct 3 12:52:57 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 3 | 350 |
| Changed | 2 | 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 | require('. ./../../.. /env-setup '); | |
| 4 | ||
| 5 | var _ = re quire('und erscore'); | |
| 6 | var reques t = requir e('request '); | |
| 7 | var handle = require (global.VX _HANDLERS + 'resync- request/re sync-reque st-handler '); | |
| 8 | ||
| 9 | var testHa ndler = re quire(glob al.VX_INTT ESTS + 'fr amework/ha ndler-test -framework ').testHan dler; | |
| 10 | var jobUti l = requir e(global.V X_UTILS + 'job-utils '); | |
| 11 | var dummyL ogger = re quire(glob al.VX_DUMM IES + 'dum my-logger' ); | |
| 12 | var wConfi g = requir e(global.V X_ROOT + ' worker-con fig'); | |
| 13 | var VistaC lient = re quire(glob al.VX_SUBS YSTEMS + ' vista/vist a-client') ; | |
| 14 | var Publis herRouter = require( global.VX_ JOBFRAMEWO RK).Publis herRouter; | |
| 15 | var JobSta tusUpdater = require (global.VX _SUBSYSTEM S + 'jds/J obStatusUp dater'); | |
| 16 | ||
| 17 | var JdsCli ent = requ ire(global .VX_SUBSYS TEMS + 'jd s/jds-clie nt'); | |
| 18 | ||
| 19 | var testCo nfig = req uire(globa l.VX_INTTE STS + 'tes t-config') ; | |
| 20 | var host = testConfi g.vxsyncIP ; | |
| 21 | var hostPo rt = testC onfig.vxsy ncPort; | |
| 22 | var port = PORT ; | |
| 23 | var tubena me = 'vx-r esync-test '; | |
| 24 | ||
| 25 | function c learTestPa tient(conf ig, patien tIdentifie rValue) { | |
| 26 | var co mpleted = false; | |
| 27 | var ac tualError, actualRes ponse; | |
| 28 | ||
| 29 | runs(f unction() { | |
| 30 | va r options = { | |
| 31 | url: con fig.protoc ol + '://' + config. host + ':' + config. port + con fig.patien tUnsyncPat h, | |
| 32 | method: 'POST', | |
| 33 | qs: { | |
| 34 | pid: patientId entifierVa lue | |
| 35 | } | |
| 36 | }; | |
| 37 | ||
| 38 | re quest.post (options, function(e rror, resp onse) { | |
| 39 | actualEr ror = erro r; | |
| 40 | actualRe sponse = r esponse; | |
| 41 | complete d = true; | |
| 42 | }) ; | |
| 43 | }); | |
| 44 | ||
| 45 | waitsF or(functio n() { | |
| 46 | re turn compl eted; | |
| 47 | }, 'Ti med out wa iting for clear pati ent REST c all.', 200 00); | |
| 48 | ||
| 49 | runs(f unction() { | |
| 50 | ex pect(actua lError).to BeFalsy(); | |
| 51 | ex pect(actua lResponse) .toBeTruth y(); | |
| 52 | }); | |
| 53 | } | |
| 54 | ||
| 55 | function r etrieveSyn cStatus(pa tientIdent ifier, env ironment, callback) { | |
| 56 | var co mpleted = false; | |
| 57 | var ac tualError, actualRes ponse, act ualResult; | |
| 58 | ||
| 59 | runs(f unction() { | |
| 60 | en vironment. jds.getSyn cStatus(pa tientIdent ifier, fun ction(erro r, respons e, result) { | |
| 61 | actualEr ror = erro r; | |
| 62 | actualRe sponse = r esponse; | |
| 63 | actualRe sult = res ult; | |
| 64 | complete d = true; | |
| 65 | }) ; | |
| 66 | }); | |
| 67 | ||
| 68 | waitsF or(functio n() { | |
| 69 | re turn compl eted; | |
| 70 | }, 'Ti med out wa iting for jds.getSyn cStatus.', 20000); | |
| 71 | ||
| 72 | runs(f unction() { | |
| 73 | ex pect(actua lError).to BeNull(); | |
| 74 | ex pect(actua lResponse) .toBeTruth y(); | |
| 75 | ex pect(_.res ult(actual Response, 'statusCod e')).toEqu al(200); | |
| 76 | ca llback(nul l, actualR esponse.st atusCode); | |
| 77 | }); | |
| 78 | } | |
| 79 | describe(' resync-req uest-handl er', funct ion() { | |
| 80 | descri be('When a resync ha ndler proc esses a re sync reque st', funct ion() { | |
| 81 | va r config, environmen t; | |
| 82 | ||
| 83 | be foreEach(f unction() { | |
| 84 | config = { | |
| 85 | retr ySync: { | |
| 86 | maxRetries : 3 | |
| 87 | }, | |
| 88 | sync RequestApi : { | |
| 89 | protocol: 'http', | |
| 90 | host: host , | |
| 91 | port: host Port, | |
| 92 | patientSyn cPath: '/s ync/doLoad ', | |
| 93 | patientUns yncPath: ' /sync/clea rPatient', | |
| 94 | patientSta tusPath: ' /sync/stat us', | |
| 95 | patientDem oSyncPath: '/sync/de mographicS ync', | |
| 96 | method: 'P OST' | |
| 97 | }, | |
| 98 | vist aSites: { | |
| 99 | '9E7A': {} , | |
| 100 | 'C877': {} | |
| 101 | }, | |
| 102 | jds: _.default s(wConfig. jds, { | |
| 103 | protocol: 'http', | |
| 104 | host: ' IP ', | |
| 105 | port: 9080 | |
| 106 | }) | |
| 107 | }; | |
| 108 | ||
| 109 | environm ent = { | |
| 110 | vist aClient: n ew VistaCl ient(dummy Logger, du mmyLogger, config), | |
| 111 | jobS tatusUpdat er: {}, | |
| 112 | publ isherRoute r: {}, | |
| 113 | metr ics: dummy Logger, | |
| 114 | jds: new JdsCl ient(dummy Logger, du mmyLogger, config) | |
| 115 | }; | |
| 116 | ||
| 117 | environm ent.jobSta tusUpdater = new Job StatusUpda ter(dummyL ogger, con fig, envir onment.jds ); | |
| 118 | environm ent.publis herRouter = new Publ isherRoute r(dummyLog ger, confi g, dummyLo gger, envi ronment.jo bStatusUpd ater); | |
| 119 | ||
| 120 | clearTes tPatient(c onfig.sync RequestApi , '9E7A;1' ); | |
| 121 | }) ; | |
| 122 | ||
| 123 | af terEach(fu nction() { | |
| 124 | environm ent.publis herRouter. close(); | |
| 125 | }) ; | |
| 126 | ||
| 127 | it ('then the patient i s resynced ', functio n() { | |
| 128 | var job = { | |
| 129 | type : 'resync- request', | |
| 130 | pati entIdentif ier: { | |
| 131 | type: 'pid ', | |
| 132 | value: '9E 7A;1' | |
| 133 | }, | |
| 134 | root JobId: '1' , | |
| 135 | jobI d: '1' | |
| 136 | }; | |
| 137 | var comp leted = fa lse; | |
| 138 | var actu alError, a ctualSyncS tatus; | |
| 139 | ||
| 140 | testHand ler(handle , dummyLog ger, confi g, environ ment, host , port, tu bename + ' -first', j ob, [], nu ll, functi on(error) { | |
| 141 | actu alError = error; | |
| 142 | retr ieveSyncSt atus(job.p atientIden tifier, en vironment, function( error, syn cStatus) { | |
| 143 | actualErro r = error; | |
| 144 | actualSync Status = s yncStatus; | |
| 145 | completed = true; | |
| 146 | }); | |
| 147 | }); | |
| 148 | ||
| 149 | waitsFor (function( ) { | |
| 150 | retu rn complet ed; | |
| 151 | }, 'resp onse from resync tes t handler timed out. ', 10000); | |
| 152 | ||
| 153 | runs(fun ction() { | |
| 154 | expe ct(actualE rror).toBe Falsy(); | |
| 155 | expe ct(actualS yncStatus) .toBe(200) ; | |
| 156 | }); | |
| 157 | }) ; | |
| 158 | ||
| 159 | it ('and the sync is st ill in pro cess then a new job is put bac k on the q ueue for t he patient ', functio n() { | |
| 160 | config.s yncRequest Api.patien tStatusPat h = '/sync /invalid'; | |
| 161 | ||
| 162 | var job = { | |
| 163 | type : 'resync- request', | |
| 164 | pati entIdentif ier: { | |
| 165 | type: 'pid ', | |
| 166 | value: '9E 7A;1' | |
| 167 | }, | |
| 168 | root JobId: '2' , | |
| 169 | jobI d: '2' | |
| 170 | }; | |
| 171 | ||
| 172 | var matc hingJobTyp es = [jobU til.resync RequestTyp e()]; | |
| 173 | ||
| 174 | testHand ler(handle , dummyLog ger, confi g, environ ment, host , port, tu bename + ' -second', job, match ingJobType s); | |
| 175 | }) ; | |
| 176 | }); | |
| 177 | }); |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.