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


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

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


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

示例1: ccMessagingAddress

TEST_F(LibJoynrDbusCommunicationTests, transmit_message) {
    QString ccMessagingAddress("local:joynr.messaging:cc.message6");

    // register skeletons
    MockMessaging* msgMock = new MockMessaging();
    EXPECT_CALL(*msgMock, transmit(A<JoynrMessage&>())).Times(1);
    auto msgSkeleton = new IDbusSkeletonWrapper<DbusMessagingSkeleton, IMessaging>(*msgMock, ccMessagingAddress);

    // get stub
    DbusMessagingStubAdapter* msgStub = new DbusMessagingStubAdapter(ccMessagingAddress);
    ASSERT_TRUE(msgStub->isProxyAvailable());

    // create message
    JoynrMessage msg;
    msg.setType(JoynrMessage::VALUE_MESSAGE_TYPE_ONE_WAY);
    msg.setHeaderTo(QString("local"));
    msg.setPayload("This is a test");

    // create messaging qos
    msgStub->transmit(msg);

    // delete skeleton
    delete msgSkeleton;

    // error on transmission
    msgStub->transmit(msg);

    // stub not availabe
    ASSERT_FALSE(msgStub->isProxyAvailable());

    delete msgStub;
    delete msgMock;
}
开发者ID:HSchroeder,项目名称:joynr,代码行数:33,代码来源:LibJoynrDbusCommunicationTests.cpp

示例2:

TEST_F(MessageQueueTest, queueDequeueMultipleMessagesForOneParticipant) {
    // add messages to the queue
    JoynrMessage msg;
    msg.setHeaderTo("TEST");
    msg.setHeaderExpiryDate(expiryDate);
    messageQueue.queueMessage(msg);
    messageQueue.queueMessage(msg);
    EXPECT_EQ(messageQueue.getQueueLength(), 2);

    // get messages from queue
    MessageQueueItem* item = messageQueue.getNextMessageForParticipant("TEST");
    EXPECT_EQ(item->getContent(), msg);
    EXPECT_EQ(messageQueue.getQueueLength(), 1);

    item = messageQueue.getNextMessageForParticipant("TEST");
    EXPECT_EQ(item->getContent(), msg);
    EXPECT_EQ(messageQueue.getQueueLength(), 0);
}
开发者ID:icyerasor,项目名称:joynr,代码行数:18,代码来源:MessageQueueTest.cpp

示例3: initMsg

void JoynrMessageFactory::initMsg(JoynrMessage& msg,
                                  const std::string& senderParticipantId,
                                  const std::string& receiverParticipantId,
                                  const std::int64_t ttl,
                                  const std::string& payload) const
{
    msg.setHeaderCreatorUserId(securityManager->getCurrentProcessUserId());
    msg.setHeaderFrom(senderParticipantId);
    msg.setHeaderTo(receiverParticipantId);

    // calculate expiry date
    JoynrTimePoint expiryDate = DispatcherUtils::convertTtlToAbsoluteTime(ttl);
    msg.setHeaderExpiryDate(expiryDate);

    // add content type and class
    msg.setHeaderContentType(JoynrMessage::VALUE_CONTENT_TYPE_APPLICATION_JSON);

    // set payload
    msg.setPayload(payload);
}
开发者ID:zabela,项目名称:joynr,代码行数:20,代码来源:JoynrMessageFactory.cpp


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