910. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 10/3/2017 11:16:05 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.

910.1 Files compared

# Location File Last Modified
1 ehmp.zip\ehmp\ehmp\product\production\vx-sync\tests\unittests\utils solr-reindexing-util-spec.js Mon Jul 10 17:46:22 2017 UTC
2 ehmp.zip\ehmp\ehmp\product\production\vx-sync\tests\unittests\utils solr-reindexing-util-spec.js Tue Oct 3 13:34:09 2017 UTC

910.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 3 808
Changed 2 8
Inserted 0 0
Removed 0 0

910.3 Comparison options

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

910.4 Active regular expressions

No regular expressions were active.

910.5 Comparison detail

  1   'use stric t';
  2  
  3   require('. ./../../en v-setup');
  4  
  5   var logger  = require (global.VX _DUMMIES +  'dummy-lo gger');
  6   var JdsCli entDummy =  require(g lobal.VX_D UMMIES + ' jds-client -dummy');
  7   var PjdsCl ientDummy  = require( global.VX_ DUMMIES +  'pjds-clie nt-dummy') ;
  8  
  9   var solrSt ore = requ ire(global .VX_HANDLE RS + 'solr -record-st orage/solr -record-st orage-hand ler');
  10   var ReEnri chUtil = r equire(glo bal.VX_ROO T + './rec ord-update /utils/rec ord-re-enr ichment-ut il');
  11   var solrRe indexingUt il = requi re(global. VX_UTILS +  'solr-rei ndexing-ut il');
  12  
  13   var domain  = 'ehmp-a ctivity';
  14   var pid =  '9E7A;3';
  15   var icn =' 10110V0048 77';
  16  
  17   // var log ger = requ ire('bunya n').create Logger({
  18   //     nam e: 'solr-r eindexing- util',
  19   //     lev el: 'debug '
  20   // });
  21  
  22   var config  = {
  23       jds: {
  24       protoc ol: 'http' ,
  25         host: ' IP          ',
  26         port: ' PORT ',
  27       timeou t: 300000
  28       },
  29       pjds:  {
  30           pr otocol: 'h ttp',
  31             host: ' IP          ',
  32             port: ' PORT ',
  33           ti meout: 300 000
  34       },
  35       vistaS ites: {'9E 7A': {}, ' C877': {}}
  36   };
  37  
  38   function c reateEnvir onment(log , config)  {
  39       return  {
  40           jd s: new Jds ClientDumm y(log, con fig),
  41           pj ds: new Pj dsClientDu mmy(log, c onfig),
  42           me trics: log ger
  43       };
  44   }
  45  
  46   describe(' solr-reind exing-util ', functio n() {
  47       descri be('storeD ataToSolr' , function () {
  48          var  done;
  49  
  50          bef oreEach(fu nction() {
  51               spyOn(sol rStore, 'w ritebackWr apper').an dCallFake( function(l og, config , environm ent, domai n, domainR ecord, sto reCallback ) {
  52                   retur n setTimeo ut(storeCa llback, 0,  null, 'su ccess');
  53               });
  54  
  55               done = fa lse;
  56          });
  57  
  58          it( 'no domain  data to s tore', fun ction() {
  59               var envir onment = c reateEnvir onment(log ger, confi g);
  60  
  61               runs(func tion() {
  62                   solrR eindexingU til.storeD ataToSolr( logger, co nfig, envi ronment, d omain, [],  function( err, resul t) {
  63                       e xpect(solr Store.writ ebackWrapp er).not.to HaveBeenCa lled();
  64                       e xpect(err) .toBeFalsy ();
  65                       e xpect(resu lt).toBe(' Successful ly stored  all ehmp-a ctivity do main data  for patien t.');
  66  
  67                       d one = true ;
  68                   });
  69               });
  70  
  71               waitsFor( function()  { return  done; }, ' done', 200 );
  72          });
  73  
  74          it( 'undefined  data to s tore', fun ction() {
  75               var envir onment = c reateEnvir onment(log ger, confi g);
  76  
  77               runs(func tion() {
  78                   solrR eindexingU til.storeD ataToSolr( logger, co nfig, envi ronment, d omain, und efined, fu nction (er r, result)  {
  79                       e xpect(solr Store.writ ebackWrapp er).not.to HaveBeenCa lled();
  80                       e xpect(err) .toBeFalsy ();
  81                       e xpect(resu lt).toBe(' Successful ly stored  all ehmp-a ctivity do main data  for patien t.');
  82  
  83                       d one = true ;
  84                   });
  85               });
  86  
  87               waitsFor( function()  { return  done; }, ' done', 200 );
  88          });
  89  
  90          it( 'domain da ta stored' , function () {
  91               var envir onment = c reateEnvir onment(log ger, confi g);
  92               var dataI tems = [{} , {}];
  93  
  94               runs(func tion() {
  95                   solrR eindexingU til.storeD ataToSolr( logger, co nfig, envi ronment, d omain, dat aItems, fu nction (er r, result)  {
  96                       e xpect(solr Store.writ ebackWrapp er.calls.l ength).toB e(2);
  97                       e xpect(err) .toBeFalsy ();
  98                       e xpect(resu lt).toBe(' Successful ly stored  all ehmp-a ctivity do main data  for patien t.');
  99  
  100                       d one = true ;
  101                   });
  102               });
  103  
  104               waitsFor( function()  { return  done; }, ' done', 200 );
  105          });
  106       });
  107  
  108       descri be('create AndPublish SolrStoreJ ob', funct ion() {
  109           va r done;
  110           va r reEnrich Util;
  111  
  112           be foreEach(f unction()  {
  113                reEnrich Util = spy On(ReEnric hUtil.prot otype, 'wr iteJobsToB eanstalk') .andCallFa ke(functio n(log, job sToPublish , callback ) {
  114                    retu rn setTime out(callba ck, 0, nul l, 'succes s');
  115                });
  116  
  117                done = f alse;
  118           }) ;
  119  
  120           it ('no domai n data to  publish',  function()  {
  121                var envi ronment =  createEnvi ronment(lo gger, conf ig);
  122  
  123                runs(fun ction() {
  124                    solr Reindexing Util.creat eAndPublis hSolrStore Job(logger , config,  environmen t, domain,  [], funct ion(err, r esult) {
  125                         expect(reE nrichUtil) .not.toHav eBeenCalle d();
  126                         expect(err ).toBeFals y();
  127                         expect(res ult).toBe( 'Successfu lly publis hed all eh mp-activit y domain d ata jobs f or patient .');
  128  
  129                         done = tru e;
  130                    });
  131                });
  132  
  133                waitsFor (function( ) { return  done; },  'done', 20 0);
  134           }) ;
  135  
  136           it ('undefine d data to  publish',  function()  {
  137                var envi ronment =  createEnvi ronment(lo gger, conf ig);
  138  
  139                runs(fun ction() {
  140                    solr Reindexing Util.creat eAndPublis hSolrStore Job(logger , config,  environmen t, domain,  undefined , function  (err, res ult) {
  141                         expect(reE nrichUtil) .not.toHav eBeenCalle d();
  142                         expect(err ).toBeFals y();
  143                         expect(res ult).toBe( 'Successfu lly publis hed all eh mp-activit y domain d ata jobs f or patient .');
  144  
  145                         done = tru e;
  146                    });
  147                });
  148  
  149                waitsFor (function( ) { return  done; },  'done', 20 0);
  150           }) ;
  151  
  152           it ('domain d ata publis hed', func tion() {
  153                var envi ronment =  createEnvi ronment(lo gger, conf ig);
  154                var data Items = [{ pid: '9E7A ;3'}, {pat ientUid: ' urn:va:pat ient:ICN:1 0108V42087 1:10108V42 0871'}];
  155  
  156                runs(fun ction() {
  157                    solr Reindexing Util.creat eAndPublis hSolrStore Job(logger , config,  environmen t, domain,  dataItems , function  (err, res ult) {
  158                         expect(reE nrichUtil. calls.leng th).toBe(1 );
  159                         expect(reE nrichUtil. calls[0].a rgs[1].len gth).toBe( 2);
  160                         expect(err ).toBeFals y();
  161                         expect(res ult).toBe( 'Successfu lly publis hed all eh mp-activit y domain d ata jobs f or patient .');
  162  
  163                         done = tru e;
  164                    });
  165                });
  166  
  167                waitsFor (function( ) { return  done; },  'done', 20 0);
  168           }) ;
  169       });
  170  
  171       descri be('retrie veDomainDa ta', funct ion() {
  172           va r done;
  173  
  174           be foreEach(f unction()  {
  175                spyOn(so lrStore, ' writebackW rapper').a ndCallFake (function( log, confi g, environ ment, doma in, domain Record, st oreCallbac k) {
  176                    retu rn setTime out(storeC allback, 0 , null, 's uccess');
  177                });
  178  
  179                done =fa lse;
  180           }) ;
  181  
  182           it ('query re turned an  error', fu nction() {
  183                var envi ronment =  createEnvi ronment(lo gger, conf ig);
  184                var quer yFunction  = function (callback)  {
  185                    call back('Fail ed to conn ect');
  186                };
  187  
  188                runs(fun ction() {
  189                    solr Reindexing Util._retr ieveDomain Data(logge r, config,  environme nt, domain , pid, que ryFunction , solrRein dexingUtil .storeData ToSolr, fu nction(err , result)  {
  190                         expect(sol rStore.wri tebackWrap per).not.t oHaveBeenC alled();
  191                         expect(err ).toBeTrut hy();
  192                         expect(res ult).toBeF alsy();
  193  
  194                         done = tru e;
  195                    });
  196                });
  197  
  198                waitsFor (function( ) { return  done; },  'done', 20 0);
  199           }) ;
  200  
  201           it ('query re turned an  error resu lt', funct ion() {
  202                var envi ronment =  createEnvi ronment(lo gger, conf ig);
  203                var quer yFunction  = function (callback)  {
  204                    call back(null,  {statusCo de: 400, b ody: {erro r: 'invali d connecti on'}}, {er ror: 'inva lid connec tion'});
  205                };
  206  
  207                runs(fun ction() {
  208                    solr Reindexing Util._retr ieveDomain Data(logge r, config,  environme nt, domain , pid, que ryFunction , solrRein dexingUtil .storeData ToSolr, fu nction(err , result)  {
  209                         expect(sol rStore.wri tebackWrap per).not.t oHaveBeenC alled();
  210                         expect(err ).toBeTrut hy();
  211                         expect(res ult).toBeF alsy();
  212  
  213                         done = tru e;
  214                    });
  215                });
  216  
  217                waitsFor (function( ) { return  done; },  'done', 20 0);
  218           }) ;
  219  
  220           it ('query re turned no  data', fun ction() {
  221                var envi ronment =  createEnvi ronment(lo gger, conf ig);
  222                var quer yFunction  = function (callback)  {
  223                    call back(null,  {statusCo de: 200, b ody: {data : {items:  []}}}, {da ta: {items : []}});
  224                };
  225  
  226                runs(fun ction() {
  227                    solr Reindexing Util._retr ieveDomain Data(logge r, config,  environme nt, domain , pid, que ryFunction , solrRein dexingUtil .storeData ToSolr, fu nction(err , result)  {
  228                         expect(sol rStore.wri tebackWrap per).not.t oHaveBeenC alled();
  229                         expect(err ).toBeFals y();
  230                         expect(res ult).toBe( 'No ' + do main + ' d omain data  to store  for patien t.');
  231  
  232                         done = tru e;
  233                    });
  234                });
  235  
  236                waitsFor (function( ) { return  done; },  'done', 20 0);
  237           }) ;
  238  
  239           it ('query re turned dat a', functi on() {
  240                var envi ronment =  createEnvi ronment(lo gger, conf ig);
  241                var quer yFunction  = function (callback)  {
  242                    call back(null,  {statusCo de: 200, b ody: {data : {items:  [{}, {}]}} }, {data:  {items: [{ }, {}]}});
  243                };
  244  
  245                runs(fun ction() {
  246                    solr Reindexing Util._retr ieveDomain Data(logge r, config,  environme nt, domain , pid, que ryFunction , solrRein dexingUtil .storeData ToSolr, fu nction(err , result)  {
  247                         expect(sol rStore.wri tebackWrap per.calls. length).to Be(2);
  248                         expect(err ).toBeFals y();
  249                         expect(res ult).toBe( 'Successfu lly stored  all ehmp- activity d omain data  for patie nt.');
  250  
  251                         done = tru e;
  252                    });
  253                });
  254  
  255                waitsFor (function( ) { return  done; },  'done', 20 0);
  256           }) ;
  257       });
  258  
  259       descri be('getAll PatientIds ', functio n() {
  260           it ('error ge tting pids  by icn fr om jds', f unction()  {
  261                var envi ronment =  createEnvi ronment(lo gger, conf ig);
  262  
  263                environm ent.jds._s etResponse Data('Erro r connecti ng', null,  null);
  264  
  265                solrRein dexingUtil ._getAllPa tientIds(l ogger, con fig, envir onment, ic n, functio n(err, res ult) {
  266                    expe ct(err).to BeTruthy() ;
  267                    expe ct(result) .toBeFalsy ();
  268                });
  269           }) ;
  270  
  271           it ('error re turned by  JDS gettin g pids by  icn', func tion() {
  272                var envi ronment =  createEnvi ronment(lo gger, conf ig);
  273  
  274                environm ent.jds._s etResponse Data(null,  {statusCo de: 400},  {error: 'e rror'});
  275  
  276                solrRein dexingUtil ._getAllPa tientIds(l ogger, con fig, envir onment, ic n, functio n(err, res ult) {
  277                    expe ct(err).to BeTruthy() ;
  278                    expe ct(result) .toBeFalsy ();
  279                });
  280           }) ;
  281  
  282           it ('generate  multiple  patient uu ids when i cn used',  function()  {
  283                var envi ronment =  createEnvi ronment(lo gger, conf ig);
  284  
  285                environm ent.jds._s etResponse Data(null,  {statusCo de: 200},  {patientId entifiers:  ['9E7A;3' , 'C877;3' , 'WE3D;3' ]});
  286  
  287                solrRein dexingUtil ._getAllPa tientIds(l ogger, con fig, envir onment, ic n, functio n(err, res ult) {
  288                    expe ct(err).to BeFalsy();
  289                    expe ct(result. length).to Be(3);
  290                    expe ct(result) .toContain ('urn:va:p atient:C87 7:3:3');
  291                    expe ct(result) .toContain ('urn:va:p atient:9E7 A:3:3');
  292                    expe ct(result) .toContain ('urn:va:p atient:ICN :' + icn +  ':' + icn );
  293                    expe ct(result) .not.toCon tain('urn: va:patient :WE3D:3:3' );
  294                });
  295           }) ;
  296  
  297           it ('generate  patient u uids for p id', funct ion() {
  298                var envi ronment =  createEnvi ronment(lo gger, conf ig);
  299  
  300                solrRein dexingUtil ._getAllPa tientIds(l ogger, con fig, envir onment, pi d, functio n(err, res ult) {
  301                    expe ct(err).to BeFalsy();
  302                    expe ct(result) .toContain ('urn:va:p atient:9E7 A:3:3');
  303                    expe ct(result. length).to Be(1);
  304                });
  305           }) ;
  306       });
  307  
  308       descri be('buildP jdsDomainR etrievalTa sks', func tion() {
  309           it ('no tasks  created w hen there  are no pjd s domains' , function () {
  310                var envi ronment =  createEnvi ronment(lo gger, conf ig);
  311                var rein dexingCont ext = {pjd sDomains:  null, pati entId: pid };
  312  
  313                solrRein dexingUtil ._buildPjd sDomainRet rievalTask s(logger,  config, en vironment,  reindexin gContext,  function(e rr, result ) {
  314                    expe ct(err).to BeFalsy();
  315                    expe ct(result. length).to Be(0);
  316                });
  317           }) ;
  318  
  319           it ('no tasks  created w hen there  is a jds e rror retri eving pids  for an ic n', functi on() {
  320                var envi ronment =  createEnvi ronment(lo gger, conf ig);
  321                var rein dexingCont ext = {pjd sDomains:  [domain],  patientId:  icn};
  322  
  323                environm ent.jds._s etResponse Data('Erro r connecti ng', null,  null);
  324  
  325                solrRein dexingUtil ._buildPjd sDomainRet rievalTask s(logger,  config, en vironment,  reindexin gContext,  function(e rr, result ) {
  326                    expe ct(err).to BeTruthy() ;
  327                    expe ct(result) .toBeFalsy ();
  328                });
  329           }) ;
  330  
  331           it ('single t ask create d for a si ngle pid a nd a singl e pjds dom ain', func tion() {
  332                var envi ronment =  createEnvi ronment(lo gger, conf ig);
  333                var rein dexingCont ext = {pjd sDomains:  [domain],  patientId:  pid};
  334  
  335                solrRein dexingUtil ._buildPjd sDomainRet rievalTask s(logger,  config, en vironment,  reindexin gContext,  function(e rr, result ) {
  336                    expe ct(err).to BeFalsy();
  337                    expe ct(result. length).to Be(1);
  338                    expe ct(typeof  result[0]) .toBe('fun ction');
  339                });
  340           }) ;
  341  
  342           it ('multiple  task crea ted for an  inc and m ultiple pj ds domains ', functio n() {
  343                var envi ronment =  createEnvi ronment(lo gger, conf ig);
  344                var rein dexingCont ext = {pjd sDomains:  [domain, ' ehmp-med'] , patientI d: icn};
  345  
  346                environm ent.jds._s etResponse Data(null,  {statusCo de: 200},  {patientId entifiers:  [pid, icn ]});
  347  
  348                solrRein dexingUtil ._buildPjd sDomainRet rievalTask s(logger,  config, en vironment,  reindexin gContext,  function(e rr, result ) {
  349                    expe ct(err).to BeFalsy();
  350                    expe ct(result. length).to Be(4);
  351                    expe ct(typeof  result[0]) .toBe('fun ction');
  352                    expe ct(typeof  result[1]) .toBe('fun ction');
  353                    expe ct(typeof  result[2]) .toBe('fun ction');
  354                    expe ct(typeof  result[3]) .toBe('fun ction');
  355                });
  356           }) ;
  357       });
  358  
  359       descri be('buildJ dsDomainRe trievalTas ks', funct ion() {
  360           it ('no tasks  created w hen there  are no jds  domains',  function( ) {
  361                var envi ronment =  createEnvi ronment(lo gger, conf ig);
  362                var rein dexingCont ext = {jds Domains: n ull, patie ntId: pid} ;
  363  
  364                solrRein dexingUtil ._buildJds DomainRetr ievalTasks (logger, c onfig, env ironment,  reindexing Context, f unction(er r, result)  {
  365                    expe ct(err).to BeFalsy();
  366                    expe ct(result. length).to Be(0);
  367                });
  368           }) ;
  369  
  370           it ('single t ask create d for a si ngle pid a nd a singl e pjds dom ain', func tion() {
  371                var envi ronment =  createEnvi ronment(lo gger, conf ig);
  372                var rein dexingCont ext = {jds Domains: [ domain], p atientId:  pid};
  373  
  374                solrRein dexingUtil ._buildJds DomainRetr ievalTasks (logger, c onfig, env ironment,  reindexing Context, f unction(er r, result)  {
  375                    expe ct(err).to BeFalsy();
  376                    expe ct(result. length).to Be(1);
  377                    expe ct(typeof  result[0]) .toBe('fun ction');
  378                });
  379           }) ;
  380  
  381           it ('multiple  task crea ted for an  inc and m ultiple jd s domains' , function () {
  382                var envi ronment =  createEnvi ronment(lo gger, conf ig);
  383                var rein dexingCont ext = {jds Domains: [ domain, 'e hmp-med'],  patientId : icn};
  384  
  385                solrRein dexingUtil ._buildJds DomainRetr ievalTasks (logger, c onfig, env ironment,  reindexing Context, f unction(er r, result)  {
  386                    expe ct(err).to BeFalsy();
  387                    expe ct(result. length).to Be(2);
  388                    expe ct(typeof  result[0]) .toBe('fun ction');
  389                    expe ct(typeof  result[1]) .toBe('fun ction');
  390                });
  391           }) ;
  392       });
  393  
  394       descri be('proces sPatient',  function( ) {
  395           it ('process  one pjdsDo main with  no patient  data for  a pid', fu nction() {
  396                var envi ronment =  createEnvi ronment(lo gger, conf ig);
  397                var rein dexingCont ext = {jds Domains: n ull, pjdsD omains: [d omain], pa tientId: p id};
  398  
  399                environm ent.pjds._ setRespons eData(null , {statusC ode: 200},  {data: {i tems: []}} );
  400  
  401                solrRein dexingUtil .processPa tient(logg er, config , environm ent, reind exingConte xt, functi on(err, re sult) {
  402                    expe ct(err).to BeFalsy();
  403                    expe ct(result. length).to Be(1);
  404                    expe ct(result[ 0]).toBe(' No ehmp-ac tivity dom ain data t o store fo r patient. ');
  405                });
  406           }) ;
  407       });
  408   });