860. EPMO Open Source Coordination Office Redaction File Detail Report

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.

860.1 Files compared

# Location File Last Modified
1 ehmp.zip\ehmp\ehmp\product\production\vx-sync\tests\integrationtests\syncruleengine expiration-rule-itest-spec.js Tue Jan 10 16:20:50 2017 UTC
2 ehmp.zip\ehmp\ehmp\product\production\vx-sync\tests\integrationtests\syncruleengine expiration-rule-itest-spec.js Tue Oct 3 12:56:00 2017 UTC

860.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 2 486
Changed 1 4
Inserted 0 0
Removed 0 0

860.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

860.4 Active regular expressions

No regular expressions were active.

860.5 Comparison detail

  1   'use stric t';
  2  
  3   var _ = re quire('und erscore');
  4  
  5   require('. ./../../en v-setup');
  6   var SyncRu lesEngine  = require( global.VX_ SYNCRULES  + 'rules-e ngine');
  7   var JdsCli ent = requ ire(global .VX_SUBSYS TEMS + 'jd s/jds-clie nt');
  8   var wConfi g = requir e(global.V X_ROOT + ' worker-con fig');
  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: 'expira tion-rule- itest-spec ',
  13   //     lev el: 'debug '
  14   // });
  15  
  16   //-------- ---------- ---------- ---------- ---------- ---------- ---------- -
  17   // Create  an instanc e of the e nvironment  variable.
  18   //
  19   // config:   The conf ig object  to be used  in the en vironment.
  20   // returns : The envi ronment th at was cre ated.
  21   //-------- ---------- ---------- ---------- ---------- ---------- ---------- -
  22   function c reateEnvir onment(con fig) {
  23       var en vironment  = {
  24           jd s: new Jds Client(log , log, con fig),
  25           me trics: log
  26       };
  27  
  28       spyOn( environmen t.jds, 'ge tSimpleSyn cStatus'). andCallThr ough();
  29  
  30       return  environme nt;
  31   }
  32  
  33   //-------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- --
  34   // Create  the config  needed fo r the test s.
  35   //-------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- --
  36   function c reateConfi g() {
  37       var co nfig = {
  38           vi staSites:  {
  39                'AAAA':  {},
  40                'BBBB':  {}
  41           },
  42           jd s: _.defau lts(wConfi g.jds, {
  43                protocol : 'http',
  44                  host: ' IP          ',
  45                  port:  PORT
  46           }) ,
  47           ru les: {
  48                'expirat ion': {
  49                    'def ault': 300 000, // 5  minutes
  50                    'dod ': 60000,  // 1 minut e
  51                    'hdr ': 120000,  // 2 minu tes
  52                    'vle r': 180000  // 3 minu tes
  53                }
  54           },
  55           'h dr': {
  56                'operati onMode': ' REQ/RES'
  57           }
  58       };
  59       return  config;
  60   }
  61  
  62   //-------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---
  63   // This fu nction cre ates the p id based o n the site  and icn a nd returns  it.
  64   //
  65   // site: T he site fo r which th e pid is b eing creat ed.
  66   // icn: Th e ICN for  this patie nt.
  67   // dfn:  T he DFN to  use for th e VistA si tes.
  68   // edipi:  The edipi  to use for  DoD.
  69   // returns : The pid  that was c reated.
  70   //-------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---
  71   function c reatePid(s ite, icn,  dfn, edipi ) {
  72       var pa tientId =  '';
  73       if (si te === 'DO D') {
  74           pa tientId =  edipi;
  75       } else  if (_.con tains(['HD R', 'VLER' ], site))  {
  76           pa tientId =  icn;
  77       } else  {
  78           pa tientId =  dfn;
  79       }
  80  
  81       return  site + '; ' + patien tId;
  82   }
  83  
  84   //-------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- -----
  85   // Create  the set of  patientId entifiers  that will  be used fo r this tes ting.
  86   //
  87   // sites:  The sites  to create  the patien t identifi ers for.
  88   // icn: Th e ICN for  this patie nt.
  89   // jpid: T he JPID fo r this pat ient.
  90   // dfn:  T he DFN to  use for th e VistA si tes.
  91   // edipi:  The edipi  to use for  DoD.
  92   // returns : The pati entIdentif iers array .
  93   //-------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- -----
  94   function c reatePatie ntIdentifi ers(sites,  icn, jpid , dfn, edi pi) {
  95       var pa tientIdent ifiers = [ {
  96           't ype': 'icn ',
  97           'v alue': icn
  98       }, {
  99           't ype': 'pid ',
  100           'v alue': 'JP ID;' + jpi d
  101       }];
  102  
  103       _.each (sites, fu nction(sit e) {
  104           va r patientI dentifier  = {
  105                'type':  'pid',
  106                'value':  createPid (site, icn , dfn, edi pi)
  107           };
  108           pa tientIdent ifiers.pus h(patientI dentifier) ;
  109  
  110       });
  111  
  112  
  113       return  patientId entifiers;
  114   }
  115  
  116   //-------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------
  117   // This fu nction cre ates the s et of iden tifiers th at will be  stored in  JDS for t his
  118   // test pa tient.
  119   //
  120   // sites:  The sites  to put in  the patien t identifi er list.
  121   // returns : The pati ent identi fiers to b e stored t o JDS.
  122   //-------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------
  123   function c reateJDSPa tientIdent ifierList( sites, icn , dfn, edi pi) {
  124       var jd sPatientId entifiers  = {
  125           pa tientIdent ifiers: [i cn]
  126       };
  127  
  128       _.each (sites, fu nction(sit e) {
  129           va r pid = cr eatePid(si te, icn, d fn, edipi) ;
  130           jd sPatientId entifiers. patientIde ntifiers.p ush(pid);
  131       });
  132  
  133       return  jdsPatien tIdentifie rs;
  134   }
  135  
  136  
  137   //-------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---
  138   //  Store  a set of i dentifiers  so that w e can use  it for our  test.
  139   //
  140   //  jdsPat ientIdenti fiers:  Th e patient  identifier s to link  together i n JDS.
  141   //  enviro nment: The  environme nt informa tion to be  used.
  142   //  callba ck:  The c allback fu nction.
  143   //               func tion(error , jpid)
  144   //              Where :
  145   //                     error: Th e error th at occurre d.
  146   //                     jpid: The  jpid that  was creat ed by JDS  for these  identifier s.
  147   //-------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---
  148   function s toreJdsPat ientIdenti fiers(jdsP atientIden tifiers, e nvironment , callback ) {
  149       enviro nment.jds. storePatie ntIdentifi er(jdsPati entIdentif iers, func tion(error , response , result)  {
  150           ex pect(error ).toBeFals y();
  151           ex pect(respo nse).toBeT ruthy();
  152           ex pect(respo nse.status Code).toBe (201);
  153           ex pect(respo nse.header s).toBeTru thy();
  154           ex pect(respo nse.header s.location ).toBeTrut hy();
  155           ex pect(_.isS tring(resp onse.heade rs.locatio n)).toBe(t rue);
  156           ex pect(resul t).toBeFal sy();
  157  
  158           va r jpid = ' ';
  159           va r tokens =  response. headers.lo cation.spl it('jpid/' );
  160           if  ((tokens)  && (_.isA rray(token s)) && (to kens.lengt h === 2))  {
  161                jpid = t okens[1];
  162           }
  163           ex pect(jpid) .toBeTruth y();
  164  
  165           re turn callb ack(null,  jpid);
  166       });
  167   }
  168  
  169   describe(' expiration -rule-ites t', functi on() {
  170       it('Ru n expirati on rule on  unsynchro nized pati ent.', fun ction() {
  171           va r config =  createCon fig();
  172           va r environm ent = crea teEnvironm ent(config );
  173           va r sites =  ['AAAA', ' BBBB', 'DO D', 'HDR',  'VLER'];
  174           va r icn = '5 5555555555 5V55555555 55';
  175           va r dfn = '5 6565656';
  176           va r edipi =  '505050505 0';
  177           va r jdsPatie ntIdentifi ers = crea teJDSPatie ntIdentifi erList(sit es, icn, d fn, edipi) ;
  178  
  179           //  Store the  Identifie rs we will  need to u se.
  180           // ---------- ---------- ---------- ---------- ---
  181           va r finished JdsIdStore  = false;
  182           va r jpid = ' ';
  183           ru ns(functio n() {
  184                storeJds PatientIde ntifiers(j dsPatientI dentifiers , environm ent, funct ion(error,  assignedJ pid) {
  185                    expe ct(error). toBeFalsy( );
  186                    expe ct(assigne dJpid).toB eTruthy();
  187                    jpid  = assigne dJpid;
  188                    fini shedJdsIdS tore = tru e;
  189                });
  190           }) ;
  191  
  192           wa itsFor(fun ction() {
  193                return f inishedJds IdStore;
  194           }) ;
  195  
  196           //  Make our  call to ex piration r ules engin e.   In th is case, s ince no sy nc has bee n done on  the patien t, the rul es
  197           //  should re turn all e ntries for  this pati ent.
  198           // ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---
  199           va r engine =  new SyncR ulesEngine (log, conf ig, enviro nment);
  200           va r patientI dentifiers  = createP atientIden tifiers(si tes, icn,  jpid, dfn,  edipi);
  201           va r patientI dentifiers Expected =  createPat ientIdenti fiers(site s, icn, jp id, dfn, e dipi);
  202  
  203           va r finished RulesEngin eCall = fa lse;
  204           ru ns(functio n() {
  205                engine.g etSyncPati entIdentif iers(patie ntIdentifi ers, [], f unction(er ror, resul t) {
  206                    expe ct(error). toBeFalsy( );
  207                    expe ct(result) .toEqual(p atientIden tifiersExp ected);
  208                    fini shedRulesE ngineCall  = true;
  209                });
  210  
  211           }) ;
  212  
  213           wa itsFor(fun ction() {
  214                return f inishedRul esEngineCa ll;
  215           }) ;
  216  
  217  
  218           //  Clean up  what we cr eated...
  219           // ---------- ---------- ---------
  220           va r finished Cleanup =  false;
  221           ru ns(functio n() {
  222                environm ent.jds.de letePatien tByPid(pat ientIdenti fiers[0].v alue, func tion(error ) {
  223                    expe ct(error). toBeFalsy( );
  224                    fini shedCleanu p = true;
  225                });
  226           }) ;
  227  
  228           wa itsFor(fun ction() {
  229                return f inishedCle anup;
  230           },  10000);
  231       });
  232       // it( 'Run expir ation rule  on full s ynchronize d patient. ', functio n() {
  233       //      var finis hed = fals e;
  234       //      runs(func tion() {
  235       //          engin e.getSyncP atientIden tifiers(pa tientIdent ifiers, [] , function (error, id s) {
  236       //              e xpect(val( ids, 'leng th')).toBe (3);
  237       //              f inished =  true;
  238       //          });
  239       //      });
  240  
  241       //      waitsFor( function()  {
  242       //          retur n finished ;
  243       //      });
  244       // });
  245   });