Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions .crossbar/key.priv

This file was deleted.

9 changes: 0 additions & 9 deletions .crossbar/key.pub

This file was deleted.

21 changes: 10 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
name: Autobahn JS CI

on:
workflow_dispatch:
push:
branches:
- master
- $default-branch
pull_request:
branches:
- master
- $default-branch

jobs:
unittest:
Expand All @@ -16,13 +17,12 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
# https://de.wikipedia.org/wiki/Node.js#Versionen
node: ['14', '18', '19']
node: [lts/-2, lts/-1, lts/*]

name: Node ${{ matrix.node }} run
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}

Expand All @@ -34,11 +34,10 @@ jobs:

- name: Install dependencies
run: |
sudo apt update
sudo npm install -g nodeunit
sudo pip3 install --no-cache-dir -U scons boto taschenmesser
cd packages/autobahn
npm install

- name: Run tests
run: |
cd packages/autobahn && npm install
make test
cd packages/autobahn
npm run test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ package/.crossbar/
package-lock.json
packages/autobahn-xbr/lib/contracts/
packages/autobahn-xbr/contracts/
packages/autobahn/coverage/
13 changes: 13 additions & 0 deletions packages/autobahn/.c8rc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"all": true,
"sourceMap": false,
"include": [
"lib/**/*.js"
],
"report-dir": "./coverage",
"temp-dir": "./coverage",
"reporter": [
"lcov",
"text-summary"
]
}
2 changes: 0 additions & 2 deletions packages/autobahn/lib/log.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ if ('console' in global) {
}
}

console.log('Sdfsdf');

