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.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | ehealth_xchange_cif.zip\NHIN_adapter\AdapterEJB\src\test\java\gov\va\med\nhin\adapter\adapterxdr | AdapterXDRTest.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\adapterxdr | AdapterXDRTest.java | Tue Feb 27 14:24:58 2018 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 368 |
| Changed | 1 | 2 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| 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 |
No regular expressions were active.
| 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.adapterx dr; | |
| 7 | ||
| 8 | import gov .hhs.fha.n hinc.commo n.nhinccom monadapter .AdapterPr ovideAndRe gisterDocu mentSetReq uestType; | |
| 9 | import gov .hhs.fha.n hinc.nhinc componentp atientcorr elation.Pa tientCorre lationPort Type; | |
| 10 | import gov .va.med.nh in.adapter .adapterga teway.Test Utils; | |
| 11 | import gov .va.med.nh in.adapter .audit.Aud it; | |
| 12 | import gov .va.med.nh in.adapter .audit.Aud itManager; | |
| 13 | import gov .va.med.nh in.adapter .documentr epository. DocumentRe pository; | |
| 14 | import gov .va.med.nh in.adapter .facilitym anager.Fac ility; | |
| 15 | import gov .va.med.nh in.adapter .facilitym anager.Fac ilityManag er; | |
| 16 | import gov .va.med.nh in.adapter .propertyl ookup.Prop ertyLookup ; | |
| 17 | import gov .va.med.nh in.adapter .utils.das .DasDAO; | |
| 18 | import gov .va.med.nh in.adapter .utils.das .DasOperat ionSendImm unizationD ataRequest ; | |
| 19 | import gov .va.med.nh in.adapter .utils.das .DasOperat ionSendImm unizationD ataRespons e; | |
| 20 | import gov .va.nvap.p rivacy.Org anizationT rustedSour ceRequestT ype; | |
| 21 | import gov .va.nvap.p rivacy.Org anizationT rustedSour ceResponse Type; | |
| 22 | import ihe .iti.xds_b ._2007.Pro videAndReg isterDocum entSetRequ estType.Do cument; | |
| 23 | import jav a.io.File; | |
| 24 | import jav a.util.Bas e64; | |
| 25 | import jav a.util.Pro perties; | |
| 26 | import jav ax.xml.bin d.JAXBCont ext; | |
| 27 | import jav ax.xml.bin d.Unmarsha ller; | |
| 28 | import oas is.names.t c.ebxml_re grep.xsd.r s._3.Regis tryRespons eType; | |
| 29 | import org .apache.co mmons.io.F ileUtils; | |
| 30 | import org .hl7.v3.II ; | |
| 31 | import org .hl7.v3.Re trievePati entCorrela tionsReque stType; | |
| 32 | import org .hl7.v3.Re trievePati entCorrela tionsRespo nseType; | |
| 33 | import org .jmock.Exp ectations; | |
| 34 | import org .jmock.Moc kery; | |
| 35 | import org .jmock.int egration.j unit4.JMoc k; | |
| 36 | import org .jmock.int egration.j unit4.JUni t4Mockery; | |
| 37 | import org .junit.Aft er; | |
| 38 | import org .junit.Bef ore; | |
| 39 | import org .junit.Bef oreClass; | |
| 40 | import org .junit.Tes t; | |
| 41 | import org .junit.run ner.RunWit h; | |
| 42 | import pri vacy.servi ce.nvap. DNS .ConsentMa nagementPo rtType; | |
| 43 | ||
| 44 | /** | |
| 45 | * | |
| 46 | * @author alok.sube di | |
| 47 | */ | |
| 48 | @RunWith(J Mock.class ) | |
| 49 | public cla ss Adapter XDRTest { | |
| 50 | ||
| 51 | privat e static f inal Strin g TEST_DIR = "src/te st/resourc es"; | |
| 52 | privat e static f inal File REQUEST_FI LE = new F ile(TEST_D IR, "docum ent_submis sion_reque st.xml"); | |
| 53 | privat e static f inal File CORRELATIO N_RESPONSE = new Fil e(TEST_DIR , "correla tions-resp onse.xml") ; | |
| 54 | privat e static f inal File DOCUMENT = new File( TEST_DIR, "document. txt"); | |
| 55 | privat e static f inal File RESPONSE_F ILE = new File(TEST_ DIR, "docu ment_submi ssion_resp onse.xml") ; | |
| 56 | ||
| 57 | privat e Mockery context; | |
| 58 | privat e AdapterX DR instanc e; | |
| 59 | ||
| 60 | public AdapterXD RTest() { | |
| 61 | } | |
| 62 | ||
| 63 | @Befor e | |
| 64 | public void setU p() { | |
| 65 | th is.context = new JUn it4Mockery (); | |
| 66 | th is.instanc e = new Ad apterXDR() ; | |
| 67 | } | |
| 68 | ||
| 69 | @Befor eClass | |
| 70 | public static vo id setUpCl ass() { | |
| 71 | Sy stem.setPr operty("ja vax.xml.pa rsers.SAXP arserFacto ry", | |
| 72 | "com .sun.org.a pache.xerc es.interna l.jaxp.SAX ParserFact oryImpl"); | |
| 73 | } | |
| 74 | ||
| 75 | @After | |
| 76 | public void tear Down() { | |
| 77 | } | |
| 78 | ||
| 79 | /** | |
| 80 | * Tes t of provi deAndRegis terDocumen tSetb meth od, of cla ss Adapter XDR. | |
| 81 | */ | |
| 82 | @Test | |
| 83 | public void test ProvideAnd RegisterDo cumentSetb () throws Exception { | |
| 84 | ||
| 85 | JA XBContext jaxb = JAX BContext.n ewInstance (AdapterPr ovideAndRe gisterDocu mentSetReq uestType.c lass, Retr ievePatien tCorrelati onsRespons eType.clas s, Documen t.class); | |
| 86 | Un marshaller unm = jax b.createUn marshaller (); | |
| 87 | ||
| 88 | fi nal Adapte rProvideAn dRegisterD ocumentSet RequestTyp e request = TestUtil s.fileToPo jo(REQUEST _FILE, Ada pterProvid eAndRegist erDocument SetRequest Type.class , unm); | |
| 89 | fi nal Retrie vePatientC orrelation sResponseT ype correl ationRespo nse = Test Utils.file ToPojo(COR RELATION_R ESPONSE, R etrievePat ientCorrel ationsResp onseType.c lass, unm) ; | |
| 90 | ||
| 91 | St ring s = F ileUtils.r eadFileToS tring(DOCU MENT); | |
| 92 | fi nal byte [ ] document = Base64. getDecoder ().decode( s); | |
| 93 | ||
| 94 | fi nal String icn = "10 12581676V3 77802"; | |
| 95 | fi nal String hcid = "2 .16.840.1. 113883.3.2 018.1.5.1" ; | |
| 96 | fi nal String fullHcid = "urn:oid :2.16.840. 1.113883.3 .2018.1.5. 1"; | |
| 97 | ||
| 98 | ||
| 99 | fi nal Proper tyLookup p ropertyLoo kup = cont ext.mock(P ropertyLoo kup.class) ; | |
| 100 | fi nal Facili tyManager facilityMa nager = co ntext.mock (FacilityM anager.cla ss); | |
| 101 | fi nal AuditM anager aud itManager = context. mock(Audit Manager.cl ass); | |
| 102 | fi nal Patien tCorrelati onPortType patientCo rrelationP ortType = context.mo ck(Patient Correlatio nPortType. class); | |
| 103 | fi nal Docume ntReposito ry documen tRepositor y = contex t.mock(Doc umentRepos itory.clas s); | |
| 104 | fi nal Consen tManagemen tPortType consentMan agementPor tType = co ntext.mock (ConsentMa nagementPo rtType.cla ss); | |
| 105 | fi nal DasDAO dasDAO = context.mo ck(DasDAO. class); | |
| 106 | ||
| 107 | fi nal Proper ties props = new Pro perties(); | |
| 108 | pr ops.setPro perty("vle r.das.docs ubmit.url" , "http:// MOCK-HOST: 8088/ecrud /v1/core/i mmunizatio ns/transfo rm"); | |
| 109 | ||
| 110 | Pr opertyLook up pl = ne w Property Lookup() { | |
| 111 | @Overrid e | |
| 112 | public S tring getP roperty(St ring key) { | |
| 113 | retu rn props.g etProperty (key); | |
| 114 | } | |
| 115 | }; | |
| 116 | ||
| 117 | in stance.set PropertyLo okup(pl); | |
| 118 | in stance.set FacilityMa nager(faci lityManage r); | |
| 119 | in stance.set AuditManag er(auditMa nager); | |
| 120 | in stance.set AdapterPat ientCorrel ation(pati entCorrela tionPortTy pe); | |
| 121 | in stance.set DocumentRe pository(d ocumentRep ository); | |
| 122 | in stance.set VapConsent Management (consentMa nagementPo rtType); | |
| 123 | in stance.set DasDAO(das DAO); | |
| 124 | ||
| 125 | co ntext.chec king(new E xpectation s() { | |
| 126 | { | |
| 127 | II p atientId = new II(); | |
| 128 | pati entId.setR oot("2.16. 840.1.1138 83.4.349") ; | |
| 129 | pati entId.setE xtension(i cn); | |
| 130 | ||
| 131 | Faci lity homeF acility = new Facili ty(); | |
| 132 | home Facility.s etHomeComm unityId(hc id); | |
| 133 | home Facility.s etFacility Number("20 0NWG"); | |
| 134 | home Facility.s etFullHome CommunityI d(fullHcid ); | |
| 135 | ||
| 136 | allo wing(facil ityManager ).getFacil ityByFullH omeCommuni tyId(with( any(String .class))); | |
| 137 | will (returnVal ue(homeFac ility)); | |
| 138 | ||
| 139 | Orga nizationTr ustedSourc eResponseT ype res = new Organi zationTrus tedSourceR esponseTyp e(); | |
| 140 | res. setIsTrust ed(true); | |
| 141 | ||
| 142 | allo wing(conse ntManageme ntPortType ).getIsOrg anizationT rustedSour ce(with(an y(Organiza tionTruste dSourceReq uestType.c lass))); | |
| 143 | will (returnVal ue(res)); | |
| 144 | ||
| 145 | // PR PAIN201310 UV02 prpn = new PRPA IN201310UV 02(); | |
| 146 | // pr pn.setId(p atientId); | |
| 147 | // | |
| 148 | // Re trievePati entCorrela tionsRespo nseType co rRes = new RetrieveP atientCorr elationsRe sponseType (); | |
| 149 | // co rRes.setPR PAIN201310 UV02(prpn) ; | |
| 150 | ||
| 151 | allo wing(patie ntCorrelat ionPortTyp e).retriev ePatientCo rrelations (with(any( RetrievePa tientCorre lationsReq uestType.c lass))); | |
| 152 | will (returnVal ue(correla tionRespon se)); | |
| 153 | ||
| 154 | allo wing(prope rtyLookup) .getProper ty("vler.d as.docsubm it.url"); | |
| 155 | will (returnVal ue("http:/ /MOCK-HOST :8088/ecru d/v1/core/ immunizati ons/transf orm")); | |
| 156 | ||
| 157 | // Da sOperation SendImmuni zationData Request re q = new Da sOperation SendImmuni zationData Request(); | |
| 158 | // re q.setMessa ge(documen t); | |
| 159 | // re q.setICN(" icn"); | |
| 160 | // re q.setFacil ity("facil ityNumber" ); | |
| 161 | ||
| 162 | DasO perationSe ndImmuniza tionDataRe sponse res ponse = ne w DasOpera tionSendIm munization DataRespon se(); | |
| 163 | resp onse.setDo cId("123") ; | |
| 164 | ||
| 165 | DasOpe rationSend Immunizati onDataResp onse drres p = | |
| 166 | new DasOpe rationSend Immunizati onDataResp onse(); | |
| 167 | drresp .setDocId( "58ec59a8 d943870ac8 998c10"); | |
| 168 | ||
| 169 | oneO f(dasDAO). doOperatio nSendImmun izationDat a(with(any (DasOperat ionSendImm unizationD ataRequest .class ) ) ); | |
| 170 | will (returnVal ue(drresp) ); | |
| 171 | ||
| 172 | oneOf( documentR epository ).storeDoc ument( wit h( any( go v.va.med.n hin.adapte r.document repository .Document. class ) ) ); | |
| 173 | oneOf( auditMana ger).store Audit( wit h( any( Au dit.class) ) ); | |
| 174 | } | |
| 175 | }) ; | |
| 176 | ||
| 177 | Re gistryResp onseType r esult = in stance.pro videAndReg isterDocum entSetb(re quest); | |
| 178 | ||
| 179 | TestUtil s.assertRe sultsOk(Re gistryResp onseType.c lass, resu lt, | |
| 180 | "/ RegistryRe sponseType /ResponseS lotList/Sl ot[@name=' DocumentId ']/ValueLi st/Value", | |
| 181 | "5 8ec59a8d94 3870ac8998 c10"); | |
| 182 | co ntext.asse rtIsSatisf ied(); | |
| 183 | } | |
| 184 | ||
| 185 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.