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,182 +0,0 @@
|
|
|
1
|
-
var t = require('./utils/testing'); // Testing dependency
|
|
2
|
-
|
|
3
|
-
describe('Infinispan JSON client', function() {
|
|
4
|
-
var client = t.client(t.local, t.json);
|
|
5
|
-
|
|
6
|
-
beforeEach(function (done) {
|
|
7
|
-
client
|
|
8
|
-
.then(t.assert(t.clear()))
|
|
9
|
-
.catch(t.failed(done)).finally(done);
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
it('can put -> get -> remove a key/value pair', function (done) {
|
|
13
|
-
client
|
|
14
|
-
.then(t.assert(t.put({k: 'jkey'}, {v: 'jvalue'})))
|
|
15
|
-
.then(t.assert(t.get({k: 'jkey'}), t.toEqual({v: 'jvalue'})))
|
|
16
|
-
.then(t.assert(t.containsKey({k: 'jkey'}), t.toBeTruthy))
|
|
17
|
-
.then(t.assert(t.remove({k: 'jkey'}), t.toBeTruthy))
|
|
18
|
-
.catch(t.failed(done))
|
|
19
|
-
.finally(done);
|
|
20
|
-
});
|
|
21
|
-
it('can use conditional operations on a key/value pair', function (done) {
|
|
22
|
-
client
|
|
23
|
-
.then(t.assert(t.putIfAbsent({k: 'jcond'}, {v: 'jv0'}), t.toBeTruthy))
|
|
24
|
-
.then(t.assert(t.replace({k: 'jcond'}, {v: 'jv1'}), t.toBeTruthy))
|
|
25
|
-
.then(t.assert(t.conditional(
|
|
26
|
-
t.replaceV, t.getM, {k: 'jcond'}, {v: 'jv1'}, {v: 'jv2'}), t.toBeTruthy)
|
|
27
|
-
)
|
|
28
|
-
.then(t.assert(t.conditional(
|
|
29
|
-
t.removeWithVersion, t.getM, {k: 'jcond'}, {v: 'jv2'}), t.toBeTruthy)
|
|
30
|
-
)
|
|
31
|
-
.catch(t.failed(done))
|
|
32
|
-
.finally(done);
|
|
33
|
-
});
|
|
34
|
-
it('can return previous values', function (done) {
|
|
35
|
-
client
|
|
36
|
-
.then(t.assert(t.putIfAbsent({k: 'jprev'}, {v: 'jv0'}, t.prev()), t.toBeUndefined))
|
|
37
|
-
.then(t.assert(t.putIfAbsent({k: 'jprev'}, {v: 'jv1'}, t.prev()), t.toEqual({v: 'jv0'})))
|
|
38
|
-
.then(t.assert(t.remove({k: 'jprev'}, t.prev()), t.toEqual({v: 'jv0'})))
|
|
39
|
-
.then(t.assert(t.put({k: 'jprev'}, {v: 'jv1'}, t.prev()), t.toBeUndefined))
|
|
40
|
-
.then(t.assert(t.put({k: 'jprev'}, {v: 'jv2'}, t.prev()), t.toEqual({v: 'jv1'})))
|
|
41
|
-
.then(t.assert(t.replace({k: 'jprev'}, {v: 'jv3'}, t.prev()), t.toEqual({v: 'jv2'})))
|
|
42
|
-
.then(t.assert(
|
|
43
|
-
t.conditional(t.replaceV, t.getM, {k: 'jprev'}, {v: 'jv3'}, {v: 'jv4'}, t.prev())
|
|
44
|
-
, t.toEqual({v: 'jv3'})))
|
|
45
|
-
.then(t.assert(
|
|
46
|
-
t.conditional(t.removeWithVersion, t.getM, {k: 'jprev'}, {v: 'jv4'}, t.prev())
|
|
47
|
-
, t.toEqual({v: 'jv4'})))
|
|
48
|
-
.catch(t.failed(done))
|
|
49
|
-
.finally(done);
|
|
50
|
-
});
|
|
51
|
-
it('can use multi-key operations', function (done) {
|
|
52
|
-
var pairs = [
|
|
53
|
-
{key: {mk: 'jmulti1'}, value: {mv: 'jv1'}}
|
|
54
|
-
, {key: {mk: 'jmulti2'}, value: {mv: 'jv2'}}
|
|
55
|
-
, {key: {mk: 'jmulti3'}, value: {mv: 'jv3'}}
|
|
56
|
-
];
|
|
57
|
-
var keys = [{mk: 'jmulti1'}, {mk: 'jmulti2'}];
|
|
58
|
-
client
|
|
59
|
-
.then(t.assert(t.putAll(pairs), t.toBeUndefined))
|
|
60
|
-
.then(t.assert(t.getAll(keys)
|
|
61
|
-
, t.toEqualPairs(
|
|
62
|
-
function (obj) {
|
|
63
|
-
return obj.key.mk;
|
|
64
|
-
}
|
|
65
|
-
, [{
|
|
66
|
-
key: {mk: 'jmulti1'},
|
|
67
|
-
value: {mv: 'jv1'}
|
|
68
|
-
}, {key: {mk: 'jmulti2'}, value: {mv: 'jv2'}}]
|
|
69
|
-
)))
|
|
70
|
-
.catch(t.failed(done))
|
|
71
|
-
.finally(done);
|
|
72
|
-
});
|
|
73
|
-
it('can listen for only create events', function (done) {
|
|
74
|
-
client
|
|
75
|
-
.then(t.on('create', t.expectEvent({k: 'jlisten-create'}, done, true, {v: 'jvalue'})))
|
|
76
|
-
.then(t.assert(t.putIfAbsent({k: 'jlisten-create'}, {v: 'jvalue'}), t.toBeTruthy))
|
|
77
|
-
.catch(t.failed(done));
|
|
78
|
-
});
|
|
79
|
-
it('can listen for only modified events', function (done) {
|
|
80
|
-
client
|
|
81
|
-
.then(t.on('modify', t.expectEvent({k: 'jlisten-modify'}, done, true, {v: 'jv1'})))
|
|
82
|
-
.then(t.assert(t.putIfAbsent({k: 'jlisten-modify'}, {v: 'jv0'}), t.toBeTruthy))
|
|
83
|
-
.then(t.assert(t.replace({k: 'jlisten-modify'}, {v: 'jv1'}), t.toBeTruthy))
|
|
84
|
-
.catch(t.failed(done));
|
|
85
|
-
});
|
|
86
|
-
it('can listen for only removed events', function (done) {
|
|
87
|
-
client
|
|
88
|
-
.then(t.on('remove', t.expectEvent({k: 'jlisten-remove'}, done, true)))
|
|
89
|
-
.then(t.assert(t.putIfAbsent({k: 'jlisten-remove'}, {v: 'jv0'}), t.toBeTruthy))
|
|
90
|
-
.then(t.assert(t.replace({k: 'jlisten-remove'}, {v: 'jv1'}), t.toBeTruthy))
|
|
91
|
-
.then(t.assert(t.remove({k: 'jlisten-remove'}), t.toBeTruthy))
|
|
92
|
-
.catch(t.failed(done));
|
|
93
|
-
});
|
|
94
|
-
it('can listen for custom events for created events', function(done) {
|
|
95
|
-
var expected = { _type : 'org.infinispan.commons.util.KeyValueWithPrevious', key : {"k":"jlisten-custom"}, value : {"v":"jvalue"}, prev : null };
|
|
96
|
-
var opts = { converterFactory : { name: "key-value-with-previous-converter-factory" } };
|
|
97
|
-
client
|
|
98
|
-
.then(t.on('create', t.expectCustomEvent(expected, done), opts))
|
|
99
|
-
.then(t.assert(t.putIfAbsent({k: 'jlisten-custom'}, {v: 'jvalue'}), t.toBeTruthy))
|
|
100
|
-
.catch(t.failed(done));
|
|
101
|
-
});
|
|
102
|
-
it('can listen for custom events for modified events', function (done) {
|
|
103
|
-
var expected = { _type : 'org.infinispan.commons.util.KeyValueWithPrevious', key : {"k":"jlisten-modify"}, value : {"v":"jv1"}, prev : {"v":"jv0"} };
|
|
104
|
-
var opts = { converterFactory : { name: "key-value-with-previous-converter-factory" } };
|
|
105
|
-
client
|
|
106
|
-
.then(t.on('modify', t.expectCustomEvent(expected, done), opts))
|
|
107
|
-
.then(t.assert(t.putIfAbsent({k: 'jlisten-modify'}, {v: 'jv0'}), t.toBeTruthy))
|
|
108
|
-
.then(t.assert(t.replace({k: 'jlisten-modify'}, {v: 'jv1'}), t.toBeTruthy))
|
|
109
|
-
.catch(t.failed(done));
|
|
110
|
-
});
|
|
111
|
-
it('can listen for custom events for removed events', function (done) {
|
|
112
|
-
var expected = { _type : 'org.infinispan.commons.util.KeyValueWithPrevious', key : {"k":"jlisten-remove"}, value : null, prev : {"v":"jv1"} };
|
|
113
|
-
var opts = { converterFactory : { name: "key-value-with-previous-converter-factory" } };
|
|
114
|
-
client
|
|
115
|
-
.then(t.on('remove', t.expectCustomEvent(expected, done), opts))
|
|
116
|
-
.then(t.assert(t.putIfAbsent({k: 'jlisten-remove'}, {v: 'jv0'}), t.toBeTruthy))
|
|
117
|
-
.then(t.assert(t.replace({k: 'jlisten-remove'}, {v: 'jv1'}), t.toBeTruthy))
|
|
118
|
-
.then(t.assert(t.remove({k: 'jlisten-remove'}), t.toBeTruthy))
|
|
119
|
-
.catch(t.failed(done));
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
it('can iterate over entries, one entry at the time', function (done) {
|
|
123
|
-
var pairs = [
|
|
124
|
-
{key: {k: 'jlocal-it1'}, value: {v: 'jv1'}, done: false},
|
|
125
|
-
{key: {k: 'jlocal-it2'}, value: {v: 'jv2'}, done: false},
|
|
126
|
-
{key: {k: 'jlocal-it3'}, value: {v: 'jv3'}, done: false}];
|
|
127
|
-
client
|
|
128
|
-
.then(t.assert(t.clear()))
|
|
129
|
-
.then(t.assert(t.putAll(pairs), t.toBeUndefined))
|
|
130
|
-
.then(t.seqIterator(function (obj) {
|
|
131
|
-
return obj.key.k;
|
|
132
|
-
}, 1, pairs))
|
|
133
|
-
.catch(t.failed(done))
|
|
134
|
-
.finally(done);
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
// it('can execute a script remotely to store and retrieve data', function(done) {
|
|
138
|
-
// var scriptName = 'local-typed-json-put-get.js';
|
|
139
|
-
// var params = {k: {ek: 'local-json-typed-key'}, v: {ev: 'local-json-typed-value'}};
|
|
140
|
-
// client
|
|
141
|
-
// .then(t.loadAndExec('spec/utils/typed-json-put-get.js', scriptName))
|
|
142
|
-
// .then(t.assert(t.exec(scriptName, params), t.toEqual({ev: 'local-json-typed-value'})))
|
|
143
|
-
// // .then(t.assert(t.get(prefix + "-typed-key"), t.toBe(prefix + "-typed-value")))
|
|
144
|
-
// .catch(t.failed(done)).finally(done);
|
|
145
|
-
// }
|
|
146
|
-
// );
|
|
147
|
-
// it('can execute a script remotely to store and retrieve unicode data', function(done) {
|
|
148
|
-
// client
|
|
149
|
-
// .then(t.loadAndExec('spec/utils/typed-json-put-get-unicode.js', 'typed-json-put-get-unicode.js'))
|
|
150
|
-
// .then(t.assert(t.exec('typed-json-put-get-unicode.js'), t.toEqual({v: 'բարեվ'})))
|
|
151
|
-
// .catch(t.failed(done)).finally(done);
|
|
152
|
-
// });
|
|
153
|
-
// it('can execute a script remotely that returns size', function(done) {
|
|
154
|
-
// client
|
|
155
|
-
// .then(t.loadAndExec('spec/utils/typed-json-size.js'))
|
|
156
|
-
// .then(t.assert(t.exec('typed-json-size.js'), t.toEqual({size: '0'})))
|
|
157
|
-
// .catch(t.failed(done)).finally(done);
|
|
158
|
-
// });
|
|
159
|
-
// it('can execute a script remotely that returns undefined', function(done) {
|
|
160
|
-
// client
|
|
161
|
-
// .then(t.loadAndExec('spec/utils/typed-json-null-return.js'))
|
|
162
|
-
// .then(t.assert(t.exec('typed-json-null-return.js'), t.toEqual({address: ''})))
|
|
163
|
-
// .catch(t.failed(done)).finally(done);
|
|
164
|
-
// });
|
|
165
|
-
|
|
166
|
-
// it('can listen for events generated by executing a script', function(done) {
|
|
167
|
-
// client
|
|
168
|
-
// .then(t.on('create', t.expectEvent('listen-typed-key', done, true, 'listen-typed-value')))
|
|
169
|
-
// .then(t.loadAndExec('spec/utils/typed-put-get.js'))
|
|
170
|
-
// .then(t.assert(t.exec('typed-put-get.js'
|
|
171
|
-
// , {k: 'listen-typed-key', v: 'listen-typed-value'}), t.toBe('listen-typed-value')))
|
|
172
|
-
// .catch(t.failed(done));
|
|
173
|
-
// });
|
|
174
|
-
|
|
175
|
-
// Since Jasmine 1.3 does not have afterAll callback, this disconnect test must be last
|
|
176
|
-
it('disconnects client', function(done) { client
|
|
177
|
-
.then(t.disconnect())
|
|
178
|
-
.catch(t.failed(done))
|
|
179
|
-
.finally(done);
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
});
|
|
@@ -1,354 +0,0 @@
|
|
|
1
|
-
var _ = require('underscore');
|
|
2
|
-
|
|
3
|
-
var f = require('../lib/functional');
|
|
4
|
-
var t = require('./utils/testing'); // Testing dependency
|
|
5
|
-
var tests = require('./tests'); // Shared tests
|
|
6
|
-
|
|
7
|
-
describe('Infinispan local client', function() {
|
|
8
|
-
var client = t.client(t.local, t.authOpts);
|
|
9
|
-
beforeEach(function(done) { client
|
|
10
|
-
.then(t.assert(t.clear()))
|
|
11
|
-
.catch(t.failed(done)).finally(done);
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it('can put -> get -> remove a key/value pair', function(done) {
|
|
15
|
-
client.then(t.assert(t.size(), t.toBe(0)))
|
|
16
|
-
.then(t.assert(t.put('key', 'value')))
|
|
17
|
-
.then(t.assert(t.size(), t.toBe(1)))
|
|
18
|
-
.then(t.assert(t.get('key'), t.toBe('value')))
|
|
19
|
-
.then(t.assert(t.containsKey('key'), t.toBeTruthy))
|
|
20
|
-
.then(t.assert(t.remove('key'), t.toBeTruthy))
|
|
21
|
-
.then(t.assert(t.get('key'), t.toBeUndefined))
|
|
22
|
-
.then(t.assert(t.containsKey('key'), t.toBeFalsy))
|
|
23
|
-
.then(t.assert(t.remove('key'), t.toBeFalsy))
|
|
24
|
-
.then(t.assert(t.size(), t.toBe(0)))
|
|
25
|
-
.catch(t.failed(done))
|
|
26
|
-
.finally(done);
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it('can use conditional operations on a key/value pair', function(done) { client
|
|
30
|
-
.then(t.assert(t.putIfAbsent('cond', 'v0'), t.toBeTruthy))
|
|
31
|
-
.then(t.assert(t.putIfAbsent('cond', 'v1'), t.toBeFalsy))
|
|
32
|
-
.then(t.assert(t.get('cond'), t.toBe('v0')))
|
|
33
|
-
.then(t.assert(t.replace('cond', 'v1'), t.toBeTruthy))
|
|
34
|
-
.then(t.assert(t.replace('other', 'v1'), t.toBeFalsy))
|
|
35
|
-
.then(t.assert(t.get('cond'), t.toBe('v1')))
|
|
36
|
-
.then(t.assert(t.conditional(t.replaceV, t.getM, 'cond', 'v1', 'v2'), t.toBeTruthy))
|
|
37
|
-
.then(t.assert(t.get('cond'), t.toBe('v2')))
|
|
38
|
-
.then(t.assert(t.notReplaceWithVersion('_'), t.toBeFalsy)) // key not found
|
|
39
|
-
.then(t.assert(t.notReplaceWithVersion('cond'), t.toBeFalsy)) // key found but invalid version
|
|
40
|
-
.then(t.assert(t.get('cond'), t.toBe('v2')))
|
|
41
|
-
.then(t.assert(t.notRemoveWithVersion('_'), t.toBeFalsy))
|
|
42
|
-
.then(t.assert(t.notRemoveWithVersion('cond'), t.toBeFalsy))
|
|
43
|
-
.then(t.assert(t.get('cond'), t.toBe('v2')))
|
|
44
|
-
.then(t.assert(t.conditional(t.removeWithVersion, t.getM, 'cond', 'v2'), t.toBeTruthy))
|
|
45
|
-
.then(t.assert(t.get('cond'), t.toBeUndefined))
|
|
46
|
-
.then(t.assert(t.getM('cond'), t.toBeUndefined))
|
|
47
|
-
.catch(t.failed(done))
|
|
48
|
-
.finally(done);
|
|
49
|
-
});
|
|
50
|
-
it('can return previous values', function(done) { client
|
|
51
|
-
.then(t.assert(t.putIfAbsent('prev', 'v0', t.prev()), t.toBeUndefined))
|
|
52
|
-
.then(t.assert(t.putIfAbsent('prev', 'v1', t.prev()), t.toBe('v0')))
|
|
53
|
-
.then(t.assert(t.remove('prev', t.prev()), t.toBe('v0')))
|
|
54
|
-
.then(t.assert(t.remove('prev', t.prev()), t.toBeUndefined))
|
|
55
|
-
.then(t.assert(t.put('prev', 'v1', t.prev()), t.toBeUndefined))
|
|
56
|
-
.then(t.assert(t.put('prev', 'v2', t.prev()), t.toBe('v1')))
|
|
57
|
-
.then(t.assert(t.replace('prev', 'v3', t.prev()), t.toBe('v2')))
|
|
58
|
-
.then(t.assert(t.replace('_', 'v3', t.prev()), t.toBeUndefined))
|
|
59
|
-
.then(t.assert(t.conditional(t.replaceV, t.getM, 'prev', 'v3', 'v4', t.prev()), t.toBe('v3')))
|
|
60
|
-
.then(t.assert(t.notReplaceWithVersion('_', t.prev()), t.toBeUndefined)) // key not found
|
|
61
|
-
.then(t.assert(t.notReplaceWithVersion('prev', t.prev()), t.toBe('v4'))) // key found but invalid version
|
|
62
|
-
.then(t.assert(t.notRemoveWithVersion('_', t.prev()), t.toBeUndefined)) // key not found
|
|
63
|
-
.then(t.assert(t.notRemoveWithVersion('prev', t.prev()), t.toBe('v4'))) // key found but invalid version
|
|
64
|
-
.then(t.assert(t.conditional(t.removeWithVersion, t.getM, 'prev', 'v4', t.prev()), t.toBe('v4')))
|
|
65
|
-
.catch(t.failed(done))
|
|
66
|
-
.finally(done);
|
|
67
|
-
});
|
|
68
|
-
it('can use multi-key operations', function(done) {
|
|
69
|
-
var pairs = [{key: 'multi1', value: 'v1'}, {key: 'multi2', value: 'v2'}, {key: 'multi3', value: 'v3'}];
|
|
70
|
-
var keys = ['multi1', 'multi2'];
|
|
71
|
-
client
|
|
72
|
-
.then(t.assert(t.putAll(pairs), t.toBeUndefined))
|
|
73
|
-
.then(t.assert(t.size(), t.toBe(3)))
|
|
74
|
-
.then(t.assert(t.getAll(keys), t.toEqualPairs('key', [{key: 'multi1', value: 'v1'}, {key: 'multi2', value: 'v2'}])))
|
|
75
|
-
.then(t.assert(t.getAll(['_']), t.toEqual([])))
|
|
76
|
-
.catch(t.failed(done))
|
|
77
|
-
.finally(done);
|
|
78
|
-
});
|
|
79
|
-
it('can ping a server', function(done) { client
|
|
80
|
-
.then(t.assert(t.ping(), t.toBeUndefined))
|
|
81
|
-
.catch(t.failed(done))
|
|
82
|
-
.finally(done);
|
|
83
|
-
});
|
|
84
|
-
it('fails when non-configured cache is accessed', function(done) {
|
|
85
|
-
t.client(t.local, {cacheName: 'unknownCache'})
|
|
86
|
-
.then(function() {
|
|
87
|
-
done(new Error('Exception should be thrown while accessing not-configured cache.'));
|
|
88
|
-
}).catch(function(error) {
|
|
89
|
-
expect(error).toBe("org.infinispan.server.hotrod.CacheNotFoundException: Cache with name 'unknownCache' not found amongst the configured caches");
|
|
90
|
-
done();
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
it('can put -> get a big value', function(done) {
|
|
94
|
-
var value = t.randomStr(128);
|
|
95
|
-
client
|
|
96
|
-
.then(t.assert(t.put('key', value)))
|
|
97
|
-
.then(t.assert(t.get('key'), t.toEqual(value)))
|
|
98
|
-
.catch(t.failed(done))
|
|
99
|
-
.finally(done);
|
|
100
|
-
});
|
|
101
|
-
it('can put -> get a really big value', function(done) {
|
|
102
|
-
var value = t.randomStr(1024 * 1024);
|
|
103
|
-
client
|
|
104
|
-
.then(t.assert(t.put('key', value)))
|
|
105
|
-
.then(t.assert(t.get('key'), t.toEqual(value)))
|
|
106
|
-
.catch(t.failed(done))
|
|
107
|
-
.finally(done);
|
|
108
|
-
});
|
|
109
|
-
it('can put -> get -> remove a key/value pair on a named cache', function(done) {
|
|
110
|
-
t.client(t.local, {cacheName: 'namedCache', authentication: t.authOpts.authentication})
|
|
111
|
-
.then(t.assert(t.put('key', 'value')))
|
|
112
|
-
.then(t.assert(t.get('key'), t.toBe('value')))
|
|
113
|
-
.then(t.assert(t.remove('key'), t.toBeTruthy))
|
|
114
|
-
.then(t.disconnect())
|
|
115
|
-
.catch(t.failed(done))
|
|
116
|
-
.finally(done);
|
|
117
|
-
});
|
|
118
|
-
it('can put -> get -> remove a key/value pair on a named cache with disabled ssl', function(done) {
|
|
119
|
-
t.client(t.local, {cacheName: 'namedCache',
|
|
120
|
-
authentication: t.authOpts.authentication,
|
|
121
|
-
security: {ssl: {enabled: false}}})
|
|
122
|
-
.then(t.assert(t.put('key', 'value')))
|
|
123
|
-
.then(t.assert(t.get('key'), t.toBe('value')))
|
|
124
|
-
.then(t.assert(t.remove('key'), t.toBeTruthy))
|
|
125
|
-
.then(t.disconnect())
|
|
126
|
-
.catch(t.failed(done))
|
|
127
|
-
.finally(done);
|
|
128
|
-
});
|
|
129
|
-
it('can get key/value pairs with their immortal metadata', function(done) {
|
|
130
|
-
var immortal = { created : -1, lifespan: -1, lastUsed: -1, maxIdle: -1 };
|
|
131
|
-
client
|
|
132
|
-
.then(t.assert(t.getM('meta'), t.toBeUndefined))
|
|
133
|
-
.then(t.assert(t.put('meta', 'v0')))
|
|
134
|
-
.then(t.assert(t.getM('meta'), t.toContain(f.merge({ value: 'v0' }, immortal))))
|
|
135
|
-
.then(t.assert(t.conditional(t.replaceV, t.getM, 'meta', 'v0', 'v1'), t.toBeTruthy))
|
|
136
|
-
.then(t.assert(t.getM('meta'), t.toContain(f.merge({ value: 'v1' }, immortal))))
|
|
137
|
-
.catch(t.failed(done))
|
|
138
|
-
.finally(done);
|
|
139
|
-
});
|
|
140
|
-
it('can get key/value pairs with their expirable metadata', function(done) { client
|
|
141
|
-
.then(t.assert(t.put('life-meta', 'value', {lifespan: '60s'})))
|
|
142
|
-
.then(t.assert(t.getM('life-meta'), t.toContain({ value: 'value', lifespan : 60})))
|
|
143
|
-
.then(t.assert(t.putIfAbsent('cond-exp-meta', 'v0', {maxIdle: '45m'})))
|
|
144
|
-
.then(t.assert(t.getM('cond-exp-meta'), t.toContain({ value: 'v0', maxIdle : 2700})))
|
|
145
|
-
.then(t.assert(t.replace('cond-exp-meta', 'v1', {lifespan: '1d', maxIdle: '1h'})))
|
|
146
|
-
.then(t.assert(t.getM('cond-exp-meta'), t.toContain({ value: 'v1', lifespan: 86400, maxIdle : 3600})))
|
|
147
|
-
.catch(t.failed(done))
|
|
148
|
-
.finally(done);
|
|
149
|
-
});
|
|
150
|
-
it('can listen for only create events', function(done) { client
|
|
151
|
-
.then(t.on('create', t.expectEvent('listen-create', done, true, 'value')))
|
|
152
|
-
.then(t.assert(t.putIfAbsent('listen-create', 'value'), t.toBeTruthy))
|
|
153
|
-
.catch(t.failed(done));
|
|
154
|
-
});
|
|
155
|
-
it('can listen for only modified events', function(done) { client
|
|
156
|
-
.then(t.on('modify', t.expectEvent('listen-modify', done, true, 'v1')))
|
|
157
|
-
.then(t.assert(t.putIfAbsent('listen-modify', 'v0'), t.toBeTruthy))
|
|
158
|
-
.then(t.assert(t.replace('listen-modify', 'v1'), t.toBeTruthy))
|
|
159
|
-
.catch(t.failed(done));
|
|
160
|
-
});
|
|
161
|
-
it('can listen for only removed events', function(done) { client
|
|
162
|
-
.then(t.on('remove', t.expectEvent('listen-remove', done, true)))
|
|
163
|
-
.then(t.assert(t.putIfAbsent('listen-remove', 'v0'), t.toBeTruthy))
|
|
164
|
-
.then(t.assert(t.replace('listen-remove', 'v1'), t.toBeTruthy))
|
|
165
|
-
.then(t.assert(t.remove('listen-remove'), t.toBeTruthy))
|
|
166
|
-
.catch(t.failed(done));
|
|
167
|
-
});
|
|
168
|
-
it('fails when wrong event name is passed', function(done) {
|
|
169
|
-
var errorTookPlace = false;
|
|
170
|
-
client
|
|
171
|
-
.then(t.on('notSupportedEvent', t.expectEvent('wrongNameCreate', done, true, 'value')))
|
|
172
|
-
.catch(function(error){
|
|
173
|
-
errorTookPlace = true;
|
|
174
|
-
expect(error.message).toBe("The event 'notSupportedEvent' is not supported");
|
|
175
|
-
return done();
|
|
176
|
-
})
|
|
177
|
-
.finally(function() {
|
|
178
|
-
if (!errorTookPlace) {
|
|
179
|
-
return done(new Error("The registration of unknown event should fail!"));
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
});
|
|
183
|
-
it('can listen for create/modified/remove events in distinct listeners', function(done) { client
|
|
184
|
-
.then(t.on('create', t.expectEvent('listen-distinct', done, false, 'v0')))
|
|
185
|
-
.then(t.assert(t.putIfAbsent('listen-distinct', 'v0'), t.toBeTruthy))
|
|
186
|
-
.then(t.on('modify', t.expectEvent('listen-distinct', done, false, 'v1')))
|
|
187
|
-
.then(t.assert(t.replace('listen-distinct', 'v1'), t.toBeTruthy))
|
|
188
|
-
.then(t.on('remove', t.expectEvent('listen-distinct', done, true)))
|
|
189
|
-
.then(t.assert(t.remove('listen-distinct'), t.toBeTruthy))
|
|
190
|
-
.catch(t.failed(done));
|
|
191
|
-
});
|
|
192
|
-
it('can listen for create/modified/remove events in same listener', function(done) { client
|
|
193
|
-
.then(t.onMany(
|
|
194
|
-
[{event: 'create', listener: t.expectEventKeyOnly('listen-same')},
|
|
195
|
-
{event: 'modify', listener: t.expectEventKeyOnly('listen-same')},
|
|
196
|
-
{event: 'remove', listener: t.expectEventKeyOnly('listen-same', done)}
|
|
197
|
-
]))
|
|
198
|
-
.then(t.assert(t.putIfAbsent('listen-same', 'v0'), t.toBeTruthy))
|
|
199
|
-
.then(t.assert(t.replace('listen-same', 'v1'), t.toBeTruthy))
|
|
200
|
-
.then(t.assert(t.remove('listen-same'), t.toBeTruthy))
|
|
201
|
-
.catch(t.failed(done));
|
|
202
|
-
});
|
|
203
|
-
it('can listen for state events when adding listener to non-empty cache', function(done) { client
|
|
204
|
-
.then(t.assert(t.putIfAbsent('listen-state-0', 'v0'), t.toBeTruthy))
|
|
205
|
-
.then(t.assert(t.putIfAbsent('listen-state-1', 'v1'), t.toBeTruthy))
|
|
206
|
-
.then(t.assert(t.putIfAbsent('listen-state-2', 'v2'), t.toBeTruthy))
|
|
207
|
-
.then(t.on('create', t.expectEvents(
|
|
208
|
-
['listen-state-0', 'listen-state-1', 'listen-state-2'], done),
|
|
209
|
-
{'includeState' : true}))
|
|
210
|
-
.catch(t.failed(done));
|
|
211
|
-
});
|
|
212
|
-
it('fails when trying to attach to non-existent listener', function(done) {
|
|
213
|
-
var errorTookPlace = false;
|
|
214
|
-
client.then(function (client) {
|
|
215
|
-
var clientAddListenerCreate = client.addListener(
|
|
216
|
-
'create', function(key) { console.log('[Event] Created key: ' + key); });
|
|
217
|
-
var clientAddListeners = clientAddListenerCreate.then(
|
|
218
|
-
function(listenerId) {
|
|
219
|
-
return client.addListener(
|
|
220
|
-
'modify', function(key) { console.log('[Event] Modified key: ' + key); },
|
|
221
|
-
{listenerId: 'blblbl'}).catch(function(error) {
|
|
222
|
-
errorTookPlace = true;
|
|
223
|
-
expect(error.message).toBe("No server connection for listener (listenerId=blblbl)");
|
|
224
|
-
return done();
|
|
225
|
-
}).finally(function() {
|
|
226
|
-
if (!errorTookPlace) {
|
|
227
|
-
return done(new Error("The attachment of event with unknown listenerId should fail, but has succeeded."))
|
|
228
|
-
} else {
|
|
229
|
-
var clientRemoveListener =
|
|
230
|
-
Promise.all([clientAddListenerCreate]).then(
|
|
231
|
-
function(values) {
|
|
232
|
-
var listenerId = values[0];
|
|
233
|
-
return client.removeListener(listenerId);
|
|
234
|
-
});
|
|
235
|
-
}
|
|
236
|
-
});
|
|
237
|
-
});
|
|
238
|
-
}).catch(t.failed(done)).finally(done);
|
|
239
|
-
});
|
|
240
|
-
|
|
241
|
-
it('can listen for custom events for created events', function(done) {
|
|
242
|
-
var expected = 'KeyValueWithPrevious{key=listen-custom-create, value=value, prev=null}';
|
|
243
|
-
var opts = { converterFactory : { name: "key-value-with-previous-converter-factory" } };
|
|
244
|
-
client
|
|
245
|
-
.then(t.on('create', t.expectCustomEvent(expected, done), opts))
|
|
246
|
-
.then(t.assert(t.putIfAbsent('listen-custom-create', 'value'), t.toBeTruthy))
|
|
247
|
-
.catch(t.failed(done));
|
|
248
|
-
});
|
|
249
|
-
it('can listen for custom events for modified events', function(done) {
|
|
250
|
-
var expected = 'KeyValueWithPrevious{key=listen-custom-modify, value=v1, prev=v0}';
|
|
251
|
-
var opts = { converterFactory : { name: "key-value-with-previous-converter-factory" } };
|
|
252
|
-
client
|
|
253
|
-
.then(t.on('modify', t.expectCustomEvent(expected, done), opts))
|
|
254
|
-
.then(t.assert(t.putIfAbsent('listen-custom-modify', 'v0'), t.toBeTruthy))
|
|
255
|
-
.then(t.assert(t.replace('listen-custom-modify', 'v1'), t.toBeTruthy))
|
|
256
|
-
.catch(t.failed(done));
|
|
257
|
-
});
|
|
258
|
-
it('can listen for custom events for removed events', function(done) {
|
|
259
|
-
var expected = 'KeyValueWithPrevious{key=listen-custom-remove, value=null, prev=v1}';
|
|
260
|
-
var opts = { converterFactory : { name: "key-value-with-previous-converter-factory" } };
|
|
261
|
-
client
|
|
262
|
-
.then(t.on('remove', t.expectCustomEvent(expected, done), opts))
|
|
263
|
-
.then(t.assert(t.putIfAbsent('listen-custom-remove', 'v0'), t.toBeTruthy))
|
|
264
|
-
.then(t.assert(t.replace('listen-custom-remove', 'v1'), t.toBeTruthy))
|
|
265
|
-
.then(t.assert(t.remove('listen-custom-remove'), t.toBeTruthy))
|
|
266
|
-
.catch(t.failed(done));
|
|
267
|
-
});
|
|
268
|
-
|
|
269
|
-
it('can iterate over entries, one entry at the time',
|
|
270
|
-
tests.iterateEntries('local', 1, client)
|
|
271
|
-
);
|
|
272
|
-
|
|
273
|
-
it('can iterate over entries, more than one entry at the time',
|
|
274
|
-
tests.iterateEntries('local', 3, client)
|
|
275
|
-
);
|
|
276
|
-
|
|
277
|
-
it('can iterate over entries getting their expirable metadata', function (done) {
|
|
278
|
-
var pairs = [{key: 'it-exp-1', value: 'v1'}, {key: 'it-exp-2', value: 'v2'}];
|
|
279
|
-
var expected = _.map(pairs, function (pair) {
|
|
280
|
-
return f.merge(pair, {done: false, lifespan: 86400, maxIdle: 3600});
|
|
281
|
-
});
|
|
282
|
-
client
|
|
283
|
-
.then(t.assert(t.clear()))
|
|
284
|
-
.then(t.assert(t.putAll(pairs, {lifespan: '1d', maxIdle: '1h'}), t.toBeUndefined))
|
|
285
|
-
.then(t.seqIterator('key', 3, expected, {metadata: true})) // Iterate all data, 3 elements at time, sequential
|
|
286
|
-
.catch(t.failed(done))
|
|
287
|
-
.finally(done);
|
|
288
|
-
});
|
|
289
|
-
|
|
290
|
-
it('can failover to a secondary node if first node is not available', function(done) {
|
|
291
|
-
t.client([{port: 1234, host: '127.0.0.1'}, t.local])
|
|
292
|
-
.then(t.assert(t.ping(), t.toBeUndefined))
|
|
293
|
-
.then(t.disconnect())
|
|
294
|
-
.catch(t.failed(done))
|
|
295
|
-
.finally(done);
|
|
296
|
-
});
|
|
297
|
-
it('can query statistic values', function(done) { client
|
|
298
|
-
.then(t.assertStats(t.put('stats-key', 'stats-value'), t.toBeStatIncr('stores')))
|
|
299
|
-
.then(t.assertStats(t.get('stats-key'), t.toBeStatIncr('hits')))
|
|
300
|
-
.then(t.assertStats(t.get('stats-miss-key'), t.toBeStatIncr('misses')))
|
|
301
|
-
.then(t.assertStats(t.remove('stats-miss-key'), t.toBeStatIncr('removeMisses')))
|
|
302
|
-
.then(t.assertStats(t.remove('stats-key'), t.toBeStatIncr('removeHits')))
|
|
303
|
-
.catch(t.failed(done)).finally(done);
|
|
304
|
-
});
|
|
305
|
-
it('can retrieve topology information', function(done) { client
|
|
306
|
-
.then(t.assert(t.getTopologyId(), t.toBe(0)))
|
|
307
|
-
.then(t.assert(t.getMembers(), t.toEqual([t.local])))
|
|
308
|
-
.catch(t.failed(done)).finally(done);
|
|
309
|
-
});
|
|
310
|
-
it('can execute a script remotely to store and retrieve data',
|
|
311
|
-
tests.execPutGet(
|
|
312
|
-
'spec/utils/typed-put-get.js', 'local', client, t.toBe('local-typed-value')
|
|
313
|
-
)
|
|
314
|
-
);
|
|
315
|
-
it('can execute a script remotely to store and retrieve unicode data', function(done) {
|
|
316
|
-
client
|
|
317
|
-
.then(t.loadAndExec('spec/utils/typed-put-get-unicode.js', 'typed-put-get-unicode.js'))
|
|
318
|
-
.then(t.assert(t.exec('typed-put-get-unicode.js'), t.toBe('բարեվ')))
|
|
319
|
-
.catch(t.failed(done)).finally(done);
|
|
320
|
-
});
|
|
321
|
-
it('can execute a script remotely that returns size', function(done) {
|
|
322
|
-
client
|
|
323
|
-
.then(t.loadAndExec('spec/utils/typed-size.js'))
|
|
324
|
-
.then(t.assert(t.exec('typed-size.js'), t.toBe('0')))
|
|
325
|
-
.catch(t.failed(done)).finally(done);
|
|
326
|
-
});
|
|
327
|
-
it('can execute a script remotely to get node address from cacheManager', function(done) {
|
|
328
|
-
client
|
|
329
|
-
.then(t.loadAndExec('spec/utils/typed-cachemanager-put-get.js'))
|
|
330
|
-
.then(t.assert(t.exec('typed-cachemanager-put-get.js'), t.toBe('a')))
|
|
331
|
-
.catch(t.failed(done)).finally(done);
|
|
332
|
-
});
|
|
333
|
-
it('can execute a script remotely that returns undefined', function(done) {
|
|
334
|
-
client
|
|
335
|
-
.then(t.loadAndExec('spec/utils/typed-null-return.js'))
|
|
336
|
-
.then(t.assert(t.exec('typed-null-return.js'), t.toBe('')))
|
|
337
|
-
.catch(t.failed(done)).finally(done);
|
|
338
|
-
});
|
|
339
|
-
it('can listen for events generated by executing a script', function(done) {
|
|
340
|
-
client
|
|
341
|
-
.then(t.on('create', t.expectEvent('listen-typed-key', done, true, 'listen-typed-value')))
|
|
342
|
-
.then(t.loadAndExec('spec/utils/typed-put-get.js'))
|
|
343
|
-
.then(t.assert(t.exec('typed-put-get.js'
|
|
344
|
-
, {k: 'listen-typed-key', v: 'listen-typed-value'}), t.toBe('listen-typed-value')))
|
|
345
|
-
.catch(t.failed(done));
|
|
346
|
-
});
|
|
347
|
-
|
|
348
|
-
// Since Jasmine 1.3 does not have afterAll callback, this disconnect test must be last
|
|
349
|
-
it('disconnects client', function(done) { client
|
|
350
|
-
.then(t.disconnect())
|
|
351
|
-
.catch(t.failed(done))
|
|
352
|
-
.finally(done);
|
|
353
|
-
});
|
|
354
|
-
});
|