Search in sources :

Example 6 with CreateChatThreadResult

use of com.azure.android.communication.chat.implementation.models.CreateChatThreadResult in project azure-sdk-for-android by Azure.

the class ChatAsyncImplClientTest method canDeleteChatThreadWithResponse.

@ParameterizedTest
@MethodSource("com.azure.android.core.test.TestBase#getHttpClients")
public void canDeleteChatThreadWithResponse(HttpClient httpClient) throws ExecutionException, InterruptedException {
    setupTest(httpClient);
    final CreateChatThreadOptions threadRequest = createThreadOptions(firstThreadMember.getId(), secondThreadMember.getId());
    CompletableFuture<Response<CreateChatThreadResult>> completableFuture1 = this.client.getChatClient().createChatThreadWithResponseAsync(threadRequest, null);
    assertNotNull(completableFuture1);
    Response<CreateChatThreadResult> response1 = completableFuture1.get();
    assertNotNull(response1);
    CreateChatThreadResult result1 = response1.getValue();
    assertNotNull(result1);
    assertNotNull(result1.getChatThread());
    assertNotNull(result1.getChatThread().getId());
    CompletableFuture<Response<Void>> completableFuture2 = this.client.getChatClient().deleteChatThreadWithResponseAsync(result1.getChatThread().getId());
    assertNotNull(completableFuture2);
    Response<Void> response2 = completableFuture2.get();
    assertNotNull(response2);
    Void result2 = response2.getValue();
    assertNull(result2);
}
Also used : Response(com.azure.android.core.rest.Response) PagedResponse(com.azure.android.core.rest.util.paging.PagedResponse) CreateChatThreadResult(com.azure.android.communication.chat.implementation.models.CreateChatThreadResult) CreateChatThreadOptions(com.azure.android.communication.chat.implementation.models.CreateChatThreadOptions) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 7 with CreateChatThreadResult

use of com.azure.android.communication.chat.implementation.models.CreateChatThreadResult in project azure-sdk-for-android by Azure.

the class ChatAsyncImplClientTest method canCreateThreadWithResponse.

@ParameterizedTest
@MethodSource("com.azure.android.core.test.TestBase#getHttpClients")
public void canCreateThreadWithResponse(HttpClient httpClient) throws ExecutionException, InterruptedException {
    setupTest(httpClient);
    final CreateChatThreadOptions threadRequest = createThreadOptions(firstThreadMember.getId(), secondThreadMember.getId());
    CompletableFuture<Response<CreateChatThreadResult>> completableFuture = this.client.getChatClient().createChatThreadWithResponseAsync(threadRequest, null);
    assertNotNull(completableFuture);
    Response<CreateChatThreadResult> response = completableFuture.get();
    assertNotNull(response);
    CreateChatThreadResult result = response.getValue();
    assertNotNull(result);
    assertNotNull(result.getChatThread());
    assertNotNull(result.getChatThread().getId());
}
Also used : Response(com.azure.android.core.rest.Response) PagedResponse(com.azure.android.core.rest.util.paging.PagedResponse) CreateChatThreadResult(com.azure.android.communication.chat.implementation.models.CreateChatThreadResult) CreateChatThreadOptions(com.azure.android.communication.chat.implementation.models.CreateChatThreadOptions) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 8 with CreateChatThreadResult

use of com.azure.android.communication.chat.implementation.models.CreateChatThreadResult in project azure-sdk-for-android by Azure.

the class ChatAsyncImplClientTest method canGetExistingChatThreadWithResponse.

@ParameterizedTest
@MethodSource("com.azure.android.core.test.TestBase#getHttpClients")
public void canGetExistingChatThreadWithResponse(HttpClient httpClient) throws ExecutionException, InterruptedException {
    setupTest(httpClient);
    final CreateChatThreadOptions threadRequest = createThreadOptions(firstThreadMember.getId(), secondThreadMember.getId());
    CompletableFuture<Response<CreateChatThreadResult>> completableFuture1 = this.client.getChatClient().createChatThreadWithResponseAsync(threadRequest, null);
    assertNotNull(completableFuture1);
    Response<CreateChatThreadResult> response1 = completableFuture1.get();
    assertNotNull(response1);
    CreateChatThreadResult result1 = response1.getValue();
    assertNotNull(result1);
    assertNotNull(result1.getChatThread());
    assertNotNull(result1.getChatThread().getId());
    String expectedThreadId = result1.getChatThread().getId();
    CompletableFuture<Response<ChatThreadProperties>> completableFuture2 = this.client.getChatThreadClient().getChatThreadPropertiesWithResponseAsync(expectedThreadId);
    assertNotNull(completableFuture2);
    Response<ChatThreadProperties> response2 = completableFuture2.get();
    assertNotNull(response2);
    ChatThreadProperties result2 = response2.getValue();
    assertNotNull(result2);
    assertNotNull(result2.getId());
    assertEquals(expectedThreadId, result2.getId());
}
Also used : Response(com.azure.android.core.rest.Response) PagedResponse(com.azure.android.core.rest.util.paging.PagedResponse) CreateChatThreadResult(com.azure.android.communication.chat.implementation.models.CreateChatThreadResult) ChatThreadProperties(com.azure.android.communication.chat.implementation.models.ChatThreadProperties) CreateChatThreadOptions(com.azure.android.communication.chat.implementation.models.CreateChatThreadOptions) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 9 with CreateChatThreadResult

