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

36.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_getByRecordId_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_getByRecordId_Test.java Tue May 22 20:59:40 2018 UTC

36.2 Comparison summary

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

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

36.4 Active regular expressions

No regular expressions were active.

36.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.Arr ays;
  7   import jav a.util.Col lections;
  8   import jav a.util.Lis t;
  9  
  10   import jun it.framewo rk.TestCas e;
  11  
  12  
  13   import org .apache.ax is.AxisFau lt;
  14   import org .apache.mi na.util.Av ailablePor tFinder;
  15  
  16   import org .nhind.con fig.Config urationSer viceProxy;
  17   import org .nhind.con fig.DnsRec ord;
  18   import org .nhindirec t.dns.Conf igServiceD NSStore;
  19   import org .nhindirec t.dns.DNSS erver;
  20   import org .nhindirec t.dns.DNSS erverSetti ngs;
  21   import org .nhindirec t.dns.util .BaseTestP lan;
  22   import org .nhindirec t.dns.util .ConfigSer viceRunner ;
  23   import org .xbill.DNS .ARecord;
  24   import org .xbill.DNS .DClass;
  25   import org .xbill.DNS .MXRecord;
  26   import org .xbill.DNS .Name;
  27   import org .xbill.DNS .Record;
  28   import org .xbill.DNS .SOARecord ;
  29   import org .xbill.DNS .Type;
  30  
  31   public cla ss DNSReco rdCommands _getByReco rdId_Test  extends Te stCase
  32   {
  33           ab stract cla ss TestPla n extends  BaseTestPl an 
  34           {
  35           pr otected Mo ckDNSRecor dPrinter r ecordPrint er;
  36                    
  37                    prot ected int  port;
  38                    prot ected DNSS erver serv er = null;
  39                    prot ected Conf igurationS erviceProx y proxy;
  40                    prot ected DNSR ecordComma nds record Commands;
  41                    
  42                    prot ected Reco rd toRecor d(DnsRecor d rec) thr ows Except ion
  43                    {                         
  44                             return  Record.ne wRecord(Na me.fromStr ing(rec.ge tName()),  rec.getTyp e(), rec.g etDclass() , rec.getT tl(), rec. getData()) ;
  45                    }
  46  
  47                    prot ected DnsR ecord from Record(Rec ord rec) t hrows Exce ption
  48                    {                         
  49                             DnsRec ord newRec  = new Dns Record();
  50                             newRec .setData(r ec.rdataTo WireCanoni cal());
  51                             newRec .setDclass (rec.getDC lass());
  52                             newRec .setName(r ec.getName ().toStrin g());
  53                             newRec .setTtl(re c.getTTL() );
  54                             newRec .setType(r ec.getType ());
  55                             
  56                             return  newRec;
  57                    }
  58                                      
  59                    prot ected List <Record> g etRecordsI nStore(int  type) thr ows Except ion
  60                    {
  61                             DnsRec ord[] reco rds = prox y.getDNSBy Type(type) ;
  62                             
  63                             List<R ecord> ret Val;
  64                             
  65                             if (re cords == n ull || rec ords.lengt h == 0)
  66                                      retVal =  Collectio ns.emptyLi st();
  67                             else
  68                             {
  69                                      retVal =  new Array List<Recor d>();
  70                                      for (Dns Record rec ord : reco rds)
  71                                               retVal.add (toRecord( record));
  72                             }
  73                             
  74                             return  retVal;
  75                    }                 
  76                    
  77                    @Ove rride
  78                    prot ected void  setupMock s() throws  Exception
  79                    {
  80                             if (!C onfigServi ceRunner.i sServiceRu nning())
  81                                      ConfigSe rviceRunne r.startCon figService ();
  82  
  83                             proxy  = new Conf igurationS erviceProx y(ConfigSe rviceRunne r.getConfi gServiceUR L());
  84                             
  85                             cleanR ecords();
  86                             
  87                             port =  Available PortFinder .getNextAv ailable(10 24);
  88                             DNSSer verSetting s settings  = new DNS ServerSett ings();
  89                             settin gs.setPort (port);
  90                                                       
  91                             server  = new DNS Server(new  ConfigSer viceDNSSto re(new URL (ConfigSer viceRunner .getConfig ServiceURL ())), sett ings);
  92                             
  93                             server .start();          
  94                             
  95                             record Printer =  new MockDN SRecordPri nter();
  96                    }
  97                    
  98                    @Ove rride
  99                    prot ected void  tearDownM ocks() thr ows Except ion
  100                    {
  101                             if (se rver != nu ll)
  102                                      server.s top();
  103                    }        
  104                    
  105                    @Ove rride
  106                    prot ected void  performIn ner() thro ws Excepti on
  107                    {
  108                             record Commands =  new DNSRe cordComman ds(proxy);
  109                             record Commands.s etRecordPr inter(reco rdPrinter) ;
  110                             
  111                             List<R ecord> rec ordsToAdd  = getRecor dsToAdd();
  112                             
  113                             
  114                             DnsRec ord[] addR ecs = new  DnsRecord[ recordsToA dd.size()] ;
  115                             int cn t = 0;
  116                             for (R ecord reco rdToAdd :  recordsToA dd)
  117                             {                                  
  118                                      addRecs[ cnt++] = f romRecord( recordToAd d);
  119                             }
  120                             
  121                             proxy. addDNS(add Recs);
  122                             
  123                             addRec s = proxy. getDNSByTy pe(Type.AN Y);                                    
  124                             
  125                             List<D nsRecord>  recordsToF etch = get RecordsToF etch(Array s.asList(a ddRecs));
  126                             for (D nsRecord r ecordToRem ove : reco rdsToFetch )
  127                             {
  128                                      switch ( recordToRe move.getTy pe())
  129                                      {
  130                                               case Type. A:
  131                                                       re cordComman ds.getANAM E(new Stri ng[] {Long .toString( recordToRe move.getId ())});
  132                                                       br eak;
  133                                               case Type. MX:
  134                                                       re cordComman ds.getMX(n ew String[ ] {Long.to String(rec ordToRemov e.getId()) });
  135                                                       br eak;
  136                                               case Type. SOA:
  137                                                       re cordComman ds.getSOA( new String [] {Long.t oString(re cordToRemo ve.getId() )});
  138                                                       br eak;
  139  
  140                                      }                                                   
  141                             }
  142                                                       
  143                             doAsse rtions();
  144                    }                 
  145                    
  146                    priv ate void c leanRecord s() throws  Exception
  147                    {
  148                             DnsRec ord[] rec  = proxy.ge tDNSByType (Type.ANY) ;
  149                             
  150                             if (re c != null  && rec.len gth > 0)
  151                                      proxy.re moveDNS(re c);
  152                             
  153                             rec =  proxy.getD NSByType(T ype.ANY);
  154                             
  155                             assert Null(rec);
  156                             
  157                    }                 
  158                                      
  159                    
  160                    prot ected abst ract List< Record> ge tRecordsTo Add() thro ws Excepti on;
  161                    
  162                    prot ected abst ract List< DnsRecord>  getRecord sToFetch(L ist<DnsRec ord> added Records) t hrows Exce ption;
  163                    
  164                    prot ected abst ract void  doAssertio ns() throw s Exceptio n;
  165           }
  166  
  167           pu blic void  testGetAll Records_As sertAllRec ordFetched () throws  Exception 
  168           {                 
  169                    new  TestPlan()
  170                    {
  171                             @Overr ide
  172                             protec ted List<R ecord> get RecordsToA dd() throw s Exceptio n
  173                             {
  174                                      List<Rec ord> recor dsToAdd =  new ArrayL ist<Record >();
  175                                      
  176                                      recordsT oAdd.add(n ew ARecord (Name.from String("ex ample.doma in.com."),  DClass.IN , 3600, In etAddress. getByName( "127.0.0.1 ")));
  177                                      recordsT oAdd.add(n ew ARecord (Name.from String("ex ample.doma in.com."),  DClass.IN , 3600, In etAddress. getByName( "127.0.0.2 ")));
  178                                      recordsT oAdd.add(n ew MXRecor d(Name.fro mString("e xample.dom ain.com.") , DClass.I N, 3600, 
  179                                                       1,  Name.from String("ma il1.exampl e.domain.c om.")));
  180                                      recordsT oAdd.add(n ew MXRecor d(Name.fro mString("e xample2.do main.com." ), DClass. IN, 3600, 
  181                                                       1,  Name.from String("ma il2.exampl 2.domain.c om.")));
  182  
  183                                      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. "),
  184                                                       Na me.fromStr ing("gm255 2.example. domain.com ."), 1, 36 00, 60, 60 , 3600));                                             
  185                                      
  186                                      return r ecordsToAd d;                                                
  187                             }
  188  
  189                             @Overr ide
  190                             protec ted List<D nsRecord>  getRecords ToFetch(Li st<DnsReco rd> addedR ecords) th rows Excep tion
  191                             {
  192                                      return a ddedRecord s;
  193                             }
  194  
  195                             @Overr ide
  196                             protec ted void d oAssertion s() throws  Exception
  197                             {
  198                                      assertEq uals(5, re cordPrinte r.printRec ordCalled) ;
  199                             }
  200                    }.pe rform();
  201           }                 
  202           
  203           pu blic void  testGetOnl yARecords_ AssertOnly ARecordsFe tched() th rows Excep tion 
  204           {                 
  205                    new  TestPlan()
  206                    {
  207                             @Overr ide
  208                             protec ted List<R ecord> get RecordsToA dd() throw s Exceptio n
  209                             {
  210                                      List<Rec ord> recor dsToAdd =  new ArrayL ist<Record >();
  211                                      
  212                                      recordsT oAdd.add(n ew ARecord (Name.from String("ex ample.doma in.com."),  DClass.IN , 3600, In etAddress. getByName( "127.0.0.1 ")));
  213                                      recordsT oAdd.add(n ew ARecord (Name.from String("ex ample.doma in.com."),  DClass.IN , 3600, In etAddress. getByName( "127.0.0.2 ")));
  214                                      recordsT oAdd.add(n ew ARecord (Name.from String("ex ample.doma in.com."),  DClass.IN , 3600, In etAddress. getByName( "127.0.0.3 ")));
  215                                      recordsT oAdd.add(n ew MXRecor d(Name.fro mString("e xample.dom ain.com.") , DClass.I N, 3600, 
  216                                                       1,  Name.from String("ma il1.exampl e.domain.c om.")));
  217                                      recordsT oAdd.add(n ew MXRecor d(Name.fro mString("e xample2.do main.com." ), DClass. IN, 3600, 
  218                                                       1,  Name.from String("ma il2.exampl 2.domain.c om.")));
  219  
  220                                      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. "),
  221                                                       Na me.fromStr ing("gm255 2.example. domain.com ."), 1, 36 00, 60, 60 , 3600));                                             
  222                                      
  223                                      return r ecordsToAd d;                                                
  224                             }
  225  
  226                             @Overr ide
  227                             protec ted List<D nsRecord>  getRecords ToFetch(Li st<DnsReco rd> addedR ecords) th rows Excep tion
  228                             {
  229                                      List<Dns Record> re tVal = new  ArrayList <DnsRecord >();
  230                             
  231                                      for (Dns Record add edRecord :  addedReco rds)
  232                                      {
  233                                               if (addedR ecord.getT ype() == T ype.A)
  234                                                       re tVal.add(a ddedRecord );
  235                                      }
  236                                      
  237                                      return r etVal;
  238                             }
  239  
  240                             @Overr ide
  241                             protec ted void d oAssertion s() throws  Exception
  242                             {
  243                                      assertEq uals(3, re cordPrinte r.printRec ordCalled) ;
  244                             }
  245                    }.pe rform();
  246           }                 
  247  
  248           pu blic void  testGetAll ExceptARec ords_Asser tNoARecord sFetched()  throws Ex ception 
  249           {                 
  250                    new  TestPlan()
  251                    {
  252                             @Overr ide
  253                             protec ted List<R ecord> get RecordsToA dd() throw s Exceptio n
  254                             {
  255                                      List<Rec ord> recor dsToAdd =  new ArrayL ist<Record >();
  256                                      
  257                                      recordsT oAdd.add(n ew ARecord (Name.from String("ex ample.doma in.com."),  DClass.IN , 3600, In etAddress. getByName( "127.0.0.1 ")));
  258  
  259                                      recordsT oAdd.add(n ew MXRecor d(Name.fro mString("e xample.dom ain.com.") , DClass.I N, 3600, 
  260                                                       1,  Name.from String("ma il1.exampl e.domain.c om.")));
  261                                      recordsT oAdd.add(n ew MXRecor d(Name.fro mString("e xample2.do main.com." ), DClass. IN, 3600, 
  262                                                       1,  Name.from String("ma il2.exampl 2.domain.c om.")));
  263  
  264                                      
  265                                      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. "),
  266                                                       Na me.fromStr ing("gm255 2.example. domain.com ."), 1, 36 00, 60, 60 , 3600));                                             
  267  
  268                                      recordsT oAdd.add(n ew SOAReco rd(Name.fr omString(" example2.d omain.com. "), DClass .IN, 3600,  Name.from String("ns 1.example2 .domain.co m."),
  269                                                       Na me.fromStr ing("gm255 2.example2 .domain.co m."), 1, 3 600, 60, 6 0, 3600));                                                     
  270  
  271                                      return r ecordsToAd d;                                                
  272                             }
  273  
  274                             @Overr ide
  275                             protec ted List<D nsRecord>  getRecords ToFetch(Li st<DnsReco rd> addedR ecords) th rows Excep tion
  276                             {
  277                                      List<Dns Record> re tVal = new  ArrayList <DnsRecord >();
  278                             
  279                                      for (Dns Record add edRecord :  addedReco rds)
  280                                      {
  281                                               if (addedR ecord.getT ype() != T ype.A)
  282                                                       re tVal.add(a ddedRecord );
  283                                      }
  284                                      
  285                                      return r etVal;
  286                             }
  287  
  288                             @Overr ide
  289                             protec ted void d oAssertion s() throws  Exception
  290                             {
  291                                      assertEq uals(4, re cordPrinte r.printRec ordCalled) ;
  292                             }
  293                    }.pe rform();
  294           }                          
  295           
  296           pu blic void  testReturn NoRecords_ noIdsProvi ded_Assert NoRecordsF etched() t hrows Exce ption 
  297           {                 
  298                    new  TestPlan()
  299                    {
  300                             @Overr ide
  301                             protec ted List<R ecord> get RecordsToA dd() throw s Exceptio n
  302                             {
  303                                      List<Rec ord> recor dsToAdd =  new ArrayL ist<Record >();
  304                                      
  305                                      recordsT oAdd.add(n ew ARecord (Name.from String("ex ample.doma in.com."),  DClass.IN , 3600, In etAddress. getByName( "127.0.0.1 ")));
  306  
  307                                      recordsT oAdd.add(n ew MXRecor d(Name.fro mString("e xample.dom ain.com.") , DClass.I N, 3600, 
  308                                                       1,  Name.from String("ma il1.exampl e.domain.c om.")));
  309                                      recordsT oAdd.add(n ew MXRecor d(Name.fro mString("e xample2.do main.com." ), DClass. IN, 3600, 
  310                                                       1,  Name.from String("ma il2.exampl 2.domain.c om.")));
  311  
  312                                      
  313                                      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. "),
  314                                                       Na me.fromStr ing("gm255 2.example. domain.com ."), 1, 36 00, 60, 60 , 3600));                                             
  315  
  316                                      recordsT oAdd.add(n ew SOAReco rd(Name.fr omString(" example2.d omain.com. "), DClass .IN, 3600,  Name.from String("ns 1.example2 .domain.co m."),
  317                                                       Na me.fromStr ing("gm255 2.example2 .domain.co m."), 1, 3 600, 60, 6 0, 3600));                                                     
  318  
  319                                      return r ecordsToAd d;                                                
  320                             }
  321  
  322                             @Overr ide
  323                             protec ted List<D nsRecord>  getRecords ToFetch(Li st<DnsReco rd> addedR ecords) th rows Excep tion
  324                             {
  325                                      List<Dns Record> re tVal = Col lections.e mptyList() ;
  326                                      return r etVal;
  327                             }
  328  
  329                             @Overr ide
  330                             protec ted void d oAssertion s() throws  Exception
  331                             {
  332                                      assertEq uals(0, re cordPrinte r.printRec ordCalled) ;
  333                             }
  334                    }.pe rform();
  335           }                 
  336           
  337           pu blic void  testReturn NoRecords_ noMatching Ids_Assert NoRecordsF etched() t hrows Exce ption 
  338           {
  339                    new  TestPlan()
  340                    {
  341                             privat e List<Rec ord> recor dsToAdd;
  342                             
  343                             @Overr ide
  344                             protec ted List<R ecord> get RecordsToA dd() throw s Exceptio n
  345                             {
  346                                      recordsT oAdd = new  ArrayList <Record>() ;
  347                                      
  348                                      recordsT oAdd.add(n ew ARecord (Name.from String("ex ample.doma in.com."),  DClass.IN , 3600, In etAddress. getByName( "127.0.0.1 ")));
  349                                      
  350                                      return r ecordsToAd d;                                                
  351                             }
  352                             
  353                             @Overr ide
  354                             protec ted List<D nsRecord>  getRecords ToFetch(Li st<DnsReco rd> addedR ecords) th rows Excep tion
  355                             {        
  356                                      DnsRecor d largestR ecord = nu ll;
  357                                      // find  the record  with the  highest id  and add 1  to it
  358                                      for (Dns Record rec ord : adde dRecords)
  359                                      {
  360                                               if (larges tRecord ==  null || l argestReco rd.getId()  < record. getId())
  361                                                       la rgestRecor d = record ;                                             
  362                                      }
  363                                      
  364                                      largestR ecord.setI d(largestR ecord.getI d() + 1);
  365                                      
  366                                      return n ew ArrayLi st<DnsReco rd>(Arrays .asList(la rgestRecor d));
  367                             }
  368  
  369                             
  370                             @Overr ide
  371                             protec ted void d oAssertion s() throws  Exception
  372                             {
  373                                      assertEq uals(0, re cordPrinte r.printRec ordCalled) ;
  374                             }
  375  
  376                    }.pe rform();
  377           }
  378           
  379           pu blic void  testFailur eToGetReco rds_invali dProxy_Ass ertExcepti on() throw s Exceptio
  380           {
  381                    new  TestPlan()
  382                    {
  383                             privat e List<Rec ord> recor dsToAdd;
  384                             
  385                             @Overr ide
  386                             protec ted List<R ecord> get RecordsToA dd() throw s Exceptio n
  387                             {
  388                                      recordsT oAdd = new  ArrayList <Record>() ;
  389                                      
  390                                      recordsT oAdd.add(n ew ARecord (Name.from String("ex ample.doma in.com."),  DClass.IN , 3600, In etAddress. getByName( "127.0.0.1 ")));
  391                                      
  392                                      return r ecordsToAd d;                                                
  393                             }
  394                             
  395                             @Overr ide
  396                             protec ted List<D nsRecord>  getRecords ToFetch(Li st<DnsReco rd> addedR ecords) th rows Excep tion
  397                             {                                  
  398                                       this.recor dCommands. setConfigu rationProx y(new Conf igurationS erviceProx y("http:// localhost: PORT /bogusendp oint"));
  399                                      return a ddedRecord s;
  400                             }
  401                             
  402                             @Overr ide
  403                             protec ted void a ssertExcep tion(Excep tion excep tion) thro ws Excepti on 
  404                             {
  405                                      assertNo tNull(exce ption);
  406                                      assertTr ue(excepti on instanc eof Runtim eException );
  407                                      assertTr ue(excepti on.getCaus e() instan ceof AxisF ault);
  408                                      
  409                                      
  410                             }
  411                             
  412                             @Overr ide
  413                             protec ted void d oAssertion s() throws  Exception
  414                             {
  415  
  416                             }
  417  
  418                    }.pe rform();
  419           }                 
  420   }