MCPcopy Create free account
hub / github.com/apache/qpid-proton / test_message_properties

Function test_message_properties

cpp/src/message_test.cpp:65–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65void test_message_properties() {
66 message m("hello");
67 std::string s = get<std::string>(m.body());
68 ASSERT_EQUAL("hello", s);
69
70 CHECK_MESSAGE_ID(id);
71 CHECK_STR(user);
72 CHECK_STR(to);
73 CHECK_STR(subject);
74 CHECK_STR(reply_to);
75 CHECK_MESSAGE_ID(correlation_id);
76 CHECK_STR(content_type);
77 CHECK_STR(content_encoding);
78 CHECK_STR(group_id);
79 CHECK_STR(reply_to_group_id);
80 m.expiry_time(timestamp(42));
81 ASSERT_EQUAL(m.expiry_time().milliseconds(), 42);
82 m.creation_time(timestamp(4242));
83 ASSERT_EQUAL(m.creation_time().milliseconds(), 4242);
84 m.ttl(duration(30));
85 ASSERT_EQUAL(m.ttl().milliseconds(), 30);
86 m.priority(3);
87 ASSERT_EQUAL(m.priority(), 3);
88
89 message m2(m);
90 ASSERT_EQUAL("hello", get<std::string>(m2.body()));
91 ASSERT_EQUAL(message_id("id"), m2.id());
92 ASSERT_EQUAL("user", m2.user());
93 ASSERT_EQUAL("to", m2.to());
94 ASSERT_EQUAL("subject", m2.subject());
95 ASSERT_EQUAL("reply_to", m2.reply_to());
96 ASSERT_EQUAL(message_id("correlation_id"), m2.correlation_id());
97 ASSERT_EQUAL("content_type", m2.content_type());
98 ASSERT_EQUAL("content_encoding", m2.content_encoding());
99 ASSERT_EQUAL("group_id", m2.group_id());
100 ASSERT_EQUAL("reply_to_group_id", m2.reply_to_group_id());
101 ASSERT_EQUAL(42, m2.expiry_time().milliseconds());
102 ASSERT_EQUAL(4242, m.creation_time().milliseconds());
103
104 m2 = m;
105 ASSERT_EQUAL("hello", get<std::string>(m2.body()));
106 ASSERT_EQUAL(message_id("id"), m2.id());
107 ASSERT_EQUAL("user", m2.user());
108 ASSERT_EQUAL("to", m2.to());
109 ASSERT_EQUAL("subject", m2.subject());
110 ASSERT_EQUAL("reply_to", m2.reply_to());
111 ASSERT_EQUAL(message_id("correlation_id"), m2.correlation_id());
112 ASSERT_EQUAL("content_type", m2.content_type());
113 ASSERT_EQUAL("content_encoding", m2.content_encoding());
114 ASSERT_EQUAL("group_id", m2.group_id());
115 ASSERT_EQUAL("reply_to_group_id", m2.reply_to_group_id());
116 ASSERT_EQUAL(42, m2.expiry_time().milliseconds());
117 ASSERT_EQUAL(4242, m.creation_time().milliseconds());
118}
119
120void test_message_body() {
121 std::string s("hello");

Callers 1

mainFunction · 0.85

Calls 15

bodyMethod · 0.80
timestampClass · 0.50
durationClass · 0.50
message_idClass · 0.50
expiry_timeMethod · 0.45
millisecondsMethod · 0.45
creation_timeMethod · 0.45
ttlMethod · 0.45
priorityMethod · 0.45
idMethod · 0.45
userMethod · 0.45
toMethod · 0.45

Tested by

no test coverage detected