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

38.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_matchARecords_Test.java Tue May 22 13:40:36 2018 UTC
2 C:\AraxisMergeCompare\Pri_re\ZIP\DSM-cif\Direct Implementation\java\dns\src\test\java\org\nhindirect\dns\tools DNSRecordCommands_matchARecords_Test.java Tue May 22 20:59:40 2018 UTC

38.2 Comparison summary

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

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

38.4 Active regular expressions

No regular expressions were active.

38.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 _matchARec ords_Test  extends Te stCase 
  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 atchAName( new String [] {matchN ame});
  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                                      recordsT oAdd.add(n ew ARecord (Name.from String("ex ample.doma in.com."),  DClass.IN , 3600, In etAddress. getByName( "127.0.0.1 ")));
  145                                      recordsT oAdd.add(n ew ARecord (Name.from String("ex ample.doma in.com."),  DClass.IN , 3600, In etAddress. getByName( "127.0.0.2 ")));
  146                             
  147                                      
  148                                      return r ecordsToAd d;                                                
  149                             }
  150  
  151                             @Overr ide
  152                             protec ted String  getNameTo Match() th rows Excep tion
  153                             {
  154                                      return " example.do main.com";
  155                             }
  156  
  157                             @Overr ide
  158                             protec ted void d oAssertion s(List<Rec ord> recor dsMatched)  throws Ex ception                 
  159                             {
  160                                      assertNo tNull(reco rdsMatched );
  161                                      assertEq uals(2, re cordsMatch ed.size()) ;
  162                                      
  163                                      for (Rec ord record  : records ToAdd)
  164                                      {
  165                                               int index  = recordsT oAdd.index Of(record) ;
  166                                               assertTrue (index > - 1);
  167                                               Record che ckRecord =  recordsTo Add.get(in dex);
  168                                               assertEqua ls(record,  checkReco rd);
  169                                      }                                  
  170                             }
  171                    }.pe rform();
  172           }                 
  173                    
  174           pu blic void  testMatchR ecords_aRe cordsOnly_ AssertOnly ARecordMat ched() thr ows Except ion 
  175           {                 
  176                    new  TestPlan()
  177                    {
  178                             privat e List<Rec ord> recor dsToAdd;
  179                             privat e List<Rec ord> expec tedMatched Records;
  180                             @Overr ide
  181                             protec ted List<R ecord> get RecordsToA dd() throw s Exceptio n
  182                             {
  183                                      recordsT oAdd = new  ArrayList <Record>() ;
  184                                      expected MatchedRec ords = new  ArrayList <Record>() ;
  185                                      
  186                                      Record r ecToAdd =  new ARecor d(Name.fro mString("e xample.dom ain.com.") , DClass.I N, 3600, I netAddress .getByName ("127.0.0. 1"));
  187                                      recordsT oAdd.add(r ecToAdd);
  188                                      expected MatchedRec ords.add(r ecToAdd);
  189                                      
  190                                      
  191                                      recToAdd  = new ARe cord(Name. fromString ("example. domain.com ."), DClas s.IN, 3600 , InetAddr ess.getByN ame("127.0 .0.2"));
  192                                      recordsT oAdd.add(r ecToAdd);
  193                                      expected MatchedRec ords.add(r ecToAdd);                              
  194  
  195                                      recordsT oAdd.add(n ew MXRecor d(Name.fro mString("e xample.dom ain.com.") , DClass.I N, 3600, 
  196                                                       1,  Name.from String("ma il1.exampl e.domain.c om.")));
  197                                      
  198                                      return r ecordsToAd d;                                                
  199                             }
  200  
  201                             @Overr ide
  202                             protec ted String  getNameTo Match() th rows Excep tion
  203                             {
  204                                      return " example.do main.com";
  205                             }
  206  
  207                             @Overr ide
  208                             protec ted void d oAssertion s(List<Rec ord> recor dsMatched)  throws Ex ception                 
  209                             {
  210                                      assertNo tNull(reco rdsMatched );
  211                                      assertEq uals(2, re cordsMatch ed.size()) ;
  212                                      
  213                                      for (Rec ord record  : expecte dMatchedRe cords)
  214                                      {
  215                                               int index  = recordsT oAdd.index Of(record) ;
  216                                               assertTrue (index > - 1);
  217                                               Record che ckRecord =  recordsTo Add.get(in dex);
  218                                               assertEqua ls(record,  checkReco rd);
  219                                      }                                  
  220                             }
  221                    }.pe rform();
  222           }                 
  223           
  224           pu blic void  testMatchR ecords_spe cificDomai n_AssertOn lyDomainRe cordMatche d() throws  Exception  
  225           {                 
  226                    new  TestPlan()
  227                    {
  228                             privat e List<Rec ord> recor dsToAdd;
  229                             privat e List<Rec ord> expec tedMatched Records;
  230                             
  231                             @Overr ide
  232                             protec ted List<R ecord> get RecordsToA dd() throw s Exceptio n
  233                             {
  234                                      recordsT oAdd = new  ArrayList <Record>() ;
  235                                      expected MatchedRec ords = new  ArrayList <Record>() ;
  236                                      
  237                                      Record r ecToAdd =  new ARecor d(Name.fro mString("e xample.dom ain.com.") , DClass.I N, 3600, I netAddress .getByName ("127.0.0. 1"));
  238                                      recordsT oAdd.add(r ecToAdd);
  239                                      expected MatchedRec ords.add(r ecToAdd);
  240                                      
  241                                      
  242                                      recToAdd  = new ARe cord(Name. fromString ("example. domain.com ."), DClas s.IN, 3600 , InetAddr ess.getByN ame("127.0 .0.2"));
  243                                      recordsT oAdd.add(r ecToAdd);
  244                                      expected MatchedRec ords.add(r ecToAdd);
  245  
  246                                      recordsT oAdd.add(n ew ARecord (Name.from String("do main.com." ), DClass. IN, 3600,  InetAddres s.getByNam e("127.0.0 .3")));                       
  247                                      
  248                                      
  249                                      return r ecordsToAd d;                                                
  250                             }
  251  
  252                             @Overr ide
  253                             protec ted String  getNameTo Match() th rows Excep tion
  254                             {
  255                                      return " example.do main.com";
  256                             }
  257  
  258                             @Overr ide
  259                             protec ted void d oAssertion s(List<Rec ord> recor dsMatched)  throws Ex ception                 
  260                             {
  261                                      assertNo tNull(reco rdsMatched );
  262                                      assertEq uals(2, re cordsMatch ed.size()) ;
  263                                      
  264                                      for (Rec ord record  : expecte dMatchedRe cords)
  265                                      {
  266                                               int index  = recordsT oAdd.index Of(record) ;
  267                                               assertTrue (index > - 1);
  268                                               Record che ckRecord =  recordsTo Add.get(in dex);
  269                                               assertEqua ls(record,  checkReco rd);
  270                                      }                                  
  271                             }
  272                    }.pe rform();
  273           }                          
  274           
  275           pu blic void  testMatchN oRecords_m atchingPar entDomain_ AssertNoRe cordMatche d() throws  Exception  
  276           {                 
  277                    new  TestPlan()
  278                    {
  279                             privat e List<Rec ord> recor dsToAdd;
  280                             
  281                             @Overr ide
  282                             protec ted List<R ecord> get RecordsToA dd() throw s Exceptio n
  283                             {
  284                                      recordsT oAdd = new  ArrayList <Record>() ;
  285                                      
  286                                      recordsT oAdd.add(n ew ARecord (Name.from String("ex ample.doma in.com."),  DClass.IN , 3600, In etAddress. getByName( "127.0.0.1 ")));
  287                                      recordsT oAdd.add(n ew ARecord (Name.from String("ex ample.doma in.com."),  DClass.IN , 3600, In etAddress. getByName( "127.0.0.2 ")));
  288                             
  289                                      
  290                                      return r ecordsToAd d;                                                
  291                             }
  292  
  293                             @Overr ide
  294                             protec ted String  getNameTo Match() th rows Excep tion
  295                             {
  296                                      return " domain.com ";
  297                             }
  298  
  299                             @Overr ide
  300                             protec ted void d oAssertion s(List<Rec ord> recor dsMatched)  throws Ex ception                 
  301                             {
  302                                      assertNo tNull(reco rdsMatched );
  303                                      assertEq uals(0, re cordsMatch ed.size()) ;
  304                                                       
  305                             }
  306                    }.pe rform();
  307           }                 
  308           
  309           pu blic void  testFailur eToMatch_i nvalidProx y_AssertEx ception()  throws Exc eption 
  310           {
  311                    new  TestPlan()
  312                    {
  313                             
  314                             @Overr ide
  315                             protec ted List<R ecord> get RecordsToA dd() throw s Exceptio n
  316                             {
  317                                      ArrayLis t<Record>  recordsToA dd = new A rrayList<R ecord>();
  318                                      
  319                                      recordsT oAdd.add(n ew ARecord (Name.from String("ex ample.doma in.com."),  DClass.IN , 3600, In etAddress. getByName( "127.0.0.1 ")));
  320                                      
  321                                      return r ecordsToAd d;                                                
  322                             }
  323                             
  324                             @Overr ide
  325                             protec ted String  getNameTo Match() th rows Excep tion
  326                             {                                  
  327                                       recordComm ands.setCo nfiguratio nProxy(new  Configura tionServic eProxy("ht tp://local host: PORT /bogusendp oint"));
  328                                      return " example.do main.com";
  329                             }
  330                             
  331                             @Overr ide
  332                             protec ted void a ssertExcep tion(Excep tion excep tion) thro ws Excepti on 
  333                             {
  334                                      assertNo tNull(exce ption);
  335                                      assertTr ue(excepti on instanc eof Runtim eException );
  336                                      assertTr ue(excepti on.getCaus e() instan ceof AxisF ault);
  337                                                                
  338                             }
  339                             
  340                             @Overr ide
  341                             protec ted void d oAssertion s(List<Rec ord> recor dsMatched)  throws Ex ception                 
  342                             {
  343                             }
  344  
  345                    }.pe rform();
  346           }                          
  347   }