Produced by Araxis Merge on 10/4/2017 9:15:14 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 | vista-js.zip\vista-js\tests\integration | RpcClient-itest-spec.js | Tue Dec 15 21:45:19 2015 UTC |
| 2 | vista-js.zip\vista-js\tests\integration | RpcClient-itest-spec.js | Wed Oct 4 14:06:32 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 4 | 546 |
| Changed | 3 | 16 |
| 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 | var _ = re quire('und erscore'); | |
| 4 | var async = require( 'async'); | |
| 5 | ||
| 6 | var logger = require ('bunyan') .createLog ger({ | |
| 7 | name: 'test:Vist aJS-authen ticate', | |
| 8 | level: 'fatal' | |
| 9 | }); | |
| 10 | ||
| 11 | var wConfi g = requir e('./confi g'); | |
| 12 | var RpcCli ent = requ ire('../.. /src/RpcCl ient').Rpc Client; | |
| 13 | ||
| 14 | var config = _.defau lts(wConfi g.vistaSit es[' SIT E
|
|
| 15 | host: ' IP ', | |
| 16 | port: PORT , | |
| 17 | accessCode : ' PL ', | |
| 18 | verifyCode : ' PW ', | |
| 19 | contex t: 'HMP SY NCHRONIZAT ION CONTEX T', | |
| 20 | localI P: '127.0. 0.1', | |
| 21 | localA ddress: 'l ocalhost', | |
| 22 | connec tTimeout: 1000, | |
| 23 | sendTi meout: 500 0 | |
| 24 | }); | |
| 25 | ||
| 26 | describe(' verify Rpc Client() a nd instanc e methods against Pa norama', f unction() { | |
| 27 | descri be('verify correct c onfig info yields go od result' , function () { | |
| 28 | it ('test wit h explicit connectio n command' , function () { | |
| 29 | var test Error; | |
| 30 | var test Result; | |
| 31 | var call ed = false ; | |
| 32 | ||
| 33 | var expe ctedError = null; | |
| 34 | var expe ctedResult = { | |
| 35 | conn ect: { | |
| 36 | accessCode : ' PL ', | |
| 37 | verifyCode : ' PW ', | |
| 38 | duz: jasmi ne.any(Str ing), | |
| 39 | greeting: jasmine.an y(String) | |
| 40 | }, | |
| 41 | exec ute: jasmi ne.any(Str ing), | |
| 42 | clos e: 'SIGNOF F SUCCESSF UL' | |
| 43 | }; | |
| 44 | ||
| 45 | function callback( error, res ult) { | |
| 46 | call ed = true; | |
| 47 | test Error = er ror; | |
| 48 | test Result = r esult; | |
| 49 | } | |
| 50 | ||
| 51 | var clie nt = new R pcClient(l ogger, con fig); | |
| 52 | ||
| 53 | var rpc = { | |
| 54 | conn ect: clien t.connect. bind(clien t), | |
| 55 | exec ute: clien t.execute. bind(clien t, 'ORWU U SERINFO'), | |
| 56 | clos e: client. close.bind (client) | |
| 57 | }; | |
| 58 | ||
| 59 | async.se ries(rpc, callback); | |
| 60 | ||
| 61 | waitsFor (function( ) { | |
| 62 | retu rn called; | |
| 63 | }, 'shou ld be call ed', 5000) ; | |
| 64 | ||
| 65 | runs(fun ction() { | |
| 66 | expe ct(testErr or).toEqua l(expected Error); | |
| 67 | expe ct(testRes ult).toEqu al(expecte dResult); | |
| 68 | }); | |
| 69 | }) ; | |
| 70 | ||
| 71 | it ('test aut omatic con nection', function() { | |
| 72 | var test Error; | |
| 73 | var test Result; | |
| 74 | var call ed = false ; | |
| 75 | ||
| 76 | var expe ctedError = null; | |
| 77 | var expe ctedResult = { | |
| 78 | exec ute: jasmi ne.any(Str ing), | |
| 79 | clos e: 'SIGNOF F SUCCESSF UL' | |
| 80 | }; | |
| 81 | ||
| 82 | function callback( error, res ult) { | |
| 83 | call ed = true; | |
| 84 | test Error = er ror; | |
| 85 | test Result = r esult; | |
| 86 | } | |
| 87 | ||
| 88 | var clie nt = new R pcClient(l ogger, con fig); | |
| 89 | ||
| 90 | var rpc = { | |
| 91 | exec ute: clien t.execute. bind(clien t, 'ORWU U SERINFO'), | |
| 92 | clos e: client. close.bind (client) | |
| 93 | }; | |
| 94 | ||
| 95 | async.se ries(rpc, callback); | |
| 96 | ||
| 97 | waitsFor (function( ) { | |
| 98 | retu rn called; | |
| 99 | }, 'shou ld be call ed', 5000) ; | |
| 100 | ||
| 101 | runs(fun ction() { | |
| 102 | expe ct(testErr or).toEqua l(expected Error); | |
| 103 | expe ct(testRes ult).toEqu al(expecte dResult); | |
| 104 | }); | |
| 105 | }) ; | |
| 106 | ||
| 107 | it ('test aut omatic con nection di sabled', f unction() { | |
| 108 | var test Error; | |
| 109 | var test Result; | |
| 110 | var call ed = false ; | |
| 111 | ||
| 112 | var expe ctedError = 'Connect ion not in itialized' ; | |
| 113 | var expe ctedResult = { | |
| 114 | exec ute: undef ined | |
| 115 | }; | |
| 116 | ||
| 117 | var disa bledConfig = _.defau lts({}, co nfig, { | |
| 118 | noRe connect: t rue | |
| 119 | }); | |
| 120 | ||
| 121 | function callback( error, res ult) { | |
| 122 | call ed = true; | |
| 123 | test Error = er ror; | |
| 124 | test Result = r esult; | |
| 125 | } | |
| 126 | ||
| 127 | var clie nt = new R pcClient(l ogger, dis abledConfi g); | |
| 128 | ||
| 129 | var rpc = { | |
| 130 | exec ute: clien t.execute. bind(clien t, 'ORWU U SERINFO'), | |
| 131 | clos e: client. close.bind (client) | |
| 132 | }; | |
| 133 | ||
| 134 | async.se ries(rpc, callback); | |
| 135 | ||
| 136 | waitsFor (function( ) { | |
| 137 | retu rn called; | |
| 138 | }, 'shou ld be call ed', 5000) ; | |
| 139 | ||
| 140 | runs(fun ction() { | |
| 141 | expe ct(testErr or).toEqua l(expected Error); | |
| 142 | expe ct(testRes ult).toEqu al(expecte dResult); | |
| 143 | }); | |
| 144 | }) ; | |
| 145 | ||
| 146 | it ('test mul tiple comm ands withi n single t imeout', f unction() { | |
| 147 | // The i mportant p oint of th is test is that *all * commands are run | |
| 148 | // withi n the time out. Indir ectly prov ing that a connectio n is | |
| 149 | // only made once and used f or all RPC calls. | |
| 150 | var test Error; | |
| 151 | var test Result; | |
| 152 | var call ed = false ; | |
| 153 | ||
| 154 | var expe ctedError = null; | |
| 155 | var expe ctedResult = { | |
| 156 | exec ute1: jasm ine.any(St ring), | |
| 157 | exec ute2: jasm ine.any(St ring), | |
| 158 | exec ute3: jasm ine.any(St ring), | |
| 159 | exec ute4: jasm ine.any(St ring), | |
| 160 | exec ute5: jasm ine.any(St ring), | |
| 161 | clos e: 'SIGNOF F SUCCESSF UL' | |
| 162 | }; | |
| 163 | ||
| 164 | function callback( error, res ult) { | |
| 165 | call ed = true; | |
| 166 | test Error = er ror; | |
| 167 | test Result = r esult; | |
| 168 | } | |
| 169 | ||
| 170 | var clie nt = new R pcClient(l ogger, con fig); | |
| 171 | ||
| 172 | var rpc = { | |
| 173 | exec ute1: clie nt.execute .bind(clie nt, 'ORWU USERINFO') , | |
| 174 | exec ute2: clie nt.execute .bind(clie nt, 'ORWU USERINFO') , | |
| 175 | exec ute3: clie nt.execute .bind(clie nt, 'ORWU USERINFO') , | |
| 176 | exec ute4: clie nt.execute .bind(clie nt, 'ORWU USERINFO') , | |
| 177 | exec ute5: clie nt.execute .bind(clie nt, 'ORWU USERINFO') , | |
| 178 | clos e: client. close.bind (client) | |
| 179 | }; | |
| 180 | ||
| 181 | async.se ries(rpc, callback); | |
| 182 | ||
| 183 | waitsFor (function( ) { | |
| 184 | retu rn called; | |
| 185 | }, 'shou ld be call ed', 5000) ; | |
| 186 | ||
| 187 | runs(fun ction() { | |
| 188 | expe ct(testErr or).toEqua l(expected Error); | |
| 189 | expe ct(testRes ult).toEqu al(expecte dResult); | |
| 190 | }); | |
| 191 | }) ; | |
| 192 | }); | |
| 193 | ||
| 194 | descri be('test m ultiple co mmands exe cuted sync hronously in order', function( ) { | |
| 195 | fu nction cre ateTest(te stFunction , expected Error, exp ectedResul t, timeout Millis) { | |
| 196 | return f unction te ster() { | |
| 197 | var testError; | |
| 198 | var testResult ; | |
| 199 | var called = f alse; | |
| 200 | ||
| 201 | test Function(f unction(er ror, resul t) { | |
| 202 | called = t rue; | |
| 203 | testError = error; | |
| 204 | testResult = result; | |
| 205 | }); | |
| 206 | ||
| 207 | wait sFor(funct ion() { | |
| 208 | return cal led; | |
| 209 | }, ' test', tim eoutMillis ); | |
| 210 | ||
| 211 | runs (function( ) { | |
| 212 | expect(tes tError).to Equal(expe ctedError) ; | |
| 213 | expect(tes tResult).t oEqual(exp ectedResul t); | |
| 214 | }); | |
| 215 | }; | |
| 216 | } | |
| 217 | ||
| 218 | // The impor tant point of this t est is tha t all of t he | |
| 219 | // commands are run se rially and in order. | |
| 220 | ||
| 221 | va r client = new RpcCl ient(logge r, config) ; | |
| 222 | ||
| 223 | va r expected Error = nu ll; | |
| 224 | ||
| 225 | va r execute = client.e xecute.bin d(client, 'ORWU USER INFO'); | |
| 226 | va r close = client.clo se.bind(cl ient); | |
| 227 | ||
| 228 | va r tests = { | |
| 229 | 'autocon nect and e xecute 1': createTes t(execute, expectedE rror, jasm ine.any(St ring), 500 0), | |
| 230 | 'close 1 ': createT est(close, expectedE rror, 'SIG NOFF SUCCE SSFUL', 10 0), | |
| 231 | 'autocon nect and e xecute 2': createTes t(execute, expectedE rror, jasm ine.any(St ring), 500 0), | |
| 232 | 'execute 1': creat eTest(exec ute, expec tedError, jasmine.an y(String), 100), | |
| 233 | 'close 2 ': createT est(close, expectedE rror, 'SIG NOFF SUCCE SSFUL', 10 0) | |
| 234 | }; | |
| 235 | ||
| 236 | _. each(tests , function (test, tes tName) { | |
| 237 | it('test ' + testN ame, funct ion() { | |
| 238 | test (); | |
| 239 | }); | |
| 240 | }) ; | |
| 241 | }); | |
| 242 | ||
| 243 | descri be('verify incorrect config in fo yields error resu lt', funct ion() { | |
| 244 | it ('test inc orrect con figuration ', functio n() { | |
| 245 | var test Error; | |
| 246 | var test Result; | |
| 247 | var call ed = false ; | |
| 248 | ||
| 249 | function callback( error, res ult) { | |
| 250 | call ed = true; | |
| 251 | test Error = er ror; | |
| 252 | test Result = r esult; | |
| 253 | } | |
| 254 | ||
| 255 | var conf = _.clone (config); | |
| 256 | conf.port = PORT ; | |
| 257 | ||
| 258 | var clie nt = new R pcClient(l ogger, con f); | |
| 259 | ||
| 260 | var rpc = { | |
| 261 | conn ect: clien t.connect. bind(clien t), | |
| 262 | exec ute: clien t.execute. bind(clien t, 'ORWU U SERINFO'), | |
| 263 | clos e: client. close.bind (client) | |
| 264 | }; | |
| 265 | ||
| 266 | async.se ries(rpc, callback); | |
| 267 | ||
| 268 | waitsFor (function( ) { | |
| 269 | retu rn called; | |
| 270 | }, 'shou ld be call ed', 5000) ; | |
| 271 | ||
| 272 | runs(fun ction() { | |
| 273 | expe ct(testErr or).toBeDe fined(); | |
| 274 | expe ct(testRes ult.connec t).toBeDef ined(); | |
| 275 | expe ct(testRes ult.execut e).toBeUnd efined(); | |
| 276 | expe ct(testRes ult.close) .toBeUndef ined(); | |
| 277 | }); | |
| 278 | }) ; | |
| 279 | }); | |
| 280 | ||
| 281 | }); |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.