16. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 12/8/2017 1:33:39 PM Central Standard Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

16.1 Files compared

# Location File Last Modified
1 PC_CP4_CiF.zip\FPPS_Backend\fpps_app\src\test\java\gov\va\med\fee\controller AuthenticatorControllerTest.java Fri Dec 8 17:51:36 2017 UTC
2 PC_CP4_CiF.zip\FPPS_Backend\fpps_app\src\test\java\gov\va\med\fee\controller AuthenticatorControllerTest.java Fri Dec 8 18:30:03 2017 UTC

16.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 2 254
Changed 1 2
Inserted 0 0
Removed 0 0

16.3 Comparison options

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

16.4 Active regular expressions

No regular expressions were active.

16.5 Comparison detail

  1   package go v.va.med.f ee.control ler;
  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 tHandlers. print;
  6   import sta tic org.sp ringframew ork.test.w eb.servlet .result.Mo ckMvcResul tMatchers. content;
  7   import sta tic org.sp ringframew ork.test.w eb.servlet .result.Mo ckMvcResul tMatchers. status;
  8  
  9   import jav a.util.Has hSet;
  10   import jav a.util.Set ;
  11  
  12   import jav ax.servlet .http.Http ServletReq uest;
  13  
  14   import org .junit.Bef ore;
  15   import org .junit.Tes t;
  16   import org .junit.run ner.RunWit h;
  17   import org .mockito.I njectMocks ;
  18   import org .mockito.M ock;
  19   import org .mockito.M ockitoAnno tations;
  20   import org .mockito.r unners.Moc kitoJUnitR unner;
  21   import org .springfra mework.htt p.HttpStat us;
  22   import org .springfra mework.htt p.MediaTyp e;
  23   import org .springfra mework.htt p.Response Entity;
  24   import org .springfra mework.tes t.web.serv let.MockMv c;
  25   import org .springfra mework.tes t.web.serv let.setup. MockMvcBui lders;
  26   import org .springfra mework.web .bind.anno tation.Req uestMappin g;
  27   import org .springfra mework.web .bind.anno tation.Req uestMethod ;
  28  
  29   import gov .va.med.fe e.exceptio ns.Generic Exception;
  30   import gov .va.med.fe e.model.re sponse.Aut henticatio nParamResp onse;
  31   import gov .va.med.fe e.model.re sponse.Use rInfoRespo nse;
  32   import gov .va.med.fe e.model.re sponse.Use rStationDe tails;
  33   import gov .va.med.fe e.service. IAuthentic atorServic e;
  34   import net .minidev.j son.JSONOb ject;
  35  
  36  
  37   /**
  38    * 
  39    * @author  Mahilet D emisse
  40    *
  41    */
  42  
  43   @RunWith(M ockitoJUni tRunner.cl ass)
  44   public cla ss Authent icatorCont rollerTest  {
  45  
  46           pr ivate Mock Mvc mockMv c;
  47  
  48           @M ock
  49           pr ivate IAut henticator Service au thenticato rService;
  50  
  51           @I njectMocks
  52           pr ivate Auth enticatorC ontroller  authentica torControl ler;
  53  
  54           @B efore
  55           pu blic void  init() thr ows Except ion {
  56                    Mock itoAnnotat ions.initM ocks(this) ;
  57                    mock Mvc = Mock MvcBuilder s.standalo neSetup(au thenticato rControlle r).build() ;
  58           }
  59  
  60           /* *
  61            *  @throws E xception
  62            * /
  63           @T est
  64           pu blic void  getUserRol es() throw s Exceptio n {
  65                    
  66                    // c reating gu id param
  67                    Stri ng guid =  "45bRjsfHG HKmLHkksf7 6";
  68                    
  69                    //cr eating the  response
  70                    User InfoRespon se userInf oResponse  = new User InfoRespon se();
  71                     userInfoRe sponse.set UserName(" DN S      DEMIS");
  72                    user InfoRespon se.setLast Login("11/ 02/2017 10 :27:12");
  73                    
  74                    // c reating th e roles
  75                    Set< String> us erRoles =  new HashSe t<String>( );
  76                    user Roles.add( "ADMIN");
  77                    user InfoRespon se.setUser Roles(user Roles);
  78                    
  79                    // c reating th e permssio ns
  80                    JSON Object per missions =  new JSONO bject();
  81                    user InfoRespon se.setPerm issions(pe rmissions) ;
  82                    
  83                    // c reating us er facilit y
  84                    User StationDet ails userF acilityDat a = new Us erStationD etails();
  85                    user InfoRespon se.setUser FacilityDa ta(userFac ilityData) ;
  86           
  87                    // m ocking ser vice calls
  88                    when (authentic atorServic e.authenti cate(guid) ).thenRetu rn(true);
  89                    when (authentic atorServic e.getUserR oles()).th enReturn(u serInfoRes ponse);
  90                    
  91                    
  92                    try  {
  93                             mockMv c.perform( get("/api/ v1/roles") .param("gu id", guid) ).andDo(pr int()).and Expect(sta tus().isOk ())
  94                             .andEx pect(conte nt().conte ntType(Med iaType.APP LICATION_J SON_UTF8_V ALUE));
  95  
  96                    } ca tch (Excep tion e) {
  97                             e.prin tStackTrac e();
  98                    }
  99           
  100  
  101           }
  102  
  103           
  104           /*
  105            *  @throws E xception
  106            * /
  107           @T est
  108           pu blic void  getAuthPar ams() thro ws Excepti on {
  109                    
  110                    // c reating se esionId
  111                    Stri ng session Id = "abc" ;
  112                    
  113                    // c reating Au th respons e
  114                    Auth entication ParamRespo nse authen ticationPa ramRespons e = null;
  115                    
  116           
  117                    // m ocking ser vice calls  
  118                    when (authentic atorServic e.getAuthP arams(sess ionId)).th enReturn(a uthenticat ionParamRe sponse);
  119                    
  120                    try  {
  121                             mockMv c.perform( get("/api/ v1/authPar ams")).and Do(print() ).andExpec t(status() .isOk());
  122                             
  123                    } ca tch (Excep tion e) {
  124                             e.prin tStackTrac e();
  125                    }
  126                    
  127           }
  128   }