Produced by Araxis Merge on 10/3/2017 11:16:01 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\endpoints\operational | operational-sync-endpoint-handler-itest-spec.js | Tue Jan 10 16:20:50 2017 UTC |
| 2 | ehmp.zip\ehmp\ehmp\product\production\vx-sync\tests\integrationtests\endpoints\operational | operational-sync-endpoint-handler-itest-spec.js | Tue Oct 3 12:43:18 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 3 | 590 |
| Changed | 2 | 8 |
| 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 | var _ = re quire('und erscore'); | |
| 4 | ||
| 5 | require('. ./../../.. /env-setup '); | |
| 6 | ||
| 7 | var handle r = requir e(global.V X_ENDPOINT S + '/oper ational/op erational- sync-endpo int-handle r'); | |
| 8 | ||
| 9 | var log = require(gl obal.VX_DU MMIES + 'd ummy-logge r'); | |
| 10 | // log = r equire('bu nyan').cre ateLogger( { | |
| 11 | // nam e: 'operat ional-sync -endpoint- handler-sp ec', | |
| 12 | // lev el: 'debug ' | |
| 13 | // }); | |
| 14 | ||
| 15 | var val = require(gl obal.VX_UT ILS + 'obj ect-utils' ).getPrope rty; | |
| 16 | var wConfi g = requir e(global.V X_ROOT + ' worker-con fig'); | |
| 17 | var JdsCli ent = requ ire(global .VX_SUBSYS TEMS + 'jd s/jds-clie nt'); | |
| 18 | ||
| 19 | describe(' operationa l-sync-end point-hand ler integr ation test ', functio n() { | |
| 20 | var op dStampAAAA = { | |
| 21 | 's tampTime': 201410310 94920, | |
| 22 | 's ourceMetaS tamp': { | |
| 23 | 'AAAA': { | |
| 24 | 'sta mpTime': 2 0141031094 920, | |
| 25 | 'dom ainMetaSta mp': { | |
| 26 | 'doc-def': { | |
| 27 | 'domai n': 'doc-d ef', | |
| 28 | 'stamp Time': 201 4103109492 0, | |
| 29 | 'itemM etaStamp': { | |
| 30 | 'u rn:va:doc- def:AAAA:1 001': { | |
| 31 | 'stampTi me': 20141 031094920, | |
| 32 | }, | |
| 33 | } | |
| 34 | }, | |
| 35 | 'pt-select ': { | |
| 36 | 'domai n': 'pt-se lect', | |
| 37 | 'stamp Time': 201 4103109492 0, | |
| 38 | 'itemM etaStamp': { | |
| 39 | 'u rn:va:pt-s elect:AAAA :1001': { | |
| 40 | 'stampTi me': 20141 031094920, | |
| 41 | } | |
| 42 | } | |
| 43 | } | |
| 44 | } | |
| 45 | } | |
| 46 | } | |
| 47 | }; | |
| 48 | var op dStampBBBB = { | |
| 49 | 's tampTime': 201410310 94920, | |
| 50 | 's ourceMetaS tamp': { | |
| 51 | 'BBBB': { | |
| 52 | 'sta mpTime': 2 0141031094 920, | |
| 53 | 'dom ainMetaSta mp': { | |
| 54 | 'pt-select ': { | |
| 55 | 'domai n': 'pt-se lect', | |
| 56 | 'stamp Time': 201 4103109492 0, | |
| 57 | 'itemM etaStamp': { | |
| 58 | 'u rn:va:pt-s elect:BBBB :1001': { | |
| 59 | 'stampTi me': 20141 031094920, | |
| 60 | } | |
| 61 | } | |
| 62 | } | |
| 63 | } | |
| 64 | } | |
| 65 | } | |
| 66 | }; | |
| 67 | var st oreDocDefM etadataAAA A = { | |
| 68 | 's ource': 'A AAA', | |
| 69 | 'u id': 'urn: va:doc-def :AAAA:1001 ', | |
| 70 | 'd omain': 'd oc-def', | |
| 71 | 'i temStamp': 201410310 94920 | |
| 72 | }; | |
| 73 | var st orePtSelec tMetadataA AAA = { | |
| 74 | 's ource': 'A AAA', | |
| 75 | 'u id': 'urn: va:pt-sele ct:AAAA:10 01', | |
| 76 | 'd omain': 'p t-select', | |
| 77 | 'i temStamp': 201410310 94920 | |
| 78 | }; | |
| 79 | var st orePtSelec tMetadataB BBB = { | |
| 80 | 's ource': 'B BBB', | |
| 81 | 'u id': 'urn: va:pt-sele ct:BBBB:10 01', | |
| 82 | 'd omain': 'p t-select', | |
| 83 | 'i temStamp': 201410310 94920 | |
| 84 | }; | |
| 85 | descri be('initia lOPDSync() ', functio n() { | |
| 86 | va r config = { | |
| 87 | vistaSit es: { | |
| 88 | 'AAA A': {}, | |
| 89 | 'BBB B': {} | |
| 90 | }, | |
| 91 | jds: _.d efaults(wC onfig.jds, { | |
| 92 | prot ocol: 'htt p', | |
| 93 | host: ' IP ', | |
| 94 | port: PORT | |
| 95 | }) | |
| 96 | }; | |
| 97 | be foreEach(f unction() { | |
| 98 | //Clear the metast amps for t he sites u sed in the se tests | |
| 99 | var jdsC lient = ne w JdsClien t(log, log , config); | |
| 100 | var done 1 = false; | |
| 101 | var done 2 = false; | |
| 102 | runs(fun ction() { | |
| 103 | jdsC lient.dele teOperatio nalSyncSta tus('AAAA' , function () { | |
| 104 | done1 = tr ue; | |
| 105 | }); | |
| 106 | jdsC lient.dele teOperatio nalSyncSta tus('BBBB' , function () { | |
| 107 | done2 = tr ue; | |
| 108 | }); | |
| 109 | }); | |
| 110 | waitsFor (function( ) { | |
| 111 | retu rn done1 & & done2; | |
| 112 | }); | |
| 113 | }) ; | |
| 114 | it ('normal p ath: subsc ribe OPD f or all sit es', funct ion() { | |
| 115 | var done = false; | |
| 116 | //var te stConfig = _.clone(c onfig); | |
| 117 | var jdsC lient = ne w JdsClien t(log, log , config); | |
| 118 | var envi ronment = { | |
| 119 | publ isherRoute r: { | |
| 120 | publish: f unction(jo bsToPublis h, config, callback) { | |
| 121 | callba ck(null, ' success'); | |
| 122 | } | |
| 123 | }, | |
| 124 | metr ics: log, | |
| 125 | jds: jdsClient | |
| 126 | }; | |
| 127 | //No met astamp in JDS | |
| 128 | spyOn(en vironment. publisherR outer, 'pu blish').an dCallThrou gh(); | |
| 129 | ||
| 130 | runs(fun ction() { | |
| 131 | hand ler.initia lOPDSync(l og, config , environm ent, funct ion(error) { | |
| 132 | expect(err or).toBeFa lsy(); | |
| 133 | //console. log(JSON.s tringify(e nvironment .publisher Router.pub lish.calls )); | |
| 134 | expect(env ironment.p ublisherRo uter.publi sh.calls). toBeTruthy (); | |
| 135 | expect(val (environme nt.publish erRouter.p ublish.cal ls, 0, 'ar gs')).toBe Truthy(); | |
| 136 | expect(val (environme nt.publish erRouter.p ublish.cal ls, 1, 'ar gs')).toBe Truthy(); | |
| 137 | ||
| 138 | var callAr gs = [val( environmen t.publishe rRouter.pu blish.call s, 0, 'arg s', 0), va l(environm ent.publis herRouter. publish.ca lls, 1, 'a rgs', 0)]; | |
| 139 | expect(cal lArgs).toC ontain({ | |
| 140 | 'type' : 'vista-o perational -subscribe -request', | |
| 141 | 'site' : 'AAAA' | |
| 142 | }); | |
| 143 | ||
| 144 | expect(cal lArgs).toC ontain({ | |
| 145 | 'type' : 'vista-o perational -subscribe -request', | |
| 146 | 'site' : 'BBBB' | |
| 147 | }); | |
| 148 | ||
| 149 | // expect( val(enviro nment.publ isherRoute r.publish. calls, 0, 'args', 0) ).toEqual( { | |
| 150 | // 'ty pe': 'vist a-operatio nal-subscr ibe-reques t', | |
| 151 | // 'si te': 'AAAA ' | |
| 152 | // }); | |
| 153 | // expect( val(enviro nment.publ isherRoute r.publish. calls, 1, 'args', 0) ).toEqual( { | |
| 154 | // 'ty pe': 'vist a-operatio nal-subscr ibe-reques t', | |
| 155 | // 'si te': 'BBBB ' | |
| 156 | // }); | |
| 157 | done = tru e; | |
| 158 | }); | |
| 159 | }); | |
| 160 | waitsFor (function( ) { | |
| 161 | retu rn done; | |
| 162 | }); | |
| 163 | }) ; | |
| 164 | it ('normal p ath: subsc ribe OPD f or only so me sites', function( ) { | |
| 165 | var done 1, done2, done3, don e4 = false ; | |
| 166 | //var te stConfig = _.clone(c onfig); | |
| 167 | var jdsC lient = ne w JdsClien t(log, log , config); | |
| 168 | var envi ronment = { | |
| 169 | publ isherRoute r: { | |
| 170 | publish: f unction(jo bsToPublis h, config, callback) { | |
| 171 | callba ck(null, ' success'); | |
| 172 | } | |
| 173 | }, | |
| 174 | metr ics: log, | |
| 175 | jds: jdsClient | |
| 176 | }; | |
| 177 | spyOn(en vironment. publisherR outer, 'pu blish').an dCallThrou gh(); | |
| 178 | //Send o perational metastamp s to JDS | |
| 179 | runs(fun ction() { | |
| 180 | envi ronment.jd s.saveOper ationalSyn cStatus(op dStampAAAA , 'AAAA', function() { | |
| 181 | done1 = tr ue; | |
| 182 | }); | |
| 183 | envi ronment.jd s.saveOper ationalSyn cStatus(op dStampBBBB , 'BBBB', function() { | |
| 184 | done2 = tr ue; | |
| 185 | }); | |
| 186 | }); | |
| 187 | waitsFor (function( ) { | |
| 188 | retu rn done1 & & done2; | |
| 189 | }); | |
| 190 | //Mark a ll items f or BBBB as stored | |
| 191 | runs(fun ction() { | |
| 192 | envi ronment.jd s._markOpe rationalIt emAsStored (storePtSe lectMetada taBBBB, fu nction() { | |
| 193 | done3 = tr ue; | |
| 194 | }); | |
| 195 | }); | |
| 196 | waitsFor (function( ) { | |
| 197 | retu rn done3; | |
| 198 | }); | |
| 199 | //test h andler usi ng framewo rk | |
| 200 | runs(fun ction() { | |
| 201 | hand ler.initia lOPDSync(l og, config , environm ent, funct ion(error) { | |
| 202 | expect(err or).toBeFa lsy(); | |
| 203 | //console. log(JSON.s tringify(e nvironment .publisher Router.pub lish.calls )); | |
| 204 | expect(env ironment.p ublisherRo uter.publi sh.calls). toBeTruthy (); | |
| 205 | expect(val (environme nt.publish erRouter.p ublish.cal ls, 0, 'ar gs')).toBe Truthy(); | |
| 206 | expect(val (environme nt.publish erRouter.p ublish.cal ls, 0, 'ar gs', 0)).t oEqual({ | |
| 207 | 'type' : 'vista-o perational -subscribe -request', | |
| 208 | 'site' : 'AAAA' | |
| 209 | }); | |
| 210 | expect(val (environme nt.publish erRouter.p ublish.cal ls, 'lengt h')).toEqu al(1); | |
| 211 | done4 = tr ue; | |
| 212 | }); | |
| 213 | }); | |
| 214 | waitsFor (function( ) { | |
| 215 | retu rn done4; | |
| 216 | }); | |
| 217 | }) ; | |
| 218 | it ('normal p ath: OPD a lready com plete', fu nction() { | |
| 219 | var done 1, done2, done3, don e4, done5, done6 = f alse; | |
| 220 | //var te stConfig = _.clone(c onfig); | |
| 221 | var jdsC lient = ne w JdsClien t(log, log , config); | |
| 222 | var envi ronment = { | |
| 223 | publ isherRoute r: { | |
| 224 | publish: f unction(jo bsToPublis h, config, callback) { | |
| 225 | callba ck(null, ' success'); | |
| 226 | } | |
| 227 | }, | |
| 228 | metr ics: log, | |
| 229 | jds: jdsClient | |
| 230 | }; | |
| 231 | spyOn(en vironment. publisherR outer, 'pu blish').an dCallThrou gh(); | |
| 232 | //Send o perational metastamp s to JDS | |
| 233 | runs(fun ction() { | |
| 234 | envi ronment.jd s.saveOper ationalSyn cStatus(op dStampAAAA , 'AAAA', function() { | |
| 235 | done1 = tr ue; | |
| 236 | }); | |
| 237 | envi ronment.jd s.saveOper ationalSyn cStatus(op dStampBBBB , 'BBBB', function() { | |
| 238 | done2 = tr ue; | |
| 239 | }); | |
| 240 | }); | |
| 241 | waitsFor (function( ) { | |
| 242 | retu rn done1 & & done2; | |
| 243 | }); | |
| 244 | //Mark a ll items f or AAAA an d BBBB as stored | |
| 245 | runs(fun ction() { | |
| 246 | envi ronment.jd s._markOpe rationalIt emAsStored (storeDocD efMetadata AAAA, func tion() { | |
| 247 | done3 = tr ue; | |
| 248 | }); | |
| 249 | envi ronment.jd s._markOpe rationalIt emAsStored (storePtSe lectMetada taAAAA, fu nction() { | |
| 250 | done4 = tr ue; | |
| 251 | }); | |
| 252 | envi ronment.jd s._markOpe rationalIt emAsStored (storePtSe lectMetada taBBBB, fu nction() { | |
| 253 | done5 = tr ue; | |
| 254 | }); | |
| 255 | }); | |
| 256 | waitsFor (function( ) { | |
| 257 | retu rn done3 & & done4 && done5; | |
| 258 | }); | |
| 259 | //test h andler usi ng framewo rk | |
| 260 | runs(fun ction() { | |
| 261 | hand ler.initia lOPDSync(l og, config , environm ent, funct ion(error) { | |
| 262 | expect(err or).toBeFa lsy(); | |
| 263 | //console. log(JSON.s tringify(e nvironment .publisher Router.pub lish.calls )); | |
| 264 | expect(val (environme nt.publish erRouter.p ublish.cal ls, 'lengt h')).toEqu al(0); | |
| 265 | done6 = tr ue; | |
| 266 | }); | |
| 267 | }); | |
| 268 | waitsFor (function( ) { | |
| 269 | retu rn done6; | |
| 270 | }); | |
| 271 | }) ; | |
| 272 | // it('error path?', f unction() {}); | |
| 273 | }); | |
| 274 | //Clea nup | |
| 275 | afterE ach(functi on() { | |
| 276 | va r config = { | |
| 277 | jds: _.d efaults(wC onfig.jds, { | |
| 278 | prot ocol: 'htt p', | |
| 279 | host: ' IP ', | |
| 280 | port: PORT | |
| 281 | }) | |
| 282 | }; | |
| 283 | // Clear the metastamps for the s ites used in these t ests | |
| 284 | va r jdsClien t = new Jd sClient(lo g, log, co nfig); | |
| 285 | va r done1 = false; | |
| 286 | va r done2 = false; | |
| 287 | ru ns(functio n() { | |
| 288 | jdsClien t.deleteOp erationalS yncStatus( 'AAAA', fu nction() { | |
| 289 | done 1 = true; | |
| 290 | }); | |
| 291 | jdsClien t.deleteOp erationalS yncStatus( 'BBBB', fu nction() { | |
| 292 | done 2 = true; | |
| 293 | }); | |
| 294 | }) ; | |
| 295 | wa itsFor(fun ction() { | |
| 296 | return d one1 && do ne2; | |
| 297 | }) ; | |
| 298 | }); | |
| 299 | }); |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.