Produced by Araxis Merge on 10/27/2017 2:19:30 PM Central Daylight 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 | Source Code.zip\Source Code\Services\src\test\java\gov\va\genisis2\bo | BusinessServiceTest.java | Fri Oct 27 12:18:50 2017 UTC |
| 2 | Source Code.zip\Source Code\Services\src\test\java\gov\va\genisis2\bo | BusinessServiceTest.java | Fri Oct 27 17:35:21 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 1490 |
| Changed | 1 | 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.bo; | |
| 2 | ||
| 3 | import sta tic org.ju nit.Assert .assertNot Null; | |
| 4 | import sta tic org.mo ckito.Mock ito.when; | |
| 5 | ||
| 6 | import jav a.util.Arr ayList; | |
| 7 | import jav a.util.Dat e; | |
| 8 | import jav a.util.Lis t; | |
| 9 | ||
| 10 | import org .junit.Bef ore; | |
| 11 | import org .junit.Ign ore; | |
| 12 | import org .junit.Tes t; | |
| 13 | import org .springfra mework.bea ns.factory .annotatio n.Autowire d; | |
| 14 | ||
| 15 | import gov .va.genisi s2.Abstrac tMockMvcTe sts; | |
| 16 | import gov .va.genisi s2.convert er.Comment HistoryCon verter; | |
| 17 | import gov .va.genisi s2.convert er.Request Converter; | |
| 18 | import gov .va.genisi s2.convert er.StudyAp provalConv erter; | |
| 19 | import gov .va.genisi s2.convert er.UserCon verter; | |
| 20 | import gov .va.genisi s2.convert er.UserRef reshHistor yConverter ; | |
| 21 | import gov .va.genisi s2.dao.ICo mmentHisto ryDao; | |
| 22 | import gov .va.genisi s2.dao.ILo okUpDao; | |
| 23 | import gov .va.genisi s2.dao.IRe questDao; | |
| 24 | import gov .va.genisi s2.dao.ISt udyApprova lDao; | |
| 25 | import gov .va.genisi s2.dao.IUs erManageme ntDao; | |
| 26 | import gov .va.genisi s2.dto.Com mentHistor yDTO; | |
| 27 | import gov .va.genisi s2.dto.Req uestDTO; | |
| 28 | import gov .va.genisi s2.dto.Stu dyApproval DTO; | |
| 29 | import gov .va.genisi s2.dto.Use rCountDTO; | |
| 30 | import gov .va.genisi s2.excepti ons.Genisi sDAOExcept ion; | |
| 31 | import gov .va.genisi s2.excepti ons.Genisi sServiceEx ception; | |
| 32 | import gov .va.genisi s2.model.C ommentHist ory; | |
| 33 | import gov .va.genisi s2.model.R equest; | |
| 34 | import gov .va.genisi s2.model.R equestType ; | |
| 35 | import gov .va.genisi s2.model.S ource; | |
| 36 | import gov .va.genisi s2.model.S tudyApprov al; | |
| 37 | import gov .va.genisi s2.model.U ser; | |
| 38 | import gov .va.genisi s2.model.U serCount; | |
| 39 | import gov .va.genisi s2.model.U serRefresh History; | |
| 40 | import gov .va.genisi s2.service .impl.Comm entHistory Service; | |
| 41 | import gov .va.genisi s2.service .impl.Look UpService; | |
| 42 | import gov .va.genisi s2.service .impl.Requ estService ; | |
| 43 | import gov .va.genisi s2.service .impl.Stud yApprovalS ervice; | |
| 44 | import gov .va.genisi s2.service .impl.User Management Service; | |
| 45 | import gov .va.genisi s2.util.Eh cacheHelpe r; | |
| 46 | import gov .va.genisi s2.util.re st.helper. ResponseWr apper; | |
| 47 | import gov .va.genisi s2.vo.Copy TableSourc e; | |
| 48 | ||
| 49 | /** | |
| 50 | * @author Getaneh K assahun | |
| 51 | * | |
| 52 | */ | |
| 53 | public cla ss Busines sServiceTe st extends AbstractM ockMvcTest s { | |
| 54 | ||
| 55 | /* * | |
| 56 | * The busin essService . | |
| 57 | * / | |
| 58 | pr ivate Busi nessServic e business Service; | |
| 59 | ||
| 60 | /* * | |
| 61 | * The study ApprovalSe rvice. | |
| 62 | * / | |
| 63 | pr ivate Stud yApprovalS ervice stu dyApproval Service; | |
| 64 | ||
| 65 | /* * | |
| 66 | * The userM anagementS ervice. | |
| 67 | * / | |
| 68 | pr ivate User Management Service us erManageme ntService; | |
| 69 | ||
| 70 | /* * | |
| 71 | * The lookU pService. | |
| 72 | * / | |
| 73 | pr ivate Look UpService lookUpServ ice; | |
| 74 | ||
| 75 | /* * | |
| 76 | * The reque stService. | |
| 77 | * / | |
| 78 | pr ivate Requ estService requestSe rvice; | |
| 79 | ||
| 80 | /* * | |
| 81 | * The activ iti servic e. | |
| 82 | * | |
| 83 | * / | |
| 84 | pr ivate Acti vitiServic e activiti Service; | |
| 85 | ||
| 86 | /* * | |
| 87 | * The comme ntHistoryS ervice. | |
| 88 | * | |
| 89 | * / | |
| 90 | pr ivate Comm entHistory Service co mmentHisto ryService; | |
| 91 | ||
| 92 | /* * | |
| 93 | * The study ApprovalCo nverter. | |
| 94 | * / | |
| 95 | pr ivate Stud yApprovalC onverter s tudyApprov alConverte r; | |
| 96 | ||
| 97 | /* * | |
| 98 | * The userC onverter. | |
| 99 | * / | |
| 100 | pr ivate User Converter userConver ter; | |
| 101 | ||
| 102 | /* * | |
| 103 | * The busin essHelper. | |
| 104 | * / | |
| 105 | pr ivate Busi nessHelper businessH elper; | |
| 106 | ||
| 107 | /* * | |
| 108 | * The study Approval. | |
| 109 | * / | |
| 110 | pr ivate Stud yApproval studyAppro val; | |
| 111 | ||
| 112 | /* * | |
| 113 | * The study Approval. | |
| 114 | * / | |
| 115 | pr ivate Stud yApprovalD TO studyAp provalDto; | |
| 116 | ||
| 117 | /* * | |
| 118 | * The userR efreshHist oryConvert er. | |
| 119 | * / | |
| 120 | pr ivate User RefreshHis toryConver ter userRe freshHisto ryConverte r; | |
| 121 | ||
| 122 | /* * | |
| 123 | * The userR efreshHist oryConvert er. | |
| 124 | * / | |
| 125 | pr ivate Requ estConvert er request Converter; | |
| 126 | ||
| 127 | /* * | |
| 128 | * The userR efreshHist oryConvert er. | |
| 129 | * / | |
| 130 | pr ivate Comm entHistory Converter commentHis toryConver ter; | |
| 131 | ||
| 132 | /* * | |
| 133 | * The user. | |
| 134 | * / | |
| 135 | pr ivate User user; | |
| 136 | ||
| 137 | /* * | |
| 138 | * The reque st. | |
| 139 | * / | |
| 140 | pr ivate Requ est reques t; | |
| 141 | ||
| 142 | /* * | |
| 143 | * The comme ntHistory. | |
| 144 | * / | |
| 145 | pr ivate Comm entHistory commentHi story; | |
| 146 | ||
| 147 | /* * | |
| 148 | * The reque stDto. | |
| 149 | * / | |
| 150 | pr ivate Requ estDTO req uestDto; | |
| 151 | ||
| 152 | /* * | |
| 153 | * The comme ntHistoryD TO. | |
| 154 | * / | |
| 155 | pr ivate Comm entHistory DTO commen tHistoryDT O; | |
| 156 | ||
| 157 | /* * | |
| 158 | * The workf lowDeadend sList. | |
| 159 | * | |
| 160 | * / | |
| 161 | pr ivate List <String> w orkflowDea dendsList; | |
| 162 | ||
| 163 | /* * | |
| 164 | * The email Helper. | |
| 165 | * | |
| 166 | * / | |
| 167 | pr ivate Emai lHelper em ailHelper; | |
| 168 | ||
| 169 | ||
| 170 | pr ivate Ehca cheHelper ehcacheHel per; | |
| 171 | /* * | |
| 172 | * The study ApprovalDa o. | |
| 173 | * / | |
| 174 | @A utowired | |
| 175 | pr ivate IStu dyApproval Dao studyA pprovalDao ; | |
| 176 | ||
| 177 | /* * | |
| 178 | * The userM anagementD ao. | |
| 179 | * / | |
| 180 | @A utowired | |
| 181 | pr ivate IUse rManagemen tDao userM anagementD ao; | |
| 182 | ||
| 183 | /* * | |
| 184 | * The reque stDao. | |
| 185 | * / | |
| 186 | @A utowired | |
| 187 | pr ivate IReq uestDao re questDao; | |
| 188 | ||
| 189 | /* * | |
| 190 | * The lookU pDao. | |
| 191 | * / | |
| 192 | @A utowired | |
| 193 | pr ivate ILoo kUpDao loo kUpDao; | |
| 194 | ||
| 195 | /* * | |
| 196 | * The comme ntHistoryD ao. | |
| 197 | * / | |
| 198 | @A utowired | |
| 199 | pr ivate ICom mentHistor yDao comme ntHistoryD ao; | |
| 200 | ||
| 201 | /* * | |
| 202 | * Run befor e all test methods. | |
| 203 | * / | |
| 204 | @B efore | |
| 205 | pu blic void setUp() { | |
| 206 | ||
| 207 | busi nessServic e = new Bu sinessServ ice(); | |
| 208 | stud yApprovalS ervice = g etMockStud yApprovalS ervice(); | |
| 209 | user Management Service = getMockUse rManagemen tService() ; | |
| 210 | look UpService = getMockL ookUpServi ce(); | |
| 211 | requ estService = getMock RequestSer vice(); | |
| 212 | acti vitiServic e = getMoc kActivitiS ervice(); | |
| 213 | comm entHistory Service = getMockCom mentHistor yService() ; | |
| 214 | ||
| 215 | stud yApprovalC onverter = getMockSt udyApprova lConverter (); | |
| 216 | user Converter = getMockU serConvert er(); | |
| 217 | user RefreshHis toryConver ter = getM ockUserRef reshHistor yConverter (); | |
| 218 | requ estConvert er = new R equestConv erter(); | |
| 219 | comm entHistory Converter = new Comm entHistory Converter( ); | |
| 220 | busi nessHelper = new Bus inessHelpe r(); | |
| 221 | emai lHelper = new EmailH elper(); | |
| 222 | ehca cheHelper = new Ehca cheHelper( ); | |
| 223 | busi nessHelper .setWorkfl owDeadends List(getLi stOfworkfl owDeadends List()); | |
| 224 | ||
| 225 | ||
| 226 | user Converter. setUserApp roverConve rter(getMo ckUserAppr overConver ter()); | |
| 227 | user Converter. setUserRol eTypeConve rter(getMo ckUserRole TypeConver ter()); | |
| 228 | requ estConvert er.setRequ estTypeCon verter(get MockReques tTypeConve rter()); | |
| 229 | requ estConvert er.setSour ceConverte r(getMockS ourceConve rter()); | |
| 230 | requ estConvert er.setStud yApprovalC onverter(g etMockStud yApprovalC onverter() ); | |
| 231 | ||
| 232 | stud yApprovalS ervice.set StudyAppro valDao(get MockStudyA pprovalDao ()); | |
| 233 | user Management Service.se tUserManag ementDao(g etMockUser Management Dao()); | |
| 234 | look UpService. setLookUpD ao(getMock LookUpDao( )); | |
| 235 | requ estService .setReques tDao(getMo ckRequestD ao()); | |
| 236 | comm entHistory Service.se tCommentHi storyDao(g etMockComm entHistory Dao()); | |
| 237 | ||
| 238 | busi nessServic e.setStudy ApprovalCo nverter(st udyApprova lConverter ); | |
| 239 | busi nessServic e.setUserC onverter(u serConvert er); | |
| 240 | busi nessServic e.setUserR efreshHist oryConvert er(userRef reshHistor yConverter ); | |
| 241 | busi nessServic e.setSourc eConverter (getMockSo urceConver ter()); | |
| 242 | busi nessServic e.setReque stTypeConv erter(getM ockRequest TypeConver ter()); | |
| 243 | busi nessServic e.setGenis isProperti esUtil(get MockGenisi sPropertie sUtil()); | |
| 244 | busi nessServic e.setReque stConverte r(requestC onverter); | |
| 245 | busi nessServic e.setComme ntHistoryC onverter(c ommentHist oryConvert er); | |
| 246 | ||
| 247 | busi nessServic e.setStudy ApprovalSe rvice(stud yApprovalS ervice); | |
| 248 | busi nessServic e.setUserM anagementS ervice(use rManagemen tService); | |
| 249 | busi nessServic e.setLookU pService(l ookUpServi ce); | |
| 250 | busi nessServic e.setReque stService( requestSer vice); | |
| 251 | busi nessServic e.setActiv itiService (activitiS ervice); | |
| 252 | busi nessServic e.setComme ntHistoryS ervice(com mentHistor yService); | |
| 253 | busi nessServic e.setBusin essHelper( businessHe lper); | |
| 254 | busi nessServic e.setEmail Helper(ema ilHelper); | |
| 255 | busi nessServic e.setEhcac heHelper(e hcacheHelp er); | |
| 256 | } | |
| 257 | ||
| 258 | /* * | |
| 259 | * To testCr eateStudyA pproval. | |
| 260 | * / | |
| 261 | @T est | |
| 262 | pu blic void testCreate StudyAppro val() thro ws Genisis ServiceExc eption, Ge nisisDAOEx ception { | |
| 263 | ||
| 264 | Stud yApprovalD TO studyAp proval = s tudyApprov alConverte r.convert( studyAppro valDao.get StudyAppro valsByID(1 76)); | |
| 265 | when (getMockSt udyApprova lService() .createStu dyApproval (studyAppr ovalDao.ge tStudyAppr ovalsByID( 176))) | |
| 266 | .thenRet urn(176); | |
| 267 | asse rtNotNull( businessSe rvice.crea teStudyApp roval(stud yApproval) ); | |
| 268 | } | |
| 269 | ||
| 270 | /* * | |
| 271 | * To testCr eateStudyA pproval. | |
| 272 | * / | |
| 273 | @T est | |
| 274 | pu blic void testCreate StudyAppro val_Null1( ) throws G enisisServ iceExcepti on { | |
| 275 | ||
| 276 | when (getMockSt udyApprova lService() .createStu dyApproval (null)).th enReturn(0 ); | |
| 277 | asse rtNotNull( businessSe rvice.crea teStudyApp roval(null )); | |
| 278 | } | |
| 279 | ||
| 280 | /* * | |
| 281 | * To testCr eateStudyA pproval. | |
| 282 | * / | |
| 283 | @T est | |
| 284 | pu blic void testCreate StudyAppro val_Null2( ) throws G enisisServ iceExcepti on { | |
| 285 | ||
| 286 | when (getMockSt udyApprova lService() .createStu dyApproval (new Study Approval() )).thenRet urn(0); | |
| 287 | asse rtNotNull( businessSe rvice.crea teStudyApp roval(new StudyAppro valDTO())) ; | |
| 288 | } | |
| 289 | ||
| 290 | /* * | |
| 291 | * To testGe tStudyAppr ovalsByID. | |
| 292 | * | |
| 293 | * @throws G enisisDAOE xception | |
| 294 | * / | |
| 295 | @T est | |
| 296 | pu blic void testGetStu dyApproval sByID() th rows Genis isServiceE xception, GenisisDAO Exception { | |
| 297 | ||
| 298 | Stud yApproval StudyAppro val = stud yApprovalD ao.getStud yApprovals ByID(176); | |
| 299 | when (getMockSt udyApprova lService() .getStudyA pprovalsBy ID(176)).t henReturn( StudyAppro val); | |
| 300 | asse rtNotNull( businessSe rvice.getS tudyApprov alsByID(17 6)); | |
| 301 | } | |
| 302 | ||
| 303 | /* * | |
| 304 | * To test g etStudyApp rovalsByUI D. | |
| 305 | * | |
| 306 | * @throws G enisisDAOE xception | |
| 307 | * / | |
| 308 | @T est | |
| 309 | pu blic void testGetStu dyApproval sByUID() t hrows Geni sisService Exception, GenisisDA OException { | |
| 310 | ||
| 311 | List <StudyAppr oval> Stud yApprovals = studyAp provalDao. getStudyAp provalsByU ID("create dBy"); | |
| 312 | when (getMockSt udyApprova lService() .getStudyA pprovalsBy UID("creat edBy")).th enReturn(S tudyApprov als); | |
| 313 | asse rtNotNull( businessSe rvice.getS tudyApprov alsByUID(" createdBy" )); | |
| 314 | } | |
| 315 | ||
| 316 | /* * | |
| 317 | * To test g etStudyApp rovals. | |
| 318 | * | |
| 319 | * @throws G enisisDAOE xception | |
| 320 | * / | |
| 321 | @T est | |
| 322 | pu blic void testGetStu dyApproval s() throws GenisisSe rviceExcep tion, Geni sisDAOExce ption { | |
| 323 | ||
| 324 | List <StudyAppr oval> Stud yApprovals = studyAp provalDao. getStudyAp provals(); | |
| 325 | when (getMockSt udyApprova lService() .getStudyA pprovals() ).thenRetu rn(StudyAp provals); | |
| 326 | asse rtNotNull( businessSe rvice.getS tudyApprov als()); | |
| 327 | } | |
| 328 | ||
| 329 | /* * | |
| 330 | * To test g etUserDeta ilsByUsern ame. | |
| 331 | * | |
| 332 | * @throws G enisisDAOE xception | |
| 333 | * / | |
| 334 | @T est | |
| 335 | pu blic void testGetUse rDetailsBy Username() throws Ge nisisServi ceExceptio n, Genisis DAOExcepti on { | |
| 336 | ||
| 337 | User user = userMana gementDao. getUserDet ailsByUser name(" DN S FRANCISS") ; | |
| 338 | when(getMo ckUserMana gementServ ice().getU serDetails ByUsername (" DN S FRANCISS") ).thenRetu rn(user); | |
| 339 | assertNotN ull(busine ssService. getUserDet ailsByUser name(" DN S FRANCISS") ); | |
| 340 | } | |
| 341 | ||
| 342 | /* * | |
| 343 | * To test g etUserCoun tsAndLdapL astRefresh . | |
| 344 | * | |
| 345 | * / | |
| 346 | @T est | |
| 347 | pu blic void testGetUse rCountsAnd LdapLastRe fresh() th rows Genis isServiceE xception { | |
| 348 | ||
| 349 | List <UserCount > userCoun ts = getMo ckUserMana gementServ ice().getU serCountOn Role(); | |
| 350 | Date lastRefre shed = get MockUserMa nagementSe rvice().ge tLatestUse rRefreshHi story(); | |
| 351 | when (getMockUs erManageme ntService( ).getUserC ountOnRole ()).thenRe turn(userC ounts); | |
| 352 | when (getMockUs erManageme ntService( ).getLates tUserRefre shHistory( )).thenRet urn(lastRe freshed); | |
| 353 | User CountDTO u serCountDT O = getMoc kUserCount Converter( ).populate UserCount( userCounts , lastRefr eshed); | |
| 354 | when (getMockUs erCountCon verter().p opulateUse rCount(use rCounts, l astRefresh ed)).thenR eturn(user CountDTO); | |
| 355 | asse rtNotNull( businessSe rvice.getU serCountsA ndLdapLast Refresh()) ; | |
| 356 | } | |
| 357 | ||
| 358 | /* * | |
| 359 | * To test t estRefresh UserData. | |
| 360 | * | |
| 361 | * / | |
| 362 | @T est | |
| 363 | pu blic void testRefres hUserData( ) throws G enisisServ iceExcepti on { | |
| 364 | ||
| 365 | when (getMockUs erManageme ntService( ).createUs erRefreshH istory(new UserRefre shHistory( ))).thenRe turn(1); | |
| 366 | } | |
| 367 | ||
| 368 | /* * | |
| 369 | * To test g etGenisisA PIDetails. | |
| 370 | * | |
| 371 | * / | |
| 372 | @T est | |
| 373 | pu blic void testGetGen isisAPIDet ails() thr ows Genisi sServiceEx ception { | |
| 374 | ||
| 375 | Resp onseWrappe r response Wrapper = new Respon seWrapper( ); | |
| 376 | when (getMockBu sinessServ ice().getG enisisAPID etails()). thenReturn (responseW rapper); | |
| 377 | busi nessServic e.getClass (); | |
| 378 | // a ssertNotNu ll(busines sService.g etGenisisA PIDetails( )); | |
| 379 | } | |
| 380 | ||
| 381 | /* * | |
| 382 | * To test u pdateStudy Approval. | |
| 383 | * | |
| 384 | * @throws G enisisDAOE xception | |
| 385 | * | |
| 386 | * / | |
| 387 | @T est | |
| 388 | pu blic void testUpdate StudyAppro val() thro ws Genisis ServiceExc eption, Ge nisisDAOEx ception { | |
| 389 | ||
| 390 | stud yApprovalC onverter = new Study ApprovalCo nverter(); | |
| 391 | stud yApproval = studyApp rovalDao.g etStudyApp rovalsByID (177); | |
| 392 | stud yApprovalD to = study ApprovalCo nverter.co nvert(stud yApproval) ; | |
| 393 | when (getMockSt udyApprova lService() .updateStu dyApproval (studyAppr oval)).the nReturn(17 6); | |
| 394 | asse rtNotNull( businessSe rvice.upda teStudyApp roval(stud yApprovalD to)); | |
| 395 | } | |
| 396 | ||
| 397 | /* * | |
| 398 | * To test u pdateStudy Approval. | |
| 399 | * | |
| 400 | * | |
| 401 | * / | |
| 402 | @T est | |
| 403 | pu blic void testUpdate StudyAppro val_Null() throws Ge nisisServi ceExceptio n { | |
| 404 | ||
| 405 | when (getMockSt udyApprova lService() .updateStu dyApproval (null)).th enReturn(0 ); | |
| 406 | asse rtNotNull( businessSe rvice.upda teStudyApp roval(null )); | |
| 407 | } | |
| 408 | ||
| 409 | /* * | |
| 410 | * To test u pdateStudy Approval. | |
| 411 | * | |
| 412 | * | |
| 413 | * / | |
| 414 | @T est | |
| 415 | pu blic void testUpdate StudyAppro val_Id0() throws Gen isisServic eException { | |
| 416 | ||
| 417 | when (getMockSt udyApprova lService() .updateStu dyApproval (new Study Approval() )).thenRet urn(0); | |
| 418 | asse rtNotNull( businessSe rvice.upda teStudyApp roval(new StudyAppro valDTO())) ; | |
| 419 | } | |
| 420 | ||
| 421 | /* * | |
| 422 | * To test g etRequestD ataSources . | |
| 423 | * | |
| 424 | * | |
| 425 | * / | |
| 426 | @T est | |
| 427 | pu blic void testGetReq uestDataSo urces() th rows Genis isServiceE xception { | |
| 428 | ||
| 429 | List <Source> d ataSource = getMockL ookUpServi ce().getDa taSources( ); | |
| 430 | when (getMockLo okUpServic e().getDat aSources() ).thenRetu rn(dataSou rce); | |
| 431 | asse rtNotNull( businessSe rvice.getR equestData Sources()) ; | |
| 432 | } | |
| 433 | ||
| 434 | /* * | |
| 435 | * To test g etRequestT ypes. | |
| 436 | * | |
| 437 | * | |
| 438 | * / | |
| 439 | @T est | |
| 440 | pu blic void testGetReq uestTypes( ) throws G enisisServ iceExcepti on { | |
| 441 | ||
| 442 | List <RequestTy pe> listRe questTypes = getMock LookUpServ ice().getR equestType s(); | |
| 443 | when (getMockLo okUpServic e().getReq uestTypes( )).thenRet urn(listRe questTypes ); | |
| 444 | asse rtNotNull( businessSe rvice.getR equestType s()); | |
| 445 | } | |
| 446 | ||
| 447 | /* * | |
| 448 | * To test g etUserDeta ilsByEmail . | |
| 449 | * | |
| 450 | * | |
| 451 | * / | |
| 452 | @T est | |
| 453 | pu blic void testGetUse rDetailsBy Email() th rows Genis isServiceE xception { | |
| 454 | ||
| 455 | user = userMan agementSer vice.getUs erDetailsB yEmail("ge nisisad@gm ail.com"); | |
| 456 | when (getMockUs erManageme ntService( ).getUserD etailsByEm ail("genis isad@gmail .com")).th enReturn(u ser); | |
| 457 | asse rtNotNull( businessSe rvice.getU serDetails ByEmail("g enisisad@g mail.com") ); | |
| 458 | } | |
| 459 | ||
| 460 | /* * | |
| 461 | * To test g etUserDeta ilsById. | |
| 462 | * | |
| 463 | * | |
| 464 | * / | |
| 465 | @T est | |
| 466 | pu blic void testGetUse rDetailsBy Id() throw s GenisisS erviceExce ption { | |
| 467 | ||
| 468 | user = userMan agementSer vice.getUs erDetailsB yId(1); | |
| 469 | when (getMockUs erManageme ntService( ).getUserD etailsById (1)).thenR eturn(user ); | |
| 470 | asse rtNotNull( businessSe rvice.getU serDetails ById(1)); | |
| 471 | } | |
| 472 | ||
| 473 | /* * | |
| 474 | * To test g etUserRole . | |
| 475 | * | |
| 476 | * | |
| 477 | * / | |
| 478 | @T est | |
| 479 | pu blic void testGetUse rRole() th rows Genis isServiceE xception { | |
| 480 | ||
| 481 | Stri ng uid = u serManagem entService .getUserRo le(1); | |
| 482 | when (getMockUs erManageme ntService( ).getUserR ole(1)).th enReturn(u id); | |
| 483 | asse rtNotNull( businessSe rvice.getU serRole(1) ); | |
| 484 | } | |
| 485 | ||
| 486 | /* * | |
| 487 | * To test c reateReque st. | |
| 488 | * | |
| 489 | * @throws G enisisDAOE xception | |
| 490 | * | |
| 491 | * | |
| 492 | * / | |
| 493 | @T est | |
| 494 | pu blic void testCreate Request() throws Gen isisServic eException , GenisisD AOExceptio n { | |
| 495 | ||
| 496 | Stri ng process InstanceId = "proces sInstanceI d"; | |
| 497 | requ est = requ estDao.get RequestByI d(1); | |
| 498 | requ estDto = r equestConv erter.conv ert(reques t); | |
| 499 | when (getMockRe questServi ce().getRe questById( 1)).thenRe turn(reque st); | |
| 500 | when (getMockAc tivitiServ ice().star tProcess(r equest.get CreatedBy( ))).thenRe turn(proce ssInstance Id); | |
| 501 | asse rtNotNull( businessSe rvice.crea teRequest( requestDto )); | |
| 502 | } | |
| 503 | ||
| 504 | /* * | |
| 505 | * To test c reateReque st. | |
| 506 | * | |
| 507 | * @throws G enisisDAOE xception | |
| 508 | * | |
| 509 | * | |
| 510 | * / | |
| 511 | @T est | |
| 512 | pu blic void testCreate Request_Ap proverIdNu ll() throw s GenisisS erviceExce ption, Gen isisDAOExc eption { | |
| 513 | ||
| 514 | Stri ng process InstanceId = "proces sInstanceI d"; | |
| 515 | requ est = requ estDao.get RequestByI d(1); | |
| 516 | requ estDto = r equestConv erter.conv ert(reques t); | |
| 517 | requ estDto.set ApproverId (null); | |
| 518 | when (getMockRe questServi ce().getRe questById( 1)).thenRe turn(reque st); | |
| 519 | when (getMockAc tivitiServ ice().star tProcess(r equest.get CreatedBy( ))).thenRe turn(proce ssInstance Id); | |
| 520 | asse rtNotNull( businessSe rvice.crea teRequest( requestDto )); | |
| 521 | } | |
| 522 | ||
| 523 | /* * | |
| 524 | * To test g etRequestB yID. | |
| 525 | * | |
| 526 | * @throws G enisisDAOE xception | |
| 527 | * | |
| 528 | * | |
| 529 | * / | |
| 530 | @T est | |
| 531 | pu blic void testGetReq uestByID() throws Ge nisisServi ceExceptio n, Genisis DAOExcepti on { | |
| 532 | ||
| 533 | requ est = requ estDao.get RequestByI d(1); | |
| 534 | when (getMockRe questServi ce().getRe questById( 1)).thenRe turn(reque st); | |
| 535 | asse rtNotNull( businessSe rvice.getR equestByID (1)); | |
| 536 | } | |
| 537 | ||
| 538 | /* * | |
| 539 | * To test g etRequestT rackingByI D. | |
| 540 | * | |
| 541 | * @throws G enisisDAOE xception | |
| 542 | * | |
| 543 | * | |
| 544 | * / | |
| 545 | @T est | |
| 546 | pu blic void testGetReq uestTracki ngByID() t hrows Geni sisService Exception, GenisisDA OException { | |
| 547 | ||
| 548 | requ est = requ estDao.get RequestByI d(1); | |
| 549 | when (getMockRe questServi ce().getRe questById( 1)).thenRe turn(reque st); | |
| 550 | asse rtNotNull( businessSe rvice.getR equestTrac kingByID(1 , "Admin") ); | |
| 551 | } | |
| 552 | ||
| 553 | /* * | |
| 554 | * To test g etRequests ByUID. | |
| 555 | * | |
| 556 | * | |
| 557 | * | |
| 558 | * / | |
| 559 | @T est | |
| 560 | pu blic void testGetReq uestsByUID () throws GenisisSer viceExcept ion { | |
| 561 | ||
| 562 | List <Request> requests = getMockRe questServi ce().getRe questsByUI D("dataman ager4"); | |
| 563 | when (getMockRe questServi ce().getRe questsByUI D("dataman ager4")).t henReturn( requests); | |
| 564 | asse rtNotNull( businessSe rvice.getR equestsByU ID("datama nager4")); | |
| 565 | } | |
| 566 | ||
| 567 | /* * | |
| 568 | * To test g etRequests ByDataMana gers. | |
| 569 | * | |
| 570 | * | |
| 571 | * | |
| 572 | * / | |
| 573 | @T est | |
| 574 | pu blic void testGetReq uestsByDat aManagers( ) throws G enisisServ iceExcepti on { | |
| 575 | ||
| 576 | List <Request> requests = getMockRe questServi ce().getRe questsByDa taManagers ("datamana ger4"); | |
| 577 | when (getMockRe questServi ce().getRe questsByDa taManagers ("datamana ger4")).th enReturn(r equests); | |
| 578 | asse rtNotNull( businessSe rvice.getR equestsByD ataManager s("dataman ager4")); | |
| 579 | } | |
| 580 | ||
| 581 | /* * | |
| 582 | * To test g etRequests DataSource Managers. | |
| 583 | * | |
| 584 | * | |
| 585 | * | |
| 586 | * / | |
| 587 | @T est | |
| 588 | pu blic void testGetReq uestsDataS ourceManag ers() thro ws Genisis ServiceExc eption { | |
| 589 | ||
| 590 | List <Request> requests = getMockRe questServi ce().getRe questsData SourceMana gers("data manager4") ; | |
| 591 | when (getMockRe questServi ce().getRe questsData SourceMana gers("data manager4") ).thenRetu rn(request s); | |
| 592 | asse rtNotNull( businessSe rvice.getR equestsDat aSourceMan agers("dat amanager4" )); | |
| 593 | } | |
| 594 | ||
| 595 | /* * | |
| 596 | * To test g etAllReque sts. | |
| 597 | * | |
| 598 | * | |
| 599 | * | |
| 600 | * / | |
| 601 | @T est | |
| 602 | pu blic void testGetAll Requests() throws Ge nisisServi ceExceptio n { | |
| 603 | ||
| 604 | List <Request> requests = getMockRe questServi ce().getAl lRequests( ); | |
| 605 | when (getMockRe questServi ce().getAl lRequests( )).thenRet urn(reques ts); | |
| 606 | asse rtNotNull( businessSe rvice.getA llRequests ()); | |
| 607 | } | |
| 608 | ||
| 609 | /* * | |
| 610 | * To test g etAllReque stsByStudy Approval. | |
| 611 | * | |
| 612 | * @throws G enisisDAOE xception | |
| 613 | * | |
| 614 | * | |
| 615 | * | |
| 616 | * / | |
| 617 | @T est | |
| 618 | pu blic void testGetAll RequestsBy StudyAppro val() thro ws Genisis ServiceExc eption, Ge nisisDAOEx ception { | |
| 619 | ||
| 620 | Stud yApproval studayAppr oval = stu dyApproval Dao.getStu dyApproval sByID(176) ; | |
| 621 | int studyAppro valId = st udayApprov al.getId() ; | |
| 622 | List <Request> requests = getMockRe questServi ce().getAl lRequestsB yStudyAppr oval(study ApprovalId ); | |
| 623 | when (getMockRe questServi ce().getAl lRequestsB yStudyAppr oval(study ApprovalId )).thenRet urn(reques ts); | |
| 624 | asse rtNotNull( businessSe rvice.getA llRequests ByStudyApp roval(stud ayApproval .getId())) ; | |
| 625 | } | |
| 626 | ||
| 627 | /* * | |
| 628 | * To test g etAllReque stsByStaus . | |
| 629 | * | |
| 630 | * @throws G enisisDAOE xception | |
| 631 | * | |
| 632 | * | |
| 633 | * | |
| 634 | * / | |
| 635 | @T est | |
| 636 | pu blic void testGetAll RequestsBy Staus() th rows Genis isServiceE xception, GenisisDAO Exception { | |
| 637 | ||
| 638 | Sour ce source = lookUpDa o.getSourc e(1); | |
| 639 | List <Request> requests = getMockRe questServi ce().getAl lRequestsB yStaus(sou rce.getDes cription() ); | |
| 640 | when (getMockRe questServi ce().getAl lRequestsB yStaus(sou rce.getDes cription() )).thenRet urn(reques ts); | |
| 641 | asse rtNotNull( businessSe rvice.getA llRequests ByStaus(so urce.getDe scription( ))); | |
| 642 | } | |
| 643 | ||
| 644 | /* * | |
| 645 | * To test s ubmitOrMod ify. | |
| 646 | * | |
| 647 | * @throws G enisisDAOE xception | |
| 648 | * | |
| 649 | * | |
| 650 | * | |
| 651 | * / | |
| 652 | @T est | |
| 653 | pu blic void testSubmit OrModify() throws Ge nisisServi ceExceptio n, Genisis DAOExcepti on { | |
| 654 | ||
| 655 | Stri ng process InstanceId = "proces sInstanceI d"; | |
| 656 | requ est = requ estDao.get RequestByI d(1); | |
| 657 | requ estDto = r equestConv erter.conv ert(reques t); | |
| 658 | when (getMockRe questServi ce().getRe questById( 1)).thenRe turn(reque st); | |
| 659 | when (getMockAc tivitiServ ice().star tProcess(r equest.get CreatedBy( ))).thenRe turn(proce ssInstance Id); | |
| 660 | when (getMockRe questServi ce().submi tOrModify( request)). thenReturn (1); | |
| 661 | asse rtNotNull( businessSe rvice.subm itOrModify (requestDt o)); | |
| 662 | } | |
| 663 | ||
| 664 | /* * | |
| 665 | * To test p ersist. | |
| 666 | * | |
| 667 | * @throws G enisisDAOE xception | |
| 668 | * | |
| 669 | * | |
| 670 | * | |
| 671 | * / | |
| 672 | @T est | |
| 673 | @I gnore | |
| 674 | pu blic void persist() throws Gen isisServic eException , GenisisD AOExceptio n { | |
| 675 | ||
| 676 | requ est = requ estDao.get RequestByI d(1); | |
| 677 | requ estDto = r equestConv erter.conv ert(reques t); | |
| 678 | when (getMockRe questServi ce().getRe questById( 1)).thenRe turn(reque st); | |
| 679 | asse rtNotNull( businessSe rvice.pers ist(1, req uestDto, r equestDto. getStatusD escription ())); | |
| 680 | } | |
| 681 | ||
| 682 | /* * | |
| 683 | * To test C reateComme ntHistory. | |
| 684 | * | |
| 685 | * @throws G enisisDAOE xception | |
| 686 | * | |
| 687 | * | |
| 688 | * | |
| 689 | * / | |
| 690 | @T est | |
| 691 | pu blic void testCreate CommentHis tory() thr ows Genisi sServiceEx ception, G enisisDAOE xception { | |
| 692 | ||
| 693 | requ est = requ estDao.get RequestByI d(1); | |
| 694 | comm entHistory = comment HistoryDao .getCommen tHistoryBy CommentId( 1); | |
| 695 | comm entHistory .setReques t(request) ; | |
| 696 | comm entHistory .setReques tId(reques t.getId()) ; | |
| 697 | comm entHistory .setCommen tTypeId(1) ; | |
| 698 | comm entHistory DTO = comm entHistory Converter. convert(co mmentHisto ry); | |
| 699 | when (getMockRe questServi ce().getRe questById( 1)).thenRe turn(reque st); | |
| 700 | when (getMockLo okUpServic e().getSta tusId(comm entHistory .getStatus ())).thenR eturn(1); | |
| 701 | when (getMockCo mmentHisto ryService( ).submitOr Modify(com mentHistor y)).thenRe turn(1); | |
| 702 | asse rtNotNull( businessSe rvice.crea teCommentH istory(com mentHistor yDTO)); | |
| 703 | } | |
| 704 | ||
| 705 | /* * | |
| 706 | * To test t estPerform TableCopyT ransfer. | |
| 707 | * | |
| 708 | * / | |
| 709 | @T est | |
| 710 | pu blic void testPerfor mTableCopy Transfer() throws Ge nisisServi ceExceptio n { | |
| 711 | ||
| 712 | Resp onseWrappe r wrapper = new Resp onseWrappe r(); | |
| 713 | Copy TableSourc e copyTabl eSource = new CopyTa bleSource( "tableName Test", "tc SourceData BaseServer NameTest", | |
| 714 | "tcSourc eDataBaseN ameTest", "sourceSch emaNameTes t", "tcDes tinationDa taBaseServ erNameTest ", | |
| 715 | "tcDesti nationData BaseUserNa meTest", " tcDestinat ionDataBas eUserPassw ordTest", | |
| 716 | "tcDesti nationServ erDataBase NameTest", "destinat ionSchemaN ameTest", | |
| 717 | "tcManag ementDataB aseServerN ameTest", "tcManagem entDataBas eUserNameT est", | |
| 718 | "tcManag ementDataB aseUserPas swordTest" , "tcManag ementDataB aseSchemaT est", "cmd FilePathTe st", | |
| 719 | "tcManag ementDataB aseNameTes t", "tcTem poraryData BaseNameTe st"); | |
| 720 | //a ssertNotNu ll(busines sService.p erformTabl eCopyTrans fer(copyTa bleSource, 1)); | |
| 721 | } | |
| 722 | ||
| 723 | /* * | |
| 724 | * To test t estGetCopy TableDomai nDetails. | |
| 725 | * | |
| 726 | * / | |
| 727 | @T est | |
| 728 | pu blic void testGetCop yTableDoma inDetails( ) throws G enisisServ iceExcepti on { | |
| 729 | ||
| 730 | asse rtNotNull( businessSe rvice.getC opyTableDo mainDetail s()); | |
| 731 | } | |
| 732 | ||
| 733 | /* * | |
| 734 | * To getLis tOfworkflo wDeadendsL ist. | |
| 735 | * | |
| 736 | * / | |
| 737 | pr ivate List <String> g etListOfwo rkflowDead endsList ( ){ | |
| 738 | work flowDeaden dsList = n ew ArrayLi st<String> (); | |
| 739 | work flowDeaden dsList.add ("Denied") ; | |
| 740 | work flowDeaden dsList.add ("RequestN otAccepted "); | |
| 741 | work flowDeaden dsList.add ("ResultsN otAccepted "); | |
| 742 | work flowDeaden dsList.add ("Cancelle d"); | |
| 743 | ||
| 744 | retu rn workflo wDeadendsL ist; | |
| 745 | ||
| 746 | } | |
| 747 | ||
| 748 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.