Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Goedde committed Apr 4, 2014
2 parents 60627e6 + 1edc796 commit 3f6b26f
Show file tree
Hide file tree
Showing 9 changed files with 130 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Autobahn|Testsuite - Changelog

## v0.6.2
* new mode for generating WAMP message serializations
## v0.6.1
* permessage-deflate tests with different parameters and fragmentation

Expand Down
1 change: 1 addition & 0 deletions autobahntestsuite/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ autobahntestsuite/reports
autobahntestsuite/*.json
.*.db
fuzzing*.json
testdata.json
3 changes: 3 additions & 0 deletions autobahntestsuite/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,7 @@ test_web:
test_help:
python -m autobahntestsuite.wstest --help

test_serializer:
python -m autobahntestsuite.wstest -m serializer --outfile "testdata.json"

test: test_import test_run test_web
2 changes: 1 addition & 1 deletion autobahntestsuite/autobahntestsuite/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
##
###############################################################################

__version__ = "0.6.1"
__version__ = "0.6.2"
50 changes: 50 additions & 0 deletions autobahntestsuite/autobahntestsuite/serializer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
###############################################################################
##
## Copyright (C) 2011-2014 Tavendo GmbH
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##
###############################################################################

from __future__ import absolute_import

__all__ = ['start']

import json
import binascii
from autobahn import wamp
from autobahn.wamp.tests.test_serializer import generate_test_messages


def start(outfilename, debug = False):
with open(outfilename, 'wb') as outfile:
ser_json = wamp.serializer.JsonSerializer()
ser_msgpack = wamp.serializer.MsgPackSerializer()

res = []
for msg in generate_test_messages():
case = {}
case['name'] = str(msg)
case['rmsg'] = msg.marshal()

## serialize message to JSON
bytes, binary = ser_json.serialize(msg)
case['json'] = bytes

## serialize message to MsgPack
bytes, binary = ser_msgpack.serialize(msg)
case['msgpack'] = binascii.hexlify(bytes)

res.append(case)

outfile.write(json.dumps(res, indent = 3))
6 changes: 6 additions & 0 deletions autobahntestsuite/autobahntestsuite/wstest.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import massconnect
import wsperfcontrol
import wsperfmaster
import serializer


from spectemplate import SPEC_FUZZINGSERVER, \
Expand Down Expand Up @@ -82,6 +83,7 @@ class WsTestOptions(usage.Options):
#'web',
#'import',
#'export',
'serializer'
]

# Modes that need a specification file
Expand Down Expand Up @@ -117,6 +119,7 @@ class WsTestOptions(usage.Options):
['mode', 'm', None, 'Test mode, one of: %s [required]' % ', '.join(MODES)],
['testset', 't', None, 'Run a test set from an import test spec.'],
['spec', 's', None, 'Test specification file [required in some modes].'],
['outfile', 'o', None, 'Output filename for modes that generate testdata.'],
['wsuri', 'w', None, 'WebSocket URI [required in some modes].'],
['ident', 'i', None, ('Testee client identifier [optional for client testees].')],
['key', 'k', None, ('Server private key file for secure WebSocket (WSS) [required in server modes for WSS].')],
Expand Down Expand Up @@ -223,6 +226,9 @@ def startService(self):
elif self.mode == "massconnect":
return massconnect.startClient(self.spec, debug = self.debug)

elif self.mode == "serializer":
return serializer.start(outfilename = self.options['outfile'], debug = self.debug)

else:
raise Exception("no mode '%s'" % self.mode)

Expand Down
4 changes: 3 additions & 1 deletion autobahntestsuite/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,10 @@
url = 'http://autobahn.ws/testsuite',
platforms = ('Any'),
install_requires = ['setuptools',
'autobahn[twisted]>=0.8.5',
'autobahn[twisted]>=0.8.7',
'jinja2>=2.6',
'markupsafe>=0.19',
'Werkzeug>=0.9.4',
'klein>=0.2.1'],
packages = find_packages(),
#packages = ['autobahntestsuite'],
Expand Down
Binary file added doc/.sconsign.dblite
Binary file not shown.
64 changes: 64 additions & 0 deletions doc/SConstruct
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
###############################################################################
##
## Copyright (C) 2014 Tavendo GmbH
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##
###############################################################################

import os
import json
import pkg_resources

taschenmesser = pkg_resources.resource_filename('taschenmesser', '..')
#taschenmesser = "../../../infrequent/taschenmesser"
env = Environment(tools = ['default', 'taschenmesser'],
toolpath = [taschenmesser],
ENV = os.environ)

DOCSDIR = '_build'
S3DIR = '_upload'

##
## Sphinx Build
##
docs = env.Command(DOCSDIR, [], "sphinx-build -b html . $TARGET")
env.AlwaysBuild(docs)
Clean(docs, DOCSDIR)
Default(docs)


##
## Upload to Amazon S3
##
env['S3_RELPATH'] = DOCSDIR
env['S3_BUCKET'] = 'autobahn.ws'
env['S3_BUCKET_PREFIX'] = 'testsuite/' # note the trailing slash!
env['S3_OBJECT_ACL'] = 'public-read'


uploaded = []
import fnmatch

for root, dirnames, filenames in os.walk(DOCSDIR):
if not root.endswith('.doctrees'):
for filename in filenames:
if not fnmatch.fnmatch(filename, '*.s3'):
source = os.path.join(root, filename)
target = os.path.join(S3DIR, source)
uploaded.append(env.S3('{}.s3'.format(target), source))

Depends(uploaded, docs)
Clean(docs, S3DIR)
Alias("publish", uploaded)

0 comments on commit 3f6b26f

Please sign in to comment.