Produced by Araxis Merge on 12/20/2017 5:56:13 PM Eastern 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 | Genisis_2.0_v6_bld6.zip\Source Code\UI\Services\src\test\java\gov\va\genisis2\controller | Genisis2ControllerTest.java | Thu Dec 14 19:57:11 2017 UTC |
| 2 | Genisis_2.0_v6_bld6.zip\Source Code\UI\Services\src\test\java\gov\va\genisis2\controller | Genisis2ControllerTest.java | Wed Dec 20 22:27:25 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 4 | 1166 |
| Changed | 3 | 6 |
| 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.genis is2.contro ller; | |
| 2 | ||
| 3 | import sta tic org.mo ckito.Mock ito.when; | |
| 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 .result.Mo ckMvcResul tMatchers. status; | |
| 6 | ||
| 7 | import org .junit.Ass ert; | |
| 8 | import org .junit.Ign ore; | |
| 9 | import org .junit.Tes t; | |
| 10 | import org .slf4j.Log ger; | |
| 11 | import org .slf4j.Log gerFactory ; | |
| 12 | import org .springfra mework.htt p.MediaTyp e; | |
| 13 | import org .springfra mework.htt p.Response Entity; | |
| 14 | ||
| 15 | import gov .va.genisi s2.Abstrac tMockMvcTe sts; | |
| 16 | import gov .va.genisi s2.bo.Busi nessServic e; | |
| 17 | import gov .va.genisi s2.common. enums.Comm onEnum; | |
| 18 | import gov .va.genisi s2.dao.imp l.RequestD ao; | |
| 19 | import gov .va.genisi s2.dto.Com mentHistor yDTO; | |
| 20 | import gov .va.genisi s2.dto.Req uestDTO; | |
| 21 | import gov .va.genisi s2.dto.Stu dyApproval DTO; | |
| 22 | import gov .va.genisi s2.excepti ons.ErrorR esponse; | |
| 23 | import gov .va.genisi s2.excepti ons.Genisi s2RestExce ption; | |
| 24 | import gov .va.genisi s2.excepti ons.Genisi sException ; | |
| 25 | import gov .va.genisi s2.excepti ons.Genisi sServiceEx ception; | |
| 26 | import gov .va.genisi s2.service .impl.Requ estService ; | |
| 27 | import gov .va.genisi s2.util.He lper; | |
| 28 | import gov .va.genisi s2.util.re st.helper. ResponseWr apper; | |
| 29 | import gov .va.genisi s2.vo.Copy TableSourc e; | |
| 30 | ||
| 31 | /** | |
| 32 | * The Cla ss Genisis 2Controlle rTest. | |
| 33 | * | |
| 34 | * @author 1 Janet Lo pez | |
| 35 | * @author Getaneh K assahun | |
| 36 | * | |
| 37 | * The Clas s Genisis2 Controller Test. | |
| 38 | * | |
| 39 | * Descript ion: In th is Genisis 2Controlle rTest Clas s which ex tends the | |
| 40 | * abstract class, Ab stractMock MvcTests, junit test s are defi ned. | |
| 41 | */ | |
| 42 | ||
| 43 | public cla ss Genisis 2Controlle rTest exte nds Abstra ctMockMvcT ests { | |
| 44 | ||
| 45 | /* * The LOGG ER. */ | |
| 46 | pr ivate stat ic final L ogger LOGG ER = Logge rFactory.g etLogger(G enisis2Con trollerTes t.class); | |
| 47 | ||
| 48 | pr ivate Geni sis2Contro ller genis is2Control ler; | |
| 49 | ||
| 50 | pr ivate Busi nessServic e business Service_SF _NULL; | |
| 51 | ||
| 52 | pr ivate Requ estService requestSe rvice_SF_N ULL; | |
| 53 | ||
| 54 | pr ivate Requ estDao req uestDao_SF _Null; | |
| 55 | ||
| 56 | /* * | |
| 57 | * This meth od is used to testGe nisis2Cont rollerAllR equests. | |
| 58 | * | |
| 59 | * @exceptio n Exceptio n | |
| 60 | * The exception. | |
| 61 | * / | |
| 62 | @T est | |
| 63 | pu blic void testAllReq uests() th rows Excep tion { | |
| 64 | ||
| 65 | LOGG ER.info("* *********J unit Get a ll request s********* *"); | |
| 66 | ||
| 67 | Resp onseWrappe r wrapper = new Resp onseWrappe r(); | |
| 68 | when (getMockBu sinessServ ice().getA llRequests ()).thenRe turn(wrapp er); | |
| 69 | getM ockMvc().p erform( | |
| 70 | get("/se rvices/req uests").co ntentType( MediaType. APPLICATIO N_JSON).ac cept(Media Type.APPLI CATION_JSO N)) | |
| 71 | .andExpe ct(status( ).isOk()); | |
| 72 | } | |
| 73 | ||
| 74 | /* * | |
| 75 | * This meth od is used to testGe nisis2Cont rollerGetR equestByID . | |
| 76 | * | |
| 77 | * @exceptio n Exceptio n | |
| 78 | * The exception. | |
| 79 | * / | |
| 80 | @T est | |
| 81 | pu blic void testGetReq uestByID() throws Ex ception { | |
| 82 | ||
| 83 | LOGG ER.info("* *********J unit Get R equest by ID******** **"); | |
| 84 | int id = 1; | |
| 85 | Long idL = 1L; | |
| 86 | Stri ng role = "Admin"; | |
| 87 | Resp onseWrappe r wrapper = new Resp onseWrappe r(); | |
| 88 | ||
| 89 | when (getMockBu sinessServ ice().getR equestTrac kingByID(i d, role)). thenReturn (wrapper); | |
| 90 | getM ockMvc().p erform(get ("/service s/requests /{id}", id L.toString ()).conten tType(Medi aType.APPL ICATION_JS ON) | |
| 91 | .accept( MediaType. APPLICATIO N_JSON)).a ndExpect(s tatus().is Ok()); | |
| 92 | ||
| 93 | } | |
| 94 | ||
| 95 | /* * | |
| 96 | * This meth od is used to testGe nisis2Cont rollerCopy TableDomai ns. | |
| 97 | * | |
| 98 | * @exceptio n Exceptio n | |
| 99 | * The exception. | |
| 100 | * / | |
| 101 | @T est | |
| 102 | pu blic void testCopyTa bleDomains () throws Exception { | |
| 103 | ||
| 104 | LOGG ER.info("* *********J unit Get C opy Table Domains*** *******"); | |
| 105 | ||
| 106 | Resp onseWrappe r wrapper = new Resp onseWrappe r(); | |
| 107 | when (getMockBu sinessServ ice().getC opyTableDo mainDetail s()).thenR eturn(wrap per); | |
| 108 | getM ockMvc().p erform(get ("/service s/copytabl e/domains" ).contentT ype(MediaT ype.APPLIC ATION_JSON ) | |
| 109 | .accept( MediaType. APPLICATIO N_JSON)).a ndExpect(s tatus().is Ok()); | |
| 110 | } | |
| 111 | ||
| 112 | /* * | |
| 113 | * This meth od is used to testGe nisis2Cont rollerGetD ataSources . | |
| 114 | * | |
| 115 | * @exceptio n Exceptio n | |
| 116 | * The exception. | |
| 117 | * / | |
| 118 | @T est | |
| 119 | pu blic void testGetDat aSources() throws Ex ception { | |
| 120 | ||
| 121 | LOGG ER.info("* *********J unit Get D ata Source s********* *"); | |
| 122 | ||
| 123 | Resp onseWrappe r wrapper = new Resp onseWrappe r(); | |
| 124 | when (getMockBu sinessServ ice().getR equestData Sources()) .thenRetur n(wrapper) ; | |
| 125 | getM ockMvc().p erform( | |
| 126 | get("/se rvices/dat asources") .contentTy pe(MediaTy pe.APPLICA TION_JSON) .accept(Me diaType.AP PLICATION_ JSON)) | |
| 127 | .andExpe ct(status( ).isOk()); | |
| 128 | } | |
| 129 | ||
| 130 | /* * | |
| 131 | * This meth od is used to testGe nisis2Cont rollerGetU serDetails ByEmail. | |
| 132 | * | |
| 133 | * @exceptio n Exceptio n | |
| 134 | * The exception. | |
| 135 | * / | |
| 136 | @T est | |
| 137 | pu blic void testGetUse rDetailsBy Email() th rows Excep tion { | |
| 138 | ||
| 139 | LOGG ER.info("* *********J unit Get L ogin Detai ls By Emai l********* *"); | |
| 140 | Stri ng email = "emailid@ gmail.com" ; | |
| 141 | Resp onseWrappe r wrapper = new Resp onseWrappe r(); | |
| 142 | when (getMockBu sinessServ ice().getU serDetails ByEmail(em ail)).then Return(wra pper); | |
| 143 | getM ockMvc().p erform(get ("/service s/users/{e mail}/emai l", email. toString() ) | |
| 144 | .content Type(Media Type.APPLI CATION_JSO N).accept( MediaType. APPLICATIO N_JSON)).a ndExpect(s tatus().is Ok()); | |
| 145 | } | |
| 146 | ||
| 147 | /* * | |
| 148 | * This meth od is used to testGe nisis2Cont rollerGetU sersDetail sById. | |
| 149 | * | |
| 150 | * @exceptio n Exceptio n | |
| 151 | * The exception. | |
| 152 | * / | |
| 153 | @T est | |
| 154 | pu blic void testGetUse rsDetailsB yId() thro ws Excepti on { | |
| 155 | ||
| 156 | LOGG ER.info("* *********J unit Get L ogin Detai ls By Id** ********") ; | |
| 157 | int id = 1; | |
| 158 | getM ockMvc().p erform(get ("/service s/users/{i d}", id).c ontentType (MediaType .APPLICATI ON_JSON) | |
| 159 | .accept( MediaType. APPLICATIO N_JSON)).a ndExpect(s tatus().is Ok()); | |
| 160 | } | |
| 161 | ||
| 162 | /* * | |
| 163 | * This meth od is used to testGe nisis2Cont rollerGetU serRole. | |
| 164 | * | |
| 165 | * @exceptio n Exceptio n | |
| 166 | * The exception. | |
| 167 | * / | |
| 168 | @T est | |
| 169 | pu blic void testGetUse rRole() th rows Excep tion { | |
| 170 | ||
| 171 | LOGG ER.info("* *********J unit Get U ser Role** ********") ; | |
| 172 | int id = 1; | |
| 173 | getM ockMvc().p erform(get ("/service s/users/ro le/{uid}", id).conte ntType(Med iaType.APP LICATION_J SON) | |
| 174 | .accept( MediaType. APPLICATIO N_JSON)).a ndExpect(s tatus().is Ok()); | |
| 175 | } | |
| 176 | ||
| 177 | /* * | |
| 178 | * This meth od is used to testGe nisis2Cont rollerGetR equestsByU ser. | |
| 179 | * | |
| 180 | * @exceptio n Exceptio n | |
| 181 | * The exception. | |
| 182 | * / | |
| 183 | @T est | |
| 184 | pu blic void testGetReq uestsByUse r() throws Exception { | |
| 185 | ||
| 186 | LOGG ER.info("* *********J unit Get R equests By User***** *****"); | |
| 187 | Stri ng uid = " testresear cher"; | |
| 188 | Resp onseWrappe r wrapper = new Resp onseWrappe r(); | |
| 189 | when (getMockBu sinessServ ice().getR equestsByU ID(uid)).t henReturn( wrapper); | |
| 190 | getM ockMvc().p erform(get ("/service s/requests /{uid}/cre atedBy", u id).conten tType(Medi aType.APPL ICATION_JS ON) | |
| 191 | .accept( MediaType. APPLICATIO N_JSON)).a ndExpect(s tatus().is Ok()); | |
| 192 | ||
| 193 | } | |
| 194 | ||
| 195 | /* * | |
| 196 | * This meth od is used to testGe nisis2Cont rollerGetR equestByDa taManager. | |
| 197 | * | |
| 198 | * @exceptio n Exceptio n | |
| 199 | * The exception. | |
| 200 | * / | |
| 201 | @T est | |
| 202 | pu blic void testGetReq uestByData Manager() throws Exc eption { | |
| 203 | ||
| 204 | LOGG ER.info("* *********J unit Get R equests By Data Mana ger******* ***"); | |
| 205 | Stri ng id = "t esdatatman ager"; | |
| 206 | Resp onseWrappe r wrapper = new Resp onseWrappe r(); | |
| 207 | when (getMockBu sinessServ ice().getR equestsByD ataManager s(id)).the nReturn(wr apper); | |
| 208 | getM ockMvc().p erform(get ("/service s/requests /{id}/data Manager", id).conten tType(Medi aType.APPL ICATION_JS ON) | |
| 209 | .accept( MediaType. APPLICATIO N_JSON)).a ndExpect(s tatus().is Ok()); | |
| 210 | ||
| 211 | } | |
| 212 | ||
| 213 | /* * | |
| 214 | * This meth od is used to testGe nisis2Cont rollerGetR equestsDat aSourceMan agers. | |
| 215 | * | |
| 216 | * @exceptio n Exceptio n | |
| 217 | * The exception. | |
| 218 | * / | |
| 219 | @T est | |
| 220 | pu blic void testGetReq uestsDataS ourceManag ers() thro ws Excepti on { | |
| 221 | ||
| 222 | LOGG ER.info("* *********J unit Get R equests fo r Data Sou rce Manage rs******** **"); | |
| 223 | Stri ng id = "t esdatasour cemanagers "; | |
| 224 | Resp onseWrappe r wrapper = new Resp onseWrappe r(); | |
| 225 | when (getMockBu sinessServ ice().getR equestsDat aSourceMan agers(id)) .thenRetur n(wrapper) ; | |
| 226 | getM ockMvc().p erform(get ("/service s/requests /{id}/data SourceMana ger", id). contentTyp e(MediaTyp e.APPLICAT ION_JSON) | |
| 227 | .accept( MediaType. APPLICATIO N_JSON)).a ndExpect(s tatus().is Ok()); | |
| 228 | } | |
| 229 | ||
| 230 | /* * | |
| 231 | * This meth od is used to | |
| 232 | * testGenis is2Control lerGetRequ estStudyAp provalsByI DUID. | |
| 233 | * | |
| 234 | * @exceptio n Exceptio n | |
| 235 | * The exception. | |
| 236 | * / | |
| 237 | @T est | |
| 238 | pu blic void testGetReq uestStudyA pprovalsBy IDUID() th rows Excep tion { | |
| 239 | ||
| 240 | LOGG ER.info("* *********J unit Get S tudy Appro vals by UI D********* *"); | |
| 241 | int id = 1; | |
| 242 | Long idL = 1L; | |
| 243 | Resp onseWrappe r wrapper = new Resp onseWrappe r(); | |
| 244 | ||
| 245 | when (getMockBu sinessServ ice().getA llRequests ByStudyApp roval(id)) .thenRetur n(wrapper) ; | |
| 246 | getM ockMvc() | |
| 247 | .perform (get("/ser vices/requ ests/{stud yApprovalI d}/studyAp proval", i dL.toStrin g()) | |
| 248 | .c ontentType (MediaType .APPLICATI ON_JSON).a ccept(Medi aType.APPL ICATION_JS ON)) | |
| 249 | .andExpe ct(status( ).isOk()); | |
| 250 | ||
| 251 | } | |
| 252 | ||
| 253 | /* * | |
| 254 | * This meth od is used to testGe nisis2Cont rollerGetA llStudyApp roval. | |
| 255 | * | |
| 256 | * @exceptio n Exceptio n | |
| 257 | * The exception. | |
| 258 | * / | |
| 259 | @T est | |
| 260 | pu blic void testGetAll StudyAppro val() thro ws Excepti on { | |
| 261 | ||
| 262 | // s et up stud yApproval model in s etup using hibernate template | |
| 263 | LOGG ER.info("* *********J unit Get A ll Request By Study Approval** ********") ; | |
| 264 | ||
| 265 | Resp onseWrappe r wrapper = new Resp onseWrappe r(); | |
| 266 | ||
| 267 | when (getMockBu sinessServ ice().getS tudyApprov als()).the nReturn(wr apper); | |
| 268 | getM ockMvc().p erform(get ("/service s/studyApp rovals").c ontentType (MediaType .APPLICATI ON_JSON) | |
| 269 | .accept( MediaType. APPLICATIO N_JSON)).a ndExpect(s tatus().is Ok()); | |
| 270 | ||
| 271 | } | |
| 272 | ||
| 273 | /* * | |
| 274 | * This meth od is used to testGe nisis2Cont rollerGetA llStudyApp rovalsByID . | |
| 275 | * | |
| 276 | * @exceptio n Exceptio n | |
| 277 | * The exception. | |
| 278 | * / | |
| 279 | @T est | |
| 280 | pu blic void testGetAll StudyAppro valsByID() throws Ex ception { | |
| 281 | ||
| 282 | LOGG ER.info("* *********J unit Get A ll Study A pprovals** ********") ; | |
| 283 | int id = 1; | |
| 284 | Long idL = 1L; | |
| 285 | Resp onseWrappe r wrapper = new Resp onseWrappe r(); | |
| 286 | ||
| 287 | when (getMockBu sinessServ ice().getS tudyApprov alsByID(id )).thenRet urn(wrappe r); | |
| 288 | getM ockMvc().p erform(get ("/service s/studyApp rovals/{id }", idL.to String()) | |
| 289 | .content Type(Media Type.APPLI CATION_JSO N).accept( MediaType. APPLICATIO N_JSON)).a ndExpect(s tatus().is Ok()); | |
| 290 | ||
| 291 | } | |
| 292 | ||
| 293 | /* * | |
| 294 | * This meth od is used to testGe nisis2Cont rollerGetS tudyApprov alsByIDUID . | |
| 295 | * | |
| 296 | * @exceptio n Exceptio n | |
| 297 | * The exception. | |
| 298 | * / | |
| 299 | @T est | |
| 300 | pu blic void testGetStu dyApproval sByIDUID() throws Ex ception { | |
| 301 | ||
| 302 | LOGG ER.info("* *********J unit Get S tudy Appro vals by UI D********* *"); | |
| 303 | Stri ng uid = " testmanage r"; | |
| 304 | Stri ng user = "testmanag er"; | |
| 305 | Resp onseWrappe r wrapper = new Resp onseWrappe r(); | |
| 306 | ||
| 307 | when (getMockBu sinessServ ice().getS tudyApprov alsByUID(u id)).thenR eturn(wrap per); | |
| 308 | getM ockMvc().p erform(get ("/service s/studyApp rovals/{ui d}/{user}" , uid, use r) | |
| 309 | .content Type(Media Type.APPLI CATION_JSO N).accept( MediaType. APPLICATIO N_JSON)).a ndExpect(s tatus().is Ok()); | |
| 310 | ||
| 311 | } | |
| 312 | ||
| 313 | /* * | |
| 314 | * This meth od is used to testGe nisis2Cont rollerGetR equestTrac kingByID. | |
| 315 | * | |
| 316 | * @exceptio n Exceptio n | |
| 317 | * The exception. | |
| 318 | * / | |
| 319 | @T est | |
| 320 | pu blic void testGetReq uestTracki ngByID() t hrows Exce ption { | |
| 321 | ||
| 322 | LOGG ER.info("* *********J unit Get R equest Tra cking by I D********* *"); | |
| 323 | int id = 1; | |
| 324 | Long idL = 1L; | |
| 325 | Stri ng userRol e = "Admin "; | |
| 326 | Resp onseWrappe r wrapper = new Resp onseWrappe r(); | |
| 327 | ||
| 328 | when (getMockBu sinessServ ice().getR equestTrac kingByID(i d, userRol e)).thenRe turn(wrapp er); | |
| 329 | getM ockMvc().p erform(get ("/service s/requests /{id}/{use rRole}/log ", idL.toS tring(), u serRole).c ontentType (MediaType .APPLICATI ON_JSON) | |
| 330 | .accept( MediaType. APPLICATIO N_JSON)).a ndExpect(s tatus().is Ok()); | |
| 331 | ||
| 332 | } | |
| 333 | ||
| 334 | /* * | |
| 335 | * This meth od is used to testGe nisis2Cont rollerGetR equestType s. | |
| 336 | * | |
| 337 | * @exceptio n Exceptio n | |
| 338 | * The exception. | |
| 339 | * / | |
| 340 | @T est | |
| 341 | pu blic void testGetReq uestTypes( ) throws E xception { | |
| 342 | ||
| 343 | LOGG ER.info("* *********J unit Get R equest Typ es******** **"); | |
| 344 | Resp onseWrappe r wrapper = new Resp onseWrappe r(); | |
| 345 | String use rname = " DN S USER4"; | |
| 346 | when (getMockBu sinessServ ice().getR equestType s()).thenR eturn(wrap per); | |
| 347 | getM ockMvc().p erform(get ("/service s/requestT ypes/{user name}", us ername).co ntentType( MediaType. APPLICATIO N_JSON) | |
| 348 | .accept( MediaType. APPLICATIO N_JSON)).a ndExpect(s tatus().is Ok()); | |
| 349 | ||
| 350 | } | |
| 351 | ||
| 352 | /* * | |
| 353 | * This meth od is used to testGe nisis2Cont rollerGetR equestBySt atus. | |
| 354 | * | |
| 355 | * @exceptio n Exceptio n | |
| 356 | * The exception. | |
| 357 | * / | |
| 358 | @T est | |
| 359 | pu blic void testGetReq uestByStat us() throw s Exceptio n { | |
| 360 | ||
| 361 | LOGG ER.info("* *********J unit Get A ll Request By Status ********** "); | |
| 362 | Stri ng status1 = CommonE num.NO_REC ORD_FOUND. getText(); | |
| 363 | getM ockMvc().p erform(get ("/service s/requests /{status}/ status", s tatus1).co ntentType( MediaType. APPLICATIO N_JSON) | |
| 364 | .accept( MediaType. APPLICATIO N_JSON)).a ndExpect(s tatus().is Ok()); | |
| 365 | } | |
| 366 | ||
| 367 | /* * | |
| 368 | * This meth od is used to testGe tUserByUse rname. | |
| 369 | * | |
| 370 | * @exceptio n Exceptio n | |
| 371 | * The exception. | |
| 372 | * / | |
| 373 | @T est | |
| 374 | pu blic void testGetUse rByUsernam e() throws Exception { | |
| 375 | ||
| 376 | LOGG ER.info("* *********J unit test Get UserBy Username** ********") ; | |
| 377 | String use rName = " DN S
|
|
| 378 | Resp onseWrappe r wrapper = new Resp onseWrappe r(); | |
| 379 | ||
| 380 | when (getMockBu sinessServ ice().getU serDetails ByUsername (userName) ).thenRetu rn(wrapper ); | |
| 381 | getM ockMvc().p erform(get ("/service s/users/us ername/{us ername}", userName). contentTyp e(MediaTyp e.APPLICAT ION_JSON) | |
| 382 | .accept( MediaType. APPLICATIO N_JSON)).a ndExpect(s tatus().is Ok()); | |
| 383 | ||
| 384 | } | |
| 385 | ||
| 386 | /* * | |
| 387 | * This meth od is used to test g etUserCoun tsAndLdapL astRefresh . | |
| 388 | * | |
| 389 | * @exceptio n Exceptio n | |
| 390 | * The exception. | |
| 391 | * / | |
| 392 | @T est | |
| 393 | pu blic void testGetUse rCountsAnd LdapLastRe fresh() th rows Excep tion { | |
| 394 | ||
| 395 | LOGG ER.info("* *********J unit test getUserCou ntsAndLdap LastRefres h********* *"); | |
| 396 | Resp onseWrappe r wrapper = new Resp onseWrappe r(); | |
| 397 | ||
| 398 | when (getMockBu sinessServ ice().getU serCountsA ndLdapLast Refresh()) .thenRetur n(wrapper) ; | |
| 399 | getM ockMvc().p erform(get ("/service s/users/la stRefreshe d").conten tType(Medi aType.APPL ICATION_JS ON) | |
| 400 | .accept( MediaType. APPLICATIO N_JSON)).a ndExpect(s tatus().is Ok()); | |
| 401 | ||
| 402 | } | |
| 403 | ||
| 404 | /* * | |
| 405 | * This meth od is used to test r efreshUser Data. | |
| 406 | * | |
| 407 | * @exceptio n Exceptio n | |
| 408 | * The exception. | |
| 409 | * / | |
| 410 | @T est | |
| 411 | pu blic void testRefres hUserData( ) throws E xception { | |
| 412 | ||
| 413 | LOGG ER.info("* *********J unit test refreshUse rData***** *****"); | |
| 414 | String use rname = " D N S ciss"; | |
| 415 | Resp onseWrappe r wrapper = new Resp onseWrappe r(); | |
| 416 | when (getMockBu sinessServ ice().refr eshUserDat a(username )).thenRet urn(wrappe r); | |
| 417 | getM ockMvc().p erform(get ("/service s/users/ld apRefresh/ {username} ", usernam e).content Type(Media Type.APPLI CATION_JSO N) | |
| 418 | .accept( MediaType. APPLICATIO N_JSON)).a ndExpect(s tatus().is Ok()); | |
| 419 | ||
| 420 | } | |
| 421 | ||
| 422 | /* * | |
| 423 | * This meth od is used to test r efreshUser Data. | |
| 424 | * | |
| 425 | * @exceptio n Exceptio n | |
| 426 | * The exception. | |
| 427 | * / | |
| 428 | @T est | |
| 429 | pu blic void testGetReq uestStatus Counts() t hrows Exce ption { | |
| 430 | ||
| 431 | LOGG ER.info("* *********J unit test getRequest StatusCoun ts******** **"); | |
| 432 | Resp onseWrappe r wrapper = new Resp onseWrappe r(); | |
| 433 | when (getMockBu sinessServ ice().getR equestStat usCounts() ).thenRetu rn(wrapper ); | |
| 434 | getM ockMvc().p erform(get ("/service s/requests /status/co unt").cont entType(Me diaType.AP PLICATION_ JSON) | |
| 435 | .accept( MediaType. APPLICATIO N_JSON)).a ndExpect(s tatus().is Ok()); | |
| 436 | ||
| 437 | } | |
| 438 | ||
| 439 | /* * | |
| 440 | * This meth od is used to test g etDataType s. | |
| 441 | * | |
| 442 | * @exceptio n Exceptio n | |
| 443 | * The exception. | |
| 444 | * / | |
| 445 | @T est | |
| 446 | pu blic void testGetDat aTypes() t hrows Exce ption { | |
| 447 | ||
| 448 | LOGG ER.info("* *********J unit test getDataTyp es******** **"); | |
| 449 | Resp onseWrappe r wrapper = new Resp onseWrappe r(); | |
| 450 | when (getMockBu sinessServ ice().getD ataTypes() ).thenRetu rn(wrapper ); | |
| 451 | getM ockMvc().p erform(get ("/service s/dataType s").conten tType(Medi aType.APPL ICATION_JS ON) | |
| 452 | .accept( MediaType. APPLICATIO N_JSON)).a ndExpect(s tatus().is Ok()); | |
| 453 | ||
| 454 | } | |
| 455 | ||
| 456 | /* * | |
| 457 | * This meth od is used to testGe nisis2Cont rollerPutS tudyApprov al_1. | |
| 458 | * | |
| 459 | * @exceptio n Exceptio n | |
| 460 | * The exception. | |
| 461 | * / | |
| 462 | @T est | |
| 463 | @I gnore | |
| 464 | pu blic void testPutStu dyApproval _1() throw s Exceptio n { | |
| 465 | ||
| 466 | LOGG ER.info("* *********J unit put S tudyApprov al******** **"); | |
| 467 | int id = 3; | |
| 468 | Resp onseEntity <ResponseW rapper> en t = getGen isis2Contr oller().up dateStudyA pproval(id , Helper.g etStudyApp rovalDTO() ); | |
| 469 | Asse rt.assertN otNull(ent .getStatus Code()); | |
| 470 | LOGG ER.info("* *********E nd of Juni t put Stud yApproval* *********" ); | |
| 471 | } | |
| 472 | ||
| 473 | /* * | |
| 474 | * This meth od is used to testGe nisis2Cont rollerPutS tudyApprov al_2. | |
| 475 | * | |
| 476 | * @exceptio n Exceptio n | |
| 477 | * The exception. | |
| 478 | * / | |
| 479 | @T est | |
| 480 | pu blic void testPutStu dyApproval _2() throw s Exceptio n { | |
| 481 | ||
| 482 | LOGG ER.info("* *********J unit put S tudyApprov al******** **"); | |
| 483 | int id = 0; | |
| 484 | Resp onseEntity <ResponseW rapper> en t = getGen isis2Contr oller().up dateStudyA pproval(id , Helper.g etStudyApp rovalDTO() ); | |
| 485 | ||
| 486 | Asse rt.assertN otNull(ent .getStatus Code()); | |
| 487 | ||
| 488 | LOGG ER.info("* ********* end test f or Junit p ut StudyAp proval ** ******** "); | |
| 489 | ||
| 490 | } | |
| 491 | ||
| 492 | ||
| 493 | /* * | |
| 494 | * This meth od is used to | |
| 495 | * testGenis is2Control lerPerform TableCopyT ransferTes t. | |
| 496 | * | |
| 497 | * @exceptio n Exceptio n | |
| 498 | * The exception. | |
| 499 | * / | |
| 500 | @T est | |
| 501 | @I gnore | |
| 502 | pu blic void performTab leCopyTran sferTest() throws Ex ception { | |
| 503 | LOGG ER.info("* *********J unit POST TEST for p erform Tab le Copy Tr ansfer ** ******** "); | |
| 504 | int id = 1; | |
| 505 | Copy TableSourc e copyTabl eSource1 = new CopyT ableSource (); | |
| 506 | //TODO copy TableSourc e1.setTabl eName("Tab le1"); | |
| 507 | ||
| 508 | Resp onseEntity <ResponseW rapper> en t = getGen isis2Contr oller().pe rformTable CopyTransf er(id, cop yTableSour ce1); | |
| 509 | ||
| 510 | Asse rt.assertN otNull(ent .getStatus Code()); | |
| 511 | ||
| 512 | LOGG ER.info("* *********E nd of Juni t POST TES T for Tabl e Copy Tra nsfer **** ****** " + ent.getS tatusCode( )); | |
| 513 | ||
| 514 | } | |
| 515 | ||
| 516 | /* * | |
| 517 | * This meth od is used to testGe nisis2Cont rollerCrea teStudyApp roval. | |
| 518 | * | |
| 519 | * @exceptio n Exceptio n | |
| 520 | * The exception. | |
| 521 | * / | |
| 522 | @T est | |
| 523 | @I gnore | |
| 524 | pu blic void createStud yApproval( ) throws E xception { | |
| 525 | LOGG ER.info("* *********J unit POST TEST for c reate Stud y Approval ******** ** "); | |
| 526 | ||
| 527 | Stud yApprovalD TO studyAp provalDto = Helper.g etStudyApp rovalDTO() ; | |
| 528 | Resp onseEntity <ResponseW rapper> en t = getGen isis2Contr oller().cr eateStudyA pproval(st udyApprova lDto); | |
| 529 | ||
| 530 | Asse rt.assertN otNull(ent .getStatus Code()); | |
| 531 | ||
| 532 | LOGG ER.info("* ********* end of Jun it POST TE ST for Stu dy Approva l ******* *** " + e nt.getStat usCode()); | |
| 533 | ||
| 534 | } | |
| 535 | ||
| 536 | /* * | |
| 537 | * This meth od is used to TestEx ception. | |
| 538 | * | |
| 539 | * @exceptio n Exceptio n | |
| 540 | * The exception. | |
| 541 | * / | |
| 542 | @T est | |
| 543 | pu blic void TestExcept ion() thro ws Excepti on { | |
| 544 | LOGG ER.info("* *********J unit POST TEST for E xception ********** "); | |
| 545 | ||
| 546 | Geni sis2RestEx ception ex = new Gen isis2RestE xception(" errorMessa geTestOne" ); | |
| 547 | ||
| 548 | Resp onseEntity <ErrorResp onse> ent = getGenis is2Control ler().exce ptionHandl er(ex); | |
| 549 | Asse rt.assertN otNull(ent .getStatus Code()); | |
| 550 | ||
| 551 | LOGG ER.info("* ********* end of Jun it POST TE ST for Exc eption ** ******** " + ent.ge tStatusCod e()); | |
| 552 | ||
| 553 | } | |
| 554 | ||
| 555 | /* * | |
| 556 | * This meth od is used to TestGe tBusiness. | |
| 557 | * | |
| 558 | * @exceptio n Exceptio n | |
| 559 | * The exception. | |
| 560 | * / | |
| 561 | @T est | |
| 562 | pu blic void TestGetBus iness() th rows Excep tion { | |
| 563 | LOGG ER.info("* *********J unit for b o********* "); | |
| 564 | ||
| 565 | // TODO Busi nessServic e bo = get Genisis2Co ntroller() .getBusine ssService( ); | |
| 566 | // TODO Asse rt.assertN otNull(bo) ; | |
| 567 | ||
| 568 | LOGG ER.info("* ********* end of Jun it for bo* *********" ); | |
| 569 | ||
| 570 | } | |
| 571 | ||
| 572 | pr ivate void setSessio nFactory_N ull() { | |
| 573 | ||
| 574 | requ estService _SF_NULL = new Reque stService( ); | |
| 575 | busi nessServic e_SF_NULL = new Busi nessServic e(); | |
| 576 | geni sis2Contro ller = new Genisis2C ontroller( ); | |
| 577 | requ estDao_SF_ Null = new RequestDa o(); | |
| 578 | // TODO requ estDao_SF_ Null.setSe ssionFacto ry(null); | |
| 579 | // TODO requ estService _SF_NULL.s etRequestD ao(request Dao_SF_Nul l); | |
| 580 | // T ODO: Comme nted by Pa ram | |
| 581 | //bu sinessServ ice_SF_NUL L.setReque stService( requestSer vice_SF_NU LL); | |
| 582 | // TODO geni sis2Contro ller.setBu sinessServ ice(busine ssService_ SF_NULL); | |
| 583 | ||
| 584 | } | |
| 585 | ||
| 586 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.