From f3f44de30e3c7ca089ed332f1117bc7152547e86 Mon Sep 17 00:00:00 2001 From: Tracy Boehrer Date: Mon, 9 Sep 2019 14:55:34 -0500 Subject: [PATCH 1/2] Removed bot-connector sync methods. --- .../microsoft/bot/connector/Attachments.java | 23 -- .../bot/connector/Conversations.java | 218 ------------------ .../EnterpriseChannelValidation.java | 2 +- .../GovernmentChannelValidation.java | 2 +- .../authentication/JwtTokenExtractor.java | 2 +- .../authentication/JwtTokenValidation.java | 2 +- .../connector/authentication/OAuthClient.java | 8 +- .../bot/connector/rest/RestAttachments.java | 29 --- .../bot/connector/rest/RestConversations.java | 156 ++----------- .../bot/connector/AttachmentsTest.java | 14 +- .../bot/connector/ConversationsTest.java | 96 ++++---- .../bot/connector/OAuthTestBase.java | 2 +- 12 files changed, 77 insertions(+), 477 deletions(-) diff --git a/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/Attachments.java b/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/Attachments.java index 18741d1c..7c58230e 100644 --- a/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/Attachments.java +++ b/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/Attachments.java @@ -16,17 +16,6 @@ import java.util.concurrent.CompletableFuture; * in Attachments. */ public interface Attachments { - /** - * GetAttachmentInfo. - * Get AttachmentInfo structure describing the attachment views. - * - * @param attachmentId attachment id - * @return the AttachmentInfo object if successful. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - */ - AttachmentInfo getAttachmentInfo(String attachmentId); - /** * GetAttachmentInfo. * Get AttachmentInfo structure describing the attachment views. @@ -37,18 +26,6 @@ public interface Attachments { */ CompletableFuture getAttachmentInfo(String attachmentId); - /** - * GetAttachment. - * Get the named view as binary content. - * - * @param attachmentId attachment id - * @param viewId View id from attachmentInfo - * @return the InputStream object if successful. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - */ - InputStream getAttachment(String attachmentId, String viewId); - /** * GetAttachment. * Get the named view as binary content. diff --git a/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/Conversations.java b/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/Conversations.java index be16e9df..f6276456 100644 --- a/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/Conversations.java +++ b/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/Conversations.java @@ -21,23 +21,6 @@ import java.util.concurrent.CompletableFuture; * in Conversations. */ public interface Conversations { - /** - * GetConversations. - * List the Conversations in which this bot has participated. - * GET from this method with a skip token - * The return value is a ConversationsResult, which contains an array of ConversationMembers and a skip token. - * If the skip token is not empty, then there are further values to be returned. Call this method again with - * the returned token to get more values. - * - * Each ConversationMembers object contains the ID of the conversation and an array of ChannelAccounts that - * describe the members of the conversation. - * - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the ConversationsResult object if successful. - */ - ConversationsResult getConversations(); - /** * GetConversations. * List the Conversations in which this bot has participated. @@ -54,24 +37,6 @@ public interface Conversations { */ CompletableFuture getConversations(); - /** - * GetConversations. - * List the Conversations in which this bot has participated. - * GET from this method with a skip token - * The return value is a ConversationsResult, which contains an array of ConversationMembers and a skip token. - * If the skip token is not empty, then there are further values to be returned. Call this method again with the - * returned token to get more values. - * - * Each ConversationMembers object contains the ID of the conversation and an array of ChannelAccounts that - * describe the members of the conversation. - * - * @param continuationToken skip or continuation token - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the ConversationsResult object if successful. - */ - ConversationsResult getConversations(String continuationToken); - /** * GetConversations. * List the Conversations in which this bot has participated. @@ -88,30 +53,6 @@ public interface Conversations { */ CompletableFuture getConversations(String continuationToken); - /** - * CreateConversation. - * Create a new Conversation. - * POST to this method with a - * Bot being the bot creating the conversation - * IsGroup set to true if this is not a direct message (default is false) - * Members array contining the members you want to have be in the conversation. - * The return value is a ResourceResponse which contains a conversation id which is suitable for use in the - * message payload and REST API uris. - * Most channels only support the semantics of bots initiating a direct message conversation. An example of how - * to do that would be: - * ``` - * var resource = await connector.conversations.CreateConversation(new ConversationParameters(){ Bot = bot, - * members = new ChannelAccount[] { new ChannelAccount("user1") } ); - * await connect.Conversations.SendToConversation(resource.Id, new Activity() ... ) ; - * ```. - * - * @param parameters Parameters to create the conversation from - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the ConversationResourceResponse object if successful. - */ - ConversationResourceResponse createConversation(ConversationParameters parameters); - /** * CreateConversation. * Create a new Conversation. @@ -135,25 +76,6 @@ public interface Conversations { */ CompletableFuture createConversation(ConversationParameters parameters); - /** - * SendToConversation. - * This method allows you to send an activity to the end of a conversation. - * This is slightly different from ReplyToActivity(). - * SendToConverstion(conversationId) - will append the activity to the end of the conversation according to the - * timestamp or semantics of the channel. - * ReplyToActivity(conversationId,ActivityId) - adds the activity as a reply to another activity, if the channel - * supports it. If the channel does not support nested replies, ReplyToActivity falls back to SendToConversation. - * Use ReplyToActivity when replying to a specific activity in the conversation. - * Use SendToConversation in all other cases. - * - * @param conversationId Conversation ID - * @param activity Activity to send - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the ResourceResponse object if successful. - */ - ResourceResponse sendToConversation(String conversationId, Activity activity); - /** * SendToConversation. * This method allows you to send an activity to the end of a conversation. @@ -172,21 +94,6 @@ public interface Conversations { */ CompletableFuture sendToConversation(String conversationId, Activity activity); - /** - * UpdateActivity. - * Edit an existing activity. - * Some channels allow you to edit an existing activity to reflect the new state of a bot conversation. - * For example, you can remove buttons after someone has clicked "Approve" button. - * - * @param conversationId Conversation ID - * @param activityId activityId to update - * @param activity replacement Activity - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the ResourceResponse object if successful. - */ - ResourceResponse updateActivity(String conversationId, String activityId, Activity activity); - /** * UpdateActivity. * Edit an existing activity. @@ -201,26 +108,6 @@ public interface Conversations { */ CompletableFuture updateActivity(String conversationId, String activityId, Activity activity); - /** - * ReplyToActivity. - * This method allows you to reply to an activity. - * This is slightly different from SendToConversation(). - * SendToConverstion(conversationId) - will append the activity to the end of the conversation according to the - * timestamp or semantics of the channel. - * ReplyToActivity(conversationId,ActivityId) - adds the activity as a reply to another activity, if the channel - * supports it. If the channel does not support nested replies, ReplyToActivity falls back to SendToConversation. - * Use ReplyToActivity when replying to a specific activity in the conversation. - * Use SendToConversation in all other cases. - * - * @param conversationId Conversation ID - * @param activityId activityId the reply is to (OPTIONAL) - * @param activity Activity to send - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the ResourceResponse object if successful. - */ - ResourceResponse replyToActivity(String conversationId, String activityId, Activity activity); - /** * ReplyToActivity. * This method allows you to reply to an activity. @@ -240,19 +127,6 @@ public interface Conversations { */ CompletableFuture replyToActivity(String conversationId, String activityId, Activity activity); - /** - * DeleteActivity. - * Delete an existing activity. - * Some channels allow you to delete an existing activity, and if successful this method will remove the - * specified activity. - * - * @param conversationId Conversation ID - * @param activityId activityId to delete - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - */ - void deleteActivity(String conversationId, String activityId); - /** * DeleteActivity. * Delete an existing activity. @@ -266,19 +140,6 @@ public interface Conversations { */ CompletableFuture deleteActivity(String conversationId, String activityId); - /** - * GetConversationMembers. - * Enumerate the members of a converstion. - * This REST API takes a ConversationId and returns an array of ChannelAccount objects representing the members - * of the conversation. - * - * @param conversationId Conversation ID - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the List<ChannelAccount> object if successful. - */ - List getConversationMembers(String conversationId); - /** * GetConversationMembers. * Enumerate the members of a converstion. @@ -291,19 +152,6 @@ public interface Conversations { */ CompletableFuture> getConversationMembers(String conversationId); - /** - * DeleteConversationMember. - * Deletes a member from a conversation. - * This REST API takes a ConversationId and a memberId (of type string) and removes that member from the - * conversation. If that member was the last member of the conversation, the conversation will also be deleted. - * - * @param conversationId Conversation ID - * @param memberId ID of the member to delete from this conversation - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - */ - void deleteConversationMember(String conversationId, String memberId); - /** * DeleteConversationMember. * Deletes a member from a conversation. @@ -317,20 +165,6 @@ public interface Conversations { */ CompletableFuture deleteConversationMember(String conversationId, String memberId); - /** - * GetActivityMembers. - * Enumerate the members of an activity. - * This REST API takes a ConversationId and a ActivityId, returning an array of ChannelAccount objects - * representing the members of the particular activity in the conversation. - * - * @param conversationId Conversation ID - * @param activityId Activity ID - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the List<ChannelAccount> object if successful. - */ - List getActivityMembers(String conversationId, String activityId); - /** * GetActivityMembers. * Enumerate the members of an activity. @@ -344,21 +178,6 @@ public interface Conversations { */ CompletableFuture> getActivityMembers(String conversationId, String activityId); - /** - * UploadAttachment. - * Upload an attachment directly into a channel's blob storage. - * This is useful because it allows you to store data in a compliant store when dealing with enterprises. - * The response is a ResourceResponse which contains an AttachmentId which is suitable for using with the - * attachments API. - * - * @param conversationId Conversation ID - * @param attachmentUpload Attachment data - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the ResourceResponse object if successful. - */ - ResourceResponse uploadAttachment(String conversationId, AttachmentData attachmentUpload); - /** * UploadAttachment. * Upload an attachment directly into a channel's blob storage. @@ -373,21 +192,6 @@ public interface Conversations { */ CompletableFuture uploadAttachment(String conversationId, AttachmentData attachmentUpload); - /** - * This method allows you to upload the historic activities to the conversation. - * - * Sender must ensure that the historic activities have unique ids and appropriate timestamps. - * The ids are used by the client to deal with duplicate activities and the timestamps are used by - * the client to render the activities in the right order. - * - * @param conversationId Conversation ID - * @param history Historic activities - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the ResourceResponse object if successful. - */ - ResourceResponse sendConversationHistory(String conversationId, Transcript history); - /** * This method allows you to upload the historic activities to the conversation. * @@ -403,28 +207,6 @@ public interface Conversations { */ CompletableFuture sendConversationHistory(String conversationId, Transcript history); - /** - * Enumerate the members of a conversation one page at a time. - * - * This REST API takes a ConversationId. Optionally a pageSize and/or continuationToken can be provided. - * It returns a PagedMembersResult, which contains an array of ChannelAccounts representing the members - * of the conversation and a continuation token that can be used to get more values. - * - * One page of ChannelAccounts records are returned with each call. The number of records in a page may - * vary between channels and calls. The pageSize parameter can be used as a suggestion. If there are no - * additional results the response will not contain a continuation token. If there are no members in the - * conversation the Members will be empty or not present in the response. - * - * A response to a request that has a continuation token from a prior request may rarely return members - * from a previous request. - * - * @param conversationId Conversation ID - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PagedMembersResult object if successful. - */ - PagedMembersResult getConversationPagedMembers(String conversationId); - /** * Enumerate the members of a conversation one page at a time. * diff --git a/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/EnterpriseChannelValidation.java b/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/EnterpriseChannelValidation.java index 97f4c69e..a8983e0c 100644 --- a/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/EnterpriseChannelValidation.java +++ b/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/EnterpriseChannelValidation.java @@ -96,7 +96,7 @@ public class EnterpriseChannelValidation { public static CompletableFuture validateIdentity(ClaimsIdentity identity, CredentialProvider credentials, String serviceUrl) { - return CompletableFuture.supply(() -> { + return CompletableFuture.supplyAsync(() -> { if (identity == null || !identity.isAuthenticated()) { throw new AuthenticationException("Invalid Identity"); } diff --git a/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/GovernmentChannelValidation.java b/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/GovernmentChannelValidation.java index b6849780..60949cbb 100644 --- a/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/GovernmentChannelValidation.java +++ b/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/GovernmentChannelValidation.java @@ -89,7 +89,7 @@ public class GovernmentChannelValidation { CredentialProvider credentials, String serviceUrl) { - return CompletableFuture.supply(() -> { + return CompletableFuture.supplyAsync(() -> { if (identity == null || !identity.isAuthenticated()) { throw new AuthenticationException("Invalid Identity"); } diff --git a/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/JwtTokenExtractor.java b/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/JwtTokenExtractor.java index f4ad614b..a7d313c8 100644 --- a/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/JwtTokenExtractor.java +++ b/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/JwtTokenExtractor.java @@ -92,7 +92,7 @@ public class JwtTokenExtractor { return CompletableFuture.completedFuture(null); } - return CompletableFuture.supply(() -> { + return CompletableFuture.supplyAsync(() -> { Verification verification = JWT.require(Algorithm.RSA256(key.key, null)); try { verification.build().verify(token); diff --git a/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/JwtTokenValidation.java b/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/JwtTokenValidation.java index 2b403d5c..ce873abc 100644 --- a/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/JwtTokenValidation.java +++ b/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/JwtTokenValidation.java @@ -47,7 +47,7 @@ public class JwtTokenValidation { CredentialProvider credentials, ChannelProvider channelProvider, AuthenticationConfiguration authConfig) { - return CompletableFuture.supply(() -> { + return CompletableFuture.supplyAsync(() -> { if (StringUtils.isEmpty(authHeader)) { // No auth header was sent. We might be on the anonymous code path. boolean isAuthDisable = credentials.isAuthenticationDisabled().join(); diff --git a/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/OAuthClient.java b/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/OAuthClient.java index 659be6bc..7d941e65 100644 --- a/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/OAuthClient.java +++ b/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/OAuthClient.java @@ -111,7 +111,7 @@ public class OAuthClient extends ServiceClient { throw new IllegalArgumentException("connectionName"); } - return CompletableFuture.supply(() -> { + return CompletableFuture.supplyAsync(() -> { // Construct URL HashMap qstrings = new HashMap<>(); qstrings.put("userId", userId); @@ -180,7 +180,7 @@ public class OAuthClient extends ServiceClient { throw new IllegalArgumentException("connectionName"); } - return CompletableFuture.supply(() -> { + return CompletableFuture.supplyAsync(() -> { // Construct URL HashMap qstrings = new HashMap<>(); qstrings.put("userId", userId); @@ -264,7 +264,7 @@ public class OAuthClient extends ServiceClient { String strUri = String.format("%sapi/botsignin/getsigninurl", this.uri); final URI tokenUrl = MakeUri(strUri, qstrings); - return CompletableFuture.supply(() -> { + return CompletableFuture.supplyAsync(() -> { // add botframework api service url to the list of trusted service url's for these app credentials. MicrosoftAppCredentials.trustServiceUrl(tokenUrl); @@ -310,7 +310,7 @@ public class OAuthClient extends ServiceClient { // add botframework api service url to the list of trusted service url's for these app credentials. MicrosoftAppCredentials.trustServiceUrl(tokenUrl); - return CompletableFuture.run(() -> { + return CompletableFuture.runAsync(() -> { // Construct dummy body RequestBody body = RequestBody.create(JSON, "{}"); diff --git a/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/rest/RestAttachments.java b/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/rest/RestAttachments.java index ca99a417..b90c3cbc 100644 --- a/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/rest/RestAttachments.java +++ b/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/rest/RestAttachments.java @@ -65,20 +65,6 @@ public class RestAttachments implements Attachments { } - /** - * GetAttachmentInfo. - * Get AttachmentInfo structure describing the attachment views. - * - * @param attachmentId attachment id - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws ErrorResponseException thrown if the request is rejected by server - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the AttachmentInfo object if successful. - */ - public AttachmentInfo getAttachmentInfo(String attachmentId) { - return getAttachmentInfo(attachmentId).join(); - } - /** * GetAttachmentInfo. * Get AttachmentInfo structure describing the attachment views. @@ -113,21 +99,6 @@ public class RestAttachments implements Attachments { .build(response); } - /** - * GetAttachment. - * Get the named view as binary content. - * - * @param attachmentId attachment id - * @param viewId View id from attachmentInfo - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws ErrorResponseException thrown if the request is rejected by server - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the InputStream object if successful. - */ - public InputStream getAttachment(String attachmentId, String viewId) { - return getAttachment(attachmentId, viewId).join(); - } - /** * GetAttachment. * Get the named view as binary content. diff --git a/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/rest/RestConversations.java b/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/rest/RestConversations.java index d227b16b..f3620841 100644 --- a/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/rest/RestConversations.java +++ b/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/rest/RestConversations.java @@ -138,40 +138,20 @@ public class RestConversations implements Conversations { @Header("User-Agent") String userAgent); } - /** - * Implementation of getConversations. - * - * @see Conversations#getConversations - */ - @Override - public ConversationsResult getConversations() { - return getConversations().join(); - } - /** * Implementation of getConversationsAsync. * - * @see Conversations#getConversationsAsync + * @see Conversations#getConversations */ @Override public CompletableFuture getConversations() { return getConversations(null); } - /** - * Implementation of getConversations. - * - * @see Conversations#getConversations - */ - @Override - public ConversationsResult getConversations(String continuationToken) { - return getConversations(continuationToken).join(); - } - /** * Implementation of getConversationsAsync. * - * @see Conversations#getConversationsAsync + * @see Conversations#getConversations */ @Override public CompletableFuture getConversations(String continuationToken) { @@ -196,20 +176,10 @@ public class RestConversations implements Conversations { .build(response); } - /** - * Implementation of CreateConversation. - * - * @see Conversations#createConversation - */ - @Override - public ConversationResourceResponse createConversation(ConversationParameters parameters) { - return createConversation(parameters).join(); - } - /** * Implementation of createConversationWithServiceResponseAsync. * - * @see Conversations#createConversationAsync + * @see Conversations#createConversation */ @Override public CompletableFuture createConversation(ConversationParameters parameters) { @@ -241,20 +211,10 @@ public class RestConversations implements Conversations { .build(response); } - /** - * Implementation of sendToConversation. - * - * @see Conversations#sendToConversation - */ - @Override - public ResourceResponse sendToConversation(String conversationId, Activity activity) { - return sendToConversation(conversationId, activity).join(); - } - /** * Implementation of sendToConversationAsync. * - * @see Conversations#sendToConversationAsync + * @see Conversations#sendToConversation */ @Override public CompletableFuture sendToConversation(String conversationId, Activity activity) { @@ -289,20 +249,10 @@ public class RestConversations implements Conversations { .build(response); } - /** - * Implementation of updateActivity. - * - * @see Conversations#updateActivity - */ - @Override - public ResourceResponse updateActivity(String conversationId, String activityId, Activity activity) { - return updateActivity(conversationId, activityId, activity).join(); - } - /** * Implementation of updateActivityAsync. * - * @see Conversations#updateActivityAsync + * @see Conversations#updateActivity */ @Override public CompletableFuture updateActivity(String conversationId, String activityId, Activity activity) { @@ -340,20 +290,10 @@ public class RestConversations implements Conversations { .build(response); } - /** - * Implementation of replyToActivity. - * - * @see Conversations#replyToActivity - */ - @Override - public ResourceResponse replyToActivity(String conversationId, String activityId, Activity activity) { - return replyToActivity(conversationId, activityId, activity).join(); - } - /** * Implementation of replyToActivityAsync. * - * @see Conversations#replyToActivityAsync + * @see Conversations#replyToActivity */ @Override public CompletableFuture replyToActivity(String conversationId, @@ -393,20 +333,10 @@ public class RestConversations implements Conversations { .build(response); } - /** - * Implementation of deleteActivity. - * - * @see Conversations#deleteActivity - */ - @Override - public void deleteActivity(String conversationId, String activityId) { - deleteActivity(conversationId, activityId).join(); - } - /** * Implementation of deleteActivityWithServiceResponseAsync. * - * @see Conversations#deleteActivityAsync + * @see Conversations#deleteActivity */ @Override public CompletableFuture deleteActivity(String conversationId, String activityId) { @@ -439,20 +369,10 @@ public class RestConversations implements Conversations { .build(response); } - /** - * Implementation of getConversationMembers. - * - * @see Conversations#getConversationMembers - */ - @Override - public List getConversationMembers(String conversationId) { - return getConversationMembers(conversationId).join(); - } - /** * Implementation of getConversationMembersAsync. * - * @see Conversations#getConversationMembersAsync + * @see Conversations#getConversationMembers */ @Override public CompletableFuture> getConversationMembers(String conversationId) { @@ -480,20 +400,10 @@ public class RestConversations implements Conversations { .build(response); } - /** - * Implementation of deleteConversationMember. - * - * @see Conversations#deleteConversationMember - */ - @Override - public void deleteConversationMember(String conversationId, String memberId) { - deleteConversationMember(conversationId, memberId).join(); - } - /** * Implementation of deleteConversationMemberWithServiceResponseAsync. * - * @see Conversations#deleteConversationMemberAsync + * @see Conversations#deleteConversationMember */ @Override public CompletableFuture deleteConversationMember(String conversationId, String memberId) { @@ -527,20 +437,10 @@ public class RestConversations implements Conversations { .build(response); } - /** - * Implementation of getActivityMembers. - * - * @see Conversations#getActivityMembers - */ - @Override - public List getActivityMembers(String conversationId, String activityId) { - return getActivityMembers(conversationId, activityId).join(); - } - /** * Implementation of getActivityMembersAsync. * - * @see Conversations#getActivityMembersAsync + * @see Conversations#getActivityMembers */ @Override public CompletableFuture> getActivityMembers(String conversationId, String activityId) { @@ -572,20 +472,10 @@ public class RestConversations implements Conversations { .build(response); } - /** - * Implementation of uploadAttachment. - * - * @see Conversations#uploadAttachment - */ - @Override - public ResourceResponse uploadAttachment(String conversationId, AttachmentData attachmentUpload) { - return uploadAttachment(conversationId, attachmentUpload).join(); - } - /** * Implementation of uploadAttachmentAsync. * - * @see Conversations#uploadAttachmentAsync + * @see Conversations#uploadAttachment */ @Override public CompletableFuture uploadAttachment(String conversationId, AttachmentData attachmentUpload) { @@ -621,20 +511,10 @@ public class RestConversations implements Conversations { } - /** - * Implementation of sendConversationHistory. - * - * @see Conversations#sendConversationHistory - */ - @Override - public ResourceResponse sendConversationHistory(String conversationId, Transcript history) { - return sendConversationHistory(conversationId, history).join(); - } - /** * Implementation of sendConversationHistoryAsync. * - * @see Conversations#sendConversationHistoryAsync + * @see Conversations#sendConversationHistory */ @Override public CompletableFuture sendConversationHistory(String conversationId, Transcript history) { @@ -670,20 +550,10 @@ public class RestConversations implements Conversations { } - /** - * Implementation of getConversationPagedMembers. - * - * @see Conversations#getConversationPagedMembers - */ - @Override - public PagedMembersResult getConversationPagedMembers(String conversationId){ - return getConversationPagedMembers(conversationId).join(); - } - /** * Implementation of getConversationPagedMembersAsync. * - * @see Conversations#getConversationPagedMembersAsync + * @see Conversations#getConversationPagedMembers */ @Override public CompletableFuture getConversationPagedMembers(String conversationId){ diff --git a/libraries/bot-connector/src/test/java/com/microsoft/bot/connector/AttachmentsTest.java b/libraries/bot-connector/src/test/java/com/microsoft/bot/connector/AttachmentsTest.java index 6b88f87d..469fd7c8 100644 --- a/libraries/bot-connector/src/test/java/com/microsoft/bot/connector/AttachmentsTest.java +++ b/libraries/bot-connector/src/test/java/com/microsoft/bot/connector/AttachmentsTest.java @@ -24,11 +24,11 @@ public class AttachmentsTest extends BotConnectorTestBase { setBot(bot); }}; - ConversationResourceResponse conversation = connector.getConversations().createConversation(createMessage); + ConversationResourceResponse conversation = connector.getConversations().createConversation(createMessage).join(); - ResourceResponse attachmentResponse = connector.getConversations().uploadAttachment(conversation.getId(), attachment); + ResourceResponse attachmentResponse = connector.getConversations().uploadAttachment(conversation.getId(), attachment).join(); - AttachmentInfo response = connector.getAttachments().getAttachmentInfo(attachmentResponse.getId()); + AttachmentInfo response = connector.getAttachments().getAttachmentInfo(attachmentResponse.getId()).join(); Assert.assertEquals(attachment.getName(), response.getName()); } @@ -57,14 +57,14 @@ public class AttachmentsTest extends BotConnectorTestBase { setBot(bot); }}; - ConversationResourceResponse conversation = connector.getConversations().createConversation(createMessage); + ConversationResourceResponse conversation = connector.getConversations().createConversation(createMessage).join(); - ResourceResponse attachmentResponse = connector.getConversations().uploadAttachment(conversation.getId(), attachment); + ResourceResponse attachmentResponse = connector.getConversations().uploadAttachment(conversation.getId(), attachment).join(); - AttachmentInfo attachmentInfo = connector.getAttachments().getAttachmentInfo(attachmentResponse.getId()); + AttachmentInfo attachmentInfo = connector.getAttachments().getAttachmentInfo(attachmentResponse.getId()).join(); for (AttachmentView attView : attachmentInfo.getViews()) { - InputStream retrievedAttachment = connector.getAttachments().getAttachment(attachmentResponse.getId(), attView.getViewId()); + InputStream retrievedAttachment = connector.getAttachments().getAttachment(attachmentResponse.getId(), attView.getViewId()).join(); Assert.assertTrue(isSame(retrievedAttachment, attachmentStream)); } diff --git a/libraries/bot-connector/src/test/java/com/microsoft/bot/connector/ConversationsTest.java b/libraries/bot-connector/src/test/java/com/microsoft/bot/connector/ConversationsTest.java index e41020cd..11457670 100644 --- a/libraries/bot-connector/src/test/java/com/microsoft/bot/connector/ConversationsTest.java +++ b/libraries/bot-connector/src/test/java/com/microsoft/bot/connector/ConversationsTest.java @@ -33,7 +33,7 @@ public class ConversationsTest extends BotConnectorTestBase { setActivity(activity); }}; - ConversationResourceResponse result = connector.getConversations().createConversation(params); + ConversationResourceResponse result = connector.getConversations().createConversation(params).join(); Assert.assertNotNull(result.getActivityId()); } @@ -55,7 +55,7 @@ public class ConversationsTest extends BotConnectorTestBase { }}; try { - ConversationResourceResponse result = connector.getConversations().createConversation(params); + ConversationResourceResponse result = connector.getConversations().createConversation(params).join(); Assert.fail("expected exception did not occur."); } catch (CompletionException e) { if (e.getCause() instanceof ErrorResponseException) { @@ -83,7 +83,7 @@ public class ConversationsTest extends BotConnectorTestBase { }}; try { - ConversationResourceResponse result = connector.getConversations().createConversation(params); + ConversationResourceResponse result = connector.getConversations().createConversation(params).join(); Assert.fail("expected exception did not occur."); } catch (CompletionException e) { if (e.getCause() instanceof ErrorResponseException) { @@ -111,7 +111,7 @@ public class ConversationsTest extends BotConnectorTestBase { }}; try { - ConversationResourceResponse result = connector.getConversations().createConversation(params); + ConversationResourceResponse result = connector.getConversations().createConversation(params).join(); Assert.fail("expected exception did not occur."); } catch (CompletionException e) { Assert.assertEquals("BadArgument", ((ErrorResponseException)e.getCause()).body().getError().getCode()); @@ -121,7 +121,7 @@ public class ConversationsTest extends BotConnectorTestBase { @Test public void CreateConversationWithNullParameter() { try { - ConversationResourceResponse result = connector.getConversations().createConversation(null); + ConversationResourceResponse result = connector.getConversations().createConversation(null).join(); Assert.fail("expected exception did not occur."); } catch (IllegalArgumentException e) { Assert.assertTrue(e.getMessage().contains("cannot be null")); @@ -136,9 +136,9 @@ public class ConversationsTest extends BotConnectorTestBase { setBot(bot); }}; - ConversationResourceResponse conversation = connector.getConversations().createConversation(createMessage); + ConversationResourceResponse conversation = connector.getConversations().createConversation(createMessage).join(); - List members = connector.getConversations().getConversationMembers(conversation.getId()); + List members = connector.getConversations().getConversationMembers(conversation.getId()).join(); boolean hasUser = false; @@ -158,10 +158,10 @@ public class ConversationsTest extends BotConnectorTestBase { setBot(bot); }}; - ConversationResourceResponse conversation = connector.getConversations().createConversation(createMessage); + ConversationResourceResponse conversation = connector.getConversations().createConversation(createMessage).join(); try { - List members = connector.getConversations().getConversationMembers(conversation.getId().concat("M")); + List members = connector.getConversations().getConversationMembers(conversation.getId().concat("M")).join(); Assert.fail("expected exception did not occur."); } catch (CompletionException e) { if (e.getCause() instanceof ErrorResponseException) { @@ -176,7 +176,7 @@ public class ConversationsTest extends BotConnectorTestBase { @Test public void GetConversationMembersWithNullConversationId() { try { - List members = connector.getConversations().getConversationMembers(null); + List members = connector.getConversations().getConversationMembers(null).join(); Assert.fail("expected exception did not occur."); } catch (IllegalArgumentException e) { Assert.assertTrue(e.getMessage().contains("cannot be null")); @@ -190,10 +190,10 @@ public class ConversationsTest extends BotConnectorTestBase { setBot(bot); }}; - ConversationResourceResponse conversation = connector.getConversations().createConversation(createMessage); + ConversationResourceResponse conversation = connector.getConversations().createConversation(createMessage).join(); try { - PagedMembersResult pagedMembers = connector.getConversations().getConversationPagedMembers(conversation.getId()); + PagedMembersResult pagedMembers = connector.getConversations().getConversationPagedMembers(conversation.getId()).join(); boolean hasUser = false; for (ChannelAccount member : pagedMembers.getMembers()) { @@ -222,10 +222,10 @@ public class ConversationsTest extends BotConnectorTestBase { setActivity(activity); }}; - ConversationResourceResponse conversation = connector.getConversations().createConversation(createMessage); + ConversationResourceResponse conversation = connector.getConversations().createConversation(createMessage).join(); try { - connector.getConversations().getConversationPagedMembers(conversation.getId().concat("M")); + connector.getConversations().getConversationPagedMembers(conversation.getId().concat("M")).join(); Assert.fail("expected exception did not occur."); } catch (CompletionException e) { if (e.getCause() instanceof ErrorResponseException) { @@ -251,9 +251,9 @@ public class ConversationsTest extends BotConnectorTestBase { setBot(bot); }}; - ConversationResourceResponse conversation = connector.getConversations().createConversation(createMessage); + ConversationResourceResponse conversation = connector.getConversations().createConversation(createMessage).join(); - ResourceResponse response = connector.getConversations().sendToConversation(conversation.getId(), activity); + ResourceResponse response = connector.getConversations().sendToConversation(conversation.getId(), activity).join(); Assert.assertNotNull(response.getId()); } @@ -273,10 +273,10 @@ public class ConversationsTest extends BotConnectorTestBase { setBot(bot); }}; - ConversationResourceResponse conversation = connector.getConversations().createConversation(createMessage); + ConversationResourceResponse conversation = connector.getConversations().createConversation(createMessage).join(); try { - ResourceResponse response = connector.getConversations().sendToConversation(conversation.getId().concat("M"), activity); + ResourceResponse response = connector.getConversations().sendToConversation(conversation.getId().concat("M"), activity).join(); Assert.fail("expected exception did not occur."); } catch (CompletionException e) { if (e.getCause() instanceof ErrorResponseException) { @@ -296,7 +296,7 @@ public class ConversationsTest extends BotConnectorTestBase { setBot(bot); }}; - ConversationResourceResponse conversation = connector.getConversations().createConversation(createMessage); + ConversationResourceResponse conversation = connector.getConversations().createConversation(createMessage).join(); bot.setId("B21S8SG7K:T03CWQ0QB"); Activity activity = new Activity(ActivityTypes.MESSAGE) {{ @@ -307,7 +307,7 @@ public class ConversationsTest extends BotConnectorTestBase { }}; try { - ResourceResponse response = connector.getConversations().sendToConversation(conversation.getId(), activity); + ResourceResponse response = connector.getConversations().sendToConversation(conversation.getId(), activity).join(); Assert.fail("expected exception did not occur."); } catch (CompletionException e) { if (e.getCause() instanceof ErrorResponseException) { @@ -383,9 +383,9 @@ public class ConversationsTest extends BotConnectorTestBase { setBot(bot); }}; - ConversationResourceResponse conversation = connector.getConversations().createConversation(createMessage); + ConversationResourceResponse conversation = connector.getConversations().createConversation(createMessage).join(); - ResourceResponse response = connector.getConversations().sendToConversation(conversation.getId(), activity); + ResourceResponse response = connector.getConversations().sendToConversation(conversation.getId(), activity).join(); Assert.assertNotNull(response.getId()); } @@ -405,9 +405,9 @@ public class ConversationsTest extends BotConnectorTestBase { setActivity(activity); }}; - ConversationResourceResponse conversation = connector.getConversations().createConversation(createMessage); + ConversationResourceResponse conversation = connector.getConversations().createConversation(createMessage).join(); - List members = connector.getConversations().getActivityMembers(conversation.getId(), conversation.getActivityId()); + List members = connector.getConversations().getActivityMembers(conversation.getId(), conversation.getActivityId()).join(); boolean hasUser = false; @@ -434,10 +434,10 @@ public class ConversationsTest extends BotConnectorTestBase { setActivity(activity); }}; - ConversationResourceResponse conversation = connector.getConversations().createConversation(createMessage); + ConversationResourceResponse conversation = connector.getConversations().createConversation(createMessage).join(); try { - List members = connector.getConversations().getActivityMembers(conversation.getId().concat("M"), conversation.getActivityId()); + List members = connector.getConversations().getActivityMembers(conversation.getId().concat("M"), conversation.getActivityId()).join(); Assert.fail("expected exception did not occur."); } catch (CompletionException e) { if (e.getCause() instanceof ErrorResponseException) { @@ -489,11 +489,11 @@ public class ConversationsTest extends BotConnectorTestBase { setBot(bot); }}; - ConversationResourceResponse conversation = connector.getConversations().createConversation(createMessage); + ConversationResourceResponse conversation = connector.getConversations().createConversation(createMessage).join(); - ResourceResponse response = connector.getConversations().sendToConversation(conversation.getId(), activity); + ResourceResponse response = connector.getConversations().sendToConversation(conversation.getId(), activity).join(); - ResourceResponse replyResponse = connector.getConversations().replyToActivity(conversation.getId(), response.getId(), reply); + ResourceResponse replyResponse = connector.getConversations().replyToActivity(conversation.getId(), response.getId(), reply).join(); Assert.assertNotNull(replyResponse.getId()); } @@ -518,12 +518,12 @@ public class ConversationsTest extends BotConnectorTestBase { setBot(bot); }}; - ConversationResourceResponse conversation = connector.getConversations().createConversation(createMessage); + ConversationResourceResponse conversation = connector.getConversations().createConversation(createMessage).join(); - ResourceResponse response = connector.getConversations().sendToConversation(conversation.getId(), activity); + ResourceResponse response = connector.getConversations().sendToConversation(conversation.getId(), activity).join(); try { - ResourceResponse replyResponse = connector.getConversations().replyToActivity(conversation.getId().concat("M"), response.getId(), reply); + ResourceResponse replyResponse = connector.getConversations().replyToActivity(conversation.getId().concat("M"), response.getId(), reply).join(); Assert.fail("expected exception did not occur."); } catch (CompletionException e) { if (e.getCause() instanceof ErrorResponseException) { @@ -590,12 +590,12 @@ public class ConversationsTest extends BotConnectorTestBase { setBot(bot); }}; - ConversationResourceResponse conversation = connector.getConversations().createConversation(createMessage); + ConversationResourceResponse conversation = connector.getConversations().createConversation(createMessage).join(); - ResourceResponse response = connector.getConversations().sendToConversation(conversation.getId(), activity); + ResourceResponse response = connector.getConversations().sendToConversation(conversation.getId(), activity).join(); try { - ResourceResponse replyResponse = connector.getConversations().replyToActivity(conversation.getId(), response.getId(), null); + ResourceResponse replyResponse = connector.getConversations().replyToActivity(conversation.getId(), response.getId(), null).join(); Assert.fail("expected exception did not occur."); } catch (IllegalArgumentException e) { Assert.assertTrue(e.getMessage().contains("cannot be null")); @@ -617,7 +617,7 @@ public class ConversationsTest extends BotConnectorTestBase { setActivity(activity); }}; - ConversationResourceResponse conversation = connector.getConversations().createConversation(createMessage); + ConversationResourceResponse conversation = connector.getConversations().createConversation(createMessage).join(); connector.getConversations().deleteActivity(conversation.getId(), conversation.getActivityId()); @@ -639,10 +639,10 @@ public class ConversationsTest extends BotConnectorTestBase { setActivity(activity); }}; - ConversationResourceResponse conversation = connector.getConversations().createConversation(createMessage); + ConversationResourceResponse conversation = connector.getConversations().createConversation(createMessage).join(); try { - connector.getConversations().deleteActivity("B21S8SG7K:T03CWQ0QB", conversation.getActivityId()); + connector.getConversations().deleteActivity("B21S8SG7K:T03CWQ0QB", conversation.getActivityId()).join(); Assert.fail("expected exception did not occur."); } catch (CompletionException e) { if (e.getCause() instanceof ErrorResponseException) { @@ -657,7 +657,7 @@ public class ConversationsTest extends BotConnectorTestBase { @Test public void DeleteActivityWithNullConversationId() { try { - connector.getConversations().deleteActivity(null, "id"); + connector.getConversations().deleteActivity(null, "id").join(); Assert.fail("expected exception did not occur."); } catch(IllegalArgumentException e) { Assert.assertTrue(e.getMessage().contains("cannot be null")); @@ -667,7 +667,7 @@ public class ConversationsTest extends BotConnectorTestBase { @Test public void DeleteActivityWithNullActivityId() { try { - connector.getConversations().deleteActivity("id", null); + connector.getConversations().deleteActivity("id", null).join(); Assert.fail("expected exception did not occur."); } catch(IllegalArgumentException e) { Assert.assertTrue(e.getMessage().contains("cannot be null")); @@ -688,14 +688,14 @@ public class ConversationsTest extends BotConnectorTestBase { setBot(bot); }}; - ConversationResourceResponse conversation = connector.getConversations().createConversation(createMessage); + ConversationResourceResponse conversation = connector.getConversations().createConversation(createMessage).join(); - ResourceResponse response = connector.getConversations().sendToConversation(conversation.getId(), activity); + ResourceResponse response = connector.getConversations().sendToConversation(conversation.getId(), activity).join(); activity.setId(response.getId()); activity.setText("TEST Update Activity"); - ResourceResponse updateResponse = connector.getConversations().updateActivity(conversation.getId(), response.getId(), activity); + ResourceResponse updateResponse = connector.getConversations().updateActivity(conversation.getId(), response.getId(), activity).join(); Assert.assertNotNull(updateResponse.getId()); } @@ -714,15 +714,15 @@ public class ConversationsTest extends BotConnectorTestBase { setBot(bot); }}; - ConversationResourceResponse conversation = connector.getConversations().createConversation(createMessage); + ConversationResourceResponse conversation = connector.getConversations().createConversation(createMessage).join(); - ResourceResponse response = connector.getConversations().sendToConversation(conversation.getId(), activity); + ResourceResponse response = connector.getConversations().sendToConversation(conversation.getId(), activity).join(); activity.setId(response.getId()); activity.setText("TEST Update Activity"); try { - ResourceResponse updateResponse = connector.getConversations().updateActivity("B21S8SG7K:T03CWQ0QB", response.getId(), activity); + ResourceResponse updateResponse = connector.getConversations().updateActivity("B21S8SG7K:T03CWQ0QB", response.getId(), activity).join(); Assert.fail("expected exception did not occur."); } catch (CompletionException e) { if (e.getCause() instanceof ErrorResponseException) { @@ -790,9 +790,9 @@ public class ConversationsTest extends BotConnectorTestBase { setBot(bot); }}; - ConversationResourceResponse conversation = connector.getConversations().createConversation(createMessage); + ConversationResourceResponse conversation = connector.getConversations().createConversation(createMessage).join(); - ResourceResponse response = connector.getConversations().uploadAttachment(conversation.getId(), attachment); + ResourceResponse response = connector.getConversations().uploadAttachment(conversation.getId(), attachment).join(); Assert.assertNotNull(response.getId()); } diff --git a/libraries/bot-connector/src/test/java/com/microsoft/bot/connector/OAuthTestBase.java b/libraries/bot-connector/src/test/java/com/microsoft/bot/connector/OAuthTestBase.java index e0dca5cf..6c2ab606 100644 --- a/libraries/bot-connector/src/test/java/com/microsoft/bot/connector/OAuthTestBase.java +++ b/libraries/bot-connector/src/test/java/com/microsoft/bot/connector/OAuthTestBase.java @@ -106,7 +106,7 @@ public class OAuthTestBase extends TestBase { } public CompletableFuture UseOAuthClientFor(Function> doTest, String className, String methodName) throws MalformedURLException, URISyntaxException { - return CompletableFuture.run(() -> { + return CompletableFuture.runAsync(() -> { OAuthClient oauthClient = null; try { oauthClient = new OAuthClient(this.connector, AuthenticationConstants.OAUTH_URL); From 5a3fcb6f19f8d1bb704b85c411923771eebd8e3b Mon Sep 17 00:00:00 2001 From: Tracy Boehrer Date: Mon, 9 Sep 2019 15:01:37 -0500 Subject: [PATCH 2/2] Update Async calls in bot-builder. --- .../microsoft/bot/builder/BotFrameworkAdapter.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/libraries/bot-builder/src/main/java/com/microsoft/bot/builder/BotFrameworkAdapter.java b/libraries/bot-builder/src/main/java/com/microsoft/bot/builder/BotFrameworkAdapter.java index c2e1143e..d7a6883f 100644 --- a/libraries/bot-builder/src/main/java/com/microsoft/bot/builder/BotFrameworkAdapter.java +++ b/libraries/bot-builder/src/main/java/com/microsoft/bot/builder/BotFrameworkAdapter.java @@ -294,10 +294,10 @@ public class BotFrameworkAdapter extends BotAdapter { // if it is a Trace activity we only send to the channel if it's the emulator. } else if (!StringUtils.isEmpty(activity.getReplyToId())) { ConnectorClient connectorClient = context.getServices().Get("ConnectorClient"); - response = connectorClient.getConversations().replyToActivity(activity.getConversation().getId(), activity.getId(), activity); + response = connectorClient.getConversations().replyToActivity(activity.getConversation().getId(), activity.getId(), activity).join(); } else { ConnectorClient connectorClient = context.getServices().Get("ConnectorClient"); - response = connectorClient.getConversations().sendToConversation(activity.getConversation().getId(), activity); + response = connectorClient.getConversations().sendToConversation(activity.getConversation().getId(), activity).join(); } // If No response is set, then defult to a "simple" response. This can't really be done @@ -336,7 +336,7 @@ public class BotFrameworkAdapter extends BotAdapter { public ResourceResponse UpdateActivity(TurnContext context, Activity activity) { ConnectorClient connectorClient = context.getServices().Get("ConnectorClient"); // TODO String conversationId, String activityId, Activity activity) - return connectorClient.getConversations().updateActivity(activity.getConversation().getId(), activity.getId(), activity); + return connectorClient.getConversations().updateActivity(activity.getConversation().getId(), activity.getId(), activity).join(); } /** @@ -350,7 +350,7 @@ public class BotFrameworkAdapter extends BotAdapter { public void DeleteActivity(TurnContext context, ConversationReference reference) { RestConnectorClient connectorClient = context.getServices().Get("ConnectorClient"); try { - connectorClient.getConversations().deleteConversationMemberAsync( + connectorClient.getConversations().deleteConversationMember( reference.getConversation().getId(), reference.getActivityId()).join(); } catch (CompletionException e) { e.printStackTrace(); @@ -586,7 +586,7 @@ public class BotFrameworkAdapter extends BotAdapter { } Conversations conversations = connectorClient.getConversations(); - CompletableFuture result = conversations.createConversationAsync(conversationParameters); + CompletableFuture result = conversations.createConversation(conversationParameters); ConversationResourceResponse response = result.join(); @@ -618,7 +618,7 @@ public class BotFrameworkAdapter extends BotAdapter { protected CompletableFuture TrySetEmulatingOAuthCards(TurnContext turnContext) { if (!isEmulatingOAuthCards && turnContext.getActivity().getChannelId().equals("emulator") && - (_credentialProvider.isAuthenticationDisabledAsync().join())) { + (_credentialProvider.isAuthenticationDisabled().join())) { isEmulatingOAuthCards = true; } return completedFuture(isEmulatingOAuthCards); @@ -750,7 +750,7 @@ public class BotFrameworkAdapter extends BotAdapter { } if (this.appCredentialMap.containsKey(appId)) return this.appCredentialMap.get(appId); - String appPassword = this._credentialProvider.getAppPasswordAsync(appId).join(); + String appPassword = this._credentialProvider.getAppPassword(appId).join(); MicrosoftAppCredentials appCredentials = new MicrosoftAppCredentials(appId, appPassword); this.appCredentialMap.put(appId, appCredentials); return appCredentials;