2. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 10/4/2017 8:38:10 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.

2.1 Files compared

# Location File Last Modified
1 solr-smart-client.zip\solr-smart-client\tests\unit solr-smart-client-spec.js Mon Aug 28 19:30:59 2017 UTC
2 solr-smart-client.zip\solr-smart-client\tests\unit solr-smart-client-spec.js Wed Oct 4 13:28:43 2017 UTC

2.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 14 466
Changed 13 50
Inserted 0 0
Removed 0 0

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

2.4 Active regular expressions

No regular expressions were active.

2.5 Comparison detail

  1   'use stric t';
  2  
  3   const buny an = requi re('bunyan ');
  4   const Solr SmartClien t = requir e('../../s olr-smart- client').S olrSmartCl ient;
  5  
  6   const dumm yLogger =  bunyan.cre ateLogger( {
  7     name: 't est',
  8     level: ' debug',
  9     // comme nt out the  next thre e lines to  see logge r output
  10     streams:  [{
  11       path:  '/dev/null ',
  12     }]
  13   });
  14  
  15   function c lusterStat eString(.. .params) {
  16     return J SON.string ify(cluste rState(... params));
  17   }
  18  
  19   function b adClusterS tateString (...params ) {
  20     let stat e = cluste rState(... params);
  21     delete s tate.shard s;
  22     return J SON.string ify(state) ;
  23   }
  24  
  25   function c lusterStat e({
  26     protocol  = 'http',
  27       address =  ' IP          ',
  28     core = ' vpr'
  29   } = {}) {
  30     return {
  31       [core] : {
  32         'rep licationFa ctor': '1' ,
  33         'sha rds': {
  34           's hard1': {
  35              'range': ' 80000000-7 fffffff',
  36              'state': ' active',
  37              'replicas' : {
  38                'core_no de1': {
  39                  'core' : 'vpr_sha rd1_replic a1',
  40                    'base_url' : (protoco l ? protoc ol + '://'  : '') + a ddress + ' : PORT /solr',
  41                    'node_name ': ' IP                _solr',
  42                  'state ': 'active ',
  43                  'leade r': 'true'
  44                },
  45                'core_no de2': {
  46                  'core' : 'vpr_sha rd1_replic a2',
  47                    'base_url' : (protoco l ? protoc ol + '://'  : '') + a ddress + ' : PORT /solr',
  48                    'node_name ': ' IP                _solr',
  49                  'state ': 'active ',
  50                  'leade r': 'true'
  51                }
  52              }
  53           },
  54           's hard2': {
  55              'range': ' 80000000-7 fffffff',
  56              'state': ' active',
  57              'replicas' : {
  58                'core_no de3': {
  59                  'core' : 'vpr_sha rd2_replic a1',
  60                    'base_url' : (protoco l ? protoc ol + '://'  : '') + a ddress + ' : PORT /solr',
  61                    'node_name ': ' IP                _solr',
  62                  'state ': 'active ',
  63                  'leade r': 'true'
  64                },
  65                'core_no de4': {
  66                  'core' : 'vpr_sha rd2_replic a2',
  67                    'base_url' : (protoco l ? protoc ol + '://'  : '') + a ddress + ' : PORT /solr',
  68                    'node_name ': ' IP                _solr',
  69                  'state ': 'active ',
  70                  'leade r': 'true'
  71                }
  72              }
  73           }
  74         },
  75         'rou ter': {
  76           'n ame': 'com positeId'
  77         },
  78         'max ShardsPerN ode': '2',
  79         'aut oAddReplic as': 'fals e'
  80       }
  81     };
  82   }
  83  
  84   console.lo g(clusterS tateString ())
  85  
  86   describe(' solr-smart -client',  function()  {
  87     describe ('_getVali dSolrClien t()', func tion() {
  88       it('te sts that c orrect age nt is used  to create  solrClien t instance ', functio n() {
  89         let  expectSolr Config;
  90         let  finished =  false;
  91         let  testAgent  = 'test in stance';
  92  
  93         let  solrClient  = {
  94           cr eateClient : function (solrConfi g) {
  95              expectSolr Config = s olrConfig;
  96           }
  97         };
  98  
  99         let  instance =  {
  100           lo gger: dumm yLogger,
  101           co nfig: {
  102              core: 'vpr '
  103           },
  104           ag ent: testA gent,
  105           _g etValidSol rClient: S olrSmartCl ient.proto type._getV alidSolrCl ient,
  106           _g etSolrClie ntInfo: fu nction(cal lback) {
  107              this.logge r.debug('t est._getSo lrClient() ');
  108              return set Timeout(ca llback, 0,  null, clu sterStateS tring());
  109           }
  110         };
  111  
  112         runs (function( ) {
  113           in stance._ge tValidSolr Client(sol rClient, e rror => {
  114              expect(err or).toBeFa lsy();
  115              expect(exp ectSolrCon fig.agent) .toEqual(t estAgent);
  116              finished =  true;
  117           }) ;
  118         });
  119  
  120         wait sFor(funct ion() {
  121           re turn finis hed;
  122         }, 5 00);
  123       });
  124     });
  125  
  126     describe ('_findFir stReadyNod eUrl()', f unction()  {
  127       it('te sts that u rls with p rotocols a re accepte d', functi on() {
  128         let  result;
  129  
  130         resu lt = SolrS martClient ._findFirs tReadyNode Url(dummyL ogger, clu sterState( ).vpr.shar ds);
  131         expe ct(result) .toBeTruth y();
  132         if ( result) {
  133           ex pect(resul t.length). toBe(6);
  134           ex pect(resul t[2]).toBe ('http');
  135             expect(res ult[3]).to Be(' IP          ');
  136             expect(res ult[4]).to Be(' PORT ');
  137           ex pect(resul t[5]).toBe ('/solr');
  138         }
  139  
  140         resu lt = SolrS martClient ._findFirs tReadyNode Url(dummyL ogger, clu sterState( {
  141           pr otocol: 'h ttps'
  142         }).v pr.shards) ;
  143  
  144         expe ct(result) .toBeTruth y();
  145         if ( result) {
  146           ex pect(resul t.length). toBe(6);
  147           ex pect(resul t[2]).toBe ('https');
  148             expect(res ult[3]).to Be(' IP          ');
  149             expect(res ult[4]).to Be(' PORT ');
  150           ex pect(resul t[5]).toBe ('/solr');
  151         }
  152       });
  153  
  154       it('te sts that u rls withou t protocol s are acce pted', fun ction() {
  155         let  result;
  156  
  157         resu lt = SolrS martClient ._findFirs tReadyNode Url(dummyL ogger, clu sterState( {
  158           pr otocol: ''
  159         }).v pr.shards) ;
  160  
  161         expe ct(result) .toBeTruth y();
  162         if ( result) {
  163           ex pect(resul t.length). toBe(6);
  164           ex pect(resul t[2]).toBe Falsy();
  165             expect(res ult[3]).to Be(' IP          ');
  166             expect(res ult[4]).to Be(' PORT ');
  167           ex pect(resul t[5]).toBe ('/solr');
  168         }
  169       });
  170  
  171       it('te sts that n odes that  are not in  the corre ct state a re omitted ', functio n() {
  172         let  result;
  173         let  shards = c lusterStat e().vpr.sh ards;
  174  
  175         shar ds.shard1. replicas.c ore_node1. state = 'i nactive';
  176         shar ds.shard1. replicas.c ore_node1. leader = ' true';
  177         resu lt = SolrS martClient ._findFirs tReadyNode Url(dummyL ogger, sha rds);
  178         expe ct(result) .toBeTruth y();
  179         if ( result) {
  180           ex pect(resul t.length). toBe(6);
  181           ex pect(resul t[2]).toBe ('http');
  182             expect(res ult[3]).to Be(' IP          ');
  183             expect(res ult[4]).to Be(' PORT ');
  184           ex pect(resul t[5]).toBe ('/solr');
  185         }
  186  
  187         shar ds.shard1. replicas.c ore_node1. state = 'a ctive';
  188         shar ds.shard1. replicas.c ore_node1. leader = ' false';
  189         resu lt = SolrS martClient ._findFirs tReadyNode Url(dummyL ogger, sha rds);
  190         expe ct(result) .toBeTruth y();
  191         if ( result) {
  192           ex pect(resul t.length). toBe(6);
  193           ex pect(resul t[2]).toBe ('http');
  194             expect(res ult[3]).to Be(' IP          ');
  195             expect(res ult[4]).to Be(' PORT ');
  196           ex pect(resul t[5]).toBe ('/solr');
  197         }
  198       });
  199     });
  200  
  201     describe ('_createS olrClientC onfig()',  function()  {
  202       let co re = 'vpr' ;
  203       let ag ent = 'age nt';
  204  
  205       it('te sts that a ny empty c ore or clu sterState  parameter  returns un defined',  function()  {
  206         expe ct(SolrSma rtClient._ createSolr ClientConf ig(dummyLo gger, null , agent, c lusterStat e())).toBe Undefined( );
  207         expe ct(SolrSma rtClient._ createSolr ClientConf ig(dummyLo gger, core , agent, n ull)).toBe Undefined( );
  208         expe ct(SolrSma rtClient._ createSolr ClientConf ig(dummyLo gger, core , agent, [ ])).toBeUn defined();
  209       });
  210  
  211       it('te sts that n on-JSON cl usterState  parameter  returns u ndefined',  function( ) {
  212         expe ct(SolrSma rtClient._ createSolr ClientConf ig(dummyLo gger, null , agent, ' non-JSON-t est-string ')).toBeUn defined();
  213       });
  214  
  215       it('te sts that c lusterStat e without  "vpr" coll ection ret urns undef ined', fun ction() {
  216         expe ct(SolrSma rtClient._ createSolr ClientConf ig(dummyLo gger, null , agent, c lusterStat eString({
  217           co re: 'test'
  218         }))) .toBeUndef ined();
  219       });
  220  
  221       it('te sts that b ad format  clusterSta te paramet er returns  undefined ', functio n() {
  222         expe ct(SolrSma rtClient._ createSolr ClientConf ig(dummyLo gger, null , agent, b adClusterS tateString ())).toBeU ndefined() ;
  223       });
  224  
  225       it('te sts that f irst valid  configura tion is re turned', f unction()  {
  226         expe ct(SolrSma rtClient._ createSolr ClientConf ig(dummyLo gger, core , agent, c lusterStat eString()) ).toEqual( {
  227             host: ' IP          ',
  228             port: ' PORT ',
  229           pa th: '/solr ',
  230           se cure: fals e,
  231           co re: core,
  232           ag ent: agent
  233         });
  234  
  235         expe ct(SolrSma rtClient._ createSolr ClientConf ig(dummyLo gger, core , agent, c lusterStat eString({
  236           pr otocol: ''
  237         }))) .toEqual({
  238             host: ' IP          ',
  239             port: ' PORT ',
  240           pa th: '/solr ',
  241           se cure: fals e,
  242           co re: core,
  243           ag ent: agent
  244         });
  245  
  246         expe ct(SolrSma rtClient._ createSolr ClientConf ig(dummyLo gger, core , agent, c lusterStat eString({
  247           pr otocol: 'h ttps'
  248         }))) .toEqual({
  249             host: ' IP          ',
  250             port: ' PORT ',
  251           pa th: '/solr ',
  252           se cure: true ,
  253           co re: core,
  254           ag ent: agent
  255         });
  256       });
  257     });
  258   });