Search in sources :

Example 11 with CommunicationUserIdentifier

use of com.azure.android.communication.common.CommunicationUserIdentifier in project azure-sdk-for-android by Azure.

the class ChatThreadAsyncClientTest method cannotRemoveParticipantWithResponseWithInvalidUser.

@ParameterizedTest
@MethodSource("com.azure.android.core.test.TestBase#getHttpClients")
public void cannotRemoveParticipantWithResponseWithInvalidUser(HttpClient httpClient) throws ExecutionException, InterruptedException {
    setupTest(httpClient);
    ExecutionException executionException = assertThrows(ExecutionException.class, () -> {
        this.chatThreadClient.removeParticipantWithResponse(new CommunicationUserIdentifier("8:acs:invalidUserId"), null).get();
    });
    Throwable cause = executionException.getCause();
    assertNotNull(cause);
    assertTrue(cause instanceof ChatErrorResponseException);
    ChatErrorResponseException exception = (ChatErrorResponseException) cause;
    assertNotNull(exception.getResponse());
    assertEquals(400, exception.getResponse().getStatusCode());
}
Also used : ChatErrorResponseException(com.azure.android.communication.chat.models.ChatErrorResponseException) ExecutionException(java.util.concurrent.ExecutionException) CommunicationUserIdentifier(com.azure.android.communication.common.CommunicationUserIdentifier) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 12 with CommunicationUserIdentifier

use of com.azure.android.communication.common.CommunicationUserIdentifier in project azure-sdk-for-android by Azure.

the class NotificationUtilsTest method canParseAcsGcchUserRawId.

@Test
public void canParseAcsGcchUserRawId() {
    final String acsUserRawId = "8:gcch-acs:" + USER_ID;
    CommunicationIdentifier communicationIdentifier = NotificationUtils.getCommunicationIdentifier(acsUserRawId);
    assertNotNull(communicationIdentifier);
    assertTrue(communicationIdentifier instanceof CommunicationUserIdentifier);
    CommunicationUserIdentifier communicationUserIdentifier = (CommunicationUserIdentifier) communicationIdentifier;
    assertEquals(acsUserRawId, communicationUserIdentifier.getId());
}
Also used : CommunicationIdentifier(com.azure.android.communication.common.CommunicationIdentifier) CommunicationUserIdentifier(com.azure.android.communication.common.CommunicationUserIdentifier) Test(org.junit.jupiter.api.Test)

Example 13 with CommunicationUserIdentifier

use of com.azure.android.communication.common.CommunicationUserIdentifier in project azure-sdk-for-android by Azure.

the class NotificationUtilsTest method canParseSpoolUserRawId.

@Test
public void canParseSpoolUserRawId() {
    final String spoolUserRawId = "8:spool:" + USER_ID;
    CommunicationIdentifier communicationIdentifier = NotificationUtils.getCommunicationIdentifier(spoolUserRawId);
    assertNotNull(communicationIdentifier);
    assertTrue(communicationIdentifier instanceof CommunicationUserIdentifier);
    CommunicationUserIdentifier communicationUserIdentifier = (CommunicationUserIdentifier) communicationIdentifier;
    assertEquals(spoolUserRawId, communicationUserIdentifier.getId());
}
Also used : CommunicationIdentifier(com.azure.android.communication.common.CommunicationIdentifier) CommunicationUserIdentifier(com.azure.android.communication.common.CommunicationUserIdentifier) Test(org.junit.jupiter.api.Test)

Example 14 with CommunicationUserIdentifier

use of com.azure.android.communication.common.CommunicationUserIdentifier in project azure-sdk-for-android by Azure.

the class CommunicationIdentifierConverterTests method serializeCommunicationUser.

@Test
public void serializeCommunicationUser() {
    CommunicationIdentifierModel model = CommunicationIdentifierConverter.convert(new CommunicationUserIdentifier(someId), logger);
    assertNotNull(model.getCommunicationUser());
    assertEquals(someId, model.getCommunicationUser().getId());
}
Also used : CommunicationIdentifierModel(com.azure.android.communication.chat.implementation.models.CommunicationIdentifierModel) CommunicationUserIdentifier(com.azure.android.communication.common.CommunicationUserIdentifier) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 15 with CommunicationUserIdentifier

use of com.azure.android.communication.common.CommunicationUserIdentifier in project azure-sdk-for-android by Azure.

the class ChatAsyncImplClientTest method setupTest.

private void setupTest(HttpClient httpClient) {
    this.client = super.getChatClientBuilder(httpClient).buildClient();
    this.firstThreadMember = new CommunicationUserIdentifier(THREAD_MEMBER_1);
    this.secondThreadMember = new CommunicationUserIdentifier(THREAD_MEMBER_2);
}
Also used : CommunicationUserIdentifier(com.azure.android.communication.common.CommunicationUserIdentifier)

Aggregations

CommunicationUserIdentifier (com.azure.android.communication.common.CommunicationUserIdentifier)19 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)7 ChatParticipant (com.azure.android.communication.chat.models.ChatParticipant)6 MethodSource (org.junit.jupiter.params.provider.MethodSource)6 ArrayList (java.util.ArrayList)5 Test (org.junit.jupiter.api.Test)5 ListParticipantsOptions (com.azure.android.communication.chat.models.ListParticipantsOptions)4 CommunicationIdentifier (com.azure.android.communication.common.CommunicationIdentifier)4 CountDownLatch (java.util.concurrent.CountDownLatch)4 ExecutionException (java.util.concurrent.ExecutionException)4 ChatErrorResponseException (com.azure.android.communication.chat.models.ChatErrorResponseException)2 CreateChatThreadOptions (com.azure.android.communication.chat.models.CreateChatThreadOptions)2 CreateChatThreadResult (com.azure.android.communication.chat.models.CreateChatThreadResult)2 CommunicationCloudEnvironmentModel (com.azure.android.communication.chat.implementation.models.CommunicationCloudEnvironmentModel)1 CommunicationIdentifierModel (com.azure.android.communication.chat.implementation.models.CommunicationIdentifierModel)1 MicrosoftTeamsUserIdentifierModel (com.azure.android.communication.chat.implementation.models.MicrosoftTeamsUserIdentifierModel)1 PhoneNumberIdentifierModel (com.azure.android.communication.chat.implementation.models.PhoneNumberIdentifierModel)1 AddChatParticipantsResult (com.azure.android.communication.chat.models.AddChatParticipantsResult)1 ChatEvent (com.azure.android.communication.chat.models.ChatEvent)1 ChatMessageDeletedEvent (com.azure.android.communication.chat.models.ChatMessageDeletedEvent)1