infinispan 0.12.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 (94) hide show
  1. package/README.md +1 -1
  2. package/package.json +7 -6
  3. package/.eslintrc +0 -25
  4. package/.flowconfig +0 -6
  5. package/Jenkinsfile +0 -50
  6. package/Jenkinsfile-release +0 -63
  7. package/documentation/asciidoc/stories/assembly_client_usage_examples.adoc +0 -10
  8. package/documentation/asciidoc/stories/assembly_installation_configuration.adoc +0 -20
  9. package/documentation/asciidoc/titles/js_client.asciidoc +0 -28
  10. package/documentation/asciidoc/titles/stories.adoc +0 -5
  11. package/documentation/asciidoc/topics/attributes/community-attributes.adoc +0 -9
  12. package/documentation/asciidoc/topics/attributes/downstream-attributes.adoc +0 -2
  13. package/documentation/asciidoc/topics/code_examples/authentication-digest.js +0 -12
  14. package/documentation/asciidoc/topics/code_examples/authentication-external.js +0 -15
  15. package/documentation/asciidoc/topics/code_examples/authentication-oauthbearer.js +0 -10
  16. package/documentation/asciidoc/topics/code_examples/authentication-plain.js +0 -11
  17. package/documentation/asciidoc/topics/code_examples/authentication-scram.js +0 -11
  18. package/documentation/asciidoc/topics/code_examples/await-multiple-entries.js +0 -36
  19. package/documentation/asciidoc/topics/code_examples/await-single-entries.js +0 -29
  20. package/documentation/asciidoc/topics/code_examples/conditional-operations.js +0 -57
  21. package/documentation/asciidoc/topics/code_examples/connection-multiple-servers.js +0 -23
  22. package/documentation/asciidoc/topics/code_examples/connection-xsite-cluster-switch.js +0 -39
  23. package/documentation/asciidoc/topics/code_examples/connection-xsite.js +0 -13
  24. package/documentation/asciidoc/topics/code_examples/data-types.js +0 -30
  25. package/documentation/asciidoc/topics/code_examples/encryption-crypto-store.js +0 -11
  26. package/documentation/asciidoc/topics/code_examples/encryption-private-key.js +0 -13
  27. package/documentation/asciidoc/topics/code_examples/encryption-sni-hostname.js +0 -9
  28. package/documentation/asciidoc/topics/code_examples/encryption-trust-certs.js +0 -8
  29. package/documentation/asciidoc/topics/code_examples/ephemeral-data.js +0 -52
  30. package/documentation/asciidoc/topics/code_examples/hello-world.js +0 -42
  31. package/documentation/asciidoc/topics/code_examples/key-value-converter.js +0 -67
  32. package/documentation/asciidoc/topics/code_examples/logging-configuration.js +0 -2
  33. package/documentation/asciidoc/topics/code_examples/multiple-entries.js +0 -64
  34. package/documentation/asciidoc/topics/code_examples/queries.js +0 -92
  35. package/documentation/asciidoc/topics/code_examples/register-event-listener.js +0 -64
  36. package/documentation/asciidoc/topics/code_examples/sample-script-execute.js +0 -33
  37. package/documentation/asciidoc/topics/code_examples/sample-script.js +0 -3
  38. package/documentation/asciidoc/topics/code_examples/single-entries.js +0 -49
  39. package/documentation/asciidoc/topics/config_examples/logging.json +0 -14
  40. package/documentation/asciidoc/topics/proc_configuring_authentication.adoc +0 -16
  41. package/documentation/asciidoc/topics/proc_configuring_connections.adoc +0 -25
  42. package/documentation/asciidoc/topics/proc_configuring_connections_xsite.adoc +0 -18
  43. package/documentation/asciidoc/topics/proc_configuring_data_formats.adoc +0 -30
  44. package/documentation/asciidoc/topics/proc_configuring_encryption.adoc +0 -15
  45. package/documentation/asciidoc/topics/proc_configuring_logging.adoc +0 -28
  46. package/documentation/asciidoc/topics/proc_installing_clients.adoc +0 -58
  47. package/documentation/asciidoc/topics/proc_switching_clusters.adoc +0 -17
  48. package/documentation/asciidoc/topics/ref_authentication_mechanisms.adoc +0 -68
  49. package/documentation/asciidoc/topics/ref_client_usage.adoc +0 -128
  50. package/documentation/asciidoc/topics/ref_encryption.adoc +0 -71
  51. package/gen-jsdoc.sh +0 -6
  52. package/make-ssl.sh +0 -335
  53. package/memory-profiling/helper.js +0 -9
  54. package/memory-profiling/infinispan_memory_many_get.js +0 -50
  55. package/memory-profiling/infinispan_memory_one_get.js +0 -56
  56. package/release.sh +0 -19
  57. package/run-servers.sh +0 -171
  58. package/run-testsuite.sh +0 -6
  59. package/server/.keep +0 -0
  60. package/set-npm-auth-token.sh +0 -4
  61. package/smoke-tests.sh +0 -21
  62. package/spec/codec_spec.js +0 -224
  63. package/spec/configs/clean/infinispan.xml +0 -55
  64. package/spec/configs/infinispan-clustered.xml +0 -63
  65. package/spec/configs/infinispan-ssl.xml +0 -115
  66. package/spec/configs/infinispan-xsite-EARTH.xml +0 -187
  67. package/spec/configs/infinispan-xsite-MOON.xml +0 -189
  68. package/spec/configs/infinispan.xml +0 -77
  69. package/spec/functional_spec.js +0 -73
  70. package/spec/infinispan_auth_spec.js +0 -19
  71. package/spec/infinispan_cluster_spec.js +0 -176
  72. package/spec/infinispan_expiry_spec.js +0 -218
  73. package/spec/infinispan_failover_listener_spec.js +0 -52
  74. package/spec/infinispan_failover_spec.js +0 -63
  75. package/spec/infinispan_json_spec.js +0 -182
  76. package/spec/infinispan_local_spec.js +0 -354
  77. package/spec/infinispan_ssl_spec.js +0 -442
  78. package/spec/infinispan_stress_spec.js +0 -32
  79. package/spec/infinispan_xsite_spec.js +0 -99
  80. package/spec/protocols_spec.js +0 -82
  81. package/spec/protostream_spec.js +0 -237
  82. package/spec/tests.js +0 -28
  83. package/spec/utils/test-log4js.json +0 -14
  84. package/spec/utils/testing.js +0 -762
  85. package/spec/utils/typed-cachemanager-put-get.js +0 -3
  86. package/spec/utils/typed-null-return-dist.js +0 -2
  87. package/spec/utils/typed-null-return.js +0 -2
  88. package/spec/utils/typed-put-get-dist.js +0 -3
  89. package/spec/utils/typed-put-get-unicode.js +0 -3
  90. package/spec/utils/typed-put-get.js +0 -3
  91. package/spec/utils/typed-size.js +0 -2
  92. package/spec/utils_spec.js +0 -154
  93. package/spec-manual/infinispan_manual_stress_get_spec.js +0 -50
  94. 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,171 +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:-"14.0.27.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
