本文整理汇总了Java中com.restfb.types.webhook.messaging.MessagingItem类的典型用法代码示例。如果您正苦于以下问题:Java MessagingItem类的具体用法?Java MessagingItem怎么用?Java MessagingItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MessagingItem类属于com.restfb.types.webhook.messaging包,在下文中一共展示了MessagingItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleMessagingItem
import com.restfb.types.webhook.messaging.MessagingItem; //导入依赖的package包/类
protected void handleMessagingItem(final MessagingItem messagingItem, final Map<String, String[]> params) {
final MessagingParticipant sender = messagingItem.getSender();
if (sender == null || Strings.isBlank(sender.getId())) {
LOG.warn("Ignoring message with empty sender");
} else {
facebookMessageHandler.handleMessagingItem(messagingItem, params);
}
}
示例2: handleWebhookEntry
import com.restfb.types.webhook.messaging.MessagingItem; //导入依赖的package包/类
protected void handleWebhookEntry(final WebhookEntry webhookEntry, final Map<String, String[]> params) {
for (final MessagingItem messagingItem : webhookEntry.getMessaging()) {
if (messagingItem != null) {
handleMessagingItem(messagingItem, params);
}
}
}
示例3: createReceiveMessage
import com.restfb.types.webhook.messaging.MessagingItem; //导入依赖的package包/类
@Override
public ReceiveMessage createReceiveMessage(final MessagingItem messagingItem, final Map<String, String[]> params) {
final ReceiveMessage result = new ReceiveMessage();
final MessageItem messageItem = messagingItem.getMessage();
result.setNativePayload(FacebookPlatformEnum.FACEBOOK, messagingItem);
handleSender(messagingItem.getSender(), result);
handleRecipient(messagingItem.getRecipient(), result);
if (params != null) {
result.getParams().putAll(params);
}
if (messageItem != null) {
handleMessageItem(messageItem, result);
}
if (messagingItem.getPostback() != null) {
handlePostbackItem(messagingItem.getPostback(), result);
}
if (messagingItem.getDelivery() != null) {
handleDeliveryItem(messagingItem.getDelivery(), result);
}
if (messagingItem.getRead() != null) {
handleReadItem(messagingItem.getRead(), result);
}
return result;
}
示例4: handleMessagingItem
import com.restfb.types.webhook.messaging.MessagingItem; //导入依赖的package包/类
@Override
public void handleMessagingItem(final MessagingItem messagingItem, final Map<String, String[]> params) {
final ReceiveMessage receiveMessage = facebookReceiveMessageFactory.createReceiveMessage(messagingItem, params);
if (receiveMessage != null) {
messageReceiver.receive(receiveMessage);
}
}
示例5: testOnMessage
import com.restfb.types.webhook.messaging.MessagingItem; //导入依赖的package包/类
@Test
public void testOnMessage() {
MessageItem message = new MessageItem();
MessagingItem messagingItem = new MessagingItem();
messagingItem.setMessage(message);
WebhookObject webhookObject = createWebhookObjectWithMessagingItem(messagingItem);
spyCallbackHandler.onCallback(messenger, webhookObject);
verify(spyCallbackHandler, times(1)).onMessage(messenger, messagingItem);
verifyNoMoreInteractions(spyCallbackHandler);
}
示例6: testOnMessageDelivered
import com.restfb.types.webhook.messaging.MessagingItem; //导入依赖的package包/类
@Test
public void testOnMessageDelivered() {
DeliveryItem delivery = new DeliveryItem();
MessagingItem messagingItem = new MessagingItem();
messagingItem.setDelivery(delivery);
WebhookObject webhookObject = createWebhookObjectWithMessagingItem(messagingItem);
spyCallbackHandler.onCallback(messenger, webhookObject);
verify(spyCallbackHandler, times(1)).onMessageDelivered(messenger, messagingItem);
verifyNoMoreInteractions(spyCallbackHandler);
}
示例7: testOnMessageRead
import com.restfb.types.webhook.messaging.MessagingItem; //导入依赖的package包/类
@Test
public void testOnMessageRead() {
ReadItem read = new ReadItem();
MessagingItem messagingItem = new MessagingItem();
messagingItem.setRead(read);
WebhookObject webhookObject = createWebhookObjectWithMessagingItem(messagingItem);
spyCallbackHandler.onCallback(messenger, webhookObject);
verify(spyCallbackHandler, times(1)).onMessageRead(messenger, messagingItem);
verifyNoMoreInteractions(spyCallbackHandler);
}
示例8: testOnMessageEcho
import com.restfb.types.webhook.messaging.MessagingItem; //导入依赖的package包/类
@Test
public void testOnMessageEcho() {
MessageItem message = new MessageItem();
message.setEcho(true);
MessagingItem messagingItem = new MessagingItem();
messagingItem.setMessage(message);
WebhookObject webhookObject = createWebhookObjectWithMessagingItem(messagingItem);
spyCallbackHandler.onCallback(messenger, webhookObject);
verify(spyCallbackHandler, times(1)).onMessageEcho(messenger, messagingItem);
verifyNoMoreInteractions(spyCallbackHandler);
}
示例9: testOnPostback
import com.restfb.types.webhook.messaging.MessagingItem; //导入依赖的package包/类
@Test
public void testOnPostback() {
PostbackItem postback = new PostbackItem();
MessagingItem messagingItem = new MessagingItem();
messagingItem.setPostback(postback);
WebhookObject webhookObject = createWebhookObjectWithMessagingItem(messagingItem);
spyCallbackHandler.onCallback(messenger, webhookObject);
verify(spyCallbackHandler, times(1)).onPostback(messenger, messagingItem);
verifyNoMoreInteractions(spyCallbackHandler);
}
示例10: testOnOptin
import com.restfb.types.webhook.messaging.MessagingItem; //导入依赖的package包/类
@Test
public void testOnOptin() {
OptinItem optin = new OptinItem();
MessagingItem messagingItem = new MessagingItem();
messagingItem.setOptin(optin);
WebhookObject webhookObject = createWebhookObjectWithMessagingItem(messagingItem);
spyCallbackHandler.onCallback(messenger, webhookObject);
verify(spyCallbackHandler, times(1)).onOptin(messenger, messagingItem);
verifyNoMoreInteractions(spyCallbackHandler);
}
示例11: testOnReferral
import com.restfb.types.webhook.messaging.MessagingItem; //导入依赖的package包/类
@Test
public void testOnReferral() {
ReferralItem referral = new ReferralItem();
MessagingItem messagingItem = new MessagingItem();
messagingItem.setReferral(referral);
WebhookObject webhookObject = createWebhookObjectWithMessagingItem(messagingItem);
spyCallbackHandler.onCallback(messenger, webhookObject);
verify(spyCallbackHandler, times(1)).onReferral(messenger, messagingItem);
verifyNoMoreInteractions(spyCallbackHandler);
}
示例12: testOnPayment
import com.restfb.types.webhook.messaging.MessagingItem; //导入依赖的package包/类
@Test
public void testOnPayment() {
PaymentItem payment = new PaymentItem();
MessagingItem messagingItem = new MessagingItem();
messagingItem.setPayment(payment);
WebhookObject webhookObject = createWebhookObjectWithMessagingItem(messagingItem);
spyCallbackHandler.onCallback(messenger, webhookObject);
verify(spyCallbackHandler, times(1)).onPayment(messenger, messagingItem);
verifyNoMoreInteractions(spyCallbackHandler);
}
示例13: testOnCheckoutUpdate
import com.restfb.types.webhook.messaging.MessagingItem; //导入依赖的package包/类
@Test
public void testOnCheckoutUpdate() {
CheckoutUpdateItem checkoutUpdate = new CheckoutUpdateItem();
MessagingItem messagingItem = new MessagingItem();
messagingItem.setCheckoutUpdate(checkoutUpdate);
WebhookObject webhookObject = createWebhookObjectWithMessagingItem(messagingItem);
spyCallbackHandler.onCallback(messenger, webhookObject);
verify(spyCallbackHandler, times(1)).onCheckoutUpdate(messenger, messagingItem);
verifyNoMoreInteractions(spyCallbackHandler);
}
示例14: testOnAccountLinking
import com.restfb.types.webhook.messaging.MessagingItem; //导入依赖的package包/类
@Test
public void testOnAccountLinking() {
AccountLinkingItem accountLinking = new AccountLinkingItem();
MessagingItem messagingItem = new MessagingItem();
messagingItem.setAccountLinking(accountLinking);
WebhookObject webhookObject = createWebhookObjectWithMessagingItem(messagingItem);
spyCallbackHandler.onCallback(messenger, webhookObject);
verify(spyCallbackHandler, times(1)).onAccountLinking(messenger, messagingItem);
verifyNoMoreInteractions(spyCallbackHandler);
}
示例15: testOnPolicyEnforcement
import com.restfb.types.webhook.messaging.MessagingItem; //导入依赖的package包/类
@Test
public void testOnPolicyEnforcement() {
PolicyEnforcementItem policyEnforcement = new PolicyEnforcementItem();
MessagingItem messagingItem = new MessagingItem();
messagingItem.setPolicyEnforcement(policyEnforcement);
WebhookObject webhookObject = createWebhookObjectWithMessagingItem(messagingItem);
spyCallbackHandler.onCallback(messenger, webhookObject);
verify(spyCallbackHandler, times(1)).onPolicyEnforcement(messenger, messagingItem);
verifyNoMoreInteractions(spyCallbackHandler);
}