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


C++ SubscriptionRequest::setAttributeName方法代码示例

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


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

示例1: semaphore

/**
  * Trigger:    The dispatcher receives a SubscriptionRequest.
  * Expected:   The PublicationManager creates a PublisherRunnable and polls
  *             the MockCaller for the attribute.
  */
TEST_F(SubscriptionTest, receive_subscriptionRequestAndPollAttribute) {
    qRegisterMetaType<OnChangeWithKeepAliveSubscriptionQos>("OnChangeWithKeepAliveSubscriptionQos");
    qRegisterMetaType<SubscriptionRequest>("SubscriptionRequest");

    // Use a semaphore to count and wait on calls to the mockRequestCaller
    QSemaphore semaphore(0);
    EXPECT_CALL(*mockRequestCaller, getLocation(_, _))
            .WillRepeatedly(ReleaseSemaphore(&semaphore));

    QString attributeName = "Location";
    auto subscriptionQos = QSharedPointer<SubscriptionQos>(new OnChangeWithKeepAliveSubscriptionQos(
                80, // validity_ms
                100, // minInterval_ms
                200, // maxInterval_ms
                80 // alertInterval_ms
    ));
    QString subscriptionId = "SubscriptionID";
    SubscriptionRequest subscriptionRequest;
    subscriptionRequest.setSubscriptionId(subscriptionId);
    subscriptionRequest.setAttributeName(attributeName);
    subscriptionRequest.setQos(subscriptionQos);

    JoynrMessage msg = messageFactory.createSubscriptionRequest(
                proxyParticipantId,
                providerParticipantId,
                qos,
                subscriptionRequest);

    dispatcher.addRequestCaller(providerParticipantId, mockRequestCaller);
    dispatcher.receive(msg, qos);

    // Wait for a call to be made to the mockRequestCaller
    ASSERT_TRUE(semaphore.tryAcquire(1,1000));
}
开发者ID:alienscience,项目名称:joynr,代码行数:39,代码来源:SubscriptionTest.cpp

示例2: OnChangeSubscriptionQos

TEST_F(JoynrMessageFactoryTest, createSubscriptionRequest){
    auto subscriptionQos = QSharedPointer<SubscriptionQos>(new OnChangeSubscriptionQos());
    SubscriptionRequest subscriptionRequest;
    subscriptionRequest.setSubscriptionId(QString("subscriptionId"));
    subscriptionRequest.setAttributeName(QString("attributeName"));
    subscriptionRequest.setQos(subscriptionQos);
    JoynrMessage joynrMessage = messageFactory.createSubscriptionRequest(
                senderID,
                receiverID,
                qos,
                subscriptionRequest
    );
    checkParticipantIDs(joynrMessage);
    EXPECT_QSTREQ(JoynrMessage::VALUE_MESSAGE_TYPE_SUBSCRIPTION_REQUEST, joynrMessage.getType());
}
开发者ID:alienscience,项目名称:joynr,代码行数:15,代码来源:JoynrMessageFactoryTest.cpp


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