本文整理汇总了C++中JoynrMessage类的典型用法代码示例。如果您正苦于以下问题:C++ JoynrMessage类的具体用法?C++ JoynrMessage怎么用?C++ JoynrMessage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JoynrMessage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TEST_F
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);
}
示例2: TEST_F
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;
}
示例3: createOneWay
JoynrMessage JoynrMessageFactory::createOneWay(const std::string& senderId,
const std::string& receiverId,
const MessagingQos& qos,
const Reply& payload) const
{
JoynrMessage msg;
msg.setType(JoynrMessage::VALUE_MESSAGE_TYPE_ONE_WAY);
initMsg(msg, senderId, receiverId, qos.getTtl(), JsonSerializer::serialize<Reply>(payload));
return msg;
}
示例4: TEST_F
TEST_F(JoynrMessageFactoryTest, createRequest_withContentType) {
JoynrMessage joynrMessage = messageFactory.createRequest(
senderID,
receiverID,
qos,
request
);
EXPECT_QSTREQ(senderID, joynrMessage.getHeaderFrom());
EXPECT_QSTREQ(receiverID, joynrMessage.getHeaderTo());
}
示例5: createRequest
JoynrMessage JoynrMessageFactory::createRequest(const std::string& senderId,
const std::string& receiverId,
const MessagingQos& qos,
const Request& payload) const
{
// create message and set type
JoynrMessage msg;
msg.setType(JoynrMessage::VALUE_MESSAGE_TYPE_REQUEST);
initMsg(msg, senderId, receiverId, qos.getTtl(), JsonSerializer::serialize<Request>(payload));
return msg;
}
示例6: createSubscriptionStop
JoynrMessage JoynrMessageFactory::createSubscriptionStop(const std::string& senderId,
const std::string& receiverId,
const MessagingQos& qos,
const SubscriptionStop& payload) const
{
JoynrMessage msg;
msg.setType(JoynrMessage::VALUE_MESSAGE_TYPE_SUBSCRIPTION_STOP);
initMsg(msg,
senderId,
receiverId,
qos.getTtl(),
JsonSerializer::serialize<SubscriptionStop>(payload));
return msg;
}
示例7: logMethodCall
void DbusMessagingStubAdapter::transmit(JoynrMessage& message)
{
logMethodCall(QString("transmit message with ID: %1 and payload: %2")
.arg(message.getHeaderMessageId())
.arg(QString(message.getPayload())));
// copy joynr message
joynr::messaging::IMessaging::JoynrMessage dbusMsg;
DbusMessagingUtil::copyJoynrMsgToDbusMsg(message, dbusMsg);
// call
CommonAPI::CallStatus status;
proxy->transmit(dbusMsg, status);
// print the status
printCallStatus(status, "transmit");
}
示例8: onTextMessageReceived
void WebSocketLibJoynrMessagingSkeleton::onTextMessageReceived(const std::string& message)
{
// deserialize message and transmit
JoynrMessage* joynrMsg = JsonSerializer::deserialize<JoynrMessage>(message);
if (joynrMsg == nullptr || joynrMsg->getType().empty()) {
JOYNR_LOG_ERROR(logger, "Unable to deserialize joynr message object from: {}", message);
return;
}
JOYNR_LOG_TRACE(logger, "<<< INCOMING <<< {}", message);
// message router copies joynr message when scheduling thread that handles
// message delivery
transmit(*joynrMsg);
delete joynrMsg;
}
示例9: JOYNR_LOG_ERROR
void LongPollingMessageReceiver::processReceivedJsonObjects(const std::string& jsonObject)
{
JoynrMessage* msg = JsonSerializer::deserialize<JoynrMessage>(jsonObject);
if (msg == nullptr) {
JOYNR_LOG_ERROR(logger, "Unable to deserialize message. Raw message: {}", jsonObject);
return;
}
if (msg->getType().empty()) {
JOYNR_LOG_ERROR(logger, "received empty message - dropping Messages");
return;
}
if (!msg->containsHeaderExpiryDate()) {
JOYNR_LOG_ERROR(logger,
"received message [msgId=[{}] without decay time - dropping message",
msg->getHeaderMessageId());
}
if (msg->getType() == JoynrMessage::VALUE_MESSAGE_TYPE_REQUEST ||
msg->getType() == JoynrMessage::VALUE_MESSAGE_TYPE_SUBSCRIPTION_REQUEST ||
msg->getType() == JoynrMessage::VALUE_MESSAGE_TYPE_BROADCAST_SUBSCRIPTION_REQUEST) {
// TODO ca: check if replyTo header info is available?
std::string replyChannelId = msg->getHeaderReplyChannelId();
std::shared_ptr<system::RoutingTypes::ChannelAddress> address(
new system::RoutingTypes::ChannelAddress(replyChannelId));
messageRouter->addNextHop(msg->getHeaderFrom(), address);
}
// messageRouter.route passes the message reference to the MessageRunnable, which copies it.
// TODO would be nicer if the pointer would be passed to messageRouter, on to MessageRunnable,
// and runnable should delete it.
messageRouter->route(*msg);
delete msg;
}
示例10: createSubscriptionPublication
JoynrMessage JoynrMessageFactory::createSubscriptionPublication(
const std::string& senderId,
const std::string& receiverId,
const MessagingQos& qos,
const SubscriptionPublication& payload) const
{
JoynrMessage msg;
msg.setType(JoynrMessage::VALUE_MESSAGE_TYPE_PUBLICATION);
initMsg(msg,
senderId,
receiverId,
qos.getTtl(),
JsonSerializer::serialize<SubscriptionPublication>(payload));
return msg;
}
示例11: createBroadcastSubscriptionRequest
JoynrMessage JoynrMessageFactory::createBroadcastSubscriptionRequest(
const std::string& senderId,
const std::string& receiverId,
const MessagingQos& qos,
const BroadcastSubscriptionRequest& payload) const
{
JoynrMessage msg;
msg.setType(JoynrMessage::VALUE_MESSAGE_TYPE_BROADCAST_SUBSCRIPTION_REQUEST);
initMsg(msg,
senderId,
receiverId,
qos.getTtl(),
JsonSerializer::serialize<BroadcastSubscriptionRequest>(payload));
return msg;
}
示例12: receive
void Dispatcher::receive(const JoynrMessage& message)
{
LOG_DEBUG(logger,
QString("receive(message). Message payload: %1").arg(QString(message.getPayload())));
ReceivedMessageRunnable* receivedMessageRunnable = new ReceivedMessageRunnable(message, *this);
handleReceivedMessageThreadPool.start(receivedMessageRunnable);
}
示例13: checkReply
void checkReply(const JoynrMessage& joynrMessage){
QString expectedPayload = QString(
"{\"_typeName\":\"joynr.Reply\","
"\"requestReplyId\":\"%1\","
"\"response\":\"response\"}"
);
expectedPayload = expectedPayload.arg(reply.getRequestReplyId());
EXPECT_EQ(expectedPayload, QString(joynrMessage.getPayload()));
}
示例14: TEST_F
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);
}
示例15: checkSubscriptionPublication
void checkSubscriptionPublication(const JoynrMessage& joynrMessage){
QString expectedPayload = QString(
"{\"_typeName\":\"joynr.SubscriptionPublication\","
"\"response\":\"publication\","
"\"subscriptionId\":\"%1\"}"
);
expectedPayload = expectedPayload.arg(subscriptionPublication.getSubscriptionId());
EXPECT_EQ(expectedPayload, QString(joynrMessage.getPayload()));
}