Ejemplo n.º 1
0
    def setUp(self):
        self._test_messages = generate_test_messages(
        ) + generate_test_messages_binary()

        self._test_serializers = []

        # JSON serializer is always available
        self._test_serializers.append(serializer.JsonSerializer())
        self._test_serializers.append(serializer.JsonSerializer(batched=True))

        # MsgPack serializer is optional
        if hasattr(serializer, 'MsgPackSerializer'):
            self._test_serializers.append(serializer.MsgPackSerializer())
            self._test_serializers.append(
                serializer.MsgPackSerializer(batched=True))

        # CBOR serializer is optional
        if hasattr(serializer, 'CBORSerializer'):
            self._test_serializers.append(serializer.CBORSerializer())
            self._test_serializers.append(
                serializer.CBORSerializer(batched=True))

        # UBJSON serializer is optional
        if hasattr(serializer, 'UBJSONSerializer'):
            self._test_serializers.append(serializer.UBJSONSerializer())
            self._test_serializers.append(
                serializer.UBJSONSerializer(batched=True))

        print('Testing WAMP serializers {} with {} WAMP test messages'.format(
            [ser.SERIALIZER_ID for ser in self._test_serializers],
            len(self._test_messages)))
def create_serializers(decimal_support=False):
    _serializers = []

    _serializers.append(
        serializer.JsonSerializer(use_decimal_from_str=decimal_support))
    _serializers.append(
        serializer.JsonSerializer(batched=True,
                                  use_decimal_from_str=decimal_support))

    _serializers.append(serializer.CBORSerializer())
    _serializers.append(serializer.CBORSerializer(batched=True))

    if not decimal_support:
        # builtins.OverflowError: Integer value out of range
        _serializers.append(serializer.MsgPackSerializer())
        _serializers.append(serializer.MsgPackSerializer(batched=True))

        # roundtrip error
        _serializers.append(serializer.UBJSONSerializer())
        _serializers.append(serializer.UBJSONSerializer(batched=True))

    # FIXME: implement full FlatBuffers serializer for WAMP
    # WAMP-FlatBuffers currently only supports Python 3
    # _serializers.append(serializer.FlatBuffersSerializer())
    # _serializers.append(serializer.FlatBuffersSerializer(batched=True))

    return _serializers
Ejemplo n.º 3
0
    def setUp(self):
        self.serializers = []

        # JSON serializer is always available
        self.serializers.append(serializer.JsonSerializer())
        self.serializers.append(serializer.JsonSerializer(batched=True))

        # MsgPack serializer is optional
        if hasattr(serializer, 'MsgPackSerializer'):
            self.serializers.append(serializer.MsgPackSerializer())
            self.serializers.append(serializer.MsgPackSerializer(batched=True))

        # CBOR serializer is optional
        if hasattr(serializer, 'CBORSerializer'):
            self.serializers.append(serializer.CBORSerializer())
            self.serializers.append(serializer.CBORSerializer(batched=True))

        # UBJSON serializer is optional
        if hasattr(serializer, 'UBJSONSerializer'):
            self.serializers.append(serializer.UBJSONSerializer())
            self.serializers.append(serializer.UBJSONSerializer(batched=True))
def create_serializers():
    _serializers = []

    _serializers.append(serializer.JsonSerializer())
    _serializers.append(serializer.JsonSerializer(batched=True))

    _serializers.append(serializer.MsgPackSerializer())
    _serializers.append(serializer.MsgPackSerializer(batched=True))

    _serializers.append(serializer.CBORSerializer())
    _serializers.append(serializer.CBORSerializer(batched=True))

    _serializers.append(serializer.UBJSONSerializer())
    _serializers.append(serializer.UBJSONSerializer(batched=True))

    # FIXME: implement full FlatBuffers serializer for WAMP
    # WAMP-FlatBuffers currently only supports Python 3
    # _serializers.append(serializer.FlatBuffersSerializer())
    # _serializers.append(serializer.FlatBuffersSerializer(batched=True))

    return _serializers