Skip to content

Commit b63f56f

Browse files
committed
Add functions to unit test framework
Signed-off-by: Emelia Lei <[email protected]>
1 parent ce37866 commit b63f56f

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

Diff for: src/groups/bmq/bmqimp/bmqimp_brokersession.t.cpp

+43
Original file line numberDiff line numberDiff line change
@@ -2834,6 +2834,49 @@ class DTTestTracer : public bmqpi::DTTracer {
28342834
d_allocator_p);
28352835
return result;
28362836
}
2837+
2838+
int serializeSpan(bsl::vector<unsigned char>* out,
2839+
const bsl::shared_ptr<bmqpi::DTSpan>& dtSpan) const
2840+
BSLS_KEYWORD_OVERRIDE
2841+
{
2842+
bmqu::MemOutStream event(d_allocator_p);
2843+
2844+
out->resize(dtSpan->operation().size() + 1);
2845+
out->insert(out->cbegin(),
2846+
dtSpan->operation().cbegin(),
2847+
dtSpan->operation().cend());
2848+
2849+
event << "SERIALIZE " << dtSpan->operation();
2850+
d_eventsQueue_p->pushBack(event.str());
2851+
2852+
return 0;
2853+
}
2854+
2855+
int deserializeAndCreateChildSpan(
2856+
bsl::shared_ptr<bmqpi::DTSpan>* out,
2857+
const bsl::vector<unsigned char>& in,
2858+
const bsl::string_view& operation,
2859+
const bmqpi::DTSpan::Baggage& baggage) const BSLS_KEYWORD_OVERRIDE
2860+
{
2861+
bsl::string parentOperation(in.begin(), in.end());
2862+
2863+
bmqu::MemOutStream event(d_allocator_p);
2864+
event << "DESERIALIZE " << parentOperation;
2865+
d_eventsQueue_p->pushBack(event.str());
2866+
2867+
bmqu::MemOutStream operationName(d_allocator_p);
2868+
operationName << operation;
2869+
operationName << " < " << parentOperation;
2870+
2871+
*out = bsl::shared_ptr<bmqpi::DTSpan>(
2872+
new (*d_allocator_p) DTTestSpan(operationName.str(),
2873+
baggage,
2874+
d_eventsQueue_p,
2875+
d_allocator_p),
2876+
d_allocator_p);
2877+
2878+
return 0;
2879+
}
28372880
};
28382881

28392882
} // close unnamed namespace

0 commit comments

Comments
 (0)