// write debug messages to tracefile if AUTOBAHN_TRACE is set as environment variable - only works on NodeJS
if ('process' in global && process.env.AUTOBAHN_TRACE) {
debug = function () {
Expand Down
2 changes: 2 additions & 0 deletions packages/autobahn/lib/transport/rawsocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ Factory.prototype.create = function () {

var self = this;

log.debug("rawsocket.Factory.create");

// the WAMP transport we create
var transport = {};

Expand Down
3 changes: 3 additions & 0 deletions packages/autobahn/lib/transport/websocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ function Factory (options) {
if (!options.protocols) {
options.protocols = [];
options.serializers.forEach(function (ser) {
util.assert(typeof ser.SERIALIZER_ID === "string", "options.serializers[].SERIALIZER_ID must be a string");
options.protocols.push("wamp.2." + ser.SERIALIZER_ID);
});
} else {
Expand Down Expand Up @@ -71,6 +72,8 @@ Factory.prototype.create = function () {

var self = this;

log.debug("websocket.Factory.create");

// the WAMP transport we create
var transport = {};

Expand Down
4 changes: 3 additions & 1 deletion packages/autobahn/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"/lib"
],
"scripts": {
"test": "nodeunit test/test.js"
"test": "nodeunit test/test.js",
"test:coverage": "c8 nodeunit test/test.js"
},
"engines": {
"node": ">= 7.10.1"
Expand All @@ -22,6 +23,7 @@
},
"optionalDependencies": {
"bufferutil": ">= 1.2.1",
"c8": "^8.0.1",
"utf-8-validate": ">= 1.2.1",
"when": ">= 3.7.7"
},
Expand Down
7 changes: 6 additions & 1 deletion packages/autobahn/test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ Tests run using NodeJS and the nodeunit package.

First, ensure that a Crossbar.io instance is running with the default configuration (use `crossbar init` if needed). This will run a WAMP-over-WebSocket transport at `ws://localhost:8080/ws`.

> You should be able to use any compliant WAMP router (on `ws://localhost:8080/ws`) - your mileage may vary though.
> You should be able to use any compliant WAMP router (on `ws://localhost:8080/ws`) - your mileage may vary though.

The easiest way is to use Docker (in the root directory of the repository):
```console
docker run -it -v $PWD/.crossbar:/node -p 8080:8080 -p 8090:8090 -u $UID crossbario/crossbar --cbdir /node
```

Then, open a terminal and run `npm test` in the `package` directory.

Expand Down
4 changes: 2 additions & 2 deletions packages/autobahn/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ exports.testCBORSerialization = serialization_cbor.testCBORSerialization;
exports.testCBORLargePayload = serialization_cbor.testCBORLargePayload;

exports.testBinaryCBOR = binary.testBinaryCBOR;
// exports.testBinaryMsgPack = binary.testBinaryMsgPack;
// exports.testBinaryJSON = binary.testBinaryJSON;
exports.testBinaryMsgPack = binary.testBinaryMsgPack;
exports.testBinaryJSON = binary.testBinaryJSON;

exports.testRawSocketTransport = rawsocket_transport.testRawSocketTransport;

Expand Down
19 changes: 7 additions & 12 deletions packages/autobahn/test/test_binary.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ function run_test (test, ser) {
var done = autobahn.when.defer();

var config = {
//url: testutil.config.url,
url: "ws://127.0.0.1:8090",
url: testutil.config.url,
realm: testutil.config.realm,
serializers: [ser]
};
Expand Down Expand Up @@ -71,14 +70,6 @@ function run_test (test, ser) {
{a: 5, b: "hello2", c: [1, 2, 3]},
[-9007199254740991, 9007199254740991],
null,
// UTC of today
BigInt('1558266424841951553'),
// 2**255-1 : NotImplementedError TODO: TAG BIGNUM for bigger bignum bytes_info=24, len(ull)=8
// BigInt('57896044618658097711785492504343953926634992332820282019728792003956564819967'),
BigInt('340282366920938463463374607431768211455'),
Uint8Array.from([0, 1, 2, 3, 4, 5, 6, 7]),
randomBytes(32),
{a: 5, b: "hello2", c: randomBytes(32)}
];

for (var i = 0; i < vals1.length; ++i) {
Expand Down Expand Up @@ -144,7 +135,11 @@ function run_test (test, ser) {
function () {
test.log("Registration failed!", arguments);
}
);
)
.catch(function (error) {
connection.close();
done.reject(error);
});
};

connection.open();
Expand Down Expand Up @@ -192,7 +187,7 @@ exports.testBinaryJSON = function (testcase) {

var dl = [];

dl.push(run_test(testcase, test, new autobahn.serializer.JSONSerializer()));
dl.push(run_test(test, new autobahn.serializer.JSONSerializer()));

autobahn.when.all(dl).then(function () {
var chk = test.check();
Expand Down
36 changes: 10 additions & 26 deletions packages/autobahn/test/test_binary_cbor.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,13 @@
9 " c, 1,2,3"
10 "Result [com.myapp.echo]: -9007199254740991,9007199254740991"
11 "Result [com.myapp.echo]: null"
12 "Result [com.myapp.echo]: 1558266424841951553"
13 "Result [com.myapp.echo]: 340282366920938463463374607431768211455"
14 "Result [com.myapp.echo]: 0,1,2,3,4,5,6,7"
15 "Result [com.myapp.echo]: 8f44d509e0492acec4fc109a030a5c751f063fb743cc388f0ed722bacc3bc66c"
16 "Result [com.myapp.echo]:"
17 " a, 5"
18 " b, hello2"
19 " c, 035e7711c8da2e9434aab5039dc3d72046dee4e57af0e957e948fbbad15e48f8"
20 "Result [any.echo]: 1.7"
21 "Result [any.echo]: hello"
22 "Result [any.echo]: 1,2,-3"
23 "Result [any.echo]:"
24 " a, 5"
25 " b, hello2"
26 " c, 1,2,3"
27 "Result [any.echo]: -9007199254740991,9007199254740991"
28 "Result [any.echo]: null"
29 "Result [any.echo]: 1558266424841951553"
30 "Result [any.echo]: 340282366920938463463374607431768211455"
31 "Result [any.echo]: 0,1,2,3,4,5,6,7"
32 "Result [any.echo]: 8f44d509e0492acec4fc109a030a5c751f063fb743cc388f0ed722bacc3bc66c"
33 "Result [any.echo]:"
34 " a, 5"
35 " b, hello2"
36 " c, 035e7711c8da2e9434aab5039dc3d72046dee4e57af0e957e948fbbad15e48f8"
37 "All finished."
12 "Result [any.echo]: 1.7"
13 "Result [any.echo]: hello"
14 "Result [any.echo]: 1,2,-3"
15 "Result [any.echo]:"
16 " a, 5"
17 " b, hello2"
18 " c, 1,2,3"
19 "Result [any.echo]: -9007199254740991,9007199254740991"
20 "Result [any.echo]: null"
21 "All finished."
22 changes: 22 additions & 0 deletions packages/autobahn/test/test_binary_json.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
0 "Connected: wamp.2.json"
1 "All registered."
2 "Serializer ID: json"
3 "Result [com.myapp.echo]: 1.7"
4 "Result [com.myapp.echo]: hello"
5 "Result [com.myapp.echo]: 1,2,-3"
6 "Result [com.myapp.echo]:"
7 " a, 5"
8 " b, hello2"
9 " c, 1,2,3"
10 "Result [com.myapp.echo]: -9007199254740991,9007199254740991"
11 "Result [com.myapp.echo]: null"
12 "Result [any.echo]: 1.7"
13 "Result [any.echo]: hello"
14 "Result [any.echo]: 1,2,-3"
15 "Result [any.echo]:"
16 " a, 5"
17 " b, hello2"
18 " c, 1,2,3"
19 "Result [any.echo]: -9007199254740991,9007199254740991"
20 "Result [any.echo]: null"
21 "All finished."
22 changes: 22 additions & 0 deletions packages/autobahn/test/test_binary_msgpack.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
0 "Connected: wamp.2.msgpack"
1 "All registered."
2 "Serializer ID: msgpack"
3 "Result [com.myapp.echo]: 1.7"
4 "Result [com.myapp.echo]: hello"
5 "Result [com.myapp.echo]: 1,2,-3"
6 "Result [com.myapp.echo]:"
7 " a, 5"
8 " b, hello2"
9 " c, 1,2,3"
10 "Result [com.myapp.echo]: -9007199254740991,9007199254740991"
11 "Result [com.myapp.echo]: null"
12 "Result [any.echo]: 1.7"
13 "Result [any.echo]: hello"
14 "Result [any.echo]: 1,2,-3"
15 "Result [any.echo]:"
16 " a, 5"
17 " b, hello2"
18 " c, 1,2,3"
19 "Result [any.echo]: -9007199254740991,9007199254740991"
20 "Result [any.echo]: null"
21 "All finished."