use of com.azure.android.communication.chat.implementation.models.CreateChatThreadResult in project azure-sdk-for-android by Azure.
the class ChatAsyncImplClientTest method canListChatThreadsWithMaxPage.
@ParameterizedTest
@MethodSource("com.azure.android.core.test.TestBase#getHttpClients")
public void canListChatThreadsWithMaxPage(HttpClient httpClient) throws InterruptedException, ExecutionException {
setupTest(httpClient);
final CreateChatThreadOptions threadRequest = createThreadOptions(firstThreadMember.getId(), secondThreadMember.getId());
CompletableFuture<CreateChatThreadResult> completableFuture1 = this.client.getChatClient().createChatThreadAsync(threadRequest);
assertNotNull(completableFuture1);
CreateChatThreadResult result1 = completableFuture1.get();
assertNotNull(result1);
assertNotNull(result1.getChatThread());
assertNotNull(result1.getChatThread().getId());
CompletableFuture<CreateChatThreadResult> completableFuture2 = this.client.getChatClient().createChatThreadAsync(threadRequest);
assertNotNull(completableFuture2);
CreateChatThreadResult result2 = completableFuture1.get();
assertNotNull(result2);
assertNotNull(result2.getChatThread());
assertNotNull(result2.getChatThread().getId());
CompletableFuture<PagedResponse<ChatThreadItem>> completableFuture = this.client.getChatClient().listChatThreadsSinglePageAsync(2, null);
String nextLink;
List<ChatThreadItem> returnedThreads = new ArrayList<ChatThreadItem>();
do {
PagedResponse<ChatThreadItem> response = completableFuture.get();
assertNotNull(response);
List<ChatThreadItem> threadsInPage = response.getValue();
assertNotNull(threadsInPage);
for (ChatThreadItem thread : threadsInPage) {
returnedThreads.add(thread);
}
nextLink = response.getContinuationToken();
if (nextLink != null) {
completableFuture = this.client.getChatClient().listChatThreadsNextSinglePageAsync(nextLink);
}
} while (nextLink != null);
// REVISIT: Unreliable assertion
// assertTrue(returnedThreads.size() > 0);
}
use of com.azure.android.communication.chat.implementation.models.CreateChatThreadResult in project azure-sdk-for-android by Azure.
the class ChatAsyncImplClientTest method canListChatThreads.
@ParameterizedTest
@MethodSource("com.azure.android.core.test.TestBase#getHttpClients")
public void canListChatThreads(HttpClient httpClient) throws InterruptedException, ExecutionException {
setupTest(httpClient);
final CreateChatThreadOptions threadRequest = createThreadOptions(firstThreadMember.getId(), secondThreadMember.getId());
CompletableFuture<CreateChatThreadResult> completableFuture1 = this.client.getChatClient().createChatThreadAsync(threadRequest);
assertNotNull(completableFuture1);
CreateChatThreadResult result1 = completableFuture1.get();
assertNotNull(result1);
assertNotNull(result1.getChatThread());
assertNotNull(result1.getChatThread().getId());
CompletableFuture<CreateChatThreadResult> completableFuture2 = this.client.getChatClient().createChatThreadAsync(threadRequest);
assertNotNull(completableFuture2);
CreateChatThreadResult result2 = completableFuture1.get();
assertNotNull(result2);
assertNotNull(result2.getChatThread());
assertNotNull(result2.getChatThread().getId());
CompletableFuture<PagedResponse<ChatThreadItem>> completableFuture = this.client.getChatClient().listChatThreadsSinglePageAsync(null, null);
String nextLink;
List<ChatThreadItem> returnedThreads = new ArrayList<ChatThreadItem>();
do {
PagedResponse<ChatThreadItem> response = completableFuture.get();
assertNotNull(response);
List<ChatThreadItem> threadsInPage = response.getValue();
assertNotNull(threadsInPage);
for (ChatThreadItem thread : threadsInPage) {
returnedThreads.add(thread);
}
nextLink = response.getContinuationToken();
if (nextLink != null) {
completableFuture = this.client.getChatClient().listChatThreadsNextSinglePageAsync(nextLink);
}
} while (nextLink != null);
// REVISIT: Unreliable assertion
// assertTrue(returnedThreads.size() > 0);
}
use of com.azure.android.communication.chat.implementation.models.CreateChatThreadResult in project azure-sdk-for-android by Azure.
the class ChatAsyncImplClientTest method canCreateThread.
@ParameterizedTest
@MethodSource("com.azure.android.core.test.TestBase#getHttpClients")
public void canCreateThread(HttpClient httpClient) throws ExecutionException, InterruptedException {
setupTest(httpClient);
final CreateChatThreadOptions threadRequest = createThreadOptions(firstThreadMember.getId(), secondThreadMember.getId());
CompletableFuture<CreateChatThreadResult> completableFuture = this.client.getChatClient().createChatThreadAsync(threadRequest);
assertNotNull(completableFuture);
CreateChatThreadResult result = completableFuture.get();
assertNotNull(result);
assertNotNull(result.getChatThread());
assertNotNull(result.getChatThread().getId());
}
use of com.azure.android.communication.chat.implementation.models.CreateChatThreadResult in project azure-sdk-for-android by Azure.
the class ChatAsyncImplClientTest method canRepeatCreateThread.
@ParameterizedTest
@MethodSource("com.azure.android.core.test.TestBase#getHttpClients")
public void canRepeatCreateThread(HttpClient httpClient) throws ExecutionException, InterruptedException {
setupTest(httpClient);
UUID uuid = UUID.randomUUID();
final CreateChatThreadOptions threadRequest = createThreadOptions(firstThreadMember.getId(), secondThreadMember.getId());
CompletableFuture<Response<CreateChatThreadResult>> completableFuture1 = this.client.getChatClient().createChatThreadWithResponseAsync(threadRequest, uuid.toString());
assertNotNull(completableFuture1);
Response<CreateChatThreadResult> response1 = completableFuture1.get();
assertNotNull(response1);
CreateChatThreadResult result1 = response1.getValue();
assertNotNull(result1);
assertNotNull(result1.getChatThread());
assertNotNull(result1.getChatThread().getId());
String expectedThreadId = response1.getValue().getChatThread().getId();
CompletableFuture<Response<CreateChatThreadResult>> completableFuture2 = this.client.getChatClient().createChatThreadWithResponseAsync(threadRequest, uuid.toString());
assertNotNull(completableFuture2);
Response<CreateChatThreadResult> response2 = completableFuture2.get();
assertNotNull(response2);
CreateChatThreadResult result2 = response2.getValue();
assertNotNull(result2);
assertNotNull(result2.getChatThread());
assertNotNull(result2.getChatThread().getId());
assertEquals(expectedThreadId, result2.getChatThread().getId());
CompletableFuture<Response<CreateChatThreadResult>> completableFuture3 = this.client.getChatClient().createChatThreadWithResponseAsync(threadRequest, UUID.randomUUID().toString());
assertNotNull(completableFuture3);
Response<CreateChatThreadResult> response3 = completableFuture3.get();
assertNotNull(response3);
CreateChatThreadResult result3 = response3.getValue();
assertNotNull(result3);
assertNotNull(result3.getChatThread());
assertNotNull(result3.getChatThread().getId());
assertNotEquals(expectedThreadId, result3.getChatThread().getId());
}
use of com.azure.android.communication.chat.implementation.models.CreateChatThreadResult in project azure-sdk-for-android by Azure.
the class ChatAsyncImplClientTest method canDeleteChatThread.
@ParameterizedTest
@MethodSource("com.azure.android.core.test.TestBase#getHttpClients")
public void canDeleteChatThread(HttpClient httpClient) throws ExecutionException, InterruptedException {
setupTest(httpClient);
final CreateChatThreadOptions threadRequest = createThreadOptions(firstThreadMember.getId(), secondThreadMember.getId());
CompletableFuture<CreateChatThreadResult> completableFuture1 = this.client.getChatClient().createChatThreadAsync(threadRequest);
assertNotNull(completableFuture1);
CreateChatThreadResult result1 = completableFuture1.get();
assertNotNull(result1);
assertNotNull(result1.getChatThread());
assertNotNull(result1.getChatThread().getId());
CompletableFuture<Void> completableFuture2 = this.client.getChatClient().deleteChatThreadAsync(result1.getChatThread().getId());
assertNotNull(completableFuture2);
Void result2 = completableFuture2.get();
assertNull(result2);
}
Aggregations