21. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 5/25/2018 9:21:41 AM 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.

21.1 Files compared

# Location File Last Modified
1 C:\AraxisMergeCompare\Pri_un\ZIP\DSM-cif\Direct Implementation\java\config\config-service-jar\src\test\java\org\nhindirect\config\resources DNSResource_removeDNSRecordsByIdsTest.java Tue May 22 13:45:48 2018 UTC
2 C:\AraxisMergeCompare\Pri_re\ZIP\DSM-cif\Direct Implementation\java\config\config-service-jar\src\test\java\org\nhindirect\config\resources DNSResource_removeDNSRecordsByIdsTest.java Wed May 23 16:39:38 2018 UTC

21.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 6 444
Changed 5 10
Inserted 0 0
Removed 0 0

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

21.4 Active regular expressions

No regular expressions were active.

21.5 Comparison detail

  1   package or g.nhindire ct.config. resources;
  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 jav ax.ws.rs.c ore.MediaT ype;
  12  
  13   import org .junit.Tes t;
  14   import org .nhindirec t.config.B aseTestPla n;
  15   import org .nhindirec t.config.C onfigServi ceRunner;
  16   import org .nhindirec t.config.T estUtils;
  17   import org .nhindirec t.config.m odel.DNSRe cord;
  18   import org .nhindirec t.config.m odel.utils .DNSUtils;
  19   import org .nhindirec t.config.s tore.dao.D NSDao;
  20   import org .xbill.DNS .Type;
  21  
  22   import com .sun.jerse y.api.clie nt.Uniform InterfaceE xception;
  23   import com .sun.jerse y.api.clie nt.WebReso urce;
  24  
  25   public cla ss DNSReso urce_remov eDNSRecord sByIdsTest  
  26   {
  27               protected  DNSDao dn sDao;
  28                
  29                    stat ic WebReso urce resou rce;
  30                    
  31                    abst ract class  TestPlan  extends Ba seTestPlan  
  32                    {
  33                             @Overr ide
  34                             protec ted void s etupMocks( )
  35                             {
  36                                      try
  37                                      {
  38                                               dnsDao = ( DNSDao)Con figService Runner.get SpringAppl icationCon text().get Bean("dnsD ao");
  39                                              
  40                                               resource =       getR esource(Co nfigServic eRunner.ge tConfigSer viceURL()) ;         
  41                                      }
  42                                      catch (T hrowable t )
  43                                      {
  44                                               throw new  RuntimeExc eption(t);
  45                                      }
  46                             }
  47                             
  48                             @Overr ide
  49                             protec ted void t earDownMoc ks()
  50                             {
  51  
  52                             }
  53  
  54                             protec ted abstra ct Collect ion<DNSRec ord> getRe cordsToAdd () throws  Exception;
  55                             
  56                             protec ted abstra ct Collect ion<Long>  getIdsToRe move();
  57                             
  58                             @Overr ide
  59                             protec ted void p erformInne r() throws  Exception
  60                             {                                  
  61                                      
  62                                      final Co llection<D NSRecord>  recordsToA dd = getRe cordsToAdd ();
  63  
  64                                      if (reco rdsToAdd ! = null)
  65                                      {
  66                                               for (DNSRe cord addRe c : record sToAdd)
  67                                               {
  68                                                       tr y
  69                                                       {
  70                                                                reso urce.path( "/api/dns" ).entity(a ddRec, Med iaType.APP LICATION_J SON).put(a ddRec);
  71                                                       }
  72                                                       ca tch (Unifo rmInterfac eException  e)
  73                                                       {
  74                                                                thro w e;
  75                                                       }
  76                                               }                         
  77                                      }
  78                                      
  79                                      try
  80                                      {
  81                                               final Coll ection<Lon g> ids = g etIdsToRem ove();
  82                                               StringBuil der builde r = new St ringBuilde r();
  83                                               int cnt =  0;
  84                                               for (Long  id : ids)
  85                                               {
  86                                                       bu ilder.appe nd(id);
  87                                                       if  (cnt < id s.size() -  1)
  88                                                                buil der.append (",");
  89                                                       
  90                                                       ++ cnt;
  91                                               }
  92  
  93                                               resource.p ath("/api/ dns/" + bu ilder.toSt ring()).de lete();
  94  
  95                                      }
  96                                      catch (U niformInte rfaceExcep tion e)
  97                                      {
  98                                               throw e;
  99                                      }
  100                                      
  101                                      
  102                                      doAssert ions();
  103                             }
  104                                      
  105                             protec ted void d oAssertion s() throws  Exception
  106                             {
  107                                      
  108                             }
  109                    }
  110                    
  111                    @Tes t
  112                    publ ic void te stRemoveDN SRecordsBy Ids_remove ExistingRe cords_asse rtRecordsR emoved() t hrows Exce ption
  113                    {
  114                             new Te stPlan()
  115                             {
  116                                      protecte d Collecti on<DNSReco rd> record s;
  117                                      
  118                                      @Overrid e
  119                                      protecte d Collecti on<DNSReco rd> getRec ordsToAdd( ) throws E xception
  120                                      {
  121                                               try
  122                                               {
  123                                                       re cords = ne w ArrayLis t<DNSRecor d>();
  124                                                       
  125                                                        DNSRecord  record = D NSUtils.cr eateARecor d("myserve r.com",  PORT , " IP            ");                           
  126                                                       re cords.add( record);
  127                                                       
  128                                                       
  129                                                        record = D NSUtils.cr eateARecor d("myserve r.com",  PORT , " IP            ");                                              
  130                                                       re cords.add( record);
  131                                                       
  132                                                        record = D NSUtils.cr eateARecor d("myserve r2.com",  PORT , " IP            ");                                             
  133                                                       re cords.add( record);
  134                                                       
  135                                                        record = D NSUtils.cr eateX509CE RTRecord(" gm2552@sec urehealthe mail.com",   PORT , TestUtil s.loadCert ("gm2552.d er"));                                     
  136                                                       re cords.add( record);
  137                                                       
  138                                                        record = D NSUtils.cr eateMXReco rd("myserv er.com", " IP            ",  PORT , 2);
  139                                                       re cords.add( record);
  140                                                       
  141                                                       re turn recor ds;
  142                                               }
  143                                               catch (Exc eption e)
  144                                               {
  145                                                       th row new Ru ntimeExcep tion (e);
  146                                               }
  147                                      }
  148                                      
  149                                      @Overrid e
  150                                      protecte d Collecti on<Long> g etIdsToRem ove()
  151                                      {
  152                                               final Coll ection<org .nhindirec t.config.s tore.DNSRe cord> recs  = dnsDao. get(Type.A NY);
  153                                              
  154                                               final Coll ection<Lon g> ids = n ew ArrayLi st<Long>() ;
  155                                               for (org.n hindirect. config.sto re.DNSReco rd rec : r ecs)
  156                                                       id s.add(rec. getId());
  157                                              
  158                                               return ids ;
  159                                      }
  160                                      
  161                                      @Overrid e
  162                                      protecte d void doA ssertions( ) throws E xception
  163                                      {
  164                                               final Coll ection<org .nhindirec t.config.s tore.DNSRe cord> recs  = dnsDao. get(Type.A NY);
  165                                               assertTrue (recs.isEm pty());
  166                                      }
  167                             }.perf orm();
  168                    }                 
  169                    
  170                    @Tes t
  171                    publ ic void te stRemoveDN SRecordsBy Ids_errorI nDelete_as sertServic eError() t hrows Exce ption
  172                    {
  173                             new Te stPlan()
  174                             {
  175                                      protecte d DNSResou rce dnsSer vice;
  176                                      
  177                                      @Overrid e
  178                                      protecte d void set upMocks()
  179                                      {
  180                                               try
  181                                               {
  182                                                       su per.setupM ocks();
  183                                                       
  184                                                       dn sService =  (DNSResou rce)Config ServiceRun ner.getSpr ingApplica tionContex t().getBea n("DNSReso urce");
  185  
  186                                                       DN SDao mockD AO = mock( DNSDao.cla ss);
  187                                                       do Throw(new  RuntimeExc eption()). when(mockD AO).remove ((long[])a ny());
  188                                                       
  189                                                       dn sService.s etDNSDao(m ockDAO);
  190                                               }
  191                                               catch (Thr owable t)
  192                                               {
  193                                                       th row new Ru ntimeExcep tion(t);
  194                                               }
  195                                      }
  196                                      
  197                                      @Overrid e
  198                                      protecte d void tea rDownMocks ()
  199                                      {
  200                                               super.tear DownMocks( );
  201                                              
  202                                               dnsService .setDNSDao (dnsDao);
  203                                      }
  204                                      
  205                                      @Overrid e
  206                                      protecte d Collecti on<DNSReco rd> getRec ordsToAdd( ) throws E xception
  207                                      {
  208                                               return nul l;
  209                                      }
  210                                      
  211                                      @Overrid e
  212                                      protecte d Collecti on<Long> g etIdsToRem ove()
  213                                      {       
  214                                              
  215                                               return Arr ays.asList (1234L);
  216                                      }
  217                                      
  218                                      @Overrid e
  219                                      protecte d void ass ertExcepti on(Excepti on excepti on) throws  Exception  
  220                                      {
  221                                               assertTrue (exception  instanceo f UniformI nterfaceEx ception);
  222                                               UniformInt erfaceExce ption ex =  (UniformI nterfaceEx ception)ex ception;
  223                                               assertEqua ls(500, ex .getRespon se().getSt atus());
  224                                      }
  225                             }.perf orm();
  226                    }                         
  227   }