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

40.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_matchSOARecords_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_matchSOARecords_Test.java Tue May 22 20:59:42 2018 UTC

40.2 Comparison summary

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

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

40.4 Active regular expressions

No regular expressions were active.

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