infinispan 0.11.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/protostream/query.proto +1 -1
- package/package.json +9 -9
- package/.eslintrc +0 -25
- package/.flowconfig +0 -6
- package/Jenkinsfile +0 -50
- package/Jenkinsfile-release +0 -63
- package/documentation/asciidoc/stories/assembly_client_usage_examples.adoc +0 -10
- package/documentation/asciidoc/stories/assembly_installation_configuration.adoc +0 -20
- package/documentation/asciidoc/titles/js_client.asciidoc +0 -28
- package/documentation/asciidoc/titles/stories.adoc +0 -5
- package/documentation/asciidoc/topics/attributes/community-attributes.adoc +0 -9
- package/documentation/asciidoc/topics/attributes/downstream-attributes.adoc +0 -2
- package/documentation/asciidoc/topics/code_examples/authentication-digest.js +0 -12
- package/documentation/asciidoc/topics/code_examples/authentication-external.js +0 -15
- package/documentation/asciidoc/topics/code_examples/authentication-oauthbearer.js +0 -10
- package/documentation/asciidoc/topics/code_examples/authentication-plain.js +0 -11
- package/documentation/asciidoc/topics/code_examples/authentication-scram.js +0 -11
- package/documentation/asciidoc/topics/code_examples/await-multiple-entries.js +0 -36
- package/documentation/asciidoc/topics/code_examples/await-single-entries.js +0 -29
- package/documentation/asciidoc/topics/code_examples/conditional-operations.js +0 -57
- package/documentation/asciidoc/topics/code_examples/connection-multiple-servers.js +0 -23
- package/documentation/asciidoc/topics/code_examples/connection-xsite-cluster-switch.js +0 -39
- package/documentation/asciidoc/topics/code_examples/connection-xsite.js +0 -13
- package/documentation/asciidoc/topics/code_examples/data-types.js +0 -30
- package/documentation/asciidoc/topics/code_examples/encryption-crypto-store.js +0 -11
- package/documentation/asciidoc/topics/code_examples/encryption-private-key.js +0 -13
- package/documentation/asciidoc/topics/code_examples/encryption-sni-hostname.js +0 -9
- package/documentation/asciidoc/topics/code_examples/encryption-trust-certs.js +0 -8
- package/documentation/asciidoc/topics/code_examples/ephemeral-data.js +0 -52
- package/documentation/asciidoc/topics/code_examples/hello-world.js +0 -42
- package/documentation/asciidoc/topics/code_examples/key-value-converter.js +0 -67
- package/documentation/asciidoc/topics/code_examples/logging-configuration.js +0 -2
- package/documentation/asciidoc/topics/code_examples/multiple-entries.js +0 -64
- package/documentation/asciidoc/topics/code_examples/queries.js +0 -92
- package/documentation/asciidoc/topics/code_examples/register-event-listener.js +0 -64
- package/documentation/asciidoc/topics/code_examples/sample-script-execute.js +0 -33
- package/documentation/asciidoc/topics/code_examples/sample-script.js +0 -3
- package/documentation/asciidoc/topics/code_examples/single-entries.js +0 -49
- package/documentation/asciidoc/topics/config_examples/logging.json +0 -14
- package/documentation/asciidoc/topics/proc_configuring_authentication.adoc +0 -16
- package/documentation/asciidoc/topics/proc_configuring_connections.adoc +0 -25
- package/documentation/asciidoc/topics/proc_configuring_connections_xsite.adoc +0 -18
- package/documentation/asciidoc/topics/proc_configuring_data_formats.adoc +0 -30
- package/documentation/asciidoc/topics/proc_configuring_encryption.adoc +0 -15
- package/documentation/asciidoc/topics/proc_configuring_logging.adoc +0 -28
- package/documentation/asciidoc/topics/proc_installing_clients.adoc +0 -58
- package/documentation/asciidoc/topics/proc_switching_clusters.adoc +0 -17
- package/documentation/asciidoc/topics/ref_authentication_mechanisms.adoc +0 -68
- package/documentation/asciidoc/topics/ref_client_usage.adoc +0 -128
- package/documentation/asciidoc/topics/ref_encryption.adoc +0 -71
- package/gen-jsdoc.sh +0 -6
- package/make-ssl.sh +0 -335
- package/memory-profiling/helper.js +0 -9
- package/memory-profiling/infinispan_memory_many_get.js +0 -50
- package/memory-profiling/infinispan_memory_one_get.js +0 -56
- package/release.sh +0 -19
- package/run-servers.sh +0 -156
- package/run-testsuite.sh +0 -6
- package/server/.keep +0 -0
- package/set-npm-auth-token.sh +0 -4
- package/smoke-tests.sh +0 -21
- package/spec/codec_spec.js +0 -224
- package/spec/configs/clean/infinispan.xml +0 -55
- package/spec/configs/infinispan-clustered.xml +0 -63
- package/spec/configs/infinispan-ssl.xml +0 -115
- package/spec/configs/infinispan-xsite-EARTH.xml +0 -191
- package/spec/configs/infinispan-xsite-MOON.xml +0 -193
- package/spec/configs/infinispan.xml +0 -77
- package/spec/functional_spec.js +0 -73
- package/spec/infinispan_auth_spec.js +0 -19
- package/spec/infinispan_cluster_spec.js +0 -176
- package/spec/infinispan_expiry_spec.js +0 -218
- package/spec/infinispan_failover_listener_spec.js +0 -52
- package/spec/infinispan_failover_spec.js +0 -63
- package/spec/infinispan_json_spec.js +0 -182
- package/spec/infinispan_local_spec.js +0 -354
- package/spec/infinispan_ssl_spec.js +0 -441
- package/spec/infinispan_stress_spec.js +0 -32
- package/spec/infinispan_xsite_spec.js +0 -99
- package/spec/protocols_spec.js +0 -82
- package/spec/protostream_spec.js +0 -237
- package/spec/tests.js +0 -28
- package/spec/utils/test-log4js.json +0 -14
- package/spec/utils/testing.js +0 -790
- package/spec/utils/typed-cachemanager-put-get.js +0 -3
- package/spec/utils/typed-null-return-dist.js +0 -2
- package/spec/utils/typed-null-return.js +0 -2
- package/spec/utils/typed-put-get-dist.js +0 -3
- package/spec/utils/typed-put-get-unicode.js +0 -3
- package/spec/utils/typed-put-get.js +0 -3
- package/spec/utils/typed-size.js +0 -2
- package/spec/utils_spec.js +0 -154
- package/spec-manual/infinispan_manual_stress_get_spec.js +0 -50
- package/spec-manual/infinispan_manual_stress_iterate_spec.js +0 -86
|
@@ -1,441 +0,0 @@
|
|
|
1
|
-
var _ = require('underscore');
|
|
2
|
-
|
|
3
|
-
var util = require('util');
|
|
4
|
-
|
|
5
|
-
var t = require('./utils/testing'); // Testing dependency
|
|
6
|
-
|
|
7
|
-
describe('Infinispan TLS/SSL client', function() {
|
|
8
|
-
|
|
9
|
-
it('can operate on data via trusted encrypted transport',
|
|
10
|
-
testSsl('trust', t.ssl, sslTrust())
|
|
11
|
-
);
|
|
12
|
-
|
|
13
|
-
it('can operate on data via crypto store trusted encrypted transport',
|
|
14
|
-
testSsl('trust-cryptostore', t.ssl, sslTrustCryptoStore())
|
|
15
|
-
);
|
|
16
|
-
|
|
17
|
-
it('can operate on data via authenticated encrypted transport',
|
|
18
|
-
testSsl('auth', t.ssl, sslAuth())
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
it('can operate on data via SNI trusted encrypted transport',
|
|
22
|
-
testSsl('sni-trusted', t.ssl, sslSniTrusted())
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
it('can operate on data via SNI trusted encrypted transport while having multiple identities',
|
|
26
|
-
testSsl('sni-trusted', t.ssl, sslSniTrustedInCaseOfMultipleTrustedSni())
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
it('fails to operate if default server name (SNI) does not match default server realm',
|
|
30
|
-
testError(expectContainsError("self signed certificate in certificate chain"),
|
|
31
|
-
sslSniDefault())
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
it('fails to operate if server name (SNI) and trusted certificate are incorrect',
|
|
35
|
-
testError(
|
|
36
|
-
expectAnyExactErrors(
|
|
37
|
-
['CERT_SIGNATURE_FAILURE'
|
|
38
|
-
, 'certificate signature failure'
|
|
39
|
-
, 'self signed certificate in certificate chain'
|
|
40
|
-
])
|
|
41
|
-
, sslSniUntrusted()
|
|
42
|
-
)
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
it('fails to operate if no passphrase provided for crypto store',
|
|
46
|
-
testError(expectAnyExactErrors(['No passphrase defined for crypto store']),
|
|
47
|
-
sslStoreNoPassphrase())
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
it('fails to operate if no path provided for crypto store',
|
|
51
|
-
testError(expectAnyExactErrors(['No path defined for crypto store']),
|
|
52
|
-
sslStoreNoPath())
|
|
53
|
-
);
|
|
54
|
-
|
|
55
|
-
it('fails to operate if no encrypted transport is provided',
|
|
56
|
-
testError(expectAnyExactErrors(['self signed certificate in certificate chain']),
|
|
57
|
-
sslStoreNoCryptoStore())
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
// it('fails to operate if key for authenticated encrypted transport is missing',
|
|
61
|
-
// testError(expectAnyExactErrors(['CERT_SIGNATURE_FAILURE', 'self signed certificate']),
|
|
62
|
-
// sslAuthWithMissingKey())
|
|
63
|
-
// );
|
|
64
|
-
//
|
|
65
|
-
// it('fails to operate if passphrase for authenticated encrypted transport is missing',
|
|
66
|
-
// testError(expectAnyExactErrors(['CERT_SIGNATURE_FAILURE', 'self signed certificate']),
|
|
67
|
-
// sslAuthWithMissingPassphrase())
|
|
68
|
-
// );
|
|
69
|
-
|
|
70
|
-
// it('fails to operate if cert path for authenticated encrypted transport is missing',
|
|
71
|
-
// testError(expectAnyExactErrors(['CERT_SIGNATURE_FAILURE', 'self signed certificate']),
|
|
72
|
-
// sslAuthWithMissingCert())
|
|
73
|
-
// );
|
|
74
|
-
|
|
75
|
-
// it('fails to operate if authenticated encrypted transport is missing',
|
|
76
|
-
// testError(expectAnyExactErrors(['CERT_SIGNATURE_FAILURE', 'self signed certificate']),
|
|
77
|
-
// sslAuthWithMissingInfo())
|
|
78
|
-
// );
|
|
79
|
-
|
|
80
|
-
it('fails to operate if trusted certificate is missing for authenticated encrypted transport',
|
|
81
|
-
testError(expectAnyExactErrors(['self signed certificate in certificate chain']),
|
|
82
|
-
sslAuthWithMissingTrustCertificate())
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
function testSsl(infix, addr, sslOpts) {
|
|
86
|
-
var k = util.format('ssl-%s-key', infix);
|
|
87
|
-
var v = util.format('ssl-%s-value', infix);
|
|
88
|
-
return function(done) {
|
|
89
|
-
t.client(addr, sslOpts)
|
|
90
|
-
.then(t.assert(t.put(k, v)))
|
|
91
|
-
.then(t.assert(t.get(k), t.toBe(v)))
|
|
92
|
-
.then(t.disconnect())
|
|
93
|
-
.catch(t.failed(done))
|
|
94
|
-
.finally(done);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
function sslTrust() {
|
|
99
|
-
return {
|
|
100
|
-
ssl: {
|
|
101
|
-
enabled: true,
|
|
102
|
-
secureProtocol: 'TLS_client_method',
|
|
103
|
-
trustCerts: ['out/ssl/ca/ca.pem']
|
|
104
|
-
},
|
|
105
|
-
authentication: {
|
|
106
|
-
enabled: true,
|
|
107
|
-
saslMechanism: 'PLAIN',
|
|
108
|
-
userName: 'admin',
|
|
109
|
-
password: 'pass'
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
function sslTrustCryptoStore() {
|
|
115
|
-
return {
|
|
116
|
-
ssl: {
|
|
117
|
-
enabled: true,
|
|
118
|
-
secureProtocol: 'TLS_client_method',
|
|
119
|
-
cryptoStore: {
|
|
120
|
-
path: 'out/ssl/client/client.p12',
|
|
121
|
-
passphrase: 'secret'
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
authentication: {
|
|
125
|
-
enabled: true,
|
|
126
|
-
saslMechanism: 'PLAIN',
|
|
127
|
-
userName: 'admin',
|
|
128
|
-
password: 'pass'
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
function sslAuth() {
|
|
134
|
-
return {
|
|
135
|
-
ssl: {
|
|
136
|
-
enabled: true,
|
|
137
|
-
trustCerts: ['out/ssl/ca/ca.pem'],
|
|
138
|
-
clientAuth: {
|
|
139
|
-
key: 'out/ssl/client/client.pk',
|
|
140
|
-
passphrase: 'secret',
|
|
141
|
-
cert: 'out/ssl/client/client.pem'
|
|
142
|
-
}
|
|
143
|
-
},
|
|
144
|
-
authentication: {
|
|
145
|
-
enabled: true,
|
|
146
|
-
saslMechanism: 'PLAIN',
|
|
147
|
-
userName: 'admin',
|
|
148
|
-
password: 'pass'
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
function sslSniTrusted() {
|
|
154
|
-
return {
|
|
155
|
-
ssl: {
|
|
156
|
-
enabled: true,
|
|
157
|
-
trustCerts: ['out/ssl/ca/ca.pem'],
|
|
158
|
-
sniHostName: 'localhost'
|
|
159
|
-
},
|
|
160
|
-
authentication: {
|
|
161
|
-
enabled: true,
|
|
162
|
-
saslMechanism: 'PLAIN',
|
|
163
|
-
userName: 'admin',
|
|
164
|
-
password: 'pass'
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
function sslSniTrustedInCaseOfMultipleTrustedSni() {
|
|
170
|
-
return {
|
|
171
|
-
ssl: {
|
|
172
|
-
enabled: true,
|
|
173
|
-
trustCerts: ['out/ssl/ca/ca.pem'],
|
|
174
|
-
sniHostName: 'localhost'
|
|
175
|
-
},
|
|
176
|
-
authentication: {
|
|
177
|
-
enabled: true,
|
|
178
|
-
saslMechanism: 'PLAIN',
|
|
179
|
-
userName: 'admin',
|
|
180
|
-
password: 'pass'
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
function sslSniDefault() {
|
|
186
|
-
return {
|
|
187
|
-
ssl: {
|
|
188
|
-
enabled: true,
|
|
189
|
-
trustCerts: ['out/ssl/untrust-ca/untrust-ca.pem'],
|
|
190
|
-
sniHostName: 'trustfail'
|
|
191
|
-
},
|
|
192
|
-
authentication: {
|
|
193
|
-
enabled: true,
|
|
194
|
-
saslMechanism: 'PLAIN',
|
|
195
|
-
userName: 'admin',
|
|
196
|
-
password: 'pass'
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
function sslSniDefaultWithTrustedCertificate() {
|
|
202
|
-
return {
|
|
203
|
-
ssl: {
|
|
204
|
-
enabled: true,
|
|
205
|
-
trustCerts: ['out/ssl/ca/ca.pem'],
|
|
206
|
-
},
|
|
207
|
-
authentication: {
|
|
208
|
-
enabled: true,
|
|
209
|
-
saslMechanism: 'PLAIN',
|
|
210
|
-
userName: 'admin',
|
|
211
|
-
password: 'pass'
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
function sslSniUntrusted() {
|
|
217
|
-
return {
|
|
218
|
-
ssl: {
|
|
219
|
-
enabled: true,
|
|
220
|
-
trustCerts: ['out/ssl/untrust-ca/untrust-ca.pem'],
|
|
221
|
-
sniHostName: "untrust"
|
|
222
|
-
},
|
|
223
|
-
authentication: {
|
|
224
|
-
enabled: true,
|
|
225
|
-
saslMechanism: 'PLAIN',
|
|
226
|
-
userName: 'admin',
|
|
227
|
-
password: 'pass'
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
function testError(errF, sslOpts) {
|
|
233
|
-
return function(done) {
|
|
234
|
-
t.client(t.ssl, sslOpts)
|
|
235
|
-
.then(shouldFail())
|
|
236
|
-
.catch(errF(done))
|
|
237
|
-
.finally(done);
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
function shouldFail() {
|
|
242
|
-
return function(client) {
|
|
243
|
-
var disconnect = client.disconnect();
|
|
244
|
-
return disconnect.finally(function() {
|
|
245
|
-
throw Error('Expected operation to fail');
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
function expectError(msg) {
|
|
251
|
-
return function(err) {
|
|
252
|
-
expect(err.message).toBe(msg);
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
function expectContainsError(msg) {
|
|
257
|
-
return function(done) {
|
|
258
|
-
return function(err) {
|
|
259
|
-
toContainAnyOf([msg], err, done);
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
function expectAnyExactErrors(msgs) {
|
|
265
|
-
return function(done) {
|
|
266
|
-
return function(err) {
|
|
267
|
-
toBeAnyOf(msgs, err, done);
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
function sslStoreNoPassphrase() {
|
|
273
|
-
return {
|
|
274
|
-
ssl: {
|
|
275
|
-
enabled: true,
|
|
276
|
-
cryptoStore: {
|
|
277
|
-
path: 'out/ssl/client/client.p12'
|
|
278
|
-
}
|
|
279
|
-
},
|
|
280
|
-
authentication: {
|
|
281
|
-
enabled: true,
|
|
282
|
-
saslMechanism: 'PLAIN',
|
|
283
|
-
userName: 'admin',
|
|
284
|
-
password: 'pass'
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
function sslStoreNoPath() {
|
|
290
|
-
return {
|
|
291
|
-
ssl: {
|
|
292
|
-
enabled: true,
|
|
293
|
-
cryptoStore: {}
|
|
294
|
-
},
|
|
295
|
-
authentication: {
|
|
296
|
-
enabled: true,
|
|
297
|
-
saslMechanism: 'PLAIN',
|
|
298
|
-
userName: 'admin',
|
|
299
|
-
password: 'pass'
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
function sslStoreNoCryptoStore() {
|
|
305
|
-
return {
|
|
306
|
-
ssl: {
|
|
307
|
-
enabled: true
|
|
308
|
-
},
|
|
309
|
-
authentication: {
|
|
310
|
-
enabled: true,
|
|
311
|
-
saslMechanism: 'PLAIN',
|
|
312
|
-
userName: 'admin',
|
|
313
|
-
password: 'pass'
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
function sslSniWithNoCert() {
|
|
319
|
-
return {
|
|
320
|
-
ssl: {
|
|
321
|
-
enabled: true,
|
|
322
|
-
sniHostName: "untrust"
|
|
323
|
-
},
|
|
324
|
-
authentication: {
|
|
325
|
-
enabled: true,
|
|
326
|
-
saslMechanism: 'PLAIN',
|
|
327
|
-
userName: 'admin',
|
|
328
|
-
password: 'pass'
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
function sslAuthWithMissingKey() {
|
|
334
|
-
return {
|
|
335
|
-
ssl: {
|
|
336
|
-
enabled: true,
|
|
337
|
-
trustCerts: ['out/ssl/ca/ca.pem'],
|
|
338
|
-
clientAuth: {
|
|
339
|
-
passphrase: 'secret',
|
|
340
|
-
cert: 'out/ssl/client/client.pem'
|
|
341
|
-
},
|
|
342
|
-
authentication: {
|
|
343
|
-
enabled: true,
|
|
344
|
-
saslMechanism: 'PLAIN',
|
|
345
|
-
userName: 'admin',
|
|
346
|
-
password: 'pass'
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
function sslAuthWithMissingPassphrase() {
|
|
353
|
-
return {
|
|
354
|
-
ssl: {
|
|
355
|
-
enabled: true,
|
|
356
|
-
trustCerts: ['out/ssl/ca/ca.pem'],
|
|
357
|
-
clientAuth: {
|
|
358
|
-
key: 'out/ssl/client/client.pk',
|
|
359
|
-
cert: 'out/ssl/client/client.pem'
|
|
360
|
-
},
|
|
361
|
-
authentication: {
|
|
362
|
-
enabled: true,
|
|
363
|
-
saslMechanism: 'PLAIN',
|
|
364
|
-
userName: 'admin',
|
|
365
|
-
password: 'pass'
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
function sslAuthWithMissingCert() {
|
|
372
|
-
return {
|
|
373
|
-
ssl: {
|
|
374
|
-
enabled: true,
|
|
375
|
-
trustCerts: ['out/ssl/ca/ca.pem'],
|
|
376
|
-
clientAuth: {
|
|
377
|
-
key: 'out/ssl/client/client.pk',
|
|
378
|
-
passphrase: 'secret'
|
|
379
|
-
}
|
|
380
|
-
},
|
|
381
|
-
authentication: {
|
|
382
|
-
enabled: true,
|
|
383
|
-
saslMechanism: 'PLAIN',
|
|
384
|
-
userName: 'admin',
|
|
385
|
-
password: 'pass'
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
function sslAuthWithMissingInfo() {
|
|
391
|
-
return {
|
|
392
|
-
ssl: {
|
|
393
|
-
enabled: true,
|
|
394
|
-
trustCerts: ['out/ssl/ca/ca.pem'],
|
|
395
|
-
clientAuth: {}
|
|
396
|
-
},
|
|
397
|
-
authentication: {
|
|
398
|
-
enabled: true,
|
|
399
|
-
saslMechanism: 'PLAIN',
|
|
400
|
-
userName: 'admin',
|
|
401
|
-
password: 'pass'
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
function sslAuthWithMissingTrustCertificate() {
|
|
407
|
-
return {
|
|
408
|
-
ssl: {
|
|
409
|
-
enabled: true,
|
|
410
|
-
clientAuth: {
|
|
411
|
-
key: 'out/ssl/client/client.pk',
|
|
412
|
-
passphrase: 'secret',
|
|
413
|
-
cert: 'out/ssl/client/client.pem'
|
|
414
|
-
}
|
|
415
|
-
},
|
|
416
|
-
authentication: {
|
|
417
|
-
enabled: true,
|
|
418
|
-
saslMechanism: 'PLAIN',
|
|
419
|
-
userName: 'admin',
|
|
420
|
-
password: 'pass'
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
function toBeAnyOf(expecteds, actual, done) {
|
|
426
|
-
for (var i = 0, l = expecteds.length; i < l; i++) {
|
|
427
|
-
if (_.isEqual(actual.message, expecteds[i]))
|
|
428
|
-
return;
|
|
429
|
-
}
|
|
430
|
-
done(new Error('[' + actual.message + '] is not any of: [' + expecteds + ']'));
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
function toContainAnyOf(expecteds, actual, done) {
|
|
434
|
-
for (var i = 0, l = expecteds.length; i < l; i++) {
|
|
435
|
-
if (actual.message.includes(expecteds[i]))
|
|
436
|
-
return;
|
|
437
|
-
}
|
|
438
|
-
done(new Error('[' + actual.message + '] does not contain any of: [' + expecteds + ']'));
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
});
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
var _ = require('underscore');
|
|
2
|
-
|
|
3
|
-
var t = require('./utils/testing'); // Testing dependency
|
|
4
|
-
|
|
5
|
-
describe('Infinispan local client under stress load', function() {
|
|
6
|
-
var client = t.client(t.local, t.authOpts);
|
|
7
|
-
|
|
8
|
-
beforeEach(function(done) { client
|
|
9
|
-
.then(t.assert(t.clear()))
|
|
10
|
-
.catch(t.failed(done)).finally(done);
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it('can do multiple puts continuously and only wait at the end', function(done) {
|
|
14
|
-
client.then(function(cl) {
|
|
15
|
-
var puts = _.map(_.range(1000), function(i) {
|
|
16
|
-
return cl.put(i + '', i + '');
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
return Promise.all(puts)
|
|
20
|
-
.catch(t.failed(done))
|
|
21
|
-
.finally(done);
|
|
22
|
-
})
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
// Since Jasmine 1.3 does not have afterAll callback, this disconnect test must be last
|
|
26
|
-
it('disconnects client', function(done) { client
|
|
27
|
-
.then(t.disconnect())
|
|
28
|
-
.catch(t.failed(done))
|
|
29
|
-
.finally(done);
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
});
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
var _ = require('underscore');
|
|
2
|
-
|
|
3
|
-
var t = require('./utils/testing'); // Testing dependency
|
|
4
|
-
var u = require('../lib/utils');
|
|
5
|
-
|
|
6
|
-
var logger = u.logger('xsite-test');
|
|
7
|
-
|
|
8
|
-
describe('Infinispan xsite cluster client', function() {
|
|
9
|
-
|
|
10
|
-
// Since Jasmine 1.3 does not have beforeAll callback, execute
|
|
11
|
-
// any cleanup as first test so that it only gets executed once.
|
|
12
|
-
it('start sites', function(done) {
|
|
13
|
-
logger.debugf("Starting servers for xsite replication tests.");
|
|
14
|
-
t.launchClusterNodeAndWaitView('server-earth', t.earth1Config, t.earth1['port'], t.earth1MCastAddr, 1, t.client)
|
|
15
|
-
.then(function(client) {return t.launchClusterNodeAndWaitView('server-moon', t.moon1Config, t.moon1['port'], t.moon1MCastAddr, 1, client);})
|
|
16
|
-
.then(function () {
|
|
17
|
-
logger.debugf("Both moon and earth servers started");
|
|
18
|
-
}).catch(t.failed(done)).finally(done);
|
|
19
|
-
}, 15000);
|
|
20
|
-
|
|
21
|
-
it('can manually switch and fail over sites', function(done) {
|
|
22
|
-
siteClients().then(function(cs) {
|
|
23
|
-
expect(cs[0].getTopologyInfo().getMembers()).toEqual([t.earth1]);
|
|
24
|
-
expect(cs[1].getTopologyInfo().getMembers()).toEqual([t.moon1]);
|
|
25
|
-
return cs[0].getTopologyInfo().switchToCluster('server-moon')
|
|
26
|
-
.then(function() {
|
|
27
|
-
expect(cs[0].getTopologyInfo().getMembers()).toEqual([t.moon1]);
|
|
28
|
-
return cs[0].getTopologyInfo().switchToDefaultCluster();
|
|
29
|
-
})
|
|
30
|
-
.then(function() {
|
|
31
|
-
expect(cs[0].getTopologyInfo().getMembers()).toEqual([t.earth1]);
|
|
32
|
-
return cs[0].put('xsite-key', 'xsite-value');
|
|
33
|
-
})
|
|
34
|
-
.then(assertGet('xsite-key', 'xsite-value', cs[0]))
|
|
35
|
-
.then(assertGet('xsite-key', 'xsite-value', cs[1]))
|
|
36
|
-
.then(t.stopClusterNode(t.earth1['port'], true))
|
|
37
|
-
// Client connected to surviving site should find data
|
|
38
|
-
.then(assertGet('xsite-key', 'xsite-value', cs[1]))
|
|
39
|
-
// Client connected to crashed site should failover
|
|
40
|
-
.then(assertGet('xsite-key', 'xsite-value', cs[0]))
|
|
41
|
-
.then(function() {
|
|
42
|
-
expect(cs[0].getTopologyInfo().getMembers()).toEqual([t.moon1]);
|
|
43
|
-
expect(cs[1].getTopologyInfo().getMembers()).toEqual([t.moon1]);
|
|
44
|
-
})
|
|
45
|
-
// Re-launch site stopped site and stop alive site
|
|
46
|
-
.then(assertGet('xsite-key', 'xsite-value', cs[0]))
|
|
47
|
-
.then(function(client) { return t.launchClusterNodeAndWaitView('server-earth', t.earth1Config, t.earth1['port'], t.earth1MCastAddr, 1, client); })
|
|
48
|
-
.then(t.stopClusterNode(t.moon1['port'], true))
|
|
49
|
-
// Client connected to failed over site should come back to original site
|
|
50
|
-
.then(assertGet('xsite-key', undefined, cs[0]))
|
|
51
|
-
.then(function() {
|
|
52
|
-
expect(cs[0].getTopologyInfo().getMembers()).toEqual([t.earth1]);
|
|
53
|
-
})
|
|
54
|
-
.then(function() {
|
|
55
|
-
return cs[0].put('xsite-key-2', 'xsite-value-2');
|
|
56
|
-
})
|
|
57
|
-
.then(assertGet('xsite-key-2', 'xsite-value-2', cs[0]))
|
|
58
|
-
//Stopping the rest of the servers to finish the test
|
|
59
|
-
.then(t.stopClusterNode(t.earth1['port'], true))
|
|
60
|
-
.finally(function() {
|
|
61
|
-
return Promise.all(_.map(cs, function(c) { return c.disconnect(); }));
|
|
62
|
-
});
|
|
63
|
-
})
|
|
64
|
-
.catch(t.failed(done)).finally(done);
|
|
65
|
-
}, 15000);
|
|
66
|
-
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
function assertGet(k, expected, client) {
|
|
70
|
-
return function() {
|
|
71
|
-
return client.get(k)
|
|
72
|
-
.then(function(v) {
|
|
73
|
-
expect(v).toBe(expected);
|
|
74
|
-
})
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function clusterSiteMoon() {
|
|
79
|
-
return {
|
|
80
|
-
cacheName: t.xsiteCacheName,
|
|
81
|
-
authentication: t.authOpts.authentication,
|
|
82
|
-
clusters: [
|
|
83
|
-
{
|
|
84
|
-
name: 'server-moon',
|
|
85
|
-
servers: [t.moon1]
|
|
86
|
-
}
|
|
87
|
-
]
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function siteClients() {
|
|
92
|
-
return Promise.all([
|
|
93
|
-
t.client(t.earth1, clusterSiteMoon()),
|
|
94
|
-
t.client(t.moon1, {cacheName:
|
|
95
|
-
t.xsiteCacheName,
|
|
96
|
-
authentication: t.authOpts.authentication
|
|
97
|
-
})
|
|
98
|
-
]);
|
|
99
|
-
}
|
package/spec/protocols_spec.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var _ = require('underscore');
|
|
4
|
-
var f = require('../lib/functional');
|
|
5
|
-
var codec = require('../lib/codec');
|
|
6
|
-
|
|
7
|
-
var t = require('./utils/testing'); // Testing dependency
|
|
8
|
-
|
|
9
|
-
var singleExpiryDecode = f.actions([codec.decodeUByte(), codec.decodeVLong()], codec.allDecoded(2));
|
|
10
|
-
var constantExpiryDecode = f.actions([codec.decodeUByte()], codec.allDecoded(1));
|
|
11
|
-
|
|
12
|
-
function lifespan(unit) { return unit << 4 | 0x07; }
|
|
13
|
-
function maxIdle(unit) { return 0x70 | unit; }
|
|
14
|
-
|
|
15
|
-
function object(name) {
|
|
16
|
-
return function(value) {
|
|
17
|
-
return _.object([name], [value]);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
describe('Protocols', function() {
|
|
22
|
-
var p = t.protocol25();
|
|
23
|
-
|
|
24
|
-
it('can encode/decode lifespan', function() {
|
|
25
|
-
encodeDecodeUnits('lifespan', lifespan);
|
|
26
|
-
});
|
|
27
|
-
it('can encode/decode max idle', function() {
|
|
28
|
-
encodeDecodeUnits('maxIdle', maxIdle);
|
|
29
|
-
});
|
|
30
|
-
it('connects with undefined HotRod Protocol', function (done) {
|
|
31
|
-
t.expectToThrow(function () {
|
|
32
|
-
t.client(t.local_notsecured, {version: '1.1'});
|
|
33
|
-
}, 'Unknown protocol version: 1.1', done);
|
|
34
|
-
});
|
|
35
|
-
it('can handle different protocols at the same time', function() {
|
|
36
|
-
var p1 = t.protocol29({
|
|
37
|
-
dataFormat : {
|
|
38
|
-
keyType: 'text/plain',
|
|
39
|
-
valueType: 'text/plain'
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
var p2 = t.protocol29({
|
|
43
|
-
dataFormat : {
|
|
44
|
-
keyType: 'application/json',
|
|
45
|
-
valueType: 'application/json'
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
expect(p1.clientOpts.dataFormat.keyType).toEqual('text/plain');
|
|
50
|
-
expect(p1.getKeyMediaType()).toEqual('text/plain');
|
|
51
|
-
expect(p1.getValueMediaType()).toEqual('text/plain');
|
|
52
|
-
|
|
53
|
-
expect(p2.clientOpts.dataFormat.keyType).toEqual('application/json');
|
|
54
|
-
expect(p2.getKeyMediaType()).toEqual('application/json');
|
|
55
|
-
expect(p2.getValueMediaType()).toEqual('application/json');
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
function encodeDecodeUnits(name, converter) {
|
|
59
|
-
var exp = object(name);
|
|
60
|
-
encodeDecodeSingleNumericExpiry(exp('777777777d'), 777777777, converter(0x06));
|
|
61
|
-
encodeDecodeSingleNumericExpiry(exp('66666666h'), 66666666, converter(0x05));
|
|
62
|
-
encodeDecodeSingleNumericExpiry(exp('5555555m'), 5555555, converter(0x04));
|
|
63
|
-
encodeDecodeSingleNumericExpiry(exp('444444s'), 444444, converter(0x00));
|
|
64
|
-
encodeDecodeSingleNumericExpiry(exp('33333ms'), 33333, converter(0x01));
|
|
65
|
-
encodeDecodeSingleNumericExpiry(exp('2222μs'), 2222, converter(0x03));
|
|
66
|
-
encodeDecodeSingleNumericExpiry(exp('111ns'), 111, converter(0x02));
|
|
67
|
-
encodeDecodeSingleConstantExpiry(exp(0), converter(0x07));
|
|
68
|
-
encodeDecodeSingleConstantExpiry(exp(-1), converter(0x08));
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function encodeDecodeSingleNumericExpiry(expiry, duration, unit) {
|
|
72
|
-
var encoder = f.actions(p.encodeExpiry(expiry), codec.bytesEncoded);
|
|
73
|
-
var bytebuf = t.assertEncode(t.newByteBuf(), encoder, t.vNumSize(duration) + 1);
|
|
74
|
-
expect(singleExpiryDecode({buf: bytebuf.buf, offset: 0})).toEqual([unit, duration]);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function encodeDecodeSingleConstantExpiry(expiry, unit) {
|
|
78
|
-
var encoder = f.actions(p.encodeExpiry(expiry), codec.bytesEncoded);
|
|
79
|
-
var bytebuf = t.assertEncode(t.newByteBuf(), encoder, 1);
|
|
80
|
-
expect(constantExpiryDecode({buf: bytebuf.buf, offset: 0})).toEqual([unit]);
|
|
81
|
-
}
|
|
82
|
-
});
|