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\unittests\eventpriorityruleengine | domain-type-rule-spec.js | Tue Jan 10 16:20:50 2017 UTC |
| 2 | ehmp.zip\ehmp\ehmp\product\production\vx-sync\tests\unittests\eventpriorityruleengine | domain-type-rule-spec.js | Tue Oct 3 13:15:41 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 4 | 520 |
| Changed | 3 | 20 |
| 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 domain TypeRule = require(g lobal.VX_E VENTPRIORI TYRULES + 'domain-ty pe-rule'); | |
| 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 | // logUtil .initializ e([{ | |
| 18 | // nam e: 'root', | |
| 19 | // str eam: proce ss.stdout, | |
| 20 | // lev el: 'debug ' | |
| 21 | // }]); | |
| 22 | // log = l ogUtil.get ('test', ' debug'); | |
| 23 | //-------- ---------- ---------- ---------- ---- | |
| 24 | // End of logging st uff to com ment out.. .. | |
| 25 | //-------- ---------- ---------- ---------- ---- | |
| 26 | // log = r equire('bu nyan').cre ateLogger( { | |
| 27 | // na me: 'site- type-rule- spec', | |
| 28 | // le vel: 'debu g' | |
| 29 | // }); | |
| 30 | ||
| 31 | var hmpSer ver = 'The HmpServer' ; | |
| 32 | ||
| 33 | var config = { | |
| 34 | jd s: { | |
| 35 | prot ocol: 'htt p', | |
| 36 | host: ' IP ', | |
| 37 | port: REDACTED | |
| 38 | }, | |
| 39 | 'v istaSites' : { | |
| 40 | '9E7 A': { | |
| 41 | 'name' : 'panoram a', | |
| 42 | 'host': ' IP ', | |
| 43 | 'port': REDACTED , | |
| 44 | 'accessCod e': ' REDACT ', | |
| 45 | 'verifyCod e': ' REDACTED ', | |
| 46 | 'local IP': '127. 0.0.1', | |
| 47 | 'local Address': 'localhost ', | |
| 48 | 'conne ctTimeout' : 3000, | |
| 49 | 'sendT imeout': 1 0000 | |
| 50 | }, | |
| 51 | 'C87 7': { | |
| 52 | 'name' : 'kodak', | |
| 53 | 'host': ' IP ', | |
| 54 | 'port': REDACTED , | |
| 55 | 'accessCod e': ' REDACT ', | |
| 56 | 'verifyCod e': ' REDACTED ', | |
| 57 | 'local IP': '127. 0.0.1', | |
| 58 | 'local Address': 'localhost ', | |
| 59 | 'conne ctTimeout' : 3000, | |
| 60 | 'sendT imeout': 1 0000 | |
| 61 | } | |
| 62 | }, | |
| 63 | 'h mp.server. id': hmpSe rver, | |
| 64 | 'h mp.version ': '0.7-S6 5', | |
| 65 | 'h mp.batch.s ize': '100 0', | |
| 66 | 'h mp.extract .schema': '3.001', | |
| 67 | 'h dr': { | |
| 68 | 'ope rationMode ': 'REQ/RE S' | |
| 69 | }, | |
| 70 | 'e ventPriori tizationRu les': { | |
| 71 | 'sit e-type': { }, | |
| 72 | 'dom ain-type': { | |
| 73 | 'consu lt': 20, | |
| 74 | 'aller gy': -20, | |
| 75 | 'order ': 40 | |
| 76 | } | |
| 77 | }, | |
| 78 | ||
| 79 | }; | |
| 80 | ||
| 81 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- - | |
| 82 | // Create an instanc e of the e nvironment variable. | |
| 83 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- - | |
| 84 | function c reateEnvir onment() { | |
| 85 | va r environm ent = { | |
| 86 | }; | |
| 87 | ||
| 88 | re turn envir onment; | |
| 89 | } | |
| 90 | ||
| 91 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- | |
| 92 | // Create an instanc e of the j ob and ret urn it. | |
| 93 | // | |
| 94 | // dataDom ain: The d omain of d ata that r epresents this job. | |
| 95 | // priorit y: The pri ority to a ssociated with this job | |
| 96 | // returns : The crea ted job | |
| 97 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- | |
| 98 | function c reateJob(d ataDomain, priority) { | |
| 99 | va r job = { | |
| 100 | type : 'event-p rioritizat ion-reques t', | |
| 101 | pati entIdentif ier: { | |
| 102 | type: 'pid', | |
| 103 | value: '9E7A;3' | |
| 104 | }, | |
| 105 | jpid : '8107cc4 1-69eb-406 0-8813-a82 db245a11a' , | |
| 106 | root JobId: '1' , | |
| 107 | data Domain: da taDomain, | |
| 108 | prio rity: prio rity, | |
| 109 | reco rd: {}, | |
| 110 | jobI d: '34' | |
| 111 | }; | |
| 112 | ||
| 113 | re turn job; | |
| 114 | ||
| 115 | } | |
| 116 | ||
| 117 | describe(' domain-typ e-rule.js' , function () { | |
| 118 | de scribe('fi xPriorityR ange()', f unction() { | |
| 119 | it(' Happy Path with no c hange', fu nction() { | |
| 120 | var jo b = create Job('9E7A; 3', 50); | |
| 121 | domain TypeRule._ internalFu nctions._f ixPriority Range(job) ; | |
| 122 | expect (job.prior ity).toBe( 50); | |
| 123 | }); | |
| 124 | it(' Range too low', func tion() { | |
| 125 | var jo b = create Job('9E7A; 3', -25); | |
| 126 | domain TypeRule._ internalFu nctions._f ixPriority Range(job) ; | |
| 127 | expect (job.prior ity).toBe( 1); | |
| 128 | }); | |
| 129 | it(' Range too high', fun ction() { | |
| 130 | var jo b = create Job('9E7A; 3', 500); | |
| 131 | domain TypeRule._ internalFu nctions._f ixPriority Range(job) ; | |
| 132 | expect (job.prior ity).toBe( 100); | |
| 133 | }); | |
| 134 | }) ; | |
| 135 | de scribe('pr ioritize() ', functio n() { | |
| 136 | it(' Happy Path with vali d job', fu nction() { | |
| 137 | var en vironment = createEn vironment( ); | |
| 138 | var jo b = create Job('aller gy', 40); | |
| 139 | ||
| 140 | var fi nished = f alse; | |
| 141 | ||
| 142 | runs(f unction() { | |
| 143 | domainTy peRule(log , config, environmen t, job, fu nction(err , resultJo b) { | |
| 144 | expect(err ).toBeFals y(); | |
| 145 | expect(res ultJob).to BeTruthy() ; | |
| 146 | expect(res ultJob.pri ority).toB e(20); | |
| 147 | finished = true; | |
| 148 | }); | |
| 149 | }); | |
| 150 | ||
| 151 | waitsF or(functio n() { | |
| 152 | return f inished; | |
| 153 | }); | |
| 154 | }); | |
| 155 | it(' Verify if domain cau ses value to drop be low lower range limi t - it wil l fix itse lf.', func tion() { | |
| 156 | var en vironment = createEn vironment( ); | |
| 157 | var jo b = create Job('aller gy', 15); | |
| 158 | ||
| 159 | var fi nished = f alse; | |
| 160 | ||
| 161 | runs(f unction() { | |
| 162 | domainTy peRule(log , config, environmen t, job, fu nction(err , resultJo b) { | |
| 163 | expect(err ).toBeFals y(); | |
| 164 | expect(res ultJob).to BeTruthy() ; | |
| 165 | expect(res ultJob.pri ority).toB e(1); | |
| 166 | finished = true; | |
| 167 | }); | |
| 168 | }); | |
| 169 | ||
| 170 | waitsF or(functio n() { | |
| 171 | return f inished; | |
| 172 | }); | |
| 173 | }); | |
| 174 | it(' Verify cas e where no configura tion setti ng for the domain - means the priority s tays the s ame.', fun ction() { | |
| 175 | var en vironment = createEn vironment( ); | |
| 176 | var jo b = create Job('vital ', 15); | |
| 177 | ||
| 178 | var fi nished = f alse; | |
| 179 | ||
| 180 | runs(f unction() { | |
| 181 | domainTy peRule(log , config, environmen t, job, fu nction(err , resultJo b) { | |
| 182 | expect(err ).toBeFals y(); | |
| 183 | expect(res ultJob).to BeTruthy() ; | |
| 184 | expect(res ultJob.pri ority).toB e(15); | |
| 185 | finished = true; | |
| 186 | }); | |
| 187 | }); | |
| 188 | ||
| 189 | waitsF or(functio n() { | |
| 190 | return f inished; | |
| 191 | }); | |
| 192 | }); | |
| 193 | it(' Verify no job exits gracefully .', functi on() { | |
| 194 | var en vironment = createEn vironment( ); | |
| 195 | ||
| 196 | var fi nished = f alse; | |
| 197 | ||
| 198 | runs(f unction() { | |
| 199 | domainTy peRule(log , config, environmen t, null, f unction(er r, resultJ ob) { | |
| 200 | expect(err ).toBeFals y(); | |
| 201 | expect(res ultJob).to BeNull(); | |
| 202 | finished = true; | |
| 203 | }); | |
| 204 | }); | |
| 205 | ||
| 206 | waitsF or(functio n() { | |
| 207 | return f inished; | |
| 208 | }); | |
| 209 | }); | |
| 210 | it(' Verify no data domai n - means the priori ty stays t he same.', function( ) { | |
| 211 | var en vironment = createEn vironment( ); | |
| 212 | var jo b = create Job(undefi ned, 15); | |
| 213 | ||
| 214 | var fi nished = f alse; | |
| 215 | ||
| 216 | runs(f unction() { | |
| 217 | domainTy peRule(log , config, environmen t, job, fu nction(err , resultJo b) { | |
| 218 | expect(err ).toBeFals y(); | |
| 219 | expect(res ultJob).to BeTruthy() ; | |
| 220 | expect(res ultJob.pri ority).toB e(15); | |
| 221 | finished = true; | |
| 222 | }); | |
| 223 | }); | |
| 224 | ||
| 225 | waitsF or(functio n() { | |
| 226 | return f inished; | |
| 227 | }); | |
| 228 | }); | |
| 229 | it(' Verify inv alid job p riority - means the priority s ets to def ault.', fu nction() { | |
| 230 | var en vironment = createEn vironment( ); | |
| 231 | var jo b = create Job('vital ', 'invali d'); | |
| 232 | ||
| 233 | var fi nished = f alse; | |
| 234 | ||
| 235 | runs(f unction() { | |
| 236 | domainTy peRule(log , config, environmen t, job, fu nction(err , resultJo b) { | |
| 237 | expect(err ).toBeFals y(); | |
| 238 | expect(res ultJob).to BeTruthy() ; | |
| 239 | expect(res ultJob.pri ority).toB e(1); | |
| 240 | finished = true; | |
| 241 | }); | |
| 242 | }); | |
| 243 | ||
| 244 | waitsF or(functio n() { | |
| 245 | return f inished; | |
| 246 | }); | |
| 247 | }); | |
| 248 | it(' Verify if config rul e for doma in-type do es not exi st - means the prior ity stays the same.' , function () { | |
| 249 | var en vironment = createEn vironment( ); | |
| 250 | var jo b = create Job('aller gy', 25); | |
| 251 | var lo calConfig = JSON.par se(JSON.st ringify(co nfig)); | |
| 252 | localC onfig.even tPrioritiz ationRules ['domain-t ype'] = un defined; | |
| 253 | ||
| 254 | var fi nished = f alse; | |
| 255 | ||
| 256 | runs(f unction() { | |
| 257 | domainTy peRule(log , localCon fig, envir onment, jo b, functio n(err, res ultJob) { | |
| 258 | expect(err ).toBeFals y(); | |
| 259 | expect(res ultJob).to BeTruthy() ; | |
| 260 | expect(res ultJob.pri ority).toB e(25); | |
| 261 | finished = true; | |
| 262 | }); | |
| 263 | }); | |
| 264 | ||
| 265 | waitsF or(functio n() { | |
| 266 | return f inished; | |
| 267 | }); | |
| 268 | }); | |
| 269 | }) ; | |
| 270 | }); |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.