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