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\jds | JobStatusUpdater-spec.js | Mon Jul 10 17:46:22 2017 UTC |
| 2 | ehmp.zip\ehmp\ehmp\product\production\vx-sync\tests\unittests\subsystems\jds | JobStatusUpdater-spec.js | Tue Oct 3 13:22:21 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 332 |
| Changed | 1 | 4 |
| 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 | ||
| 5 | var JobSta tusUpdater = require (global.VX _SUBSYSTEM S + 'jds/J obStatusUp dater'); | |
| 6 | var JdsCli entDummy = require(g lobal.VX_D UMMIES + ' jds-client -dummy'); | |
| 7 | var logger = require (global.VX _DUMMIES + 'dummy-lo gger'); | |
| 8 | ||
| 9 | var config = { | |
| 10 | jds: { | |
| 11 | pr otocol: 'h ttp', | |
| 12 | host: ' IP ', | |
| 13 | port: PORT | |
| 14 | }, | |
| 15 | trackE rrorsByMet astamp: [' record-enr ichment', 'store-rec ord', 'sol r-record-s torage', ' event-prio ritization -request'] | |
| 16 | }; | |
| 17 | ||
| 18 | describe(' JobStatusU pdater.js' , function (){ | |
| 19 | var jo b, jobStat usUpdater; | |
| 20 | var jd s = new Jd sClientDum my(logger, config); | |
| 21 | ||
| 22 | before Each(funct ion() { | |
| 23 | jo bStatusUpd ater = new JobStatus Updater(lo gger, conf ig, jds); | |
| 24 | ||
| 25 | jo b = {rootJ obId: '212 ', jpid: ' 123'}; | |
| 26 | }); | |
| 27 | ||
| 28 | it('st oreMetaSta mpErrorEve nt for sol r job', fu nction(){ | |
| 29 | va r jdsSpy = spyOn(jds , 'setEven tStoreStat us').andCa llThrough( ); | |
| 30 | ||
| 31 | jo b.status = 'error'; | |
| 32 | jo b.type = ' solr-recor d-storage' ; | |
| 33 | jo b.record = {pid: '9E 7A;3', uid : '123', t imeStamp: 'now'}; | |
| 34 | ||
| 35 | jo bStatusUpd ater.error JobStatus( job, {erro r: 'connec tion faile d'}, funct ion(error, response, result) { | |
| 36 | expect(e rror).toBe Falsy(); | |
| 37 | expect(j ds.setEven tStoreStat us).toHave BeenCalled (); | |
| 38 | ||
| 39 | var stor eEventInfo = jdsSpy. mostRecent Call.args[ 1]; | |
| 40 | expect(s toreEventI nfo.type). toBe('solr Error'); | |
| 41 | }) ; | |
| 42 | }); | |
| 43 | ||
| 44 | it('st oreMetaSta mpErrorEve nt for sto re record job', func tion(){ | |
| 45 | va r jdsSpy = spyOn(jds , 'setEven tStoreStat us').andCa llThrough( ); | |
| 46 | ||
| 47 | jo b.status = 'error'; | |
| 48 | jo b.type = ' store-reco rd'; | |
| 49 | jo b.record = {pid: '9E 7A;3', uid : '123', t imeStamp: 'now'}; | |
| 50 | ||
| 51 | jo bStatusUpd ater.error JobStatus( job, {erro r: 'connec tion faile d'}, funct ion(error, response, result) { | |
| 52 | expect(e rror).toBe Falsy(); | |
| 53 | expect(j ds.setEven tStoreStat us).toHave BeenCalled (); | |
| 54 | ||
| 55 | var stor eEventInfo = jdsSpy. mostRecent Call.args[ 1]; | |
| 56 | expect(s toreEventI nfo.type). toBe('sync Error'); | |
| 57 | }) ; | |
| 58 | }); | |
| 59 | ||
| 60 | it('wr iteStatus fails for invalid jo bState', f unction(){ | |
| 61 | sp yOn(jds, ' saveJobSta te').andCa llThrough( ); | |
| 62 | va r invalidJ ob = ''; | |
| 63 | ||
| 64 | jo bStatusUpd ater.write Status(inv alidJob, f unction(er ror, respo nse, resul t) { | |
| 65 | expect(e rror).toBe ('Invalid job state' ); | |
| 66 | expect(j ds.saveJob State).not .toHaveBee nCalled(); | |
| 67 | }) ; | |
| 68 | }); | |
| 69 | ||
| 70 | it('wr iteStatus enterprise -sync-requ est job pe nding', fu nction(){ | |
| 71 | sp yOn(jds, ' saveJobSta te').andCa llThrough( ); | |
| 72 | ||
| 73 | jo b.status = 'started' ; | |
| 74 | jo b.type = ' enterprise -sync-requ est'; | |
| 75 | jo b.rootJobI d = undefi ned; | |
| 76 | jo b.jobId = '4567'; | |
| 77 | ||
| 78 | jo bStatusUpd ater.write Status(job , function (error, re sponse, re sult) { | |
| 79 | expect(e rror).toBe Falsy(); | |
| 80 | expect(j ds.saveJob State).toH aveBeenCal led(); | |
| 81 | expect(r esult.root JobId).toB e(result.j obId); | |
| 82 | expect(r esult.time stamp).toB eDefined() ; | |
| 83 | }) ; | |
| 84 | }); | |
| 85 | ||
| 86 | it('wr iteStatus does not s ave metast amp for st ated job', function( ){ | |
| 87 | sp yOn(jds, ' saveJobSta te').andCa llThrough( ); | |
| 88 | ||
| 89 | jo b.status = 'started' ; | |
| 90 | jo b.type = ' enterprise -sync-requ est'; | |
| 91 | jo b.record = {}; | |
| 92 | ||
| 93 | jo bStatusUpd ater.write Status(job , function (error, re sponse, re sult) { | |
| 94 | expect(e rror).toBe Falsy(); | |
| 95 | expect(j ds.saveJob State).not .toHaveBee nCalled(); | |
| 96 | }) ; | |
| 97 | }); | |
| 98 | ||
| 99 | it('er rorJobStat us for sol r job', fu nction(){ | |
| 100 | sp yOn(jobSta tusUpdater , 'storeMe taStampErr orEvent'). andCallThr ough(); | |
| 101 | sp yOn(jobSta tusUpdater , 'writeSt atus').and CallThroug h(); | |
| 102 | ||
| 103 | jo b.status = 'error'; | |
| 104 | jo b.type = ' solr-recor d-storage' ; | |
| 105 | jo b.record = {pid: '9E 7A;3', uid : '123', t imeStamp: 'now'}; | |
| 106 | ||
| 107 | jo bStatusUpd ater.error JobStatus( job, {erro r: 'connec tion faile d'}, funct ion(error, response, result) { | |
| 108 | expect(e rror).toBe Falsy(); | |
| 109 | expect(r esult.stat us).toBe(' error'); | |
| 110 | expect(j obStatusUp dater.writ eStatus).n ot.toHaveB eenCalled( ); | |
| 111 | expect(j obStatusUp dater.stor eMetaStamp ErrorEvent ).toHaveBe enCalled() ; | |
| 112 | }) ; | |
| 113 | }); | |
| 114 | ||
| 115 | it('er rorJobStat us for job ', functio n(){ | |
| 116 | sp yOn(jobSta tusUpdater , 'storeMe taStampErr orEvent'). andCallThr ough(); | |
| 117 | sp yOn(jobSta tusUpdater , 'writeSt atus').and CallThroug h(); | |
| 118 | ||
| 119 | jo b.status = 'error'; | |
| 120 | jo b.type = ' x'; | |
| 121 | ||
| 122 | jo bStatusUpd ater.error JobStatus( job, {erro r: 'connec tion faile d'}, funct ion(error, response, result) { | |
| 123 | expect(e rror).toBe Falsy(); | |
| 124 | expect(r esult.stat us).toBe(' error'); | |
| 125 | expect(j obStatusUp dater.writ eStatus).t oHaveBeenC alled(); | |
| 126 | expect(j obStatusUp dater.stor eMetaStamp ErrorEvent ).not.toHa veBeenCall ed(); | |
| 127 | }) ; | |
| 128 | }); | |
| 129 | ||
| 130 | it('cr eateJobSta tus is wri tten', fun ction(){ | |
| 131 | sp yOn(jobSta tusUpdater , 'writeSt atus').and CallThroug h(); | |
| 132 | ||
| 133 | jo b.status = 'created' ; | |
| 134 | jo b.type = ' x'; | |
| 135 | ||
| 136 | jo bStatusUpd ater.creat eJobStatus (job, func tion(error , response , result) { | |
| 137 | expect(e rror).toBe Falsy(); | |
| 138 | expect(r esult.stat us).toBe(' created'); | |
| 139 | expect(j obStatusUp dater.writ eStatus).t oHaveBeenC alled(); | |
| 140 | }) ; | |
| 141 | }); | |
| 142 | ||
| 143 | it('st artJobStat us is writ ten', func tion(){ | |
| 144 | sp yOn(jobSta tusUpdater , 'writeSt atus').and CallThroug h(); | |
| 145 | ||
| 146 | jo b.status = 'started' ; | |
| 147 | jo b.type = ' x'; | |
| 148 | ||
| 149 | jo bStatusUpd ater.start JobStatus( job, funct ion(error, response, result) { | |
| 150 | expect(e rror).toBe Falsy(); | |
| 151 | expect(r esult.stat us).toBe(' started'); | |
| 152 | expect(j obStatusUp dater.writ eStatus).t oHaveBeenC alled(); | |
| 153 | }) ; | |
| 154 | }); | |
| 155 | ||
| 156 | it('co mpleteJobS tatus is w ritten', f unction(){ | |
| 157 | sp yOn(jobSta tusUpdater , 'writeSt atus').and CallThroug h(); | |
| 158 | ||
| 159 | jo b.status = 'started' ; | |
| 160 | jo b.type = ' x'; | |
| 161 | ||
| 162 | jo bStatusUpd ater.start JobStatus( job, funct ion(error, response, result) { | |
| 163 | expect(e rror).toBe Falsy(); | |
| 164 | expect(r esult.stat us).toBe(' started'); | |
| 165 | expect(j obStatusUp dater.writ eStatus).t oHaveBeenC alled(); | |
| 166 | }) ; | |
| 167 | }); | |
| 168 | }); |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.