58. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 3/1/2018 12:13:15 PM Central Standard 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.

58.1 Files compared

# Location File Last Modified
1 ehealth_xchange_cif.zip\NHIN_adapter\AdapterEJB\src\test\java\gov\va\med\nhin\adapter\patientdiscovery AdapterPatientDiscoveryTest.java Thu Feb 22 14:26:18 2018 UTC
2 ehealth_xchange_cif.zip\NHIN_adapter\AdapterEJB\src\test\java\gov\va\med\nhin\adapter\patientdiscovery AdapterPatientDiscoveryTest.java Tue Feb 27 14:25:03 2018 UTC

58.2 Comparison summary

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

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

58.4 Active regular expressions

No regular expressions were active.

58.5 Comparison detail

  1   /*
  2    * To chan ge this li cense head er, choose  License H eaders in  Project Pr operties.
  3    * To chan ge this te mplate fil e, choose  Tools | Te mplates
  4    * and ope n the temp late in th e editor.
  5    */
  6   package go v.va.med.n hin.adapte r.patientd iscovery;
  7   import gov .hhs.fha.n hinc.adapt erpolicyen gine.Adapt erPolicyEn ginePortTy pe;
  8   import gov .hhs.fha.n hinc.entit ydocquery. EntityDocQ ueryPortTy pe;
  9   import gov .hhs.fha.n hinc.entit ydocretrie ve.EntityD ocRetrieve PortType;
  10   import gov .hhs.fha.n hinc.patie ntdb.model .Patient;
  11   import gov .va.med.nh in.adapter .adapterga teway.Fake TestingAda pterPolicy Engine;
  12   import gov .va.med.nh in.adapter .adapterga teway.Test Utils;
  13   import gov .va.med.nh in.adapter .audit.Aud it;
  14   import gov .va.med.nh in.adapter .audit.Aud itManager;
  15   import gov .va.med.nh in.adapter .documentr epository. Document;
  16   import gov .va.med.nh in.adapter .documentr epository. DocumentRe pository;
  17   import gov .va.med.nh in.adapter .facilitym anager.Fac ility;
  18   import gov .va.med.nh in.adapter .facilitym anager.Fac ilityManag er;
  19   import gov .va.med.nh in.adapter .facilitym anager.Ope rationOnOf f;
  20   import gov .va.med.nh in.adapter .mvi.Adapt erMviPortT ypeLocal;
  21   import gov .va.med.nh in.adapter .patientco rrelation. PatientCor relationPo rtTypeLoca l;
  22   import gov .va.med.nh in.adapter .propertyl ookup.Prop ertyLookup ;
  23   import gov .va.med.nh in.adapter .utils.das .DasDAO;
  24   import gov .va.med.nh in.adapter .utils.das .DasOperat ionSendACP DocumentRe quest;
  25   import gov .va.med.nh in.adapter .utils.das .DasOperat ionSendACP DocumentRe sponse;
  26   import gov .va.nvap.p rivacy.Con sentDirect iveQueryRe questType;
  27   import gov .va.nvap.p rivacy.Con sentDirect iveQueryRe sponseType ;
  28   import ihe .iti.xds_b ._2007.Ret rieveDocum entSetResp onseType;
  29   import ihe .iti.xds_b ._2007.Ret rieveDocum entSetResp onseType.D ocumentRes ponse;
  30   import jav a.io.File;
  31   import jav a.sql.Time stamp;
  32   import jav a.util.Bas e64;
  33   import jav a.util.Has hMap;
  34   import jav a.util.Map ;
  35   import jav a.util.Pro perties;
  36   import jav ax.activat ion.DataHa ndler;
  37   import jav ax.xml.bin d.JAXBCont ext;
  38   import jav ax.xml.bin d.Unmarsha ller;
  39   import oas is.names.t c.ebxml_re grep.xsd.q uery._3.Ad hocQueryRe sponse;
  40   import oas is.names.t c.xacml._2 _0.context .schema.os .DecisionT ype;
  41   import org .apache.co mmons.io.F ileUtils;
  42   import org .hl7.fhir. dstu3.mode l.AuditEve nt;
  43   import org .hl7.v3.Ad dPatientCo rrelationR equestType ;
  44   import org .hl7.v3.II ;
  45   import org .hl7.v3.PR PAIN201305 UV02;
  46   import org .hl7.v3.PR PAIN201306 UV02;
  47   import org .hl7.v3.Re spondingGa tewayPRPAI N201305UV0 2RequestTy pe;
  48   import org .jmock.Exp ectations;
  49   import sta tic org.jm ock.Expect ations.any ;
  50   import org .jmock.Moc kery;
  51   import org .jmock.int egration.j unit4.JUni t4Mockery;
  52   import org .junit.Aft er;
  53   import org .junit.Bef ore;
  54   import org .junit.Bef oreClass;
  55   import org .junit.Tes t;
  56   import sta tic org.ju nit.Assert .*;
  57   import pri vacy.servi ce.nvap. DNS     .ConsentMa nagementPo rtType;
  58  
  59   /**
  60    *
  61    * @author  alok.sube di
  62    */
  63   public cla ss Adapter PatientDis coveryTest  {
  64  
  65       privat e static f inal Strin g TEST_DIR  = "src/te st/resourc es";
  66       privat e static f inal File  REQUEST_FI LE = new F ile(TEST_D IR, "patie nt_discove ry_request .xml");
  67       privat e static f inal File  DOCUMENT =  new File( TEST_DIR,  "document. txt");
  68       //priv ate static  final Fil e CORRELAT ION_RESPON SE = new F ile(TEST_D IR, "corre lations-re sponse.xml ");
  69       privat e static f inal File  RESPONSE_F ILE_MPI =  new File(T EST_DIR, " test-prpa_ in201306uv 02-match-r esponse-mp i.xml");
  70       privat e static f inal File  RESPONSE_F ILE = new  File(TEST_ DIR, "pati ent_discov ery_respon se.xml");
  71  
  72       privat e Mockery  context;
  73       privat e AdapterP atientDisc overy inst ance;
  74  
  75       public  AdapterPa tientDisco veryTest()  {
  76       }
  77  
  78       @Befor e
  79       public  void setU p() {
  80           th is.context  = new JUn it4Mockery ();
  81           th is.instanc e = new Ad apterPatie ntDiscover y();
  82       }
  83  
  84       @Befor eClass
  85       public  static vo id setUpCl ass() {
  86           Sy stem.setPr operty("ja vax.xml.pa rsers.SAXP arserFacto ry",
  87                    "com .sun.org.a pache.xerc es.interna l.jaxp.SAX ParserFact oryImpl");
  88       }
  89  
  90       @After
  91       public  void tear Down() {
  92       }
  93  
  94       /**
  95        * Tes t of respo ndingGatew ayPRPAIN20 1305UV02 m ethod, of  class
  96        * Ada pterPatien tDiscovery .
  97        */
  98       @Test
  99       public  void ok() {}
  100                    // @ Test
  101                    publ ic void te stRespondi ngGatewayP RPAIN20130 5UV02() th rows Excep tion {
  102           JA XBContext  jaxb = JAX BContext.n ewInstance (Respondin gGatewayPR PAIN201305 UV02Reques tType.clas s, PRPAIN2 01305UV02. class);
  103           Un marshaller  unm = jax b.createUn marshaller ();
  104  
  105           fi nal Respon dingGatewa yPRPAIN201 305UV02Req uestType r equest = T estUtils.f ileToPojo( REQUEST_FI LE, Respon dingGatewa yPRPAIN201 305UV02Req uestType.c lass, unm) ;
  106           fi nal PRPAIN 201306UV02  mviResult s = TestUt ils.fileTo Pojo(RESPO NSE_FILE_M PI, PRPAIN 201306UV02 .class, un m);
  107  
  108           fi nal Adapte rMviPortTy peLocal ad apterMvi =  context.m ock(Adapte rMviPortTy peLocal.cl ass);
  109           fi nal Patien tCorrelati onPortType Local pati entCorrela tion = con text.mock( PatientCor relationPo rtTypeLoca l.class);
  110           fi nal Adapte rPolicyEng inePortTyp e policyEn gine = new  FakeTesti ngAdapterP olicyEngin e(Decision Type.PERMI T);
  111           fi nal Consen tManagemen tPortType  consentMan agement =  context.mo ck(Consent Management PortType.c lass);
  112           fi nal Facili tyManager  facilityMa nager = co ntext.mock (FacilityM anager.cla ss);
  113           fi nal Proper tyLookup p ropertyLoo kup = cont ext.mock(P ropertyLoo kup.class) ;
  114           fi nal AuditM anager aud itManager  = context. mock(Audit Manager.cl ass);
  115           fi nal Docume ntReposito ry documen tRepositor y = contex t.mock(Doc umentRepos itory.clas s);
  116           fi nal Entity DocQueryPo rtType ent ityDocQuer y = contex t.mock(Ent ityDocQuer yPortType. class);
  117           fi nal Entity DocRetriev ePortType  entityDocR etrieve =  context.mo ck(EntityD ocRetrieve PortType.c lass);
  118           fi nal DasDAO  dasDAO =  context.mo ck(DasDAO. class);
  119  
  120           fi nal String  partnerHc id = "urn: oid:2.16.8 40.1.11388 3.3.184.6. 1";
  121  
  122           Pa tient pati ent = new  Patient();
  123           pa tient.setP atientId(1 L);
  124           pa tient.setG ender("mal e");
  125           pa tient.setD ateOfBirth (new Times tamp(Syste m.currentT imeMillis( )));
  126           
  127           II  patientId  = new II( );
  128           pa tientId.se tRoot("2.2 ");
  129           pa tientId.se tExtension ("12345678 90V123456" );
  130           mv iResults.s etId(patie ntId);
  131  
  132           fi nal Map<Ob ject, Obje ct> search ResultMap  = new Hash Map<>();
  133           se archResult Map.put("P RPAIN20130 6UV02", mv iResults);
  134           se archResult Map.put("S EARCH_RESU LT_PATIENT ", patient );
  135  
  136           fi nal String  sendingHC ID = "2.16 .840.1.113 883.3.184. 6.1";
  137           fi nal String  fullHCID  = "urn:oid :2.16.840. 1.113883.3 .184.6.1";
  138           fi nal String  sendingFa cilityNumb er = "200N SS";
  139           fi nal String  vaHCID =  "2.16.840. 1.113883.4 .349.1";
  140           fi nal String  soid = "2 .16.840.1. 113883.4.3 49";
  141  
  142           fi nal Proper ties props  = new Pro perties();
  143           pr ops.setPro perty("Hom eCommunity Id", vaHCI D);
  144           pr ops.setPro perty("exc ludePatien tDiscovery Sections",  "0");
  145           pr ops.setPro perty("vle r.das.eaut hsubmit.ur l", "http: //MOCK-HOS T:8088/ecr ud/v1/core /eHealthEx change.cda /transform ");
  146  
  147           Pr opertyLook up pl = ne w Property Lookup() {
  148                @Overrid e
  149                public S tring getP roperty(St ring key)  {
  150                    retu rn props.g etProperty (key);
  151                }
  152           };
  153  
  154           in stance.set AdapterMvi (adapterMv i);
  155           in stance.set AdapterPat ientCorrel ation(pati entCorrela tion);
  156           in stance.set AdapterPol icyEngine( policyEngi ne);
  157           in stance.set VapConsent Management (consentMa nagement);
  158           in stance.set FacilityMa nager(faci lityManage r);
  159           in stance.set PropertyLo okup(pl);
  160           in stance.set AuditManag er(auditMa nager);
  161           in stance.set DocumentRe pository(d ocumentRep ository);
  162           in stance.set EntityDocQ uery(entit yDocQuery) ;
  163           in stance.set EntityDocR etrieve(en tityDocRet rieve);
  164           in stance.set DasDAO(das DAO);
  165  
  166           co ntext.chec king(new E xpectation s() {
  167                {
  168                    Faci lity facil ity = new  Facility() ;
  169                    faci lity.setFa cilityNumb er("VA");
  170                    faci lity.setHo meCommunit yId(soid);
  171  
  172                    Faci lity other  = new Fac ility();
  173                    othe r.setFacil ityNumber( sendingFac ilityNumbe r);
  174                    othe r.setHomeC ommunityId (sendingHC ID);
  175                    othe r.setFullH omeCommuni tyId(fullH CID);
  176  
  177                    Retr ieveDocume ntSetRespo nseType ac cessConsen tRetrieveR esponse =  new Retrie veDocument SetRespons eType();
  178                    Docu mentRespon se docResp onse = new  DocumentR esponse();
  179                    Stri ng s = Fil eUtils.rea dFileToStr ing(DOCUME NT);
  180                    fina l byte []  acpDocumen t = Base64 .getDecode r().decode (s);
  181                    Data Handler da taHandler  = new Data Handler(ac pDocument,  "applicat ion/octet- stream");
  182                    docR esponse.se tDocument( dataHandle r);
  183                    acce ssConsentR etrieveRes ponse.getD ocumentRes ponse().ad d(docRespo nse);
  184                    
  185                    Adho cQueryResp onse adhoc Response =  new Adhoc QueryRespo nse();
  186                    adho cResponse. setRequest Id("1234") ;
  187                    
  188                    allo wing(entit yDocQuery) .respondin gGatewayCr ossGateway Query(with (any(gov.h hs.fha.nhi nc.common. nhinccommo nentity.Re spondingGa tewayCross GatewayQue ryRequestT ype.class) ));
  189                    will (returnVal ue(adhocRe sponse));
  190                    
  191                    allo wing(entit yDocRetrie ve).respon dingGatewa yCrossGate wayRetriev e(with(any (gov.hhs.f ha.nhinc.c ommon.nhin ccommonent ity.Respon dingGatewa yCrossGate wayRetriev eRequestTy pe.class)) );
  192                    will (returnVal ue(accessC onsentRetr ieveRespon se));
  193                    
  194                    DasO perationSe ndACPDocum entRespons e res = ne w DasOpera tionSendAC PDocumentR esponse();
  195                    res. setDocId(" 0000000000 ");
  196  
  197                    allo wing(facil ityManager ).getFacil ityByHomeC ommunityId (with(any( String.cla ss)));
  198                    will (returnVal ue(other)) ;
  199                    allo wing(facil ityManager ).getFacil ityByFacil ityNumber( with(any(S tring.clas s)));
  200                    will (returnVal ue(other)) ;
  201  
  202                    allo wing(facil ityManager ).isPartne rAllowed(p artnerHcid , Operatio nOnOff.ONB OARD);
  203                    will (returnVal ue(true));
  204                    allo wing(facil ityManager ).isPartne rAllowed(p artnerHcid , Operatio nOnOff.IN_ PD);
  205                    will (returnVal ue(true));
  206  
  207                    allo wing(prope rtyLookup) .getProper ty(with("H omeCommuni tyId"));
  208                    will (returnVal ue(vaHCID) );
  209                    allo wing(prope rtyLookup) .getProper ty(with("e xcludePati entDiscove rySections "));
  210                    will (returnVal ue("0"));
  211                    allo wing(prope rtyLookup) .getProper ty(with("v ler.das.ea uthsubmit. url"));
  212                    will (returnVal ue("http:/ /MOCK-HOST :8088/ecru d/v1/core/ eHealthExc hange.cda/ transform" ));
  213  
  214                    DasO perationSe ndACPDocum entRespons e dasRes =  new DasOp erationSen dACPDocume ntResponse ();
  215                    dasR es.setDocI d("1234");
  216  
  217                    allo wing(dasDA O).doOpera tionSendAC PDocument( with(any(D asOperatio nSendACPDo cumentRequ est.class) ));
  218                    will (returnVal ue(dasRes) );
  219                    
  220                    Cons entDirecti veQueryRes ponseType  consentDir ectiveResp onse = new  ConsentDi rectiveQue ryResponse Type();
  221                    
  222                    allo wing(conse ntManageme nt).getCon sentDirect ives(with( any(Consen tDirective QueryReque stType.cla ss)));
  223                    will (returnVal ue(consent DirectiveR esponse));
  224  
  225                    allo wing(adapt erMvi).fin dCandidate sMap(
  226                                                                                           with(any(R espondingG atewayPRPA IN201305UV 02RequestT ype.class) ),
  227                                                                                           with( any(  AuditEven t.class )  ) );
  228                    will (returnVal ue(searchR esultMap)) ;
  229  
  230                    allo wing(adapt erMvi).fin dCandidate s(with(any (Respondin gGatewayPR PAIN201305 UV02Reques tType.clas s)));
  231                    will (returnVal ue(mviResu lts));
  232                    
  233                    allo wing(docum entReposit ory).store Document(w ith(any(Do cument.cla ss)));
  234                    allo wing(audit Manager).s toreAudit( with(any(A udit.class )));
  235  
  236                    allo wing(patie ntCorrelat ion).addPa tientCorre lation(
  237                                                                                  with(any (AddPatien tCorrelati onRequestT ype.class) ),
  238                      wi th(any(Pat ient.class )),
  239                                                                                  with( an y( Boolean .class ) ) ,
  240                                                                                  with( an y( AuditEv ent.class  )));
  241                }
  242           }) ;
  243  
  244           PR PAIN201306 UV02 resul t = instan ce.respond ingGateway PRPAIN2013 05UV02(req uest);
  245           Te stUtils.as sertResult sOk(PRPAIN 201306UV02 .class, re sult, RESP ONSE_FILE) ;
  246           co ntext.asse rtIsSatisf ied();
  247       }
  248  
  249       /**
  250        * Tes t of extra ctPatientI dFrom20130 5 method,  of class
  251        * Ada pterPatien tDiscovery .
  252        */
  253       @Test
  254       public  void test ExtractPat ientIdFrom 201305() t hrows Exce ption {
  255           PR PAIN201305 UV02 reque st = null;
  256           II  expResult  = null;
  257           II  result =  instance.e xtractPati entIdFrom2 01305(requ est);
  258           as sertEquals (expResult , result);
  259       }
  260  
  261   }