Produced by Araxis Merge on 10/3/2017 11:16:04 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\subsystems\vista | vista-subscribe-spec.js | Mon Jul 10 17:46:22 2017 UTC |
| 2 | ehmp.zip\ehmp\ehmp\product\production\vx-sync\tests\unittests\subsystems\vista | vista-subscribe-spec.js | Tue Oct 3 13:22:48 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 3 | 998 |
| Changed | 2 | 16 |
| 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 te sts the vi sta-subscr ibe.js mod ule. | |
| 5 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- - | |
| 6 | require('. ./../../.. /env-setup '); | |
| 7 | var _ = re quire('und erscore'); | |
| 8 | var VistaC lient = re quire(glob al.VX_SUBS YSTEMS + ' vista/vist a-client') ; | |
| 9 | var dummyL ogger = re quire(glob al.VX_DUMM IES + 'dum my-logger' ); | |
| 10 | var dummyR pcClient = require(g lobal.VX_D UMMIES + ' /dummy-Rpc Client').R pcClient; | |
| 11 | var idUtil = require (global.VX _UTILS + ' patient-id entifier-u tils'); | |
| 12 | ||
| 13 | var hmpSer ver = 'The HmpServer' ; | |
| 14 | ||
| 15 | var config = { | |
| 16 | 'vista Sites': { | |
| 17 | '9 E7A': { | |
| 18 | 'name': 'panorama' , | |
| 19 | 'host': ' IP ', | |
| 20 | 'port': PORT , | |
| 21 | 'accessCod e': ' REDACT ', | |
| 22 | 'verifyCod e': ' REDACTED ', | |
| 23 | 'localIP ': '127.0. 0.1', | |
| 24 | 'localAd dress': 'l ocalhost', | |
| 25 | 'connect Timeout': 3000, | |
| 26 | 'sendTim eout': 100 00 | |
| 27 | }, | |
| 28 | 'C 877': { | |
| 29 | 'name': 'kodak', | |
| 30 | 'host': ' IP ', | |
| 31 | 'port': PORT , | |
| 32 | 'accessCod e': ' REDACT ', | |
| 33 | 'verifyCod e': ' REDACTED ', | |
| 34 | 'localIP ': '127.0. 0.1', | |
| 35 | 'localAd dress': 'l ocalhost', | |
| 36 | 'connect Timeout': 3000, | |
| 37 | 'sendTim eout': 100 00 | |
| 38 | } | |
| 39 | }, | |
| 40 | 'hmp.s erver.id': hmpServer , | |
| 41 | 'hmp.v ersion': ' 0.7-S65', | |
| 42 | 'hmp.b atch.size' : '1000', | |
| 43 | 'hmp.e xtract.sch ema': '3.0 01' | |
| 44 | }; | |
| 45 | ||
| 46 | describe(' vista-subs cribe.js', function( ) { | |
| 47 | descri be('_creat eRpcConfig VprContext ()', funct ion() { | |
| 48 | it ('Verify c ontext was added cor rectly', f unction() { | |
| 49 | var site Config = c onfig.vist aSites; | |
| 50 | var rpcC onfig = Vi staClient. _createRpc ConfigVprC ontext(sit eConfig, ' C877'); | |
| 51 | // consol e.log("rpc Config: %j ", rpcConf ig); | |
| 52 | expect(r pcConfig). toBeTruthy (); | |
| 53 | expect(r pcConfig.n ame).toEqu al('kodak' ); | |
| 54 | expect(r pcConfig.c ontext).to Equal('HMP SYNCHRONI ZATION CON TEXT'); | |
| 55 | }) ; | |
| 56 | }); | |
| 57 | ||
| 58 | descri be('fetchA ppointment ()', funct ion () { | |
| 59 | it ('Happy Pa th', funct ion () { | |
| 60 | var hand ler = new VistaClien t(dummyLog ger, dummy Logger, co nfig, dumm yRpcClient ); | |
| 61 | var site = 'C877'; | |
| 62 | var dumm yrpc = han dler._getR pcClient(s ite); | |
| 63 | spyOn(du mmyrpc, 'e xecute').a ndCallThro ugh(); | |
| 64 | var expe ctedError; | |
| 65 | var expe ctedRespon se; | |
| 66 | var call ed = false ; | |
| 67 | handler. fetchAppoi ntment(sit e, functio n (error, response) { | |
| 68 | expe ctedError = error; | |
| 69 | expe ctedRespon se = respo nse; | |
| 70 | call ed = true; | |
| 71 | }); | |
| 72 | ||
| 73 | waitsFor (function () { | |
| 74 | retu rn called; | |
| 75 | }, 'Call to fetchA ppointment failed to return in time.', 5 00); | |
| 76 | ||
| 77 | runs(fun ction () { | |
| 78 | expe ct(expecte dError).to BeNull(); | |
| 79 | //ex pect(expec tedRespons e).toEqual ('success' ); | |
| 80 | expe ct(dummyrp c.execute. calls.leng th).toEqua l(1); | |
| 81 | expe ct(dummyrp c.execute) .toHaveBee nCalledWit h('HMP PAT IENT ACTIV ITY', jasm ine.any(Ob ject), jas mine.any(F unction)); | |
| 82 | }); | |
| 83 | }) ; | |
| 84 | }); | |
| 85 | ||
| 86 | descri be('subscr ibe()', fu nction () { | |
| 87 | it ('Happy Pa th', funct ion () { | |
| 88 | var hand ler = new VistaClien t(dummyLog ger, dummy Logger, co nfig, dumm yRpcClient ); | |
| 89 | var site = 'C877'; | |
| 90 | var dumm yrpc = han dler._getR pcClient(s ite); | |
| 91 | spyOn(du mmyrpc, 'e xecute').a ndCallThro ugh(); | |
| 92 | var dfn = '3'; | |
| 93 | var pati entIdentif ier = idUt il.create( 'pid', sit e + ';' + dfn); | |
| 94 | var root JobId = '1 '; | |
| 95 | var jobI ds = [{dom ain: 'alle rgy', jobI d: '3'}]; | |
| 96 | var jobP riority = 5; | |
| 97 | var expe ctedError; | |
| 98 | var expe ctedRespon se; | |
| 99 | var call ed = false ; | |
| 100 | var refe renceInfo = { | |
| 101 | 'ses sionId': ' some-sessi on-id', | |
| 102 | 'req uestId': ' some-reque st-id' | |
| 103 | }; | |
| 104 | handler. subscribe( 'C877', pa tientIdent ifier, roo tJobId, jo bIds, jobP riority, r eferenceIn fo, functi on (error, response) { | |
| 105 | expe ctedError = error; | |
| 106 | expe ctedRespon se = respo nse; | |
| 107 | call ed = true; | |
| 108 | }); | |
| 109 | ||
| 110 | waitsFor (function () { | |
| 111 | retu rn called; | |
| 112 | }, 'Call to subscr ibe failed to return in time.' , 500); | |
| 113 | ||
| 114 | runs(fun ction () { | |
| 115 | expe ct(expecte dError).to BeNull(); | |
| 116 | expe ct(expecte dResponse) .toEqual(' success'); | |
| 117 | expe ct(dummyrp c.execute. calls.leng th).toEqua l(1); | |
| 118 | expe ct(dummyrp c.execute) .toHaveBee nCalledWit h('HMPDJFS API', | |
| 119 | jasmine.ob jectContai ning({ | |
| 120 | '"serv er"': hmpS erver, | |
| 121 | '"comm and"': 'pu tPtSubscri ption', | |
| 122 | '"loca lId"': dfn , | |
| 123 | '"root JobId"': r ootJobId, | |
| 124 | '"HMPP riority"': jobPriori ty.toStrin g(), | |
| 125 | '"refI nfo-sessio nId"': 'so me-session -id', | |
| 126 | '"refI nfo-reques tId"': 'so me-request -id', | |
| 127 | '"jobD omainId-al lergy"': j obIds[0].j obId | |
| 128 | }), | |
| 129 | jasmine.an y(Function )); | |
| 130 | }); | |
| 131 | }) ; | |
| 132 | ||
| 133 | it ('graceful ly handles non-valid JSON resp onses', fu nction () { | |
| 134 | var comp lete = fal se; | |
| 135 | var fake Vista = { | |
| 136 | log: dummyLogg er, | |
| 137 | metr ics: dummy Logger, | |
| 138 | conf ig: config , | |
| 139 | rpcC lient: { | |
| 140 | execute: f unction (r pc, params , callback ) { | |
| 141 | callba ck(null, ' No DUZ ret urned from login req uest'); | |
| 142 | } | |
| 143 | }, | |
| 144 | _get RpcClient: function () { | |
| 145 | return thi s.rpcClien t; | |
| 146 | } | |
| 147 | }; | |
| 148 | ||
| 149 | var site = '9E7A'; | |
| 150 | var dfn = '3'; | |
| 151 | var pati entIdentif ier = idUt il.create( 'pid', sit e + ';' + dfn); | |
| 152 | var root JobId = '1 '; | |
| 153 | var jobI ds = [{dom ain: 'alle rgy', jobI d: '3'}]; | |
| 154 | var jobP riority = 5; | |
| 155 | var refe renceInfo = { | |
| 156 | 'ses sionId': ' some-sessi on-id', | |
| 157 | 'req uestId': ' some-reque st-id' | |
| 158 | }; | |
| 159 | ||
| 160 | runs(fun ction () { | |
| 161 | Vist aClient.pr ototype.su bscribe.ca ll(fakeVis ta, site, patientIde ntifier, r ootJobId, jobIds, jo bPriority, reference Info, func tion (erro r, respons e) { | |
| 162 | complete = true; | |
| 163 | expect(err or).toBeTr uthy(); | |
| 164 | expect(res ponse).toB eFalsy(); | |
| 165 | expect(err or).toCont ain('No DU Z returned from logi n request' ); | |
| 166 | }); | |
| 167 | }); | |
| 168 | waitsFor (function () { | |
| 169 | retu rn complet e; | |
| 170 | }, 'Wait ing for Vi sta client to proces s response '); | |
| 171 | }) ; | |
| 172 | ||
| 173 | }); | |
| 174 | ||
| 175 | descri be('unsubs cribe()', function ( ) { | |
| 176 | it ('Happy Pa th', funct ion () { | |
| 177 | var hand ler = new VistaClien t(dummyLog ger, dummy Logger, co nfig, dumm yRpcClient ); | |
| 178 | var site = 'C877'; | |
| 179 | var dumm yrpc = han dler._getR pcClient(s ite); | |
| 180 | spyOn(du mmyrpc, 'e xecute').a ndCallThro ugh(); | |
| 181 | var dfn = '3'; | |
| 182 | var pati entIdentif ier = idUt il.create( 'pid', sit e + ';' + dfn); | |
| 183 | var expe ctedError; | |
| 184 | var expe ctedRespon se; | |
| 185 | var call ed = false ; | |
| 186 | handler. unsubscrib e(patientI dentifier. value, fun ction (err or, respon se) { | |
| 187 | expe ctedError = error; | |
| 188 | expe ctedRespon se = respo nse; | |
| 189 | call ed = true; | |
| 190 | }); | |
| 191 | ||
| 192 | waitsFor (function () { | |
| 193 | retu rn called; | |
| 194 | }, 'Call to subscr ibe failed to return in time.' , 500); | |
| 195 | ||
| 196 | runs(fun ction () { | |
| 197 | expe ct(expecte dError).to BeNull(); | |
| 198 | expe ct(expecte dResponse) .toEqual(' success'); | |
| 199 | expe ct(dummyrp c.execute. calls.leng th).toEqua l(1); | |
| 200 | expe ct(dummyrp c.execute) .toHaveBee nCalledWit h('HMPDJFS DELSUB', | |
| 201 | jasmine.ob jectContai ning({ | |
| 202 | '"hmpS rvId"': hm pServer, | |
| 203 | '"pid" ': patient Identifier .value | |
| 204 | }), jasmin e.any(Func tion)); | |
| 205 | }); | |
| 206 | }) ; | |
| 207 | }); | |
| 208 | ||
| 209 | descri be('status ()', funct ion () { | |
| 210 | it ('invokes the HMP SU BSCRIPTION STATUS RP C', functi on () { | |
| 211 | var hand ler = new VistaClien t(dummyLog ger, dummy Logger, co nfig, dumm yRpcClient ); | |
| 212 | var site = 'C877'; | |
| 213 | var dumm yrpc = han dler._getR pcClient(s ite); | |
| 214 | spyOn(du mmyrpc, 'e xecute').a ndCallThro ugh(); | |
| 215 | var dfn = '3'; | |
| 216 | var pati entIdentif ier = idUt il.create( 'pid', sit e + ';' + dfn); | |
| 217 | var expe ctedError; | |
| 218 | var expe ctedRespon se; | |
| 219 | var call ed = false ; | |
| 220 | handler. status(pat ientIdenti fier.value , function (error, r esponse) { | |
| 221 | expe ctedError = error; | |
| 222 | expe ctedRespon se = respo nse; | |
| 223 | call ed = true; | |
| 224 | }); | |
| 225 | ||
| 226 | waitsFor (function () { | |
| 227 | retu rn called; | |
| 228 | }, 'Call to subscr ibe failed to return in time.' , 500); | |
| 229 | ||
| 230 | runs(fun ction () { | |
| 231 | expe ct(expecte dError).no t.toBeNull (); | |
| 232 | expe ct(expecte dResponse) .toBeUndef ined(); | |
| 233 | expe ct(dummyrp c.execute. calls.leng th).toEqua l(1); | |
| 234 | expe ct(dummyrp c.execute) .toHaveBee nCalledWit h('HMP SUB SCRIPTION STATUS', | |
| 235 | jasmine.ob jectContai ning({ | |
| 236 | '"serv er"': hmpS erver, | |
| 237 | '"loca lId"': pat ientIdenti fier.value .split(';' )[1] | |
| 238 | }), jasmin e.any(Func tion)); | |
| 239 | }); | |
| 240 | }) ; | |
| 241 | }); | |
| 242 | ||
| 243 | descri be('getDem ographics( )', functi on () { | |
| 244 | it ('Happy Pa th', funct ion () { | |
| 245 | var hand ler = new VistaClien t(dummyLog ger, dummy Logger, co nfig, dumm yRpcClient ); | |
| 246 | var vist aId = 'C87 7'; | |
| 247 | var dumm yrpc = han dler._getR pcClient(v istaId); | |
| 248 | spyOn(du mmyrpc, 'e xecute').a ndCallThro ugh(); | |
| 249 | var dfn = '3'; | |
| 250 | var expe ctedError; | |
| 251 | var expe ctedRespon se; | |
| 252 | ||
| 253 | var call ed = false ; | |
| 254 | handler. getDemogra phics(vist aId, dfn, function ( error, res ponse) { | |
| 255 | expe ctedError = error; | |
| 256 | expe ctedRespon se = respo nse; | |
| 257 | call ed = true; | |
| 258 | }); | |
| 259 | ||
| 260 | waitsFor (function () { | |
| 261 | retu rn called; | |
| 262 | }, 'Call to subscr ibe failed to return in time.' , 500); | |
| 263 | ||
| 264 | runs(fun ction () { | |
| 265 | expe ct(expecte dError).to BeTruthy() ; // This is because we are ca lling the dummyRPC a nd it does not retur n a valid result. | |
| 266 | expe ct(expecte dResponse) .toBeNull( ); // This is becaus e we are c alling the dummyRPC | |
| 267 | expe ct(dummyrp c.execute. calls.leng th).toEqua l(1); | |
| 268 | expe ct(dummyrp c.execute) .toHaveBee nCalledWit h('HMP GET PATIENT D ATA JSON', | |
| 269 | jasmine.ob jectContai ning({ | |
| 270 | '"pati entId"': d fn, | |
| 271 | '"doma in"': 'pat ient', | |
| 272 | '"extr actSchema" ': '3.001' | |
| 273 | }), jasmin e.any(Func tion)); | |
| 274 | }); | |
| 275 | }) ; | |
| 276 | }); | |
| 277 | ||
| 278 | descri be('fetchN extBatch() ', functio n () { | |
| 279 | it ('Happy Pa th', funct ion () { | |
| 280 | var comp lete = fal se; | |
| 281 | var fake Vista = { | |
| 282 | log: dummyLogg er, | |
| 283 | metr ics: dummy Logger, | |
| 284 | conf ig: config , | |
| 285 | rpcC lient: { | |
| 286 | callNumber : -1, | |
| 287 | execute: f unction (r pc, params , callback ) { | |
| 288 | this.c allNumber+ +; | |
| 289 | expect (params['" max"']).to Equal(this .batchSize [this.call Number]); | |
| 290 | callba ck(this.er rors[this. callNumber ], this.re sults[this .callNumbe r]); | |
| 291 | }, | |
| 292 | batchSize: ['1000'], | |
| 293 | errors: [n ull], | |
| 294 | results: [ '{\"apiVer sion\": 1. 02,\"param s\":{\"dom ain\":\"KO DAK.VISTAC ORE.US\",\ "systemId\ ":\"C877\" },\"data\" :{\"update d\":\"2015 0721120512 \",\"total Items\":10 00,\"lastU pdate\" : \"3150721- 11303\"},\ "items\":[ {},{}]}'] | |
| 295 | }, | |
| 296 | _get RpcClient: function () { | |
| 297 | return thi s.rpcClien t; | |
| 298 | } | |
| 299 | }; | |
| 300 | var vist aId = '9E7 A'; | |
| 301 | var hmpB atchSize = '1000'; | |
| 302 | var last updatetime = '0'; | |
| 303 | runs(fun ction () { | |
| 304 | Vist aClient.pr ototype.fe tchNextBat ch.call(fa keVista, v istaId, la stupdateti me, hmpBat chSize, fu nction (er ror, respo nse) { | |
| 305 | complete = true; | |
| 306 | expect(err or).toBeFa lsy(); | |
| 307 | expect(res ponse).toB eTruthy(); | |
| 308 | expect(res ponse.rawR esponse).t oBeFalsy() ; | |
| 309 | expect(res ponse.hmpB atchSize). toEqual(hm pBatchSize ); | |
| 310 | expect(res ponse.data ).toEqual( JSON.parse (fakeVista .rpcClient .results[0 ]).data); | |
| 311 | }); | |
| 312 | }); | |
| 313 | waitsFor (function () { | |
| 314 | retu rn complet e; | |
| 315 | }, 'Wait ing for Vi sta client to proces s response '); | |
| 316 | }) ; | |
| 317 | ||
| 318 | ||
| 319 | it ('One JSON processin g error th en error o ut single record', f unction () { | |
| 320 | var comp lete = fal se; | |
| 321 | var fake Vista = { | |
| 322 | log: dummyLogg er, | |
| 323 | metr ics: dummy Logger, | |
| 324 | conf ig: config , | |
| 325 | ERRO R_LIST: { | |
| 326 | INVALID_JS ON_ERROR: 'Invalid J SON with h mpBatchSiz e = 1', | |
| 327 | RPC_ERROR: 'RPC Erro r', | |
| 328 | INVALID_CO NFIGURATIO N_ERROR: ' Invalid Co nfiguratio n', | |
| 329 | VISTA_LOCK _DOWN_MODE : 'VistA A llocations Locked' | |
| 330 | }, | |
| 331 | fetc hNextBatch : function (vistaId, lastupdate time, hmpB atchSize, callback){ | |
| 332 | expect(_.i sString(hm pBatchSize )).toBeTru thy(); | |
| 333 | VistaClien t.prototyp e.fetchNex tBatch.cal l(fakeVist a, vistaId , lastupda tetime, hm pBatchSize , callback ); | |
| 334 | }, | |
| 335 | rpcC lient: { | |
| 336 | callNumber : -1, | |
| 337 | execute: f unction (r pc, params , callback ) { | |
| 338 | this.c allNumber+ +; | |
| 339 | expect (params['" max"']).to Equal(this .batchSize [this.call Number]); | |
| 340 | callba ck(this.er rors[this. callNumber ], this.re sults[this .callNumbe r]); | |
| 341 | }, | |
| 342 | errors: [n ull, null] , | |
| 343 | batchSize: ['2', '1' ], | |
| 344 | results: [ '{\"apiVer sion\": 1. 02,\"param s\":{\"dom ain\":\"KO DAK.VISTAC ORE.US\",\ "systemId\ ":\"C877\" },\"data\" :{\"update d\":\"2015 0721120512 \",\"total Items\":,\ "lastUpdat e\" : \"31 50721-1130 3\"},\"ite ms\":[{},{ }]}', | |
| 345 | '{\"ap iVersion\" : 1.02,\"p arams\":{\ "domain\": \"KODAK.VI STACORE.US \",\"syste mId\":\"C8 77\"},\"da ta\":{\"up dated\":\" 2015072112 0512\",\"t otalItems\ ":,\"lastU pdate\" : \"3150721- 11303\"},\ "items\":[ {},{}]}'] | |
| 346 | }, | |
| 347 | _get RpcClient: function () { | |
| 348 | return thi s.rpcClien t; | |
| 349 | } | |
| 350 | }; | |
| 351 | var vist aId = '9E7 A'; | |
| 352 | var hmpB atchSize = '2'; | |
| 353 | var last updatetime = '0'; | |
| 354 | runs(fun ction () { | |
| 355 | Vist aClient.pr ototype.fe tchNextBat ch.call(fa keVista, v istaId, la stupdateti me, hmpBat chSize, fu nction (er ror, respo nse) { | |
| 356 | complete = true; | |
| 357 | expect(err or).toBeTr uthy(); | |
| 358 | expect(res ponse).toB eTruthy(); | |
| 359 | expect(res ponse.rawR esponse).t oBe(fakeVi sta.rpcCli ent.result s[1]); | |
| 360 | expect(res ponse.data ).toBeFals y(); | |
| 361 | }); | |
| 362 | }); | |
| 363 | waitsFor (function () { | |
| 364 | retu rn complet e; | |
| 365 | }, 'Wait ing for Vi sta client to proces s response '); | |
| 366 | }) ; | |
| 367 | ||
| 368 | it ('One JSON processin g error th en success ', functio n () { | |
| 369 | var comp lete = fal se; | |
| 370 | var fake Vista = { | |
| 371 | log: dummyLogg er, | |
| 372 | metr ics: dummy Logger, | |
| 373 | conf ig: config , | |
| 374 | ERRO R_LIST: { | |
| 375 | INVALID_JS ON_ERROR: 'Invalid J SON with h mpBatchSiz e = 1', | |
| 376 | RPC_ERROR: 'RPC Erro r', | |
| 377 | INVALID_CO NFIGURATIO N_ERROR: ' Invalid Co nfiguratio n', | |
| 378 | VISTA_LOCK _DOWN_MODE : 'VistA A llocations Locked' | |
| 379 | }, | |
| 380 | fetc hNextBatch : function (vistaId, lastupdate time, hmpB atchSize, callback){ | |
| 381 | expect(_.i sString(hm pBatchSize )).toBeTru thy(); | |
| 382 | VistaClien t.prototyp e.fetchNex tBatch.cal l(fakeVist a, vistaId , lastupda tetime, hm pBatchSize , callback ); | |
| 383 | }, | |
| 384 | rpcC lient: { | |
| 385 | callNumber : -1, | |
| 386 | execute: f unction (r pc, params , callback ) { | |
| 387 | this.c allNumber+ +; | |
| 388 | expect (params['" max"']).to Equal(this .batchSize [this.call Number]); | |
| 389 | callba ck(this.er rors[this. callNumber ], this.re sults[this .callNumbe r]); | |
| 390 | }, | |
| 391 | errors: [n ull, null] , | |
| 392 | batchSize: ['1000', '500'], | |
| 393 | results: [ '{\"apiVer sion\": 1. 02,\"param s\":{\"dom ain\":\"KO DAK.VISTAC ORE.US\",\ "systemId\ ":\"C877\" },\"data\" :{\"update d\":\"2015 0721120512 \",\"total Items\":,\ "lastUpdat e\" : \"31 50721-1130 3\"},\"ite ms\":[{},{ }]}', | |
| 394 | '{\"ap iVersion\" : 1.02,\"p arams\":{\ "domain\": \"KODAK.VI STACORE.US \",\"syste mId\":\"C8 77\"},\"da ta\":{\"up dated\":\" 2015072112 0512\",\"t otalItems\ ":1000,\"l astUpdate\ " : \"3150 721-11303\ "},\"items \":[{},{}] }'] | |
| 395 | }, | |
| 396 | _get RpcClient: function () { | |
| 397 | return thi s.rpcClien t; | |
| 398 | } | |
| 399 | }; | |
| 400 | ||
| 401 | var vist aId = '9E7 A'; | |
| 402 | var hmpB atchSize = '1000'; | |
| 403 | var last updatetime = '0'; | |
| 404 | runs(fun ction () { | |
| 405 | Vist aClient.pr ototype.fe tchNextBat ch.call(fa keVista, v istaId, la stupdateti me, hmpBat chSize, fu nction (er ror, respo nse) { | |
| 406 | complete = true; | |
| 407 | expect(err or).toBeFa lsy(); | |
| 408 | expect(res ponse).toB eTruthy(); | |
| 409 | expect(res ponse.rawR esponse).t oBeFalsy() ; | |
| 410 | expect(res ponse.data ).toEqual( JSON.parse (fakeVista .rpcClient .results[1 ]).data); | |
| 411 | }); | |
| 412 | }); | |
| 413 | waitsFor (function () { | |
| 414 | retu rn complet e; | |
| 415 | }, 'Wait ing for Vi sta client to proces s response '); | |
| 416 | }) ; | |
| 417 | ||
| 418 | it ('More tha n one JSON processin g error th en success ', functio n () { | |
| 419 | var comp lete = fal se; | |
| 420 | var fake Vista = { | |
| 421 | log: dummyLogg er, | |
| 422 | metr ics: dummy Logger, | |
| 423 | conf ig: config , | |
| 424 | fetc hNextBatch : function (vistaId, lastupdat etime, hmp BatchSize, callback) { | |
| 425 | expect(_.i sString(hm pBatchSize )).toBeTru thy(); | |
| 426 | VistaClien t.prototyp e.fetchNex tBatch.cal l(fakeVist a, vistaId , lastupda tetime, hm pBatchSize , callback ); | |
| 427 | }, | |
| 428 | rpcC lient: { | |
| 429 | callNumber : -1, | |
| 430 | execute: f unction (r pc, params , callback ) { | |
| 431 | this.c allNumber+ +; | |
| 432 | expect (params['" max"']).to Equal(this .batchSize [this.call Number]); | |
| 433 | callba ck(this.er rors[this. callNumber ], this.re sults[this .callNumbe r]); | |
| 434 | }, | |
| 435 | errors: [n ull, null, null], | |
| 436 | batchSize: ['3', '2' , '1'], | |
| 437 | results: [ '{\"apiVer sion\": 1. 02,\"param s\":{\"dom ain\":\"KO DAK.VISTAC ORE.US\",\ "systemId\ ":\"C877\" },\"data\" :{\"update d\":\"2015 0721120512 \",\"total Items\":,\ "lastUpdat e\" : \"31 50721-1130 3\"},\"ite ms\":[{},{ }]}', | |
| 438 | '{\"ap iVersion\" : 1.02,\"p arams\":{\ "domain\": \"KODAK.VI STACORE.US \",\"syste mId\":\"C8 77\"},\"da ta\":{\"up dated\":\" 2015072112 0512\",\"t otalItems\ ":,\"lastU pdate\" : \"3150721- 11303\"},\ "items\":[ {},{}]}', | |
| 439 | '{\"ap iVersion\" : 1.02,\"p arams\":{\ "domain\": \"KODAK.VI STACORE.US \",\"syste mId\":\"C8 77\"},\"da ta\":{\"up dated\":\" 2015072112 0512\",\"t otalItems\ ":1000,\"l astUpdate\ " : \"3150 721-11303\ "},\"items \":[{},{}] }'] | |
| 440 | }, | |
| 441 | _get RpcClient: function () { | |
| 442 | return thi s.rpcClien t; | |
| 443 | } | |
| 444 | }; | |
| 445 | var vist aId = '9E7 A'; | |
| 446 | var hmpB atchSize = '3'; //tr y batch si ze that is n't a powe r of 2 | |
| 447 | var last updatetime = '0'; | |
| 448 | runs(fun ction () { | |
| 449 | Vist aClient.pr ototype.fe tchNextBat ch.call(fa keVista, v istaId, la stupdateti me, hmpBat chSize, fu nction (er ror, respo nse) { | |
| 450 | complete = true; | |
| 451 | expect(err or).toBeFa lsy(); | |
| 452 | expect(res ponse).toB eTruthy(); | |
| 453 | expect(res ponse.rawR esponse).t oBeFalsy() ; | |
| 454 | expect(res ponse.data ).toEqual( JSON.parse (fakeVista .rpcClient .results[2 ]).data); | |
| 455 | }); | |
| 456 | }); | |
| 457 | waitsFor (function () { | |
| 458 | retu rn complet e; | |
| 459 | }, 'Wait ing for Vi sta client to proces s response '); | |
| 460 | }) ; | |
| 461 | ||
| 462 | it ('No data or warn me ssage from Vista', f unction () { | |
| 463 | var comp lete = fal se; | |
| 464 | var fake Vista = { | |
| 465 | log: dummyLogg er, | |
| 466 | metr ics: dummy Logger, | |
| 467 | conf ig: config , | |
| 468 | fetc hNextBatch : function (vistaId, lastupdat etime, hmp BatchSize, callback) { | |
| 469 | expect(_.i sString(hm pBatchSize )).toBeTru thy(); | |
| 470 | VistaClien t.prototyp e.fetchNex tBatch.cal l(fakeVist a, vistaId , lastupda tetime, hm pBatchSize , callback ); | |
| 471 | }, | |
| 472 | rpcC lient: { | |
| 473 | callNumber : -1, | |
| 474 | execute: f unction (r pc, params , callback ) { | |
| 475 | this.c allNumber+ +; | |
| 476 | expect (params['" max"']).to Equal(this .batchSize [this.call Number]); | |
| 477 | callba ck(this.er rors[this. callNumber ], this.re sults[this .callNumbe r]); | |
| 478 | }, | |
| 479 | errors: [n ull], | |
| 480 | batchSize: ['1000'], | |
| 481 | results: [ '{\"apiVer sion\": 1. 02,\"param s\":{\"dom ain\":\"KO DAK.VISTAC ORE.US\",\ "systemId\ ":\"C877\" }}'] | |
| 482 | }, | |
| 483 | _get RpcClient: function () { | |
| 484 | return thi s.rpcClien t; | |
| 485 | } | |
| 486 | }; | |
| 487 | var vist aId = '9E7 A'; | |
| 488 | var hmpB atchSize = '1000'; | |
| 489 | var last updatetime = '0'; | |
| 490 | runs(fun ction () { | |
| 491 | Vist aClient.pr ototype.fe tchNextBat ch.call(fa keVista, v istaId, la stupdateti me, hmpBat chSize, fu nction (er ror, respo nse) { | |
| 492 | complete = true; | |
| 493 | expect(err or).toBeTr uthy(); | |
| 494 | expect(res ponse).toB eTruthy(); | |
| 495 | expect(res ponse.rawR esponse).t oBeFalsy() ; | |
| 496 | expect(res ponse.hmpB atchSize). toEqual(hm pBatchSize ); | |
| 497 | expect(res ponse.data ).toBeFals y(); | |
| 498 | }); | |
| 499 | }); | |
| 500 | waitsFor (function () { | |
| 501 | retu rn complet e; | |
| 502 | }, 'Wait ing for Vi sta client to proces s response '); | |
| 503 | }) ; | |
| 504 | ||
| 505 | }); | |
| 506 | ||
| 507 | }); |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.