7310. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 3/8/2018 10:14:54 AM 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.

7310.1 Files compared

# Location File Last Modified
1 PRE_PPS-N_v3.0.1.zip\PS_PPS_srv\src\test\java\gov\va\med\pharmacy\peps\service\common\session\impl CopayTierMigrationServiceImplTest.java Fri Jan 12 15:43:40 2018 UTC
2 PRE_PPS-N_v3.0.1.zip\PS_PPS_srv\src\test\java\gov\va\med\pharmacy\peps\service\common\session\impl CopayTierMigrationServiceImplTest.java Wed Mar 7 18:59:35 2018 UTC

7310.2 Comparison summary

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

7310.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

7310.4 Active regular expressions

No regular expressions were active.

7310.5 Comparison detail

  1   package go v.va.med.p harmacy.pe ps.service .common.se ssion.impl ;
  2  
  3   import sta tic org.ea symock.Eas yMock.anyO bject;
  4   import sta tic org.ea symock.Eas yMock.anyS tring;
  5   import sta tic org.ea symock.Eas yMock.expe ct;
  6   import sta tic org.ha mcrest.Cor eMatchers. equalTo;
  7   import sta tic org.ju nit.Assert .assertTha t;
  8  
  9   import jav a.io.File;
  10   import jav a.time.Ins tant;
  11   import jav a.time.Loc alDate;
  12   import jav a.util.Arr ayList;
  13   import jav a.util.Arr ays;
  14   import jav a.util.Col lection;
  15   import jav a.util.Col lections;
  16   import jav a.util.Dat e;
  17   import jav a.util.Lis t;
  18  
  19   import org .easymock. EasyMockSu pport;
  20   import org .hamcrest. CoreMatche rs;
  21   import org .junit.Bef ore;
  22   import org .junit.Tes t;
  23  
  24   import gov .va.med.ph armacy.pep s.common.u tility.Con figFileUti lity;
  25   import gov .va.med.ph armacy.pep s.common.u tility.Dat eTimeUtili ty;
  26   import gov .va.med.ph armacy.pep s.common.u tility.Env ironmentUt ility;
  27   import gov .va.med.ph armacy.pep s.common.u tility.Pps Configurat ion;
  28   import gov .va.med.ph armacy.pep s.common.u tility.tes t.generato r.CopayTie rGenerator ;
  29   import gov .va.med.ph armacy.pep s.common.u tility.tes t.generato r.UserGene rator;
  30   import gov .va.med.ph armacy.pep s.common.v o.CopayTie rVo;
  31   import gov .va.med.ph armacy.pep s.common.v o.Migratio nCopayTier Vo;
  32   import gov .va.med.ph armacy.pep s.common.v o.UserVo;
  33   import gov .va.med.ph armacy.pep s.domain.c ommon.capa bility.Cop ayTierMigr ationDomai nCapabilit y;
  34   import gov .va.med.ph armacy.pep s.domain.c ommon.capa bility.Ite mAuditHist oryDomainC apability;
  35   import gov .va.med.ph armacy.pep s.domain.c ommon.dao. EplVuidSta tusHistory Dao;
  36   import gov .va.med.ph armacy.pep s.domain.c ommon.mode l.EplCopay TierDo;
  37   import gov .va.med.ph armacy.pep s.domain.c ommon.mode l.EplProdu ctDo;
  38   import gov .va.med.ph armacy.pep s.domain.c ommon.util ity.conver ter.CopayT ierConvert er;
  39   import gov .va.med.ph armacy.pep s.service. common.mig ration.Mig rationStat us;
  40   import gov .va.med.ph armacy.pep s.service. common.upd ate.NdfFil eSyncProce ssorFactor y;
  41  
  42   /**
  43    * Unit te sts for {@ link Copay TierMigrat ionService Impl}.
  44    */
  45   public cla ss CopayTi erMigratio nServiceIm plTest ext ends EasyM ockSupport  {
  46     
  47     /**
  48      * The d irectory c ontaining  test resou rces.
  49      */
  50     private  static fin al File RE SOURCE_DIR ECTORY = n ew File("s rc/test/re sources/co pay_tier_m igration") ;
  51  
  52     /* Depen dencies -  declare he re so both  setUp() a nd tests c an use the m. */
  53     
  54     private  CopayTierM igrationDo mainCapabi lity mockC tmDc;
  55     private  ItemAuditH istoryDoma inCapabili ty mockIte mAuditHist oryDc;
  56     private  EplVuidSta tusHistory Dao mockVs hDao;
  57     private  PpsConfigu ration pps Configurat ion;
  58     private  NdfFileSyn cProcessor Factory mo ckSyncProc essorFacto ry;
  59     private  Environmen tUtility m ockEnviron ment;
  60     
  61     /**
  62      * Set u p each tes t.
  63      */
  64     @Before
  65     public v oid setUp( ) {
  66       // Con struct the  mocks her e for use  in tests.
  67       mockCt mDc = mock (CopayTier MigrationD omainCapab ility.clas s);
  68       mockIt emAuditHis toryDc = m ock(ItemAu ditHistory DomainCapa bility.cla ss);
  69       mockVs hDao = moc k(EplVuidS tatusHisto ryDao.clas s);
  70       ppsCon figuration  = new Con figFileUti lity();
  71       mockSy ncProcesso rFactory =  mock(NdfF ileSyncPro cessorFact ory.class) ;
  72       mockEn vironment  = mock(Env ironmentUt ility.clas s);
  73     }
  74  
  75     /**
  76      * Tests  for the d efault {@l ink Migrat ionStatus}  values wh en no impo rt has bee n run.
  77      */
  78     @Test
  79     public v oid testIn itialMigra tionStatus Fresh() {
  80       
  81       final  CopayTierM igrationSe rviceImpl  objUnderTe st = new C opayTierMi grationSer viceImpl(
  82           mo ckCtmDc, m ockItemAud itHistoryD c, mockVsh Dao, ppsCo nfiguratio n, mockSyn cProcessor Factory, m ockEnviron ment);
  83       
  84       final  MigrationS tatus actu alStatus =  objUnderT est.getPro gress();
  85       assert That(actua lStatus.ge tStatus(),  CoreMatch ers.equalT o(Migratio nStatus.IN ITIAL));
  86       assert That(actua lStatus.ge tProgressC ount(), Co reMatchers .equalTo(0 ));
  87       assert That(actua lStatus.ge tTotalCoun t(), CoreM atchers.eq ualTo(0));
  88     }
  89     
  90     /**
  91      * Tests  for the l oaded {@li nk Migrati onStatus}  when an im port has b een run be fore.
  92      */
  93     @Test
  94     public v oid testIn itialMigra tionStatus Loaded() {
  95       
  96       /* Set up */
  97       final  int rowsIn ResultFile  = 44;
  98       
  99       // Moc k the PpsC onfigurati on so we c an overrid e the pers istent dir ectory.
  100       ppsCon figuration  = mock(Pp sConfigura tion.class );
  101       expect (ppsConfig uration.ge tPersisten tDirectory ()).andRet urn(RESOUR CE_DIRECTO RY);
  102       
  103       /* Beh avior & Ve rification  */
  104       
  105       replay All();
  106       
  107       final  CopayTierM igrationSe rviceImpl  objUnderTe st = new C opayTierMi grationSer viceImpl(
  108           mo ckCtmDc, m ockItemAud itHistoryD c, mockVsh Dao, ppsCo nfiguratio n, mockSyn cProcessor Factory, m ockEnviron ment);
  109  
  110       final  MigrationS tatus actu alStatus =  objUnderT est.getPro gress();
  111       assert That(actua lStatus.ge tStatus(),  CoreMatch ers.equalT o(Migratio nStatus.DO NE));
  112       assert That(actua lStatus.ge tProgressC ount(), Co reMatchers .equalTo(r owsInResul tFile));
  113       assert That(actua lStatus.ge tTotalCoun t(), CoreM atchers.eq ualTo(rows InResultFi le));
  114     }
  115     
  116     private  List<EplCo payTierDo>  convertTo Do(final C ollection< CopayTierV o> vos) {
  117       final  ArrayList< EplCopayTi erDo> dos  = new Arra yList<>(vo s.size());
  118       final  CopayTierC onverter c onverter =  new Copay TierConver ter();
  119       for (f inal Copay TierVo vo  : vos) {
  120         dos. add(conver ter.conver t(vo));
  121       }
  122       return  dos;
  123     }
  124     
  125     private  List<EplCo payTierDo>  makeCopay TierList()  {
  126       final  List<Copay TierVo> co payTierVos  = new Cop ayTierGene rator().ge nerate();
  127       return  convertTo Do(copayTi erVos);
  128     }
  129     
  130     /**
  131      * Tests  {@link Co payTierMig rationServ iceImpl#pr ocessCopay TierImport (List, Use rVo)} when  the produ ct has val idation
  132      * error s.
  133      */
  134     @Test
  135     public v oid testPr ocessCopay TierImport Validation Error() {
  136       
  137       /* Set up */
  138       // We  always nee d a future  effective  date, so  generate a n Instant  in the fut ure.
  139       final  Instant tw oMonthsFro mNow = Dat eTimeUtili ty.toInsta nt(LocalDa te.now().p lusMonths( 2));
  140       final  MigrationC opayTierVo  rowForPro ductWithNo Tiers = ne w Migratio nCopayTier Vo();
  141       final  List<EplCo payTierDo>  copayTier List = mak eCopayTier List();
  142       final  int VUID =  1111;
  143       rowFor ProductWit hNoTiers.s etVUID(VUI D);
  144       rowFor ProductWit hNoTiers.s etVaProduc tName("Pro duct with  No Tiers") ;
  145       rowFor ProductWit hNoTiers.s etCopayTie rLevel(cop ayTierList .get(1).ge tTierLevel ());
  146       rowFor ProductWit hNoTiers.s etEffectiv eDate(Date .from(twoM onthsFromN ow));
  147       
  148       final  EplProduct Do product WithNoTier s = new Ep lProductDo ();
  149         productWit hNoTiers.s et DNS    ductName(r owForProdu ctWithNoTi ers.get DNS    ductName() );
  150       produc tWithNoTie rs.setMast erEntryFor Vuid("1");
  151       produc tWithNoTie rs.setOver rideDfDose ChkExclusn ("1");
  152       // Not e that we  are not se tting the  generic na me, primar y drug cla ss code, o r dosage f orm.
  153       produc tWithNoTie rs.setEplP rodCopayTi erAssocs(C ollections .emptySet( ));
  154       
  155       // Set  up mocks
  156       expect (mockCtmDc .retrieveC opayTiers( )).andRetu rn(copayTi erList);
  157       expect (mockCtmDc .retrieveP roduct(row ForProduct WithNoTier s.getVUID( ))).andRet urn(produc tWithNoTie rs);
  158       // Thi s is an ug ly mock to  match an  ugly direc t HQL quer y from the  service.
  159       expect (mockVshDa o.executeH qlQuery(an yString(),  anyObject ())).andRe turn(Array s.asList(1 L));
  160       
  161       final  CopayTierM igrationSe rviceImpl  objUnderTe st = new C opayTierMi grationSer viceImpl(
  162           mo ckCtmDc, m ockItemAud itHistoryD c, mockVsh Dao, ppsCo nfiguratio n, mockSyn cProcessor Factory, m ockEnviron ment);
  163       
  164       final  UserVo use r = new Us erGenerato r().getMig rator();
  165  
  166       replay All();
  167       
  168       /* Beh avior */
  169  
  170       objUnd erTest.pro cessCopayT ierImport( Arrays.asL ist(rowFor ProductWit hNoTiers),  user);
  171       
  172       /* Ver ification  */
  173       
  174       // Not e: relying  on proces sCopayTier Import() m odifying t he origina l Migratio nCopayTier Vo here
  175       assert That(rowFo rProductWi thNoTiers. isError(),  equalTo(t rue));
  176       assert That(rowFo rProductWi thNoTiers. getErrorMe ssage().is Empty(), e qualTo(fal se));
  177     }
  178     
  179     // Note:  It would  certainly  be nice to  test a co mplete imp ort here,  but I (Dav id Tombs)  ran out of  time to i mplement
  180     // such  a test. Ma inly setti ng up the  needed Pro ductConver ter was to o involved .
  181  
  182   }