use of com.azure.android.communication.chat.models.SendChatMessageOptions in project azure-sdk-for-android by Azure.
the class ChatThreadAsyncClientTest method canSendThenGetMessageWithResponse.
@ParameterizedTest
@MethodSource("com.azure.android.core.test.TestBase#getHttpClients")
public void canSendThenGetMessageWithResponse(HttpClient httpClient) throws ExecutionException, InterruptedException {
setupTest(httpClient);
SendChatMessageOptions messageRequest = super.sendMessageOptions();
CompletableFuture<Response<SendChatMessageResult>> completableFuture1 = this.chatThreadClient.sendMessageWithResponse(messageRequest, null);
Response<SendChatMessageResult> response1 = completableFuture1.get();
assertNotNull(response1);
final String messageId = response1.getValue().getId();
CompletableFuture<Response<ChatMessage>> completableFuture2 = this.chatThreadClient.getMessageWithResponse(messageId, null);
Response<ChatMessage> response2 = completableFuture2.get();
assertNotNull(response2);
final ChatMessage message = response2.getValue();
assertEquals(message.getContent().getMessage(), messageRequest.getContent());
assertEquals(message.getType(), messageRequest.getType());
assertEquals(message.getSenderDisplayName(), messageRequest.getSenderDisplayName());
assertEquals(message.getMetadata(), messageRequest.getMetadata());
}
use of com.azure.android.communication.chat.models.SendChatMessageOptions in project azure-sdk-for-android by Azure.
the class ChatThreadAsyncClientTest method canSendReadReceipt.
@Disabled("Unreliable test")
@ParameterizedTest
@MethodSource("com.azure.android.core.test.TestBase#getHttpClients")
public void canSendReadReceipt(HttpClient httpClient) throws ExecutionException, InterruptedException {
setupTest(httpClient);
SendChatMessageOptions messageRequest = super.sendMessageOptions();
String messageId = this.chatThreadClient.sendMessage(messageRequest).get().getId();
this.chatThreadClient.sendReadReceipt(messageId).get();
}
use of com.azure.android.communication.chat.models.SendChatMessageOptions in project azure-sdk-for-android by Azure.
the class ChatClientTestBase method sendMessageOptions.
public static SendChatMessageOptions sendMessageOptions() {
SendChatMessageOptions options = new SendChatMessageOptions();
options.setContent("Content");
options.setSenderDisplayName("Tester");
options.setType(ChatMessageType.TEXT);
options.setMetadata(new HashMap<String, String>() {
{
put("tags", "tags value");
put("deliveryMode", "deliveryMode value");
put("onedriveReferences", "onedriveReferences");
put("amsreferences", "[\\\"test url file 3\\\"]");
put("key", "value key");
}
});
return options;
}
use of com.azure.android.communication.chat.models.SendChatMessageOptions in project azure-sdk-for-android by Azure.
the class ChatThreadAsyncClientTest method canSendReadReceiptWithResponse.
@Disabled("Unreliable test")
@ParameterizedTest
@MethodSource("com.azure.android.core.test.TestBase#getHttpClients")
public void canSendReadReceiptWithResponse(HttpClient httpClient) throws ExecutionException, InterruptedException {
setupTest(httpClient);
SendChatMessageOptions messageRequest = super.sendMessageOptions();
String messageId = this.chatThreadClient.sendMessage(messageRequest).get().getId();
CompletableFuture<Response<Void>> completableFuture = this.chatThreadClient.sendReadReceiptWithResponse(messageId, null);
Response<Void> response = completableFuture.get();
assertNotNull(response);
assertEquals(200, response.getStatusCode());
}
use of com.azure.android.communication.chat.models.SendChatMessageOptions in project azure-sdk-for-android by Azure.
the class ChatThreadAsyncClientTest method canSendThenGetMessage.
@ParameterizedTest
@MethodSource("com.azure.android.core.test.TestBase#getHttpClients")
public void canSendThenGetMessage(HttpClient httpClient) throws ExecutionException, InterruptedException {
setupTest(httpClient);
SendChatMessageOptions messageRequest = super.sendMessageOptions();
final String messageId = this.chatThreadClient.sendMessage(messageRequest).get().getId();
final ChatMessage message = this.chatThreadClient.getMessage(messageId).get();
assertEquals(message.getContent().getMessage(), messageRequest.getContent());
assertEquals(message.getType(), messageRequest.getType());
assertEquals(message.getSenderDisplayName(), messageRequest.getSenderDisplayName());
assertEquals(message.getMetadata(), messageRequest.getMetadata());
}
Aggregations