예제 #1
0
 async def _async() -> None:
     data = Person()
     data.name = 'John Doe'
     data.id = '12'
     json_message = await instance.message_protocol.build_message(
         instance, 'topic', data)
     await instance.message_protocol.parse_message(json_message, str)
예제 #2
0
 async def _async() -> None:
     data = Person()
     data.name = "John Doe"
     data.id = "12"
     json_message = await instance.message_envelope.build_message(
         instance, "topic", data)
     await instance.message_envelope.parse_message(json_message, str)
예제 #3
0
 async def _async() -> None:
     data = Person()
     data.name = 'John Doe'
     data.id = '12'
     protobuf_message = await instance.message_protocol.build_message(
         instance, 'topic', data)
     await instance.message_protocol.parse_message(protobuf_message, Person,
                                                   test_validator)
예제 #4
0
 async def _async() -> None:
     data = Person()
     data.name = "John Doe"
     data.id = "12"
     protobuf_message = await instance.message_envelope.build_message(
         instance, "topic", data)
     await instance.message_envelope.parse_message(protobuf_message, Person,
                                                   test_validator)
예제 #5
0
 async def _async() -> None:
     data = Person()
     data.name = 'John Doe'
     data.id = '12'
     protobuf_message = await instance.message_protocol.build_message(
         instance, 'topic', data)
     result, message_uuid, timestamp = await instance.message_protocol.parse_message(
         protobuf_message)
     assert type(result.get('data')) is not Person
     assert type(result.get('data')) is bytes
     assert result.get('data') != data
     assert result.get('data') == b'\n\x0212"\x08John Doe'
예제 #6
0
 async def _async() -> None:
     data = Person()
     data.name = "John Doe"
     data.id = "12"
     protobuf_message = await instance.message_envelope.build_message(
         instance, "topic", data)
     result, message_uuid, timestamp = await instance.message_envelope.parse_message(
         protobuf_message)
     assert type(result.get("data")) is not Person
     assert type(result.get("data")) is bytes
     assert result.get("data") != data
     assert result.get("data") == b"\n\x0212\x12\x08John Doe"
예제 #7
0
 async def _async() -> None:
     data = Person()
     data.name = 'John Doe'
     data.id = '12'
     t1 = time.time()
     protobuf_message = await instance.message_protocol.build_message(
         instance, 'topic', data)
     t2 = time.time()
     result, message_uuid, timestamp = await instance.message_protocol.parse_message(
         protobuf_message, Person)
     assert type(result.get('data')) is Person
     assert result.get('data') == data
     assert result.get('metadata', {}).get('data_encoding') == 'proto'
     assert result.get('data') == data
     assert result.get('data').name == data.name
     assert result.get('data').id == data.id
     assert len(MessageToJson(result.get('data'))) == len(
         MessageToJson(data))
     assert MessageToJson(result.get('data')) == MessageToJson(data)
     assert len(message_uuid) == 73
     assert message_uuid[0:36] == instance.uuid
     assert timestamp >= t1
     assert timestamp <= t2
예제 #8
0
 async def _async() -> None:
     data = Person()
     data.name = "John Doe"
     data.id = "12"
     t1 = time.time()
     protobuf_message = await instance.message_envelope.build_message(
         instance, "topic", data)
     t2 = time.time()
     result, message_uuid, timestamp = await instance.message_envelope.parse_message(
         protobuf_message, Person)
     assert type(result.get("data")) is Person
     assert result.get("data") == data
     assert result.get("metadata", {}).get("data_encoding") == "proto"
     assert result.get("data") == data
     assert result.get("data").name == data.name
     assert result.get("data").id == data.id
     assert len(MessageToJson(result.get("data"))) == len(
         MessageToJson(data))
     assert MessageToJson(result.get("data")) == MessageToJson(data)
     assert len(message_uuid) == 73
     assert message_uuid[0:36] == instance.uuid
     assert timestamp >= t1
     assert timestamp <= t2