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\eventpriorityruleengine | site-type-rule-spec.js | Mon Jul 10 17:46:22 2017 UTC |
| 2 | ehmp.zip\ehmp\ehmp\product\production\vx-sync\tests\unittests\eventpriorityruleengine | site-type-rule-spec.js | Tue Oct 3 13:16:24 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 7 | 1320 |
| Changed | 6 | 40 |
| 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 fi le contain s unit tes ts for sit e-type-rul e.js. | |
| 5 | // | |
| 6 | // Author: Les Westb erg | |
| 7 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ------ | |
| 8 | ||
| 9 | require('. ./../../en v-setup'); | |
| 10 | var siteTy peRule = r equire(glo bal.VX_EVE NTPRIORITY RULES + 's ite-type-r ule'); | |
| 11 | var JdsCli entDummy = require(g lobal.VX_D UMMIES + ' jds-client -dummy'); | |
| 12 | ||
| 13 | var log = require(gl obal.VX_DU MMIES + 'd ummy-logge r'); | |
| 14 | //-------- ---------- ---------- ---------- ---------- ---------- ---- | |
| 15 | // Uncomme nt the fol lowing to see the lo gging out on the scr een. | |
| 16 | //-------- ---------- ---------- ---------- ---------- ---------- ---- | |
| 17 | // var log Util = req uire(globa l.VX_UTILS + 'log'); | |
| 18 | // logUtil .initializ e([{ | |
| 19 | // nam e: 'root', | |
| 20 | // str eam: proce ss.stdout, | |
| 21 | // lev el: 'debug ' | |
| 22 | // }]); | |
| 23 | // log = l ogUtil.get ('test', ' debug'); | |
| 24 | //-------- ---------- ---------- ---------- ---- | |
| 25 | // End of logging st uff to com ment out.. .. | |
| 26 | //-------- ---------- ---------- ---------- ---- | |
| 27 | // log = r equire('bu nyan').cre ateLogger( { | |
| 28 | // na me: 'site- type-rule- spec', | |
| 29 | // le vel: 'debu g' | |
| 30 | // }); | |
| 31 | ||
| 32 | ||
| 33 | var hmpSer ver = 'The HmpServer' ; | |
| 34 | ||
| 35 | var config = { | |
| 36 | jds: { | |
| 37 | pr otocol: 'h ttp', | |
| 38 | host: ' IP ', | |
| 39 | port: PORT | |
| 40 | }, | |
| 41 | 'vista Sites': { | |
| 42 | '9 E7A': { | |
| 43 | 'name': 'panorama' , | |
| 44 | 'host': ' IP ', | |
| 45 | 'port': PORT , | |
| 46 | 'accessCod e': ' REDACT ', | |
| 47 | 'verifyCod e': ' REDACTED ', | |
| 48 | 'localIP ': '127.0. 0.1', | |
| 49 | 'localAd dress': 'l ocalhost', | |
| 50 | 'connect Timeout': 3000, | |
| 51 | 'sendTim eout': 100 00 | |
| 52 | }, | |
| 53 | 'C 877': { | |
| 54 | 'name': 'kodak', | |
| 55 | 'host': ' IP ', | |
| 56 | 'port': PORT , | |
| 57 | 'accessCod e': ' REDACT ', | |
| 58 | 'verifyCod e': ' REDACTED ', | |
| 59 | 'localIP ': '127.0. 0.1', | |
| 60 | 'localAd dress': 'l ocalhost', | |
| 61 | 'connect Timeout': 3000, | |
| 62 | 'sendTim eout': 100 00 | |
| 63 | } | |
| 64 | }, | |
| 65 | 'hmp.s erver.id': hmpServer , | |
| 66 | 'hmp.v ersion': ' 0.7-S65', | |
| 67 | 'hmp.b atch.size' : '1000', | |
| 68 | 'hmp.e xtract.sch ema': '3.0 01', | |
| 69 | 'hdr': { | |
| 70 | 'o perationMo de': 'REQ/ RES' | |
| 71 | } | |
| 72 | }; | |
| 73 | ||
| 74 | var vistaH drConfig = { | |
| 75 | jds: { | |
| 76 | pr otocol: 'h ttp', | |
| 77 | host: ' IP ', | |
| 78 | port: PORT | |
| 79 | }, | |
| 80 | 'vista Sites': { | |
| 81 | '9 E7A': { | |
| 82 | 'name': 'panorama' , | |
| 83 | 'host': ' IP ', | |
| 84 | 'port': PORT , | |
| 85 | 'accessCod e': ' REDACT ', | |
| 86 | 'verifyCod e': ' REDACTED ', | |
| 87 | 'localIP ': '127.0. 0.1', | |
| 88 | 'localAd dress': 'l ocalhost', | |
| 89 | 'connect Timeout': 3000, | |
| 90 | 'sendTim eout': 100 00 | |
| 91 | }, | |
| 92 | 'C 877': { | |
| 93 | 'name': 'kodak', | |
| 94 | 'host': ' IP ', | |
| 95 | 'port': PORT , | |
| 96 | 'accessCod e': ' REDACT ', | |
| 97 | 'verifyCod e': ' REDACTED ', | |
| 98 | 'localIP ': '127.0. 0.1', | |
| 99 | 'localAd dress': 'l ocalhost', | |
| 100 | 'connect Timeout': 3000, | |
| 101 | 'sendTim eout': 100 00 | |
| 102 | } | |
| 103 | }, | |
| 104 | 'hmp.s erver.id': hmpServer , | |
| 105 | 'hmp.v ersion': ' 0.7-S65', | |
| 106 | 'hmp.b atch.size' : '1000', | |
| 107 | 'hmp.e xtract.sch ema': '3.0 01', | |
| 108 | 'hdr': { | |
| 109 | 'o perationMo de': 'PUB/ SUB', | |
| 110 | 'h drSites': { | |
| 111 | '3A8B': { | |
| 112 | 'sta tionNumber ': 42 | |
| 113 | }, | |
| 114 | 'CF2A': { | |
| 115 | 'sta tionNumber ': 101 | |
| 116 | }, | |
| 117 | '72A0': { | |
| 118 | 'sta tionNumber ': 13 | |
| 119 | }, | |
| 120 | '8211': { | |
| 121 | 'sta tionNumber ': 1337 | |
| 122 | }, | |
| 123 | '84F0': { | |
| 124 | 'sta tionNumber ': 578 | |
| 125 | } | |
| 126 | } | |
| 127 | } | |
| 128 | }; | |
| 129 | ||
| 130 | ||
| 131 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- - | |
| 132 | // Create an instanc e of the e nvironment variable. | |
| 133 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- - | |
| 134 | function c reateEnvir onment(the _config) { | |
| 135 | var en vironment = { | |
| 136 | jd s: new Jds ClientDumm y(log, the _config), | |
| 137 | }; | |
| 138 | ||
| 139 | spyOn( environmen t.jds, 'ge tJobStatus ').andCall Through(); | |
| 140 | ||
| 141 | return environme nt; | |
| 142 | } | |
| 143 | ||
| 144 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- | |
| 145 | // Create an instanc e of the j ob and ret urn it. | |
| 146 | // | |
| 147 | // pid: Th e pid to a ssociate w ith this j ob. | |
| 148 | // priorit y: The pri ority to a ssociated with this job | |
| 149 | // returns : The crea ted job | |
| 150 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- | |
| 151 | function c reateJob(p id, priori ty) { | |
| 152 | var jo b = { | |
| 153 | ty pe: 'recor d-enrichme nt', | |
| 154 | pa tientIdent ifier: { | |
| 155 | type: 'p id', | |
| 156 | value: p id | |
| 157 | }, | |
| 158 | jp id: '8107c c41-69eb-4 060-8813-a 82db245a11 a', | |
| 159 | ro otJobId: ' 1', | |
| 160 | da taDomain: 'appointme nt', | |
| 161 | pr iority: pr iority, | |
| 162 | re cord: {}, | |
| 163 | jo bId: '34' | |
| 164 | }; | |
| 165 | ||
| 166 | return job; | |
| 167 | ||
| 168 | } | |
| 169 | ||
| 170 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- | |
| 171 | // Create an instanc e of the j ob status and return it. | |
| 172 | // | |
| 173 | // pid: Th e pid to a ssociate w ith this j ob status. | |
| 174 | // priorit y: The pri ority to a ssociated with this job status | |
| 175 | // returns : The crea ted job st atus | |
| 176 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- | |
| 177 | function c reateJobSt atus(pid, priority) { | |
| 178 | var jo bStatus = { | |
| 179 | 'j obId': '4b bb4574-68a b-4fd0-9aa f-5abf7576 5449', | |
| 180 | 'j pid': '15f bef90-aed2 -4267-9f8b -980ad62c2 a00', | |
| 181 | 'p atientIden tifier': { | |
| 182 | 'type': 'pid', | |
| 183 | value: p id | |
| 184 | }, | |
| 185 | pr iority: pr iority, | |
| 186 | 'r ootJobId': '4bbb4574 -68ab-4fd0 -9aaf-5abf 75765449', | |
| 187 | 's tatus': 'c ompleted', | |
| 188 | 't imestamp': '14586808 91151', | |
| 189 | 't ype': 'ent erprise-sy nc-request ' | |
| 190 | }; | |
| 191 | ||
| 192 | return jobStatus ; | |
| 193 | ||
| 194 | } | |
| 195 | ||
| 196 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- -------- | |
| 197 | // Since w e are mock ing out JD S - and si nce each o f the call s to JDS f or this | |
| 198 | // unit te st are sim ilar. Thi s function sets up t he jds res ponse that should | |
| 199 | // be give n when JDS is called . | |
| 200 | // | |
| 201 | // environ ment: The environmen t object c ontaining the handle to JDS | |
| 202 | // jobStat us: The jo bStatus th at will be returned by JDS. | |
| 203 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- -------- | |
| 204 | function s etupDummyJ ds(environ ment, jobS tatus) { | |
| 205 | var ex pectedJdsE rror = [nu ll]; | |
| 206 | var ex pectedJdsR esponse = [{ | |
| 207 | st atusCode: 200 | |
| 208 | }]; | |
| 209 | var ex pectedJdsR esult = [{ | |
| 210 | it ems: [jobS tatus] | |
| 211 | }]; | |
| 212 | enviro nment.jds. _setRespon seData(exp ectedJdsEr ror, expec tedJdsResp onse, expe ctedJdsRes ult); | |
| 213 | } | |
| 214 | ||
| 215 | describe(' site-type- rule.js', function ( ) { | |
| 216 | descri be('extrac tSite()', function ( ) { | |
| 217 | it ('Happy Pa th with va lid job', function ( ) { | |
| 218 | var job = createJo b('9E7A;3' , 1); | |
| 219 | var site = siteTyp eRule._int ernalFunct ions._extr actSite(jo b); | |
| 220 | expect(s ite).toBe( '9E7A'); | |
| 221 | }) ; | |
| 222 | it ('Happy Pa th with va lid jobSta tus', func tion () { | |
| 223 | var jobS tatus = cr eateJobSta tus('C877; 3', 1); | |
| 224 | var site = siteTyp eRule._int ernalFunct ions._extr actSite(jo bStatus); | |
| 225 | expect(s ite).toBe( 'C877'); | |
| 226 | }) ; | |
| 227 | it ('Job or j obStatus i s null', f unction () { | |
| 228 | var site = siteTyp eRule._int ernalFunct ions._extr actSite(nu ll); | |
| 229 | expect(s ite).toBeN ull(); | |
| 230 | }) ; | |
| 231 | it ('Job or j obStatus i s undefine d', functi on () { | |
| 232 | var site = siteTyp eRule._int ernalFunct ions._extr actSite(un defined); | |
| 233 | expect(s ite).toBeN ull(); | |
| 234 | }) ; | |
| 235 | it ('job.pati entIdentif ier is und efined', f unction () { | |
| 236 | var job = {}; | |
| 237 | var site = siteTyp eRule._int ernalFunct ions._extr actSite(jo b); | |
| 238 | expect(s ite).toBeN ull(); | |
| 239 | }) ; | |
| 240 | it ('job.pati entIdentif ier.value is undefin ed', funct ion () { | |
| 241 | var job = { | |
| 242 | pati entIdentif ier: {} | |
| 243 | }; | |
| 244 | var site = siteTyp eRule._int ernalFunct ions._extr actSite(jo b); | |
| 245 | expect(s ite).toBeN ull(); | |
| 246 | }) ; | |
| 247 | }); | |
| 248 | descri be('fixPri orityRange ()', funct ion () { | |
| 249 | it ('Happy Pa th with no change', function ( ) { | |
| 250 | var job = createJo b('9E7A;3' , 50); | |
| 251 | siteType Rule._inte rnalFuncti ons._fixPr iorityRang e(job); | |
| 252 | expect(j ob.priorit y).toBe(50 ); | |
| 253 | }) ; | |
| 254 | it ('Range to o low', fu nction () { | |
| 255 | var job = createJo b('9E7A;3' , -25); | |
| 256 | siteType Rule._inte rnalFuncti ons._fixPr iorityRang e(job); | |
| 257 | expect(j ob.priorit y).toBe(1) ; | |
| 258 | }) ; | |
| 259 | it ('Range to o high', f unction () { | |
| 260 | var job = createJo b('9E7A;3' , 500); | |
| 261 | siteType Rule._inte rnalFuncti ons._fixPr iorityRang e(job); | |
| 262 | expect(j ob.priorit y).toBe(10 0); | |
| 263 | }) ; | |
| 264 | }); | |
| 265 | descri be('priori tize()', f unction () { | |
| 266 | it ('Happy Pa th with va lid my-sit e job (via job statu s retrieva l)', funct ion () { | |
| 267 | var envi ronment = createEnvi ronment(co nfig); | |
| 268 | var job = createJo b('9E7A;3' , 1); | |
| 269 | var jobS tatus = cr eateJobSta tus('9E7A; 3', 1); | |
| 270 | setupDum myJds(envi ronment, j obStatus); | |
| 271 | ||
| 272 | var fini shed = fal se; | |
| 273 | ||
| 274 | runs(fun ction () { | |
| 275 | site TypeRule(l og, config , environm ent, job, function ( err, resul tJob) { | |
| 276 | expect(err ).toBeFals y(); | |
| 277 | expect(env ironment.j ds.getJobS tatus.call s.length). toEqual(1) ; | |
| 278 | expect(env ironment.j ds.getJobS tatus).toH aveBeenCal ledWith(jo b, jasmine .objectCon taining({f ilter: jas mine.any(S tring)}), jasmine.an y(Function )); | |
| 279 | expect(res ultJob).to BeTruthy() ; | |
| 280 | expect(res ultJob.pri ority).toB e(1); | |
| 281 | finished = true; | |
| 282 | }); | |
| 283 | }); | |
| 284 | ||
| 285 | waitsFor (function () { | |
| 286 | retu rn finishe d; | |
| 287 | }); | |
| 288 | }) ; | |
| 289 | it ('Happy Pa th with va lid my-sit e job (via data in t he job - n o job stat us retreiv al)', func tion () { | |
| 290 | var envi ronment = createEnvi ronment(co nfig); | |
| 291 | var job = createJo b('9E7A;3' , 1); | |
| 292 | job.refe renceInfo = { | |
| 293 | init ialSyncId: '9E7A;3' | |
| 294 | }; | |
| 295 | var jobS tatus = cr eateJobSta tus('9E7A; 3', 1); | |
| 296 | setupDum myJds(envi ronment, j obStatus); | |
| 297 | ||
| 298 | var fini shed = fal se; | |
| 299 | ||
| 300 | runs(fun ction () { | |
| 301 | site TypeRule(l og, config , environm ent, job, function ( err, resul tJob) { | |
| 302 | expect(err ).toBeFals y(); | |
| 303 | expect(env ironment.j ds.getJobS tatus.call s.length). toEqual(0) ; | |
| 304 | expect(env ironment.j ds.getJobS tatus).not .toHaveBee nCalled(); | |
| 305 | expect(res ultJob).to BeTruthy() ; | |
| 306 | expect(res ultJob.pri ority).toB e(1); | |
| 307 | finished = true; | |
| 308 | }); | |
| 309 | }); | |
| 310 | ||
| 311 | waitsFor (function () { | |
| 312 | retu rn finishe d; | |
| 313 | }); | |
| 314 | }) ; | |
| 315 | it ('Happy Pa th with va lid Other Primary Vi sta Site j ob (via jo b status r etrieval)' , function () { | |
| 316 | var envi ronment = createEnvi ronment(co nfig); | |
| 317 | var job = createJo b('C877;3' , 1); | |
| 318 | var jobS tatus = cr eateJobSta tus('9E7A; 3', 1); | |
| 319 | setupDum myJds(envi ronment, j obStatus); | |
| 320 | ||
| 321 | var fini shed = fal se; | |
| 322 | ||
| 323 | runs(fun ction () { | |
| 324 | site TypeRule(l og, config , environm ent, job, function ( err, resul tJob) { | |
| 325 | expect(err ).toBeFals y(); | |
| 326 | expect(env ironment.j ds.getJobS tatus.call s.length). toEqual(1) ; | |
| 327 | expect(env ironment.j ds.getJobS tatus).toH aveBeenCal ledWith(jo b, jasmine .objectCon taining({f ilter: jas mine.any(S tring)}), jasmine.an y(Function )); | |
| 328 | expect(res ultJob).to BeTruthy() ; | |
| 329 | expect(res ultJob.pri ority).toB e(21); | |
| 330 | finished = true; | |
| 331 | }); | |
| 332 | }); | |
| 333 | ||
| 334 | waitsFor (function () { | |
| 335 | retu rn finishe d; | |
| 336 | }); | |
| 337 | }) ; | |
| 338 | it ('Happy Pa th with va lid Other Primary Vi sta Site j ob (via da ta in the job - no j ob status retreival) ', functio n () { | |
| 339 | var envi ronment = createEnvi ronment(co nfig); | |
| 340 | var job = createJo b('C877;3' , 1); | |
| 341 | job.refe renceInfo = { | |
| 342 | init ialSyncId: '9E7A;3' | |
| 343 | }; | |
| 344 | var jobS tatus = cr eateJobSta tus('9E7A; 3', 1); | |
| 345 | setupDum myJds(envi ronment, j obStatus); | |
| 346 | ||
| 347 | var fini shed = fal se; | |
| 348 | ||
| 349 | runs(fun ction () { | |
| 350 | site TypeRule(l og, config , environm ent, job, function ( err, resul tJob) { | |
| 351 | expect(err ).toBeFals y(); | |
| 352 | expect(env ironment.j ds.getJobS tatus.call s.length). toEqual(0) ; | |
| 353 | expect(env ironment.j ds.getJobS tatus).not .toHaveBee nCalled(); | |
| 354 | expect(res ultJob).to BeTruthy() ; | |
| 355 | expect(res ultJob.pri ority).toB e(21); | |
| 356 | finished = true; | |
| 357 | }); | |
| 358 | }); | |
| 359 | ||
| 360 | waitsFor (function () { | |
| 361 | retu rn finishe d; | |
| 362 | }); | |
| 363 | }) ; | |
| 364 | ||
| 365 | it ('Happy Pa th with va lid Other VistaHDR S ite job (v ia job sta tus retrie val)', fun ction () { | |
| 366 | var envi ronment = createEnvi ronment(vi staHdrConf ig); | |
| 367 | var job = createJo b('3A8B;3' , 1); | |
| 368 | var jobS tatus = cr eateJobSta tus('9E7A; 3', 1); | |
| 369 | setupDum myJds(envi ronment, j obStatus); | |
| 370 | ||
| 371 | var fini shed = fal se; | |
| 372 | ||
| 373 | runs(fun ction () { | |
| 374 | site TypeRule(l og, vistaH drConfig, environmen t, job, fu nction (er r, resultJ ob) { | |
| 375 | expect(err ).toBeFals y(); | |
| 376 | expect(env ironment.j ds.getJobS tatus.call s.length). toEqual(1) ; | |
| 377 | expect(env ironment.j ds.getJobS tatus).toH aveBeenCal ledWith(jo b, jasmine .objectCon taining({f ilter: jas mine.any(S tring)}), jasmine.an y(Function )); | |
| 378 | expect(res ultJob).to BeTruthy() ; | |
| 379 | expect(res ultJob.pri ority).toB e(21); | |
| 380 | finished = true; | |
| 381 | }); | |
| 382 | }); | |
| 383 | ||
| 384 | waitsFor (function () { | |
| 385 | retu rn finishe d; | |
| 386 | }); | |
| 387 | }) ; | |
| 388 | ||
| 389 | it ('Happy Pa th with va lid Other VistaHDR S ite job (v ia data in the job - no job st atus retre ival)', fu nction () { | |
| 390 | var envi ronment = createEnvi ronment(vi staHdrConf ig); | |
| 391 | var job = createJo b('3A8B;3' , 1); | |
| 392 | job.refe renceInfo = { | |
| 393 | init ialSyncId: '9E7A;3' | |
| 394 | }; | |
| 395 | var jobS tatus = cr eateJobSta tus('9E7A; 3', 1); | |
| 396 | setupDum myJds(envi ronment, j obStatus); | |
| 397 | ||
| 398 | var fini shed = fal se; | |
| 399 | ||
| 400 | runs(fun ction () { | |
| 401 | site TypeRule(l og, vistaH drConfig, environmen t, job, fu nction (er r, resultJ ob) { | |
| 402 | expect(err ).toBeFals y(); | |
| 403 | expect(env ironment.j ds.getJobS tatus.call s.length). toEqual(0) ; | |
| 404 | expect(env ironment.j ds.getJobS tatus).not .toHaveBee nCalled(); | |
| 405 | expect(res ultJob).to BeTruthy() ; | |
| 406 | expect(res ultJob.pri ority).toB e(21); | |
| 407 | finished = true; | |
| 408 | }); | |
| 409 | }); | |
| 410 | ||
| 411 | waitsFor (function () { | |
| 412 | retu rn finishe d; | |
| 413 | }); | |
| 414 | }) ; | |
| 415 | ||
| 416 | it ('Happy Pa th with va lid Other Secondary HDR Site j ob (via jo b status r etrieval)' , function () { | |
| 417 | var envi ronment = createEnvi ronment(co nfig); | |
| 418 | var job = createJo b('HDR;101 08V420871' , 1); | |
| 419 | var jobS tatus = cr eateJobSta tus('9E7A; 3', 1); | |
| 420 | setupDum myJds(envi ronment, j obStatus); | |
| 421 | ||
| 422 | var fini shed = fal se; | |
| 423 | ||
| 424 | runs(fun ction () { | |
| 425 | site TypeRule(l og, config , environm ent, job, function ( err, resul tJob) { | |
| 426 | expect(err ).toBeFals y(); | |
| 427 | expect(env ironment.j ds.getJobS tatus.call s.length). toEqual(1) ; | |
| 428 | expect(env ironment.j ds.getJobS tatus).toH aveBeenCal ledWith(jo b, jasmine .objectCon taining({f ilter: jas mine.any(S tring)}), jasmine.an y(Function )); | |
| 429 | expect(res ultJob).to BeTruthy() ; | |
| 430 | expect(res ultJob.pri ority).toB e(21); | |
| 431 | finished = true; | |
| 432 | }); | |
| 433 | }); | |
| 434 | ||
| 435 | waitsFor (function () { | |
| 436 | retu rn finishe d; | |
| 437 | }); | |
| 438 | }) ; | |
| 439 | ||
| 440 | it ('Happy Pa th with va lid Other Secondary HDR Site j ob (via da ta in the job - no j ob status retreival) ', functio n () { | |
| 441 | var envi ronment = createEnvi ronment(co nfig); | |
| 442 | var job = createJo b('HDR;101 08V420871' , 1); | |
| 443 | job.refe renceInfo = { | |
| 444 | init ialSyncId: '9E7A;3' | |
| 445 | }; | |
| 446 | var jobS tatus = cr eateJobSta tus('9E7A; 3', 1); | |
| 447 | setupDum myJds(envi ronment, j obStatus); | |
| 448 | ||
| 449 | var fini shed = fal se; | |
| 450 | ||
| 451 | runs(fun ction () { | |
| 452 | site TypeRule(l og, config , environm ent, job, function ( err, resul tJob) { | |
| 453 | expect(err ).toBeFals y(); | |
| 454 | expect(env ironment.j ds.getJobS tatus.call s.length). toEqual(0) ; | |
| 455 | expect(env ironment.j ds.getJobS tatus).not .toHaveBee nCalled(); | |
| 456 | expect(res ultJob).to BeTruthy() ; | |
| 457 | expect(res ultJob.pri ority).toB e(21); | |
| 458 | finished = true; | |
| 459 | }); | |
| 460 | }); | |
| 461 | ||
| 462 | waitsFor (function () { | |
| 463 | retu rn finishe d; | |
| 464 | }); | |
| 465 | }) ; | |
| 466 | ||
| 467 | it ('Happy Pa th with va lid DOD Si te job (vi a job stat us retriev al)', func tion () { | |
| 468 | var envi ronment = createEnvi ronment(co nfig); | |
| 469 | var job = createJo b('DOD;000 0000003', 1); | |
| 470 | var jobS tatus = cr eateJobSta tus('9E7A; 3', 1); | |
| 471 | setupDum myJds(envi ronment, j obStatus); | |
| 472 | ||
| 473 | var fini shed = fal se; | |
| 474 | ||
| 475 | runs(fun ction () { | |
| 476 | site TypeRule(l og, config , environm ent, job, function ( err, resul tJob) { | |
| 477 | expect(err ).toBeFals y(); | |
| 478 | expect(env ironment.j ds.getJobS tatus.call s.length). toEqual(1) ; | |
| 479 | expect(env ironment.j ds.getJobS tatus).toH aveBeenCal ledWith(jo b, jasmine .objectCon taining({f ilter: jas mine.any(S tring)}), jasmine.an y(Function )); | |
| 480 | expect(res ultJob).to BeTruthy() ; | |
| 481 | expect(res ultJob.pri ority).toB e(41); | |
| 482 | finished = true; | |
| 483 | }); | |
| 484 | }); | |
| 485 | ||
| 486 | waitsFor (function () { | |
| 487 | retu rn finishe d; | |
| 488 | }); | |
| 489 | }) ; | |
| 490 | ||
| 491 | it ('Happy Pa th with va lid DOD Si te job (vi a data in the job - no job sta tus retrei val)', fun ction () { | |
| 492 | var envi ronment = createEnvi ronment(co nfig); | |
| 493 | var job = createJo b('DOD;000 0000003', 1); | |
| 494 | job.refe renceInfo = { | |
| 495 | init ialSyncId: '9E7A;3' | |
| 496 | }; | |
| 497 | var jobS tatus = cr eateJobSta tus('9E7A; 3', 1); | |
| 498 | setupDum myJds(envi ronment, j obStatus); | |
| 499 | ||
| 500 | var fini shed = fal se; | |
| 501 | ||
| 502 | runs(fun ction () { | |
| 503 | site TypeRule(l og, config , environm ent, job, function ( err, resul tJob) { | |
| 504 | expect(err ).toBeFals y(); | |
| 505 | expect(env ironment.j ds.getJobS tatus.call s.length). toEqual(0) ; | |
| 506 | expect(env ironment.j ds.getJobS tatus).not .toHaveBee nCalled(); | |
| 507 | expect(res ultJob).to BeTruthy() ; | |
| 508 | expect(res ultJob.pri ority).toB e(41); | |
| 509 | finished = true; | |
| 510 | }); | |
| 511 | }); | |
| 512 | ||
| 513 | waitsFor (function () { | |
| 514 | retu rn finishe d; | |
| 515 | }); | |
| 516 | }) ; | |
| 517 | ||
| 518 | it ('Happy Pa th with va lid Other Secondary VLER Site job (via j ob status retrieval) ', functio n () { | |
| 519 | var envi ronment = createEnvi ronment(co nfig); | |
| 520 | var job = createJo b('VLER;10 108V420871 ', 1); | |
| 521 | var jobS tatus = cr eateJobSta tus('9E7A; 3', 1); | |
| 522 | setupDum myJds(envi ronment, j obStatus); | |
| 523 | ||
| 524 | var fini shed = fal se; | |
| 525 | ||
| 526 | runs(fun ction () { | |
| 527 | site TypeRule(l og, config , environm ent, job, function ( err, resul tJob) { | |
| 528 | expect(err ).toBeFals y(); | |
| 529 | expect(env ironment.j ds.getJobS tatus.call s.length). toEqual(1) ; | |
| 530 | expect(env ironment.j ds.getJobS tatus).toH aveBeenCal ledWith(jo b, jasmine .objectCon taining({f ilter: jas mine.any(S tring)}), jasmine.an y(Function )); | |
| 531 | expect(res ultJob).to BeTruthy() ; | |
| 532 | expect(res ultJob.pri ority).toB e(41); | |
| 533 | finished = true; | |
| 534 | }); | |
| 535 | }); | |
| 536 | ||
| 537 | waitsFor (function () { | |
| 538 | retu rn finishe d; | |
| 539 | }); | |
| 540 | }) ; | |
| 541 | ||
| 542 | it ('Happy Pa th with va lid Other Secondary VLER Site job (via d ata in the job - no job status retreival )', functi on () { | |
| 543 | var envi ronment = createEnvi ronment(co nfig); | |
| 544 | var job = createJo b('VLER;10 108V420871 ', 1); | |
| 545 | job.refe renceInfo = { | |
| 546 | init ialSyncId: '9E7A;3' | |
| 547 | }; | |
| 548 | var jobS tatus = cr eateJobSta tus('9E7A; 3', 1); | |
| 549 | setupDum myJds(envi ronment, j obStatus); | |
| 550 | ||
| 551 | var fini shed = fal se; | |
| 552 | ||
| 553 | runs(fun ction () { | |
| 554 | site TypeRule(l og, config , environm ent, job, function ( err, resul tJob) { | |
| 555 | expect(err ).toBeFals y(); | |
| 556 | expect(env ironment.j ds.getJobS tatus.call s.length). toEqual(0) ; | |
| 557 | expect(env ironment.j ds.getJobS tatus).not .toHaveBee nCalled(); | |
| 558 | expect(res ultJob).to BeTruthy() ; | |
| 559 | expect(res ultJob.pri ority).toB e(41); | |
| 560 | finished = true; | |
| 561 | }); | |
| 562 | }); | |
| 563 | ||
| 564 | waitsFor (function () { | |
| 565 | retu rn finishe d; | |
| 566 | }); | |
| 567 | }) ; | |
| 568 | ||
| 569 | it ('Happy Pa th with or iginal pri ority neve r set. (vi a job stat us retriev al)', func tion () { | |
| 570 | var envi ronment = createEnvi ronment(co nfig); | |
| 571 | var job = createJo b('9E7A;3' , undefine d); | |
| 572 | var jobS tatus = cr eateJobSta tus('9E7A; 3', 50); | |
| 573 | setupDum myJds(envi ronment, j obStatus); | |
| 574 | ||
| 575 | var fini shed = fal se; | |
| 576 | ||
| 577 | runs(fun ction () { | |
| 578 | site TypeRule(l og, config , environm ent, job, function ( err, resul tJob) { | |
| 579 | expect(err ).toBeFals y(); | |
| 580 | expect(env ironment.j ds.getJobS tatus.call s.length). toEqual(1) ; | |
| 581 | expect(env ironment.j ds.getJobS tatus).toH aveBeenCal ledWith(jo b, jasmine .objectCon taining({f ilter: jas mine.any(S tring)}), jasmine.an y(Function )); | |
| 582 | expect(res ultJob).to BeTruthy() ; | |
| 583 | expect(res ultJob.pri ority).toB e(50); | |
| 584 | finished = true; | |
| 585 | }); | |
| 586 | }); | |
| 587 | ||
| 588 | waitsFor (function () { | |
| 589 | retu rn finishe d; | |
| 590 | }); | |
| 591 | }) ; | |
| 592 | ||
| 593 | it ('Happy Pa th with or iginal pri ority not the same a s the curr ent job. ( via job st atus retri eval)', fu nction () { | |
| 594 | var envi ronment = createEnvi ronment(co nfig); | |
| 595 | var job = createJo b('9E7A;3' , 50); | |
| 596 | var jobS tatus = cr eateJobSta tus('9E7A; 3', 30); | |
| 597 | setupDum myJds(envi ronment, j obStatus); | |
| 598 | ||
| 599 | var fini shed = fal se; | |
| 600 | ||
| 601 | runs(fun ction () { | |
| 602 | site TypeRule(l og, config , environm ent, job, function ( err, resul tJob) { | |
| 603 | expect(err ).toBeFals y(); | |
| 604 | expect(env ironment.j ds.getJobS tatus.call s.length). toEqual(1) ; | |
| 605 | expect(env ironment.j ds.getJobS tatus).toH aveBeenCal ledWith(jo b, jasmine .objectCon taining({f ilter: jas mine.any(S tring)}), jasmine.an y(Function )); | |
| 606 | expect(res ultJob).to BeTruthy() ; | |
| 607 | expect(res ultJob.pri ority).toB e(30); | |
| 608 | finished = true; | |
| 609 | }); | |
| 610 | }); | |
| 611 | ||
| 612 | waitsFor (function () { | |
| 613 | retu rn finishe d; | |
| 614 | }); | |
| 615 | }) ; | |
| 616 | ||
| 617 | it ('Case whe re priorit y overflow s upper li mit (via j ob status retrieval) ', functio n () { | |
| 618 | var envi ronment = createEnvi ronment(co nfig); | |
| 619 | var job = createJo b('VLER;10 108V420871 ', 80); | |
| 620 | var jobS tatus = cr eateJobSta tus('9E7A; 3', 80); | |
| 621 | setupDum myJds(envi ronment, j obStatus); | |
| 622 | ||
| 623 | var fini shed = fal se; | |
| 624 | ||
| 625 | runs(fun ction () { | |
| 626 | site TypeRule(l og, config , environm ent, job, function ( err, resul tJob) { | |
| 627 | expect(err ).toBeFals y(); | |
| 628 | expect(env ironment.j ds.getJobS tatus.call s.length). toEqual(1) ; | |
| 629 | expect(env ironment.j ds.getJobS tatus).toH aveBeenCal ledWith(jo b, jasmine .objectCon taining({f ilter: jas mine.any(S tring)}), jasmine.an y(Function )); | |
| 630 | expect(res ultJob).to BeTruthy() ; | |
| 631 | expect(res ultJob.pri ority).toB e(100); | |
| 632 | finished = true; | |
| 633 | }); | |
| 634 | }); | |
| 635 | ||
| 636 | waitsFor (function () { | |
| 637 | retu rn finishe d; | |
| 638 | }); | |
| 639 | }) ; | |
| 640 | ||
| 641 | }); | |
| 642 | descri be('adjust JobPriorit y()', func tion () { | |
| 643 | it ('Happy Pa th with my -site job' , function () { | |
| 644 | var job = createJo b('9E7A;3' , 1); | |
| 645 | var resu ltJob = si teTypeRule ._internal Functions. _adjustJob Priority(l og, config , job, '9E 7A', '9E7A '); | |
| 646 | expect(r esultJob). toBeTruthy (); | |
| 647 | expect(r esultJob.p riority).t oBe(1); | |
| 648 | }) ; | |
| 649 | it ('Happy Pa th with va lid Other Primary Vi sta Site j ob', funct ion () { | |
| 650 | var job = createJo b('C877;3' , 1); | |
| 651 | var resu ltJob = si teTypeRule ._internal Functions. _adjustJob Priority(l og, config , job, '9E 7A', 'C877 '); | |
| 652 | expect(r esultJob). toBeTruthy (); | |
| 653 | expect(r esultJob.p riority).t oBe(21); | |
| 654 | }) ; | |
| 655 | it ('Happy Pa th with va lid Other VistaHDR S ite job', function ( ) { | |
| 656 | var job = createJo b('3A8B;3' , 1); | |
| 657 | var resu ltJob = si teTypeRule ._internal Functions. _adjustJob Priority(l og, vistaH drConfig, job, '9E7A ', '3A8B') ; | |
| 658 | expect(r esultJob). toBeTruthy (); | |
| 659 | expect(r esultJob.p riority).t oBe(21); | |
| 660 | }) ; | |
| 661 | it ('Happy Pa th with va lid Other Secondary HDR Site j ob', funct ion () { | |
| 662 | var job = createJo b('HDR;101 08V420871' , 1); | |
| 663 | var resu ltJob = si teTypeRule ._internal Functions. _adjustJob Priority(l og, config , job, '9E 7A', 'HDR' ); | |
| 664 | expect(r esultJob). toBeTruthy (); | |
| 665 | expect(r esultJob.p riority).t oBe(21); | |
| 666 | }) ; | |
| 667 | it ('Happy Pa th with va lid DOD Si te job', f unction () { | |
| 668 | var job = createJo b('DOD;000 0000003', 1); | |
| 669 | var resu ltJob = si teTypeRule ._internal Functions. _adjustJob Priority(l og, config , job, '9E 7A', 'DOD' ); | |
| 670 | expect(r esultJob). toBeTruthy (); | |
| 671 | expect(r esultJob.p riority).t oBe(41); | |
| 672 | }) ; | |
| 673 | it ('Happy Pa th with va lid Other Secondary VLER Site job', func tion () { | |
| 674 | var job = createJo b('VLER;10 108V420871 ', 1); | |
| 675 | var resu ltJob = si teTypeRule ._internal Functions. _adjustJob Priority(l og, config , job, '9E 7A', 'VLER '); | |
| 676 | expect(r esultJob). toBeTruthy (); | |
| 677 | expect(r esultJob.p riority).t oBe(41); | |
| 678 | }) ; | |
| 679 | }); | |
| 680 | }); |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.