当前位置: 首页>>代码示例>>C++>>正文


C++ JoynrMessage::setHeaderReplyChannelId方法代码示例

本文整理汇总了C++中JoynrMessage::setHeaderReplyChannelId方法的典型用法代码示例。如果您正苦于以下问题:C++ JoynrMessage::setHeaderReplyChannelId方法的具体用法?C++ JoynrMessage::setHeaderReplyChannelId怎么用?C++ JoynrMessage::setHeaderReplyChannelId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JoynrMessage的用法示例。


在下文中一共展示了JoynrMessage::setHeaderReplyChannelId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: transmit

TEST_F(MessagingTest, routeMsgToHttpCommunicationMgr)
{
    JoynrMessage message = messageFactory.createRequest(
                senderId,
                receiverId,
                qos,
                request);
    message.setHeaderReplyChannelId(senderChannelId);

    // InProcessMessagingSkeleton should not receive the message
    EXPECT_CALL(*inProcessMessagingSkeleton, transmit(Eq(message)))
            .Times(0);

    // HttpCommunicationManager should receive the message
    EXPECT_CALL(*mockMessageSender, sendMessage(Eq(receiverChannelId),Eq(message)))
            .Times(1).WillRepeatedly(ReleaseSemaphore(&semaphore));

    std::shared_ptr<system::RoutingTypes::ChannelAddress> joynrMessagingEndpointAddr =
            std::shared_ptr<system::RoutingTypes::ChannelAddress>(new system::RoutingTypes::ChannelAddress());
    joynrMessagingEndpointAddr->setChannelId(receiverChannelId);

    messageRouter->addNextHop(receiverId, joynrMessagingEndpointAddr);

    messageRouter->route(message);

    WaitXTimes(1);
}
开发者ID:icyerasor,项目名称:joynr,代码行数:27,代码来源:MessagingTest.cpp

示例2: InProcessMessagingAddress

TEST_F(MessagingTest, routeMultipleMessages)
{
    JoynrMessage message = messageFactory.createRequest(
                senderId,
                receiverId,
                qos,
                request);
    message.setHeaderReplyChannelId(senderChannelId);

    std::string receiverId2("receiverId2");
    JoynrMessage message2 = messageFactory.createRequest(
                senderId,
                receiverId2,
                qos,
                request);
    message2.setHeaderReplyChannelId(senderChannelId);

    // InProcessMessagingSkeleton should receive the message2 and message3
    EXPECT_CALL(*inProcessMessagingSkeleton, transmit(Eq(message2)))
            .Times(2).WillRepeatedly(ReleaseSemaphore(&semaphore));

    // MessageSender should receive the message
    EXPECT_CALL(*mockMessageSender, sendMessage(Eq(receiverChannelId), Eq(message)))
            .Times(1).WillRepeatedly(ReleaseSemaphore(&semaphore));

    EXPECT_CALL(*mockMessageReceiver, getReceiveChannelId())
//            .WillOnce(ReturnRefOfCopy(senderChannelId));
            .WillRepeatedly(ReturnRefOfCopy(senderChannelId));

    std::shared_ptr<InProcessMessagingAddress> messagingSkeletonEndpointAddr(
                new InProcessMessagingAddress(inProcessMessagingSkeleton)
    );

    messageRouter->addNextHop(receiverId2, messagingSkeletonEndpointAddr);

    std::shared_ptr<system::RoutingTypes::ChannelAddress> joynrMessagingEndpointAddr =
            std::shared_ptr<system::RoutingTypes::ChannelAddress>(new system::RoutingTypes::ChannelAddress());
    joynrMessagingEndpointAddr->setChannelId(receiverChannelId);

    messageRouter->addNextHop(receiverId, joynrMessagingEndpointAddr);

    messageRouter->route(message);
    messageRouter->route(message2);
    messageRouter->route(message2);

    WaitXTimes(3);
}
开发者ID:icyerasor,项目名称:joynr,代码行数:47,代码来源:MessagingTest.cpp


注:本文中的JoynrMessage::setHeaderReplyChannelId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。