# HG changeset patch
# User dporopat <denis.poropat@smarteh.si>
# Date 1522138264 -7200
# Node ID 35d6b9321ffd87b8d4e19fc91d64808874c6ded9
# Parent  259df9ecf9ca176c0cc2102c5405003416562d58
#2486 Updated wamp test project to work with the latest Crossbar version.

diff -r 259df9ecf9ca -r 35d6b9321ffd runtime/WampClient.py
--- 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
diff -r 259df9ecf9ca -r 35d6b9321ffd tests/wamp/.crossbar/config.json
--- 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"
                     ]
                 }
             ]
diff -r 259df9ecf9ca -r 35d6b9321ffd tests/wamp/README
--- 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
diff -r 259df9ecf9ca -r 35d6b9321ffd tests/wamp/beremiz.xml
--- 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>