- echo $CLUSTER_SIZE_MAIN
34
- MEMBERS_MAIN=$($CLUSTER_SIZE_MAIN | grep cluster_size | cut -d':' -f2 | sed 's/.$//' | sed -e 's/^[[:space:]]*//')
35
- echo "Waiting for clusters to form (main: $MEMBERS_MAIN)"
36
- sleep 20
37
- done
38
- }
39
-
40
- function prepareServerDir()
41
- {
42
- local isCi=$1
43
- local confPath=$2
44
- local isSsl=$3
45
- local dirName=${4}
46
-
47
- echo ${isSsl}
48
- if [ ! -f "${SERVER_ZIP}" ]; then
49
- cd server
50
- wget "${DOWNLOAD_URL}" -O "${SERVER_ZIP}" --no-check-certificate
51
- unzip "${SERVER_ZIP}"
52
-
53
- if [[ ${DOWNLOAD_URL} == *"redhat-datagrid"* ]]; then
54
- datagrid=$(cd "${SCRIPT_DIR}"/server/redhat-datagrid-*/; pwd)
55
- mv "$datagrid" "${SERVER_HOME}"
56
- else
57
- datagrid=$(cd "${SCRIPT_DIR}"/server/infinispan-server-*/; pwd)
58
- mv "$datagrid" "${SERVER_HOME}"
59
- fi
60
- cd ..
61
- fi
62
-
63
- if [[ -z "${SERVER_TMP}" ]]; then
64
- SERVER_TMP=server/${SERVER_DIR}
65
- mkdir ${SERVER_TMP} 2>/dev/null
66
- echo "Created temporary directory: $SERVER_TMP"
67
-
68
- cp -r ${SERVER_HOME}/* $SERVER_TMP
69
- echo "Server copied to temporary directory."
70
-
71
- $SERVER_TMP/bin/cli.sh user create admin -p pass
72
- echo "Admin user added."
73
- fi
74
-
75
- cp -r ${SERVER_HOME}/server ${SERVER_TMP}/${dirName}
76
- cp "${SERVER_TMP}/server/conf/users.properties" "${SERVER_TMP}/${dirName}/conf/users.properties"
77
- cp "${CONF_DIR_TO_COPY_FROM}/${confPath}" ${SERVER_TMP}/${dirName}/conf
78
- echo ${SERVER_TMP}
79
-
80
- echo "Infinispan configuration file ${confPath} copied to server ${dirName}."
81
-
82
- #Installing nashorn engine before server startup
83
- # If java > 15
84
- if [ $(javap -verbose java.lang.String | grep "major version" | cut -d " " -f5) -ge 60 ]; then
85
- mkdir -p ${SERVER_TMP}/${dirName}/lib
86
- ${SERVER_TMP}/bin/cli.sh install org.openjdk.nashorn:nashorn-core:15.4 --server-root=${dirName}
87
- ${SERVER_TMP}/bin/cli.sh install org.ow2.asm:asm:9.4 --server-root=${dirName}
88
- ${SERVER_TMP}/bin/cli.sh install org.ow2.asm:asm-commons:9.4 --server-root=${dirName}
89
- ${SERVER_TMP}/bin/cli.sh install org.ow2.asm:asm-tree:9.4 --server-root=${dirName}
90
- ${SERVER_TMP}/bin/cli.sh install org.ow2.asm:asm-util:9.4 --server-root=${dirName}
91
- echo Nashorn script engine installed for ${dirName}
92
- fi
93
-
94
- if [[ ${isSsl} = "true" && ${IS_SSL_PROCESSED} = 0 ]]; then
95
- ./make-ssl.sh
96
- echo "Generate TLS/SSL certificates"
97
-
98
- IS_SSL_PROCESSED=1
99
- fi
100
-
101
- if [[ ${isSsl} = "true" ]]; then
102
- cp out/ssl/ca/ca.p12 $SERVER_TMP/${dirName}/conf
103
- cp out/ssl/server/server.p12 $SERVER_TMP/${dirName}/conf
104
- cp out/ssl/client/client.p12 $SERVER_TMP/${dirName}/conf
105
- cp out/ssl/sni-trust1/trust1.p12 $SERVER_TMP/${dirName}/conf
106
- cp out/ssl/sni-trust2/trust2.p12 $SERVER_TMP/${dirName}/conf
107
- cp out/ssl/sni-untrust/untrust.p12 $SERVER_TMP/${dirName}/conf
108
- echo "Security key and trust stores copied to temporary server."
109
- fi
110
- export SERVER_TMP=${SERVER_TMP}
111
- }
112
-
113
- function startServer()
114
- {
115
- local isCi=$1
116
- local confPath=$2
117
- local isSsl=$3
118
- local port=${4}
119
- local nodeName=${5}
120
- local jvmParam=${6}
121
-
122
- prepareServerDir "${isCi}" ${confPath} ${isSsl} ${nodeName}
123
-
124
- if [[ ! -z ${port} ]]; then
125
- portStr="-p ${port}"
126
- fi
127
-
128
- echo 'Cleaning data dir in '$SERVER_TMP''
129
- rm -rf $SERVER_TMP/data/*
130
- echo 'Run server '$nodeName' in '$SERVER_TMP''
131
-
132
- if [[ ${isCi} = "--ci" ]]; then
133
- 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 &
134
- else
135
- ${SERVER_TMP}/bin/server.sh -Djavax.net.debug -Dorg.infinispan.openssl=false -c ${confPath} -s ${SERVER_TMP}/${nodeName} ${portStr:-} --node-name=${nodeName} ${jvmParam:-} &
136
- fi
137
- }
138
-
139
- #deleting the testable server directory
140
- rm -drf server/${SERVER_DIR}
141
-
142
- export JAVA_OPTS="-Xms1024m -Xmx2048m -XX:MetaspaceSize=254M -XX:MaxMetaspaceSize=1024m"
143
-
144
- startServer "$1" infinispan.xml false 11222 "server-local"
145
- startServer "$1" infinispan-clustered.xml false 11322 "server-one"
146
- startServer "$1" infinispan-clustered.xml false 11332 "server-two"
147
- startServer "$1" infinispan-clustered.xml false 11342 "server-three"
148
- startServer "$1" infinispan-ssl.xml true 11622 "server-ssl"
149
-
150
- #Preparing server dirs for failover tests (3 servers)
151
- prepareServerDir "$1" infinispan-clustered.xml false "server-failover-one"
152
- prepareServerDir "$1" infinispan-clustered.xml false "server-failover-two"
153
- prepareServerDir "$1" infinispan-clustered.xml false "server-failover-three"
154
-
155
- #Preparing server dirs for xsite tests (2 servers)
156
- prepareServerDir "$1" infinispan-xsite-EARTH.xml false "server-earth"
157
- prepareServerDir "$1" infinispan-xsite-MOON.xml false "server-moon"
158
-
159
- waitForClusters
160
- echo "Infinispan test servers started."
161
-
162
-
163
- if [[ $1 = "--ci" ]]; then
164
- echo "Launch script finished"
165
- else
166
- # Wait until script stopped
167
- while :
168
- do
169
- sleep 5
170
- done
171
- 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:cluster}" 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
- 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>