use of com.azure.android.communication.chat.implementation.models.CreateChatThreadResult in project azure-sdk-for-android by Azure.

the class ChatAsyncImplClientTest method canGetExistingChatThread.

@ParameterizedTest
@MethodSource("com.azure.android.core.test.TestBase#getHttpClients")
public void canGetExistingChatThread(HttpClient httpClient) throws ExecutionException, InterruptedException {
    setupTest(httpClient);
    final CreateChatThreadOptions threadRequest = createThreadOptions(firstThreadMember.getId(), secondThreadMember.getId());
    CompletableFuture<CreateChatThreadResult> completableFuture1 = this.client.getChatClient().createChatThreadAsync(threadRequest, null);
    assertNotNull(completableFuture1);
    CreateChatThreadResult result1 = completableFuture1.get();
    assertNotNull(result1);
    assertNotNull(result1.getChatThread());
    assertNotNull(result1.getChatThread().getId());
    String expectedThreadId = result1.getChatThread().getId();
    CompletableFuture<ChatThreadProperties> completableFuture2 = this.client.getChatThreadClient().getChatThreadPropertiesAsync(expectedThreadId);
    assertNotNull(completableFuture2);
    ChatThreadProperties result2 = completableFuture2.get();
    assertNotNull(result2);
    assertNotNull(result2.getId());
    assertEquals(expectedThreadId, result2.getId());
}
Also used : CreateChatThreadResult(com.azure.android.communication.chat.implementation.models.CreateChatThreadResult) ChatThreadProperties(com.azure.android.communication.chat.implementation.models.ChatThreadProperties) CreateChatThreadOptions(com.azure.android.communication.chat.implementation.models.CreateChatThreadOptions) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 10 with CreateChatThreadResult

use of com.azure.android.communication.chat.implementation.models.CreateChatThreadResult in project azure-sdk-for-android by Azure.

the class ChatAsyncImplClientTest method canCreateNewThreadWithoutSettingRepeatabilityID.

@ParameterizedTest
@MethodSource("com.azure.android.core.test.TestBase#getHttpClients")
public void canCreateNewThreadWithoutSettingRepeatabilityID(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, null);
    assertNotNull(completableFuture1);
    Response<CreateChatThreadResult> response1 = completableFuture1.get();
    assertNotNull(response1);
    CreateChatThreadResult result1 = response1.getValue();
    assertNotNull(result1);
    assertNotNull(result1.getChatThread());
    assertNotNull(result1.getChatThread().getId());
    String threadId1 = response1.getValue().getChatThread().getId();
    CompletableFuture<Response<CreateChatThreadResult>> completableFuture2 = this.client.getChatClient().createChatThreadWithResponseAsync(threadRequest, null);
    assertNotNull(completableFuture2);
    Response<CreateChatThreadResult> response2 = completableFuture2.get();
    assertNotNull(response2);
    CreateChatThreadResult result2 = response2.getValue();
    assertNotNull(result2);
    assertNotNull(result2.getChatThread());
    assertNotNull(result2.getChatThread().getId());
    assertNotEquals(threadId1, result2.getChatThread().getId());
}
Also used : Response(com.azure.android.core.rest.Response) PagedResponse(com.azure.android.core.rest.util.paging.PagedResponse) CreateChatThreadResult(com.azure.android.communication.chat.implementation.models.CreateChatThreadResult) UUID(java.util.UUID) CreateChatThreadOptions(com.azure.android.communication.chat.implementation.models.CreateChatThreadOptions) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Aggregations

CreateChatThreadOptions (com.azure.android.communication.chat.implementation.models.CreateChatThreadOptions)10 CreateChatThreadResult (com.azure.android.communication.chat.implementation.models.CreateChatThreadResult)10 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)10 MethodSource (org.junit.jupiter.params.provider.MethodSource)10 PagedResponse (com.azure.android.core.rest.util.paging.PagedResponse)7 Response (com.azure.android.core.rest.Response)5 ChatThreadProperties (com.azure.android.communication.chat.implementation.models.ChatThreadProperties)2 ChatThreadItem (com.azure.android.communication.chat.models.ChatThreadItem)2 ArrayList (java.util.ArrayList)2 UUID (java.util.UUID)2