838. EPMO Open Source Coordination Office Redaction File Detail Report

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.

838.1 Files compared

# Location File Last Modified
1 ehmp.zip\ehmp\ehmp\product\production\vx-sync\tests\integrationtests\handlers\jmeadows-document jmeadows-pdf-document-transform-handler-itest-spec.js Mon Jul 10 17:46:22 2017 UTC
2 ehmp.zip\ehmp\ehmp\product\production\vx-sync\tests\integrationtests\handlers\jmeadows-document jmeadows-pdf-document-transform-handler-itest-spec.js Tue Oct 3 12:49:01 2017 UTC

838.2 Comparison summary

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

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

838.4 Active regular expressions

No regular expressions were active.

838.5 Comparison detail

  1   'use stric t';
  2  
  3   require('. ./../../.. /env-setup ');
  4   var _ = re quire('und erscore');
  5   var wConfi g = requir e(global.V X_ROOT + ' worker-con fig');
  6   var realCo nfig = JSO N.parse(JS ON.stringi fy(wConfig ));             // Ma ke sure we  are not u sing a sha red copy o f this so  we can mak e changes  later and  not side e ffect some  other tes t.
  7  
  8   var fsUtil  = require (global.VX _UTILS + ' fs-utils') ;
  9   var jobUti ls = requi re(global. VX_UTILS +  'job-util s');
  10   var testHa ndler = re quire(glob al.VX_INTT ESTS + 'fr amework/ha ndler-test -framework ').testHan dler;
  11   var handle  = require (global.VX _HANDLERS  + 'jmeadow s-document /jmeadows- pdf-docume nt-transfo rm-handler ');
  12   var path =  require(' path');
  13   var val =  require(gl obal.VX_UT ILS + 'obj ect-utils' ).getPrope rty;
  14  
  15   var testCo nfig = req uire(globa l.VX_INTTE STS + 'tes t-config') ;
  16   var vx_syn c_ip = tes tConfig.vx syncIP;
  17  
  18   var dummyL ogger = re quire(glob al.VX_DUMM IES + '/du mmy-logger ');
  19   var VistaC lientDummy  = require (global.VX _DUMMIES +  'vista-cl ient-dummy ');
  20   var jobSta tusUpdater Dummy = re quire(glob al.VX_DUMM IES + '/Jo bStatusUpd aterDummy' );
  21  
  22   var config  = _.pick( realConfig , 'documen tStorage') ;
  23   config.doc umentStora ge.staging .path = co nfig.docum entStorage .staging.p ath.replac e(/vxsync/ , 'vxsync- test');
  24   config.doc umentStora ge.publish .path = co nfig.docum entStorage .publish.p ath.replac e(/vxsync/ , 'vxsync- test');
  25   config.doc umentStora ge.staging .path = pa th.resolve (config.do cumentStor age.stagin g.path);
  26   config.doc umentStora ge.publish .path = pa th.resolve (config.do cumentStor age.publis h.path);
  27  
  28   // dummyLo gger = req uire('buny an').creat eLogger({
  29   //     nam e: 'test',
  30   //     lev el: 'debug '
  31   // });
  32   // since t his checks  the local  file syst em, it can not work o n the VM
  33   // TODO: r eenable
  34   xdescribe( 'jmeadows- pdf-docume nt-transfo rm-handler .js', func tion() {
  35       var en vironment  = {
  36           vi staClient:  new Vista ClientDumm y(dummyLog ger, confi g, null),
  37           jo bStatusUpd ater: jobS tatusUpdat erDummy,
  38           pu blisherRou ter: {
  39                publish:  function( job, callb ack) {
  40                    expe ct(val(job , 'record' )).toBeDef ined();
  41                    call back(null,  job);
  42                }
  43           }
  44       };
  45       var fi leName = ' dummyDocum ent.pdf';
  46  
  47       before Each(funct ion() {
  48           fs Util.delet eAllFiles( config.doc umentStora ge.publish .path);
  49       });
  50       it('co nvert PDF  document',  function( ) {
  51           va r job = {
  52                patientI dentifier:  {
  53                    type : 'EDIPI',
  54                    valu e: '000000 03'
  55                },
  56                record:  {
  57                    file JobId: 0xb eefbeef,
  58                    file Id: fileNa me,
  59                    dodC omplexNote Uri: 'test ',
  60                    uid:  'urn:va:c onsult:DOD :000000000 8:10000011 22'
  61                }
  62           };
  63  
  64           va r filepath  = config. documentSt orage.stag ing.path +  '/' + job .record.fi leJobId +  '/' + file Name;
  65           va r handlerF inished =  false;
  66           ru ns(functio n() {
  67                fsUtil.c opyFile('. /tests/dat a/secondar y/jmeadows /dummyDocu ment.pdf',  filepath,  function( ) {});
  68           }) ;
  69  
  70           wa itsFor(fun ction() {
  71                var file  = filepat h; //confi g.document Storage.st aging.path +'/dummyDo cument.pdf ';
  72                var exis ts = fsUti l.fileExis tsSync(fil e);
  73                return e xists;
  74           },  'File cop y', 2000);
  75  
  76           ru ns(functio n() {
  77                handle(d ummyLogger , config,  environmen t, job, fu nction(err , result)  {
  78                    expe ct(err).to BeFalsy();
  79                    expe ct(result) .toBeDefin ed();
  80                    expe ct(val(res ult, 'reco rd')).toBe Defined();
  81                    expe ct(val(res ult, 'reco rd', 'file Id')).toBe Undefined( );
  82  
  83                    var  rtfPath =  config.doc umentStora ge.staging .path + '/ ' + fileNa me;
  84                    var  dirRegex =  /dir=([a- zA-Z0-9\/] +)/;
  85                    // c onsole.log (result.re cord);
  86                    var  matches =  dirRegex.e xec(result .record.do dComplexNo teUri);
  87                    expe ct(_.isArr ay(matches )).toBeTru thy();
  88                    expe ct(val(mat ches, 'len gth')).toE qual(2);
  89                    var  patientDir  = matches [1];
  90                    var  htmlFilena me = fileN ame.replac e(/\.pdf/,  '.html');
  91                    var  htmlPath =  config.do cumentStor age.publis h.path + ' /' + patie ntDir + '/ ' + htmlFi lename;
  92                    var  txtFilenam e = fileNa me.replace (/\.pdf/,  '.txt');
  93                    var  txtPath =  config.doc umentStora ge.publish .path + '/ ' + patien tDir + '/'  + txtFile name;
  94  
  95                    expe ct(fsUtil. fileExists Sync(rtfPa th)).not.t oBeTruthy( );
  96                    expe ct(fsUtil. fileExists Sync(htmlP ath)).toBe Truthy();
  97                    expe ct(fsUtil. fileExists Sync(txtPa th)).toBeF alsy();
  98                    hand lerFinishe d = true;
  99                });
  100           }) ;
  101           wa itsFor(fun ction() {
  102                return h andlerFini shed;
  103           },  'file con version',  10000);
  104       });
  105  
  106       it('co rrupted do cument pat hway: hand le corrupt ed PDF doc uments', f unction()  {
  107           va r job = {
  108                patientI dentifier:  {
  109                    type : 'EDIPI',
  110                    valu e: '000000 03'
  111                },
  112                record:  {
  113                    file JobId: 0xb eefbeef,
  114                    file Id: fileNa me,
  115                    dodC omplexNote Uri: 'test ',
  116                    uid:  'urn:va:c onsult:DOD :000000000 8:10000011 22'
  117                }
  118           };
  119  
  120           va r filepath  = config. documentSt orage.stag ing.path +  '/' + job .record.fi leJobId +  '/' + file Name;
  121           va r handlerF inished =  false;
  122           ru ns(functio n() {
  123                fsUtil.c opyFile('. /tests/dat a/secondar y/jmeadows /dummyCorr uptedDocum ent.pdf',  filepath,  function()  {});
  124           }) ;
  125  
  126           sp yOn(enviro nment.publ isherRoute r, 'publis h').andCal lThrough() ;
  127  
  128           wa itsFor(fun ction() {
  129                var file  = filepat h; //confi g.document Storage.st aging.path +'/dummyDo cument.pdf ';
  130                var exis ts = fsUti l.fileExis tsSync(fil e);
  131                return e xists;
  132           },  'File cop y', 2000);
  133  
  134           ru ns(functio n() {
  135                handle(d ummyLogger , config,  environmen t, job, fu nction(err , result)  {
  136                    expe ct(err).to BeFalsy();
  137                    if ( !err && re sult && re sult.recor d) {
  138                         expect(res ult).toBeD efined();
  139                         expect(val (result, ' record')). toBeDefine d();
  140                         expect(val (result, ' record', ' fileId')). toBeUndefi ned();
  141  
  142                         var rtfPat h = config .documentS torage.sta ging.path  + '/' + fi leName;
  143                         var dirReg ex = /dir= ([a-zA-Z0- 9\/]+)/;
  144                         // console .log(resul t.record);
  145                         var matche s = dirReg ex.exec(re sult.recor d.dodCompl exNoteUri) ;
  146                         expect(_.i sArray(mat ches)).toB eTruthy();
  147                         expect(val (matches,  'length')) .toEqual(2 );
  148                         var patien tDir = mat ches[1];
  149                         var htmlFi lename = f ileName.re place(/\.p df/, '.htm l');
  150                         var htmlPa th = confi g.document Storage.pu blish.path  + '/' + p atientDir  + '/' + ht mlFilename ;
  151                         var txtFil ename = fi leName.rep lace(/\.pd f/, '.txt' );
  152                         var txtPat h = config .documentS torage.pub lish.path  + '/' + pa tientDir +  '/' + txt Filename;
  153  
  154                         expect(fsU til.fileEx istsSync(r tfPath)).n ot.toBeTru thy();
  155                         expect(fsU til.fileEx istsSync(h tmlPath)). toBeTruthy ();
  156                         expect(fsU til.fileEx istsSync(t xtPath)).t oBeFalsy() ;
  157  
  158                         var corrup tedText =  '-Placehol der for a  DOD Patien t Document - Unfortun ately this  document  is corrupt ed and can not be dis played.  P lease repo rt it so t he problem  can be re ctified.';
  159  
  160                         //Check wh ether the  corrupted  document p ath was fo llowed by  looking at  the recor d.content
  161                         expect(val (environme nt, 'publi sherRouter ', 'publis h', 'calls ')).toBeTr uthy();
  162                         //console. log(JSON.s tringify(e nvironment .publisher Router.pub lish.calls ));
  163                         var publis hCalls = v al(environ ment, 'pub lisherRout er', 'publ ish', 'cal ls');
  164                         expect(val (publishCa lls, 0, 'a rgs')).toB eTruthy();
  165                         expect(val (publishCa lls, 0, 'a rgs', 0, ' record')). toBeTruthy ();
  166                         expect(val (publishCa lls, 0, 'a rgs', 0, ' record', ' text')).to BeTruthy() ;
  167                         expect(val (publishCa lls, 0, 'a rgs', 0, ' record', ' text', 0)) .toBeTruth y();
  168                         expect(val (publishCa lls, 0, 'a rgs', 0, ' record', ' text', 0,  'content') ).toEqual( corruptedT ext);
  169                    }
  170                    hand lerFinishe d = true;
  171                });
  172           }) ;
  173           wa itsFor(fun ction() {
  174                return h andlerFini shed;
  175           },  'file con version',  10000);
  176       });
  177  
  178       descri be('job ou tput', fun ction() {
  179           va r environm ent = {
  180                vistaCli ent: new V istaClient Dummy(dumm yLogger, c onfig, nul l),
  181                jobStatu sUpdater:  jobStatusU pdaterDumm y,
  182           };
  183           va r job = {
  184                patientI dentifier:  {
  185                    type : 'EDIPI',
  186                    valu e: '000000 03'
  187                },
  188                record:  {
  189                    file JobId: 0xd eadbeef,
  190                    file Id: fileNa me,
  191                    dodC omplexNote Uri: 'test ',
  192                    uid:  'urn:va:c onsult:DOD :000000000 8:10000011 22'
  193                }
  194           };
  195           va r filepath  = config. documentSt orage.stag ing.path +  '/' + job .record.fi leJobId +  '/dummyDoc ument.pdf' ;
  196           ru ns(functio n() {
  197                fsUtil.c opyFile('. /tests/dat a/secondar y/jmeadows /dummyDocu ment.pdf',  filepath,  function( ) {});
  198           }) ;
  199  
  200           wa itsFor(fun ction() {
  201                var file  = filepat h;
  202                var exis ts = fsUti l.fileExis tsSync(fil e);
  203                return e xists;
  204           },  'File cop y', 2000);
  205  
  206           va r host = v x_sync_ip;
  207             var port =   PORT ;
  208           va r tubename  = 'vx-syn c-test';
  209  
  210           va r jobTypes  = [jobUti ls.recordE nrichmentT ype()];
  211  
  212           te stHandler( handle, du mmyLogger,  config, e nvironment , host, po rt, tubena me, job, j obTypes);
  213       });
  214  
  215       afterE ach(functi on() {
  216           // Make sure  that the p ublish dir ectory is  clear afte r each tes t
  217           fs Util.delet eAllFiles( config.doc umentStora ge.publish .path);
  218       });
  219   });