39. EPMO Open Source Coordination Office Redaction File Detail Report

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

39.1 Files compared

# Location File Last Modified
1 C:\AraxisMergeCompare\Pri_un\ZIP\DSM-cif\Direct Implementation\java\dns\src\test\java\org\nhindirect\dns\tools DNSRecordCommands_matchMXRecords_Test.java Tue May 22 13:40:38 2018 UTC
2 C:\AraxisMergeCompare\Pri_re\ZIP\DSM-cif\Direct Implementation\java\dns\src\test\java\org\nhindirect\dns\tools DNSRecordCommands_matchMXRecords_Test.java Tue May 22 20:59:42 2018 UTC

39.2 Comparison summary

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

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

39.4 Active regular expressions

No regular expressions were active.

39.5 Comparison detail

  1   package or g.nhindire ct.dns.too ls;
  2  
  3   import jav a.net.Inet Address;
  4   import jav a.net.URL;
  5   import jav a.util.Arr ayList;
  6   import jav a.util.Lis t;
  7  
  8   import org .apache.ax is.AxisFau lt;
  9   import org .apache.mi na.util.Av ailablePor tFinder;
  10   import org .nhind.con fig.Config urationSer viceProxy;
  11   import org .nhind.con fig.DnsRec ord;
  12   import org .nhindirec t.dns.Conf igServiceD NSStore;
  13   import org .nhindirec t.dns.DNSS erver;
  14   import org .nhindirec t.dns.DNSS erverSetti ngs;
  15   import org .nhindirec t.dns.util .BaseTestP lan;
  16   import org .nhindirec t.dns.util .ConfigSer viceRunner ;
  17   import org .xbill.DNS .ARecord;
  18   import org .xbill.DNS .DClass;
  19   import org .xbill.DNS .MXRecord;
  20   import org .xbill.DNS .Name;
  21   import org .xbill.DNS .Record;
  22   import org .xbill.DNS .Type;
  23  
  24   import jun it.framewo rk.TestCas e;
  25  
  26   public cla ss DNSReco rdCommands _matchMXRe cords_Test  extends T estCase 
  27   {
  28           ab stract cla ss TestPla n extends  BaseTestPl an 
  29           {
  30           pr otected Mo ckDNSRecor dPrinter r ecordPrint er;
  31                    
  32                    prot ected int  port;
  33                    prot ected DNSS erver serv er = null;
  34                    prot ected Conf igurationS erviceProx y proxy;
  35                    prot ected DNSR ecordComma nds record Commands;
  36                    
  37                    prot ected Reco rd toRecor d(DnsRecor d rec) thr ows Except ion
  38                    {                         
  39                             return  Record.ne wRecord(Na me.fromStr ing(rec.ge tName()),  rec.getTyp e(), rec.g etDclass() , rec.getT tl(), rec. getData()) ;
  40                    }
  41  
  42                    prot ected DnsR ecord from Record(Rec ord rec) t hrows Exce ption
  43                    {                         
  44                             DnsRec ord newRec  = new Dns Record();
  45                             newRec .setData(r ec.rdataTo WireCanoni cal());
  46                             newRec .setDclass (rec.getDC lass());
  47                             newRec .setName(r ec.getName ().toStrin g());
  48                             newRec .setTtl(re c.getTTL() );
  49                             newRec .setType(r ec.getType ());
  50                             
  51                             return  newRec;
  52                    }
  53                                      
  54                    
  55                    @Ove rride
  56                    prot ected void  setupMock s() throws  Exception
  57                    {
  58                             if (!C onfigServi ceRunner.i sServiceRu nning())
  59                                      ConfigSe rviceRunne r.startCon figService ();
  60  
  61                             proxy  = new Conf igurationS erviceProx y(ConfigSe rviceRunne r.getConfi gServiceUR L());
  62                             
  63                             cleanR ecords();
  64                             
  65                             port =  Available PortFinder .getNextAv ailable(10 24);
  66                             DNSSer verSetting s settings  = new DNS ServerSett ings();
  67                             settin gs.setPort (port);
  68                                                       
  69                             server  = new DNS Server(new  ConfigSer viceDNSSto re(new URL (ConfigSer viceRunner .getConfig ServiceURL ())), sett ings);
  70                             
  71                             server .start();          
  72                             
  73                             record Printer =  new MockDN SRecordPri nter();
  74                    }
  75                    
  76                    @Ove rride
  77                    prot ected void  tearDownM ocks() thr ows Except ion
  78                    {
  79                             if (se rver != nu ll)
  80                                      server.s top();
  81                    }        
  82                    
  83                    @Ove rride
  84                    prot ected void  performIn ner() thro ws Excepti on
  85                    {
  86                             record Commands =  new DNSRe cordComman ds(proxy);
  87                             record Commands.s etRecordPr inter(reco rdPrinter) ;
  88                             
  89                             List<R ecord> rec ordsToAdd  = getRecor dsToAdd();
  90                             
  91                             
  92                             DnsRec ord[] addR ecs = new  DnsRecord[ recordsToA dd.size()] ;
  93                             int cn t = 0;
  94                             for (R ecord reco rdToAdd :  recordsToA dd)
  95                             {                                  
  96                                      addRecs[ cnt++] = f romRecord( recordToAd d);
  97                             }
  98                             
  99                             proxy. addDNS(add Recs);
  100                                              
  101                             
  102                             String  matchName  = getName ToMatch();
  103  
  104                             record Commands.m atchMX(new  String[]  {matchName });
  105  
  106                             List<R ecord> mat chedRecord s = new Ar rayList<Re cord>();
  107                             for (D nsRecord m atchedReco rd : recor dPrinter.p rintedReco rds)
  108                                      matchedR ecords.add (toRecord( matchedRec ord));
  109                                                       
  110                             doAsse rtions(mat chedRecord s);
  111                    }                 
  112                    
  113                    priv ate void c leanRecord s() throws  Exception
  114                    {
  115                             DnsRec ord[] rec  = proxy.ge tDNSByType (Type.ANY) ;
  116                             
  117                             if (re c != null  && rec.len gth > 0)
  118                                      proxy.re moveDNS(re c);
  119                             
  120                             rec =  proxy.getD NSByType(T ype.ANY);
  121                             
  122                             assert Null(rec);
  123                             
  124                    }                 
  125                                                       
  126                    prot ected abst ract List< Record> ge tRecordsTo Add() thro ws Excepti on;
  127                    
  128                    prot ected abst ract Strin g getNameT oMatch() t hrows Exce ption;
  129                    
  130                    prot ected abst ract void  doAssertio ns(List<Re cord> reco rdsMatched ) throws E xception;               
  131           }
  132           
  133           pu blic void  testMatchR ecords_Ass ertAllReco rdMatched( ) throws E xception 
  134           {                 
  135                    new  TestPlan()
  136                    {
  137                             privat e List<Rec ord> recor dsToAdd;
  138                             
  139                             @Overr ide
  140                             protec ted List<R ecord> get RecordsToA dd() throw s Exceptio n
  141                             {
  142                                      recordsT oAdd = new  ArrayList <Record>() ;
  143                                      
  144                                      
  145                                      recordsT oAdd.add(n ew MXRecor d(Name.fro mString("e xample.dom ain.com.") , DClass.I N, 3600, 
  146                                                       1,  Name.from String("ma il1.exampl e.domain.c om.")));       
  147                                      
  148                                      recordsT oAdd.add(n ew MXRecor d(Name.fro mString("e xample.dom ain.com.") , DClass.I N, 3600, 
  149                                                       1,  Name.from String("ma il2.exampl e.domain.c om.")));       
  150                             
  151                                      
  152                                      return r ecordsToAd d;                                                
  153                             }
  154  
  155                             @Overr ide
  156                             protec ted String  getNameTo Match() th rows Excep tion
  157                             {
  158                                      return " example.do main.com";
  159                             }
  160  
  161                             @Overr ide
  162                             protec ted void d oAssertion s(List<Rec ord> recor dsMatched)  throws Ex ception                 
  163                             {
  164                                      assertNo tNull(reco rdsMatched );
  165                                      assertEq uals(2, re cordsMatch ed.size()) ;
  166                                      
  167                                      for (Rec ord record  : records ToAdd)
  168                                      {
  169                                               int index  = recordsT oAdd.index Of(record) ;
  170                                               assertTrue (index > - 1);
  171                                               Record che ckRecord =  recordsTo Add.get(in dex);
  172                                               assertEqua ls(record,  checkReco rd);
  173                                      }                                  
  174                             }
  175                    }.pe rform();
  176           }                 
  177                    
  178  
  179           pu blic void  testMatchR ecords_mxR ecordsOnly _AssertOnl yMXRecordM atched() t hrows Exce ption 
  180           {                 
  181                    new  TestPlan()
  182                    {
  183                             privat e List<Rec ord> recor dsToAdd;
  184                             privat e List<Rec ord> expec tedMatched Records;
  185                             @Overr ide
  186                             protec ted List<R ecord> get RecordsToA dd() throw s Exceptio n
  187                             {
  188                                      recordsT oAdd = new  ArrayList <Record>() ;
  189                                      expected MatchedRec ords = new  ArrayList <Record>() ;
  190                                      
  191                                      Record r ecToAdd =  new MXReco rd(Name.fr omString(" example.do main.com." ), DClass. IN, 3600, 
  192                                                       1,  Name.from String("ma il1.exampl e.domain.c om."));
  193                                      recordsT oAdd.add(r ecToAdd);
  194                                      expected MatchedRec ords.add(r ecToAdd);                     
  195                                      
  196                                      recToAdd  = new MXR ecord(Name .fromStrin g("example .domain.co m."), DCla ss.IN, 360 0, 
  197                                                       1,  Name.from String("ma il2.exampl e.domain.c om."));
  198                                      recordsT oAdd.add(r ecToAdd);
  199                                      expected MatchedRec ords.add(r ecToAdd);            
  200  
  201                                      recordsT oAdd.add(n ew ARecord (Name.from String("ex ample.doma in.com."),  DClass.IN , 3600, In etAddress. getByName( "127.0.0.1 ")));
  202                                      
  203                                      return r ecordsToAd d;                                                
  204                             }
  205  
  206                             @Overr ide
  207                             protec ted String  getNameTo Match() th rows Excep tion
  208                             {
  209                                      return " example.do main.com";
  210                             }
  211  
  212                             @Overr ide
  213                             protec ted void d oAssertion s(List<Rec ord> recor dsMatched)  throws Ex ception                 
  214                             {
  215                                      assertNo tNull(reco rdsMatched );
  216                                      assertEq uals(2, re cordsMatch ed.size()) ;
  217                                      
  218                                      for (Rec ord record  : expecte dMatchedRe cords)
  219                                      {
  220                                               int index  = recordsT oAdd.index Of(record) ;
  221                                               assertTrue (index > - 1);
  222                                               Record che ckRecord =  recordsTo Add.get(in dex);
  223                                               assertEqua ls(record,  checkReco rd);
  224                                      }                                  
  225                             }
  226                    }.pe rform();
  227           }                 
  228           
  229           
  230           pu blic void  testMatchR ecords_spe cificDomai n_AssertOn lyDomainRe cordMatche d() throws  Exception  
  231           {                 
  232                    new  TestPlan()
  233                    {
  234                             privat e List<Rec ord> recor dsToAdd;
  235                             privat e List<Rec ord> expec tedMatched Records;
  236                             
  237                             @Overr ide
  238                             protec ted List<R ecord> get RecordsToA dd() throw s Exceptio n
  239                             {
  240                                      recordsT oAdd = new  ArrayList <Record>() ;
  241                                      expected MatchedRec ords = new  ArrayList <Record>() ;
  242                                      
  243                                      Record r ecToAdd =  new MXReco rd(Name.fr omString(" example.do main.com." ), DClass. IN, 3600, 
  244                                                       1,  Name.from String("ma il1.exampl e.domain.c om."));
  245                                      recordsT oAdd.add(r ecToAdd);
  246                                      expected MatchedRec ords.add(r ecToAdd);                     
  247                                      
  248                                      recToAdd  = new MXR ecord(Name .fromStrin g("example .domain.co m."), DCla ss.IN, 360 0, 
  249                                                       1,  Name.from String("ma il2.exampl e.domain.c om."));
  250                                      recordsT oAdd.add(r ecToAdd);
  251                                      expected MatchedRec ords.add(r ecToAdd);            
  252  
  253                                      recordsT oAdd.add(n ew MXRecor d(Name.fro mString("e xample2.do main.com." ), DClass. IN, 3600, 
  254                                                       1,  Name.from String("ma il1.exampl e2.domain. com.")));
  255                                      
  256                                      return r ecordsToAd d;                                                
  257                             }
  258  
  259                             @Overr ide
  260                             protec ted String  getNameTo Match() th rows Excep tion
  261                             {
  262                                      return " example.do main.com";
  263                             }
  264  
  265                             @Overr ide
  266                             protec ted void d oAssertion s(List<Rec ord> recor dsMatched)  throws Ex ception                 
  267                             {
  268                                      assertNo tNull(reco rdsMatched );
  269                                      assertEq uals(2, re cordsMatch ed.size()) ;
  270                                      
  271                                      for (Rec ord record  : expecte dMatchedRe cords)
  272                                      {
  273                                               int index  = recordsT oAdd.index Of(record) ;
  274                                               assertTrue (index > - 1);
  275                                               Record che ckRecord =  recordsTo Add.get(in dex);
  276                                               assertEqua ls(record,  checkReco rd);
  277                                      }                                  
  278                             }
  279                    }.pe rform();
  280           }                          
  281           
  282           
  283           pu blic void  testMatchN oRecords_m atchingPar entDomain_ AssertNoRe cordMatche d() throws  Exception  
  284           {                 
  285                    new  TestPlan()
  286                    {
  287                             privat e List<Rec ord> recor dsToAdd;
  288                             
  289                             @Overr ide
  290                             protec ted List<R ecord> get RecordsToA dd() throw s Exceptio n
  291                             {
  292                                      recordsT oAdd = new  ArrayList <Record>() ;
  293                                      
  294                                      
  295                                      recordsT oAdd.add(n ew MXRecor d(Name.fro mString("e xample.dom ain.com.") , DClass.I N, 3600, 
  296                                                       1,  Name.from String("ma il1.exampl e.domain.c om.")));       
  297                                      
  298                                      recordsT oAdd.add(n ew MXRecor d(Name.fro mString("e xample.dom ain.com.") , DClass.I N, 3600, 
  299                                                       1,  Name.from String("ma il2.exampl e.domain.c om.")));       
  300                             
  301                                      
  302                                      return r ecordsToAd d;                                       
  303                             }
  304  
  305                             @Overr ide
  306                             protec ted String  getNameTo Match() th rows Excep tion
  307                             {
  308                                      return " domain.com ";
  309                             }
  310  
  311                             @Overr ide
  312                             protec ted void d oAssertion s(List<Rec ord> recor dsMatched)  throws Ex ception                 
  313                             {
  314                                      assertNo tNull(reco rdsMatched );
  315                                      assertEq uals(0, re cordsMatch ed.size()) ;
  316                                                       
  317                             }
  318                    }.pe rform();
  319           }                 
  320           
  321           
  322           pu blic void  testFailur eToMatch_i nvalidProx y_AssertEx ception()  throws Exc eption 
  323           {
  324                    new  TestPlan()
  325                    {
  326                             
  327                             @Overr ide
  328                             protec ted List<R ecord> get RecordsToA dd() throw s Exceptio n
  329                             {
  330                                      ArrayLis t<Record>  recordsToA dd = new A rrayList<R ecord>();
  331                                      
  332                                      
  333                                      recordsT oAdd.add(n ew MXRecor d(Name.fro mString("e xample.dom ain.com.") , DClass.I N, 3600, 
  334                                                       1,  Name.from String("ma il1.exampl e.domain.c om.")));       
  335                                      
  336                                      return r ecordsToAd d;                                       
  337                             }
  338                             
  339                             @Overr ide
  340                             protec ted String  getNameTo Match() th rows Excep tion
  341                             {                                  
  342                                       recordComm ands.setCo nfiguratio nProxy(new  Configura tionServic eProxy("ht tp://local host: PORT /bogusendp oint"));
  343                                      return " example.do main.com";
  344                             }
  345                             
  346                             @Overr ide
  347                             protec ted void a ssertExcep tion(Excep tion excep tion) thro ws Excepti on 
  348                             {
  349                                      assertNo tNull(exce ption);
  350                                      assertTr ue(excepti on instanc eof Runtim eException );
  351                                      assertTr ue(excepti on.getCaus e() instan ceof AxisF ault);
  352                                                                
  353                             }
  354                             
  355                             @Overr ide
  356                             protec ted void d oAssertion s(List<Rec ord> recor dsMatched)  throws Ex ception                 
  357                             {
  358                             }
  359  
  360                    }.pe rform();
  361           }        
  362           
  363   }