aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/actors
diff options
context:
space:
mode:
authoruzhas <uzhas@yandex-team.ru>2022-02-10 16:47:07 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:07 +0300
commit531b7c7053348b9d4c8ff3832d1b8db5a1918125 (patch)
treeb83306b6e37edeea782e9eed673d89286c4fef35 /library/cpp/actors
parent2002caab389ddffd0e7db4d8c4db835fa4c99f83 (diff)
downloadydb-531b7c7053348b9d4c8ff3832d1b8db5a1918125.tar.gz
Restoring authorship annotation for <uzhas@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/actors')
-rw-r--r--library/cpp/actors/core/event_pb_payload_ut.cpp90
1 files changed, 45 insertions, 45 deletions
diff --git a/library/cpp/actors/core/event_pb_payload_ut.cpp b/library/cpp/actors/core/event_pb_payload_ut.cpp
index 8f2f1ef369..eab007bc15 100644
--- a/library/cpp/actors/core/event_pb_payload_ut.cpp
+++ b/library/cpp/actors/core/event_pb_payload_ut.cpp
@@ -9,21 +9,21 @@ using namespace NActors;
enum {
EvMessageWithPayload = EventSpaceBegin(TEvents::ES_PRIVATE),
EvArenaMessage,
- EvArenaMessageBig,
- EvMessageWithPayloadPreSerialized
+ EvArenaMessageBig,
+ EvMessageWithPayloadPreSerialized
};
struct TEvMessageWithPayload : TEventPB<TEvMessageWithPayload, TMessageWithPayload, EvMessageWithPayload> {
- TEvMessageWithPayload() = default;
- explicit TEvMessageWithPayload(const TMessageWithPayload& p)
- : TEventPB<TEvMessageWithPayload, TMessageWithPayload, EvMessageWithPayload>(p)
- {}
+ TEvMessageWithPayload() = default;
+ explicit TEvMessageWithPayload(const TMessageWithPayload& p)
+ : TEventPB<TEvMessageWithPayload, TMessageWithPayload, EvMessageWithPayload>(p)
+ {}
};
-struct TEvMessageWithPayloadPreSerialized : TEventPreSerializedPB<TEvMessageWithPayloadPreSerialized, TMessageWithPayload, EvMessageWithPayloadPreSerialized> {
-};
-
-
+struct TEvMessageWithPayloadPreSerialized : TEventPreSerializedPB<TEvMessageWithPayloadPreSerialized, TMessageWithPayload, EvMessageWithPayloadPreSerialized> {
+};
+
+
TRope MakeStringRope(const TString& message) {
return message ? TRope(message) : TRope();
}
@@ -113,42 +113,42 @@ Y_UNIT_TEST_SUITE(TEventProtoWithPayload) {
TestSerializeDeserialize<TEvArenaMessage, TEvArenaMessageWithoutArena>(200, 14010);
TestSerializeDeserialize<TEvArenaMessageWithoutArena, TEvArenaMessage>(2000, 4010);
}
-
- Y_UNIT_TEST(PreSerializedCompatibility) {
- // ensure TEventPreSerializedPB and TEventPB are interchangable with no compatibility issues
- TMessageWithPayload msg;
- msg.SetMeta("hello, world!");
- msg.AddPayloadId(123);
- msg.AddPayloadId(999);
- msg.AddSomeData("abc");
- msg.AddSomeData("xyzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz");
-
- TEvMessageWithPayloadPreSerialized e1;
+
+ Y_UNIT_TEST(PreSerializedCompatibility) {
+ // ensure TEventPreSerializedPB and TEventPB are interchangable with no compatibility issues
+ TMessageWithPayload msg;
+ msg.SetMeta("hello, world!");
+ msg.AddPayloadId(123);
+ msg.AddPayloadId(999);
+ msg.AddSomeData("abc");
+ msg.AddSomeData("xyzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz");
+
+ TEvMessageWithPayloadPreSerialized e1;
Y_PROTOBUF_SUPPRESS_NODISCARD msg.SerializeToString(&e1.PreSerializedData);
-
- auto serializer1 = MakeHolder<TAllocChunkSerializer>();
+
+ auto serializer1 = MakeHolder<TAllocChunkSerializer>();
e1.SerializeToArcadiaStream(serializer1.Get());
- auto buffers1 = serializer1->Release(e1.IsExtendedFormat());
- UNIT_ASSERT_VALUES_EQUAL(buffers1->GetSize(), e1.CalculateSerializedSize());
- TString ser1 = buffers1->GetString();
-
- TEvMessageWithPayload e2(msg);
- auto serializer2 = MakeHolder<TAllocChunkSerializer>();
+ auto buffers1 = serializer1->Release(e1.IsExtendedFormat());
+ UNIT_ASSERT_VALUES_EQUAL(buffers1->GetSize(), e1.CalculateSerializedSize());
+ TString ser1 = buffers1->GetString();
+
+ TEvMessageWithPayload e2(msg);
+ auto serializer2 = MakeHolder<TAllocChunkSerializer>();
e2.SerializeToArcadiaStream(serializer2.Get());
- auto buffers2 = serializer2->Release(e2.IsExtendedFormat());
- UNIT_ASSERT_VALUES_EQUAL(buffers2->GetSize(), e2.CalculateSerializedSize());
- TString ser2 = buffers2->GetString();
- UNIT_ASSERT_VALUES_EQUAL(ser1, ser2);
-
- // deserialize
- auto data = MakeIntrusive<TEventSerializedData>(ser1, false);
- THolder<TEvMessageWithPayloadPreSerialized> parsedEvent(static_cast<TEvMessageWithPayloadPreSerialized*>(TEvMessageWithPayloadPreSerialized::Load(data)));
- UNIT_ASSERT_VALUES_EQUAL(parsedEvent->PreSerializedData, ""); // this field is empty after deserialization
- auto& record = parsedEvent->GetRecord();
- UNIT_ASSERT_VALUES_EQUAL(record.GetMeta(), msg.GetMeta());
- UNIT_ASSERT_VALUES_EQUAL(record.PayloadIdSize(), msg.PayloadIdSize());
- UNIT_ASSERT_VALUES_EQUAL(record.PayloadIdSize(), 2);
- UNIT_ASSERT_VALUES_EQUAL(record.GetPayloadId(0), msg.GetPayloadId(0));
- UNIT_ASSERT_VALUES_EQUAL(record.GetPayloadId(1), msg.GetPayloadId(1));
- }
+ auto buffers2 = serializer2->Release(e2.IsExtendedFormat());
+ UNIT_ASSERT_VALUES_EQUAL(buffers2->GetSize(), e2.CalculateSerializedSize());
+ TString ser2 = buffers2->GetString();
+ UNIT_ASSERT_VALUES_EQUAL(ser1, ser2);
+
+ // deserialize
+ auto data = MakeIntrusive<TEventSerializedData>(ser1, false);
+ THolder<TEvMessageWithPayloadPreSerialized> parsedEvent(static_cast<TEvMessageWithPayloadPreSerialized*>(TEvMessageWithPayloadPreSerialized::Load(data)));
+ UNIT_ASSERT_VALUES_EQUAL(parsedEvent->PreSerializedData, ""); // this field is empty after deserialization
+ auto& record = parsedEvent->GetRecord();
+ UNIT_ASSERT_VALUES_EQUAL(record.GetMeta(), msg.GetMeta());
+ UNIT_ASSERT_VALUES_EQUAL(record.PayloadIdSize(), msg.PayloadIdSize());
+ UNIT_ASSERT_VALUES_EQUAL(record.PayloadIdSize(), 2);
+ UNIT_ASSERT_VALUES_EQUAL(record.GetPayloadId(0), msg.GetPayloadId(0));
+ UNIT_ASSERT_VALUES_EQUAL(record.GetPayloadId(1), msg.GetPayloadId(1));
+ }
}