Produced by Araxis Merge on 12/8/2017 1:33:40 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 | PC_CP4_CiF.zip\FPPS_Backend\fpps_app\src\test\java\gov\va\med\fee\integration | UserRequestControllerIntegrationTest.java | Fri Dec 8 17:51:36 2017 UTC |
| 2 | PC_CP4_CiF.zip\FPPS_Backend\fpps_app\src\test\java\gov\va\med\fee\integration | UserRequestControllerIntegrationTest.java | Fri Dec 8 18:57:31 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 5 | 452 |
| Changed | 4 | 10 |
| 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.f ee.integra tion; | |
| 2 | ||
| 3 | import sta tic org.ju nit.Assert .assertFal se; | |
| 4 | import sta tic org.sp ringframew ork.test.w eb.servlet .request.M ockMvcRequ estBuilder s.get; | |
| 5 | import sta tic org.sp ringframew ork.test.w eb.servlet .request.M ockMvcRequ estBuilder s.post; | |
| 6 | import sta tic org.sp ringframew ork.test.w eb.servlet .request.M ockMvcRequ estBuilder s.put; | |
| 7 | import sta tic org.sp ringframew ork.test.w eb.servlet .result.Mo ckMvcResul tHandlers. print; | |
| 8 | import sta tic org.sp ringframew ork.test.w eb.servlet .result.Mo ckMvcResul tMatchers. content; | |
| 9 | import sta tic org.sp ringframew ork.test.w eb.servlet .result.Mo ckMvcResul tMatchers. status; | |
| 10 | ||
| 11 | import jav a.util.Arr ayList; | |
| 12 | import jav a.util.Arr ays; | |
| 13 | import jav a.util.Lis t; | |
| 14 | import jav a.util.Ran dom; | |
| 15 | ||
| 16 | import org .apache.lo gging.log4 j.LogManag er; | |
| 17 | import org .apache.lo gging.log4 j.Logger; | |
| 18 | import org .junit.Bef ore; | |
| 19 | import org .junit.Tes t; | |
| 20 | import org .junit.run ner.RunWit h; | |
| 21 | import org .springfra mework.bea ns.factory .annotatio n.Autowire d; | |
| 22 | import org .springfra mework.htt p.HttpStat us; | |
| 23 | import org .springfra mework.htt p.MediaTyp e; | |
| 24 | import org .springfra mework.moc k.web.Mock HttpServle tResponse; | |
| 25 | import org .springfra mework.tes t.context. ContextCon figuration ; | |
| 26 | import org .springfra mework.tes t.context. junit4.Spr ingJUnit4C lassRunner ; | |
| 27 | import org .springfra mework.tes t.context. web.WebApp Configurat ion; | |
| 28 | import org .springfra mework.tes t.web.serv let.MockMv c; | |
| 29 | import org .springfra mework.tes t.web.serv let.Result Actions; | |
| 30 | import org .springfra mework.tes t.web.serv let.setup. MockMvcBui lders; | |
| 31 | import org .springfra mework.web .context.W ebApplicat ionContext ; | |
| 32 | ||
| 33 | import com .fasterxml .jackson.c ore.JsonPr ocessingEx ception; | |
| 34 | import com .fasterxml .jackson.d atabind.Ob jectMapper ; | |
| 35 | import com .fasterxml .jackson.d atabind.Ob jectWriter ; | |
| 36 | import com .fasterxml .jackson.d atabind.Se rializatio nFeature; | |
| 37 | ||
| 38 | import gov .va.med.do main.fee.A ppUser; | |
| 39 | import gov .va.med.fe e.configur ation.AppC onfig; | |
| 40 | import gov .va.med.fe e.configur ation.hibe rnate.Pers istenceCon fig; | |
| 41 | import gov .va.med.fe e.configur ation.spri ng.SpringM vcConfig; | |
| 42 | import gov .va.med.fe e.model.re quest.Stat ionRequest ; | |
| 43 | import gov .va.med.fe e.model.re quest.User ReqRequest ; | |
| 44 | ||
| 45 | ||
| 46 | ||
| 47 | @WebAppCon figuration | |
| 48 | @RunWith(S pringJUnit 4ClassRunn er.class) | |
| 49 | @ContextCo nfiguratio n(classes = {AppConf ig.class, Persistenc eConfig.cl ass, Sprin gMvcConfig .class}) | |
| 50 | public cla ss UserReq uestContro llerIntegr ationTest { | |
| 51 | pr ivate stat ic final L ogger logg er = LogMa nager.getL ogger(User RequestCon trollerInt egrationTe st.class); | |
| 52 | ||
| 53 | @A utowired | |
| 54 | pr ivate WebA pplication Context wa c; | |
| 55 | pr ivate Mock Mvc mockMv c; | |
| 56 | ||
| 57 | @A utowired | |
| 58 | Mo ckHttpServ letRespons e response ; | |
| 59 | ||
| 60 | lo ng randomP honeNumber ; | |
| 61 | Us erReqReque st req; | |
| 62 | ||
| 63 | @B efore | |
| 64 | pu blic void setup() { | |
| 65 | mock Mvc = Mock MvcBuilder s.webAppCo ntextSetup (this.wac) .build(); | |
| 66 | long x = 11111 11111L; | |
| 67 | long y = 99999 99999L; | |
| 68 | ||
| 69 | Rand om r = new Random(); | |
| 70 | rand omPhoneNum ber = x+(( long)(r.ne xtDouble() *(y-x))); | |
| 71 | ||
| 72 | String cur rent_user_ name = " DN S MTESTER"; | |
| 73 | String win dow_nt_nam e = " DN S ABCD"; | |
| 74 | Stri ng last_na me = "Jack son"; | |
| 75 | Stri ng first_n ame = "Jac ky"; | |
| 76 | String ema il = " PII "; | |
| 77 | bool ean enable d = Boolea n.TRUE; | |
| 78 | Stri ng [] requ est_roles = new Stri ng[] {"FPP S_HELP_DES K"}; | |
| 79 | ||
| 80 | List <String> r equest_fac ilities = new ArrayL ist<>(); | |
| 81 | requ est_facili ties.add(n ew Station Request("5 20", 16,"B ILOXI MS") .getDispla yFacility( )); | |
| 82 | requ est_facili ties.add(n ew Station Request("5 64", 16,"F ayettevill e NC VAMC" ).getDispl ayFacility ()); | |
| 83 | ||
| 84 | req = new User ReqRequest (current_u ser_name, window_nt_ name, last _name, fir st_name, n ull, | |
| 85 | String.v alueOf(ran domPhoneNu mber), ema il, enable d, Arrays. asList(req uest_roles ), request _facilitie s); | |
| 86 | } | |
| 87 | ||
| 88 | @T est | |
| 89 | pu blic void testLoadMo difyUserRe questForm( ) throws E xception { | |
| 90 | AppU ser appUse r = new Ap pUser(); | |
| 91 | appU ser.setApp UserId(Lon g.valueOf( 100)); | |
| 92 | appUser.se tUserName( " DN S PPSADMIN") ; | |
| 93 | appU ser.setFir stName("Te st"); | |
| 94 | appU ser.setLas tName("Tes t"); | |
| 95 | ||
| 96 | Resu ltActions s = mockMv c.perform( get("/api/ v1/userReq uest/form/ {userName} ", appUser .getUserNa me())).and Do(print() ) | |
| 97 | .andExpe ct(status( ).isOk()). andExpect( content(). contentTyp e("applica tion/json; charset=UT F-8")); | |
| 98 | ||
| 99 | logg er.info("t estGetClai mByIndex_s uccess:" + s.andRetu rn().getRe sponse().g etStatus() ); | |
| 100 | asse rtFalse(Ht tpStatus.O K.value() != s.andRe turn().get Response() .getStatus ()); | |
| 101 | } | |
| 102 | ||
| 103 | @T est | |
| 104 | pu blic void testLoadRe questUser( ) throws E xception { | |
| 105 | Resu ltActions s = mockMv c.perform( get("/api/ v1/userReq uest/form" )).andDo(p rint()) | |
| 106 | .andExpe ct(status( ).isOk()). andExpect( content(). contentTyp e("applica tion/json; charset=UT F-8")); | |
| 107 | ||
| 108 | logg er.info("t estGetClai mByIndex_s uccess:" + s.andRetu rn().getRe sponse().g etStatus() ); | |
| 109 | asse rtFalse(Ht tpStatus.O K.value() != s.andRe turn().get Response() .getStatus ()); | |
| 110 | } | |
| 111 | ||
| 112 | /* @Test | |
| 113 | pu blic void testReques tAddUser() { | |
| 114 | try { | |
| 115 | Result Actions s = mockMvc. perform(po st("/api/v 1/userRequ est/").con tentType(M ediaType.A PPLICATION _JSON) | |
| 116 | .content(g etRequestJ son())).an dDo(print( )); | |
| 117 | ||
| 118 | if(s.a ndReturn() .getRespon se().getSt atus() != HttpStatus .CREATED.v alue()) { | |
| 119 | logger.i nfo("testR equestAddU ser:" + s. andReturn( ).getRespo nse().getS tatus()); | |
| 120 | assertFa lse(HttpSt atus.BAD_R EQUEST.val ue() != s. andReturn( ).getRespo nse().getS tatus()); | |
| 121 | } else { | |
| 122 | logger.i nfo("testR equestAddU ser:" + s. andReturn( ).getRespo nse().getS tatus()); | |
| 123 | assertFa lse(HttpSt atus.CREAT ED.value() != s.andR eturn().ge tResponse( ).getStatu s()); | |
| 124 | } | |
| 125 | ||
| 126 | } ca tch (JsonP rocessingE xception e ) { | |
| 127 | logger .error("te stRequestA ddUser Jso nProcessin gException -- "); | |
| 128 | e.prin tStackTrac e(); | |
| 129 | ||
| 130 | } ca tch (Excep tion e) { | |
| 131 | e.prin tStackTrac e(); | |
| 132 | } | |
| 133 | }* / | |
| 134 | ||
| 135 | @T est | |
| 136 | pu blic void testReques tAddUser_v alidationE rror() { | |
| 137 | try { | |
| 138 | req.se tFirst_nam e("ABCDEFG HIJKLMNOPQ RSTUVWXYZ1 234567910" ); | |
| 139 | req.se tLast_name ("ABCDEFGH IJKLMNOPQR STUVWXYZ12 34"); | |
| 140 | req.se tMiddle_na me("ABCDEF GHIJKLMNOP QRSTUVWXYZ 1234"); | |
| 141 | req.se tPhone("12 3456789009 8765432112 345"); | |
| 142 | ||
| 143 | ||
| 144 | Result Actions s = mockMvc. perform(po st("/api/v 1/userRequ est/").con tentType(M ediaType.A PPLICATION _JSON) | |
| 145 | .content(g etRequestJ son())).an dDo(print( )); | |
| 146 | ||
| 147 | assert False(Http Status.BAD _REQUEST.v alue() != s.andRetur n().getRes ponse().ge tStatus()) ; | |
| 148 | ||
| 149 | } ca tch (JsonP rocessingE xception e ) { | |
| 150 | logger .error("te stRequestA ddUser Jso nProcessin gException -- "); | |
| 151 | e.prin tStackTrac e(); | |
| 152 | ||
| 153 | } ca tch (Excep tion e) { | |
| 154 | e.prin tStackTrac e(); | |
| 155 | } | |
| 156 | } | |
| 157 | ||
| 158 | /* @Test | |
| 159 | pu blic void testReques tModifyUse r() { | |
| 160 | try { | |
| 161 | //set up | |
| 162 | String [] reques t_roles = new String [] {"FPPS_ HELP_DESK" , "FEE_VIS N_PGM_MANA GER"}; | |
| 163 | req.setWin dow_nt_nam e(" DN S MABCDEFG") ; | |
| 164 | req.se tRequest_r oles(Array s.asList(r equest_rol es)); | |
| 165 | ||
| 166 | Result Actions s = mockMvc. perform(pu t("/api/v1 /userReque st/").cont entType(Me diaType.AP PLICATION_ JSON) | |
| 167 | .content(g etRequestJ son())).an dDo(print( )); | |
| 168 | ||
| 169 | if(s.a ndReturn() .getRespon se().getSt atus() != HttpStatus .OK.value( )) { | |
| 170 | logger.d ebug("test RequestMod ifyUser:" + s.andRet urn().getR esponse(). getStatus( )); | |
| 171 | assertFa lse(HttpSt atus.BAD_R EQUEST.val ue() != s. andReturn( ).getRespo nse().getS tatus()); | |
| 172 | } else { | |
| 173 | logger.d ebug("test RequestMod ifyUser:" + s.andRet urn().getR esponse(). getStatus( )); | |
| 174 | assertFa lse(HttpSt atus.OK.va lue() != s .andReturn ().getResp onse().get Status()); | |
| 175 | } | |
| 176 | ||
| 177 | } ca tch (JsonP rocessingE xception e ) { | |
| 178 | logger .error("te stRequestA ddUser Jso nProcessin gException -- "); | |
| 179 | e.prin tStackTrac e(); | |
| 180 | ||
| 181 | } ca tch (Excep tion e) { | |
| 182 | e.prin tStackTrac e(); | |
| 183 | } | |
| 184 | } | |
| 185 | */ | |
| 186 | @T est | |
| 187 | pu blic void testReques tModifyUse r_validati onError() { | |
| 188 | try { | |
| 189 | req.se tFirst_nam e("ABCDEFG HIJKLMNOPQ RSTUVWXYZ1 234567910" ); | |
| 190 | req.se tLast_name ("ABCDEFGH IJKLMNOPQR STUVWXYZ12 34"); | |
| 191 | req.se tMiddle_na me("ABCDEF GHIJKLMNOP QRSTUVWXYZ 1234"); | |
| 192 | req.se tPhone("12 3456789009 8765432112 345"); | |
| 193 | ||
| 194 | Result Actions s = mockMvc. perform(po st("/api/v 1/userRequ est/").con tentType(M ediaType.A PPLICATION _JSON) | |
| 195 | .content(g etRequestJ son())).an dDo(print( )); | |
| 196 | ||
| 197 | assert False(Http Status.BAD _REQUEST.v alue() != s.andRetur n().getRes ponse().ge tStatus()) ; | |
| 198 | ||
| 199 | } ca tch (JsonP rocessingE xception e ) { | |
| 200 | logger .error("te stRequestA ddUser Jso nProcessin gException -- "); | |
| 201 | e.prin tStackTrac e(); | |
| 202 | ||
| 203 | } ca tch (Excep tion e) { | |
| 204 | e.prin tStackTrac e(); | |
| 205 | } | |
| 206 | } | |
| 207 | ||
| 208 | pr ivate Stri ng getRequ estJson() { | |
| 209 | Stri ng request Json = nul l; | |
| 210 | try { | |
| 211 | Object Mapper map per = new ObjectMapp er(); | |
| 212 | mapper.con figure(Ser ialization Feature.WR AP_ROOT_VA LUE, false ); | |
| 213 | ObjectWrit er ow = ma pper.write r().withDe faultPrett yPrinter() ; | |
| 214 | reques tJson = ow .writeValu eAsString( req); | |
| 215 | System .out.print ln("reques tJson - " + requestJ son); | |
| 216 | ||
| 217 | } ca tch (JsonP rocessingE xception e ) { | |
| 218 | logger .error("te stRequestA ddUser Jso nProcessin gException -- "); | |
| 219 | e.prin tStackTrac e(); | |
| 220 | ||
| 221 | } | |
| 222 | ||
| 223 | /*re questJson = "{\"curr ent_user_n ame\": \"V HAISMBAIAH BBB\",\"wi ndow_nt_na me\":\"bbb b\",\"last _name\":\" dd\",\"fir st_name\": \"ddd\"," | |
| 224 | + "\ "phone\":\ "\"," | |
| 225 | + "\ "email\":\ "\",\"enab led\":\"tr ue\",\"req uest_roles \":[\"FPPS _HELP_DESK \"],\"requ est_facili ties\":[\" \"]," | |
| 226 | + "\ "disable_c omments\": \"\"}"; | |
| 227 | */ | |
| 228 | retu rn request Json; | |
| 229 | } | |
| 230 | ||
| 231 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.