#2486 Updated wamp test project to work with the latest Crossbar version. #2486
authordporopat <denis.poropat@smarteh.si>
Tue, 27 Mar 2018 10:11:04 +0200
branch#2486
changeset 2194 35d6b9321ffd
parent 2193 259df9ecf9ca
child 2195 2cef75d036c2
#2486 Updated wamp test project to work with the latest Crossbar version.
runtime/WampClient.py
tests/wamp/.crossbar/config.json
tests/wamp/README
tests/wamp/beremiz.xml
tests/wamp/py_ext_0@py_ext/baseconfnode.xml
tests/wamp/py_ext_0@py_ext/pyfile.xml
--- a/runtime/WampClient.py	Mon Mar 19 12:18:07 2018 +0100
+++ b/runtime/WampClient.py	Tue Mar 27 10:11:04 2018 +0200
@@ -73,7 +73,7 @@
 class WampSession(wamp.ApplicationSession):
     def onConnect(self):
         if "secret" in self.config.extra:
-            user = self.config.extra["ID"].encode('utf8')
+            user = self.config.extra["ID"]
             self.join(u"Automation", [u"wampcra"], user)
         else:
             self.join(u"Automation")
@@ -91,7 +91,6 @@
         global _WampSession
         _WampSession = self
         ID = self.config.extra["ID"]
-        print('WAMP session joined by :', ID)
         for name in ExposedCalls:
             regoption = types.RegisterOptions(u'exact', u'last')
             yield self.register(GetCallee(name), u'.'.join((ID, name)), regoption)
@@ -102,6 +101,8 @@
         for func in DoOnJoin:
             yield func(self)
 
+        print(_('WAMP session joined (%s) by:' % time.ctime()), ID)
+
     def onLeave(self, details):
         global _WampSession
         _WampSession = None
--- a/tests/wamp/.crossbar/config.json	Mon Mar 19 12:18:07 2018 +0100
+++ b/tests/wamp/.crossbar/config.json	Tue Mar 27 10:11:04 2018 +0200
@@ -39,13 +39,15 @@
             "transports": [
                 {
                     "type": "websocket",
+                    "debug": true,
                     "endpoint": {
                         "type": "tcp",
                         "port": 8888
                     },
                     "url": "ws://127.0.0.1:8888/",
                     "serializers": [
-                        "msgpack"
+                        "msgpack",
+                        "json"
                     ]
                 }
             ]
--- a/tests/wamp/README	Mon Mar 19 12:18:07 2018 +0100
+++ b/tests/wamp/README	Tue Mar 27 10:11:04 2018 +0200
@@ -1,25 +1,26 @@
-Crossbar test router configuration is available in .crossbar directory.
-
-Starting command:
-crossbar start
-
-This project contains wamp client config to be loaded at runtime startup.
-
-project_files/wampconf.json
+/* This project contains wamp client config to be loaded at runtime startup. */
+./project_files/wampconf.json
 
 wampconf.json is in "Project Files", so it is copied to runtime's working directory, and then loaded after program transfer + runtime restart.
 
 Otherwise, wamp config file path can be forced :
 ./Beremiz_service.py -c /path/to/my/wampconf.json /working/dir
 
-Otherwise, path for CRA secret can be forced :
-./Beremiz_service.py -s /path/to/my/secret /working/dir
+/* Crossbar install */
+#sudo apt-get update
+#sudo apt-get -y dist-upgrade
+sudo apt-get -y install build-essential libssl-dev libffi-dev libreadline-dev libbz2-dev libsqlite3-dev libncurses5-dev
+sudo python -m pip install -U pip
+sudo pip install crossbar
+crossbar version
 
+/* Start Crossbar command: */
+crossbar start
+
+/* Crossbar test router configuration is available in .crossbar directory. */
 Tested on version:
- Crossbar.io        : 17.12.1 (Crossbar.io COMMUNITY)
-   Autobahn         : 17.10.1 (with JSON, MessagePack, CBOR, UBJSON)
+ Crossbar.io        : 18.3.1 (Crossbar.io COMMUNITY)
+   Autobahn         : 18.3.1 (with JSON, MessagePack, CBOR, UBJSON)
    Twisted          : 17.9.0-EPollReactor
    LMDB             : 0.93/lmdb-0.9.18
-   Python           : 2.7.12/CPython
-
-
+   Python           : 2.7.12/CPython
\ No newline at end of file
--- a/tests/wamp/beremiz.xml	Mon Mar 19 12:18:07 2018 +0100
+++ b/tests/wamp/beremiz.xml	Tue Mar 27 10:11:04 2018 +0200
@@ -1,4 +1,4 @@
 <?xml version='1.0' encoding='utf-8'?>
-<BeremizRoot xmlns:xsd="http://www.w3.org/2001/XMLSchema" URI_location="WAMP://127.0.0.1:8888#Automation#wamptest">
+<BeremizRoot xmlns:xsd="http://www.w3.org/2001/XMLSchema" URI_location="WAMP://127.0.0.1:8888#Automation#WampID">
   <TargetType/>
 </BeremizRoot>