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.
Files changed (95) hide show
  1. package/README.md +1 -1
  2. package/lib/protostream/query.proto +1 -1
  3. package/package.json +9 -9
  4. package/.eslintrc +0 -25
  5. package/.flowconfig +0 -6
  6. package/Jenkinsfile +0 -50
  7. package/Jenkinsfile-release +0 -63
  8. package/documentation/asciidoc/stories/assembly_client_usage_examples.adoc +0 -10
  9. package/documentation/asciidoc/stories/assembly_installation_configuration.adoc +0 -20
  10. package/documentation/asciidoc/titles/js_client.asciidoc +0 -28
  11. package/documentation/asciidoc/titles/stories.adoc +0 -5
  12. package/documentation/asciidoc/topics/attributes/community-attributes.adoc +0 -9
  13. package/documentation/asciidoc/topics/attributes/downstream-attributes.adoc +0 -2
  14. package/documentation/asciidoc/topics/code_examples/authentication-digest.js +0 -12
  15. package/documentation/asciidoc/topics/code_examples/authentication-external.js +0 -15
  16. package/documentation/asciidoc/topics/code_examples/authentication-oauthbearer.js +0 -10
  17. package/documentation/asciidoc/topics/code_examples/authentication-plain.js +0 -11
  18. package/documentation/asciidoc/topics/code_examples/authentication-scram.js +0 -11
  19. package/documentation/asciidoc/topics/code_examples/await-multiple-entries.js +0 -36
  20. package/documentation/asciidoc/topics/code_examples/await-single-entries.js +0 -29
  21. package/documentation/asciidoc/topics/code_examples/conditional-operations.js +0 -57
  22. package/documentation/asciidoc/topics/code_examples/connection-multiple-servers.js +0 -23
  23. package/documentation/asciidoc/topics/code_examples/connection-xsite-cluster-switch.js +0 -39
  24. package/documentation/asciidoc/topics/code_examples/connection-xsite.js +0 -13
  25. package/documentation/asciidoc/topics/code_examples/data-types.js +0 -30
  26. package/documentation/asciidoc/topics/code_examples/encryption-crypto-store.js +0 -11
  27. package/documentation/asciidoc/topics/code_examples/encryption-private-key.js +0 -13
  28. package/documentation/asciidoc/topics/code_examples/encryption-sni-hostname.js +0 -9
  29. package/documentation/asciidoc/topics/code_examples/encryption-trust-certs.js +0 -8
  30. package/documentation/asciidoc/topics/code_examples/ephemeral-data.js +0 -52
  31. package/documentation/asciidoc/topics/code_examples/hello-world.js +0 -42
  32. package/documentation/asciidoc/topics/code_examples/key-value-converter.js +0 -67
  33. package/documentation/asciidoc/topics/code_examples/logging-configuration.js +0 -2
  34. package/documentation/asciidoc/topics/code_examples/multiple-entries.js +0 -64
  35. package/documentation/asciidoc/topics/code_examples/queries.js +0 -92
  36. package/documentation/asciidoc/topics/code_examples/register-event-listener.js +0 -64
  37. package/documentation/asciidoc/topics/code_examples/sample-script-execute.js +0 -33
  38. package/documentation/asciidoc/topics/code_examples/sample-script.js +0 -3
  39. package/documentation/asciidoc/topics/code_examples/single-entries.js +0 -49
  40. package/documentation/asciidoc/topics/config_examples/logging.json +0 -14
  41. package/documentation/asciidoc/topics/proc_configuring_authentication.adoc +0 -16
  42. package/documentation/asciidoc/topics/proc_configuring_connections.adoc +0 -25
  43. package/documentation/asciidoc/topics/proc_configuring_connections_xsite.adoc +0 -18
  44. package/documentation/asciidoc/topics/proc_configuring_data_formats.adoc +0 -30
  45. package/documentation/asciidoc/topics/proc_configuring_encryption.adoc +0 -15
  46. package/documentation/asciidoc/topics/proc_configuring_logging.adoc +0 -28
  47. package/documentation/asciidoc/topics/proc_installing_clients.adoc +0 -58
  48. package/documentation/asciidoc/topics/proc_switching_clusters.adoc +0 -17
  49. package/documentation/asciidoc/topics/ref_authentication_mechanisms.adoc +0 -68
  50. package/documentation/asciidoc/topics/ref_client_usage.adoc +0 -128
  51. package/documentation/asciidoc/topics/ref_encryption.adoc +0 -71
  52. package/gen-jsdoc.sh +0 -6
  53. package/make-ssl.sh +0 -335
  54. package/memory-profiling/helper.js +0 -9
  55. package/memory-profiling/infinispan_memory_many_get.js +0 -50
  56. package/memory-profiling/infinispan_memory_one_get.js +0 -56
  57. package/release.sh +0 -19
  58. package/run-servers.sh +0 -156
  59. package/run-testsuite.sh +0 -6
  60. package/server/.keep +0 -0
  61. package/set-npm-auth-token.sh +0 -4
  62. package/smoke-tests.sh +0 -21
  63. package/spec/codec_spec.js +0 -224
  64. package/spec/configs/clean/infinispan.xml +0 -55
  65. package/spec/configs/infinispan-clustered.xml +0 -63
  66. package/spec/configs/infinispan-ssl.xml +0 -115
  67. package/spec/configs/infinispan-xsite-EARTH.xml +0 -191
  68. package/spec/configs/infinispan-xsite-MOON.xml +0 -193
  69. package/spec/configs/infinispan.xml +0 -77
  70. package/spec/functional_spec.js +0 -73
  71. package/spec/infinispan_auth_spec.js +0 -19
  72. package/spec/infinispan_cluster_spec.js +0 -176
  73. package/spec/infinispan_expiry_spec.js +0 -218
  74. package/spec/infinispan_failover_listener_spec.js +0 -52
  75. package/spec/infinispan_failover_spec.js +0 -63
  76. package/spec/infinispan_json_spec.js +0 -182
  77. package/spec/infinispan_local_spec.js +0 -354
  78. package/spec/infinispan_ssl_spec.js +0 -441
  79. package/spec/infinispan_stress_spec.js +0 -32
  80. package/spec/infinispan_xsite_spec.js +0 -99
  81. package/spec/protocols_spec.js +0 -82
  82. package/spec/protostream_spec.js +0 -237
  83. package/spec/tests.js +0 -28
  84. package/spec/utils/test-log4js.json +0 -14
  85. package/spec/utils/testing.js +0 -790
  86. package/spec/utils/typed-cachemanager-put-get.js +0 -3
  87. package/spec/utils/typed-null-return-dist.js +0 -2
  88. package/spec/utils/typed-null-return.js +0 -2
  89. package/spec/utils/typed-put-get-dist.js +0 -3
  90. package/spec/utils/typed-put-get-unicode.js +0 -3
  91. package/spec/utils/typed-put-get.js +0 -3
  92. package/spec/utils/typed-size.js +0 -2
  93. package/spec/utils_spec.js +0 -154
  94. package/spec-manual/infinispan_manual_stress_get_spec.js +0 -50
  95. package/spec-manual/infinispan_manual_stress_iterate_spec.js +0 -86
