diff --git a/README.md b/README.md index f94e24d81..69b6bb550 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ For more information jump to a section below. | Branch | Description | Build Status | Coverage Status | |--------|-------------|--------------|-----------------| - |Main | Preview 8 Builds | [![Build Status](https://travis-ci.org/Microsoft/botbuilder-java.svg?branch=main)](https://travis-ci.org/Microsoft/botbuilder-java) | [![Coverage Status](https://coveralls.io/repos/github/microsoft/botbuilder-java/badge.svg?branch=823847c676b7dbb0fa348a308297ae375f5141ef)](https://coveralls.io/github/microsoft/botbuilder-java?branch=823847c676b7dbb0fa348a308297ae375f5141ef) | + |Main | Preview 8 Builds | [![Build Status](https://fuselabs.visualstudio.com/SDK_v4/_apis/build/status/Java/BotBuilder-Java-4.0-daily?branchName=main)](https://fuselabs.visualstudio.com/SDK_v4/_build/latest?definitionId=1202&branchName=main) | [![Coverage Status](https://coveralls.io/repos/github/microsoft/botbuilder-java/badge.svg?branch=823847c676b7dbb0fa348a308297ae375f5141ef)](https://coveralls.io/github/microsoft/botbuilder-java?branch=823847c676b7dbb0fa348a308297ae375f5141ef) | ## Getting Started To get started building bots using the SDK, see the [Azure Bot Service Documentation](https://docs.microsoft.com/en-us/azure/bot-service/?view=azure-bot-service-4.0). diff --git a/libraries/bot-azure/src/test/java/com/microsoft/bot/azure/AzureQueueTests.java b/libraries/bot-azure/src/test/java/com/microsoft/bot/azure/AzureQueueTests.java index fa03fa5e3..663e7b826 100644 --- a/libraries/bot-azure/src/test/java/com/microsoft/bot/azure/AzureQueueTests.java +++ b/libraries/bot-azure/src/test/java/com/microsoft/bot/azure/AzureQueueTests.java @@ -14,6 +14,7 @@ import com.microsoft.bot.builder.UserState; import com.microsoft.bot.builder.adapters.TestAdapter; import com.microsoft.bot.builder.adapters.TestFlow; +import com.microsoft.bot.connector.Async; import com.microsoft.bot.dialogs.Dialog; import com.microsoft.bot.dialogs.DialogContext; import com.microsoft.bot.dialogs.DialogManager; @@ -167,13 +168,13 @@ public CompletableFuture beginDialog(DialogContext dc, Object try { date = LocalDateTime.parse(dateString); } catch (DateTimeParseException ex) { - throw new IllegalArgumentException("Date is invalid"); + return Async.completeExceptionally(new IllegalArgumentException("Date is invalid")); } ZonedDateTime zonedDate = date.atZone(ZoneOffset.UTC); ZonedDateTime now = LocalDateTime.now().atZone(ZoneOffset.UTC); if (zonedDate.isBefore(now)) { - throw new IllegalArgumentException("Date must be in the future"); + return Async.completeExceptionally(new IllegalArgumentException("Date must be in the future")); } // create ContinuationActivity from the conversation reference. @@ -185,7 +186,7 @@ public CompletableFuture beginDialog(DialogContext dc, Object QueueStorage queueStorage = dc.getContext().getTurnState().get("QueueStorage"); if (queueStorage == null) { - throw new NullPointerException("Unable to locate QueueStorage in HostContext"); + return Async.completeExceptionally(new NullPointerException("Unable to locate QueueStorage in HostContext")); } return queueStorage.queueActivity(activity, visibility, ttl).thenCompose(receipt -> { // return the receipt as the result diff --git a/libraries/bot-azure/src/test/java/com/microsoft/bot/azure/TranscriptStoreTests.java b/libraries/bot-azure/src/test/java/com/microsoft/bot/azure/TranscriptStoreTests.java index b9653bcc4..668971103 100644 --- a/libraries/bot-azure/src/test/java/com/microsoft/bot/azure/TranscriptStoreTests.java +++ b/libraries/bot-azure/src/test/java/com/microsoft/bot/azure/TranscriptStoreTests.java @@ -14,6 +14,7 @@ import com.microsoft.bot.builder.TranscriptStore; import com.microsoft.bot.builder.adapters.TestAdapter; import com.microsoft.bot.builder.adapters.TestFlow; +import com.microsoft.bot.connector.Async; import com.microsoft.bot.schema.Activity; import com.microsoft.bot.schema.ActivityTypes; import com.microsoft.bot.schema.ChannelAccount; @@ -536,7 +537,7 @@ private CompletableFuture> getPagedResult(ConversationRefe } if(pagedResult == null) { - throw new TimeoutException("Unable to retrieve pagedResult in time"); + return Async.completeExceptionally(new TimeoutException("Unable to retrieve pagedResult in time")); } return CompletableFuture.completedFuture(pagedResult); diff --git a/libraries/bot-builder/src/test/java/com/microsoft/bot/builder/ActivityHandlerTests.java b/libraries/bot-builder/src/test/java/com/microsoft/bot/builder/ActivityHandlerTests.java index 6c8c30b2c..66401f54b 100644 --- a/libraries/bot-builder/src/test/java/com/microsoft/bot/builder/ActivityHandlerTests.java +++ b/libraries/bot-builder/src/test/java/com/microsoft/bot/builder/ActivityHandlerTests.java @@ -3,6 +3,7 @@ package com.microsoft.bot.builder; +import com.microsoft.bot.connector.Async; import com.microsoft.bot.schema.*; import org.junit.Assert; import org.junit.Test; @@ -467,7 +468,7 @@ public CompletableFuture sendActivities( TurnContext context, List activities ) { - throw new RuntimeException(); + return Async.completeExceptionally(new RuntimeException()); } @Override @@ -475,7 +476,7 @@ public CompletableFuture updateActivity( TurnContext context, Activity activity ) { - throw new RuntimeException(); + return Async.completeExceptionally(new RuntimeException()); } @Override @@ -483,7 +484,7 @@ public CompletableFuture deleteActivity( TurnContext context, ConversationReference reference ) { - throw new RuntimeException(); + return Async.completeExceptionally(new RuntimeException()); } } diff --git a/libraries/bot-builder/src/test/java/com/microsoft/bot/builder/BotStateTests.java b/libraries/bot-builder/src/test/java/com/microsoft/bot/builder/BotStateTests.java index 6264a05fe..a673b27a0 100644 --- a/libraries/bot-builder/src/test/java/com/microsoft/bot/builder/BotStateTests.java +++ b/libraries/bot-builder/src/test/java/com/microsoft/bot/builder/BotStateTests.java @@ -73,7 +73,7 @@ public CompletableFuture delete(String[] keys) { Assert.assertEquals(1, readCount[0]); Assert.assertEquals(0, storeCount[0]); - propertyA.set(context, "there"); + propertyA.set(context, "there").join(); Assert.assertEquals(0, storeCount[0]); // Set on property should not bump userState.saveChanges(context).join(); diff --git a/libraries/bot-builder/src/test/java/com/microsoft/bot/builder/MessageFactoryTests.java b/libraries/bot-builder/src/test/java/com/microsoft/bot/builder/MessageFactoryTests.java index babf68f8c..75501d86d 100644 --- a/libraries/bot-builder/src/test/java/com/microsoft/bot/builder/MessageFactoryTests.java +++ b/libraries/bot-builder/src/test/java/com/microsoft/bot/builder/MessageFactoryTests.java @@ -545,7 +545,7 @@ public void ValidateIMBackWithNoTest() { null ); - turnContext.sendActivity(activity); + turnContext.sendActivity(activity).join(); } return CompletableFuture.completedFuture(null); }; diff --git a/libraries/bot-builder/src/test/java/com/microsoft/bot/builder/OnTurnErrorTests.java b/libraries/bot-builder/src/test/java/com/microsoft/bot/builder/OnTurnErrorTests.java index 9fd3e5287..d7324212b 100644 --- a/libraries/bot-builder/src/test/java/com/microsoft/bot/builder/OnTurnErrorTests.java +++ b/libraries/bot-builder/src/test/java/com/microsoft/bot/builder/OnTurnErrorTests.java @@ -29,7 +29,7 @@ public void OnTurnError_Test() { new TestFlow(adapter, (turnContext -> { if (StringUtils.equals(turnContext.getActivity().getText(), "foo")) { - turnContext.sendActivity(turnContext.getActivity().getText()); + turnContext.sendActivity(turnContext.getActivity().getText()).join(); } if ( diff --git a/libraries/bot-builder/src/test/java/com/microsoft/bot/builder/SkillConversationIdFactoryTests.java b/libraries/bot-builder/src/test/java/com/microsoft/bot/builder/SkillConversationIdFactoryTests.java index 2ca4d4625..864b66ff0 100644 --- a/libraries/bot-builder/src/test/java/com/microsoft/bot/builder/SkillConversationIdFactoryTests.java +++ b/libraries/bot-builder/src/test/java/com/microsoft/bot/builder/SkillConversationIdFactoryTests.java @@ -51,7 +51,7 @@ public void SkillConversationIdFactoryHappyPath() { skillConversationIdFactory.getSkillConversationReference(skillConversationId).join(); // Delete - skillConversationIdFactory.deleteConversationReference(skillConversationId); + skillConversationIdFactory.deleteConversationReference(skillConversationId).join(); // Retrieve again SkillConversationReference deletedConversationReference = diff --git a/libraries/bot-builder/src/test/java/com/microsoft/bot/builder/TestAdapterTests.java b/libraries/bot-builder/src/test/java/com/microsoft/bot/builder/TestAdapterTests.java index efd49f498..58dfb3fd6 100644 --- a/libraries/bot-builder/src/test/java/com/microsoft/bot/builder/TestAdapterTests.java +++ b/libraries/bot-builder/src/test/java/com/microsoft/bot/builder/TestAdapterTests.java @@ -5,6 +5,7 @@ import com.microsoft.bot.builder.adapters.TestAdapter; import com.microsoft.bot.builder.adapters.TestFlow; +import com.microsoft.bot.connector.Async; import com.microsoft.bot.schema.ActionTypes; import com.microsoft.bot.schema.Activity; import com.microsoft.bot.schema.ActivityTypes; @@ -71,7 +72,7 @@ public void TestAdapter_ExceptionInBotOnReceive() { try { new TestFlow(adapter, turnContext -> { - throw new RuntimeException(uniqueExceptionId); + return Async.completeExceptionally(new RuntimeException(uniqueExceptionId)); }).test("foo", activity -> { Assert.assertNull(activity); }).startTest().join(); diff --git a/libraries/bot-builder/src/test/java/com/microsoft/bot/builder/TurnContextTests.java b/libraries/bot-builder/src/test/java/com/microsoft/bot/builder/TurnContextTests.java index c46567d31..8fb64edf5 100644 --- a/libraries/bot-builder/src/test/java/com/microsoft/bot/builder/TurnContextTests.java +++ b/libraries/bot-builder/src/test/java/com/microsoft/bot/builder/TurnContextTests.java @@ -5,6 +5,7 @@ import com.microsoft.bot.builder.adapters.TestAdapter; import com.microsoft.bot.builder.adapters.TestFlow; +import com.microsoft.bot.connector.Async; import com.microsoft.bot.connector.Attachments; import com.microsoft.bot.connector.ConnectorClient; import com.microsoft.bot.connector.Conversations; @@ -63,7 +64,7 @@ public void CacheValueUsingSetAndGet() { case "TestResponded": if (turnContext.getResponded()) { - throw new RuntimeException("Responded is true"); + return Async.completeExceptionally(new RuntimeException("Responded is true")); } return turnContext.sendActivity( @@ -419,7 +420,7 @@ public void DeleteOneActivityToAdapter() { TurnContext c = new TurnContextImpl(a, TestMessage.Message()); - c.deleteActivity("12345"); + c.deleteActivity("12345").join(); Assert.assertTrue(activityDeleted[0]); } @@ -440,7 +441,7 @@ public void DeleteConversationReferenceToAdapter() { } }; - c.deleteActivity(reference); + c.deleteActivity(reference).join(); Assert.assertTrue(activityDeleted[0]); } diff --git a/libraries/bot-builder/src/test/java/com/microsoft/bot/builder/teams/TeamsActivityHandlerHidingTests.java b/libraries/bot-builder/src/test/java/com/microsoft/bot/builder/teams/TeamsActivityHandlerHidingTests.java index 9160ae1f5..c51ec6ea3 100644 --- a/libraries/bot-builder/src/test/java/com/microsoft/bot/builder/teams/TeamsActivityHandlerHidingTests.java +++ b/libraries/bot-builder/src/test/java/com/microsoft/bot/builder/teams/TeamsActivityHandlerHidingTests.java @@ -8,6 +8,7 @@ import com.microsoft.bot.builder.MessageFactory; import com.microsoft.bot.builder.TurnContext; import com.microsoft.bot.builder.TurnContextImpl; +import com.microsoft.bot.connector.Async; import com.microsoft.bot.schema.Activity; import com.microsoft.bot.schema.ActivityTypes; import com.microsoft.bot.schema.ChannelAccount; @@ -346,7 +347,7 @@ public CompletableFuture sendActivities( TurnContext context, List activities ) { - throw new RuntimeException(); + return Async.completeExceptionally(new RuntimeException()); } @Override @@ -354,7 +355,7 @@ public CompletableFuture updateActivity( TurnContext context, Activity activity ) { - throw new RuntimeException(); + return Async.completeExceptionally(new RuntimeException()); } @Override @@ -362,7 +363,7 @@ public CompletableFuture deleteActivity( TurnContext context, ConversationReference reference ) { - throw new RuntimeException(); + return Async.completeExceptionally(new RuntimeException()); } } diff --git a/libraries/bot-dialogs/src/test/java/com/microsoft/bot/dialogs/PromptValidatorContextTests.java b/libraries/bot-dialogs/src/test/java/com/microsoft/bot/dialogs/PromptValidatorContextTests.java index 539255999..a56bd6f83 100644 --- a/libraries/bot-dialogs/src/test/java/com/microsoft/bot/dialogs/PromptValidatorContextTests.java +++ b/libraries/bot-dialogs/src/test/java/com/microsoft/bot/dialogs/PromptValidatorContextTests.java @@ -107,7 +107,7 @@ public void PromptValidatorContextRetryEnd() { return CompletableFuture.completedFuture(true); } else { promptContext.getContext().sendActivity( - MessageFactory.text("Please send a name that is longer than 3 characters.")); + MessageFactory.text("Please send a name that is longer than 3 characters.")).join(); } return CompletableFuture.completedFuture(false); diff --git a/libraries/bot-dialogs/src/test/java/com/microsoft/bot/dialogs/SkillDialogTests.java b/libraries/bot-dialogs/src/test/java/com/microsoft/bot/dialogs/SkillDialogTests.java index 6c56f035b..8c18e32dd 100644 --- a/libraries/bot-dialogs/src/test/java/com/microsoft/bot/dialogs/SkillDialogTests.java +++ b/libraries/bot-dialogs/src/test/java/com/microsoft/bot/dialogs/SkillDialogTests.java @@ -352,7 +352,7 @@ public void ShouldThrowHttpExceptionOnPostFailure() { conversationState); // Send something to the dialog - Assert.assertThrows(Exception.class, () -> client.sendActivity("irrelevant")); + Assert.assertThrows(Exception.class, () -> client.sendActivity("irrelevant").join()); } @Test @@ -548,7 +548,7 @@ public void EndOfConversationFromExpectRepliesCallsDeleteConversationReference() conversationState); // Send something to the dialog to start it - client.sendActivity("hello"); + client.sendActivity("hello").join(); SimpleConversationIdFactory factory = null; if (dialogOptions.getConversationIdFactory() != null diff --git a/libraries/bot-dialogs/src/test/java/com/microsoft/bot/dialogs/WaterfallTests.java b/libraries/bot-dialogs/src/test/java/com/microsoft/bot/dialogs/WaterfallTests.java index ed5bd91cf..b7f2d2b22 100644 --- a/libraries/bot-dialogs/src/test/java/com/microsoft/bot/dialogs/WaterfallTests.java +++ b/libraries/bot-dialogs/src/test/java/com/microsoft/bot/dialogs/WaterfallTests.java @@ -70,13 +70,13 @@ public void Waterfall() { DialogSet dialogs = new DialogSet(dialogState); WaterfallStep[] steps = new WaterfallStep[] {(step) -> { - step.getContext().sendActivity("step1"); + step.getContext().sendActivity("step1").join(); return CompletableFuture.completedFuture(Dialog.END_OF_TURN); }, (step) -> { - step.getContext().sendActivity("step2"); + step.getContext().sendActivity("step2").join(); return CompletableFuture.completedFuture(Dialog.END_OF_TURN); }, (step) -> { - step.getContext().sendActivity("step3"); + step.getContext().sendActivity("step3").join(); return CompletableFuture.completedFuture(Dialog.END_OF_TURN); }, }; @@ -140,13 +140,13 @@ public void WaterfallWithCallback() { StatePropertyAccessor dialogState = convoState.createProperty("dialogState"); DialogSet dialogs = new DialogSet(dialogState); WaterfallStep[] steps = new WaterfallStep[] {(step) -> { - step.getContext().sendActivity("step1"); + step.getContext().sendActivity("step1").join(); return CompletableFuture.completedFuture(Dialog.END_OF_TURN); }, (step) -> { - step.getContext().sendActivity("step2"); + step.getContext().sendActivity("step2").join(); return CompletableFuture.completedFuture(Dialog.END_OF_TURN); }, (step) -> { - step.getContext().sendActivity("step3"); + step.getContext().sendActivity("step3").join(); return CompletableFuture.completedFuture(Dialog.END_OF_TURN); }, }; WaterfallDialog waterfallDialog = new WaterfallDialog("test", Arrays.asList(steps)); @@ -375,7 +375,7 @@ private WaterfallDialog Create_Waterfall2() { private class Waterfall2_Step1 implements WaterfallStep { @Override public CompletableFuture waterfallStep(WaterfallStepContext stepContext) { - stepContext.getContext().sendActivity("step1"); + stepContext.getContext().sendActivity("step1").join(); PromptOptions options = new PromptOptions(); options.setPrompt(MessageFactory.text("Enter a number.")); options.setRetryPrompt(MessageFactory.text("It must be a number")); @@ -388,10 +388,10 @@ private class Waterfall2_Step2 implements WaterfallStep { public CompletableFuture waterfallStep(WaterfallStepContext stepContext) { if (stepContext.getValues() != null) { int numberResult = (int) stepContext.getResult(); - stepContext.getContext().sendActivity(String.format("Thanks for '%d'", numberResult)); + stepContext.getContext().sendActivity(String.format("Thanks for '%d'", numberResult)).join(); } - stepContext.getContext().sendActivity("step2"); + stepContext.getContext().sendActivity("step2").join(); PromptOptions options = new PromptOptions(); options.setPrompt(MessageFactory.text("Enter a number.")); options.setRetryPrompt(MessageFactory.text("It must be a number")); @@ -404,10 +404,10 @@ private class Waterfall2_Step3 implements WaterfallStep { public CompletableFuture waterfallStep(WaterfallStepContext stepContext) { if (stepContext.getValues() != null) { int numberResult = (int) stepContext.getResult(); - stepContext.getContext().sendActivity(String.format("Thanks for '%d'", numberResult)); + stepContext.getContext().sendActivity(String.format("Thanks for '%d'", numberResult)).join(); } - stepContext.getContext().sendActivity("step3"); + stepContext.getContext().sendActivity("step3").join(); Map resultMap = new HashMap(); resultMap.put("Value", "All Done!"); return stepContext.endDialog(resultMap); @@ -416,7 +416,7 @@ public CompletableFuture waterfallStep(WaterfallStepContext st private class Waterfall3_Step1 implements WaterfallStep { @Override public CompletableFuture waterfallStep(WaterfallStepContext stepContext) { - stepContext.getContext().sendActivity(MessageFactory.text("step1")); + stepContext.getContext().sendActivity(MessageFactory.text("step1")).join(); return stepContext.beginDialog("test-waterfall-b", null); } } @@ -424,7 +424,7 @@ public CompletableFuture waterfallStep(WaterfallStepContext st private class Waterfall3_Step2 implements WaterfallStep { @Override public CompletableFuture waterfallStep(WaterfallStepContext stepContext) { - stepContext.getContext().sendActivity(MessageFactory.text("step2")); + stepContext.getContext().sendActivity(MessageFactory.text("step2")).join(); return stepContext.beginDialog("test-waterfall-c", null); } } @@ -432,7 +432,7 @@ public CompletableFuture waterfallStep(WaterfallStepContext st private class Waterfall4_Step1 implements WaterfallStep { @Override public CompletableFuture waterfallStep(WaterfallStepContext stepContext) { - stepContext.getContext().sendActivity(MessageFactory.text("step1.1")); + stepContext.getContext().sendActivity(MessageFactory.text("step1.1")).join(); return CompletableFuture.completedFuture(Dialog.END_OF_TURN); } } @@ -440,7 +440,7 @@ public CompletableFuture waterfallStep(WaterfallStepContext st private class Waterfall4_Step2 implements WaterfallStep { @Override public CompletableFuture waterfallStep(WaterfallStepContext stepContext) { - stepContext.getContext().sendActivity(MessageFactory.text("step1.2")); + stepContext.getContext().sendActivity(MessageFactory.text("step1.2")).join(); return CompletableFuture.completedFuture(Dialog.END_OF_TURN); } } @@ -448,7 +448,7 @@ public CompletableFuture waterfallStep(WaterfallStepContext st private class Waterfall5_Step1 implements WaterfallStep { @Override public CompletableFuture waterfallStep(WaterfallStepContext stepContext) { - stepContext.getContext().sendActivity(MessageFactory.text("step2.1")); + stepContext.getContext().sendActivity(MessageFactory.text("step2.1")).join(); return CompletableFuture.completedFuture(Dialog.END_OF_TURN); } } @@ -456,7 +456,7 @@ public CompletableFuture waterfallStep(WaterfallStepContext st private class Waterfall5_Step2 implements WaterfallStep { @Override public CompletableFuture waterfallStep(WaterfallStepContext stepContext) { - stepContext.getContext().sendActivity(MessageFactory.text("step2.2")); + stepContext.getContext().sendActivity(MessageFactory.text("step2.2")).join(); return stepContext.endDialog(); } } diff --git a/libraries/bot-dialogs/src/test/java/com/microsoft/bot/dialogs/prompts/ChoicePromptTests.java b/libraries/bot-dialogs/src/test/java/com/microsoft/bot/dialogs/prompts/ChoicePromptTests.java index 42ea35187..38bc0e342 100644 --- a/libraries/bot-dialogs/src/test/java/com/microsoft/bot/dialogs/prompts/ChoicePromptTests.java +++ b/libraries/bot-dialogs/src/test/java/com/microsoft/bot/dialogs/prompts/ChoicePromptTests.java @@ -536,7 +536,7 @@ public void ShouldCallCustomValidator() { DialogSet dialogs = new DialogSet(dialogState); PromptValidator validator = (promptContext) -> { - promptContext.getContext().sendActivity(MessageFactory.text("validator called")); + promptContext.getContext().sendActivity(MessageFactory.text("validator called")).join(); return CompletableFuture.completedFuture(true); }; diff --git a/libraries/bot-dialogs/src/test/java/com/microsoft/bot/dialogs/prompts/NumberPromptTests.java b/libraries/bot-dialogs/src/test/java/com/microsoft/bot/dialogs/prompts/NumberPromptTests.java index a8939f2a5..8a042586f 100644 --- a/libraries/bot-dialogs/src/test/java/com/microsoft/bot/dialogs/prompts/NumberPromptTests.java +++ b/libraries/bot-dialogs/src/test/java/com/microsoft/bot/dialogs/prompts/NumberPromptTests.java @@ -132,7 +132,7 @@ public void NumberPrompt() throws UnsupportedDataTypeException { } else if (results.getStatus() == DialogTurnStatus.COMPLETE) { int numberResult = (int) results.getResult(); turnContext.sendActivity( - MessageFactory.text(String.format("Bot received the number '%d'.", numberResult))); + MessageFactory.text(String.format("Bot received the number '%d'.", numberResult))).join(); } return CompletableFuture.completedFuture(null); }) @@ -174,7 +174,7 @@ public void NumberPromptRetry() throws UnsupportedDataTypeException { } else if (results.getStatus() == DialogTurnStatus.COMPLETE) { int numberResult = (int) results.getResult(); turnContext.sendActivity( - MessageFactory.text(String.format("Bot received the number '%d'.", numberResult))); + MessageFactory.text(String.format("Bot received the number '%d'.", numberResult))).join(); } return CompletableFuture.completedFuture(null); }) @@ -229,7 +229,7 @@ public void NumberPromptValidator() throws UnsupportedDataTypeException { } else if (results.getStatus() == DialogTurnStatus.COMPLETE) { int numberResult = (int) results.getResult(); turnContext.sendActivity( - MessageFactory.text(String.format("Bot received the number '%d'.", numberResult))); + MessageFactory.text(String.format("Bot received the number '%d'.", numberResult))).join(); } return CompletableFuture.completedFuture(null); }) @@ -270,7 +270,7 @@ public void FloatNumberPrompt() throws UnsupportedDataTypeException { } else if (results.getStatus() == DialogTurnStatus.COMPLETE) { Float numberResult = (Float) results.getResult(); turnContext.sendActivity( - MessageFactory.text(String.format("Bot received the number '%.2f'.", numberResult))); + MessageFactory.text(String.format("Bot received the number '%.2f'.", numberResult))).join(); } return CompletableFuture.completedFuture(null); }) @@ -309,7 +309,7 @@ public void LongNumberPrompt() throws UnsupportedDataTypeException { } else if (results.getStatus() == DialogTurnStatus.COMPLETE) { Long numberResult = (Long) results.getResult(); turnContext.sendActivity( - MessageFactory.text(String.format("Bot received the number '%d'.", numberResult))); + MessageFactory.text(String.format("Bot received the number '%d'.", numberResult))).join(); } return CompletableFuture.completedFuture(null); }) @@ -348,7 +348,7 @@ public void DoubleNumberPrompt() throws UnsupportedDataTypeException { } else if (results.getStatus() == DialogTurnStatus.COMPLETE) { Double numberResult = (Double) results.getResult(); turnContext.sendActivity( - MessageFactory.text(String.format("Bot received the number '%.2f'.", numberResult))); + MessageFactory.text(String.format("Bot received the number '%.2f'.", numberResult))).join(); } return CompletableFuture.completedFuture(null); }) @@ -387,7 +387,7 @@ public void CurrencyNumberPrompt() throws UnsupportedDataTypeException { } else if (results.getStatus() == DialogTurnStatus.COMPLETE) { Double numberResult = (Double) results.getResult(); turnContext.sendActivity( - MessageFactory.text(String.format("Bot received the number '%.0f'.", numberResult))); + MessageFactory.text(String.format("Bot received the number '%.0f'.", numberResult))).join(); } return CompletableFuture.completedFuture(null); }) .send("hello") @@ -425,7 +425,7 @@ public void AgeNumberPrompt() throws UnsupportedDataTypeException { } else if (results.getStatus() == DialogTurnStatus.COMPLETE) { Double numberResult = (Double) results.getResult(); turnContext.sendActivity( - MessageFactory.text(String.format("Bot received the number '%.0f'.", numberResult))); + MessageFactory.text(String.format("Bot received the number '%.0f'.", numberResult))).join(); } return CompletableFuture.completedFuture(null); }) @@ -464,7 +464,7 @@ public void DimensionNumberPrompt() throws UnsupportedDataTypeException { } else if (results.getStatus() == DialogTurnStatus.COMPLETE) { Double numberResult = (Double) results.getResult(); turnContext.sendActivity( - MessageFactory.text(String.format("Bot received the number '%.0f'.", numberResult))); + MessageFactory.text(String.format("Bot received the number '%.0f'.", numberResult))).join(); } return CompletableFuture.completedFuture(null); }) @@ -503,7 +503,7 @@ public void TemperatureNumberPrompt() throws UnsupportedDataTypeException { } else if (results.getStatus() == DialogTurnStatus.COMPLETE) { Double numberResult = (Double) results.getResult(); turnContext.sendActivity( - MessageFactory.text(String.format("Bot received the number '%.0f'.", numberResult))); + MessageFactory.text(String.format("Bot received the number '%.0f'.", numberResult))).join(); } return CompletableFuture.completedFuture(null); }) @@ -621,7 +621,7 @@ public void NumberPromptDefaultsToEnUsLocale() throws UnsupportedDataTypeExcepti } else if (results.getStatus() == DialogTurnStatus.COMPLETE) { Double numberResult = (Double) results.getResult(); turnContext.sendActivity( - MessageFactory.text(String.format("Bot received the number '%.2f'.", numberResult))); + MessageFactory.text(String.format("Bot received the number '%.2f'.", numberResult))).join(); } return CompletableFuture.completedFuture(null); }) diff --git a/libraries/bot-dialogs/src/test/java/com/microsoft/bot/dialogs/prompts/OAuthPromptTests.java b/libraries/bot-dialogs/src/test/java/com/microsoft/bot/dialogs/prompts/OAuthPromptTests.java index 8e07128c4..88deb325b 100644 --- a/libraries/bot-dialogs/src/test/java/com/microsoft/bot/dialogs/prompts/OAuthPromptTests.java +++ b/libraries/bot-dialogs/src/test/java/com/microsoft/bot/dialogs/prompts/OAuthPromptTests.java @@ -130,9 +130,9 @@ public void OAuthPromptWithMagicCode() { dc.prompt("OAuthPrompt", new PromptOptions()); } else if (results.getStatus() == DialogTurnStatus.COMPLETE) { if (results.getResult() instanceof TokenResponse) { - turnContext.sendActivity(MessageFactory.text("Logged in.")); + turnContext.sendActivity(MessageFactory.text("Logged in.")).join(); } else { - turnContext.sendActivity(MessageFactory.text("Failed.")); + turnContext.sendActivity(MessageFactory.text("Failed.")).join(); } } return CompletableFuture.completedFuture(null); @@ -599,9 +599,9 @@ private void OAuthPrompt(Storage storage) { dc.prompt("OAuthPrompt", new PromptOptions()); } else if (results.getStatus() == DialogTurnStatus.COMPLETE) { if (results.getResult() instanceof TokenResponse) { - turnContext.sendActivity(MessageFactory.text("Logged in.")); + turnContext.sendActivity(MessageFactory.text("Logged in.")).join(); } else { - turnContext.sendActivity(MessageFactory.text("Failed.")); + turnContext.sendActivity(MessageFactory.text("Failed.")).join(); } } return CompletableFuture.completedFuture(null); diff --git a/libraries/bot-dialogs/src/test/java/com/microsoft/bot/dialogs/prompts/TextPromptTests.java b/libraries/bot-dialogs/src/test/java/com/microsoft/bot/dialogs/prompts/TextPromptTests.java index 1c06ab1ec..4c0f59afb 100644 --- a/libraries/bot-dialogs/src/test/java/com/microsoft/bot/dialogs/prompts/TextPromptTests.java +++ b/libraries/bot-dialogs/src/test/java/com/microsoft/bot/dialogs/prompts/TextPromptTests.java @@ -176,7 +176,7 @@ public void TextPromptValidator() { String value = promptContext.getRecognized().getValue(); if (value.length() <= 3) { promptContext.getContext() - .sendActivity(MessageFactory.text("Make sure the text is greater than three characters.")); + .sendActivity(MessageFactory.text("Make sure the text is greater than three characters.")).join(); return CompletableFuture.completedFuture(false); } else { return CompletableFuture.completedFuture(true); @@ -270,7 +270,7 @@ public void TextPromptValidatorWithMessageShouldNotSendRetryPrompt() { String value = promptContext.getRecognized().getValue(); if (value.length() <= 3) { promptContext.getContext() - .sendActivity(MessageFactory.text("The text should be greater than 3 chars.")); + .sendActivity(MessageFactory.text("The text should be greater than 3 chars.")).join(); return CompletableFuture.completedFuture(false); } else { return CompletableFuture.completedFuture(true);