Search in sources :

Example 51 with ChatListener

use of com.fanap.podchat.chat.ChatListener in project pod-chat-android-sdk by FanapSoft.

the class ChatTestSandbox method getHistoryHashtagTest.

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

        @Override
        public void onGetHistory(String content, ChatResponse<ResultHistory> history) {
            System.out.println("onGetHistory: ");
            Logger.json(history.getJson());
            Assert.assertTrue(true);
            resumeProcess();
        }
    };
    chat.setListener(historyListeners);
    RequestGetHistory request = new RequestGetHistory.Builder(8085).offset(0).count(25).order("desc").build();
    presenter.getHistory(request, null);
    pauseProcess();
}
Also used : RequestGetHistory(com.fanap.podchat.requestobject.RequestGetHistory) 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 52 with ChatListener

use of com.fanap.podchat.chat.ChatListener 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)

Example 53 with ChatListener

use of com.fanap.podchat.chat.ChatListener in project pod-chat-android-sdk by FanapSoft.

the class ChatTestSandbox method deActiveAssistantTest.

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

        @Override
        public void onDeActiveAssistant(ChatResponse<List<AssistantVo>> response) {
            System.out.println("onDeActiveAssistant: " + response);
            Assert.assertTrue(true);
        }
    };
    chat.addListener(historyListeners);
    deActiveAssistant();
}
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 54 with ChatListener

use of com.fanap.podchat.chat.ChatListener in project pod-chat-android-sdk by FanapSoft.

the class ContactCacheTest method createChat.

@Before
public void createChat() {
    view = Mockito.mock(ChatContract.view.class);
    chatActivity = chatActivityRule.getActivity();
    presenter = new ChatPresenter(appContext, view, chatActivity);
    RequestConnect rc = new RequestConnect.Builder(socketAddress, APP_ID, serverName, TOKEN, ssoHost, platformHost, fileServer, "podSpaceServer").build();
    chatListeners = new ChatListener() {

        @Override
        public void onChatState(String state) {
            if (state.equals(CHAT_READY)) {
                resumeProcess();
            }
        }
    };
    chat.addListener(chatListeners);
    chat.connect(rc);
    chat.isCacheables(CACHE);
    pauseProcess();
}
Also used : ChatPresenter(com.example.chat.application.chatexample.ChatPresenter) RequestConnect(com.fanap.podchat.requestobject.RequestConnect) ChatListener(com.fanap.podchat.chat.ChatListener) Before(org.junit.Before)

Example 55 with ChatListener

use of com.fanap.podchat.chat.ChatListener in project pod-chat-android-sdk by FanapSoft.

the class ContactCacheTest method populateContactsFromServer.

public void populateContactsFromServer() {
    chatListeners = new ChatListener() {

        @Override
        public void onGetContacts(String content, ChatResponse<ResultContact> response) {
            if (!response.isCache()) {
                System.out.println("Received List: " + content);
                serverContacts.addAll(response.getResult().getContacts());
                chat.removeListener(chatListeners);
                resumeProcess();
            }
        }
    };
    chat.setListener(chatListeners);
    RequestGetContact request = new RequestGetContact.Builder().count(50).offset(0).build();
    chat.getContacts(request, null);
    pauseProcess();
    System.out.println("Received List: " + serverContacts.size());
}
Also used : ResultContact(com.fanap.podchat.model.ResultContact) ChatListener(com.fanap.podchat.chat.ChatListener) RequestGetContact(com.fanap.podchat.requestobject.RequestGetContact)

Aggregations

ChatListener (com.fanap.podchat.chat.ChatListener)134 Test (org.junit.Test)87 RequestThread (com.fanap.podchat.requestobject.RequestThread)80 LargeTest (android.support.test.filters.LargeTest)63 Thread (com.fanap.podchat.mainmodel.Thread)61 ResultHistory (com.fanap.podchat.model.ResultHistory)44 ChatResponse (com.fanap.podchat.model.ChatResponse)40 ResultThreads (com.fanap.podchat.model.ResultThreads)39 RequestMessage (com.fanap.podchat.requestobject.RequestMessage)38 ArrayList (java.util.ArrayList)38 Date (java.util.Date)32 RequestConnect (com.fanap.podchat.requestobject.RequestConnect)31 RequestGetHistory (com.fanap.podchat.requestobject.RequestGetHistory)31 Before (org.junit.Before)31 ChatPresenter (com.example.chat.application.chatexample.ChatPresenter)29 MessageVO (com.fanap.podchat.mainmodel.MessageVO)23 FlakyTest (android.support.test.filters.FlakyTest)21 MediumTest (android.support.test.filters.MediumTest)21 ResultNewMessage (com.fanap.podchat.model.ResultNewMessage)21 Activity (android.app.Activity)18