| 680 | |
| 681 | template <typename ServerTraits, typename TemplateTraits> |
| 682 | void testOnewayCall() { |
| 683 | typedef ServiceState<ServerTraits, ChildServiceTraits<TemplateTraits> > State; |
| 684 | |
| 685 | // Start the server |
| 686 | std::shared_ptr<State> state(new State); |
| 687 | ServerThread serverThread(state, true); |
| 688 | |
| 689 | const std::shared_ptr<EventLog>& log = state->getLog(); |
| 690 | |
| 691 | // Create a client |
| 692 | std::shared_ptr<typename State::Client> client = state->createClient(); |
| 693 | uint32_t connId = checkNewConnEvents(log); |
| 694 | |
| 695 | // Make a oneway call |
| 696 | // It should return immediately, even though the server's handler |
| 697 | // won't return right away |
| 698 | state->getHandler()->prepareTriggeredCall(); |
| 699 | client->onewayWait(); |
| 700 | string callName = "ParentService.onewayWait"; |
| 701 | uint32_t callId = checkCallHandlerEvents(log, connId, EventLog::ET_CALL_ONEWAY_WAIT, callName); |
| 702 | |
| 703 | // There shouldn't be any more events |
| 704 | checkNoEvents(log); |
| 705 | |
| 706 | // Trigger the handler to return |
| 707 | state->getHandler()->triggerPendingCalls(); |
| 708 | |
| 709 | // The handler will log an ET_WAIT_RETURN event when it wakes up |
| 710 | Event event = log->waitForEvent(); |
| 711 | BOOST_CHECK_EQUAL(EventLog::ET_WAIT_RETURN, event.type); |
| 712 | |
| 713 | // Now we should see the async complete event, then call finished |
| 714 | event = log->waitForEvent(); |
| 715 | BOOST_CHECK_EQUAL(EventLog::ET_ASYNC_COMPLETE, event.type); |
| 716 | BOOST_CHECK_EQUAL(connId, event.connectionId); |
| 717 | BOOST_CHECK_EQUAL(callId, event.callId); |
| 718 | BOOST_CHECK_EQUAL(callName, event.message); |
| 719 | |
| 720 | event = log->waitForEvent(); |
| 721 | BOOST_CHECK_EQUAL(EventLog::ET_CALL_FINISHED, event.type); |
| 722 | BOOST_CHECK_EQUAL(connId, event.connectionId); |
| 723 | BOOST_CHECK_EQUAL(callId, event.callId); |
| 724 | BOOST_CHECK_EQUAL(callName, event.message); |
| 725 | |
| 726 | // Destroy the client, and check for connection closed events |
| 727 | client.reset(); |
| 728 | checkCloseEvents(log, connId); |
| 729 | |
| 730 | checkNoEvents(log); |
| 731 | } |
| 732 | |
| 733 | template <typename ServerTraits, typename TemplateTraits> |
| 734 | void testExpectedError() { |
nothing calls this directly
no test coverage detected