189. EPMO Open Source Coordination Office Redaction File Detail Report

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

189.1 Files compared

# Location File Last Modified
1 ehmp.zip\ehmp\ehmp\product\production\NodeMockServices\mockHdrPubSub\tests\integrationtests mockHdr-itest-spec.js Tue Jan 10 16:20:50 2017 UTC
2 ehmp.zip\ehmp\ehmp\product\production\NodeMockServices\mockHdrPubSub\tests\integrationtests mockHdr-itest-spec.js Mon Oct 2 19:39:05 2017 UTC

189.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 4 836
Changed 3 6
Inserted 0 0
Removed 0 0

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

189.4 Active regular expressions

No regular expressions were active.

189.5 Comparison detail

  1   'use stric t';
  2  
  3   var reques t = requir e('request ');
  4   var _ = re quire('und erscore');
  5  
  6   var mocksV mIp = ' IP          ';
  7   var mockHd rPort = '8 999';
  8  
  9   var testPa tientLocal Id = '0';
  10   var testPa tientStati onNumber =  '547';
  11   var testPa tientSiteH ash = '76C 6';
  12   var querys tring = re quire('que rystring') ;
  13   var config  = require ('../../co nfig.js');
  14   var domain  = config. domains;
  15   //var uuid  = require ('node-uui d');
  16   var moment  = require ('moment') ;
  17  
  18  
  19   var pubsub Config = {
  20       "host": " IP          ",
  21     "port":  8999,
  22     "protoco l": "http" ,
  23       "path": "r epositorie s. URL         /fpds/vpr/ ",
  24     "server" : "HMPTest ",
  25     "clientN ame": "eHM P",
  26     "_type":  "json",
  27     "identif ier": "USV HA",
  28     "extract Schema": " 3.001",
  29     "maxBatc hSize": 50 0,
  30     "timeout ": 60000
  31   };
  32  
  33   function g etHDRBaseU rl () {
  34       return  pubsubCon fig.protoc ol + '://'  + pubsubC onfig.host  + ':' + p ubsubConfi g.port + ' /' + pubsu bConfig.pa th;
  35   }
  36  
  37   var queryP arams = {
  38       server : pubsubCo nfig.serve r,
  39       _type:  pubsubCon fig._type,
  40       client Name: pubs ubConfig.c lientName
  41   };
  42  
  43   var reques tId = 'ab6 e882b-2c54 -4434-9724 -30c9f89d4 2bc';
  44   var jobId  = 'jobId';
  45   var rootJo bId = 'roo tJobId';
  46   var resolv edIdentifi er = testP atientLoca lId + '-'  + testPati entStation Number + ' -USVHA';
  47   var pid =  testPatien tSiteHash  + ';' + te stPatientL ocalId;
  48  
  49   function g etUnsubscr ibeUrl() {
  50       var cl eanUpParam  = {
  51           re solvedIden tifier: re solvedIden tifier,
  52           re questId: r equestId,
  53           cl ientReques tInitiatio nTime: mom ent().form at()
  54       };
  55       return  getHDRBas eUrl() + ' cancel?' +  querystri ng.stringi fy(_.defau lts(cleanU pParam, qu eryParams) );
  56   }
  57  
  58   function g etSubscrib eUrl(domai nList) {
  59       var su bscribePar am = {
  60           re solvedIden tifier: re solvedIden tifier,
  61           re questId: r equestId,
  62           cl ientReques tInitiatio nTime: mom ent().form at(),
  63           ro otJobId: r ootJobId
  64       };
  65       if (do mainList)  {
  66           _. each(domai nList, fun ction(doma in){
  67                subscrib eParam['jo bDomainId- '+ domain]  = 'jobId- ' + domain ;
  68           }) ;
  69           su bscribePar am.HMPSVER S = 1;
  70       }
  71       else {
  72           su bscribePar am.jobId =  jobId;
  73       }
  74       return  getHDRBas eUrl() + ' subscribe? ' + querys tring.stri ngify(_.de faults(sub scribePara m, queryPa rams));
  75   }
  76  
  77   function g etPollUrl( ) {
  78       var su bscribePar am = {
  79           re questId: r equestId,
  80           cl ientReques tInitiatio nTime: mom ent().form at(),
  81           ex tractSchem a: pubsubC onfig.extr actSchema,
  82           la st: '31501 20-500',
  83           ma x: pubsubC onfig.maxB atchSize
  84       };
  85       return  getHDRBas eUrl() + ' patientdat a/' + test PatientSta tionNumber  + '?' + q uerystring .stringify (_.default s(subscrib eParam, qu eryParams) );
  86   }
  87   //Note: ru nning this  test will  leave the  test pati ent 0-547- USVHA in m ockHdr's m emory, but  it won't  be subscri bed.
  88  
  89   describe(' mockHdr en dpoint int egration t est', func tion() {
  90       var du mmyUnsolic itedUpdate Allergy =  {
  91           "l astUpdateT ime": 2015 0811104725 ,
  92           "u id": "urn: va:allergy :" + testP atientSite Hash + ':'  + testPat ientLocalI d + ":TEST ",
  93       };
  94  
  95       //Step s must be  done in or der
  96       it('Sm oke test:  clean up t est patien t, subscri be patient  to a site , poll for  data, sen d unsolici ted update , poll aga in, unsubs cribe', fu nction() {
  97           va r cleanUpD one, done1 , done2, d one3, done 4, done5 =  false;
  98           // Clean up
  99           re quest.post ({
  100                url: get Unsubscrib eUrl(),
  101           },  function( error, res ponse, bod y) {
  102                expect(e rror).toBe Falsy();
  103                expect(r esponse).t oBeTruthy( );
  104                expect(r esponse.st atusCode). toBe(200);
  105                cleanUpD one = true ;
  106           }) ;
  107  
  108           wa itsFor(fun ction() {
  109                return c leanUpDone ;
  110           }) ;
  111  
  112  
  113           // Subscribe  test patie nt
  114           re quest.post (getSubscr ibeUrl(),  function(e rror, resp onse, body ) {
  115                expect(e rror).toBe Falsy();
  116                expect(r esponse).t oBeTruthy( );
  117                var body JSON = JSO N.parse(bo dy);
  118                expect(b odyJSON.si tes).toBeT ruthy();
  119                expect(b odyJSON.si tes[0].wai tingPids). toContain( pid);
  120  
  121                done1 =  true;
  122           }) ;
  123  
  124           wa itsFor(fun ction() {
  125                return d one1;
  126           }) ;
  127  
  128           // Poll for p atient dat a
  129           re quest(getP ollUrl(),  function(e rror, resp onse, body ) {
  130                expect(e rror).toBe Falsy();
  131                expect(r esponse).t oBeTruthy( );
  132                var body JSON = JSO N.parse(bo dy);
  133                expect(b odyJSON.si tes).toBeT ruthy();
  134                expect(b odyJSON.si tes[0].dat a).toBeTru thy();
  135                expect(b odyJSON.si tes[0].dat a.items).t oBeTruthy( );
  136                expect(_ .isEmpty(b odyJSON.si tes[0].dat a.items)). toBe(false );
  137                done2 =  true;
  138           }) ;
  139  
  140           wa itsFor(fun ction() {
  141                return d one2;
  142           }) ;
  143  
  144           // Send unsol icited upd ate data
  145           re quest.post ({
  146                url: 'ht tp://' + m ocksVmIp +  ':' + moc kHdrPort +  '/update' ,
  147                body: du mmyUnsolic itedUpdate Allergy,
  148                json: tr ue
  149           },  function( error, res ponse, bod y) {
  150                expect(e rror).toBe Falsy();
  151                expect(r esponse).t oBeTruthy( );
  152                expect(r esponse.st atusCode). toBe(201);
  153                done3 =  true;
  154           }) ;
  155  
  156           wa itsFor(fun ction() {
  157                return d one3;
  158           }) ;
  159  
  160           // Poll for u nsolicited  update
  161           re quest(getP ollUrl(),  function(e rror, resp onse, body ) {
  162                expect(e rror).toBe Falsy();
  163                expect(r esponse).t oBeTruthy( );
  164                var body JSON = JSO N.parse(bo dy);
  165                expect(b odyJSON.si tes).toBeT ruthy();
  166                expect(b odyJSON.si tes[0].dat a).toBeTru thy();
  167                expect(b odyJSON.si tes[0].dat a.items).t oBeTruthy( );
  168                expect(_ .isEmpty(b odyJSON.si tes[0].dat a.items)). toBe(false );
  169                expect(_ .find(body JSON.sites [0].data.i tems, func tion(item) {
  170                    if(! item.objec t){return  false;}
  171                    retu rn item.ob ject.uid = == dummyUn solicitedU pdateAller gy.uid;
  172                })).toBe Truthy();
  173                done4 =  true;
  174           }) ;
  175  
  176           wa itsFor(fun ction() {
  177                return d one4;
  178           }) ;
  179  
  180           // Unsubscrib e
  181           re quest.post ({
  182                url: get Unsubscrib eUrl()
  183           },  function( error, res ponse, bod y) {
  184                expect(e rror).toBe Falsy();
  185                expect(r esponse).t oBeTruthy( );
  186                expect(r esponse.st atusCode). toBe(200);
  187                done5 =  true;
  188           }) ;
  189  
  190           wa itsFor(fun ction() {
  191                return d one5;
  192           }) ;
  193       });
  194  
  195       it('Ve rsion 1: S moke test:  clean up  test patie nt, subscr ibe patien t to a sit e, poll fo r data, se nd unsolic ited updat e, poll ag ain, unsub scribe', f unction()  {
  196           va r cleanUpD one, done1 , done2, d one3, done 4, done5 =  false;
  197  
  198           // Clean up
  199           re quest.post ({
  200                url: get Unsubscrib eUrl(),
  201           },  function( error, res ponse, bod y) {
  202                expect(e rror).toBe Falsy();
  203                expect(r esponse).t oBeTruthy( );
  204                expect(r esponse.st atusCode). toBe(200);
  205                cleanUpD one = true ;
  206           }) ;
  207  
  208           wa itsFor(fun ction() {
  209                return c leanUpDone ;
  210           }) ;
  211  
  212           // Subscribe  test patie nt V1
  213           re quest.post (getSubscr ibeUrl(dom ain), func tion(error , response , body) {
  214                expect(e rror).toBe Falsy();
  215                expect(r esponse).t oBeTruthy( );
  216                var body JSON = JSO N.parse(bo dy);
  217                expect(b odyJSON.si tes).toBeT ruthy();
  218                expect(b odyJSON.si tes[0].wai tingPids). toContain( pid);
  219                done1 =  true;
  220           }) ;
  221  
  222           wa itsFor(fun ction() {
  223                return d one1;
  224           }) ;
  225  
  226           // Poll for p atient dat a
  227           re quest(getP ollUrl(),  function(e rror, resp onse, body ) {
  228                expect(e rror).toBe Falsy();
  229                expect(r esponse).t oBeTruthy( );
  230                var body JSON = JSO N.parse(bo dy);
  231                expect(b odyJSON.si tes).toBeT ruthy();
  232                expect(b odyJSON.si tes[0].dat a).toBeTru thy();
  233                expect(b odyJSON.si tes[0].dat a.items).t oBeTruthy( );
  234                var item s = bodyJS ON.sites[0 ].data.ite ms;
  235                expect(_ .isEmpty(i tems)).toB e(false);
  236                var sync StartList  = _.where( items, {co llection:  "syncStart "});
  237                expect(s yncStartLi st).toBeTr uthy();
  238                expect(s yncStartLi st.length) .toEqual(d omain.leng th);
  239                done2 =  true;
  240           }) ;
  241  
  242           wa itsFor(fun ction() {
  243                return d one2;
  244           }) ;
  245  
  246           // Send unsol icited upd ate data
  247           re quest.post ({
  248                url: 'ht tp://' + m ocksVmIp +  ':' + moc kHdrPort +  '/update' ,
  249                body: du mmyUnsolic itedUpdate Allergy,
  250                json: tr ue
  251           },  function( error, res ponse, bod y) {
  252                expect(e rror).toBe Falsy();
  253                expect(r esponse).t oBeTruthy( );
  254                expect(r esponse.st atusCode). toBe(201);
  255                done3 =  true;
  256           }) ;
  257  
  258           wa itsFor(fun ction() {
  259                return d one3;
  260           }) ;
  261  
  262           // Poll for u nsolicited  update
  263           re quest(getP ollUrl(),  function(e rror, resp onse, body ) {
  264                expect(e rror).toBe Falsy();
  265                expect(r esponse).t oBeTruthy( );
  266                var body JSON = JSO N.parse(bo dy);
  267                expect(b odyJSON.si tes).toBeT ruthy();
  268                expect(b odyJSON.si tes[0].dat a).toBeTru thy();
  269                expect(b odyJSON.si tes[0].dat a.items).t oBeTruthy( );
  270                expect(_ .isEmpty(b odyJSON.si tes[0].dat a.items)). toBe(false );
  271                expect(_ .find(body JSON.sites [0].data.i tems, func tion(item) {
  272                    if(! item.objec t){return  false;}
  273                    retu rn item.ob ject.uid = == dummyUn solicitedU pdateAller gy.uid;
  274                })).toBe Truthy();
  275                done4 =  true;
  276           }) ;
  277  
  278           wa itsFor(fun ction() {
  279                return d one4;
  280           }) ;
  281  
  282           // Unsubscrib e
  283           re quest.post ({
  284                url: get Unsubscrib eUrl(),
  285           },  function( error, res ponse, bod y) {
  286                expect(e rror).toBe Falsy();
  287                expect(r esponse).t oBeTruthy( );
  288                expect(r esponse.st atusCode). toBe(200);
  289                done5 =  true;
  290           }) ;
  291  
  292           wa itsFor(fun ction() {
  293                return d one5;
  294           }) ;
  295       });
  296       it('Ve rsion 1: s ubscribe w ith specif ic domain  or domain  that does  not exits' , function () {
  297           va r cleanUpD one, done1 , done2, d one3, done 4, done5,  done6, don e7, done8  = false;
  298           va r nonExist Domain = ' foo';
  299           va r testDoma in = domai n.slice(0, 2);
  300           va r testDoma in1 = doma in.slice(0 ,2);
  301           te stDomain1. push(nonEx istDomain) ;
  302  
  303           // Clean up
  304           re quest.post ({
  305                url: get Unsubscrib eUrl(),
  306           },  function( error, res ponse, bod y) {
  307                expect(e rror).toBe Falsy();
  308                expect(r esponse).t oBeTruthy( );
  309                expect(r esponse.st atusCode). toBe(200);
  310                cleanUpD one = true ;
  311           }) ;
  312  
  313           wa itsFor(fun ction() {
  314                return c leanUpDone ;
  315           }) ;
  316  
  317           // Subscribe  test patie nt V1 with  two domai ns
  318           re quest.post (getSubscr ibeUrl(tes tDomain),  function(e rror, resp onse, body ) {
  319                expect(e rror).toBe Falsy();
  320                expect(r esponse).t oBeTruthy( );
  321                var body JSON = JSO N.parse(bo dy);
  322                expect(b odyJSON.si tes).toBeT ruthy();
  323                expect(b odyJSON.si tes[0].wai tingPids). toContain( pid);
  324                done1 =  true;
  325           }) ;
  326  
  327           wa itsFor(fun ction() {
  328                return d one1;
  329           }) ;
  330  
  331           // Poll for p atient dat a
  332           re quest(getP ollUrl(),  function(e rror, resp onse, body ) {
  333                expect(e rror).toBe Falsy();
  334                expect(r esponse).t oBeTruthy( );
  335                var body JSON = JSO N.parse(bo dy);
  336                expect(b odyJSON.si tes).toBeT ruthy();
  337                expect(b odyJSON.si tes[0].dat a).toBeTru thy();
  338                expect(b odyJSON.si tes[0].dat a.items).t oBeTruthy( );
  339                var item s = bodyJS ON.sites[0 ].data.ite ms;
  340                expect(_ .isEmpty(i tems)).toB e(false);
  341                var sync StartList  = _.where( items, {co llection:  "syncStart "});
  342                expect(s yncStartLi st).toBeTr uthy();
  343                expect(s yncStartLi st.length) .toEqual(t estDomain. length);
  344                done2 =  true;
  345           }) ;
  346  
  347           wa itsFor(fun ction() {
  348                return d one2;
  349           }) ;
  350  
  351           // Unsubscrib e
  352           re quest.post ({
  353                url: get Unsubscrib eUrl(),
  354           },  function( error, res ponse, bod y) {
  355                expect(e rror).toBe Falsy();
  356                expect(r esponse).t oBeTruthy( );
  357                expect(r esponse.st atusCode). toBe(200);
  358                done5 =  true;
  359           }) ;
  360  
  361           wa itsFor(fun ction() {
  362                return d one5;
  363           }) ;
  364  
  365           // Subscribe  test patie nt V1 with  a domain  does not e xit
  366           re quest.post (getSubscr ibeUrl(tes tDomain1),  function( error, res ponse, bod y) {
  367                expect(e rror).toBe Falsy();
  368                expect(r esponse).t oBeTruthy( );
  369                var body JSON = JSO N.parse(bo dy);
  370                expect(b odyJSON.si tes).toBeT ruthy();
  371                expect(b odyJSON.si tes[0].wai tingPids). toContain( pid);
  372                done6 =  true;
  373           }) ;
  374  
  375           wa itsFor(fun ction() {
  376                return d one6;
  377           }) ;
  378  
  379           // Poll for p atient dat a
  380           re quest(getP ollUrl(),  function(e rror, resp onse, body ) {
  381                expect(e rror).toBe Falsy();
  382                expect(r esponse).t oBeTruthy( );
  383                var body JSON = JSO N.parse(bo dy);
  384                expect(b odyJSON.si tes).toBeT ruthy();
  385                expect(b odyJSON.si tes[0].dat a).toBeTru thy();
  386                expect(b odyJSON.si tes[0].dat a.items).t oBeTruthy( );
  387                var item s = bodyJS ON.sites[0 ].data.ite ms;
  388                expect(_ .isEmpty(i tems)).toB e(false);
  389                var sync StartList  = _.where( items, {co llection:  "syncStart "});
  390                expect(s yncStartLi st).toBeTr uthy();
  391                expect(s yncStartLi st.length) .toEqual(t estDomain1 .length);
  392                console. log(syncSt artList);
  393                // now v erify that  foo domai n does not  have any  metaStamp  informatio n.
  394                var nonE xistSyncSt art = _.fi ndWhere(sy ncStartLis t, {jobId:  'jobId-'  + nonExist Domain});
  395                console. log(nonExi stSyncStar t);
  396                expect(_ .isObject( nonExistSy ncStart)). toBeTruthy ();
  397                console. log(nonExi stSyncStar t);
  398                // var e ventMetaSt amp = nonE xistSyncSt art.metaSt amp.source MetaStamp[ siteId].do mainMetaSt amp[domain ].eventMet aStamp;
  399                // expec t(eventMet aStamp).to BeDefined( );
  400                // expec t(_.isEmpt y(eventMet aStamp)).t oBeTruthy( );
  401                done7 =  true;
  402           }) ;
  403  
  404           wa itsFor(fun ction() {
  405                return d one7;
  406           }) ;
  407           // Unsubscrib e
  408           re quest.post ({
  409                url: get Unsubscrib eUrl(),
  410           },  function( error, res ponse, bod y) {
  411                expect(e rror).toBe Falsy();
  412                expect(r esponse).t oBeTruthy( );
  413                expect(r esponse.st atusCode). toBe(200);
  414                done8 =  true;
  415           }) ;
  416  
  417           wa itsFor(fun ction() {
  418                return d one8;
  419           }) ;
  420       });
  421   });