Search in sources :

Example 6 with AssistantVo

use of com.fanap.podchat.chat.assistant.model.AssistantVo in project pod-chat-android-sdk by FanapSoft.

the class AssistantCacheTest method getAndValidateAssistantHistoriesCache.

@Test
public void getAndValidateAssistantHistoriesCache() {
    ArrayList<AssistantVo> assistantVoArrayList = new ArrayList<>();
    chat.addListener(new ChatListener() {

        @Override
        public void onGetAssistants(ChatResponse<List<AssistantVo>> response) {
            assistantVoArrayList.addAll(response.getResult());
            chat.removeListener(this);
            resumeProcess();
        }
    });
    GetAssistantRequest request = new GetAssistantRequest.Builder().setCount(25).setOffset(0).build();
    chat.getAssistants(request);
    pauseProcess();
    Collections.shuffle(assistantVoArrayList);
    ArrayList<AssistantHistoryVo> assistantHistoryVos = new ArrayList<>();
    ArrayList<AssistantHistoryVo> assistantHistoryVosCache = new ArrayList<>();
    chat.addListener(new ChatListener() {

        @Override
        public void onGetAssistantHistory(ChatResponse<List<AssistantHistoryVo>> response) {
            print("Received Assistant Histories cache: " + response.isCache());
            prettyLog(App.getGson().toJson(response.getResult()));
            if (response.isCache()) {
                assistantHistoryVosCache.addAll(response.getResult());
            } else {
                assistantHistoryVos.addAll(response.getResult());
            }
            if (assistantHistoryVos.size() == assistantHistoryVosCache.size()) {
                chat.removeListener(this);
                resumeProcess();
            }
        }
    });
    GetAssistantHistoryRequest getAssistantHistoryRequest = new GetAssistantHistoryRequest.Builder().setCount(50).build();
    chat.getAssistantHistory(getAssistantHistoryRequest);
    pauseProcess();
    Assert.assertTrue(true);
}
Also used : AssistantVo(com.fanap.podchat.chat.assistant.model.AssistantVo) ArrayList(java.util.ArrayList) AssistantHistoryVo(com.fanap.podchat.chat.assistant.model.AssistantHistoryVo) ChatListener(com.fanap.podchat.chat.ChatListener) List(java.util.List) ArrayList(java.util.ArrayList) GetAssistantHistoryRequest(com.fanap.podchat.chat.assistant.request_model.GetAssistantHistoryRequest) GetAssistantRequest(com.fanap.podchat.chat.assistant.request_model.GetAssistantRequest) Test(org.junit.Test) LargeTest(android.support.test.filters.LargeTest)

Example 7 with AssistantVo

use of com.fanap.podchat.chat.assistant.model.AssistantVo in project pod-chat-android-sdk by FanapSoft.

the class ChatTestIntegration method deActiveAssistant.

private void deActiveAssistant() {
    // 52987   khodam
    // 103187  nemati
    // invite
    Invitee invite = new Invitee("63253", InviteType.Constants.TO_BE_USER_CONTACT_ID);
    List<AssistantVo> assistantVos = new ArrayList<>();
    AssistantVo assistantVo = new AssistantVo();
    assistantVo.setInvitees(invite);
    assistantVos.add(assistantVo);
    DeActiveAssistantRequest request = new DeActiveAssistantRequest.Builder(assistantVos).build();
    presenter.deActiveAssistant(request);
    pauseProcess();
}
Also used : Invitee(com.fanap.podchat.mainmodel.Invitee) AssistantVo(com.fanap.podchat.chat.assistant.model.AssistantVo) ArrayList(java.util.ArrayList) DeActiveAssistantRequest(com.fanap.podchat.chat.assistant.request_model.DeActiveAssistantRequest)

Example 8 with AssistantVo

use of com.fanap.podchat.chat.assistant.model.AssistantVo in project pod-chat-android-sdk by FanapSoft.

the class ChatTestIntegration method registerAssistantsTest.

@Test
@LargeTest
public void registerAssistantsTest() {
    ChatListener historyListeners = new ChatListener() {

        @Override
        public void onRegisterAssistant(ChatResponse<List<AssistantVo>> response) {
            System.out.println("onRegisterAssistant: " + response.getJson());
            Assert.assertTrue(true);
            resumeProcess();
        }
    };
    chat.addListener(historyListeners);
    registerAssistant();
}
Also used : AssistantVo(com.fanap.podchat.chat.assistant.model.AssistantVo) ChatResponse(com.fanap.podchat.model.ChatResponse) ChatListener(com.fanap.podchat.chat.ChatListener) FlakyTest(android.support.test.filters.FlakyTest) MediumTest(android.support.test.filters.MediumTest) Test(org.junit.Test) LargeTest(android.support.test.filters.LargeTest) LargeTest(android.support.test.filters.LargeTest)