@@ -1,50 +0,0 @@
1
- var _ = require('underscore');
2
- var infinispan = require('../lib/infinispan');
3
- var helper = require('./helper');
4
-
5
- var connected = infinispan.client({port: 11222, host: '127.0.0.1'},{cacheName: 'namedCache'});
6
- console.log("Connected to JDG server");
7
- connected.then(function (client) {
8
- var key = "memory-one-get";
9
-
10
- var put= client.put(key, " test");
11
-
12
- return put.then(function() {
13
- var heapUseAfterPut = process.memoryUsage().heapUsed;
14
-
15
- var temp = [];
16
- var numOps = 10000; // 500000
17
-
18
- _.map(_.range(numOps), function(i) {
19
- temp.push(client.get(key).then(function(value) {
20
- console.log("[get] Value: " + value);
21
- }));
22
- });
23
-
24
- var ps = Promise.all(temp);
25
- var completed = ps.then(function() {
26
- global.gc();
27
- return process.memoryUsage().heapUsed;
28
- });
29
-
30
- temp = null;
31
- ps = null;
32
-
33
- return completed.then(function(heapAfterManyGets) {
34
- return client.get(key).then(function(value) {
35
- console.log("[after-gets] Value: " + value);
36
-
37
- global.gc();
38
- var heapAfterFinalGet = process.memoryUsage().heapUsed;
39
-
40
- console.log("After first put, heap used: " + heapUseAfterPut);
41
- console.log("After many gets, heap used: " + heapAfterManyGets);
42
- console.log("After final get, heap used: " + heapAfterFinalGet);
43
-
44
- return client.disconnect();
45
- });
46
- });
47
- });
48
- }).catch(function(err) {
49
- console.log("Error: " + err);
50
- });
@@ -1,56 +0,0 @@
1
- var _ = require('underscore');
2
- var infinispan = require('../lib/infinispan');
3
- var helper = require('./helper');
4
-
5
- const fs = require('fs');
6
- const v8 = require('v8');
7
-
8
- var connected = infinispan.client({port: 11222, host: '127.0.0.1'},{cacheName: 'namedCache'});
9
- console.log("Connected to JDG server");
10
- connected.then(function (client) {
11
- var key = "memory-one-get";
12
- var put = client.put(key, "test");
13
-
14
- var afterPut = put.then(function() {
15
- //console.log("After put, heapUsed: "+process.memoryUsage().heapUsed);
16
-
17
- helper.createHeapSnapshot();
18
- });
19
-
20
- var get1 = afterPut.then(function test_get1() {
21
- return client.get(key);
22
- });
23
-
24
- var logGet1 = get1.then(function test_log_get1(value) {
25
- console.log("[get1] value: " + value);
26
- });
27
-
28
- var dumpAfterGet1 = logGet1.then(function test_dump_after_get1() {
29
- global.gc();
30
- //console.log("After get1, heapUsed: "+process.memoryUsage().heapUsed);
31
-
32
- helper.createHeapSnapshot();
33
- });
34
-
35
- var get2 = dumpAfterGet1.then(function test_get2() {
36
- return client.get(key);
37
- });
38
-
39
- var logGet2 = get2.then(function test_log_get2(value) {
40
- console.log("[get2] value: " + value);
41
- });
42
-
43
- var dumpAfterGet2 = logGet2.then(function test_dump_after_get2() {
44
- global.gc();
45
- //console.log("After get2, heapUsed: "+process.memoryUsage().heapUsed);
46
-
47
- helper.createHeapSnapshot();
48
- });
49
-
50
- return dumpAfterGet2.then(function test_disconnect() {
51
- return client.disconnect();
52
- });
53
-
54
- }).catch(function(err) {
55
- console.log("connect error", err);
56
- });
package/release.sh DELETED
@@ -1,19 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- # Stop if any errors found
4
- set -e
5
-
6
- VERSION=$1
7
- API_URL=infinispan@filemgmt.jboss.org:/docs_htdocs/infinispan/hotrod-clients/javascript
8
-
9
- echo "Release $VERSION"
10
- npm install npm-release
11
- npm-release $VERSION
12
-
13
- echo "Generate JS API docs and upload"
14
- ./node_modules/.bin/jsdoc lib/*.js
15
- mv out apidocs
16
- mkdir 1.0
17
- mv apidocs 1.0
18
- rsync -rv --protocol=28 1.0 $API_URL
19
- mv 1.0 out
package/run-servers.sh DELETED
@@ -1,156 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- set -e
4
-
5
- if [[ $1 = "--ci" ]]; then
6
- echo "Launch script finished"
7
- else
8
- trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT
9
- fi
10
-
11
- SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
12
- SERVER_VERSION="${SERVER_VERSION:-"13.0.0.Final"}"
13
- SERVER_HOME=${SCRIPT_DIR}/server/original-server
14
- SERVER_ZIP=${SCRIPT_DIR}/server/${SERVER_VERSION}.zip
15
- CLUSTER_SIZE_MAIN="$SERVER_HOME/bin/cli.sh -c http://admin:pass@localhost:11322 -f batch "
16
- ZIP_ROOT="http://downloads.jboss.org/infinispan"
17
- DOWNLOAD_URL="${DOWNLOAD_URL:-"$ZIP_ROOT/$SERVER_VERSION/infinispan-server-$SERVER_VERSION.zip"}"
18
-
19
- CONF_DIR_TO_COPY_FROM="spec/configs/"
20
- IS_SSL_PROCESSED=0
21
- SERVER_DIR="infinispan-server"
22
-
23
- function waitForClusters()
24
- {
25
- cat > batch<<EOF
26
- describe
27
- disconnect
28
- EOF
29
-
30
- MEMBERS_MAIN=''
31
- while [ "$MEMBERS_MAIN" != '3' ];
32
- do
33
- MEMBERS_MAIN=$($CLUSTER_SIZE_MAIN | grep cluster_size | cut -d':' -f2 | sed 's/.$//' | sed -e 's/^[[:space:]]*//')
34
- echo "Waiting for clusters to form (main: $MEMBERS_MAIN)"
35
- sleep 20
36
- done
37
- }
38
-
39
- function prepareServerDir()
40
- {
41
- local isCi=$1
42
- local confPath=$2
43
- local isSsl=$3
44
- local dirName=${4}
45
-
46
- echo ${isSsl}
47
- if [ ! -f "${SERVER_ZIP}" ]; then
48
- cd server
49
- wget "${DOWNLOAD_URL}" -O "${SERVER_ZIP}" --no-check-certificate
50
- unzip "${SERVER_ZIP}"
51
-
52
- if [[ ${DOWNLOAD_URL} == *"redhat-datagrid"* ]]; then
53
- datagrid=$(cd "${SCRIPT_DIR}"/server/redhat-datagrid-*/; pwd)
54
- mv "$datagrid" "${SERVER_HOME}"
55
- else
56
- datagrid=$(cd "${SCRIPT_DIR}"/server/infinispan-server-*/; pwd)
57
- mv "$datagrid" "${SERVER_HOME}"
58
- fi
59
- cd ..
60
- fi
61
-
62
- if [[ -z "${SERVER_TMP}" ]]; then
63
- SERVER_TMP=server/${SERVER_DIR}
64
- mkdir ${SERVER_TMP} 2>/dev/null
65
- echo "Created temporary directory: $SERVER_TMP"
66
-
67
- cp -r ${SERVER_HOME}/* $SERVER_TMP
68
- echo "Server copied to temporary directory."
69
-
70
- $SERVER_TMP/bin/cli.sh user create admin -p pass
71
- echo "Admin user added."
72
- fi
73
-
74
- cp -r ${SERVER_HOME}/server ${SERVER_TMP}/${dirName}
75
- cp "${SERVER_TMP}/server/conf/users.properties" "${SERVER_TMP}/${dirName}/conf/users.properties"
76
- cp "${CONF_DIR_TO_COPY_FROM}/${confPath}" ${SERVER_TMP}/${dirName}/conf
77
- echo ${SERVER_TMP}
78
-
79
- echo "Infinispan configuration file ${confPath} copied to server ${dirName}."
80
-
81
- if [[ ${isSsl} = "true" && ${IS_SSL_PROCESSED} = 0 ]]; then
82
- ./make-ssl.sh
83
- echo "Generate TLS/SSL certificates"
84
-
85
- IS_SSL_PROCESSED=1
86
- fi
87
-
88
- if [[ ${isSsl} = "true" ]]; then
89
- cp out/ssl/ca/ca.p12 $SERVER_TMP/${dirName}/conf
90
- cp out/ssl/server/server.p12 $SERVER_TMP/${dirName}/conf
91
- cp out/ssl/client/client.p12 $SERVER_TMP/${dirName}/conf
92
- cp out/ssl/sni-trust1/trust1.p12 $SERVER_TMP/${dirName}/conf
93
- cp out/ssl/sni-trust2/trust2.p12 $SERVER_TMP/${dirName}/conf
94
- cp out/ssl/sni-untrust/untrust.p12 $SERVER_TMP/${dirName}/conf
95
- echo "Security key and trust stores copied to temporary server."
96
- fi
97
- export SERVER_TMP=${SERVER_TMP}
98
- }
99
-
100
- function startServer()
101
- {
102
- local isCi=$1
103
- local confPath=$2
104
- local isSsl=$3
105
- local port=${4}
106
- local nodeName=${5}
107
- local jvmParam=${6}
108
-
109
- prepareServerDir "${isCi}" ${confPath} ${isSsl} ${nodeName}
110
-
111
- if [[ ! -z ${port} ]]; then
112
- portStr="-p ${port}"
113
- fi
114
-
115
- echo 'Run server '$nodeName' in '$SERVER_TMP''
116
-
117
- if [[ ${isCi} = "--ci" ]]; then
118
- nohup $SERVER_TMP/bin/server.sh -Djavax.net.debug -Dorg.infinispan.openssl=false -c ${confPath} -s ${SERVER_TMP}/${nodeName} ${portStr:-""} --node-name=${nodeName} ${jvmParam:-} -Djgroups.bind.address=127.0.0.1 &
119
- else
120
- ${SERVER_TMP}/bin/server.sh -Djavax.net.debug -Dorg.infinispan.openssl=false -c ${confPath} -s ${SERVER_TMP}/${nodeName} ${portStr:-} --node-name=${nodeName} ${jvmParam:-} &
121
- fi
122
- }
123
-
124
- #deleting the testable server directory
125
- rm -drf server/${SERVER_DIR}
126
-
127
- export JAVA_OPTS="-Xms1024m -Xmx2048m -XX:MetaspaceSize=254M -XX:MaxMetaspaceSize=1024m"
128
-
129
- startServer "$1" infinispan.xml false 11222 "server-local"
130
- startServer "$1" infinispan-clustered.xml false 11322 "server-one"
131
- startServer "$1" infinispan-clustered.xml false 11332 "server-two"
132
- startServer "$1" infinispan-clustered.xml false 11342 "server-three"
133
- startServer "$1" infinispan-ssl.xml true 11622 "server-ssl"
134
-
135
- #Preparing server dirs for failover tests (3 servers)
136
- prepareServerDir "$1" infinispan-clustered.xml false "server-failover-one"
137
- prepareServerDir "$1" infinispan-clustered.xml false "server-failover-two"
138
- prepareServerDir "$1" infinispan-clustered.xml false "server-failover-three"
139
-
140
- #Preparing server dirs for xsite tests (2 servers)
141
- prepareServerDir "$1" infinispan-xsite-EARTH.xml false "server-earth"
142
- prepareServerDir "$1" infinispan-xsite-MOON.xml false "server-moon"
143
-
144
- waitForClusters
145
- echo "Infinispan test servers started."
146
-
147
-
148
- if [[ $1 = "--ci" ]]; then
149
- echo "Launch script finished"
150
- else
151
- # Wait until script stopped
152
- while :
153
- do
154
- sleep 5
155
- done
156
- fi
package/run-testsuite.sh DELETED
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- # Stop if any errors found
4
- set -e
5
-
6
- node --trace-deprecation node_modules/jasmine-node/lib/jasmine-node/cli.js spec/* --captureExceptions --forceexit --junitreport
package/server/.keep DELETED
File without changes
@@ -1,4 +0,0 @@
1
- #!/bin/bash
2
- cat << EOF > .npmrc
3
- //registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN
4
- EOF
package/smoke-tests.sh DELETED
@@ -1,21 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- rm -drf tmp-tests.log
4
-
5
- node \
6
- --trace-deprecation \
7
- node_modules/jasmine-node/lib/jasmine-node/cli.js \
8
- spec/codec_spec.js \
9
- spec/functional_spec.js \
10
- spec/infinispan_auth_spec.js \
11
- spec/infinispan_cluster_spec.js \
12
- spec/infinispan_expiry_spec.js \
13
- spec/infinispan_json_spec.js \
14
- spec/infinispan_local_spec.js \
15
- spec/infinispan_ssl_spec.js \
16
- spec/infinispan_stress_spec.js \
17
- spec/protocols_spec.js \
18
- spec/protostream_spec.js \
19
- spec/tests.js \
20
- spec/utils_spec.js \
21
- --captureExceptions --junitreport --forceexit
@@ -1,224 +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
- // Test functions
10
-
11
- var multiByteEncode = [codec.encodeUByte(0xA0), codec.encodeUByte(0xA1)];
12
- var multiByteDecode = [codec.decodeUByte(), codec.decodeUByte()];
13
- var multiBytes = [0xA0, 0xA1];
14
-
15
- var singleVIntEncode = function(num) { return codec.encodeVInt(num); };
16
- var singleVIntDecode = [codec.decodeVInt()];
17
-
18
- var singleVLongEncode = function(num) { return codec.encodeVLong(num); };
19
- var singleVLongDecode = [codec.decodeVLong()];
20
-
21
- var multiVNumEncode = function(num) { return [codec.encodeVInt(num), codec.encodeVLong(num)]; };
22
- var multiVNumDecode = [codec.decodeVInt(), codec.decodeVLong()];
23
-
24
- // Tests
25
-
26
- describe('Variable bytes decode', function() {
27
- it('can decode a variable sized byte array', function() {
28
- var bytes = Buffer.from([3, 49, 50, 51]);
29
- var actual = encodeDecode(4, codec.encodeBytes(bytes), codec.decodeVariableBytes(), 1);
30
- t.expectToBeBuffer(actual[0], Buffer.from([49, 50, 51]));
31
- });
32
- });
33
-
34
- describe('Signed number encode/decode', function() {
35
- it('can encode a negative numbers as positive ones', function() {
36
- assert(-2147483648, 5, codec.encodeSignedInt(-2147483648), codec.decodeSignedInt());
37
- assert(2147483647, 5, codec.encodeSignedInt(2147483647), codec.decodeSignedInt());
38
- assert(-2, 1, codec.encodeSignedInt(-2), codec.decodeSignedInt());
39
- assert(-1, 1, codec.encodeSignedInt(-1), codec.decodeSignedInt());
40
- assert(1, 1, codec.encodeSignedInt(1), codec.decodeSignedInt());
41
- assert(0, 1, codec.encodeSignedInt(0), codec.decodeSignedInt());
42
- });
43
- });
44
-
45
- describe('String encode/decode', function() {
46
- it('can encode a String', function() {
47
- assert('one', strSize('one'), codec.encodeString('one'), codec.decodeString());
48
- });
49
- it('can encode an undefined String with 0 length', function() {
50
- assert(0, 1, codec.encodeString(undefined), codec.decodeUByte());
51
- });
52
- it('can encode a String that fits exactly within buffer', function() {
53
- var str = t.randomStr(31);
54
- assert(str, 32, codec.encodeString(str), codec.decodeString(), 32);
55
- });
56
- it('can encode a String that needs expanding to include length', function() {
57
- // Length of String needs to be bigger than 8 bytes for expansion at String
58
- var str = t.randomStr(32);
59
- assert(str, 33, codec.encodeString(str), codec.decodeString(), 32);
60
- });
61
- });
62
-
63
- describe('Bytes encode/decode', function() {
64
- it('can resize buffer when encoding a number of Bytes', function() {
65
- var bytes = Buffer.from([48, 49, 50, 51, 52, 53, 54, 55]);
66
- var actual = encodeDecode(8, codec.encodeBytes(bytes), codec.decodeFixedBytes(8), 1);
67
- t.expectToBeBuffer(actual[0], bytes);
68
- });
69
- it('can encode a number of Bytes', function() {
70
- var bytes = Buffer.from([48, 49, 50, 51, 52, 53, 54, 55]);
71
- var actual = encodeDecode(8, codec.encodeBytes(bytes), codec.decodeFixedBytes(8));
72
- t.expectToBeBuffer(actual[0], bytes);
73
- });
74
- it('can encode Object + Bytes + Object', function() {
75
- var bytes = Buffer.from([48, 49, 50, 51, 52, 53, 54, 55]);
76
- var actual = encodeDecode(strSize('one') + 8 + strSize('one'),
77
- [codec.encodeString('one'), codec.encodeBytes(bytes), codec.encodeString('two')],
78
- [codec.decodeString(), codec.decodeFixedBytes(8), codec.decodeString()]);
79
- expect(actual[0]).toBe('one');
80
- t.expectToBeBuffer(actual[1], bytes);
81
- expect(actual[2]).toBe('two');
82
- });
83
- it('can encode a chain of Bytes => Object', function() {
84
- var bytes = Buffer.from([48, 49, 50, 51, 52, 53, 54, 55]);
85
- var actual = encodeDecode(8 + strSize('one'),
86
- [codec.encodeBytes(bytes), codec.encodeString('one')],
87
- [codec.decodeFixedBytes(8), codec.decodeString()]);
88
- t.expectToBeBuffer(actual[0], bytes);
89
- expect(actual[1]).toBe('one');
90
- });
91
- it('can encode a chain of Object => Bytes', function() {
92
- var bytes = Buffer.from([48, 49, 50, 51, 52, 53, 54, 55]);
93
- var actual = encodeDecode(8 + strSize('one'),
94
- [codec.encodeString('one'), codec.encodeBytes(bytes)],
95
- [codec.decodeString(), codec.decodeFixedBytes(8)]);
96
- expect(actual[0]).toBe('one');
97
- t.expectToBeBuffer(actual[1], bytes);
98
- });
99
- });
100
-
101
- describe('Object encode/decode', function() {
102
- it('can resize buffer when encoding a String', function() {
103
- assert('one two three four five six', strSize('one two three four five six'),
104
- codec.encodeString('one two three four five six'), codec.decodeString(), 1);
105
- });
106
- it('can encode a String', function() {
107
- assert('one', strSize('one'), codec.encodeString('one'), codec.decodeString());
108
- });
109
- it('can encode multiple Strings', function() {
110
- assert(['one', 'two'], strSize('one') + strSize('two'),
111
- [codec.encodeString('one'), codec.encodeString('two')],
112
- [codec.decodeString(), codec.decodeString()]);
113
- });
114
- });
115
-
116
- function strSize(str) {
117
- var len = Buffer.byteLength(str);
118
- return len + t.vNumSize(len);
119
- }
120
-
121
- describe('Variable number encode/decode', function() {
122
- it('can resize buffer when encoding a VInt', function() {
123
- assert(Math.pow(2, 32) - 1, 5, singleVIntEncode(Math.pow(2, 32) - 1), singleVIntDecode, 1);
124
- });
125
- it('can resize buffer when encoding a VLong', function() {
126
- assert(Math.pow(2, 53) - 1, 8, singleVLongEncode(Math.pow(2, 53) - 1), singleVLongDecode, 1);
127
- });
128
- it('can encode 0', function() { encodeDecodeVNum(0); });
129
- it('can encode 2^7 - 1', function() { encodeDecodeVNum(Math.pow(2, 7) - 1); });
130
- it('can encode 2^7', function() { encodeDecodeVNum(Math.pow(2, 7)); });
131
- it('can encode 2^14 - 1', function() { encodeDecodeVNum(Math.pow(2, 14) - 1); });
132
- it('can encode 2^14', function() { encodeDecodeVNum(Math.pow(2, 14)); });
133
- it('can encode 2^21 - 1', function() { encodeDecodeVNum(Math.pow(2, 21) - 1); });
134
- it('can encode 2^21', function() { encodeDecodeVNum(Math.pow(2, 21)); });
135
- it('can encode 2^28 - 1', function() { encodeDecodeVNum(Math.pow(2, 28) - 1); });
136
- it('can encode 2^28', function() { encodeDecodeVNum(Math.pow(2, 28)); });
137
- it('can encode 2^32 - 1', function() { encodeDecodeVNum(Math.pow(2, 32) - 1); });
138
- it('fails to encode 2^32 as a VInt because it is out of bounds', function() {
139
- var encode = f.actions([codec.encodeVInt(Math.pow(2, 32))], codec.bytesEncoded);
140
- expect(function() { encode(t.newByteBuf()) }).toThrow('must be less than 2^32');
141
- });
142
- it('can encode 2^32', function() { encodeDecodeVLong(Math.pow(2, 32)); });
143
- it('can encode 2^35 - 1', function() { encodeDecodeVLong(Math.pow(2, 35) - 1); });
144
- it('can encode 2^35', function() { encodeDecodeVLong(Math.pow(2, 35)); });
145
- it('can encode 2^42 - 1', function() { encodeDecodeVLong(Math.pow(2, 42) - 1); });
146
- it('can encode 2^42', function() { encodeDecodeVLong(Math.pow(2, 42)); });
147
- it('can encode 2^49 - 1', function() { encodeDecodeVLong(Math.pow(2, 49 - 1)); });
148
- it('can encode 2^49', function() { encodeDecodeVLong(Math.pow(2, 49)); });
149
- it('can encode 2^53 - 1', function() { encodeDecodeVLong(Math.pow(2, 53) - 1); });
150
- it('fails to encode 2^53 as a VLong because it is out of bounds', function() {
151
- var encode = f.actions([codec.encodeVLong(Math.pow(2, 53))], codec.bytesEncoded);
152
- expect(function() { encode(t.newByteBuf()) })
153
- .toThrow('must be less than 2^53 (javascript safe integer limitation)');
154
- });
155
- it('fails to encode a number when it is not a number', function() {
156
- var encode = f.actions([codec.encodeVInt('blah')], codec.bytesEncoded);
157
- expect(function() { encode(t.newByteBuf()) })
158
- .toThrow('must be a number, must be >= 0, must be less than 2^32');
159
- });
160
- it('fails to encode a number when it is negative', function() {
161
- var encode = f.actions([codec.encodeVInt(-1)], codec.bytesEncoded);
162
- expect(function() { encode(t.newByteBuf()) }).toThrow('must be >= 0');
163
- });
164
-
165
- function encodeDecodeVNum(num) {
166
- assert([num, num], t.vNumSize(num) * 2, multiVNumEncode(num), multiVNumDecode);
167
- }
168
- function encodeDecodeVLong(num) {
169
- assert(num, t.vNumSize(num), singleVLongEncode(num), singleVLongDecode);
170
- }
171
- });
172
-
173
- describe('Basic encode/decode', function() {
174
- it('can resize buffer multiple times to write numbers', function() {
175
- var numbers = [0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9];
176
- var encoders = _.map(numbers, function (num) { return codec.encodeUByte(num); });
177
- var decoders = _.map(numbers, function (num) { return codec.decodeUByte(); });
178
- var encodeActions = f.actions(encoders, codec.bytesEncoded);
179
- var decodeActions = f.actions(decoders, codec.allDecoded(10));
180
- var bytebuf = t.assertEncode(t.newByteBuf(1), encodeActions, 10);
181
- expect(decodeActions({buf: bytebuf.buf, offset: 0})).toEqual(numbers);
182
- });
183
- it('can resize buffer to write numbers', function() {
184
- assert(multiBytes, 2, multiByteEncode, multiByteDecode, 1);
185
- });
186
- it('fails to encode a byte when it is not a number', function() {
187
- var invalidByteEncode = f.actions([codec.encodeUByte('blah')], codec.bytesEncoded);
188
- expect(function() { invalidByteEncode(t.newByteBuf()) })
189
- .toThrow('must be a number, must be >= 0');
190
- });
191
- it('fails to encode a number when it is negative', function() {
192
- var encode = f.actions([codec.encodeUByte(-1)], codec.bytesEncoded);
193
- expect(function() { encode(t.newByteBuf()) }).toThrow('must be >= 0');
194
- });
195
- it('fails to encode a byte when the value is too big (256 or higher)', function() {
196
- var overLimitByteEncode = f.actions([codec.encodeUByte(0x100)], codec.bytesEncoded);
197
- expect(function() { overLimitByteEncode(t.newByteBuf()) }).toThrow();
198
- });
199
- it('fails to decode if past the buffer end', function() {
200
- var bytebuf = t.newByteBuf();
201
- expect(function() { f.actions([codec.decodeUByte()])(t.newByteBuf()) }).toThrow();
202
- });
203
- it('can encode a byte with limit value 255', function() {
204
- assert(0xFF, 1, codec.encodeUByte(0xFF), codec.decodeUByte());
205
- });
206
- it('can encode a multiple bytes with actions', function() {
207
- assert(multiBytes, 2, multiByteEncode, multiByteDecode);
208
- });
209
- it('can encode a single byte with actions', function() {
210
- assert(0xA0, 1, codec.encodeUByte(0xA0), codec.decodeUByte());
211
- });
212
- });
213
-
214
- function assert(expected, size, encoder, decoder, bufferSize) {
215
- var ret = encodeDecode(size, encoder, decoder, bufferSize);
216
- expect(ret).toEqual(_.isArray(expected) ? expected : [expected]);
217
- }
218
-
219
- function encodeDecode(size, encoder, decoder, bufferSize) {
220
- var enc = f.actions(_.isArray(encoder) ? encoder : [encoder], codec.bytesEncoded);
221
- var bytebuf = t.assertEncode(t.newByteBuf(bufferSize), enc, size);
222
- var dec = f.actions(_.isArray(decoder) ? decoder : [decoder], codec.allDecoded(decoder.length));
223
- return dec({buf: bytebuf.buf, offset: 0});
224
- }
@@ -1,55 +0,0 @@
1
- <infinispan
2
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3
- xsi:schemaLocation="urn:infinispan:config:12.0 http://www.infinispan.org/schemas/infinispan-config-12.0.xsd
4
- urn:infinispan:server:12.0 http://www.infinispan.org/schemas/infinispan-server-12.0.xsd"
5
- xmlns="urn:infinispan:config:12.0"
6
- xmlns:server="urn:infinispan:server:12.0">
7
-
8
- <cache-container>
9
- <transport cluster="${infinispan.cluster.name}" stack="${infinispan.cluster.stack:tcp}"/>
10
- </cache-container>
11
-
12
- <server xmlns="urn:infinispan:server:12.0">
13
- <interfaces>
14
- <interface name="public">
15
- <inet-address value="${infinispan.bind.address:127.0.0.1}"/>
16
- </interface>
17
- </interfaces>
18
-
19
- <socket-bindings default-interface="public" port-offset="${infinispan.socket.binding.port-offset:0}">
20
- <socket-binding name="default" port="${infinispan.bind.port:11222}"/>
21
- <socket-binding name="memcached" port="11221"/>
22
- </socket-bindings>
23
-
24
- <security>
25
- <security-realms>
26
- <security-realm name="default">
27
- <!-- Uncomment to enable TLS on the realm -->
28
- <!-- server-identities>
29
- <ssl>
30
- <keystore path="application.keystore" relative-to="infinispan.server.config.path"
31
- keystore-password="password" alias="server" key-password="password"
32
- generate-self-signed-certificate-host="localhost"/>
33
- </ssl>
34
- </server-identities-->
35
- <properties-realm groups-attribute="Roles">
36
- <user-properties path="users.properties" relative-to="infinispan.server.config.path" plain-text="true"/>
37
- <group-properties path="groups.properties" relative-to="infinispan.server.config.path" />
38
- </properties-realm>
39
- </security-realm>
40
- </security-realms>
41
- </security>
42
-
43
- <endpoints socket-binding="default" security-realm="default">
44
- <hotrod-connector name="hotrod">
45
- <authentication>
46
- <sasl mechanisms="PLAIN"
47
- server-name="infinispan"/>
48
- </authentication>
49
- </hotrod-connector>
50
- <rest-connector name="rest"/>
51
- <!-- Uncomment to enable the memcached connector -->
52
- <!-- memcached-connector socket-binding="memcached" / -->
53
- </endpoints>
54
- </server>
55
- </infinispan>
@@ -1,63 +0,0 @@
1
- <infinispan
2
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3
- xsi:schemaLocation="urn:infinispan:config:13.0 https://infinispan.org/schemas/infinispan-config-13.0.xsd
4
- urn:infinispan:server:13.0 https://infinispan.org/schemas/infinispan-server-13.0.xsd"
5
- xmlns="urn:infinispan:config:13.0"
6
- xmlns:server="urn:infinispan:server:13.0">
7
-
8
- <cache-container name="clustered" default-cache="default">
9
- <!-- <security>-->
10
- <!-- <authorization/>-->
11
- <!-- </security>-->
12
- <transport cluster="${infinispan.cluster.name}" stack="${infinispan.cluster.stack:tcp}" node-name="${infinispan.node.name:}"/>
13
- <!--<global-state/>-->
14
- <metrics accurate-size="true"/>
15
- <distributed-cache name="default" segments="20" remote-timeout="30000">
16
- <locking acquire-timeout="30000" concurrency-level="1000" />
17
- <encoding media-type="text/plain"/>
18
- </distributed-cache>
19
- </cache-container>
20
-
21
- <server xmlns="urn:infinispan:server:13.0">
22
- <interfaces>
23
- <interface name="public">
24
- <inet-address value="${infinispan.bind.address:127.0.0.1}"/>
25
- </interface>
26
- </interfaces>
27
-
28
- <socket-bindings default-interface="public" port-offset="${infinispan.socket.binding.port-offset:0}">
29
- <socket-binding name="default" port="${infinispan.bind.port:11222}"/>
30
- </socket-bindings>
31
-
32
- <security>
33
- <security-realms>
34
- <security-realm name="default">
35
- <!-- Uncomment to enable TLS on the realm -->
36
- <!-- server-identities>
37
- <ssl>
38
- <keystore path="application.keystore" relative-to="infinispan.server.config.path"
39
- keystore-password="password" alias="server" key-password="password"
40
- generate-self-signed-certificate-host="localhost"/>
41
- </ssl>
42
- </server-identities-->
43
- <properties-realm groups-attribute="Roles">
44
- <user-properties path="users.properties" relative-to="infinispan.server.config.path" plain-text="true"/>
45
- <group-properties path="groups.properties" relative-to="infinispan.server.config.path" />
46
- </properties-realm>
47
- </security-realm>
48
- </security-realms>
49
- </security>
50
-
51
- <endpoints>
52
- <endpoint socket-binding="default" security-realm="default">
53
- <hotrod-connector name="hotrod">
54
- <authentication>
55
- <sasl mechanisms="PLAIN"
56
- server-name="infinispan"/>
57
- </authentication>
58
- </hotrod-connector>
59
- <rest-connector name="rest"/>
60
- </endpoint>
61
- </endpoints>
62
- </server>
63
- </infinispan>