16. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 3/13/2019 2:49:38 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.

16.1 Files compared

# Location File Last Modified
1 C:\AraxisMergeCompare\Pri_un\DSM\Direct Implementation\java\config\config-service-client\src\test\java\org\nhind\config\rest\impl DefautlDNSService_deleteDNSRecordsByIdsTest.java Tue Mar 12 22:01:54 2019 UTC
2 C:\AraxisMergeCompare\Pri_re\DSM-scrubbed\Direct Implementation\java\config\config-service-client\src\test\java\org\nhind\config\rest\impl DefautlDNSService_deleteDNSRecordsByIdsTest.java Wed Mar 13 02:10:34 2019 UTC

16.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 5 434
Changed 4 8
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 or g.nhind.co nfig.rest. impl;
  2  
  3   import sta tic org.mo ckito.Matc hers.any;
  4   import sta tic org.mo ckito.Mock ito.doThro w;
  5   import sta tic org.mo ckito.Mock ito.mock;
  6  
  7   import jav a.util.Arr ayList;
  8   import jav a.util.Arr ays;
  9   import jav a.util.Col lection;
  10  
  11   import org .junit.Tes t;
  12   import org .nhind.con fig.client .ConfigSer viceRunner ;
  13   import org .nhind.con fig.rest.D NSService;
  14   import org .nhind.con fig.testba se.BaseTes tPlan;
  15   import org .nhind.con fig.testba se.TestUti ls;
  16  
  17   import org .nhindirec t.common.r est.except ions.Servi ceExceptio n;
  18   import org .nhindirec t.common.r est.except ions.Servi ceMethodEx ception;
  19  
  20   import org .nhindirec t.config.m odel.DNSRe cord;
  21   import org .nhindirec t.config.m odel.utils .DNSUtils;
  22   import org .nhindirec t.config.r esources.D NSResource ;
  23  
  24   import org .nhindirec t.config.s tore.dao.D NSDao;
  25   import org .xbill.DNS .Type;
  26  
  27   public cla ss Defautl DNSService _deleteDNS RecordsByI dsTest 
  28   {
  29       protec ted DNSDao  dnsDao;
  30       
  31           st atic DNSSe rvice reso urce;
  32           
  33           ab stract cla ss TestPla n extends  BaseTestPl an 
  34           {
  35                    
  36                    @Ove rride
  37                    prot ected void  setupMock s()
  38                    {
  39                             try
  40                             {
  41                                      dnsDao =  (DNSDao)C onfigServi ceRunner.g etSpringAp plicationC ontext().g etBean("DN SDaoImpl") ;
  42                                      
  43                                      resource  =      (D NSService) BaseTestPl an.getServ ice(Config ServiceRun ner.getRes tAPIBaseUR L(), DNS_S ERVICE);       
  44  
  45                             }
  46                             catch  (Throwable  t)
  47                             {
  48                                      throw ne w RuntimeE xception(t );
  49                             }
  50                    }
  51                    
  52                    @Ove rride
  53                    prot ected void  tearDownM ocks()
  54                    {
  55  
  56                    }
  57                    
  58                    prot ected abst ract Colle ction<DNSR ecord> get RecordsToA dd() throw s Exceptio n;
  59                    
  60                    prot ected abst ract Colle ction<Long > getIdsTo Remove();
  61                    
  62                    @Ove rride
  63                    prot ected void  performIn ner() thro ws Excepti on
  64                    {                                  
  65                             
  66                             final  Collection <DNSRecord > recordsT oAdd = get RecordsToA dd();
  67  
  68                             if (re cordsToAdd  != null)
  69                             {
  70                                      for (DNS Record add Rec : reco rdsToAdd)
  71                                      {
  72                                               try
  73                                               {
  74                                                       re source.add DNSRecord( addRec);
  75  
  76                                               }
  77                                               catch (Ser viceExcept ion e)
  78                                               {
  79                                                       th row e;
  80                                               }
  81                                      }                         
  82                             }
  83                             
  84                             try
  85                             {
  86                                      final Co llection<L ong> ids =  getIdsToR emove();
  87  
  88                                      resource .deleteDNS RecordsByI ds(ids);
  89                             }
  90                             catch  (ServiceEx ception e)
  91                             {
  92                                      throw e;
  93                             }
  94                             
  95                             
  96                             doAsse rtions();
  97                    }
  98                             
  99                    prot ected void  doAsserti ons() thro ws Excepti on
  100                    {
  101                             
  102                    }
  103           }
  104           
  105           @T est
  106           pu blic void  testRemove DNSRecords ByIds_remo veExisting Records_as sertRecord sRemoved()  throws Ex ception
  107           {
  108                    new  TestPlan()
  109                    {
  110                             protec ted Collec tion<DNSRe cord> reco rds;
  111                             
  112                             @Overr ide
  113                             protec ted Collec tion<DNSRe cord> getR ecordsToAd d() throws  Exception
  114                             {
  115                                      try
  116                                      {
  117                                               records =  new ArrayL ist<DNSRec ord>();
  118                                              
  119                                                DNSRecord  record = D NSUtils.cr eateARecor d("myserve r.com", 36 00, " IP            ");                           
  120                                               records.ad d(record);
  121                                              
  122                                              
  123                                                record = D NSUtils.cr eateARecor d("myserve r.com", 36 00, " IP            ");                                              
  124                                               records.ad d(record);
  125                                              
  126                                                record = D NSUtils.cr eateARecor d("myserve r2.com", 3 600, " IP            ");                                             
  127                                               records.ad d(record);
  128                                              
  129                                               record = D NSUtils.cr eateX509CE RTRecord(" gm2552@sec urehealthe mail.com",  3600, Tes tUtils.loa dCert("gm2 552.der")) ;                                    
  130                                               records.ad d(record);
  131                                              
  132                                                record = D NSUtils.cr eateMXReco rd("myserv er.com", " IP            ", 3600, 2 );
  133                                               records.ad d(record);
  134                                              
  135                                               return rec ords;
  136                                      }
  137                                      catch (E xception e )
  138                                      {
  139                                               throw new  RuntimeExc eption (e) ;
  140                                      }
  141                             }
  142                             
  143                             @Overr ide
  144                             protec ted Collec tion<Long>  getIdsToR emove()
  145                             {
  146                                      final Co llection<o rg.nhindir ect.config .store.DNS Record> re cs = dnsDa o.get(Type .ANY);
  147                                      
  148                                      final Co llection<L ong> ids =  new Array List<Long> ();
  149                                      for (org .nhindirec t.config.s tore.DNSRe cord rec :  recs)
  150                                               ids.add(re c.getId()) ;
  151                                      
  152                                      return i ds;
  153                             }
  154                             
  155                             @Overr ide
  156                             protec ted void d oAssertion s() throws  Exception
  157                             {
  158                                      final Co llection<o rg.nhindir ect.config .store.DNS Record> re cs = dnsDa o.get(Type .ANY);
  159                                      assertTr ue(recs.is Empty());
  160                             }
  161                    }.pe rform();
  162           }                 
  163           
  164           @T est
  165           pu blic void  testRemove DNSRecords ByIds_erro rInDelete_ assertServ iceError()  throws Ex ception
  166           {
  167                    new  TestPlan()
  168                    {
  169                             protec ted DNSRes ource dnsS ervice;
  170                             
  171                             @Overr ide
  172                             protec ted void s etupMocks( )
  173                             {
  174                                      try
  175                                      {
  176                                               super.setu pMocks();
  177                                              
  178                                               dnsService  = (DNSRes ource)Conf igServiceR unner.getS pringAppli cationCont ext().getB ean("DNSRe source");
  179  
  180                                               DNSDao moc kDAO = moc k(DNSDao.c lass);
  181                                               doThrow(ne w RuntimeE xception() ).when(moc kDAO).remo ve((long[] )any());
  182                                              
  183                                               dnsService .setDNSDao (mockDAO);
  184                                      }
  185                                      catch (T hrowable t )
  186                                      {
  187                                               throw new  RuntimeExc eption(t);
  188                                      }
  189                             }
  190                             
  191                             @Overr ide
  192                             protec ted void t earDownMoc ks()
  193                             {
  194                                      super.te arDownMock s();
  195                                      
  196                                      dnsServi ce.setDNSD ao(dnsDao) ;
  197                             }
  198                             
  199                             @Overr ide
  200                             protec ted Collec tion<DNSRe cord> getR ecordsToAd d() throws  Exception
  201                             {
  202                                      return n ull;
  203                             }
  204                             
  205                             @Overr ide
  206                             protec ted Collec tion<Long>  getIdsToR emove()
  207                             {        
  208                                      
  209                                      return A rrays.asLi st(1234L);
  210                             }
  211                             
  212                             @Overr ide
  213                             protec ted void a ssertExcep tion(Excep tion excep tion) thro ws Excepti on 
  214                             {
  215                                      assertTr ue(excepti on instanc eof Servic eMethodExc eption);
  216                                      ServiceM ethodExcep tion ex =  (ServiceMe thodExcept ion)except ion;
  217                                      assertEq uals(500,  ex.getResp onseCode() );
  218                             }
  219                    }.pe rform();
  220           }                          
  221   }