50886. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 5/28/2019 3:29:10 PM Eastern 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.

50886.1 Files compared

# Location File Last Modified
1 CV_src.zip\CVVistaDataService\src\test\integration\java\gov\va\med\vds\dataservice\das DASDataServiceTest.java Wed May 1 18:46:27 2019 UTC
2 CV_src.zip\CVVistaDataService\src\test\integration\java\gov\va\med\vds\dataservice\das DASDataServiceTest.java Fri May 24 18:35:02 2019 UTC

50886.2 Comparison summary

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

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

50886.4 Active regular expressions

No regular expressions were active.

50886.5 Comparison detail

  1   /**
  2    * Janus 4 .0 (c)
  3    * Copyrig ht (c) 201 1 Hawaii R esource Gr oup LLC. A ll Rights  Reserved.
  4    * Develop ed for the  Pacific T elehealth  & Technolo gy Hui and  the Pacif ic Joint I nformation  Technolog y Center
  5    * Contrib utors:
  6    *     Hon orable Sen ator Danie l K. Inouy e
  7    *     VA  Pacific Is lands Heal th Care Sy stem
  8    *     Tri pler Army  Medical Ce nter
  9    */
  10    
  11    
  12   package go v.va.med.v ds.dataser vice.das;
  13  
  14   import jav a.io.Strin gReader;
  15   import jav a.util.Arr ayList;
  16   import jav a.util.Cal endar;
  17   import jav a.util.Lis t;
  18  
  19   import com .fasterxml .jackson.d atabind.De serializat ionFeature ;
  20   import com .fasterxml .jackson.d atabind.Ob jectMapper ;
  21   import gov .va.med.fo undations. utilities. JSONUtils;
  22   import gov .va.med.rp c.StringUt ils;
  23   import gov .va.med.vd s.TestConf ig;
  24   import gov .va.med.vd s.TestSite Utils;
  25   import gov .va.med.vd s.base.dat aservice.V DSExceptio n;
  26   import gov .va.med.vd s.das.bean s.Resource ;
  27   import gov .va.med.vd s.das.bean s.Subscrip tion;
  28   import gov .va.med.vd s.dataserv icehandler .DASServic eHandler;
  29   import gov .va.med.vd s.patient. dao.DASDao ;
  30   import gov .va.med.vd s.patient. dataservic e.AllergyD ataService ;
  31   import gov .va.med.vd s.patient. dataservic e.PatientD ataService ;
  32   import gov .va.med.vd s.vistabea ns.*;
  33   import org .apache.co mmons.io.I OUtils;
  34   import org .apache.lo g4j.LogMan ager;
  35   import org .junit.*;
  36   import org .w3c.dom.D ocument;
  37   import org .w3c.dom.N ode;
  38   import org .w3c.dom.N odeList;
  39   import org .xml.sax.I nputSource ;
  40  
  41   import jav ax.xml.par sers.Docum entBuilder Factory;
  42   import jav ax.xml.xpa th.XPath;
  43   import jav ax.xml.xpa th.XPathCo nstants;
  44   import jav ax.xml.xpa th.XPathEx pression;
  45   import jav ax.xml.xpa th.XPathFa ctory;
  46  
  47   import sta tic org.ju nit.Assert .*;
  48   /**
  49    *
  50    *
  51    */
  52   public cla ss DASData ServiceTes t //extend s DataServ iceBaseTes t
  53   {
  54  
  55       protec ted User u ser;
  56       protec ted Patien t patient;
  57       protec ted String  testPatie ntName;
  58  
  59       protec ted Site s ite;
  60  
  61       public  DASDataSe rviceTest( ){
  62           si te = TestS iteUtils.g etInstance ().getSite (TestConfi g.get(Test Config.PRO VIDER_SITE _CODE));
  63       }
  64  
  65       //**** ******
  66       //
  67       // To  test the D AS VLER in terface, m odify the  doGet() me thod in th e
  68       // Not ifications  servlet ( gov.va.med .vds.servl et.Notific ations)
  69       // Ens ure that t he configu ration in  the .prope rties file  is pointi ng to the  proper end point:
  70         // appconf ig.vler.da s.callback  = http:// IP          :[port]/Vi staDataSer vice/notif y/
  71       // Aft er deployi ng to glas sfish in d ebug mode,  you can t hen kick o ff your te st via:
  72         // http:// IP          :[port]/Vi staDataSer vice/notif y/blahblah
  73       //
  74       //**** ******
  75       @Test
  76       public  void test GetVLERAll ergies()
  77       {
  78   ////         QueryBea n queryBea n = initQu eryBean();
  79           Qu eryBean qu eryBean =  setupQuery (user, pat ient, null , null);
  80  
  81           tr y {
  82                DASDao d asDao = ne w DASDao() ;
  83                JLVResul tCollectio n resultCo llection =  dasDao.ge tVLERAller gies(query Bean);
  84                assertTr ue(resultC ollection  != null);
  85           }
  86           ca tch (VDSEx ception e)  {
  87                assertTr ue(false);
  88           }
  89       }
  90  
  91       @Test
  92       public  void test GetDASData ()
  93       {
  94   ////         QueryBea n queryBea n = initQu eryBean();
  95           Qu eryBean qu eryBean =  setupQuery (user, pat ient, null , null);
  96  
  97           tr y {
  98                DASServi ceHandler  dh = new D ASServiceH andler();
  99                Subscrip tion subsc ription =  new Subscr iption();
  100                subscrip tion.setPa tientICN(" 106");
  101                subscrip tion.setDo main("Alle rgyIntoler ance");
  102  
  103                JLVResul tCollectio n resultCo llection =  dh.getDAS Data(subsc ription);
  104                assertTr ue(resultC ollection  != null);
  105           }
  106           ca tch (Excep tion e) {
  107                assertTr ue(false);
  108           }
  109       }
  110  
  111       @Test
  112       public  void test ParseDocSt atus() thr ows Except ion
  113       {
  114           tr y
  115           {
  116                String d ocStatus =  "<wrap><d ocuments>< document>< PartnerNam e>280004</ PartnerNam e><Partner DocumentID >2.16.840. 1.113883.1 .13.99999. 999362</Pa rtnerDocum entID><sta tus>Availa ble</statu s><timesta mp>1483709 141908</ti mestamp></ document>< /documents ><document s><documen t><Partner Name>KP</P artnerName ><PartnerD ocumentID> KP1</Partn erDocument ID><status >Available Old</statu s><timesta mp></times tamp></doc ument></do cuments></ wrap>";
  117  
  118                final St ring XPATH _DOCUMENTS  = "//docu ment";
  119                final St ring XPATH _PARTNERNA ME = "./Pa rtnerName" ;
  120                final St ring XPATH _DOCUMENTI D = "./Par tnerDocume ntID";
  121                final St ring XPATH _STATUS =  "./status" ;
  122                final St ring XPATH _TIMESTAMP  = "./time stamp";
  123  
  124                InputSou rce is = n ew InputSo urce(new S tringReade r(docStatu s));
  125                Document  xmlDoc =  DocumentBu ilderFacto ry.newInst ance().new DocumentBu ilder().pa rse(is);
  126  
  127                XPath xp ath = XPat hFactory.n ewInstance ().newXPat h();
  128                XPathExp ression ex prDocs = x path.compi le(XPATH_D OCUMENTS);
  129                XPathExp ression ex prStatus =  xpath.com pile(XPATH _STATUS);
  130                XPathExp ression ex prPartnerN ame = xpat h.compile( XPATH_PART NERNAME);
  131                XPathExp ression ex prDocID =  xpath.comp ile(XPATH_ DOCUMENTID );
  132                XPathExp ression ex prTimestam p = xpath. compile(XP ATH_TIMEST AMP);
  133  
  134                NodeList  documents  = (NodeLi st) exprDo cs.evaluat e(xmlDoc,  XPathConst ants.NODES ET);
  135  
  136                List<gov .va.med.vd s.das.bean s.Document > document List = new  ArrayList <gov.va.me d.vds.das. beans.Docu ment>();
  137  
  138                for(int  i = 0; i <  documents .getLength (); i++) {
  139                    Node  doc = doc uments.ite m(i);
  140                    gov. va.med.vds .das.beans .Document  document =  new gov.v a.med.vds. das.beans. Document() ;
  141                    Stri ng status  = (String)  exprStatu s.evaluate (doc, XPat hConstants .STRING);
  142                    docu ment.setPa rtnerDocum entID((Str ing) exprD ocID.evalu ate(doc, X PathConsta nts.STRING ));
  143                    docu ment.setPa rtnerName( (String) e xprPartner Name.evalu ate(doc, X PathConsta nts.STRING ));
  144                    if(S tringUtils .isNumeric ((String)  exprTimest amp.evalua te(doc, XP athConstan ts.STRING) )) {
  145                         document.s etTimestam p(Long.par seLong((St ring) expr Timestamp. evaluate(d oc, XPathC onstants.S TRING)));
  146                    }
  147                    docu ment.setSt atus(statu s);
  148                    docu mentList.a dd(documen t);
  149                }
  150  
  151                assertTr ue(documen tList.size () > 0);
  152   //             for(Al lergy alle rgy : alle rgies)
  153   //             {
  154   //                 as sertFalse( StringUtil s.isEmpty( allergy.ge tSourcePro tocol()));
  155   //                 as sertFalse( allergy.ge tSite() ==  null);
  156   //                 as sertFalse( allergy.ge tAllergyNa me().equal s(DataServ iceBase.CO NNECTION_U NAVAILABLE ));
  157   //             }
  158           }
  159           ca tch(Except ion ex)
  160           {
  161                fail(ex. getMessage ());
  162           }
  163       }
  164  
  165       @Test
  166       public  void test ParseVLERA llergies()  throws Ex ception
  167       {
  168           tr y
  169           {
  170                String i nput = IOU tils.toStr ing(getCla ss().getRe sourceAsSt ream("/All ergyIntole ranceBundl e.json"),  "UTF-8");
  171  
  172                ObjectMa pper objec tMapper;
  173                objectMa pper = new  ObjectMap per();
  174                //allow  unknown da ta fields
  175                objectMa pper.confi gure(Deser ialization Feature.FA IL_ON_UNKN OWN_PROPER TIES, fals e);
  176                objectMa pper.confi gure(Deser ialization Feature.FA IL_ON_INVA LID_SUBTYP E, false);
  177  
  178                input =  JSONUtils. sanitizeJS ON(input);
  179                Resource  resource  = (Resourc e) objectM apper.read Value(inpu t, Resourc e.class);
  180  
  181                DASServi ceHandler  dh  = new  DASService Handler();
  182                JLVResul tCollectio n rc = dh. mapVLERAll ergies(res ource, new  Subscript ion()) ;
  183                assertTr ue(resourc e.getTotal () > 0);
  184  
  185           }
  186           ca tch(Except ion ex)
  187           {
  188                fail(ex. getMessage ());
  189           }
  190       }
  191  
  192       @Test
  193       public  void test ParseVLERP roblems()  throws Exc eption
  194       {
  195           tr y
  196           {
  197                String i nput = IOU tils.toStr ing(getCla ss().getRe sourceAsSt ream("/Con ditionBund le.json"),  "UTF-8");
  198  
  199                ObjectMa pper objec tMapper;
  200                objectMa pper = new  ObjectMap per();
  201                //allow  unknown da ta fields
  202                objectMa pper.confi gure(Deser ialization Feature.FA IL_ON_UNKN OWN_PROPER TIES, fals e);
  203  
  204                input =  JSONUtils. sanitizeJS ON(input);
  205                Resource  resource  = (Resourc e) objectM apper.read Value(inpu t, Resourc e.class);
  206  
  207                DASServi ceHandler  dh  = new  DASService Handler();
  208                JLVResul tCollectio n rc = dh. mapVLERPro blems(reso urce, new  Subscripti on()) ;
  209                assertTr ue(resourc e.getTotal () > 0);
  210  
  211           }
  212           ca tch(Except ion ex)
  213           {
  214                fail(ex. getMessage ());
  215           }
  216       }
  217  
  218       @Test
  219       public  void test ParseVLERV itals() th rows Excep tion
  220       {
  221           tr y
  222           {
  223                String i nput = IOU tils.toStr ing(getCla ss().getRe sourceAsSt ream("/Obs ervationBu ndle.json" ), "UTF-8" );
  224  
  225                ObjectMa pper objec tMapper;
  226                objectMa pper = new  ObjectMap per();
  227                //allow  unknown da ta fields
  228                objectMa pper.confi gure(Deser ialization Feature.FA IL_ON_UNKN OWN_PROPER TIES, fals e);
  229  
  230                input =  JSONUtils. sanitizeJS ON(input);
  231                Resource  resource  = (Resourc e) objectM apper.read Value(inpu t, Resourc e.class);
  232  
  233                DASServi ceHandler  dh  = new  DASService Handler();
  234                JLVResul tCollectio n rc = dh. mapVLERVit als(resour ce, new Su bscription ()) ;
  235                assertTr ue(resourc e.getTotal () > 0);
  236  
  237           }
  238           ca tch(Except ion ex)
  239           {
  240                fail(ex. getMessage ());
  241           }
  242       }
  243  
  244       @Test
  245       public  void test ParseVLERI mmunizatio ns() throw s Exceptio n
  246       {
  247           tr y
  248           {
  249                String i nput = IOU tils.toStr ing(getCla ss().getRe sourceAsSt ream("/Imm unizationB undle.json "), "UTF-8 ");
  250  
  251                ObjectMa pper objec tMapper;
  252                objectMa pper = new  ObjectMap per();
  253                //allow  unknown da ta fields
  254                objectMa pper.confi gure(Deser ialization Feature.FA IL_ON_UNKN OWN_PROPER TIES, fals e);
  255  
  256                input =  JSONUtils. sanitizeJS ON(input);
  257                Resource  resource  = (Resourc e) objectM apper.read Value(inpu t, Resourc e.class);
  258  
  259                DASServi ceHandler  dh  = new  DASService Handler();
  260                JLVResul tCollectio n rc = dh. mapVLERImm unizations (resource,  new Subsc ription())  ;
  261                assertTr ue(resourc e.getTotal () > 0);
  262  
  263           }
  264           ca tch(Except ion ex)
  265           {
  266                fail(ex. getMessage ());
  267           }
  268       }
  269  
  270       @Test
  271       public  void test ParseVLERP rocedures( ) throws E xception
  272       {
  273           tr y
  274           {
  275                String i nput = IOU tils.toStr ing(getCla ss().getRe sourceAsSt ream("/Pro cedureBund le.json"),  "UTF-8");
  276  
  277                ObjectMa pper objec tMapper;
  278                objectMa pper = new  ObjectMap per();
  279                //allow  unknown da ta fields
  280                objectMa pper.confi gure(Deser ialization Feature.FA IL_ON_UNKN OWN_PROPER TIES, fals e);
  281  
  282                input =  JSONUtils. sanitizeJS ON(input);
  283                Resource  resource  = (Resourc e) objectM apper.read Value(inpu t, Resourc e.class);
  284  
  285                DASServi ceHandler  dh  = new  DASService Handler();
  286                JLVResul tCollectio n rc = dh. mapVLERPro cedures(re source, ne w Subscrip tion()) ;
  287                assertTr ue(resourc e.getTotal () > 0);
  288  
  289           }
  290           ca tch(Except ion ex)
  291           {
  292                fail(ex. getMessage ());
  293           }
  294       }
  295  
  296       @Test
  297       public  void test ParseVLERD emographic s() throws  Exception
  298       {
  299           tr y
  300           {
  301                String i nput = IOU tils.toStr ing(getCla ss().getRe sourceAsSt ream("/Pat ientBundle .json"), " UTF-8");
  302  
  303                ObjectMa pper objec tMapper;
  304                objectMa pper = new  ObjectMap per();
  305                //allow  unknown da ta fields
  306                objectMa pper.confi gure(Deser ialization Feature.FA IL_ON_UNKN OWN_PROPER TIES, fals e);
  307  
  308                input =  JSONUtils. sanitizeJS ON(input);
  309                Resource  resource  = (Resourc e) objectM apper.read Value(inpu t, Resourc e.class);
  310  
  311                DASServi ceHandler  dh  = new  DASService Handler();
  312                JLVResul tCollectio n rc = dh. mapVLERDem ographics( resource,  new Subscr iption())  ;
  313                assertTr ue(resourc e.getTotal () > 0);
  314  
  315           }
  316           ca tch(Except ion ex)
  317           {
  318                fail(ex. getMessage ());
  319           }
  320       }
  321  
  322       @Test
  323       public  void test ParseVLERD ocuments()  throws Ex ception
  324       {
  325           tr y
  326           {
  327                String i nput = IOU tils.toStr ing(getCla ss().getRe sourceAsSt ream("/Doc umentRefer enceBundle .json"), " UTF-8");
  328  
  329                ObjectMa pper objec tMapper;
  330                objectMa pper = new  ObjectMap per();
  331                //allow  unknown da ta fields
  332                objectMa pper.confi gure(Deser ialization Feature.FA IL_ON_UNKN OWN_PROPER TIES, fals e);
  333  
  334                input =  JSONUtils. sanitizeJS ON(input);
  335                Resource  resource  = (Resourc e) objectM apper.read Value(inpu t, Resourc e.class);
  336  
  337                DASServi ceHandler  dh  = new  DASService Handler();
  338                JLVResul tCollectio n rc = dh. mapVLERDoc uments(res ource, new  Subscript ion()) ;
  339                assertTr ue(resourc e.getTotal () > 0);
  340  
  341           }
  342           ca tch(Except ion ex)
  343           {
  344                fail(ex. getMessage ());
  345           }
  346       }
  347  
  348       @Test
  349       public  void test Token()
  350       {
  351           tr y
  352           {
  353                DASServi ceHandler  dh = new D ASServiceH andler();
  354                QueryBea n qb = new  QueryBean ();
  355                Patient  pat = new  Patient();
  356                pat.setI CN("106");
  357  
  358                User use r = new Us er();
  359                user.set Name("Test User");
  360                user.set UserId("98 7");
  361  
  362                qb.setPa tient(pat) ;
  363                qb.setUs er(user);
  364  
  365                String s ubString =  dh.genera teSubscrip tion(qb, " AllergyInt olerance") ;
  366                //String  subString  = dh.gene rateSubscr iptionStri ng("Allerg y", dh.gen erateSubsc riptionStr ing(qb, "A llergyInto lerance")) ;
  367  
  368                assertTr ue(subStri ng.length( ) > 0);
  369  
  370  
  371           }
  372           ca tch(Except ion ex)
  373           {
  374                fail(ex. getMessage ());
  375           }
  376       }
  377  
  378       @Test
  379       public  void test GetAllergy Detail()
  380       {
  381           tr y
  382           {
  383                QueryBea n queryBea n = setupQ uery(user,  patient,  null, null );
  384                AllergyD ataService  allergySe rvice = ne w AllergyD ataService ();
  385                List<All ergy> alle rgies = al lergyServi ce.getPati entAllergi es(queryBe an).getAll ergies();
  386                assertTr ue(allergi es.size()  > 0);
  387  
  388                QueryBea n qb2 = ne w QueryBea n();
  389                qb2.setU ser(user);
  390                qb2.setP atient(pat ient);
  391                qb2.setI temId(alle rgies.get( 0).getAlle rgyId());
  392                qb2.setR ecordSite( allergies. get(0).get Site());
  393  
  394                AllergyD etail alle rgyDetail  = allergyS ervice.get AllergyDet ail(qb2);
  395                assertFa lse(String Utils.isEm pty(allerg yDetail.ge tReportTex t()));
  396           }
  397           ca tch(VDSExc eption ex)
  398           {
  399                fail(ex. getMessage ());
  400           }
  401       }
  402  
  403       protec ted QueryB ean setupQ uery(User  user, Pati ent patien t, Calenda r startDat e, Calenda r endDate)
  404       {
  405           Qu eryBean qb  = new Que ryBean();
  406           qb .setUser(u ser);
  407           qb .setPatien t(patient) ;
  408           qb .setStartD ate(startD ate);
  409           qb .setEndDat e(endDate) ;
  410           qb .setMax(ne w Integer( 999));
  411           qb .setActive (new Integ er(0));
  412           re turn qb;
  413       }
  414  
  415  
  416       @Befor e
  417       public  void setU p()
  418       {
  419           Lo gManager.g etRootLogg er().setLe vel(org.ap ache.log4j .Level.DEB UG);
  420  
  421           tr y
  422           {
  423                testPati entName =  TestConfig .get(TestC onfig.PATI ENT_NAME);
  424  
  425                //select  test pati ent
  426                PatientD ataService  patientSe rvice = ne w PatientD ataService ();
  427                QueryBea n queryBea n = new Qu eryBean();
  428  
  429  
  430                List<End point> end points = n ew ArrayLi st<Endpoin t>();
  431                Endpoint  endpoint  = new Endp oint();
  432                endpoint .setModali ty("HIS");
  433                endpoint .setProtoc ol("RPC");
  434                endpoint .setStatus ("active") ;
  435                  endpoint.s etHost(" IP            ");
  436                endpoint .setPort(9 448);
  437                endpoint .setSiteCo de("994");
  438                endpoint s.add(endp oint);
  439  
  440                site = n ew Site();
  441                site.set Agency("VA ");
  442                site.set SiteCode(" 994");
  443                site.set Endpoints( endpoints) ;
  444  
  445                //user =  loginTest Provider() ;
  446                user = n ew User();
  447                user.set Agency("VA ");
  448                user.set Name("TEST ER,USER");
  449                user.set UserId("11 1");
  450                user.set HostSite(s ite);
  451  
  452                queryBea n.setUser( user);
  453                queryBea n.setMax(1 00);
  454                queryBea n.setRecor dSite(user .getHostSi te());
  455                queryBea n.setItemI d(testPati entName);
  456  
  457                List<Sit e> sites =  new Array List<Site> ();
  458                sites.ad d(site);
  459  
  460                patient  = new Pati ent();
  461                patient. setICN("10 6");
  462                patient. setName("T ESTING,PAT IENT");
  463                patient. setVistaSi tes(sites) ;
  464                patient. setSSN("44 4331111");
  465  
  466                //Patien t[] patien ts = patie ntService. lookupPati ent(queryB ean);
  467                queryBea n = new Qu eryBean();
  468  
  469                queryBea n.setPatie nt(patient );
  470                queryBea n.setUser( user);
  471  
  472   //             if(!se lect(query Bean))
  473   //                 fa il("Failed  to select  patient") ;
  474  
  475   //             this.p atient = p atients[0] ;
  476  
  477           }
  478           ca tch (Excep tion ex)
  479           {
  480                fail(ex. getMessage ());
  481   //         } catch (V istaKernel HashCountL imitExceed edExceptio n e) {
  482   //             fail(e .getMessag e());
  483           }
  484       }
  485       @Befor eClass
  486       public  static vo id setUpCl ass()
  487       {
  488  
  489       }
  490  
  491       @After Class
  492       public  static vo id tearDow nClass()
  493       {
  494       }
  495       @After
  496       public  void tear Down()
  497       {
  498  
  499       }
  500       
  501   }