Example 9 with AssistantVo

use of com.fanap.podchat.chat.assistant.model.AssistantVo in project pod-chat-android-sdk by FanapSoft.

the class ChatTestSandbox method registerAssistant.

private void registerAssistant() {
    // 63253 kheirkhah
    // 63254 sajadi
    // //63255 anvari
    // 63256 amjadi
    // 63257 zhiani
    // invite list
    // 52987   khodam
    // 103187  nemati
    Invitee invite = new Invitee("52987", InviteType.Constants.TO_BE_USER_CONTACT_ID);
    // roles
    ArrayList<String> typeRoles = new ArrayList<>();
    typeRoles.add(RoleType.Constants.READ_THREAD);
    typeRoles.add(RoleType.Constants.EDIT_THREAD);
    typeRoles.add(RoleType.Constants.ADD_ROLE_TO_USER);
    List<AssistantVo> assistantVos = new ArrayList<>();
    AssistantVo assistantVo = new AssistantVo();
    assistantVo.setInvitees(invite);
    assistantVo.setContactType("default");
    assistantVo.setRoles(typeRoles);
    assistantVos.add(assistantVo);
    RegisterAssistantRequest request = new RegisterAssistantRequest.Builder(assistantVos).build();
    presenter.registerAssistant(request);
    pauseProcess();
}
Also used : Invitee(com.fanap.podchat.mainmodel.Invitee) AssistantVo(com.fanap.podchat.chat.assistant.model.AssistantVo) ArrayList(java.util.ArrayList) RegisterAssistantRequest(com.fanap.podchat.chat.assistant.request_model.RegisterAssistantRequest)

Example 10 with AssistantVo

use of com.fanap.podchat.chat.assistant.model.AssistantVo in project pod-chat-android-sdk by FanapSoft.

the class ChatTestSandbox method getAssistantTest.

@Test
@LargeTest
public void getAssistantTest() {
    long startTime = System.currentTimeMillis();
    ChatListener historyListeners = new ChatListener() {

        @Override
        public void onGetAssistants(ChatResponse<List<AssistantVo>> response) {
            System.out.println("onGetAssistants: " + response);
            Assert.assertTrue(true);
        }
    };
    chat.addListener(historyListeners);
    getAssistants();
}
Also used : AssistantVo(com.fanap.podchat.chat.assistant.model.AssistantVo) ChatResponse(com.fanap.podchat.model.ChatResponse) ChatListener(com.fanap.podchat.chat.ChatListener) FlakyTest(android.support.test.filters.FlakyTest) MediumTest(android.support.test.filters.MediumTest) Test(org.junit.Test) LargeTest(android.support.test.filters.LargeTest) LargeTest(android.support.test.filters.LargeTest)

Aggregations

AssistantVo (com.fanap.podchat.chat.assistant.model.AssistantVo)25 ArrayList (java.util.ArrayList)19 LargeTest (android.support.test.filters.LargeTest)15 ChatListener (com.fanap.podchat.chat.ChatListener)15 Test (org.junit.Test)15 Invitee (com.fanap.podchat.mainmodel.Invitee)13 ChatResponse (com.fanap.podchat.model.ChatResponse)10 List (java.util.List)9 RegisterAssistantRequest (com.fanap.podchat.chat.assistant.request_model.RegisterAssistantRequest)8 GetAssistantRequest (com.fanap.podchat.chat.assistant.request_model.GetAssistantRequest)7 FlakyTest (android.support.test.filters.FlakyTest)6 MediumTest (android.support.test.filters.MediumTest)6 BlockUnblockAssistantRequest (com.fanap.podchat.chat.assistant.request_model.BlockUnblockAssistantRequest)5 GetAssistantHistoryRequest (com.fanap.podchat.chat.assistant.request_model.GetAssistantHistoryRequest)5 Contact (com.fanap.podchat.mainmodel.Contact)5 Participant (com.fanap.podchat.mainmodel.Participant)5 ResultContact (com.fanap.podchat.model.ResultContact)5 AssistantHistoryVo (com.fanap.podchat.chat.assistant.model.AssistantHistoryVo)4 GetBlockedAssistantsRequest (com.fanap.podchat.chat.assistant.request_model.GetBlockedAssistantsRequest)4 RequestGetContact (com.fanap.podchat.requestobject.RequestGetContact)4