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

37.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_matchAllTypes_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_matchAllTypes_Test.java Tue May 22 20:59:41 2018 UTC

37.2 Comparison summary

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

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

37.4 Active regular expressions

No regular expressions were active.

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