Search in sources :

Example 16 with CommunicationIdentifier

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

the class NotificationUtilsTest method canParseTeamsDodUserRawId.

@Test
public void canParseTeamsDodUserRawId() {
    final String teamsDodUserRawId = "8:dod:" + USER_ID;
    CommunicationIdentifier communicationIdentifier = NotificationUtils.getCommunicationIdentifier(teamsDodUserRawId);
    assertNotNull(communicationIdentifier);
    assertTrue(communicationIdentifier instanceof MicrosoftTeamsUserIdentifier);
    MicrosoftTeamsUserIdentifier microsoftTeamsUserIdentifier = (MicrosoftTeamsUserIdentifier) communicationIdentifier;
    assertEquals(CommunicationCloudEnvironment.DOD, microsoftTeamsUserIdentifier.getCloudEnvironment());
    assertFalse(microsoftTeamsUserIdentifier.isAnonymous());
    assertEquals(USER_ID, microsoftTeamsUserIdentifier.getUserId());
    assertEquals(teamsDodUserRawId, microsoftTeamsUserIdentifier.getRawId());
}
Also used : MicrosoftTeamsUserIdentifier(com.azure.android.communication.common.MicrosoftTeamsUserIdentifier) CommunicationIdentifier(com.azure.android.communication.common.CommunicationIdentifier) Test(org.junit.jupiter.api.Test)

Example 17 with CommunicationIdentifier

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

the class NotificationUtilsTest method canParseTeamsGcchUserRawId.

@Test
public void canParseTeamsGcchUserRawId() {
    final String teamsGcchUserRawId = "8:gcch:" + USER_ID;
    CommunicationIdentifier communicationIdentifier = NotificationUtils.getCommunicationIdentifier(teamsGcchUserRawId);
    assertNotNull(communicationIdentifier);
    assertTrue(communicationIdentifier instanceof MicrosoftTeamsUserIdentifier);
    MicrosoftTeamsUserIdentifier microsoftTeamsUserIdentifier = (MicrosoftTeamsUserIdentifier) communicationIdentifier;
    assertEquals(CommunicationCloudEnvironment.GCCH, microsoftTeamsUserIdentifier.getCloudEnvironment());
    assertFalse(microsoftTeamsUserIdentifier.isAnonymous());
    assertEquals(USER_ID, microsoftTeamsUserIdentifier.getUserId());
    assertEquals(teamsGcchUserRawId, microsoftTeamsUserIdentifier.getRawId());
}
Also used : MicrosoftTeamsUserIdentifier(com.azure.android.communication.common.MicrosoftTeamsUserIdentifier) CommunicationIdentifier(com.azure.android.communication.common.CommunicationIdentifier) Test(org.junit.jupiter.api.Test)

Example 18 with CommunicationIdentifier

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

the class NotificationUtilsTest method canParseAcsDodUserRawId.

@Test
public void canParseAcsDodUserRawId() {
    final String acsUserRawId = "8:dod-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 19 with CommunicationIdentifier

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

the class NotificationUtilsTest method canParseAcsUserRawId.

@Test
public void canParseAcsUserRawId() {
    final String acsUserRawId = "8: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 20 with CommunicationIdentifier

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

the class NotificationUtilsTest method fallbackToUnknownIdentifierForUnknownRawId.

@Test
public void fallbackToUnknownIdentifierForUnknownRawId() {
    final String unknownRawId = "unknown_raw_id";
    CommunicationIdentifier communicationIdentifier = NotificationUtils.getCommunicationIdentifier(unknownRawId);
    assertNotNull(communicationIdentifier);
    assertTrue(communicationIdentifier instanceof UnknownIdentifier);
    UnknownIdentifier unknownIdentifier = (UnknownIdentifier) communicationIdentifier;
    assertEquals(unknownRawId, unknownIdentifier.getId());
}
Also used : CommunicationIdentifier(com.azure.android.communication.common.CommunicationIdentifier) UnknownIdentifier(com.azure.android.communication.common.UnknownIdentifier) Test(org.junit.jupiter.api.Test)

Aggregations

CommunicationIdentifier (com.azure.android.communication.common.CommunicationIdentifier)21 Test (org.junit.jupiter.api.Test)13 JSONException (org.json.JSONException)8 JSONObject (org.json.JSONObject)8 CommunicationUserIdentifier (com.azure.android.communication.common.CommunicationUserIdentifier)4 MicrosoftTeamsUserIdentifier (com.azure.android.communication.common.MicrosoftTeamsUserIdentifier)4 CommunicationIdentifierModel (com.azure.android.communication.chat.implementation.models.CommunicationIdentifierModel)3 JSONArray (org.json.JSONArray)3 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)3 CommunicationUserIdentifierModel (com.azure.android.communication.chat.implementation.models.CommunicationUserIdentifierModel)1 PhoneNumberIdentifierModel (com.azure.android.communication.chat.implementation.models.PhoneNumberIdentifierModel)1 PhoneNumberIdentifier (com.azure.android.communication.common.PhoneNumberIdentifier)1 UnknownIdentifier (com.azure.android.communication.common.UnknownIdentifier)1