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.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | solr-smart-client.zip\solr-smart-client\tests\integration | solr-smart-client-itest-spec.js | Mon Aug 28 19:30:59 2017 UTC |
| 2 | solr-smart-client.zip\solr-smart-client\tests\integration | solr-smart-client-itest-spec.js | Wed Oct 4 13:26:20 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 3 | 496 |
| Changed | 2 | 4 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| 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 |
No regular expressions were active.
| 1 | 'use stric t'; | |
| 2 | ||
| 3 | // NOTICE: in order to run thi s test, th e Mocks VM must be r unning wit h Solr and ZooKeeper . | |
| 4 | // Also, t he test fo r "deleteA ll()" will delete al l of the r ecords in Solr. | |
| 5 | ||
| 6 | // These t ests only verify tha t the func tions exec ute withou t errors. Verifying that inser ting, | |
| 7 | // finding , and dele ting data is a manua l process. | |
| 8 | ||
| 9 | const buny an = requi re('bunyan '); | |
| 10 | ||
| 11 | const Solr SmartClien t = requir e('../../s olr-smart- client').S olrSmartCl ient; | |
| 12 | const crea teClient = require(' ../../solr -smart-cli ent').crea teClient; | |
| 13 | ||
| 14 | const _ = require('u nderscore' ); | |
| 15 | ||
| 16 | const PATH = '/colle ctions/vpr /state.jso n'; | |
| 17 | const CORE = 'vpr'; | |
| 18 | ||
| 19 | const logg er = bunya n.createLo gger({ | |
| 20 | name: 't est', | |
| 21 | level: ' debug', | |
| 22 | // comme nt out the next thre e lines to see logge r output | |
| 23 | streams: [{ | |
| 24 | path: '/dev/null ', | |
| 25 | }] | |
| 26 | }); | |
| 27 | ||
| 28 | let solrSm artClient = null; | |
| 29 | let finish ed = false ; | |
| 30 | ||
| 31 | function g etConfig(c onfig) { | |
| 32 | return _ .defaults( config || {}, { | |
| 33 | dataTi meoutMilli s: 3000, | |
| 34 | core: CORE, | |
| 35 | path: PATH, | |
| 36 | zooKeeperC onnection: ' IP ', | |
| 37 | }); | |
| 38 | } | |
| 39 | ||
| 40 | ||
| 41 | describe(' solr-smart -client', function() { | |
| 42 | beforeEa ch(functio n() { | |
| 43 | finish ed = false ; | |
| 44 | }); | |
| 45 | ||
| 46 | describe ('General Initializa tion/Start up', funct ion() { | |
| 47 | it('te sts creati ng solr cl ient with factory fu nction', f unction() { | |
| 48 | solr SmartClien t = create Client(log ger, getCo nfig()); | |
| 49 | expe ct(solrSma rtClient). not.toBeUn defined(); | |
| 50 | expe ct(solrSma rtClient). not.toBeNu ll(); | |
| 51 | }); | |
| 52 | ||
| 53 | it('te sts creati ng solr cl ient with constructo r function ', functio n() { | |
| 54 | solr SmartClien t = new So lrSmartCli ent(logger , getConfi g()); | |
| 55 | expe ct(solrSma rtClient). not.toBeUn defined(); | |
| 56 | expe ct(solrSma rtClient). not.toBeNu ll(); | |
| 57 | }); | |
| 58 | ||
| 59 | it('te sts that a childInst ance is cr eated when childInst anceEnable d === true ', functio n() { | |
| 60 | solr SmartClien t = new So lrSmartCli ent(logger , getConfi g({ | |
| 61 | ch ildInstanc eEnabled: true | |
| 62 | })); | |
| 63 | let childLogge r = logger .child(); | |
| 64 | let childInsta nce = solr SmartClien t.childIns tance(chil dLogger); | |
| 65 | expe ct(childIn stance).no t.toBe(sol rSmartClie nt); | |
| 66 | }); | |
| 67 | ||
| 68 | it('te sts that a childInst ance is no t created when child InstanceEn abled !== true', fun ction() { | |
| 69 | solr SmartClien t = new So lrSmartCli ent(logger , getConfi g({ | |
| 70 | ch ildInstanc eEnabled: false | |
| 71 | })); | |
| 72 | ||
| 73 | let childLogge r = logger .child(); | |
| 74 | let childInsta nce = solr SmartClien t.childIns tance(chil dLogger); | |
| 75 | expe ct(childIn stance).to Be(solrSma rtClient); | |
| 76 | }); | |
| 77 | }); | |
| 78 | ||
| 79 | describe ('Timeout functional ity', func tion() { | |
| 80 | it('te sts that t imeout wor ks when at tempting t o get a co nnection', function( ) { | |
| 81 | let badConfig = { | |
| 82 | so lrClient: { | |
| 83 | dataTimeou tMillis: 5 00, // sho rt timeout so we don 't wait a long time for the te st | |
| 84 | core: CORE , | |
| 85 | path: PATH , | |
| 86 | zooKeeperC onnection: ' IP ' // this should poi nt to a no n-existent ZooKeeper server | |
| 87 | } | |
| 88 | }; | |
| 89 | ||
| 90 | solr SmartClien t = create Client(log ger, badCo nfig.solrC lient); | |
| 91 | ||
| 92 | runs (function( ) { | |
| 93 | so lrSmartCli ent.search ('PID:1', error => { | |
| 94 | expect(err or).not.to BeNull(); | |
| 95 | expect(err or).not.to BeUndefine d(); | |
| 96 | finished = true; | |
| 97 | }) ; | |
| 98 | }); | |
| 99 | ||
| 100 | wait sFor(funct ion() { | |
| 101 | re turn finis hed; | |
| 102 | }, 1 000); | |
| 103 | }); | |
| 104 | }); | |
| 105 | ||
| 106 | describe ('solr fun ctions', f unction() { | |
| 107 | descri be('add()' , function () { | |
| 108 | it(' tests that add() exe cutes', fu nction() { | |
| 109 | le t solrReco rd = { | |
| 110 | pid: '1001 ', | |
| 111 | uid: '1001 ' | |
| 112 | }; | |
| 113 | ||
| 114 | so lrSmartCli ent = crea teClient(l ogger, get Config()); | |
| 115 | ||
| 116 | ex pect(_.isO bject(solr Record)).t oBe(true); | |
| 117 | if (_.isObje ct(solrRec ord)) { | |
| 118 | runs(funct ion() { | |
| 119 | solrSmar tClient.ad d(solrReco rd, (error , data) => { | |
| 120 | expect (error).to BeNull(); | |
| 121 | expect (data).not .toBeUndef ined(); | |
| 122 | expect (data).not .toBeNull( ); | |
| 123 | if (da ta) { | |
| 124 | expe ct(data.re sponseHead er).not.to BeUndefine d(); | |
| 125 | expe ct(data.re sponseHead er.status) .toBe(0); | |
| 126 | } | |
| 127 | finish ed = true; | |
| 128 | }); | |
| 129 | }); | |
| 130 | ||
| 131 | waitsFor(f unction() { | |
| 132 | return f inished; | |
| 133 | }, 1000); | |
| 134 | } | |
| 135 | }); | |
| 136 | }); | |
| 137 | ||
| 138 | descri be('search ()', funct ion() { | |
| 139 | it(' tests that search() executes', function( ) { | |
| 140 | so lrSmartCli ent = crea teClient(l ogger, get Config()); | |
| 141 | ||
| 142 | ru ns(functio n() { | |
| 143 | solrSmartC lient.sear ch('PID:1' , (error, data) => { | |
| 144 | expect(e rror).toBe Null(); | |
| 145 | expect(d ata).not.t oBeUndefin ed(); | |
| 146 | if (data ) { | |
| 147 | expect (data.resp onseHeader ).not.toBe Undefined( ); | |
| 148 | expect (data.resp onseHeader .status).t oBe(0); | |
| 149 | } | |
| 150 | finished = true; | |
| 151 | }); | |
| 152 | }) ; | |
| 153 | ||
| 154 | wa itsFor(fun ction() { | |
| 155 | return fin ished; | |
| 156 | }, 1000); | |
| 157 | }); | |
| 158 | }); | |
| 159 | ||
| 160 | descri be('get()' , function () { | |
| 161 | it(' tests that get() exe cutes', fu nction() { | |
| 162 | ru ns(functio n() { | |
| 163 | solrSmartC lient.get( 'admin/pin g', (error , data) => { | |
| 164 | expect(e rror).toBe Null(); | |
| 165 | expect(d ata).not.t oBeUndefin ed(); | |
| 166 | if (data ) { | |
| 167 | expect (data.resp onseHeader ).not.toBe Undefined( ); | |
| 168 | expect (data.resp onseHeader .status).t oBe(0); | |
| 169 | } | |
| 170 | finished = true; | |
| 171 | }); | |
| 172 | }) ; | |
| 173 | ||
| 174 | wa itsFor(fun ction() { | |
| 175 | return fin ished; | |
| 176 | }, 1000); | |
| 177 | }); | |
| 178 | }); | |
| 179 | ||
| 180 | descri be('delete ByQuery()' , function () { | |
| 181 | it(' tests that deleteByQ uery() exe cutes', fu nction() { | |
| 182 | ru ns(functio n() { | |
| 183 | solrSmartC lient.dele teByQuery( 'PID:1', ( error, dat a) => { | |
| 184 | expect(e rror).toBe Null(); | |
| 185 | expect(d ata).not.t oBeUndefin ed(); | |
| 186 | if (data ) { | |
| 187 | expect (data.resp onseHeader ).not.toBe Undefined( ); | |
| 188 | expect (data.resp onseHeader .status).t oBe(0); | |
| 189 | } | |
| 190 | finished = true; | |
| 191 | }); | |
| 192 | }) ; | |
| 193 | ||
| 194 | wa itsFor(fun ction() { | |
| 195 | return fin ished; | |
| 196 | }, 1000); | |
| 197 | }); | |
| 198 | }); | |
| 199 | ||
| 200 | descri be('delete All()', fu nction() { | |
| 201 | it(' tests that deleteAll () execute s', functi on() { | |
| 202 | ru ns(functio n() { | |
| 203 | solrSmartC lient.dele teAll((err or, data) => { | |
| 204 | expect(e rror).toBe Null(); | |
| 205 | expect(d ata).not.t oBeUndefin ed(); | |
| 206 | if (data ) { | |
| 207 | expect (data.resp onseHeader ).not.toBe Undefined( ); | |
| 208 | expect (data.resp onseHeader .status).t oBe(0); | |
| 209 | } | |
| 210 | finished = true; | |
| 211 | }); | |
| 212 | }) ; | |
| 213 | ||
| 214 | wa itsFor(fun ction() { | |
| 215 | return fin ished; | |
| 216 | }, 1000); | |
| 217 | }); | |
| 218 | }); | |
| 219 | ||
| 220 | descri be('ping() ', functio n() { | |
| 221 | it(' tests that ping() ex ecutes', f unction() { | |
| 222 | ru ns(functio n() { | |
| 223 | solrSmartC lient.ping (error => { | |
| 224 | expect(_ .isUndefin ed(error) || _.isNul l(error)). toBe(true) ; | |
| 225 | finished = true; | |
| 226 | }); | |
| 227 | }) ; | |
| 228 | ||
| 229 | wa itsFor(fun ction() { | |
| 230 | return fin ished; | |
| 231 | }, 1000); | |
| 232 | }); | |
| 233 | }); | |
| 234 | ||
| 235 | descri be('commit ()', funct ion() { | |
| 236 | it(' tests that commit() executes', function( ) { | |
| 237 | ru ns(functio n() { | |
| 238 | solrSmartC lient.comm it(error = > { | |
| 239 | expect(_ .isUndefin ed(error) || _.isNul l(error)). toBe(true) ; | |
| 240 | finished = true; | |
| 241 | }); | |
| 242 | }) ; | |
| 243 | ||
| 244 | wa itsFor(fun ction() { | |
| 245 | return fin ished; | |
| 246 | }, 1000); | |
| 247 | }); | |
| 248 | }); | |
| 249 | }); | |
| 250 | }); |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.