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_interface\src\pps_local_test\java\gov\va\med\pharmacy\peps\external\tools\pseudonym\test | ServerIT.java | Thu Nov 9 14:59:22 2017 UTC |
2 | PPS-N_B397.zip\PPS-N_B397\PPS-N_B397\PS_PPS_interface\src\pps_local_test\java\gov\va\med\pharmacy\peps\external\tools\pseudonym\test | ServerIT.java | Thu Nov 9 21:00:36 2017 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 572 |
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 | * Source file creat ed in 2006 by Southw est Resear ch Institu te | |
3 | */ | |
4 | ||
5 | ||
6 | package go v.va.med.p harmacy.pe ps.externa l.tools.ps eudonym.te st; | |
7 | ||
8 | ||
9 | import jav a.io.Buffe redReader; | |
10 | import jav a.io.IOExc eption; | |
11 | import jav a.io.Input StreamRead er; | |
12 | import jav a.io.Print Writer; | |
13 | import jav a.net.Inet Address; | |
14 | import jav a.net.Sock et; | |
15 | ||
16 | import gov .va.med.ph armacy.pep s.external .tools.pse udonym.Pse udonym; | |
17 | import gov .va.med.ph armacy.pep s.external .tools.pse udonym.io. MumpsStrea m; | |
18 | ||
19 | import jun it.framewo rk.TestCas e; | |
20 | ||
21 | ||
22 | /** | |
23 | * ServerT est starts the Pseod onyM serve r then sen ds request s and reco rds the se rver's res ponse. | |
24 | * If the server res ponse matc hes the ex pected str ing the te st passes. | |
25 | */ | |
26 | public cla ss ServerI T extends TestCase { | |
27 | ||
28 | /** PO RT */ | |
29 | public sta tic final int PORT = PORT ; | |
30 | ||
31 | /** so cketPort * / | |
32 | protec ted int so cketPort = PORT; | |
33 | ||
34 | privat e Socket s ocket; | |
35 | privat e PrintWri ter out; | |
36 | privat e Buffered Reader in; | |
37 | privat e Pseudony m server; | |
38 | ||
39 | static { | |
40 | Sy stem.setEr r(System.o ut); | |
41 | } | |
42 | ||
43 | /** | |
44 | * Thi s method s tarts the PseodonyM server and establish es a socke t connecti on. | |
45 | * @th rows Excep tion If an exception occurred | |
46 | * | |
47 | * @se e junit.fr amework.Te stCase#set Up() | |
48 | */ | |
49 | public void setU p() throws Exception { | |
50 | ||
51 | th is.server = new Pseu donym(PORT ); | |
52 | se rver.start (); | |
53 | so cket = new Socket(In etAddress. getLocalHo st(), sock etPort); | |
54 | ou t = new Pr intWriter( socket.get OutputStre am(), true ); | |
55 | in = new Buf feredReade r(new Inpu tStreamRea der(socket .getInputS tream())); | |
56 | ||
57 | } | |
58 | ||
59 | /** | |
60 | * Thi s method c loses the socket con nection an d stops th e Pseodony M server. | |
61 | * @th rows Excep tion If an exception occurred | |
62 | * | |
63 | * @se e junit.fr amework.Te stCase#tea rDown() | |
64 | */ | |
65 | public void tear Down() thr ows Except ion { | |
66 | so cket.close (); | |
67 | se rver.stop( ); | |
68 | } | |
69 | ||
70 | /** | |
71 | * Sen ds request to server and compa res server response with expec ted respon se. | |
72 | * @th rows IOExc eption | |
73 | */ | |
74 | public void test FatkaatGet UserInfo() throws IO Exception { | |
75 | St ring resul t; | |
76 | St ring expec ted = "<?x ml version =\"1.0\" e ncoding=\" utf-8\" ?> <VistaLink messageTy pe=\"gov.v a.med.foun dations.rp c.re" | |
77 | + "spons e\" versio n=\"1.5\" xmlns:xsi= \"http://w ww.w3.org/ 2001/XMLSc hema-insta nce\" xsi: noNamespac eSchemaLoc atio" | |
78 | + "n=\"r pcResponse .xsd\"><Re sponse typ e=\"array\ " ><![CDAT A[52063127 2MANAGER,S YSTEMSyste mManagerMA NAGERSYSTE M0" | |
79 | + "^^^50 00^noparen tassociate dwithinput stationnum ber5003060 810.151629 1500^CAMPM ASTER^500^ 1]]></Resp onse>" | |
80 | + "</Vis taLink>"; | |
81 | ||
82 | // Setup user session b y making d ivisionGet ViaProxy c all | |
83 | ex ecuteComma nd("07XOB RPC0500003 1.5000031. 5000010000 26XUS DIVI SION GET V IA PROXY00 025 rUk%Qf ,&ff,%t=*r w%l*<*m'00 0036" | |
84 | + "00000 08appproxy 0000350100 013authent icated0000 1100006str ing0000110 0021-zVBC# C?B5;@z*%% 2qVu1"); | |
85 | re sult = exe cuteComman d("07XOB R PC05000031 .5000031.5 0000100002 5XUS FATKA AT GET USE R INFO0001 91ULO\"HY AYY \"B$v$ c200" | |
86 | + "00360 000002av00 0035010001 6notauthen ticated000 31+(@wf9fH w*pg(m%%3< @ZgNpyV<V< VN!0000120 0006string 0000110000 9127" | |
87 | + ".0.0. 100007stri ng,0000120 0014FATKAA T Sample") ; | |
88 | as sertVistAL inkEquals( expected, result); | |
89 | ||
90 | } | |
91 | ||
92 | /** | |
93 | * Sen ds request to server and compa res server response with expec ted respon se. | |
94 | * @th rows IOExc eption If an excepti on occurre d | |
95 | */ | |
96 | public void test XusGetUser Info() thr ows IOExce ption { | |
97 | St ring resul t; | |
98 | St ring expec ted = "<?x ml version =\"1.0\" e ncoding=\" utf-8\" ?> <VistaLink messageTy pe=\"gov.v a.med.foun dations.rp c.re" | |
99 | + "spons e\" versio n=\"1.5\" xmlns:xsi= \"http://w ww.w3.org/ 2001/XMLSc hema-insta nce\" xsi: noNamespac eSchemaLoc atio" | |
100 | + "n=\"r pcResponse .xsd\"><Re sponse typ e=\"array\ " ><![CDAT A[52063127 2MANAGER,S YSTEMSyste mManager50 0^CAMPMAST ER^5" | |
101 | + "00MED ICALADMINI STRATION99 99]]></Res ponse></Vi staLink>"; | |
102 | ||
103 | // Setup user session b y making d ivisionGet ViaProxy c all | |
104 | ex ecuteComma nd("07XOB RPC0500003 1.5000031. 5000010000 26XUS DIVI SION GET V IA PROXY00 025 rUk%Qf ,&ff,%t=*r w%l*<*m'00 0036" | |
105 | + "00000 08appproxy 0000350100 013authent icated0000 1100006str ing0000110 0021-zVBC# C?B5;@z*%% 2qVu1"); | |
106 | re sult = exe cuteComman d("07XOB R PC05000031 .5000031.5 0000100001 7XUS GET U SER INFO00 019\";7&+\ "ohaooh+Uv Sv%1000036 0000" | |
107 | + "002av 0000350100 013authent icated0000 10"); | |
108 | as sertVistAL inkEquals( expected, result); | |
109 | ||
110 | } | |
111 | ||
112 | /** | |
113 | * Sen ds request to server and compa res server response with expec ted respon se. | |
114 | * @th rows IOExc eption If an excepti on occurre d | |
115 | */ | |
116 | public void test Initialize Socket() t hrows IOEx ception { | |
117 | St ring comma nd = "<Vis taLink mes sageType=\ "gov.va.me d.foundati ons.vistal ink.system .request\" mode=\"si ngleton\" vers" | |
118 | + "ion=\ "1.5\" xml ns:xsi=\"h ttp://www. w3.org/200 1/XMLSchem a-instance \" xsi:noN amespaceSc hemaLocati on=\"vlSim pleR" | |
119 | + "eques t.xsd\"><R equest env ironment=\ "J2EE\" ty pe=\"initi alizeSocke t\"/></Vis taLink>"; | |
120 | ||
121 | St ring expec ted = "<?x ml version =\"1.0\" e ncoding=\" utf-8\" ?> <VistaLink messageTy pe=\"gov.v a.med.foun dations.vi stal" | |
122 | + "ink.s ystem.resp onse\" ver sion=\"1.5 \" xmlns:x si=\"http: //www.w3.o rg/2001/XM LSchema-in stance\" x si:noNames pace" | |
123 | + "Schem aLocation= \"vlSimple Response.x sd\"><Resp onse type= \"initiali zeSocket\" status=\" success\" rate=\"604 800" | |
124 | + "\" mJ ob=\"666\" reAuthSes sionTimeou t=\"3600\" /></Vista Link>"; | |
125 | St ring resul t = execut eCommand(c ommand); | |
126 | ||
127 | as sertVistAL inkEquals( expected, result); | |
128 | } | |
129 | ||
130 | /** | |
131 | * Sen ds request to server and compa res server response with expec ted respon se. | |
132 | * @th rows IOExc eption If an excepti on occurre d | |
133 | */ | |
134 | public void test SetupAndIn troText() throws IOE xception { | |
135 | St ring comma nd = "<?xm l version= \"1.0\" en coding=\"U TF-8\"?>\n <VistaLink messageTy pe=\"gov.v a.med.foun dations.se curi" | |
136 | + "ty.re quest\" mo de=\"singl eton\" ver sion=\"1.5 \" xmlns:x si=\"http: //www.w3.o rg/2001/XM LSchema-in stance\" x si:" | |
137 | + "noNam espaceSche maLocation =\"secSetu pIntroRequ est.xsd\"> <SecurityI nfo versio n=\"1.0\"/ ><Request type=\"AV. Setu" | |
138 | + "pAndI ntroText\" ><producti onInfo cli entIsProdu ction=\"fa lse\" clie ntPrimaryS tation=\"5 01\"/></Re quest>" | |
139 | + "</Vis taLink>"; | |
140 | ||
141 | St ring expec ted = "<?x ml version =\"1.0\" e ncoding=\" utf-8\" ?> <VistaLink messageTy pe=\"gov.v a.med.foun dations.se curi" | |
142 | + "ty.re sponse\" v ersion=\"1 .5\" xmlns :xsi=\"htt p://www.w3 .org/2001/ XMLSchema- instance\" xsi:noNam espaceSche maLo" | |
143 | + "catio n=\"secSet upIntroRes ponse.xsd\ "><Securit yInfo vers ion=\"1.0\ " />\n <Response type=\"AV. SetupAndIn troT" | |
144 | + "ext\" status=\" success\"> \n <SetupInfo serverNam e='Pseudon yM' volume ='simulate d' uci='VI STA' devic e=" | |
145 | + "'/sim ulated/sim ulated' nu mberAttemp ts='5' dti me='180'/> \n <IntroText ><![CDATA[ This is th e intro.<B R>" | |
146 | + "]]></ IntroText> \n </Re sponse>\n< /VistaLink >"; | |
147 | St ring resul t = execut eCommand(c ommand); | |
148 | ||
149 | as sertVistAL inkEquals( expected, result); | |
150 | } | |
151 | ||
152 | /** | |
153 | * Sen ds request to server and compa res server response with expec ted respon se. | |
154 | * @th rows IOExc eption If an excepti on occurre d | |
155 | */ | |
156 | public void test Logon() th rows IOExc eption { | |
157 | St ring comma nd = "<?xm l version= \"1.0\" en coding=\"U TF-8\"?>\n <VistaLink messageTy pe=\"gov.v a.med.foun dations.se curi" | |
158 | + "ty.re quest\" mo de=\"singl eton\" ver sion=\"1.5 \" xmlns:x si=\"http: //www.w3.o rg/2001/XM LSchema-in stance\" x si:" | |
159 | + "noNam espaceSche maLocation =\"secLogo nRequest.x sd\"><Secu rityInfo v ersion=\"1 .0\"/><Req uest type= \"AV.Logon \">" | |
160 | + "<avCo des><![CDA TA[*(bPO*P [Yozl@2F2% Z(2Oz# ]]> </avCodes> </Request> </VistaLin k>"; | |
161 | ||
162 | St ring expec ted = "<?x ml version =\"1.0\" e ncoding=\" utf-8\" ?> <VistaLink messageTy pe=\"gov.v a.med.foun dations.se curi" | |
163 | + "ty.re sponse\" v ersion=\"1 .5\" xmlns :xsi=\"htt p://www.w3 .org/2001/ XMLSchema- instance\" xsi:noNam espaceSche maLo" | |
164 | + "catio n=\"secLog onResponse .xsd\"><Se curityInfo version=\ "1.0\" />\ n <Resp onse type= \"AV.Logon \" " | |
165 | + "statu s=\"succes s\">\n <PostSi gnInText>< /PostSignI nText>\n </Respon se></Vista Link>"; | |
166 | St ring resul t = execut eCommand(c ommand); | |
167 | ||
168 | as sertVistAL inkEquals( expected, result); | |
169 | } | |
170 | ||
171 | /** | |
172 | * Sen ds request to server and compa res server response with expec ted respon se. | |
173 | * @th rows IOExc eption If an excepti on occurre d | |
174 | */ | |
175 | public void test IntroMsg() throws IO Exception { | |
176 | St ring comma nd = "07XO B RPC05000 031.500003 1.50000100 0013XUS IN TRO MSG000 25(DL<i_Ie FIIein,vD= i%vov'#000 0360000008 appp" | |
177 | + "roxy0 0003501000 16notauthe nticated00 013FATKAAT ,PROXY0000 10"; | |
178 | ||
179 | St ring expec ted = "<?x ml version =\"1.0\" e ncoding=\" utf-8\" ?> <VistaLink messageTy pe=\"gov.v a.med.foun dations.rp c.re" | |
180 | + "spons e\" versio n=\"1.5\" xmlns:xsi= \"http://w ww.w3.org/ 2001/XMLSc hema-insta nce\" xsi: noNamespac eSchemaLoc atio" | |
181 | + "n=\"r pcResponse .xsd\"><Re sponse typ e=\"array\ " ><![CDAT A[You are connected to Pseudon yM, a simu lated Vist A " | |
182 | + "serve r.Pseudony m is not a real Vist A server.P seudonym i s only a s imulation of respons es returne d from Vis tA." | |
183 | + "]]></ Response>< /VistaLink >"; | |
184 | St ring resul t = execut eCommand(c ommand); | |
185 | ||
186 | as sertVistAL inkEquals( expected, result); | |
187 | } | |
188 | ||
189 | /** | |
190 | * Sen ds request to server and compa res server response with expec ted respon se. | |
191 | * @th rows IOExc eption If an excepti on occurre d | |
192 | */ | |
193 | public void test FatkaatSer verInfo() throws IOE xception { | |
194 | St ring comma nd = "07XO B RPC05000 031.500003 1.50000100 0022XUS FA TKAAT SERV ERINFO0002 5,763Hs?$( ??$H\"C`7> Hw`u`!1000 0360" | |
195 | + "00000 8appproxy0 0003501000 13authenti cated00001 0"; | |
196 | ||
197 | St ring expec ted = "<?x ml version =\"1.0\" e ncoding=\" utf-8\" ?> <VistaLink messageTy pe=\"gov.v a.med.foun dations.rp c.re" | |
198 | + "spons e\" versio n=\"1.5\" xmlns:xsi= \"http://w ww.w3.org/ 2001/XMLSc hema-insta nce\" xsi: noNamespac eSchemaLoc atio" | |
199 | + "n=\"r pcResponse .xsd\"><Re sponse typ e=\"array\ " ><![CDAT A[SIMULATE D SIMULATE D VISTA // ./nul:1021 2 ]]>" | |
200 | + "</Res ponse></Vi staLink>"; | |
201 | St ring resul t = execut eCommand(c ommand); | |
202 | ||
203 | as sertVistAL inkEquals( expected, result); | |
204 | } | |
205 | ||
206 | /** | |
207 | * Sen ds request to server and compa res server response with expec ted respon se. | |
208 | * @th rows IOExc eption If an excepti on occurre d | |
209 | */ | |
210 | public void test InvalidDiv isionGetVi aProxy() t hrows IOEx ception { | |
211 | ||
212 | // testing fo r invalid access cod e and pass word | |
213 | St ring comma nd = "07XO B RPC05000 031.500003 1.50000100 0026XUS DI VISION GET VIA PROXY 00025 rUk% Qf,&ff,%t= *rw%l*<*m' 0000" | |
214 | + "36000 0008apppro xy00003501 00013authe nticated00 001100006s tring00001 100021-zVB C#C?d5;@z* %%4qVu1"; | |
215 | ||
216 | St ring expec ted = "<?x ml version =\"1.0\" e ncoding=\" utf-8\" ?> <VistaLink messageTy pe=\"gov.v a.med.foun dations.rp c.re" | |
217 | + "spons e\" versio n=\"1.5\" xmlns:xsi= \"http://w ww.w3.org/ 2001/XMLSc hema-insta nce\" xsi: noNamespac eSchemaLoc atio" | |
218 | + "n=\"r pcResponse .xsd\"><Re sponse typ e=\"array\ " ><![CDAT A[0 1 0 No t a valid ACCESS COD E/VERIFY C ODE pair. 0 0 " | |
219 | + "1 501 ^NEW MEXIC O HCS^501^ 1 ]]></Res ponse></Vi staLink>"; | |
220 | St ring resul t = execut eCommand(c ommand); | |
221 | ||
222 | as sertVistAL inkEquals( expected, result); | |
223 | } | |
224 | ||
225 | /** | |
226 | * Sen ds request to server and compa res server response with expec ted respon se. | |
227 | * @th rows IOExc eption If an excepti on occurre d | |
228 | */ | |
229 | public void test DivisionGe tViaProxy( ) throws I OException { | |
230 | ||
231 | St ring comma nd = "07XO B RPC05000 031.500003 1.50000100 0026XUS DI VISION GET VIA PROXY 00025 rUk% Qf,&ff,%t= *rw%l*<*m' 0000" | |
232 | + "36000 0008apppro xy00003501 00013authe nticated00 001100006s tring00001 100021-zVB C#C?B5;@z* %%2qVu1"; | |
233 | St ring expec ted = "<?x ml version =\"1.0\" e ncoding=\" utf-8\" ?> <VistaLink messageTy pe=\"gov.v a.med.foun dations.rp c.re" | |
234 | + "spons e\" versio n=\"1.5\" xmlns:xsi= \"http://w ww.w3.org/ 2001/XMLSc hema-insta nce\" xsi: noNamespac eSchemaLoc atio" | |
235 | + "n=\"r pcResponse .xsd\"><Re sponse typ e=\"array\ " ><![CDAT A[10000000 0560000150 0^CAMPMAST ER^500^1We don'tknoww heny" | |
236 | + "oulas tsignedon] ]></Respon se></Vista Link>"; | |
237 | ||
238 | St ring resul t = execut eCommand(c ommand); | |
239 | as sertVistAL inkEquals( expected, result); | |
240 | } | |
241 | ||
242 | /** | |
243 | * Sen ds request to server and compa res server response with expec ted respon se. | |
244 | * @th rows IOExc eption If an excepti on occurre d | |
245 | */ | |
246 | public void test Persel() t hrows IOEx ception { | |
247 | St ring comma nd = "07XO B RPC05000 031.500003 1.50000100 0011XHDX P ERSEL00015 .d29dJj9/c !Yax000002 3000003duz 0000350100 013" | |
248 | + "authe nticated00 0010"; | |
249 | ||
250 | St ring expec ted = "<?x ml version =\"1.0\" e ncoding=\" utf-8\" ?> <VistaLink messageTy pe=\"gov.v a.med.foun dations.rp c." | |
251 | + "respo nse\" vers ion=\"1.5\ " xmlns:xs i=\"http:/ /www.w3.or g/2001/XML Schema-ins tance\" xs i:noNamesp aceSchemaL oca" | |
252 | + "tion= \"rpcRespo nse.xsd\"> <Response type=\"arr ay\" ><![C DATA[local presentati on-1" | |
253 | + "local presentati on-2" | |
254 | + "natio nalpresent ation\n]]> </Response ></VistaLi nk>"; | |
255 | ||
256 | St ring resul t = execut eCommand(c ommand); | |
257 | ||
258 | as sertVistAL inkEquals( expected, result); | |
259 | } | |
260 | ||
261 | /** | |
262 | * Exe cutes an r equest on the server | |
263 | * @pa ram comman d the comm and to be executed | |
264 | * @re turn a res ponse from the serve r | |
265 | * @th rows IOExc eption If an IO Exce ption occu rred while attemptin g to read from or wr ite to the mumps str eam | |
266 | */ | |
267 | protec ted String executeCo mmand(Stri ng command ) throws I OException { | |
268 | ||
269 | Mu mpsStream. write(out, command); | |
270 | ||
271 | re turn Mumps Stream.rea d(in); | |
272 | ||
273 | } | |
274 | ||
275 | /** | |
276 | * Com pares the server res ponse with an expect ed string | |
277 | * @pa ram expect ed a strin g containi ng the exp ected resp onse | |
278 | * @pa ram actual a string containing the serve r response | |
279 | */ | |
280 | public void asse rtVistALin kEquals(St ring expec ted, Strin g actual) { | |
281 | St ring strip pedExpecte d = expect ed.replace All("\\s", ""); | |
282 | St ring strip pedActual = actual.r eplaceAll( "\\s", "") ; | |
283 | ||
284 | as sertEquals ("The expe cted and a ctual did not match" , stripped Expected, strippedAc tual); | |
285 | } | |
286 | ||
287 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.