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\endpoints\operational | operational-sync-endpoint-handler-spec.js | Mon Jul 10 17:46:22 2017 UTC |
| 2 | ehmp.zip\ehmp\ehmp\product\production\vx-sync\tests\unittests\endpoints\operational | operational-sync-endpoint-handler-spec.js | Tue Oct 3 13:15:09 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 21 | 716 |
| Changed | 20 | 68 |
| 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 | var _ = re quire('und erscore'); | |
| 5 | var util = require(' util'); | |
| 6 | ||
| 7 | var handle r = requir e(global.V X_ENDPOINT S + '/oper ational/op erational- sync-endpo int-handle r'); | |
| 8 | var JdsCli entDummy = require(g lobal.VX_D UMMIES + ' jds-client -dummy'); | |
| 9 | ||
| 10 | var log = require(gl obal.VX_DU MMIES + 'd ummy-logge r'); | |
| 11 | // log = r equire('bu nyan').cre ateLogger( { | |
| 12 | // nam e: 'operat ional-sync -endpoint- handler-sp ec', | |
| 13 | // lev el: 'debug ' | |
| 14 | // }); | |
| 15 | ||
| 16 | var sample OpDataStam p = { | |
| 17 | 'stamp Time': 201 4103109492 0, | |
| 18 | 'sourc eMetaStamp ': { | |
| 19 | ' R E D A CTED ': { | |
| 20 | 'stampTi me': 20141 031094920, | |
| 21 | 'domainM etaStamp': { | |
| 22 | 'doc -def': { | |
| 23 | 'domain': 'doc-def', | |
| 24 | 'stampTime ': 2014103 1094920, | |
| 25 | 'itemMetaS tamp': { | |
| 26 | 'urn:v a:doc-def: AAAA:1001' : { | |
| 27 | 's tampTime': 201410310 94920, | |
| 28 | }, | |
| 29 | 'urn:v a:doc-def: AAAA:1002' : { | |
| 30 | 's tampTime': 201410310 94920, | |
| 31 | } | |
| 32 | } | |
| 33 | }, | |
| 34 | 'pt- select': { | |
| 35 | 'domain': 'pt-select ', | |
| 36 | 'stampTime ': 2014103 1094920, | |
| 37 | 'itemMetaS tamp': { | |
| 38 | 'urn:v a:pt-selec t:AAAA:100 1': { | |
| 39 | 's tampTime': 201410310 94920, | |
| 40 | }, | |
| 41 | 'urn:v a:pt-selec t:AAAA:100 2': { | |
| 42 | 's tampTime': 201410310 94920, | |
| 43 | } | |
| 44 | } | |
| 45 | } | |
| 46 | } | |
| 47 | } | |
| 48 | } | |
| 49 | }; | |
| 50 | ||
| 51 | var sample OpDataStam p2 = { | |
| 52 | 'stamp Time': 201 4103109492 0, | |
| 53 | 'sourc eMetaStamp ': { | |
| 54 | ' REDA C TED ': { | |
| 55 | 'stampTi me': 20141 031094920, | |
| 56 | 'domainM etaStamp': { | |
| 57 | 'pt- select': { | |
| 58 | 'domain': 'pt-select ', | |
| 59 | 'stampTime ': 2014103 1094920, | |
| 60 | 'itemMetaS tamp': { | |
| 61 | 'urn:v a:pt-selec t:BBBB:100 1': { | |
| 62 | 's tampTime': 201410310 94920, | |
| 63 | } | |
| 64 | } | |
| 65 | } | |
| 66 | } | |
| 67 | } | |
| 68 | } | |
| 69 | }; | |
| 70 | ||
| 71 | describe(' operationa l-sync-end point-hand ler', func tion() { | |
| 72 | descri be('initia lOPDSync', function( ) { | |
| 73 | it ('Error pa th: JDS re turns erro r', functi on() { | |
| 74 | var done = false; | |
| 75 | var conf ig = { | |
| 76 | vist aSites: { | |
| 77 | ' R E D A CTED ': {}, | |
| 78 | ' REDA C TED ': {} | |
| 79 | }, | |
| 80 | jds: { | |
| 81 | protocol: 'http', | |
| 82 | host: ' IP ', | |
| 83 | port: PORT | |
| 84 | } | |
| 85 | }; | |
| 86 | var jdsC lientDummy = new Jds ClientDumm y(log, con fig); | |
| 87 | jdsClien tDummy._se tResponseD ata('Error ', null, n ull); | |
| 88 | var envi ronment = { | |
| 89 | jds: jdsClient Dummy | |
| 90 | }; | |
| 91 | ||
| 92 | runs(fun ction() { | |
| 93 | hand ler.initia lOPDSync(l og, config , environm ent, funct ion(error) { | |
| 94 | expect(err or).toBeTr uthy(); | |
| 95 | expect(err or).toEqua l('FailedJ dsError'); | |
| 96 | done = tru e; | |
| 97 | }); | |
| 98 | }); | |
| 99 | waitsFor (function( ) { | |
| 100 | retu rn done; | |
| 101 | }); | |
| 102 | }) ; | |
| 103 | it ('Error pa th: JDS re turns no r esponse', function() { | |
| 104 | var done = false; | |
| 105 | var conf ig = { | |
| 106 | vist aSites: { | |
| 107 | ' R E D A CTED ': {}, | |
| 108 | ' REDA C TED ': {} | |
| 109 | }, | |
| 110 | jds: { | |
| 111 | protocol: 'http', | |
| 112 | host: ' IP ', | |
| 113 | port: PORT | |
| 114 | } | |
| 115 | }; | |
| 116 | var jdsC lientDummy = new Jds ClientDumm y(log, con fig); | |
| 117 | jdsClien tDummy._se tResponseD ata(null, null, null ); | |
| 118 | var envi ronment = { | |
| 119 | jds: jdsClient Dummy | |
| 120 | }; | |
| 121 | ||
| 122 | runs(fun ction() { | |
| 123 | hand ler.initia lOPDSync(l og, config , environm ent, funct ion(error) { | |
| 124 | expect(err or).toBeTr uthy(); | |
| 125 | expect(err or).toEqua l('FailedJ dsNoRespon se'); | |
| 126 | done = tru e; | |
| 127 | }); | |
| 128 | }); | |
| 129 | waitsFor (function( ) { | |
| 130 | retu rn done; | |
| 131 | }); | |
| 132 | }) ; | |
| 133 | it ('Error pa th: JDS re turns no r esult', fu nction() { | |
| 134 | var done = false; | |
| 135 | var conf ig = { | |
| 136 | vist aSites: { | |
| 137 | ' R E D A CTED ': {}, | |
| 138 | ' REDA C TED ': {} | |
| 139 | }, | |
| 140 | jds: { | |
| 141 | protocol: 'http', | |
| 142 | host: ' IP ', | |
| 143 | port: PORT | |
| 144 | } | |
| 145 | }; | |
| 146 | var jdsC lientDummy = new Jds ClientDumm y(log, con fig); | |
| 147 | jdsClien tDummy._se tResponseD ata(null, { | |
| 148 | stat usCode: 20 0 | |
| 149 | }, null) ; | |
| 150 | var envi ronment = { | |
| 151 | jds: jdsClient Dummy | |
| 152 | }; | |
| 153 | ||
| 154 | runs(fun ction() { | |
| 155 | hand ler.initia lOPDSync(l og, config , environm ent, funct ion(error) { | |
| 156 | expect(err or).toBeTr uthy(); | |
| 157 | expect(err or).toEqua l('FailedJ dsNoResult '); | |
| 158 | done = tru e; | |
| 159 | }); | |
| 160 | }); | |
| 161 | waitsFor (function( ) { | |
| 162 | retu rn done; | |
| 163 | }); | |
| 164 | }) ; | |
| 165 | it ('Error pa th: JDS re turns wron g status c ode', func tion() { | |
| 166 | var done = false; | |
| 167 | var conf ig = { | |
| 168 | vist aSites: { | |
| 169 | ' R E D A CTED ': {}, | |
| 170 | ' REDA C TED ': {} | |
| 171 | }, | |
| 172 | jds: { | |
| 173 | protocol: 'http', | |
| 174 | host: ' IP ', | |
| 175 | port: PORT | |
| 176 | } | |
| 177 | }; | |
| 178 | var jdsC lientDummy = new Jds ClientDumm y(log, con fig); | |
| 179 | jdsClien tDummy._se tResponseD ata(null, { | |
| 180 | stat usCode: 40 3 | |
| 181 | }, {}); | |
| 182 | var envi ronment = { | |
| 183 | jds: jdsClient Dummy | |
| 184 | }; | |
| 185 | ||
| 186 | runs(fun ction() { | |
| 187 | hand ler.initia lOPDSync(l og, config , environm ent, funct ion(error) { | |
| 188 | expect(err or).toBeTr uthy(); | |
| 189 | expect(err or).toEqua l('FailedJ dsWrongSta tusCode'); | |
| 190 | done = tru e; | |
| 191 | }); | |
| 192 | }); | |
| 193 | waitsFor (function( ) { | |
| 194 | retu rn done; | |
| 195 | }); | |
| 196 | }) ; | |
| 197 | it ('normal s cenario: o perational data sync starts', function() { | |
| 198 | var done = false; | |
| 199 | var conf ig = { | |
| 200 | vist aSites: { | |
| 201 | ' R E D A CTED ': {}, | |
| 202 | ' REDA C TED ': {} | |
| 203 | }, | |
| 204 | jds: { | |
| 205 | protocol: 'http', | |
| 206 | host: ' IP ', | |
| 207 | port: PORT | |
| 208 | } | |
| 209 | }; | |
| 210 | var jdsC lientDummy = new Jds ClientDumm y(log, con fig); | |
| 211 | jdsClien tDummy._se tResponseD ata(null, [{ | |
| 212 | stat usCode: 20 0 | |
| 213 | }, { | |
| 214 | stat usCode: 20 0 | |
| 215 | }], [{ | |
| 216 | 'inP rogress': sampleOpDa taStamp | |
| 217 | }, { | |
| 218 | 'inP rogress': sampleOpDa taStamp2 | |
| 219 | }]); | |
| 220 | var envi ronment = { | |
| 221 | publ isherRoute r: { | |
| 222 | publish: f unction(jo bsToPublis h, config, callback) { | |
| 223 | callba ck(null, ' success'); | |
| 224 | } | |
| 225 | }, | |
| 226 | jds: jdsClient Dummy | |
| 227 | }; | |
| 228 | ||
| 229 | spyOn(en vironment. publisherR outer, 'pu blish').an dCallThrou gh(); | |
| 230 | runs(fun ction() { | |
| 231 | hand ler.initia lOPDSync(l og, config , environm ent, funct ion(error) { | |
| 232 | expect(err or).toBeFa lsy(); | |
| 233 | //console. log(JSON.s tringify(e nvironment .publisher Router.pub lish.calls )); | |
| 234 | expect(env ironment.p ublisherRo uter.publi sh.calls). toBeTruthy (); | |
| 235 | expect(env ironment.p ublisherRo uter.publi sh.calls[0 ].args).to BeTruthy() ; | |
| 236 | expect(env ironment.p ublisherRo uter.publi sh.calls[0 ].args[0]) .toEqual({ | |
| 237 | "type" : "vista-o perational -subscribe -request", | |
| 238 | "site": " R E D A CTED " | |
| 239 | }); | |
| 240 | expect(env ironment.p ublisherRo uter.publi sh.calls[1 ].args).to BeTruthy() ; | |
| 241 | expect(env ironment.p ublisherRo uter.publi sh.calls[1 ].args[0]) .toEqual({ | |
| 242 | "type" : "vista-o perational -subscribe -request", | |
| 243 | "site": " REDA C TED " | |
| 244 | }); | |
| 245 | done = tru e; | |
| 246 | }); | |
| 247 | }); | |
| 248 | ||
| 249 | waitsFor (function( ) { | |
| 250 | retu rn done; | |
| 251 | }); | |
| 252 | }) ; | |
| 253 | it ('normal s cenario: o perational data alre ady synced for all s ites', fun ction() { | |
| 254 | var done = false; | |
| 255 | var conf ig = { | |
| 256 | vist aSites: { | |
| 257 | ' R E D A CTED ': {}, | |
| 258 | ' REDA C TED ': {} | |
| 259 | }, | |
| 260 | jds: { | |
| 261 | protocol: 'http', | |
| 262 | host: ' IP ', | |
| 263 | port: PORT | |
| 264 | } | |
| 265 | }; | |
| 266 | var jdsC lientDummy = new Jds ClientDumm y(log, con fig); | |
| 267 | jdsClien tDummy._se tResponseD ata(null, [{ | |
| 268 | stat usCode: 20 0 | |
| 269 | }, { | |
| 270 | stat usCode: 20 0 | |
| 271 | }], [{ | |
| 272 | 'com pletedStam p': sample OpDataStam p | |
| 273 | }, { | |
| 274 | 'com pletedStam p': sample OpDataStam p2 | |
| 275 | }]); | |
| 276 | var envi ronment = { | |
| 277 | publ isherRoute r: { | |
| 278 | publish: f unction(jo bsToPublis h, config, callback) { | |
| 279 | callba ck(null, ' success'); | |
| 280 | } | |
| 281 | }, | |
| 282 | jds: jdsClient Dummy | |
| 283 | }; | |
| 284 | ||
| 285 | spyOn(en vironment. publisherR outer, 'pu blish').an dCallThrou gh(); | |
| 286 | runs(fun ction() { | |
| 287 | hand ler.initia lOPDSync(l og, config , environm ent, funct ion(error) { | |
| 288 | expect(err or).toBeFa lsy(); | |
| 289 | //console. log(JSON.s tringify(e nvironment .publisher Router.pub lish.calls )); | |
| 290 | expect(env ironment.p ublisherRo uter.publi sh.calls.l ength).toE qual(0); | |
| 291 | done = tru e; | |
| 292 | }); | |
| 293 | }); | |
| 294 | ||
| 295 | waitsFor (function( ) { | |
| 296 | retu rn done; | |
| 297 | }); | |
| 298 | }) ; | |
| 299 | it ('normal s cenario: o perational data only synced fo r some sit es', funct ion() { | |
| 300 | var done = false; | |
| 301 | var conf ig = { | |
| 302 | vist aSites: { | |
| 303 | ' R E D A CTED ': {}, | |
| 304 | ' REDA C TED ': {} | |
| 305 | }, | |
| 306 | jds: { | |
| 307 | protocol: 'http', | |
| 308 | host: ' IP ', | |
| 309 | port: PORT | |
| 310 | } | |
| 311 | }; | |
| 312 | var jdsC lientDummy = new Jds ClientDumm y(log, con fig); | |
| 313 | jdsClien tDummy._se tResponseD ata(null, [{ | |
| 314 | stat usCode: 20 0 | |
| 315 | }, { | |
| 316 | stat usCode: 20 0 | |
| 317 | }], [{ | |
| 318 | 'com pletedStam p': sample OpDataStam p | |
| 319 | }, { | |
| 320 | 'inP rogress': sampleOpDa taStamp2 | |
| 321 | }]); | |
| 322 | var envi ronment = { | |
| 323 | publ isherRoute r: { | |
| 324 | publish: f unction(jo bsToPublis h, config, callback) { | |
| 325 | callba ck(null, ' success'); | |
| 326 | } | |
| 327 | }, | |
| 328 | jds: jdsClient Dummy | |
| 329 | }; | |
| 330 | ||
| 331 | spyOn(en vironment. publisherR outer, 'pu blish').an dCallThrou gh(); | |
| 332 | runs(fun ction() { | |
| 333 | hand ler.initia lOPDSync(l og, config , environm ent, funct ion(error) { | |
| 334 | expect(err or).toBeFa lsy(); | |
| 335 | //console. log(JSON.s tringify(e nvironment .publisher Router.pub lish.calls )); | |
| 336 | expect(env ironment.p ublisherRo uter.publi sh.calls.l ength).toE qual(1); | |
| 337 | expect(env ironment.p ublisherRo uter.publi sh.calls). toBeTruthy (); | |
| 338 | expect(env ironment.p ublisherRo uter.publi sh.calls[0 ].args).to BeTruthy() ; | |
| 339 | expect(env ironment.p ublisherRo uter.publi sh.calls[0 ].args[0]) .toEqual({ | |
| 340 | "type" : "vista-o perational -subscribe -request", | |
| 341 | "site": " REDA C TED " | |
| 342 | }); | |
| 343 | done = tru e; | |
| 344 | }); | |
| 345 | }); | |
| 346 | ||
| 347 | waitsFor (function( ) { | |
| 348 | retu rn done; | |
| 349 | }); | |
| 350 | }) ; | |
| 351 | }); | |
| 352 | ||
| 353 | descri be('doLoad ', functio n() { | |
| 354 | va r environm ent = { | |
| 355 | publishe rRouter: { | |
| 356 | chil dInstance: function( ) { return this; }, | |
| 357 | publ ish: funct ion(job, o ptions, ca llback) { | |
| 358 | callback() ; | |
| 359 | } | |
| 360 | } | |
| 361 | }; | |
| 362 | va r req = { | |
| 363 | param: fun ction() { return [' R E D A CTED ']; }, | |
| 364 | headers: { | |
| 365 | 'x-s ession-id' : 'session Id', | |
| 366 | 'x-r equest-id' : 'request Id' | |
| 367 | } | |
| 368 | }; | |
| 369 | va r res = { | |
| 370 | status: function() { | |
| 371 | retu rn this; | |
| 372 | }, | |
| 373 | send: ja smine.crea teSpy() | |
| 374 | }; | |
| 375 | it ('uses ref erenceInfo ', functio n() { | |
| 376 | spyOn(lo g, 'child' ).andCallT hrough(); | |
| 377 | runs(fun ction() { | |
| 378 | hand ler.doLoad (log, envi ronment, r eq, res); | |
| 379 | }); | |
| 380 | waitsFor (function( ) { | |
| 381 | retu rn res.sen d.calls; | |
| 382 | }); | |
| 383 | runs(fun ction() { | |
| 384 | expe ct(log.chi ld).toHave BeenCalled (); | |
| 385 | expe ct(log.chi ld).toHave BeenCalled With(jasmi ne.objectC ontaining( { | |
| 386 | 'sessionId ': 'sessio nId', | |
| 387 | 'requestId ': 'reques tId' | |
| 388 | })); | |
| 389 | }); | |
| 390 | }) ; | |
| 391 | }); | |
| 392 | }); |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.