Produced by Araxis Merge on 11/9/2017 4:31:03 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 | PPS-N_B397.zip\PPS-N_B397\PPS-N_B397\PS_PPS_domain\src\test\java\gov\va\med\pharmacy\peps\domain\common\utility\impl | RxNormCapabilityImplIT.java | Thu Nov 9 14:59:38 2017 UTC |
2 | PPS-N_B397.zip\PPS-N_B397\PPS-N_B397\PS_PPS_domain\src\test\java\gov\va\med\pharmacy\peps\domain\common\utility\impl | RxNormCapabilityImplIT.java | Thu Nov 9 20:43:55 2017 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 480 |
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 | package go v.va.med.p harmacy.pe ps.domain. common.uti lity.impl; | |
2 | ||
3 | import jav a.util.Dat e; | |
4 | import jav a.util.Lis t; | |
5 | ||
6 | import org .junit.Ass ert; | |
7 | import org .junit.Bef ore; | |
8 | import org .junit.Tes t; | |
9 | import org .springfra mework.bea ns.BeansEx ception; | |
10 | import org .springfra mework.bea ns.factory .annotatio n.Autowire d; | |
11 | import org .springfra mework.con text.Appli cationCont ext; | |
12 | import org .springfra mework.con text.Appli cationCont extAware; | |
13 | import org .springfra mework.tra nsaction.a nnotation. Transactio nal; | |
14 | ||
15 | import gov .va.med.ph armacy.pep s.common.u tility.Con figFileUti lity; | |
16 | import gov .va.med.ph armacy.pep s.common.u tility.imp l.test.Env ironmentUt ilityStub; | |
17 | import gov .va.med.ph armacy.pep s.common.v o.UserVo; | |
18 | import gov .va.med.ph armacy.pep s.common.v o.diff.Dif ference; | |
19 | import gov .va.med.ph armacy.pep s.domain.c ommon.capa bility.imp l.SeqNumDo mainCapabi lityImpl; | |
20 | import gov .va.med.ph armacy.pep s.domain.c ommon.dao. impl.EplPr oductDaoIm pl; | |
21 | import gov .va.med.ph armacy.pep s.domain.c ommon.mode l.EplProdu ctDo; | |
22 | import gov .va.med.ph armacy.pep s.domain.c ommon.util ity.RxNorm Capability ; | |
23 | import gov .va.med.ph armacy.pep s.domain.c ommon.util ity.client .rxnorm.Rx NormClient ; | |
24 | import gov .va.med.ph armacy.pep s.domain.c ommon.util ity.client .rxnorm.te st.RxNormC lientIT; | |
25 | import gov .va.med.ph armacy.pep s.domain.c ommon.util ity.test.A bstractDom ainIT; | |
26 | ||
27 | /** | |
28 | * Tests R xNormCapab ilityImpl functional ity. In or der to run these int egration t ests we ne ed to prop erly setup the data source | |
29 | * configu ration pro perties in the src\t est\resour ces\xml\sp ring\test\ DomainCont ext.xml fi le. We als o need to activate t he | |
30 | * "oracle " maven pr ofile for the PS_PPS _domain pr oject. | |
31 | * | |
32 | * @author
|
|
33 | * | |
34 | */ | |
35 | public cla ss RxNormC apabilityI mplIT exte nds Abstra ctDomainIT implement s Applicat ionContext Aware { | |
36 | ||
37 | /** | |
38 | * Pro duct id fo r vuid 400 1164. | |
39 | */ | |
40 | public static fi nal long P RODUCT_VUI D_4001164_ ID = 99913 5042809473 0L; | |
41 | ||
42 | /** | |
43 | * Pro duct id fo r vuid 400 3547. | |
44 | */ | |
45 | public static fi nal long P RODUCT_VUI D_4003547_ ID = 99913 5042853608 1L; | |
46 | ||
47 | /** | |
48 | * Pro duct id fo r vuid 400 1954. | |
49 | */ | |
50 | public static fi nal long P RODUCT_VUI D_4001954_ ID = 99913 5042821855 7L; | |
51 | ||
52 | /** | |
53 | * Pro duct id fo r vuid 400 7158. | |
54 | */ | |
55 | public static fi nal long P RODUCT_VUI D_4031757_ ID = 99913 5351654376 0L; | |
56 | ||
57 | privat e Applicat ionContext context; | |
58 | privat e UserVo u ser; | |
59 | ||
60 | @Autow ired | |
61 | privat e EplProdu ctDaoImpl eplProduct Dao; | |
62 | ||
63 | privat e RxNormCa pability r xNormCapab ility; | |
64 | privat e RxNormCl ient rxnor mClient; | |
65 | privat e Environm entUtility Stub envir onmentUtil ity; | |
66 | privat e ConfigFi leUtility configFile ; | |
67 | ||
68 | @Overr ide | |
69 | public void setA pplication Context(Ap plicationC ontext app licationCo ntext) thr ows BeansE xception { | |
70 | th is.context = applica tionContex t; | |
71 | ||
72 | } | |
73 | ||
74 | /** | |
75 | * Pre pares the class to r un the tes ts. | |
76 | */ | |
77 | @Befor e | |
78 | public void setu p() { | |
79 | us er = new U serVo(); | |
80 | us er.setUser name("Auto matedTest" ); | |
81 | ||
82 | rx NormCapabi lity = (Rx NormCapabi lity) cont ext.getBea n("rxNormC apability" ); | |
83 | rx normClient = (RxNorm Client) co ntext.getB ean("rxNor mClient"); | |
84 | ||
85 | co nfigFile = new Conf igFileUtil ity(); | |
86 | ||
87 | en vironmentU tility = n ew Environ mentUtilit yStub(); | |
88 | en vironmentU tility.set National() ; | |
89 | ||
90 | Se qNumDomain Capability Impl seqNu mCapabilit y = (SeqNu mDomainCap abilityImp l) context .getBean(" seqNumDoma inCapabili ty"); | |
91 | se qNumCapabi lity.setEn vironmentU tility(env ironmentUt ility); | |
92 | ||
93 | rx NormCapabi lity.setEn vironmentU tility(env ironmentUt ility); | |
94 | } | |
95 | ||
96 | /** | |
97 | * Tes ts the get Difference s method. | |
98 | */ | |
99 | @Test | |
100 | public void test GetDiffere nces() { | |
101 | Ep lProductDo product = new EplPr oductDo(); | |
102 | ||
103 | // test both null | |
104 | pr oduct.setC odingSyste mCode(null ); | |
105 | Li st<Differe nce> diffe rences = r xNormCapab ility.getD ifferences (null, pro duct); | |
106 | As sert.asser tTrue(diff erences.is Empty()); | |
107 | ||
108 | // test both equal | |
109 | pr oduct.setC odingSyste mCode("123 4"); | |
110 | di fferences = rxNormCa pability.g etDifferen ces("1234" , product) ; | |
111 | As sert.asser tTrue(diff erences.is Empty()); | |
112 | ||
113 | // test diff erent code | |
114 | pr oduct.setC odingSyste mCode("123 5"); | |
115 | di fferences = rxNormCa pability.g etDifferen ces("1234" , product) ; | |
116 | As sert.asser tTrue(diff erences.si ze() == 2) ; | |
117 | ||
118 | // test diff erent syst em | |
119 | pr oduct.setC odingSyste mCode("123 5"); | |
120 | pr oduct.setC odingSyste m("Not RX Norm"); | |
121 | di fferences = rxNormCa pability.g etDifferen ces("1235" , product) ; | |
122 | As sert.asser tTrue(diff erences.si ze() == 2) ; | |
123 | ||
124 | // test new code | |
125 | di fferences = rxNormCa pability.g etDifferen ces("1235" , product) ; | |
126 | As sert.asser tTrue(diff erences.si ze() == 2) ; | |
127 | ||
128 | // test dele ted code | |
129 | pr oduct.setC odingSyste mCode("123 5"); | |
130 | di fferences = rxNormCa pability.g etDifferen ces(null, product); | |
131 | As sert.asser tTrue(diff erences.si ze() == 2) ; | |
132 | ||
133 | } | |
134 | ||
135 | /** | |
136 | * Tes ts when ne w rx norm code is ad ded. The E PL_PRODUCT S table ne eds to be setup so t he coding system rel ated colum ns are | |
137 | * set to null f or VUID = 4001164. | |
138 | */ | |
139 | @Test | |
140 | @Trans actional | |
141 | public void test PopulateAn dPersistNu llCoding() { | |
142 | ||
143 | Ep lProductDo eplProduc tDo = retr ieveProduc t(PRODUCT_ VUID_40011 64_ID); | |
144 | As sert.asser tNull(eplP roductDo.g etCodingSy stemCode() ); | |
145 | ||
146 | St ring code = rxnormCl ient.getCo de(eplProd uctDo.getV uid(), con figFile); | |
147 | po pulateRxNo rmForProdu ct(user, P RODUCT_VUI D_4001164_ ID); | |
148 | ||
149 | ep lProductDo = retriev eProduct(P RODUCT_VUI D_4001164_ ID); | |
150 | As sert.asser tEquals(co de, eplPro ductDo.get CodingSyst emCode()); | |
151 | As sert.asser tEquals(Ep lProductDo .RX_NORM_C ODING_SYST EM, eplPro ductDo.get CodingSyst em()); | |
152 | } | |
153 | ||
154 | /** | |
155 | * Tes ts when ne w rx norm code is up dated. The EPL_PRODU CTS table needs to b e setup so coding_sy stem = 'Te st' and | |
156 | * cod ing_system _code = '9 9999' are set to nul l for VUID = 4003547 . | |
157 | */ | |
158 | @Test | |
159 | @Trans actional | |
160 | public void test PopulateAn dPersistUp dateCoding () { | |
161 | ||
162 | Ep lProductDo eplProduc tDo = retr ieveProduc t(PRODUCT_ VUID_40035 47_ID); | |
163 | As sert.asser tNotNull(e plProductD o.getCodin gSystemCod e()); | |
164 | As sert.asser tEquals("9 9999", epl ProductDo. getCodingS ystemCode( )); | |
165 | As sert.asser tEquals("T est", eplP roductDo.g etCodingSy stem()); | |
166 | ||
167 | St ring code = rxnormCl ient.getCo de(eplProd uctDo.getV uid(), con figFile); | |
168 | po pulateRxNo rmForProdu ct(user, P RODUCT_VUI D_4003547_ ID); | |
169 | ||
170 | As sert.asser tEquals(co de, eplPro ductDo.get CodingSyst emCode()); | |
171 | As sert.asser tEquals(Ep lProductDo .RX_NORM_C ODING_SYST EM, eplPro ductDo.get CodingSyst em()); | |
172 | } | |
173 | ||
174 | /** | |
175 | * Tes ts when ne w rx norm code does not need t o be updat ed. The EP L_PRODUCTS table nee ds to be s etup so co ding_syste m = | |
176 | * 'Rx Norm' and coding_sys tem_code = '198334' are set to null for VUID = 400 1954. | |
177 | */ | |
178 | @Test | |
179 | @Trans actional | |
180 | public void test PopulateAn dPersistNo UpdateCodi ng() { | |
181 | ||
182 | Ep lProductDo eplProduc tDo = retr ieveProduc t(PRODUCT_ VUID_40019 54_ID); | |
183 | St ring code = rxnormCl ient.getCo de(eplProd uctDo.getV uid(), con figFile); | |
184 | ||
185 | As sert.asser tNotNull(e plProductD o.getCodin gSystemCod e()); | |
186 | As sert.asser tEquals(co de, eplPro ductDo.get CodingSyst emCode()); | |
187 | As sert.asser tEquals(Ep lProductDo .RX_NORM_C ODING_SYST EM, eplPro ductDo.get CodingSyst em()); | |
188 | ||
189 | po pulateRxNo rmForProdu ct(user, P RODUCT_VUI D_4001954_ ID); | |
190 | ||
191 | As sert.asser tEquals(co de, eplPro ductDo.get CodingSyst emCode()); | |
192 | As sert.asser tEquals(Ep lProductDo .RX_NORM_C ODING_SYST EM, eplPro ductDo.get CodingSyst em()); | |
193 | ||
194 | } | |
195 | ||
196 | /** | |
197 | * Tes ts when a previously existing rx norm co de has bee n deleted from ISAAC . The EPL_ PRODUCTS t able needs to be set up so | |
198 | * cod ing_system = 'RxNorm ' and codi ng_system_ code is no t null for VUID = 40 31757. | |
199 | */ | |
200 | @Test | |
201 | @Trans actional | |
202 | public void test PopulateAn dPersistDe leteCoding () { | |
203 | ||
204 | Ep lProductDo eplProduc tDo = retr ieveProduc t(PRODUCT_ VUID_40317 57_ID); | |
205 | St ring code = rxnormCl ient.getCo de(eplProd uctDo.getV uid(), con figFile); // fake vu id to get a null | |
206 | ||
207 | As sert.asser tNotNull(e plProductD o.getCodin gSystemCod e()); | |
208 | As sert.asser tNull(code ); | |
209 | As sert.asser tEquals(Ep lProductDo .RX_NORM_C ODING_SYST EM, eplPro ductDo.get CodingSyst em()); | |
210 | ||
211 | po pulateRxNo rmForProdu ct(user, P RODUCT_VUI D_4031757_ ID); | |
212 | ||
213 | ep lProductDo = retriev eProduct(P RODUCT_VUI D_4031757_ ID); | |
214 | As sert.asser tNull(eplP roductDo.g etCodingSy stemCode() ); | |
215 | As sert.asser tNull(eplP roductDo.g etCodingSy stem()); | |
216 | ||
217 | } | |
218 | ||
219 | /** | |
220 | * ret urns a pro duct from the databa se on an i d. | |
221 | * | |
222 | * @pa ram id lon g id | |
223 | * @re turn EplPr oductDo | |
224 | */ | |
225 | public EplProduc tDo retrie veProduct( long id) { | |
226 | re turn eplPr oductDao.r etrieve(id ); | |
227 | } | |
228 | ||
229 | /** | |
230 | * Exe rcises the populateA ndPersist method in the rxNorm Capability class. | |
231 | * | |
232 | * @pa ram user U serVo | |
233 | * @pa ram produc tId long i d | |
234 | */ | |
235 | public void popu lateRxNorm ForProduct (UserVo us er, Long p roductId) { | |
236 | Da te runDate = new Dat e(); | |
237 | Ep lProductDo product = eplProduc tDao.retri eve(produc tId); | |
238 | rx NormCapabi lity.popul ateAndPers ist(user, product, r unDate, co nfigFile); | |
239 | } | |
240 | ||
241 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.