Skip to content

Commit 43552f5

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

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

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

+41
Original file line numberDiff line numberDiff line change
@@ -2834,6 +2834,47 @@ 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(), dtSpan->operation().cbegin(), dtSpan->operation().cend());
2846+
2847+
event << "SERIALIZE " << dtSpan->operation();
2848+
d_eventsQueue_p->pushBack(event.str());
2849+
2850+
return 0;
2851+
}
2852+
2853+
int deserializeAndCreateChildSpan(
2854+
bsl::shared_ptr<bmqpi::DTSpan>* out,
2855+
const bsl::vector<unsigned char>& in,
2856+
const bsl::string_view& operation,
2857+
const bmqpi::DTSpan::Baggage& baggage) const BSLS_KEYWORD_OVERRIDE
2858+
{
2859+
bsl::string parentOperation(in.begin(), in.end());
2860+
2861+
bmqu::MemOutStream event(d_allocator_p);
2862+
event << "DESERIALIZE " << parentOperation;
2863+
d_eventsQueue_p->pushBack(event.str());
2864+
2865+
bmqu::MemOutStream operationName(d_allocator_p);
2866+
operationName << operation;
2867+
operationName << " < " << parentOperation;
2868+
2869+
*out = bsl::shared_ptr<bmqpi::DTSpan>(
2870+
new (*d_allocator_p) DTTestSpan(operationName.str(),
2871+
baggage,
2872+
d_eventsQueue_p,
2873+
d_allocator_p),
2874+
d_allocator_p);
2875+
2876+
return 0;
2877+
}
28372878
};
28382879

28392880
} // close unnamed namespace

0 commit comments

Comments
 (0)