MCPcopy Create free account
hub / github.com/apache/thrift / checkCallHandlerEvents

Function checkCallHandlerEvents

lib/cpp/test/processor/ProcessorTest.cpp:335–367  ·  view source on GitHub ↗

* Check for the events that should be logged when a call is received * and the handler is invoked. * * It does not check for anything after the handler invocation. * * Returns the call ID allocated by the server. */

Source from the content-addressed store, hash-verified

333 * Returns the call ID allocated by the server.
334 */
335uint32_t checkCallHandlerEvents(const std::shared_ptr<EventLog>& log,
336 uint32_t connId,
337 EventType callType,
338 const string& callName) {
339 // Call started
340 Event event = log->waitForEvent();
341 BOOST_CHECK_EQUAL(EventLog::ET_CALL_STARTED, event.type);
342 BOOST_CHECK_EQUAL(connId, event.connectionId);
343 BOOST_CHECK_EQUAL(callName, event.message);
344 uint32_t callId = event.callId;
345
346 // Pre-read
347 event = log->waitForEvent();
348 BOOST_CHECK_EQUAL(EventLog::ET_PRE_READ, event.type);
349 BOOST_CHECK_EQUAL(connId, event.connectionId);
350 BOOST_CHECK_EQUAL(callId, event.callId);
351 BOOST_CHECK_EQUAL(callName, event.message);
352
353 // Post-read
354 event = log->waitForEvent();
355 BOOST_CHECK_EQUAL(EventLog::ET_POST_READ, event.type);
356 BOOST_CHECK_EQUAL(connId, event.connectionId);
357 BOOST_CHECK_EQUAL(callId, event.callId);
358 BOOST_CHECK_EQUAL(callName, event.message);
359
360 // Handler invocation
361 event = log->waitForEvent();
362 BOOST_CHECK_EQUAL(callType, event.type);
363 // The handler doesn't have any connection or call context,
364 // so the connectionId and callId in this event aren't valid
365
366 return callId;
367}
368
369/**
370 * Check for the events that should be after a handler returns.

Callers 4

checkCallEventsFunction · 0.85
testOnewayCallFunction · 0.85
testExpectedErrorFunction · 0.85
testUnexpectedErrorFunction · 0.85

Calls 1

waitForEventMethod · 0.45

Tested by

no test coverage detected